Jitter is defined as the variation in the packet delay.
Packet Jitter ( µs ) for any given packet = | End to end delay of current packet - End to end delay of the previous packet |
Jitter ( µs ) for the entire application = Total Packet Jitter of all successful packets / (Total number of successfully received packets - 1)
A minimum two packets needs to be received at the destination to calculate jitter.
Calculating Jitter through the Packet Trace.
Consider the following scenario in WSN with two Sensors and a Sink Node, with Sensor Application configured from Wireless_Sensor_1 to Wireless_Sensor_2 with Packet Size 50B and Inter Arrival Time of 1s. (Experiment file attached)
Enable Packet Trace and simulate the scenario
1. Open packet trace and filter the CONTROL_PACKET_TYPE field to Data packets (App1_SENSOR_APP in this scenario)
2. Insert a column after PHY_LAYER_END_TIME to calculate the difference between Physical layer End Time and Application Layer Arrival Time as shown in the below
3. Apply the following code in the column created :
4. Insert a column after Column1 to calculate the Packet Jitter
5. Calculate the Packet Jitter by the formula
Packet Jitter (µs) for any given packet = | End to end delay of current packet - End to end delay of the previous packet |
The Packet Jitter can be calculated in the trace using the formula
The absolute value represents the jitter
6. From the current value obtained drag the column upto the last value and note down the Sum obtained
The sum obtained 93723 is the Total Packet Jitter value.
7. Now, note down the number of Packets Received from the Application Metrics present in the results dashboard.
8. Hence, Jitter = Total Packet Jitter of all successful packets / (Total number of successfully received packets - 1)
= 93723 / (100-1) = 946.69697 µs
9. The Jitter obtained in the results dashboard is available in the Application Metrics.
Note that in order to reconcile Jitter value between the trace file and the Results-dashboard, packets should not get fragmented.
With fragmentation, the calculation of Jitter from the trace file becomes complicated since the delay experienced by each packet is associated with the delay experienced by each of its segments. Also take care that Jitter is only calculated on "successful" packets and that "errored" or "collided" packets are not used in the calculations
Therefore, reduce the packet size to avoid fragmentation when you want to reconcile Jitter results. You can adjust the packet inter-arrival time in the application settings to attain a required generation rate.
Articles that can be referred to:
How do I introduce jitter in NetSim simulations / emulations?
In NetSim how do I measure 'Jitter' from the output results ?