Skip to main content
. 2009 Aug 24;9(9):6626–6651. doi: 10.3390/s90906626

Algorithm 1.

EBH

1: procedure NodeInitialization
2:    Mode ← MODE0
3:    EnergyUnit ← E/m
4:    ResidualEnergyGradeNumber ← m
5:    return TRUE
6: end procedure
7: procedure NeighborFindingMessageReceived
8:    DownStreamNeighbor = NeighborFindingMessage.id
9:    SendNeighborFindingACK.id = idOfItself
10:    SendNeighborF indingACK()
11:    NeighborFindingMessage.id = idOfItself
12:    SendNeighborFindingMessage()
13:    return TRUE
14: end procedure
15: procedure SendNeighborFindingACKReceived
16:    UpStreamNeighbor = SendNeighborFindingACK.id
17:    return TRUE
18: end procedure
19: procedure OneUnitEnergyConsumed
20:    SendControlMessage()
21:    ifMode = MODE1 then
22:     Mode = MODE0
23:    end if
24:    return TRUE
25: end procedure
26: procedure ControlMessageReceived
27:    ifResidualEnergyGradeN > ControlMessage.ResidualEnergyGradeN
    and Mode = MODE0 then
28:     Mode = MODE1
29:    else
30:     SendControlMessage()
31:    end if
32:    return TRUE
33: end procedure
34: procedure SendControlMessage
35:    SendResidualEnergyNumber()
36:    return TRUE
37: end procedure