## 4 Proposed Scheme
### Data Forwarding  
At the beginning of the time window, the trust model of the proposed scheme will allow each UW-sensor to record the performance of the neighboring UW-sensor, as well as the channel condition. After calculating the trust value of the UW-sensors, the UWSNs will exclude UW-sensors with trust values below 0.5 from being pre-selected nodes for data transmission. An explanation as to why the threshold is chosen to be 0.5 will be given in Section 5, Simulation and Analysis of Results. Because of the limitations of hydroacoustic communication, most of the energy of UW-sensors is consumed in sending and receiving datagrams, so to reduce the communication consumption of UW-sensors, the proposed scheme will prioritize the transmission routes in the set of candidate neighbors \(Neighbor_{i}\) to choose the transmission paths taking into account the total cabling distance of the CHs or BNs. But this leads to possible routing voids in the network [31]. To solve the routing voids, before data transmission we need to perform a two-hop availability check on the neighboring nodes to find out the void nodes. After removing the void nodes, a path with a smaller total wiring distance is constructed from the remaining neighbor nodes for transmission. The algorithm for the data forwarding phase is shown in Algorithm 1:  
```
Procedure forwarding data (node \(n_{i}\)) Initialize; Get ID of CH, locations of Neighbor; locations of CH, BN Calculate the trust value of neighboring nodes For \(n_{j}\) in \(network\) do If (\(n_{j}<0.5\).) Exclude \(n_{j}\) from the network; End if End for If (the distance from \(n_{i}\) to \(BN<R_{max}\)) \(n_{i}\) next hop is BN; End if If (\(n_{i}\)! = CH and the distance from \(n_{i}\) to \(BN>R_{max}\)) \(Neighbor_{i}\) - two hop check (\(n_{i}\) ); End if For \(n_{j}\) in \(Neighbor_{i}\) do Calculate the distance from \(n_{j}\) to CH; Calculate the distance from \(n_{i}\) to \(n_{j}\); Calculate the total distance; Check the \(n_{j}\) with the smallest total distance in \(Neighbor_{i}\); Set a timer for \(n_{j}\); Sending packets Update the rate of communication record table End for //supplement  While the timer for \(n_{j}\) is expired If do not get ACK from \(n_{j}\)  Sending packets to next node in \(Neighbor_{i}\) End if End while End procedure
```  
**Algorithm 1**Packet forwarding  
Initialization: when the network model is initialized, the network will initialize the energy, neighbor table, and local communication record table, obtain the remaining energy, location information, and data trust from the previous time window, and obtain other information to cluster the network. The cluster head node will be re-elected at the beginning of each time window, and the ID, as well as the location information of the CH, will be broadcast in the network. The normal underwater nodes will only receive the CH information of the corresponding layer, as well as the information of the BN. Filtering the candidate set: after the trust model excludes the MNs below the threshold from the network, the underwater node \(n_{i}\) checks whether the BN node is within its communication range or not, because the nodes close to the BN nodes in the first layer of the cluster are more likely to be the CH and have to take on more data transmission tasks, so to alleviate the energy consumption of the UW-sensors in this area, these UW-sensors do not transmit packets to the CHs in the first layer. Instead, they transmit data directly to the BN. The other underwater nodes will transmit data to the CH in the same layer. To improve the performance of the UWSNs, the algorithm prioritizes the total wiring distance, and to solve the possible routing void problem, a two-hop availability check is performed on the neighboring nodes to find void nodes before the data transmission. The algorithm finds a node in the neighbor table that is closer to the CH than the source node and checks if this neighbor node has a neighbor node that is closer to the CH and if the neighbor node is a void node.