2

I want to calculate the number of the dropped packet for a simulation in UnetStack using trace.json file. I know that, in trace.nam file, there is an event recorded with 'd' for every dropped packet but how do I calculate the no of the dropped packet for a simulation in UnetStack3 using trace.json

I have written a python script to calculate the tolat transferred packet and total received packet.

The pseudo-code is:-

for every event { // transfered packet count if(stimulus[sender] == phy and stimulus[recipient] == phy and response[clazz] == TxFrameNtf) { transfered_packet_count ++; save the message_id of the event to match with the receiving packet event } //Receiveing packet count if(stimulus[sender] == phy and stimulus[recipient] == phy and you get a matching message_id event) { if(response[recipient] != '#phy__snoop__ntf' and response[clazz] != 'BadFrameNtf' and res['clazz'] == 'RxFrameNtf'): received_packet_count ++; } }

I tested this code on the aloha simulation trace file. I am getting a little more packet_transfered_count and packet_receiving_count. please, help me with what condition I am missing?

get the whole python script here

1 Answers1

0

Unlike trace.nam, currently there aren't any entries in trace.json corresponding to dropped packets.

You may, however, infer dropped packets by comparing the HalfDuplexModem$TX entries in trace.json (which correspond to the arrival of a frame at a node) with corresponding RxFrameNtf/BadFrameNtf entries (which correspond to whether the frame was successfully received or damaged).

Mandar Chitre
  • 2,110
  • 6
  • 14
  • I wrote a python script considering your reply. I am not able to get the exact out as expected. I updated my question please help me. – Harendra Singh May 11 '22 at 06:43
  • You may want to post a link to your trace file too, so someone can test your script against it and reproduce the problem. – Mandar Chitre May 13 '22 at 05:24
  • you can find the script here[link](https://drive.google.com/file/d/1nPEPH8nsCxed8q-bSzFMlcfZFh6KatoK/view) – Harendra Singh May 13 '22 at 10:34
  • That's the script, not the trace file. – Mandar Chitre May 16 '22 at 10:30
  • [here](https://drive.google.com/drive/folders/1yfwXHc-1oEpF4grwrGnXiVVPdTq1r-OS?usp=sharing) I am sharing the folder containing the trace file, python script, and a text file containing the output of unet simulator result and my script result. Please download the folder, open the folder in the terminal and run the script to see the output. I am including a text file containing the result obtained by the unet simulator to see the difference between my result and the actual result. Please let me know why I am not getting the expected result. – Harendra Singh May 17 '22 at 05:12
  • How were the `TX count` and `RX count` in the `simulation result` generated? Without knowing that, it's hard to know why there is a difference between what you got from your analysis script. – Mandar Chitre Jun 07 '22 at 12:11
  • Actually, My code is correct, the difference in the TxCount and the RxCount is because in the simulation script the statics is being calculated after warmup time. that is why I was getting a few more counts. – Harendra Singh Jun 07 '22 at 17:33