## 6 Optimization of Routing Decision in WSNs with Different-Success-Rate Links  
### Metric of Link Quality  
Since ETX can easily characterize network throughput and energy consumption of nodes, and also affect end-to-end delay, this paper selects it as the path selection criteria in the case of considering coding opportunities to find a high-throughput path in a network with different link quality.  
The minimum ETX of forwarding a packet from a source node to a destination node (including the number of retransmission) is used as the path selection criteria. The ETX of a link is calculated based on the transmission success rate of the link, for example, the ETX of a link whose transmission success rate is 50% is two. The ETX of a path is the sum of the ETXs of all the links included in the path, for instance, the ETX of a path containing three lossless links is three.  
The transmission success rate of a link is calculated by the forward and reverse transmission success rates of the link. The forward transmission success rate \(q_{f}\) is the successful probability of delivering a packet to the receiver. The reverse transmission success rate \(q_{r}\) is the successful probability of receiving an acknowledgment packet ACK from the sender. Therefore, the transmission success rate of the link is \(q_{r}\times q_{f}\). If the sender does not receive the acknowledgment ACK from the receiver, the packet will be retransmitted. Since each attempt to transmit a packet can be viewed as a Bernoulli experiment, the ETX of the link is \(1/(q_{r}\times q_{f})\).  
In addition, for the measurement of transmission success rate, the forward and reverse transmission success rates \(q_{f}\) and \(q_{r}\) are measured by using a dedicated link probe packet. Each node broadcasts a dedicated link probe packet with a fixed size every \(\tau\) seconds. In order to avoid synchronization, there is a jitter (\(\pm 0.1\tau\) seconds) in each probing. Each node needs to store the probe packets received in the last \(win\) seconds. Nodes can be allowed to calculate their successful transmission probabilities at any time \(t_{i}\):  
\[q(t_{i})=count(t_{i}-win,t_{i})/(win/\tau) \tag{4}\]  
where \(count(t_{i}-win,t_{i})\) represents the number of probe packets received during the last \(win\) seconds, and \((win/\tau)\) indicates the number of probe packets that should be received when the transmission links are lossless. In general, when the link direction is \(A\to B\), the node \(A\) can measure the transmission success rate \(q_{r}\), and the node \(B\) can measure the transmission success rate \(q_{f}\). Since the node \(B\) defaults to receiving a probe packet from the node \(A\) every \(\tau\) time intervals, it can accurately calculate the current transmission success rate \(q_{f}\) according to the number of the packets actually received and that should be received. In this way, the node \(A\) can also get the current transmission success rate To calculate the ETX of a link needs \(q_{f}\) and \(q_{r}\) simultaneously. Each probe packet sent by the node \(A\) contains the number of probe packets received by the node \(A\) from its each neighbor node in the last _win_ seconds. So this can allow the node \(B\) to be also able to calculate \(q_{r}\) whenever a probe packet from the node \(A\) is received by the node \(B\). Likewise, the node \(A\) can also get \(q_{f}\). In a word, all nodes can obtain the corresponding \(q_{f}\) and \(q_{r}\) of the related links and calculate the transmission success rates and ETXs of the links.