| Energy Balancing Algorithm |
| if node.En decreases to below E_Th, then |
| it sends EPR to the root |
| it sends EPN to its subtree |
| end if |
| If root makes decision to protect node A, then |
| flood EPB |
| nodes with higher power than A are waken up |
| 's children set BPID during EPB flooding |
| if A's child B has BPID, then |
| B sends EPNR to A |
| end if |
| if all A's children send EPNR to A, then |
| if A is a target node, then |
| A detaches with its children |
| A keeps working state |
| else |
| build new paths to targets |
| A turns into sleeping state |
| end if |
| end if |