|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
25 #include <ns3/uinteger.h>
26 #include <ns3/double.h>
57 static TypeId tid =
TypeId (
"ns3::ThreeGppHttpVariables")
59 .AddConstructor<ThreeGppHttpVariables> ()
62 .AddAttribute (
"RequestSize",
63 "The constant size of HTTP request packet (in bytes).",
66 MakeUintegerChecker<uint32_t> ())
69 .AddAttribute (
"MainObjectGenerationDelay",
70 "The constant time needed by HTTP server "
71 "to generate a main object as a response.",
77 .AddAttribute (
"MainObjectSizeMean",
78 "The mean of main object sizes (in bytes).",
81 MakeUintegerChecker<uint32_t> ())
82 .AddAttribute (
"MainObjectSizeStdDev",
83 "The standard deviation of main object sizes (in bytes).",
86 MakeUintegerChecker<uint32_t> ())
87 .AddAttribute (
"MainObjectSizeMin",
88 "The minimum value of main object sizes (in bytes).",
91 MakeUintegerChecker<uint32_t> (22))
92 .AddAttribute (
"MainObjectSizeMax",
93 "The maximum value of main object sizes (in bytes).",
96 MakeUintegerChecker<uint32_t> ())
99 .AddAttribute (
"EmbeddedObjectGenerationDelay",
100 "The constant time needed by HTTP server "
101 "to generate an embedded object as a response.",
107 .AddAttribute (
"EmbeddedObjectSizeMean",
108 "The mean of embedded object sizes (in bytes).",
111 MakeUintegerChecker<uint32_t> ())
112 .AddAttribute (
"EmbeddedObjectSizeStdDev",
113 "The standard deviation of embedded object sizes (in bytes).",
116 MakeUintegerChecker<uint32_t> ())
117 .AddAttribute (
"EmbeddedObjectSizeMin",
118 "The minimum value of embedded object sizes (in bytes).",
121 MakeUintegerChecker<uint32_t> (22))
122 .AddAttribute (
"EmbeddedObjectSizeMax",
123 "The maximum value of embedded object sizes (in bytes).",
126 MakeUintegerChecker<uint32_t> ())
129 .AddAttribute (
"NumOfEmbeddedObjectsMax",
130 "The upper bound parameter of Pareto distribution for "
131 "the number of embedded objects per web page. The actual "
132 "maximum value is this value subtracted by the scale parameter.",
135 MakeUintegerChecker<uint32_t> ())
136 .AddAttribute (
"NumOfEmbeddedObjectsShape",
137 "The shape parameter of Pareto distribution for "
138 "the number of embedded objects per web page.",
141 MakeDoubleChecker<double> ())
142 .AddAttribute (
"NumOfEmbeddedObjectsScale",
143 "The scale parameter of Pareto distribution for "
144 "the number of embedded objects per web page.",
147 MakeUintegerChecker<uint32_t> ())
150 .AddAttribute (
"ReadingTimeMean",
151 "The mean of reading time.",
157 .AddAttribute (
"ParsingTimeMean",
158 "The mean of parsing time.",
164 .AddAttribute (
"LowMtuSize",
165 "The lower MTU size.",
168 MakeUintegerChecker<uint32_t> (0))
169 .AddAttribute (
"HighMtuSize",
170 "The higher MTU size.",
173 MakeUintegerChecker<uint32_t> (0))
174 .AddAttribute (
"HighMtuProbability",
175 "The probability that higher MTU size is used.",
178 MakeDoubleChecker<double> (0, 1))
223 <<
" must be greater than"
224 <<
" the `MainObjectSizeMin` attribute.");
257 <<
" must be greater than"
258 <<
" the `EmbeddedObjectSizeMin` attribute.");
281 const uint32_t upperBound =
286 <<
" must be greater than"
287 <<
" the `NumOfEmbeddedObjectsScale` attribute.");
376 const double a = std::log (1.0 + (a1 / a2));
378 const double sigma = std::sqrt (a);
379 NS_LOG_DEBUG (
this <<
" Mu= " << mu <<
" Sigma= " << sigma <<
".");
390 const double a = std::log (1.0 + (a1 / a2));
392 const double sigma = std::sqrt (a);
393 NS_LOG_DEBUG (
this <<
" Mu= " << mu <<
" Sigma= " << sigma <<
".");
475 "Shape parameter must not equal to 1.0.");
484 NS_ASSERT_MSG (scale > 0,
"Scale parameter must be greater than zero.");
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
void DoInitialize(void)
Initialize() implementation.
Ptr< ConstantRandomVariable > m_embeddedObjectGenerationDelayRng
Random variable for determining the delay needed to generate an embedded object (in seconds).
double m_highMtuProbability
High MTU size probability.
Ptr< ExponentialRandomVariable > m_parsingTimeRng
Random variable for determining the length of parsing time (in seconds).
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< ConstantRandomVariable > m_requestSizeRng
Random variable for determining request size (in bytes).
uint32_t m_embeddedObjectSizeMax
Upper bound parameter for m_embeddedObjectSizeRng.
Time GetReadingTime()
Draws a random length of time which is spent by a hypothetical human user (HTTP client) to read a web...
uint32_t m_mainObjectSizeMin
Lower bound parameter for m_mainObjectSizeRng;.
void SetEmbeddedObjectGenerationDelay(Time constant)
Time GetMainObjectGenerationDelay()
Returns the constant length of time needed by an HTTP server to generate a main object.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
uint32_t m_numOfEmbeddedObjectsScale
Scale parameter for m_numOfEmbeddedObjectsRng.
void SetParsingTimeMean(Time mean)
void SetNumOfEmbeddedObjectsScale(uint32_t scale)
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
uint32_t m_lowMtu
Lower MTU size.
Ptr< ExponentialRandomVariable > m_readingTimeRng
Random variable for determining the length of reading time (in seconds).
Ptr< LogNormalRandomVariable > m_mainObjectSizeRng
Random variable for determining main object size (in bytes).
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void SetMainObjectSizeMean(uint32_t mean)
void UpdateEmbeddedObjectMuAndSigma(void)
Upon and after object initialization, update random variable Mu and Sigma based on changes to attribu...
void SetEmbeddedObjectSizeMean(uint32_t mean)
ThreeGppHttpVariables()
Create a new instance with default configuration of random distributions.
void UpdateMainObjectMuAndSigma(void)
Upon and after object initialization, update random variable Mu and Sigma based on changes to attribu...
void SetNumOfEmbeddedObjectsShape(double shape)
log2() macro definition; to deal with Bug 1467.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
uint32_t GetRequestSize()
Returns the constant HTTP request size in bytes.
void SetEmbeddedObjectSizeStdDev(uint32_t stdDev)
Ptr< LogNormalRandomVariable > m_embeddedObjectSizeRng
Random variable for determining embedded object size (in bytes).
uint32_t m_highMtu
Higher MTU size.
void SetMainObjectSizeStdDev(uint32_t stdDev)
A base class which provides memory management and object aggregation.
static TypeId GetTypeId()
Returns the object TypeId.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
uint32_t m_embeddedObjectSizeMin
Lower bound parameter for m_embeddedObjectSizeRng.
uint32_t m_mainObjectSizeMax
Upper bound parameter for m_mainObjectSizeRng;.
Time GetParsingTime()
Draws a random length of time which simulate the small delay caused by HTTP client looking for any em...
Simulation virtual time values and global simulation resolution.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< ConstantRandomVariable > m_mainObjectGenerationDelayRng
Random variable for determining the delay needed to generate a main object (in seconds).
uint32_t m_mainObjectSizeStdDev
Standard deviation parameter for m_mainObjectSizeRng;.
Time GetEmbeddedObjectGenerationDelay()
Returns the constant length of time needed by an HTTP server to generate an embedded object.
double GetValue(double constant)
Get the next random value, as a double equal to the argument.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
void SetRequestSize(uint32_t constant)
void SetNumOfEmbeddedObjectsMax(uint32_t max)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
AttributeValue implementation for Time.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< ParetoRandomVariable > m_numOfEmbeddedObjectsRng
Random variable for determining the number of embedded objects.
uint32_t GetMainObjectSize()
Draws a random main object size (in bytes) to be sent by an HTTP server.
uint32_t m_embeddedObjectSizeStdDev
Standard deviation parameter for m_embeddedObjectSizeRng.
uint32_t m_embeddedObjectSizeMean
Mean parameter for m_embeddedObjectSizeRng.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Hold an unsigned integer type.
uint32_t GetMtuSize()
Draws a random value of maximum transmission unit (MTU) size in bytes.
double max(double x, double y)
void SetReadingTimeMean(Time mean)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
uint32_t GetInteger(uint32_t constant)
Get the next random value, as an integer equal to the argument.
double GetValue(double mean, double bound)
Get the next random value, as a double from the exponential distribution with the specified mean and ...
void SetMainObjectGenerationDelay(Time constant)
uint32_t m_mainObjectSizeMean
Mean parameter for m_mainObjectSizeRng;.
uint32_t GetNumOfEmbeddedObjects()
Draws a random integer indicating the number of embedded objects in a main object.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
uint32_t GetEmbeddedObjectSize()
Draws a random embedded object size (in bytes) to be sent by an HTTP server.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Ptr< UniformRandomVariable > m_mtuSizeRng
Random variable for determining MTU size (in bytes).
bool IsInitialized(void) const
Check if the object has been initialized.