Research Article
An Energy Efficient Routing Protocol Based on Layers and Unequal Clusters in Underwater Wireless Sensor Networks
Algorithm 2
Next forwarder selection algorithm.
| 1: Procedure forwarder selection | | 2: for each head node Hi | | 3: for each head Hj neihgbors Hi’s LN-1 = Hj’s LN | | 4: calculate H_cost(j) | | 5: end for | | 6: select two nodes as forwarders with two largest H_cost | | 7: send N_DATA packet to forwarder | | 8: end for | | 9: for each node Ni received data packet | | 10: if next hop id1 in received packet = Ni’s id | | 11: if the data packet records | | 12: record data packet | | 13: forward data packet | | 14: else drop the data packet | | 15: end if | | 16: else if next hop id2 in received packet = Ni’s id | | 17: if the data packet records | | 18: record data packet | | 19: waiting for a certain time | | 20: if not receive the same packet | | 21: forward data packet | | 22: else drop the data packet | | 23: end if | | 24: else drop the data packet | | 25: end if | | 26: else drop the data packet | | 27: end if | | 28: end for |
|