This tool is designed to analyze network simulation traces generated by the UnetStack simulator. It provides insights into various network parameters such as received packets, throughput, and more.
To understand the purpose of this tool, it's helpful to first run a simulation in UnetStack. During the simulation, the simulator displays statistics for each simulation, including received packets, throughput, and other network parameters. Our goal is to replicate and extend this functionality in a separate script.
We utilize the .nam file generated by UnetStack for our analysis. This file contains information about packet creation, transmission, reception, and drop events, as well as node motion. We chose to use the .nam file over the default .json file due to its simplicity and better documentation.
To obtain the .nam file, insert the following command at the top of your script, as soon as you encounter any other command related to trace:
trace reset; # Reset the trace buffer
trace add -p 0.01 all; # Log all events with 0.01s precision
The trace file contains detailed information that our script parses to extract relevant statistics.
Initially, we encountered issues with double-counting and excluding warm-up time from our analysis. We addressed these problems by using a set to ensure unique packet counts and by ignoring packets with timestamps before the warm-up period.
- Ensure your .nam file is in the same folder as the Python script.
- Run the script with the following command, replacing
your_file.nam
with your actual file name:
python network_analyzer.py "your_file.nam"