## 4 Enhancing the Dynamic Multi-Hop Routing (EDMR) Protocol
### The Routing Phase of the EDMR Protocol
#### 4.2.2 The Active/Sleep Sub-Phase  
It should be noted that the proposed protocol considers two general types of applications: monitoring applications (in which the sensed data remain relatively stable over time) [22], and event-driven applications (in which the sensed data change over time) [23]. Based on the application type, the EDMR protocol proposes two scenarios for the network structure and for routing the data within it during the rest of the current round. The first scenario is dedicated to monitoring applications. Here, the clusters chosen to be deactivated in this round remain inactive until the end of the round, whereas the second scenario is related to event-driven applications, in which the states of the clusters (active/deactivated) can be systematically changed throughout the current round. The following sections provide detailed explanations of the two scenarios. Figure 6: Components of the updated message for: (**a**) Ns; and (**b**) CHs/INs. ```
Definitions \(\text{N}[i]\ \in\) the set of \(\text{Ns}\) located at distance \(\geq\text{d}_{\text{o}}/2\) from the BS \(\text{CH}[\text{m}]/\text{IN}[\text{m}]\ \in\) the set of CHs/INs located at distance \(\geq\text{d}_{\text{o}}/2\) from the BS \(\text{RT}\): Routing Table \(\text{NXN}\): Next hop node (N) \(\text{NIN}\): Next hop node (CH/IN) \(\text{D}_{\text{N}[i]\text{-CH}}\): Distance from N[i] to its corresponding CH \(\text{R}_{\text{RT}[i]\text{-CH}}\): Set of available routes in RT for N[i] to reach CH \(\text{D}_{\text{CH}[\text{m}]/\text{IN}[\text{m}]\text{-BS}}\): Distance from CH[m]/IN[m] to BS \(\text{R}_{\text{RT}[\text{m}]\text{-BS}}\): Set of available routes in RT for CH[m]/IN[m] to reach BS 1: begin
2: for each (N[i])
3: if (\(\text{D}_{\text{N}[i]\text{-CH}}<\text{d}_{\text{o}}/2\))
4: transmit sensed data directly to the CH;
5: else if (\(\text{D}_{\text{N}[i]\text{-CH}}<\text{R}_{\text{ST}[i]\text{-CH}}\))
6: transmit sensed data directly to the CH;
7: else
8: select NXN from RT[i];
9: transmit the sensed data to the CH through it;
10: end if
11: end for
12: for each (CH[m]/IN[m])
13: if (\(\text{D}_{\text{CH}[\text{m}]/\text{IN}[\text{m}]\text{-BS}}<\text{d}_{\text{o}}/2\))
14: transmit aggregated data directly to the BS;
15: else If (\(\text{D}_{\text{CH}[\text{m}]/\text{IN}[\text{m}]\text{-BS}}<\text{R}_{\text{RT}[ \text{m}]\text{-BS}}\))
16: transmit the aggregated data directly to the BS;
17: else
18: select NIN from RT[m];
19: transmit aggregated data to the BS through it;
20: end if
21: end for
```  
**Algorithm 2**Initial Routing Sub-Phase  
Static Sleeping Scenario  
WSNs used in this type of application typically collect data from the surrounding environment such as air temperature and soil humidity in agricultural applications. Therefore, the network's BS is capable of analyzing the aggregated data from the initial routing phase and comparing it with a Threshold value (TH). Equation (13) demonstrates the relative difference (\(\Delta\)) between the new data value (\(V_{\text{new}}\)) sent to the BS and the previously stored data value (\(V_{\text{pre}}\)):  
\[\Delta=\left|\frac{Vnew-Vpre}{Vpre}\right| \tag{13}\]  
If \(\Delta<\text{TH}\), the change is considered insignificant. When the BS receives such data from a cluster, it selects that cluster to be deactivated for the rest of the round. It then sends a broadcast message that includes the CH ID and sets the mode bit to 1 (deactivated = 1, activated = 0) to inform the cluster to enter sleep mode for the remainder of the round. It is worth noting that the value of TH plays a key role in balancing energy consumption and maintaining acceptable coverage in the WSN. A lower TH value (e.g., 0.01) keeps more clusters active, resulting in increased data transmissions and faster energy depletion. Conversely, a higher TH value (e.g., 0.05) would reduce the energy consumption but may lead to the loss of valuable data. Therefore, selecting a moderate TH value (e.g., 0.03) strikes a balance between energy efficiency and network coverage.