# A Controller Switching Mechanism for Resilient Wireless Sensor-Actuator Networks
## 5 Performance Evaluation
Red and blue circles are transmitter nodes and relay nodes, respectively. Green circle denotes a receiver node. delays instead of using additional equipment, we employed two nodes for separately receiving and transmitting radio communications. The receiver node was only used to send the received data from network to computer, whereas the radio transmission node was used to receive data from the computer. This configuration reduced the computation delay between computers and motes at a low cost in a general-purpose control system. Apart from the relay node, five nodes were required by default, and two more were required for the backup controller. To implement the controller design, considering the design and switching ideas described earlier, the program flow of Baloo is as follows. The host checks for updated control information and prepares and sends the control packet. The regular nodes receive these control packets. A node transitions to the running state after it receives a valid control packet in on \(on\_control\_slot\_post()\) callback. For each data slot, if the sensor node is the initiator, the slot is assigned to the sensor nodes. \(T_{data}\) and \(T_{sched}\) is set to 8 ms  
Figure 8: Performance of switching algorithm in WSAN testbed experiments. Figure 9: Experimental configuration. and 16 ms, respectively. We used Baloo's preinstalled functions to serially communicate with the computers. We employed the \(on\_slot\_pre()\) and \(on\_slot\_post()\) callback functions that were executed between the two data slots, \(T_{gap}\), as shown in Figure 5. The original purpose of the \(on\_slot\_pre()\) is to pass the payload ahead of each data slot. We used the \(on\_slot\_pre()\)-callback function to read the sensor data and actuator commands from the computer. If the controller's receiver nodes or actuator nodes receive sensor or actuator data in a data slot, the nodes execute the \(on\_slot\_post()\) callback function to process the received payload. We used \(\text{theon\_slot\_post}()\) callback function to serially send the received payload to the computer. The controller switching mechanism also employed two callback functions. As shown in Figure 5, the backup controller can also read sensor data in the \(on\_slot\_post()\) after the slot for sending sensor data to controller owing to the LWB characteristics. Following the data slot used to send the actuation command from the controller, the backup controller runs Algorithm 1 for controller switching in order to monitor the controller's fault. If the backup controller decides to send an actuation command, it prepares the payload to send in \(on\_slot\_pre()\) prior to the data slot for the backup controller. With regard to the packet structure, sensor and actuator information is transmitted up to six decimal places. To reduce the size of the payload, we sent unsigned char data by two digits in the case of decimal places. Additionally, 1 B was used as an indicator for classifying the sensor and actuation data. The signs of the data and node identifier were included in the payload; each was 1 B. The total size of the payload was 8 B. The Glossy header was 2 B for Glossy, with a content-redundancy check of 16 bits. Therefore, the total packet size was 12 B. The control execution time based on applying traditional implementation guidelines varies significantly depending on process type. The computer simulations were developed in consideration of processes such as temperature, composition, and level control that require 8 or 16 s wireless communication update rate. In the experiments, we installed the plant simulator and feedback controller simulator software proposed in [37], where the plant and controller software was installed in the plant computer and two controller computers, respectively. The plant software updates state \(x(t)\) of the plant with linear dynamics (1), and actuates state \(x(t)\) with control input signal \(u(t)\) received from the controller software.