# An Efficient Opportunistic Routing Protocol with Low Latency for Farm Wireless Sensor Networks
## 3 Modeling of Wireless Sensor Networks in Farms
### Remaining Opportunistic Path Transmission Cost  
For opportunistic routing in WSN, the transmission path is determined according to candidate sets and forwarding priority. Suppose the candidate set of node \(i\) is \(C_{i}\) = \(\left\{c_{i1},c_{i2},\ldots,c_{in}\right\}\), which has been arranged in ascending order based on the transmission cost \(CQ_{1}<CQ_{2}\) < \(\ldots<CQ_{n}\). If the node \(c_{i1}\) with the highest priority receives the data packet first, then regardless of whether other candidate nodes receive the data packet, \(c_{i1}\) will be regarded as the next hop to forward data.  
\[Cq_{ic1}=\alpha\times(E_{TX}+E_{RX}(i,c_{i1}))\times\frac{1}{T_{ i}}\times cost_{i}\] \[=\alpha\times(E_{TX}+E_{RX}(i,c_{i1}))\times\frac{pe_{i1}}{(1- \prod\limits_{j\in C_{i}}(1-pe_{ij}))}CQ_{1} \tag{7}\]  
where, \(\frac{pe_{i1}}{(1-\prod\limits_{j\in C_{i}}(1-pe_{ij}))}\) is the probability that data are successfully received from node \(i\) to node \(c_{i1}\). \(\alpha\) is the weight parameter. If it is not received successfully, the node with the second priority is selected to transmit. If the candidate node \(c_{i1}\)\(\sim\)\(c_{in-1}\) did not receive the packet successfully until the data are received and forwarded by node \(u\), the remaining opportunity routing transmission cost is:  
\[Cq_{icu}=\alpha(E_{TX}+E_{RX}(i,c_{i1}))\times\frac{\prod\limits_{l=1}^{u-1}{(1- pe_{il})pe_{iu}}}{(1-\prod\limits_{j\in C_{i}}{(1-pe_{ij})})}CQ_{u} \tag{8}\]  
\(\frac{\prod\limits_{l=1}^{u-1}{(1-pe_{il})pe_{iu}}}{(1-\prod\limits_{j\in C_{ i}}{(1-pe_{ij})})}\) is the probability that the data are sent from node \(i\) to \(c_{i1}\)\(\sim\)\(c_{iu-1}\) failed and received successfully by \(c_{iu}\).  
In opportunistic routing, each forwarding node itself is opportunistic forwarding. If the forwarding priority is determined only by the transmission cost of a single node, there may be a problem that packets are transmitted to bad paths. Considering the interaction between links, this paper takes the transmission cost of the candidate set belonging to the current candidate node as the influencing factor. Therefore, the transmission cost \(Cq_{iC_{i}}\) of remaining opportunistic routing is:  
\[\begin{array}{l}Cq_{iC_{i}}=\sum\limits_{j=1}^{n}{Cq_{icj}}\\ =\frac{1}{(1-\prod\limits_{j\in C_{i}}{(1-pe_{ij})})}(\alpha\times(E_{TX}+E_{ RX}(i,c1))\times pe_{ic1}CQ_{1}\\ +\sum\limits_{j=2}^{n}{\alpha\times(E_{TX}+E_{RX}(i,cj))\times pe_{icj}CQ_{j} \prod\limits_{l=1}^{j-1}{(1-pe_{icl})})}\end{array} \tag{9}\]  
The expected transmission cost from node \(i\) to sink is the sum of the anycast transmission cost and the remaining opportunistic routing transmission cost \(CQ_{i}=Ct_{iC_{i}}+Cq_{iC_{i}}\):  
\[\begin{array}{l}CQ_{i}=Ct_{iC_{i}}+Cq_{iC_{i}}\\ =\frac{1}{(1-\prod\limits_{j\in C_{i}}{(1-pe_{ij})})}\times(\frac{\lambda_{i} +1}{\lambda_{\max}})+\\ \frac{1}{(1-\prod\limits_{j\in C_{i}}{(1-pe_{ij})})}(\alpha\times E_{TX}+E_{ RX}(i,c1))\times pe_{ic1}Dc_{i}^{1}+\sum\limits_{j=2}^{n}{\alpha\times(E_{TX}+E_{ RX}(i,cj))})\times pe_{icj}Dc_{i}^{j-1}(1-pe_{icl}))\end{array} \tag{10}\]