Skip to main content
. 2020 Sep 11;20(18):5195. doi: 10.3390/s20185195
Algorithm 1 SARF Algorithm
  •  1:

    /* Initialization

  •  2:

    ccf0;           ▹ Number of consecutive transmission failures

  •  3:

    ccs0;        ▹ Number of consecutive transmission successes

  •  4:

    R{r1,r2,...,rn};                ▹ Available rates

  •  5:

    i1;           ▹ Select the lowest transmission rate in set R

  •  6:

    trr1;           ▹ Set transmission rate to the lowest value

  •  7:

    /* End Initialization

  •  8:

    while true do

  •  9:

        if Request of a new transmission then

  • 10:

            if Previous attempt was failed then

  • 11:

               Perform transmission attempt at the lowest rate

  • 12:

            else

  • 13:

               Perform transmission attempt at the current rate

  • 14:

               if Success then

  • 15:

                   ccf0;            ▹ Reset # of consecutive failures

  • 16:

                   ccs++;       ▹ Increase counter of consecutive successes

  • 17:

                   if ccsNthen          ▹ If success threshold reached

  • 18:

                       if i<nthen            ▹ If highest rate not reached

  • 19:

                           i++;

  • 20:

                           trri;                     ▹ Increase rate

  • 21:

                       end if

  • 22:

                   end if

  • 23:

               else

  • 24:

                   /* (If failure)

  • 25:

                   ccs0;           ▹ Reset # of consecutive successes

  • 26:

                   ccf++;              ▹ Increase consecutive failures

  • 27:

                   if ccfKthen          ▹ If failure threshold reached

  • 28:

                       if i>1then             ▹ If lowest rate not reached

  • 29:

                        i;

  • 30:

                           trri;                   ▹ Decrease rate

  • 31:

                       end if

  • 32:

                   end if

  • 33:

               end if

  • 34:

            end if

  • 35:

        end if

  • 36:

    end while