Skip to main content
. 2019 May 26;19(10):2402. doi: 10.3390/s19102402
Algorithm 5 Cooperative communication.
  • 1:

    Child u sending data to Parent Pu

  • 2:

    if Beacon or ACK not received from Pu within t then

  • 3:

        sender waits for the beacon from its sibling

  • 4:

    end if

  • 5:

    if Child u receives a beacon from its sibling s then

  • 6:

        sends its data packet with relay indicator

  • 7:

    else

  • 8:

        Child u waits for another t time

  • 9:

        if child gets beacon from neighbor n then

  • 10:

            check the hopcount from beacon

  • 11:

            if hopcountn1 ≤ hopcountu then

  • 12:

               sends data to neighbor n

  • 13:

               change parent of u to n

  • 14:

            else

  • 15:

               waits for beacon from another neighbor n

  • 16:

            end if

  • 17:

        end if

  • 18:

    end if