# Performance Analysis of Time Synchronization Protocols in Wireless Sensor Networks
## 5 Evaluation Result
### Effect of Message Delay Jitter
#### 5.1.1 Simulation Results  
In this scenario, we wish to evaluate the effect of message delay jitter on the time synchronization protocols. This is a practical aspect of a real network, but it is typically ignored in a theoretical simulation [3; 12; 15; 23; 41]. Using the MAC layer timestamp, both FTSP and GTSP eliminated the send (receive) and channel access delays. However, a small delay caused by interrupt handling and message propagation remained. According to the experiment in [1], the likelihood delay can be several microseconds for interrupt handling. Therefore, a uniform random delay of up to 5 us is set on every message sent.  
\begin{table}
\begin{tabular}{l l l} \hline \hline
**Category** & **Setting** & **Value** \\ \hline \multirow{8}{*}{Common} & Topology & Grid/Random \\  & Number of Nodes & 50 \\  & Transmission Range & 100 m \\  & Network Coverage & 600 m \(\times\) 600 m \\  & Initial Clock Drift & \(\pm\)30-100 ppm \\  & Synchronization Period & 30 s \\  & Oscillator Frequency & 1 MHz \\  & Simulation Time & 7200 s \\  & Number of Executions (per scenario) & 10 \\ \hline \multirow{4}{*}{FTSP} & NUMERTIES\_LIMIT & 4 \\  & Initial Root Node ID & 1 \\  & Regression Table Size & 8 \\ \hline GTSP & JUMP\_THRESHOLD & 10 μs \\ \hline \hline \end{tabular}
\end{table}
Table 1: Setting values in simulation.  
Figure 2 shows the synchronization error between FTSP and GTSP in two settings: with message delay jitter (up to \(5\,\mathrm{\SIUnitSymbolMicro s}\)) and without (implying that the packet is received instantaneously). This is the representative result (with random seed = 10) from 10 independent simulation runs. From the figure, it can be seen that time synchronization error can be reduced significantly in an environment without message delay, and the maximum network errors of both FTSP and GTSP were only approximately \(20\,\mathrm{\SIUnitSymbolMicro s}\). Meanwhile, with message delay jitter, the maximum network errors of FTSP and GTSP increased significantly. However, the error scale of GTSP is smaller than that of FTSP. To clarify, Figure 3 shows the synchronization error of all nodes in a grid topology that used FTSP. These results demonstrate that a higher error occurs as the hop distance from the reference node increases in the presence of message delay jitter.  
Figure 3: Synchronization error between reference node (at 1\(\times\)1) and other nodes in grid topology in two settings: without message delay and with the message delay jitter up to \(5\,\mathrm{\SIUnitSymbolMicro s}\).  
Figure 2: Network error and maximum neighbor error of FTSP and GTSP in two settings: without message delay and with delay jitter up to \(5\,\mathrm{\SIUnitSymbolMicro s}\). Random seed = 10.  
We analyze the effect of message delay on FTSP to obtain the cause and solution for this problem. We observed that the delay variation causes a fluctuation in the compensated drift. Figure 4a compares the logical skew of the nearest node with that of the farthest node with the reference node. Clearly, the logical skew must be close to 1 (implying nodes operating at the same speed as the reference node) and stable to maintain the precision of the synchronized time. In fact, even if the clock drift of the nodes is compensated completely, a minor offset error still appears at the receiving nodes because of the nondeterministic delay in message delivery. It is worth noting that the offset error in this case is not caused by insufficient compensation. Therefore, calculating the drift compensation again is not necessary. In FTSP, the nodes calculate and compensate the clock drift and clock offset each time they receive a timing message. However, these processes are independent of each other. Consequently, the nodes adjust their compensated drift unnecessarily because the offset is caused by delay variation and not by the difference in clock rate. Even though this adjustment of compensated drift is typically small, it is accumulated through each hop in a multi-hop network and will eventually become a large at the farthest nodes.