• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/packmime/packmime_OL_ranvar.h

00001 /* -*-  Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
00002 
00003 /* 
00004  * Copyright 2002, Statistics Research, Bell Labs, Lucent Technologies and
00005  * The University of North Carolina at Chapel Hill
00006  * 
00007  * Redistribution and use in source and binary forms, with or without 
00008  * modification, are permitted provided that the following conditions are met:
00009  * 
00010  *    1. Redistributions of source code must retain the above copyright 
00011  * notice, this list of conditions and the following disclaimer.
00012  *    2. Redistributions in binary form must reproduce the above copyright 
00013  * notice, this list of conditions and the following disclaimer in the 
00014  * documentation and/or other materials provided with the distribution.
00015  *    3. The name of the author may not be used to endorse or promote 
00016  * products derived from this software without specific prior written 
00017  * permission.
00018  * 
00019  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 
00020  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
00021  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
00022  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 
00023  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
00024  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
00025  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
00026  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
00027  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
00028  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
00029  * POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 /*
00033  * Reference
00034  *     Stochastic Models for Generating Synthetic HTTP Source Traffic 
00035  *     J. Cao, W.S. Cleveland, Y. Gao, K. Jeffay, F.D. Smith, and M.C. Weigle 
00036  *     IEEE INFOCOM 2004.
00037  *
00038  * Documentation available at http://dirt.cs.unc.edu/packmime/
00039  * 
00040  * Contacts: Michele Weigle (mcweigle@cs.unc.edu),
00041  *           Kevin Jeffay (jeffay@cs.unc.edu)
00042  */
00043 
00044 #include "packmime_ranvar.h" 
00045 
00046 #ifndef OL_RANVAR_H
00047 #define OL_RANVAR_H
00048 
00049 #define LOG2 0.6931471806
00050 
00051 struct OL_arima_params {
00052         double d;
00053         int    N;
00054         int    pAR, qMA;
00055 
00056         double varRatioParam0, varRatioParam1, varRatioParam2; 
00057         // 1-2^(p0-p1*log2(rate)^p2)
00058 };
00059 
00060 struct OL_weibull_params {
00061         double shapeParam0, shapeParam1, shapeParam2; 
00062         // 1-2^(p0-p1*log2(rate)^p2)
00063 };
00064 
00065 /*:::::::::::::::::::: PackMimeOL Packet Size RanVar :::::::::::::::::::::::*/
00066 
00067 class PackMimeOLPacketSizeRandomVariable : public RandomVariable {
00068   private:
00069         double varRatio, sigmaNoise, sigmaEpsilon;      
00070         int n_size_dist, *size_dist_left, *size_dist_right;
00071         double connum, bitrate, conbps, conpacrate;
00072         double *size_prob;
00073         double *cumsum_size_prob;
00074         char *pac_size_dist_file;
00075         FARIMA *fARIMA;
00076         RNG* myrng;
00077         virtual double value();
00078         virtual double avg();
00079         int transform(double p);  
00080         void initialize();
00081         void init_dist();
00082         void read_dist();
00083         void bind_vars();
00084         static int def_size_dist_left[];
00085         static int def_size_dist_right[];
00086         static double def_size_prob[];
00087 
00088   public:
00089         PackMimeOLPacketSizeRandomVariable();
00090         PackMimeOLPacketSizeRandomVariable(double bitrate); 
00091         PackMimeOLPacketSizeRandomVariable(double bitrate, RNG* rng);
00092         PackMimeOLPacketSizeRandomVariable(double bitrate, RNG* rng, 
00093                                            const char *pac_size_dist_file);
00094         ~PackMimeOLPacketSizeRandomVariable();  
00095 };
00096 
00097 /*::::::::::::: PackMimeOL Packet Interarrival RanVar :::::::::::::::::::::*/
00098 
00099 class PackMimeOLPacketIARandomVariable : public RandomVariable {
00100   private:
00101         double varRatio, sigmaNoise, sigmaEpsilon;
00102         double shape, scale;
00103         double connum, bitrate, pacrate, conbps, conpacrate;
00104         FARIMA *fARIMA;
00105         RNG* myrng;
00106         RandomVariable *sizerng;
00107         virtual double value();
00108         virtual double avg();
00109         double transform(double p);  
00110         void initialize();
00111         void bind_vars();
00112 
00113   public:
00114         PackMimeOLPacketIARandomVariable();
00115         PackMimeOLPacketIARandomVariable(double bitrate_);  
00116         PackMimeOLPacketIARandomVariable(double bitrate_, RNG* rng_);  
00117         void setPktSizeRng(RandomVariable *sizerng_) {sizerng = sizerng_;};
00118         ~PackMimeOLPacketIARandomVariable();
00119 };
00120 
00121 
00122 #endif /* OL_RANVAR_H */
00123 
00124 
00125 
00126 
00127 

Generated on Tue Aug 10 2010 16:16:07 for ns-2.33 by  doxygen 1.7.1