|
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 |
|
|
| End If
|
| End For
|
|
State 2: Cluster head selection and cluster formation
|
| For each node i
|
| Calculate weight
as in (9) |
| Generate a random number
|
| If
|
| Elect node i to become CH |
| Else if receive Cluster formation message |
| Calculate weight
as in (10) |
| Join the cluster corresponding to the CH
|
| 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
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 |