# Adaptive Power-Controlled Depth-Based Routing Protocol for Underwater Wireless Sensor Networks
## 3 The Proposed Protocol
### Detailed Design of APCDBRP
#### 3.3.2 Data Transmission Phase
Implicit Routing Update Mechanism  
Unlike traditional routing update mechanisms that rely on sending control packets specifically for updating the routing table, the implicit routing update mechanism places more emphasis on completing the routing update process while communicating between nodes, such as sending packets or other control packets. Upon receiving a data packet or control packet, the node first measures the signal strength and reads the information contained in the packet. It then proceeds to iterate through its neighbor list. If the sender of the packet is found in the neighbor list, the node updates the information associated with that particular neighbor. On the other hand, if the sender is not present in the neighbor list, the node evaluates whether the sender satisfies the criteria to become the next hop based on depth information. If the criteria are met, the node adds the sender's information to the neighbor table. If the criteria are not met, the node does not update the routing table. In this protocol, except for the HOLE packet, other packets can be used to update the routing table. The routing update process is outlined in Algorithm 2. ```
1:\(depth_{node}\leftarrow\) depth in routing table of the node
2:\(depth_{packet}\leftarrow\) depth in packet
3:\(sender1D\leftarrow\) sender ID in packet
4:procedureUpdateRoutingTable()
5: calculate the forwarding factor according to Equation (11)
6: calculate the transmitting power level according to Equation (9)
7: update routing table
8:endprocedure
9:
10:procedure Hearing(packet)
11:if\(sender1D\in\) Neighbor list then
12: UpdateRoutingTable()
13:else
14:if\(depth_{packet}\geq depth_{node}\) then
15: UpdateRoutingTable()
16:endif
17:endif
18:endprocedure
```  
**Algorithm 2** Implicit routing update mechanism  
The Details of Data Transmission Phase  
During the data forwarding phase, nodes maintain a queue of pending acknowledgment packets denoted as Q for confirmation because it takes some time for a node to confirm whether a packet has been successfully transmitted after sending it. When a node sends a data packet, it simultaneously sets a timer T and adds the sent packet to Q. If, before the expiration of the timer T, the node detects the next-hop node forwarding the data packet or receives an ACK packet from the next-hop node, it indicates a successful transmission. The node then removes the packet from Q. Otherwise, if the node does not receive any confirmation within the specified time, it considers the data packet transmission to be unsuccessful and initiates the data protection mechanism, which will be discussed in Section 3.3.3. When a node receives a data packet, it follows Algorithm 2 to update its routing table. Then, based on the depth information, the node determines the direction of the packet. Ifthe packet is from the upper direction (surface direction), the node traversal Q. If the packet is in Q, it indicates that the packet has been successfully transmitted, and the node removes it from Q. If the data packet is from the lower direction, the node checks whether it is the intended destination based on the packet header information. If the node is not the destination, it discards the packet. If it is the destination, the node sets the neighbor node with the maximum forwarding factor in its routing table as the new next-hop node and adds the packet to Q. It then compares the optimal transmitting power level to the destination node with the previously recorded transmitting power level of the previous-hop node in the data packet. If the optimal transmitting power level is greater than or equal to the transmitting power level of the previous-hop node, it means that the previous-hop node can listen to the data packet forwarded by the current node, so the current node forwards the data packet directly. Otherwise, the current node sends an ACK packet to the previous-hop node to inform it that the data packet has been successfully received. The data forwarding process is described in Algorithm 3.