# Cross-Layer-Aided Opportunistic Routing for Sparse Underwater Wireless Sensor Networks
## 4 CLOR Protocol
### Process of CLOR
#### 4.2.3 Forwarder Selection Algorithm  
Generally, \(SNR\) is estimated based on hardware that can be obtained from the physical layer. Due to the channel variation, an average \(SNR\) (\(ASNR\)) as a valid input of fuzzy logic is considered. We calculate \(ASNR\) by computing the average value of the latest \(M\) packets in the link as below.  
\[ASNR=\frac{1}{M}\sum_{i=N-M+1}^{N}SNR(i) \tag{13}\]  
where \(N\) is the total number of packets that are received in the link. \(M\) is related to the channel status.  
\(PRR\) is defined by the number of successfully received packets at the receiver divided by the total number of packets sent by the sender. We calculate it at the network layer and use exponential window moving average (EWMA) to estimate Smooth \(PRR\) (\(SPRR\)) as below.  
\[SPRR(\alpha,w)=\alpha\cdot PRR_{c}+(1-\alpha)\cdot SPRR \tag{14}\]  
where \(PRR_{c}\) is the \(PRR\) of current transmission, \(\alpha\in[0,1]\) is the moving factor, and \(w\) is the length of the window that is used for link estimation. Here, we take \(\alpha\)= 0.1 and \(w\)= 2 in the simulation.  
In addition, we introduce the advance to sink (\(ATS\)) that reflects the delivery ratio of next hop to the sink, which is defined as below.  
\[ATS=1-\prod_{i=1}^{N_{LHC}}\left(1-PRR_{i->j}\right) \tag{15}\]  
where \(N_{LHC}\) is the number of neighboring nodes with values of \(HC\) smaller than that of the sender, and \(PRR_{i->j}\) is the packet received ratio of the \(i_{th}\) node in the candidate set. This metric is different from [51], where each time, only one forward link is considered in forwarding in an opportunistic network. However, all the next forward links of the candidate node are considered in this paper.  
In addition, to measure the local congestion state, we introduce the congestion degree (\(CD\)), which is defined as below [46].  
\[CD=\frac{\tau_{fw}}{\tau_{arr}} \tag{16}\]  
where \(\tau_{fw}\) is the average value of the time interval for forwarding a packet, and \(\tau_{arr}\) is the average value of the time interval for arriving a packet. When \(CD\) is higher than 1, the arrival rate is higher than the forwarding rate, and the network suffers from congestion.  
Fuzzy Rules  
We calculate the member functions of \(\mu_{ASNR}\), \(\mu_{PRR}\) and \(\mu_{ATS}\) by using a piecewise linear form function of \(\mu_{1}(x)\) and calculate the member function of \(\mu_{CD}\) by using function with a form of \(\mu_{2}(x)\). The parameters [\(a\), \(b\)] of the member functions in our simulation are set as [1.0 dB, 10 dB], [0.15, 0.95], [0.0, 1.0], and [0.1, 1.0] for the \(ASNR\), \(PRR\), \(ATS\), and \(CD\), respectively.  
\[\mu_{1}(x)=\left\{\begin{array}{l}0,x<a\\ \frac{x-a}{b-a}\\ 1,x\geq b\end{array}\right.,a\leq x<b \tag{17}\]  
\[\mu_{2}(x)=\left\{\begin{array}{l}1,x<a\\ \frac{x-a}{b-a}\\ 0,x\geq b\end{array}\right.,a\leq x<b \tag{18}\]  
Then, the output value of fuzzy logic is mapped according to the fuzzy rule as follows:  
**IF** the forward link has high channel quality **AND** the forward link has high packet delivery ratio **AND** the node has high advance to the sink **AND** the node has low congestion degree, **THEN** it has high priority.  
We use Yager AND-like and OR-like operators to produce the value of progress for its compensatory [44; 52].  
\[\begin{array}{l}F_{prg}=\beta\cdot\min(\mu_{1}(ASNR),\mu_{1}( SPRR),\mu_{1}(ATS),\mu_{2}(CD))\\ \hskip 14.226378 pt+(1-\beta)\cdot\text{mean}(\mu_{1}(ASNR),\mu_{1}( SPRR),\mu_{1}(ATS),\mu_{2}(CD))\end{array} \tag{19}\]  
where \(\beta\in[0,1]\) is the weight factor, which is related to the network model and the deployment environment. Here, we set \(\beta\) as 0.9 in this simulation.