|
Algorithm 1 Proposed Algorithm |
| 1. |
Initialize: |
| 2. |
N = total nodes |
| 3. |
Dead = 0 //the number of dead nodes. |
| 4. |
Begin |
| 5. |
for i = 1:N
|
| 6. |
if
//If node is alive |
| 7. |
Cluster formation |
| 8. |
Record the ID of node |
| 9. |
if The sensor nodes need to forward the data |
| 10. |
The sensor nodes forward the data |
| 11. |
else
|
| 12. |
Calculate the sleep threshold
|
| 13. |
if
|
| 14. |
The sensor node remains idle listen |
| 15. |
else
|
| 16. |
The sensor node will enter the sleep state from idle listening |
| 17. |
end if
|
| 18. |
end if
|
| 19. |
else
|
| 20. |
Dead = Dead +1 |
| 21. |
if
Dead ≥ N
|
| 22. |
End of simulation |
| 23. |
end if
|
| 24. |
end if
|
| 25. |
end for |