Skip to main content
. 2023 Apr 8;23(8):3824. doi: 10.3390/s23083824
Algorithm 2: Predict the remaining lifetime of the network
  1. Procedure: Find network lifetime

  2. Input: K (Number of nodes), R, E (the set of all nodes’ remaining battery);

  3. Output: L recording the lifetime of each node in R;

  4. For iR do

  5. |  Regard node i as relay r, and get remaining energy of all nodes (Ej,j=1,,K);

  6. |  For j = 1, 2, …, K, ji do

  7. |  |  Calculate the transmission power of node j (Pji);

  8. |  |  Lifetimeji=Ej/Pji;

  9. |  End

  10. |  Network lifetime computation: Li=minjLifetimeji;

  11. End

  12. Return L;