# An Energy-Efficient and Obstacle-Avoiding Routing Protocol for Underwater Acoustic Sensor Networks
## 4 Design of Energy-Efficient and Obstacle-Avoiding Routing Protocol
### The Fuzzy Logic-Based Forwarding Relay Selection  
In EOAR, the fuzzy logic system [30] is used to calculate the forwarding probability of the sensor nodes from the candidate forwarding relay set. Fuzzy logic system is multi-valued logic with multiple truth values, which uses continuous multiple values or membership function values between 0 and 1. Figure 4 shows the structure of fuzzy logic system which contains four parts: fuzzifier, inference engine, fuzzy rule base and defuzzifier. Commonly used fuzzy inference types are the Mamdani method and the Sugeno method. The difference between the two methods is the way to obtain the output. In this paper, Mamdani method is used and three input variables: propagation delay ratio (PDRA), cosine of the included angle (CIA) and residual energy ratio (RER) are set. Then, the fuzzy if-then rules are determined, and finally the desired output value is inferred. The centroid algorithm is used in the defuzzification phase. The input-output mapping function \(f_{i}\) for the fuzzy logic inference system established for each node in the candidate forwarding relay set can be expressed as:  
\[P\left(n_{s}^{j}\right)=\ f_{i}\left\{Re\left(n_{s}^{j}\right),\ cos\theta \left(n_{s}^{j}\right),\ P_{d}\ \left(n_{s}^{j}\right)\right\} \tag{5}\]  
The specific description of the three input variables is as follows:  
* \(Re\left(n_{s}^{j}\right)\) denotes the RER of sensor nodes. The calculation formula is as follows: \[Re\left(n_{s}^{j}\right)=\frac{Er\left(n_{s}^{j}\right)}{E_{I}\left(n_{s}^{j}\right)}\] (6) where \(Er\left(n_{s}^{j}\right)\) and \(E_{I}\left(n_{s}^{j}\right)\) are the residual energy and the initial energy of each candidate forwarding relay, respectively. * \(cos\theta\left(n_{s}^{j}\right)\) represents the CIA between the current node and its neighbor nodes. * \(P_{d}\ \left(n_{s}^{j}\right)\) denotes the PDRA of a candidate forwarding relay. The calculation formula can be expressed as: \[P_{d}\ \left(n_{s}^{j}\right)=\frac{Dt\left(n_{s}^{j}\right)}{D_{m}}\] (7) \[D_{m}=\left(\frac{R_{m}}{v_{sound}}\right)\] (8) where \(Dt\left(n_{s}^{j}\right)\) denotes the propagation delay from the current node to its neighbor node \(n_{s}^{j}\). Specifically, the propagation delay can be obtained by subtracting the time-stamp included in the packet from the time when the data packet is received by \(n_{s}^{j}\). \(R_{m}\) is the pre-defined maximum  
Figure 4: The fuzzy logic-based forwarding relay selection scheme. transmission distance. The underwater acoustic speed \(v_{sound}\) (m/s) is the function of depth, temperature and salinity of seawater [31]:  
\[ \begin{array}{c}v_{sound}=1448.96+4.591T-5.304\times 10^{-2}T^{2}+2.374\times 10^{- 2}T^{3}\\ +1.340(S-35)+1.63\times 10^{-1}+1.675\times 10^{-7}D^{2}\\ -1.025\times 10^{-2}T(S-35)-7.139\times 10^{-13}TD^{3}\end{array}  \tag{9}\]  
where \(T\) is the temperature in degree Celsius, \(S\) is the salinity in parts per thousand, and \(D\) is the depth in meters. The input variables of fuzzy logic system and their linguistic levels are listed in Table 1.  
The membership function of the triangle and the trapezoid is used in the fuzzifier to simplify the calculation. For an instance, Figure 5 shows the membership function for the RER, CIA, PDRA, respectively, which uses the triangular and the trapezoidal form. This paper defines 18 fuzzy rules used in fuzzy logic-based forwarding relay selection scheme. Table 2 shows the rules based on inference engine. According to this rule, the three variables of the input are fuzzed to obtain the fuzzy set. Finally, the fuzzy set is defuzzified to obtain a single accurate value. The accurate value of each candidate forwarding relay is expressed as the probability that the node is responsible for forwarding the packets. \begin{table}
\begin{tabular}{l l l l} \hline \hline \multicolumn{1}{c}{**Input**} & \multicolumn{2}{c}{**Membership**} \\ \hline RER & Low & Medium & High \\ CIA & Minimum & Medium & Maximum \\ PDRA & Short & Long & – \\ \hline \hline \end{tabular}
\end{table}