Skip to main content
. 2024 Oct 16;24(20):6661. doi: 10.3390/s24206661
Algorithm 1. HECRA
Input: node ID, initial energy, depth
Output: Cluster results
State 1: Network Initialization
    For each node i
     Broadcast HELLO = {node ID}
      If receive HELLO
        Nei=Nei+1
      End If
    End For
State 2: Cluster head selection and cluster formation
    For each node i
     Calculate weight Ti as in (9)
     Generate a random number 0rand1
      If rand<Ti
       Elect node i to become CH
      Else if receive Cluster formation message
       Calculate weight Hj as in (10)
       Join the cluster corresponding to the CH Hj
      Else
       Node goes to sleep
      End If
    End For
State 3: Data transmission
    For all CHs
     Collecting and fusing information from nodes in the cluster
     Broadcast wayfinding message
      If receive wayfinding message
       Determines whether to reply to the sender of wayfinding message
      End If
      If receive messages of confirmation
       Calculate weight ωi as in (11)
       Find the node that forwarded the message
      End If
    End For
State 4: Optimization of the network
   AUV seeks CHs that are unable to communicate with other nodes
   Find the location of the relay transmission
   Assisted in completing data forwarding and continued cruising