Research Article
An Energy Efficient Routing Protocol Based on Layers and Unequal Clusters in Underwater Wireless Sensor Networks
Algorithm 1
Cluster formation algorithm.
| 1: Procedure cluster formation | | 2: for each node Ni | | 3: calculate the layer number LN | | 4: Ni < − LN | | 5: end for | | 6: for each node Ni | | 7: broadcast N_HELLO | | 8: end for | | 9: for each node Ni received N_HELLO packet | | 10: if node’s LN in received packet = Ni’s LN | | 11: record message of neighbors | | 12: else drop the packet | | 13: end if | | 14: end for | | 15: for each node Ni | | 16: if LN ≠ 1 | | 17: Ni calculate Tc | | 18: end if | | 19: end for | | 20: for each node Ni | | 21: while Tc does not expire | | 22: end while | | 23: if did not receive N_COM packet | | 24: calculate competition radius Rc | | 25: broadcast N_COM packet within Rc | | 26: else CH(Sj) < -N_COM packet | | 26: end if | | 27: end for | | 28: for each node received N_COM packet | | 29: calculate cost (i) value | | 30: send the N_JOIN packet | | 31: end for | | 32: for each head node | | 33: record the member nodes | | 34: end for | | 35: end procedure |
|