Skip to main content
. 2019 Oct 31;19(21):4741. doi: 10.3390/s19214741
Algorithm 1 Target channel selection.
  • 1:

    procedureTrue Prediction(PredProb, RemPkts)

  • 2:

      for SUSystem do /* existing SUs */

  • 3:

       sort(ascend) /* arrange SUs with respect to RemPkts in lowest to highest order*/

  • 4:

      end for

  • 5:

      for Ch i=1:Nch do

  • 6:

       sort(decend) /* arrange all Channels with respect to prob of idleness in highest to lowest order*/

  • 7:

      end for

  • 8:

      for j1,length(SU) do

  • 9:

       ChjSUj /*Channel with jth highest prob of idleness is allotted to SU with jth shortest job*/

  • 10:

       if Chj is sensedidle then

  • 11:

        transmit SUj using Chj /* contention free access as prediction is true*/

  • 12:

        remove Chj from list of available idle channel

  • 13:

       else goto Procedure False Prediction

  • 14:

       end if

  • 15:

      end for

  • 16:

    end procedure

  •   

  • 17:

    SUfp= SUs unsuccessful in channel access due to false prediction

  • 18:

    SUn= new arriving SUs in the system

  • 19:

    Mn= new arriving SUs in the system

  • 20:

    procedureFalse Prediction(Mn, SUn, SUfp)

  • 21:

      contendersSUn+SUfp

  • 22:

      Mnlistofavailableidlechannels

  • 23:

      begin contention for channel access/* All contenders contend for channel access in random access fashion*/

  • 24:

      if collision then

  • 25:

       wait until beginning of next Tcycle

  • 26:

      else

  • 27:

       transmit on channel accessed successfully during contention

  • 28:

      end if

  • 29:

    end procedure