Skip to main content
. 2017 Sep 28;17(10):2231. doi: 10.3390/s17102231
Algorithm 1: LSIP algorithm
Input: NBi(t), SFm, Ii, NIi, ts
Output: scheduled superframe
Initialize: t = 0
// Phase 1: Calculate length of superframe
1.  Bi broadcasts {Ii, NIi} to all members in NBi(t)
2.  For each CjNBi(t)
3.    Receive {Ij, NIj}
4.    Create a common list of neighbors: CI(t) = {sj(t) ∪ si(t), IiIj | j ∈ NBi(t), iNBj(t)}, CNI(t) = {NIiNIj | jNBi(t), iNBj(t) }
5.  End For
6.  Calculate LCAP and LSP as in (6) and (7), respectively
7.  TISF = LSP + LCAP
8.  If TISF > SFm
9.      Calculate TSPm as in (12)
10.    Calculate Ti as in (11)
11.    Update LSP = TSPm
12.  End If
// Phase 2: TDMA scheduling by using greedy algorithm
13.  For each sensor sCI(t)
14.    Return the sensor sx with the highest contention value in CI(t)
15.    Assign time slot to sx with length ts (ts is transmission time of sx)
16.    Update t = t + ts
17.    Remove s of CI(t)
18.    If t > LSP
19.     break
20.    End If
21.End For