|
|
| 103 |
|
103 |
|
| 104 |
double totalTime; |
104 |
double totalTime; |
| 105 |
double expMean; |
105 |
double expMean; |
|
|
106 |
double samplingPeriod; |
| 106 |
|
107 |
|
| 107 |
uint32_t bytesTotal; |
108 |
uint32_t bytesTotal; |
| 108 |
uint32_t packetSize; |
109 |
uint32_t packetSize; |
|
|
| 129 |
m_output (name), |
130 |
m_output (name), |
| 130 |
totalTime (0.3), |
131 |
totalTime (0.3), |
| 131 |
expMean (0.1), //flows being exponentially distributed |
132 |
expMean (0.1), //flows being exponentially distributed |
|
|
133 |
samplingPeriod(0.1), |
| 132 |
bytesTotal (0), |
134 |
bytesTotal (0), |
| 133 |
packetSize (2000), |
135 |
packetSize (2000), |
| 134 |
gridSize (10), //10x10 grid for a total of 100 nodes |
136 |
gridSize (10), //10x10 grid for a total of 100 nodes |
|
|
| 172 |
void |
174 |
void |
| 173 |
Experiment::CheckThroughput () |
175 |
Experiment::CheckThroughput () |
| 174 |
{ |
176 |
{ |
| 175 |
double mbs = ((bytesTotal * 8.0) /1000000); |
177 |
double mbs = ((bytesTotal * 8.0) /1000000 /samplingPeriod); |
| 176 |
bytesTotal = 0; |
178 |
bytesTotal = 0; |
| 177 |
m_output.Add ((Simulator::Now ()).GetSeconds (), mbs); |
179 |
m_output.Add ((Simulator::Now ()).GetSeconds (), mbs); |
| 178 |
|
180 |
|
| 179 |
//check throughput every 1/10 of a second |
181 |
//check throughput every samplingPeriod second |
| 180 |
Simulator::Schedule (Seconds (0.1), &Experiment::CheckThroughput, this); |
182 |
Simulator::Schedule (Seconds (samplingPeriod), &Experiment::CheckThroughput, this); |
| 181 |
} |
183 |
} |
| 182 |
|
184 |
|
| 183 |
/** |
185 |
/** |
|
|
| 534 |
CommandLine cmd; |
536 |
CommandLine cmd; |
| 535 |
cmd.AddValue ("packetSize", "packet size", packetSize); |
537 |
cmd.AddValue ("packetSize", "packet size", packetSize); |
| 536 |
cmd.AddValue ("totalTime", "simulation time", totalTime); |
538 |
cmd.AddValue ("totalTime", "simulation time", totalTime); |
|
|
539 |
// according to totalTime, select an appropriate samplingPeriod automaticlly. |
| 540 |
if (totalTime < 1.0) |
| 541 |
{ |
| 542 |
samplingPeriod = 0.1; |
| 543 |
} |
| 544 |
else |
| 545 |
{ |
| 546 |
samplingPeriod = 1.0; |
| 547 |
} |
| 548 |
// or user selects a samplingPeriod. |
| 549 |
cmd.AddValue ("samplingPeriod", "sampling period", samplingPeriod); |
| 537 |
cmd.AddValue ("rtsThreshold", "rts threshold", rtsThreshold); |
550 |
cmd.AddValue ("rtsThreshold", "rts threshold", rtsThreshold); |
| 538 |
cmd.AddValue ("rateManager", "type of rate", rateManager); |
551 |
cmd.AddValue ("rateManager", "type of rate", rateManager); |
| 539 |
cmd.AddValue ("outputFileName", "output filename", outputFileName); |
552 |
cmd.AddValue ("outputFileName", "output filename", outputFileName); |