| Algorithm 4: Dynamic Sleeping Scenario | |
| Definitions | |
| the set of CHs | |
| TH: Threshold value N: Normal node |
|
|
Vnew: the new data value Vpre: the previously stored data value |
|
| Δ: the relative difference | |
| Max_Cycle: maximum cycle number in the round | |
| 1: | begin |
| 2: | // cycle 1: Initial Evaluation |
| 3: | for each (CH[m]) |
| 4: | transmit Vnew to the BS; |
| 5: | for each (Vnew received from the BS) |
| 6: | compute Δ; |
| 7: | if (Δ < TH) |
| 8: | mark cluster [m] as deactivated; |
| 9: | send broadcast message (CH[m]_ID, mode_bit = 1); |
| 10: | else |
| 11: | mark CH[m] as activated; |
| 12: | end if |
| 13: | end For |
| 14: | If (CH[m] received a broadcast message from the BS) |
| 15: | CH[m] broadcasts a sleep message to its Ns; |
| 16: | Ns of this cluster enter sleep mode; |
| 17: | remain CH[m] active; |
| 18: | else |
| 20: | remain Ns active |
| 21: | end if |
| 22: | end for |
| 23: | // from cycle 2 to the maximum number of cycles in the round |
| 24: | while (cycle ≤ Max_cycle) |
| 25: | for each (CH[m]) |
| 26: | if (CH[m] received reactivate message) |
| 27: | CH[m] broadcasts activate message to its Ns; |
| 28: | Ns of the cluster [m] start sensing and transmit their data to CH[m]; |
| 29: | else |
| 30: | the cluster[m] remains in deactivate mode; |
| 31: | end if |
| 32: | if (CH[m] received a deactivate message from the BS) |
| 33: | CH[m] broadcasts a sleep message to its Ns; |
| 34: | Ns of this cluster enter sleep mode; |
| 35: | remain CH[m] active; |
| 36: | end if |
| 37: | cycle++; |