## 4 Experiments
### Results and Discussion  
Tests of the CH rotation algorithms were divided into two parts. The first part is devoted to the situation where the probability of event occurrence is constant in time. In this case, the event probabilities for sensor nodes 1-3 were set to 0.2, 0.3, and 0.5, respectively. The second part of tests deals with a more realistic case in which the event occurrence probability varies with time. For instance, the probability of detecting person in an office building is high during working hours and low throughout the remaining part of the day. During experiments the probabilities were changed every 5 min in cycles of 15 min. In case of the first sensor node the probability for three successive 5-min intervals was 0.2, 0.2, and 0.3. In a similar way, the probabilities of 0.6, 0.7, and 0.9 were assigned to sensor node 2. Finally, sensor node 3 was detecting the events with probabilities of 0.1, 0.4, and 0.1. Figure 6 shows the results obtained for the simplest approach, which permanently assigns the CH role to one of the sensor nodes at the initialization stage. The sensor node with ID = 1 acts as CH during the considered period of time, as shown in Figure 6(top). In this case, the CH node (node 1) depletes its battery faster than the cluster members (node 2 and node 3). The WSN lifetime has not exceeded 13 h and 27 min. When the CH node dies, the remaining nodes have over 661 mWh of unused energy (see Figure 6(bottom)). It should be noted that in case of the fixed CH node the same results are observed for both analyzed scenarios (with constant and variable event occurrence probability) because the energy consumption of CH node, which has to send detection results to sink at each step, does not depend on the probability of event occurrence (as presented in Figure 5). Figure 5: Impact of the synchronization period on the energy consumption of sensor nodes. The second examined method uses the round-robin CH rotation (RRCR) algorithm [38; 39], which is based on the time-driven approach. This algorithm allocates fixed time interval to each sensor node in a cyclic way. Thus, all sensor nodes take the CH role for the same time. During experiments this time interval was set to one minute, based on results of preliminary tests. The WSN lifetime and energy consumption by sensor nodes for the RRCR algorithm are presented in Figures 7 and 8. When comparing these results with those of the fixed CH approach (Figure 6) it is apparent that the introduction of CH rotation significantly extends the network lifetime. In the scenario with fixed probability of event occurrence the WSN lifetime was 16 h 31 min (Figure 7 bottom), while in the second scenario with variable probabilities, the lifetime decreased to 16 h 5 min. It should be noted that at the end of the network operation, two sensor nodes still have 73 mWh and 144 mWh of unused energy on average (Figure 8 bottom). This shows that the energy resources in WSN are used in a not optimal way. The reason lays in the RRCR algorithm, which inherently assumes that the sensor nodes consume energy with the same rate. This assumption is not met in case of the smart sensor nodes that transmit data only when an important event is detected. Further improvement of the WSN lifetime was achieved by using the energy-driven CH rotation algorithm (EDCR) [40, 41], which takes into account the energy consumption of CH node. According to this algorithm the CH role is moved to the next node in sequence if a given percent of residual energy is consumed by the current CH node. After calibration process, the energy threshold of 5% was used. Results of the EDCR algorithm for fixed and variable event probability are shown in Figures 9 and 10. The left charts in Figures 9 and 10 show changes of CH nodes. It can be observed that the CH changes are performed relatively rarely at the beginning of the network operation, when the residual energy of sensor nodes is high. As energy level decreases, the changes of CH node are made more frequently. In the final stage the change is made every minute.