Skip to main content
. 2016 Sep 25;16(10):1576. doi: 10.3390/s16101576
Algorithm 5. Power Adjustment for FCH (PA-FCH)
Run at a MCH node (e.g., u)
Input: Nmax
Output: NULL
1. Initialize N as zero
2. Send a PAREQ packet at its maximum transmission power to the FCH (e.g., w)
3. Set the timer tσ as σ
4. while the timer tσ does not expire do
5.   if receive the PAREP packet from the FCH (e.g., w) then return
6. end while
7. if N < Nmax then {N++; go to step 2} else return end if
Run at a SCH node (e.g., v)
Input: Nmax
Output: NULL
8. if hear the PAREQ packet from the MCH (e.g., u) then
9.   Initialize N as zero
10.   Send a PAREQ packet at its maximum transmission power to the FCH (e.g., w)
11.   Set the timer tρ as ρ
12.   while the timer tρ does not expire do
13.    if receive the PAREP packet from the FCH (e.g., w) then return
14. end while
15. if N < Nmax then {N++; go to step 10} else return end if
16. else
17.   Go to step 8
18. end if
Run at a FCH node (e.g., w)
Input: the hello messages of all neighbors and the very small real number ε
Output: the adjusted transmission power from FCH to MCH/SCH
19. if receive the PAREQ packet from the MCH (e.g., u) then
20.   Adjust the transmission power ptw,u according to the Formula (11) and initialize FLAG as true
21.  Set the timer tψ as ψ
22.   while the timer tψ does not expire do
23.    if receive the PAREQ packet from the SCH (e.g., v) then
24.     Adjust the transmission power ptw,v according to the Formula (11)
25.     if ptw,u > ptw,v then
26.     Broadcast a PAREP packet at ptw,u and set FLAG as false
27.     else
28.      Broadcast a PAREP packet at ptw,v and set FLAG as false
29. end if
30.    end if
31. end while
32. if (FLAG == true) then Broadcast a PAREP packet at ptw,u
33. end if
34. if receive the repeated PAREQ packet from the MCH (e.g., u) or the SCH (e.g., v) then
35.     if (FLAG == true) then {ptw,u = ptw,u + ε; Broadcast a PAREP packet at ptw,u}
36.     else if ptw,u > ptw,v then {ptw,u = ptw,u + ε; Broadcast a PAREP packet at ptw,u}
37.     else {ptw,v = ptw,v + ε; Broadcast a PAREP packet at ptw,v} end if
38.     end if
39. end if