Skip to main content
. 2020 Jul 22;20(15):4071. doi: 10.3390/s20154071
Algorithm 1 GSE: processing a received DIVISION message
  • 1:

    t←MStateDur+TM−⌊MStateDur+TMTcycle⌋·Tcycle;

  • 2:

    ifgrade<0orgrade>MGrade+1then

  • 3:

        grade←MGrade+1;

  • 4:

        if MState==R then

  • 5:

            if t<Tslot then

  • 6:

               state←T;stateDur←t;

  • 7:

            else if t<(ξ+1)·Tslot then

  • 8:

               state←S;stateDur←t−Tslot;

  • 9:

            else

  • 10:

               state←R;stateDur←t−(ξ+1)·Tslot;

  • 11:

            end if

  • 12:

        end if

  • 13:

        if MState==T then

  • 14:

            if t<ξ·Tslot then

  • 15:

               state←S;stateDur←t;

  • 16:

            else if t<(ξ+1)·Tslot then

  • 17:

               state←R;stateDur←t−ξ·Tslot;

  • 18:

            else

  • 19:

               state←T;stateDur←t−(ξ+1)·Tslot;

  • 20:

            end if

  • 21:

        end if

  • 22:

        if MState==S then

  • 23:

            if t<(ξ−1)·Tslot then

  • 24:

               state←S;stateDur←t+Tslot;

  • 25:

            else if t<ξ·Tslot then

  • 26:

               state←R;stateDur←t−(ξ−1)·Tslot;

  • 27:

            else if t<(ξ+1)·Tslot then

  • 28:

               state←T;stateDur←t−ξ·Tslot;

  • 29:

            else

  • 30:

               state←S;stateDur←t−(ξ+1)·Tslot;

  • 31:

            end if

  • 32:

        end if

  • 33:

        MGrade←grade;MState←state;MStateDur←stateDur;

  • 34:

        rebroadcast the DIVISION message;

  • 35:

    else

  • 36:

        discard the DIVISION message;

  • 37:

    end if