#include <source.h>
Public Member Functions | |
SourcePareto (int16u id, int16u prior, pct_size_t pct_sz, pct_size_t preamble, DOUBLE load, DOUBLE on_shape, DOUBLE off_shape) | |
virtual | ~SourcePareto () |
virtual void | SetLoad (DOUBLE load) |
Private Member Functions | |
virtual int32u | GetBurstSize (void) |
virtual bytestamp_t | GetGapSize (void) |
Private Attributes | |
bytestamp_t | MinGap |
DOUBLE | ONShape |
DOUBLE | OFFShape |
Definition at line 131 of file source.h.
SourcePareto::SourcePareto | ( | int16u | id, | |
int16u | prior, | |||
pct_size_t | pct_sz, | |||
pct_size_t | preamble, | |||
DOUBLE | load, | |||
DOUBLE | on_shape, | |||
DOUBLE | off_shape | |||
) | [inline] |
Definition at line 143 of file source.h.
00149 : Source( id, prior, pct_sz, preamble ) 00150 { 00151 ONShape = on_shape; 00152 OFFShape = off_shape; 00153 00154 SetInRange<DOUBLE>( ONShape, MIN_ALPHA, MAX_ALPHA ); 00155 SetInRange<DOUBLE>( OFFShape, MIN_ALPHA, MAX_ALPHA ); 00156 00157 SetLoad( load ); 00158 Reset(); 00159 }
virtual SourcePareto::~SourcePareto | ( | ) | [inline, virtual] |
virtual int32u SourcePareto::GetBurstSize | ( | void | ) | [inline, private, virtual] |
virtual bytestamp_t SourcePareto::GetGapSize | ( | void | ) | [inline, private, virtual] |
virtual void SourcePareto::SetLoad | ( | DOUBLE | load | ) | [inline, virtual] |
Implements Source.
Definition at line 162 of file source.h.
00163 { 00164 SetInRange<DOUBLE>( load, 0.0, 1.0 ); 00165 // ev << "LOAD: " << load << endl; 00166 /* Given 00167 * a - shape parameter of a Pareto distribution (on_shape and off_shape) 00168 * b - minimum value from a Perto distribution 00169 * q - maximum (cutoff) value 00170 * 00171 * For Pareto distribution, mean values are calculated as 00172 * mean = (a*b) / (a-1); 00173 * However, for a series of bounded [b..q] Pareto-distributed values 00174 * mean = [(a*b) / (a-1)] * [1 - (b/q)^(a-1)] 00175 * But, q = b / s^(1/a) (see function "_pareto_(a)" in _rand.h) 00176 * s - smallest non-zero uniformly distributed value 00177 * Thus, 00178 * mean = [(a*b) / (a-1)] * [1 - s^(1-1/a)] 00179 * mean = b * [1 - s^(1-1/a)] / (1-1/a) = b * coef 00180 * where coef = [1 - s^(1-1/a)] / (1-1/a) 00181 */ 00182 DOUBLE on_coef = (1.0 - pow(SMALL_VAL, 1.0 - 1.0/ONShape)) / (1.0 - 1.0/ONShape); 00183 DOUBLE off_coef = (1.0 - pow(SMALL_VAL, 1.0 - 1.0/OFFShape)) / (1.0 - 1.0/OFFShape); 00184 00185 // ev << " SMALL VALUE: " << SMALL_VAL << endl; 00186 // ev << " ON SHAPE: " << ONShape << endl; 00187 // ev << " OFF SHAPE: " << OFFShape << endl; 00188 // ev << " ON COEFFICIENT: " << on_coef << endl; 00189 // ev << " OFF COEFFICIENT: " << off_coef << endl; 00190 00191 /* (1) MEAN_BURST = MIN_BURST * on_coef 00192 * (2) MEAN_GAP = MIN_GAP * off_coef 00193 * 00194 * MEAN_BURST*PACKET_SIZE 00195 * (3) LOAD = ---------------------------------------------- 00196 * MEAN_BURST*(PACKET_SIZE + PREAMBLE) + MEAN_GAP 00197 * 00198 * (4) MEAN_GAP = MEAN_BURST * [ PACKET_SIZE * (1 - LOAD) / LOAD - PREAMBLE ] 00199 * 00200 * on_coef PACKET_SIZE 00201 * (5) MIN_GAP = -------- * MIN_BURST * [ ----------- - (PACKET_SIZE + PREAMBLE)] 00202 * off_coef LOAD 00203 */ 00204 MinGap = SetGap((on_coef/off_coef) * MIN_BURST * (PctSize/load - PctSpace)); 00205 // ev << " MINIMUM GAP: " << MinGap << endl; 00206 }
bytestamp_t SourcePareto::MinGap [private] |
DOUBLE SourcePareto::OFFShape [private] |
DOUBLE SourcePareto::ONShape [private] |