## 4 Implementation, Simulation, and Real Tests
### Predicting and Analyzing Energy Consumption  
First energy consumption models were proposed in [2]. In this approach, the models are based on estimating the time spent by each node in active and sleep modes. To illustrate the elaboration of this kind of model, an example of a chronogram for three nodes is depicted in Figure 12.  
An analytical model of the activity duration \(D_{i}\) of node \(i\) is expressed hereafter. This parameter \(D_{i}\) defines the time when the radio interface of a node is active during a collection cycle (with a sender-receiver synchronization mechanism):  
\[D_{i}=sA+a+\sum_{j\in child\ of\ i}^{\text{C}}\left(D_{j}-sA\right)+C*IFS+D_{TX}(i) \tag{2}\]  
In this formula, \(a\) represents the time for receiving/sending a collection order or acknowledgment about successful receipt; IFS (or Inter-frame Space) is the waiting period between transmissions, which is used to prevent collisions with other frames and which can be adapted for each technology; \(\text{C}\) is the number of children of the node \(i\); \(sA\) is the synchronization anticipation time, which is used to wake up intermediate and external nodes earlier so that they can receive a signal from the parent; and \(D_{TX}(i)\) is the amount of time it takes for a message to be sent from node \(i\) to its parent.  
With the communication activity duration of each node during a collection cycle, respective energy consumption can be deducted. Power consumption in active (\(P_{\text{active}}\)) and  
Figure 11: The materials of data collection platform.  
Figure 12: Chronogram of the behavior of XBee modules for cluster-based networks.  
sleep (\(P_{\text{sleep}}\)) modes (see Section 4.1) is used to determine the energy consumption of each node during a collection period \(T\), as follows:  
\[E_{i}=P_{\text{active}}\cdot D_{\text{active}}(i)+P_{\text{sleep}}\cdot D_{\text{ sleep}}(i)\]  
\[E_{i}=P_{\text{active}}\cdot Di+P_{\text{sleep}}\cdot(T-Di) \tag{3}\]  
To illustrate the SADHoA-WSN process (cf. Section 3.1), some advancements and results of the functionalities described in level 1 of Figure 8, especially for the following functions of the control system: \"System Monitoring\" and \"Disruption impact assessment\".  
Figure 13 illustrates the measurement tests related to four different topological network structures of 6 nodes. Estimation models (in red) are compared with real measurements (in green), allowing us to observe model deviation phenomena, and to decide if a reconfiguration of the network is needed. All the platform (hardware and software) is constructed as the observation and control functions can be fully centralized or, on the contrary, fully delegated with local decisions on nodes. Hybrid architectures can also obviously be implemented. As depicted in Figure 13, the results show that the energy estimation model corresponds to measures with an average error of 5% and a maximum error of 10%, found for node 2. Indeed, the energy consumption of node 2 is always greater than the estimated one. This could be explained by a slight difference between the model formalization and the protocol implementation. This gap is not a problem because, in the reconfiguration context, the tendencies are more important than the values. Moreover in future works, we aim to continuously adapt the energy estimation models online.