# EE-UWSNs: A Joint Energy-Efficient MAC and Routing Protocol for Underwater Sensor Networks
## 3 The Proposed EE-UWSNs Protocol
### The Mechanism of the EE-UWSNs Protocol  
Figures 3 and 4 show the flowcharts that display the proposed EE-UWSNs protocol from the sender side and receiver side, respectively. Dashed boxes illustrate the contribution of the proposed protocol at the level of MAC and routing layers. To explain the proposed protocol, an example is given in this section. Figure 5 displays a network of underwater sensor nodes deployed randomly at different depths. There is a source sensor node called S1 and a set of relay sensors including S2-S7. S3, S4, S5, S6, and S7. Sensor S7 is located outside the cone of S1. In addition, there is one sink at the water surface. In the beginning, the transmission is done at the minimum power level (P1). The power level can be increased if there are no nodes in a particular area. There is a specific number of power levels (i.e., from P1 to PN). Every power level has a transmission radius. Sensors located inside this radius will respond. The proposed protocol limits the transmission, using a cone angle. Let us draw an imaginary line between the source node (S1) and the sink. The cone of angle \(\theta\) originates from the sender toward the sink. If sensor node S1 needs to send data to the surface sink, it will transmit an RTS packet to its neighbors, as shown in Figure 6. The RTS packet is a small control packet that includes the location of the source node (S1) and the desired destination (sink). When a node receives S1's multicast RTS, it needs to decide if it can be a relay node or not. This is accomplished by determining its position with respect to the line between S1 and the sink. If a node is placed inside a cone of the angle, it will reply with a CTS packet that contains its location, sink location, and the value of consumed energy. The consumed energy refers to the summation of energy consumed in transmissions (tx-energy) and in receptions (rx-energy). If a node is located outside the cone, it will not reply (S7 in this example). There is an assumption that the sink location is known for every node in a network. In this example, there are five nodes inside the transmission cone that can be reached at the power level P1, which are S2-S6. Therefore, these nodes will reply with CTS packets. After transmitting multiple CTS packets back to the sender, it selects one node as a candidate node based on the score value, which is calculated based on the values included in the CTS packets, as follows:  
\[Score=\frac{D_{i}}{Max(D)}+\frac{E_{i}}{Max(E)} \tag{1}\]  
where \(D_{i}\) and \(Max(D)\) are the distance between a node \(i\) and the sink and the maximum distance to the sink, respectively. \(E_{i}\) is the energy consumption of a node i and \(Max(E)\) is the maximum energy consumption. The sender selects the node that has the lowest score value to be a candidate. If more than two nodes have responded, the sender selects a set of them (e.g., half of them), that have high score values, to be in inactive mode. This is accomplished by transmitting an inactivation packet (INACT) that contains a list called \"inactive list\". The inactive list contains the names of nodes that will be entering inactive mode. The length of the INACT packet depends on the number of nodes in the list. \[PacketLength_{INACT}=ceiling(log_{2}(N))*N_{INACT} \tag{2}\]  
where \(N\) and \(N_{INACT}\) are the total number of nodes and the number of nodes in the inactive list, respectively. If the number of active nodes exceeds a specific threshold (e.g., seven nodes), the excess number of active nodes will be added to the inactive list based on the maximum score value. In the example, it is assumed that the descending order of the responding nodes, based on score values, is as follows: S3, S2, S5, S4, S6. Node S6 has the lowest score value, so it will be selected as a relay node. Suppose that the required proportion of inactive nodes is 50% and the maximum number of active nodes (i.e., active node threshold) is seven.