Skip to main content
. 2018 Oct 30;18(11):3697. doi: 10.3390/s18113697
Algorithm 3. The routing protocol
  • 1. 

    Assuming that the sensing data from node vs is forwarded along its optimal path on the spanning tree to the mobile sink;

  • 2. 

    When an intermediate node vm receives the sensing data:

  • 3. 

    if (its father node vn is in working status)

  • 4. 

    Forward the sensing data to vn;

  • 5. 

    vn employs this routing protocol to forward the data;

  • 6. 

    else      //vnis in sleeping status

  • 7. 

    if (vm has neighbors on the spanning tree)

  • 8. 

    for each neighbor vi do

  • 9. 

    Calculate Pvmvi according to Equation (14);

  • 10. 

    Calculate the PC of the path vm-vi-vsink;

  • 11. 

    end for

  • 12. 

    Select the neighbor that on a path with a max value of PC as the forwarder;

  • 13. 

    Forward the sensing data to this forwarder;

  • 14. 

    The forwarder employs this routing protocol to forward the data;

  • 15. 

    else

  • 16. 

    Stop forwarding this data;

  • 17. 

    end if

  • 18. 

    end if