Bug #53
closed
Remove getPER() from uwcbr and uwapplication modules
0%
Description
Both UwCBRModule and UwApplicationModule have the same method to compute the packet error rate:
double
UwCbrModule::GetPER() const
{
if (drop_out_of_order_) {
if ((pkts_recv + pkts_lost) > 0)
return ((double) pkts_lost / (double) (pkts_recv + pkts_lost));
} else {
if (esn > 0)
return (1 - (double) pkts_recv / (double) esn);
}
return 0;
}
esn is the expected sequence number and is updated with the sequence number + 1 of the last received packet. And pkts_lost is computed as follows inside the recv() method:
if (drop_out_of_order_) {
if (uwcbrh->sn() > esn) {
incrPktLost(uwcbrh->sn() - (esn));
}
}
Meaning it also depends on esn.
In the case where drop_out_of_order is set to 0, if from a certain point of the simulation I don't receive any new packet, the per computation will be wrong because the receiver doesn't know how many packets were sent.
Example : If the sender transmits 100 packets but the receiver only gets the first 50 before the link fails, esn remains 50. The resulting PER is 1 - 50/50 = 0, which is incorrect (the actual PER is 50%).
The problem persists also in the case where drop_out_of_order is set to 1 because pkts_lost is based on esn.
Solution:
Remove this method compute the PER from tcl as the number of packets received over the sent ones (as we always do anyways).