# Rethinking Modbus-UDP for Real-Time IIoT Systems
## 4 Experimental Results
### Effect of Data Link Errors  
The results shown and commented on in the previous section were obtained in a lab setting and hence with a negligible data link error probability. As a consequence, retransmission mechanisms were rarely exercised, if ever, during the experiments. To better evaluate the difference in performance between the automatic TCP segment retransmission of Modbus-TCP and the customized UDP datagram retransmission of Modbus-UDP, the same experiments were repeated with a simulated random packet loss probability \(p_{l}=10^{-2}\) in both directions of the full-duplex link between the boards. The simulation \begin{table}
\begin{tabular}{c c c c} \hline \hline \multicolumn{3}{c}{**Test Case**} \\
**R/W** & \(\mathbf{N}\) & **Conf. int. of \(\mathbf{\mu_{\text{UDP}}-\mu_{\text{TCP}}\) (us)**} & **Accept** \\ \hline R & 1 & \([-\infty,-1061.8]\) & \(H_{1}\) \\ R & 60 & \([-\infty,-1051.0]\) & \(H_{1}\) \\ R & 120 & \([-\infty,-1102.0]\) & \(H_{1}\) \\ W & 1 & \([-\infty,-1043.2]\) & \(H_{1}\) \\ W & 60 & \([-\infty,-1077.1]\) & \(H_{1}\) \\ W & 120 & \([-\infty,-1067.5]\) & \(H_{1}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: One-tailed \(t\)-tests for the equality of means, comparing \(\mu_{\text{UDP}}\) and \(\mu_{\text{TCP}}\) at significance level \(\alpha=0.001\). \(H_{0}:\mu_{\text{UDP}}=\mu_{\text{TCP}}\), \(H_{1}:\mu_{\text{UDP}}<\mu_{\text{TCP}}\). \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Protocol** & **R/W** & \(\mathbf{N}\) & \(\mathbf{\mu\) (us)} & \(\mathbf{\sigma\) (us)} & **Min (\(\upmu\))** & **Max (\(\upmu\)s)** \\ \hline Modbus-TCP & R & 1 & 1649.08 & 209.63 & 513 & 12,317 \\ Modbus-TCP & R & 60 & 1667.15 & 167.32 & 605 & 11,287 \\ Modbus-TCP & R & 120 & 1700.70 & 188.89 & 734 & 10,363 \\ Modbus-TCP & W & 1 & 1615.28 & 193.38 & 490 & 12,503 \\ Modbus-TCP & W & 60 & 1662.86 & 225.05 & 561 & 12,949 \\ Modbus-TCP & W & 120 & 1676.69 & 217.37 & 538 & 11,924 \\ \hline Modbus-UDP & R & 1 & 580.00 & 105.64 & 477 & 1353 \\ Modbus-UDP & R & 60 & 609.60 & 130.15 & 490 & 1518 \\ Modbus-UDP & R & 120 & 591.87 & 117.42 & 505 & 4962 \\ Modbus-UDP & W & 1 & 565.15 & 112.80 & 482 & 1336 \\ Modbus-UDP & W & 60 & 578.02 & 112.92 & 488 & 5142 \\ Modbus-UDP & W & 120 & 601.35 & 131.83 & 492 & 1852 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Summary statistics of the data shown in Figure 7.  
was performed by means of the built-in Linux kernel firewall configured, on both boards, with the command  
$ iptables -A INPUT - ieth0 -mstatistic -mode random \  -probability 0.01 -j DROP where eth0 is the name of the Ethernet interface used for the experiments. Considering that each experiment collects \(n\) = 10,000 samples, each sample corresponds to one Modbus transaction, and each error-free transaction consists of two UDP datagrams or two TCP segments traveling in opposite directions if data link errors are assumed to be random and independent; this leads to an expected number of errors \(e=n\cdot p_{l}=200\), according to a well-known property of the binomial distribution. In other words, the number of transactions that require a retransmission is expected to be \(e/n=2\%\) of the total. This formula neglects second- and higher-order effects, that is, the possible occurrence of further errors during a retransmission triggered by an error. Figure 8 summarizes the results obtained in the experimental conditions just described. As before, sub-plots (a) and (b) pertain to Modbus-TCP, while (c) and (d) are for Modbus-UDP. Table 5 lists the corresponding summary statistics. The comparison between this second set of experiments with respect to the error-free experiments described in Section 4.3 shows that data link errors affect Modbus-UDP and Modbus-TCP in different ways. Figure 8: Modbus-TCP and Modbus-UDP round-trip time histograms for RH and WM transactions as a function of the number of registers exchanged. Link error probability \(p_{l}=10^{-2}\), \(n\) = 10,000 samples per plot.