## 3 Triangle Metric Based Multi-Layered Routing Protocol
### Data Forwarding  
In this step, the sender's data packets are transmitted toward the distention/sink, as shown in Algorithm 2. The next-hop node should be shallower and much closer to the destination, taking into account the best link quality and high residual energy. Sensors that are closer to the distention have a high chance of transmitting data packets. We estimated the route cost based on TM and residual energy to choose the next-hop node. Therefore, the calculation of route cost is estimated between sensors \((x,y)\) using Equation (6) below:  
\[RoutCost=\left(1-\frac{Re_{y}}{Re_{max}}\right)+\left(1-\frac{\Delta d_{(x,y)} }{\Delta d_{max}}\right) \tag{6}\]  
where \(Re_{y}\) is the residual energy of node \(y\); \(Re_{max}\) is the maximum energy of the node; \(\Delta d_{max}\) is a pre-set metric (i.e., we select \(\Delta d_{max}\) after different simulation scenarios); and \(\Delta d_{(x,y)}\) link quality calculation between \(x\) and \(y\). Equation (6) computes the route based on extraordinary parameters: link quality and residual energy. Primarily based on Equation (6), it is expected that the node located at a lower depth than the sender with satisfactory link quality and higher residual energy may have minimum path cost. Thus, this node could be decided on as an optimal node to transmit packets.  
Figure 5: Hello packet format considered in the proposed underwater networking architecture.  
```
1:procedure GenerateProb(SuperNode)
2:ifProbTimeout is finished then
3: GenerateProbPacket
4:Addid toProbPacket
5:Broadcast(ProbPacket)
6:SetNewTimeout
7:end if
8:end procedure
9:
10:procedureReceiveProb(node\({}_{i}\),ProbPacket)
11:AddProbPacket information tonode\({}_{i}\).NIT
12:end procedure
13:
14:procedureGenerateHello(node\({}_{i}\))
15:ifHelloTimeout is finished then
16: GenerateHelloPacket
17:Addid, depth and residual energy tohello packet
18:Broadcast(hello packet)
19:SetNewTimeout
20:end if
21:end procedure
22:
23:procedureReceiveHello(
24:\(node_{i}\),hello packet)
25:if\(|node_{i}.depth|>|hello packet.depth|\) then
26:if\(|hello packet\) ID is not innode\({}_{i}\).NIT then
27:Addhello packet information tonode\({}_{i}\).NIT
28:else
29:Update information innode\({}_{i}\).NIT
30:endif
31:Call TM(node\({}_{i}\))
32:else
33:Drop (hello packet)
34:endif
35:end procedure
```  
**Algorithm 1** Information Acquisition Phase.  
In Figure 6, the forwarding procedure of the data packets can be concluded as below.  
1. The sender checks if it is the NSN nodes by checking if it is assigned with layer ID, and it forwards the packet to the supernode.
2. Otherwise, it gathers information from the NIT and calculates the route cost based on Equation (6), as discussed above.
3. The sender chooses the next forwarding node with minimum routing cost.
4. The sender then embeds the selected node's ID with the data packets.
5. The receiver nodes then compare ID within the data packet's embedded ID. In this case, the data packet is only accepted by the nodes with the matched ID and ignored by other nodes. This process is repeated until the packet is received by the supernode.
6. The data packets are then forwarded to the sink.  
Figure 6: Flowchart of the underwater data forwarding phase in the proposed architecture.