# Clear database from old data
## 8 Experiments and Discussion  
To check the correctness of the proposed models and algorithms, a hardware/software test-bench of a wireless sensor network was developed and assembled. This test-bench was partially described already in [35]. To implement self-organization of the network, ZigBee network layer protocol was used. Decentralization and role-based functioning were implemented at the application level in Python. Each network node consists of a single-board computer Raspberry Pi version 3 or 2, connected sensors (temperature, pressure, humidity, etc.) and a Digi XBee communication module [28, 29]. The main characteristics of the nodes are presented in Table 7.  
The role distribution is specified in a configuration file, which is replicated to all network nodes. Particularly, the configuration specifies a node identifier, types of sensors, update frequency of sensor readings and addresses of other nodes, indicating their roles. In case of a role change of a node or redistribution nodes, this file is automatically sent and adjusted consistently on all nodes. For example, in case of leaving the network, a node notifies all other participants about this event, and they adjust their local configuration files. The core software component of the test-bench represents a universal control script that is loaded onto each node and can perform the functions of each of the described roles. The script contains a range of classes, and each cone is in charge of implementing a particular role of the node. When the network is initiated first time, the configuration file is read, and each node starts to function in accordance with the role assigned to it within this configuration. The new role of a node is enforced just after it is changed in the configuration file. This allows nodes to change roles in a fairly short time and seamlessly, i.e., without restarting the software of the node. Figure 7: Technique for applying the proposed models and algorithms. Figure 8 schematically shows the used test-bench. The figure illustrates the presence of self-organization in the WSN (a case of adding a new node). The following condition for the redistribution of roles is also shown, namely the appearance of a node in the network that allows for optimizing the functions of the data keeper role. Also, the figure exposes an example of a new node appearing in the network, which leads to a redistribution of roles. In this case, such redistribution results in optimization of the function of the keeper role. In Figure 8, block 'a' illustrates the functioning of WSN with a certain set of roles for the nodes, where a new node with specific characteristics is added. Block 'b' exposes that a new node was successfully added to the WSN, the data transmission routes were rebuilt and the node started functioning with the default data collector role. Block 'c' illustrates a case where a node performing the data keeper role can no longer perform it since it has a low remaining battery charge and a low amount of remaining memory. In this case, the \begin{table}
\begin{tabular}{c c} \hline \hline
**Name** & **Characteristics** \\ \hline \multirow{6}{*}{Raspberry Pi model 3} & CPU: Broadcom BCM2837 1.2 TT\({}_{\text{RI}}\) 4 core ARM Cortex-A53; \\  & GPU: 2 core VideoCore IV; \\  & RAM: 11F LPDDR2; \\  & Power: Micro USB socket 5.1B/2.5A (from powerbank) \\  & OS: Raspbian O6 \\ \hline \multirow{6}{*}{Digi Zbee Series 2} & Frequency: 2.4...2.4835 GHz \\  & Operating radius: 100 m \\  & Data transmission speed via radio channel: 250,000 bit/s \\  & Current consumption in receive mode: 50 mA \\  & Current consumption in power saving mode: \textless{10}\)\(\mu\)A \\  & Count of channels: 16 \\  & Network addressing capabilities: PAN ID—16 bit, Address—16 bit \\  & Interfaces: UART, GPIO, PWM, ADC \\ \hline \multirow{2}{*}{Control software} & Program language: Python 3.8 \\  & Specific libraries: Digi-Xbee \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Test-bench characteristics.