Skip to main content
. 2017 May 20;17(5):1168. doi: 10.3390/s17051168
Algorithm 1 Virtual Lattice-Based Monitor Algorithm
  • 1:

    Input: SSN=S1,S2,,Sc, the position of all SNs

  • 2:

    SAN=S1,S2,,Sn, the position of all ANs

  • 3:

    With GAF, a cuboid is partitioned into many virtual small lattices, their ID set is denoted by I=I1,I2,,Im.

  • 4:

    for iI, (i=1, 2, ⋯, m) do

  • 5:

     AN Sz locally broadcasts a HELLO message to all nodes in lattice Ii with its max transmission range.

  • 6:

    if AN Sz receives a number of HELLO-ACK message which is greater than or equal to two then

  • 7:

      Record IiP

  • 8:

    else

  • 9:

      AN Sz receives a number of HELLO-ACK message which equal to one

  • 10:

      Record IiQ

  • 11:

    end if

  • 12:

     Record center coordinates set Ii=(xi,yi,zi).

  • 13:

    end for

  • 14:

    Delete IiP and corresponding center coordinates from ID set I and Ii.

  • 15:

    Record new ID set IiI, new center coordinates set IiIi.

  • 16:

    Output: The lattices that are required to be patrolled by ANs, and the ID set is Ii.