Skip to main content
. 2021 Jan 13;21(2):534. doi: 10.3390/s21020534
Algorithm 2 Pseudo-code of RA-OLA Scheme for Random PU Traffic Patterns.
  • 1:

    Initialization of parameters

  • 2:

    whilem{M}do // Create PU traffic patterns.

  • 3:

         Generate random ON model with λa exponential distribution for mth link within To.

  • 4:

         Generate random OFF model with λv exponential distribution for mth link within To.

  • 5:

    end while

  • 6:

    Calculate probability of false alarm P^F(m) following Equation (13) given determined P^D.

  • 7:

    Generate LHS T for each UAV following the allocation Algorithm 1.

  • 8:

    Create a two-stage Markov machine presented in Figure 5.

  • 9:

    while k{K} do

  • 10:

        Calculate ne with no, F and T.

  • 11:

        while n{ne} do

  • 12:

            Add Rice propagation model to the upload data.

  • 13:

            Identify the Markov machine state.

  • 14:

            Identify whether the upload data is received (power is within the threshold). The flag flagt sets to 0 when the data is lost.

  • 15:

            Update the Markov machine state.

  • 16:

             while the received LHSs have not been fully processed do

  • 17:

                  while Time of re-sensing is smaller than R do

  • 18:

                       Generate AWGN noises with Nd length for Nn channels.

  • 19:

                       Calculate the sub-channel number whose power is over the threshold.

  • 20:

                       if More than Nk sub-channels detect the busy state. then

  • 21:

                         Tsensecount=Tsensecount+1.

  • 22:

                         if The re-sensing time reaches R then

  • 23:

                              flags=0.

  • 24:

                         end if

  • 25:

                       end if

  • 26:

                  end while

  • 27:

                  if current opportunity length L>(Tsensecount·Tsen+δT) then flagf=0.

  • 28:

                  end if

  • 29:

                  if flagt, flags, and flagf equal 1 then

  • 30:

                      Summarize throughput for this opportunity.

  • 31:

                  end if

  • 32:

            end while

  • 33:

        end while

  • 34:

    end while

  • 35:

    Calculate the simulation throughput value ThUAV.