## 3 Dynamic Multi-Hop Routing (DMR) Technique
### Phases of the DMR Protocol
#### 3.2.4 The Routing Phase of the DMR Protocol  
The DMR protocol assumes that the completion of the previous three phases ensures that all network nodes have their RTs. Therefore, they become capable of sensing data from the environment and conveying these data to the BS through other network nodes. In this phase, a dynamic technique is proposed for routing the sensed data intra-cluster and the aggregated data inter-cluster in order to deliver these to the BS. The following is an explanation of the proposed approach. Figure 1: The overall architecture of WSN using the DMR protocol. * Intra-cluster Routing As previously highlighted, the nodes of each cluster are distributed into two levels around the CH. The Ns at the first level directly transmit the collected data to their corresponding CH. Each N located at the second level utilizes its RT to forward the data to the CH. The arrangement of entries within the RT depends on a cost function proposed for this purpose. The first component of this function corresponds to the relative position of the next-hop node (_NHN_) with respect to the _CH_, while the second component reflects the energy ratio of the _NHN_. Thus, the cost value for each _NHN_ is calculated using Equation (8) [8]: \[C_{\text{{NHN}}}(i)=C_{\text{{NHN-CH}}}(i)+\alpha\cdot C_{\text{{NHNE}}}(i)\] (8) At this point, \(C_{\text{{NHN-CH}}}\) and \(C_{\text{{NHNE}}}\) denote the distance and energy cost components, respectively. The variable \(i\) indicates the nodes selected to calculate their costs. Finally, the parameter \(\alpha\) represents the relative weight of the energy cost component within the cost function. Using Equation (9), the value of \(C_{\text{{NHN-CH}}}\) is computed as follows [8]: \[C_{\text{{NHN-CH}}}(i)=\frac{{D_{i}}^{2}}{{SN_{D-CH}}\ -\ NHN_{iD-CH}}\] (9) In this context, \(D_{i}\) denotes the distance separating the source node (_SN_) and the _NHN_. \(SN_{D-CH}\) symbolizes the distance from the _SN_ to the _CH_, while \(NHN_{iD-CH}\) represents the distance between the _NHN_ and the _CH_. Equation (10) is used to compute the energy ratio of the _NHN_: \[Energy\ ratio=\frac{{RE_{NHN}}}{{IE_{NHN}}}\] (10) In this formulation, \({RE_{NHN}}\) refers to the residual energy of the _NHN_, while \({IE_{NHN}}\) indicates its initial energy. For each energy ratio, there is a corresponding cost value. Hence, lower cost values are assigned to higher energy ratios, and vice versa. Figure 2 illustrates an example of this assumption. Specifically, lower cost values are allocated to Ns whose residual energy exceeds 50% of their initial energy, whereas higher cost values are assigned to the others. Thus, each SN computes the cost of all possible routes and updates its RT in ascending order, from the lowest cost to the highest. Undoubtedly, the SN selects the route with the lowest cost and transmits its data through it to the CH. During the round, the Ns broadcast updated messages. Therefore, the cost values of the routes may change, leading to a rearrangement of the entries within the table. Based on the new arrangement, the SN selects the new lowest-cost route for transmission, and so on. It should be noted that the energy cost component, \(C_{\text{{NHNE}}}\), in Equation (8) has relatively low values (ranging between 0 and 1) compared to the distance cost. For this reason, \(\alpha\) is added to amplify its impact within the cost function. Assigning a small value to \(\alpha\) (e.g., 1-10) results in a negligible influence on the energy cost, whereas a large value (e.g., 100) ensures a more balanced contribution from both energy and distance components; \(\bullet\) Inter-cluster Routing The aggregated data from the CHs, as well as the data from the INs, are also transmitted across the network levels to the BS. Consequently, the RTs of all the CHs and INs in the second and upper levels are constructed. The CHs and INs that receive acceptance responses to their JOIN-REQ messages calculate the cost value for each route.