# Pido: Predictive Delay Optimization for Intertidal Wireless Sensor Networks
## 4 Design of Pido
### Delay Modeling in Intertidal WSN  
Pido always selects the routing path with the least end-to-end delay among all available paths. For a routing path with \(n\) hops, the end-to-end delay can be represented as follows:  
\[delay=\sum_{i=1}^{n}ld_{i,i+1}+\sum_{j=2}^{n-1}nd_{j+1}. \tag{1}\]  
Before we describe how to calculate the link delay (\(ld\)) and the node delay (\(nd\)) in Equation (1), we summarize our notations in Table 1.  
Modeling of Link Delay and Node Delay  
In the IT-WSN, the poor link quality and dynamic tidal water lead to great delays, and the burstiness of packets makes the situation much worse. To better quantify the end-to-end delay in IT-WSNs, here we separately analyze the link delay (\(ld\)) and node delay (\(nd\)) in Equation (1). **(1) Link Delay:** The link delay comes from the link connection between nodes. In an IT-WSN, due to the change of the environment, \(l_{ij}\) is not always valid, and we use \(l_{ij}(t)\) to present the status of link between \(Node\)\(i\) and \(Node\)\(j\) at discrete time slot \(t\). \(l_{ij}(t)\) can be expressed as:  
\[l_{ij}(t)=\left\{ \begin{array}{ll}0&,d_{ij}>\textbf{R}\textit{ or }S_{i}(t)=0\textit{ or }S_{j}(t)=0,\\ 1&,d_{ij}\leq\textbf{R},\textit{ }S_{i}(t)=1\textit{ and }S_{j}(t)=1.\end{array} \right. \tag{2}\]  
We only evaluate the link quality of \(l_{ij}\) at time \(t\) when \(l_{ij}(t)=1\). To evaluate the link delay caused by \(l_{ij}\), we utilize ETX as an indicator. ETX is an indicator for link quality, which is first proposed by [PERSON] et al. [30], and it is widely utilized in routing path selection, i.e., CTP [16]. The ETX of a link is defined as the expected number of data transmissions required to send a packet over that link (including retransmissions), and the ETX of a route is the sum of the ETX for each link in the route [30]. Here, we take the ETX of a link in Pido. For example, if the ETX of a link is 5, we say the expected transmission times of sending a packet successfully over a link is 5. A smaller value of ETX means better link quality. We define link delay \(ld_{ij}(t)\) as:  
\[ld_{ij}(t)=\left\lfloor\frac{ETX_{ij}(t)}{ReTx}\right\rfloor*T, \tag{3}\]  
where \(ReTx\) is the limit of retransmissions of the system, \(T\) is the time interval of system cycle which is also the basic unit of delay, and \(ETX_{ij}(t)\) is the ETX value of \(l_{ij}\) at time \(t\). For a network with good link quality, the value of \(ETX_{ij}(t)\) is smaller than that of \(ReTx\) generally, i.e., \(ld_{ij}(t)\) is 0, which means a packet can be successfully transmitted within one cycle. However, \begin{table}
\begin{tabular}{c c} \hline \(d_{ij}\) & The physical distance between \(Node\)\(i\) and \(Node\)\(j\). \\ **R** & Transmission range. \\ \(l_{ij}\) & Physical connection between \(Node\)\(i\) and \(Node\)\(j\). \\ \(ETX_{ij}(t)\) & The expected transmission times of \(l_{ij}\). \\ \(ld_{ij}(t)\) & Delay introduced by \(link_{ij}\) at time \(t\) \\ \(nd_{i}(t)\) & Delay introduced by \(Node\)\(i\) at time \(t\) \\ \multicolumn{2}{c}{Current status of \(Node\)\(i\) at time \(t\);} \\ \(S_{i}(t)\) & \(Node\)\(i\) is available at time \(t\) if \(S_{i}(t)=1\) and vice versa. \\ \(S_{i}^{{}^{\prime}}(t+\tau)\) & The predicted status of \(Node\)\(i\) at time \(t+\tau\). \\ \(B_{i}(t)\) & The number of packets buffered in \(Node\)\(i\) at time \(t\). \\ \(C_{i}(t)\) & The number of packets can be sent by \(Node\)\(i\) at time \(t\) in a cycle. \\ \(ReTx\) & The limit of retransmission times in a cycle. \\ \(T\) & The time interval of a system cycle. The basic time unit of delay. \\ \hline \end{tabular}
\end{table} 
Table 1: Notations. in an IT-WSN, the value of \(ETX_{ij}(t)\) is often large due to the the presence of tidal water in our system. Specifically, the link quality depicted in Figure 3 shows that the average ETX in the Zhoushan system is 45, which means a packet needs to wait for nine cycles to be sent successfully given \(ReTx=5\).