## 5 Practical Application of a Self-Adapting IoT Network
The graph transformation mechanism has already been discussed in Section 3, and now it is time to link it with the practical application described below. **Example of Self-Adoption**  
During the active crop monitoring period in 2022, we collected a total of 9,309,520 individual records. Approximately 20 sensors were responsible for generating the data, recording them at intervals ranging from 30 s to 5 min. The primary purpose of these data was to analyze the behavior of the system, which involved monitoring the sensors for abnormalities and identifying the causes behind such irregularities. The collected data were mapped onto the properties of the graph's nodes, with each graph node representing a single sensor. Figure 7 presents detection of the anomaly and self-healing action. The humidity sensors are labeled as sensors 9, 15 and 17. While the normal data range for humidity sensors is between 0 and 1000, the failure of sensor 15 is indicated by a value of 64,000 (note the different scale of the chart created for sensor 15). An anomaly was detected at 11:50 p.m. and corrected (by the creation of a virtual sensor) at 12:50 a.m. The virtual sensor was also labeled as sensor 15 in order to maintain consistency of the system (i.e., allow the actuators connected to sensor 15 to operate as usual). The anomaly detected at 11:50 p.m. triggered automated actions, following the example discussed in Section 3. The failing humidity sensor was replaced with a virtual humidity sensor that extrapolated values from other humidity sensors (sensor 9 and sensor 17) on the IoT network. In order to correct an error, the system performed the following set of actions:  
1. Detection of the sensor failure: Sensor data that are out of range, as defined by the local capability, trigger the next actions. 2. Removal of the failed sensor from the IoT network: Transformation P1 is applied. 3. The \"virtual humidity sensor\" (VHS) has to calculate the proper value based on the values of the neighboring sensors. To find them, we apply production P2 as many times as it can be applied. In the case of the graph presented in Figure 5, only two CE nodes are connected with node \(11\) (which is connected with the VHS), and thus P2 will be applied twice. Let us note that in other configuration cases (with more neighboring sensors), the same rules will apply. 4. The new configuration presented in Figure 5 is uploaded to the IoT network. For deploying the results of the transformation to the IoT network, we utilize automation based on the DevOps methodology [15]. Continuous integration-continuous deployment (CI-CD) pipelines automatically update both the system's configuration and the software components. CI-CD promotes a high level of automation while ensuring strict validations and control over the process. 5. When the failed sensor will be repaired, the system should restore the previous graph configuration. The new transformation rules are defined as P3 and P4. P3 is the transformation from Figure 3, but the left side's production is the graph on the right side of Figure 3, and the right side's production is on the left side of the same figure. Analogously, on P4, the left and right sides of production are changed in Figure 4. For the graph presented on Figure 5, we note the following:  
* Production P4 for nodes 22, 11, 16 and 19 is applied;
* Production P4 for nodes 22, 11, 10 and 13 is applied;
* Production P3 for nodes 11 and 22 is applied. The measurement of success is based on the capabilities provided by the transformed network. Similar to the initial definition of the IoT network, which is determined by a  
Figure 7: Data monitoring example with the detected anomaly (marked in orange). set of properties that enable business capabilities, an identical or at least a similar set of measurements should be applied to the resulting network to determine its success.