Skip to main content
. 2021 Nov 7;23(11):1470. doi: 10.3390/e23111470
Algorithm 2 Pseudocode for our algorithm
  • 1:

    For any UAVi, UAVkNi

  • 2:

    Initialize FVk[0]=0, initialize Fvi,k[0] by (10)

  • 3:

    for n > 0 do

      UEs upload their data rate information to the serving UAV.

  • 4:

    UAV-UAV virtual force

      UAVi broadcast its location.

      UAVi creates its neighboring UAV set according to the received location.

      UAVk shares FVk[n1] with its neighboring UAVs, (including UAVi).

      UAVi calculates ψi[n1] by (15).

      UAVi updates FVi[n] by (16).

  • 5:

    UAV-UE virtual force

      UAVi calculates Fui,j[n], FUi[n] by (20), (13), respectively.

  • 6:

    Resultant virtual force

      UAVi calculate the resultant virtual force by (21).

  • 7:

    Motion Control

  • 8:

    Calculate the velocity vi[n] by (22).

  • 9:

    if all |vi[n]|<Vstop,(i[1,M])

  • 10:

          breake

  • 11:

       else do

  • 12:

          {[xi[n+1],yi[n+1]]}={xi[n],yi[n]}+vi[n]

  • 13:

       end if