Skip to main content
. 2019 Dec 19;20(1):18. doi: 10.3390/s20010018
Algorithm 1 Route selection between the primary route (via D2D) and the secondary route (via MC BS)
  • 1:

    procedureRoute selection

  • 2:

    for k1=(fcs,fc1,fc2,fc3,fc4,fcd) and k2=(fcs,mc1,fcd) do

  • 3:

      if route k1 is available then

  • 4:

       fcs send packet to fc1

  • 5:

       if fc1 is not available then

  • 6:

        packet goes through mc1 (secondary route) to fcd

  • 7:

       end if

  • 8:

       if fc2 is available then

  • 9:

        check the second condition:

  • 10:

        if tfc1tofc2 is α then

  • 11:

         fc1 send packet to fc2

  • 12:

        end if

  • 13:

       end if

  • 14:

       if fc2 is not available then

  • 15:

        packet goes through mc1 to fcd

  • 16:

       end if

  • 17:

       if fc3 is available then

  • 18:

        check the second condition:

  • 19:

        if tfc2tofc3 is α then

  • 20:

         fc2 send packet to fc3

  • 21:

        end if

  • 22:

       end if

  • 23:

       if fc3 is not available then

  • 24:

        packet goes through mc1 to fcd

  • 25:

       end if

  • 26:

       if fc4 is available then

  • 27:

        check the second condition:

  • 28:

        if tfc3tofc4 is α then

  • 29:

         fc3 send the packet to fc4

  • 30:

         fc4 send the packet to destination fcd

  • 31:

        else packet goes through mc1 to fcd

  • 32:

        end if

  • 33:

       end if

  • 34:

      end if

  • 35:

    end for

  • 36:

    end procedure