Packet Delay can be conveniently calculated from the Packet Trace log file, which can be obtained by enabling packet trace before running the simulation. Follow the steps given below to quickly plot packet delay over simulation time:

  • Run simulation with packet trace enabled.
  • Open packet trace using the "Open Packet Trace" option available in the Simulation Results window, as shown below:

  • Filter only Custom packets from the column Packet Type to plot the delay only for the data packets.

  • Packet Delay at a per packet level can be calculated using the columns APP LAYER ARRIVAL TIME and PHY LAYER END TIME in the packet trace as:

                Packet Delay =PHY_LAYER_END_TIME (US) – APP_LAYER_ARRIVAL_TIME (US)


  • Insert a new column next to the column PHY_LAYER_END_TIME and rename it as "packet delay" and apply the equation mentioned above, to obtain the end to end delay for each packet as shown below: 

  • Use the columns PHY_LAYER_END_TIME and Packet Delay to plot the packet delay with respect to simulation time as shown below:

           


Note: Take care to filter only Application data packets to avoid this calculation for control packets