I am trying to write my own python script to compute the statistics calculated by UNET Stack. I have generated the.nam trace file for the ALOHA sample file and I am writing my script to do the following:
compute received packets
compute enqueued packets (sent)
compute dequeued packets (sent)
compute dropped packets
using what is written in the handbook (https://unetstack.net/handbook/unet-handbook_discrete_event_simulation.html), my script computes received packets by detecting if the line in the trace starts with 'r' and if it does, I increment my counter. Similarly, if a line starts with 'd', I increment the dropped packet count & similarly for enqueued & dequeued packets as well.
My statistics are not matching with the values shown by UNET Stack for each simulation.
I do not understand where the error lies and I would be very glad if anyone could help me out.
I expect to get a similar output to the results shown when I run the ALOHA file in UnetSim but I receive a different result using the logic stated above. I have attached the .nam file incase anyone wants to check it out.
.nam file -> https://drive.google.com/file/d/15LilwmV2uTOvDy76Y1ZRG2JR1qPa_0Cs/view?usp=sharing
A quick look at the stats brings up two things:
You seem to be accounting for receiving 3x the number of frames transmitted, i.e., maybe ignoring the destination address and so triple-counting?
The number of transmissions shown in the expected results is smaller than the number of transmissions you see; maybe the time over which the expected results were computed is shorter from the time over which the nam file is logged? I believe the tracer stats use a warm-up period during which transmissions are ignored for stats (but they'll be logged).