# A Controller Switching Mechanism for Resilient Wireless Sensor-Actuator Networks
## 3 System Overview
### Network Scheduling for Control System  
We designed the WSAN scheduling without considering switching controllers. Figure 2 presents an illustration of each round and slot structure in the LWB. Each round consists of a slot for the current round schedule, n data slots, and round finish slots. All nodes repeat each round at every time period, and the time for the round is \(T_{round}\). Each round begins with the schedule of the host, \(T_{sched}\). In this slot, the host node computes the scheduling for the network and broadcasts it to the source nodes. Upon receipt of the scheduling information, one source node becomes the initiator in the allocated slot and launches the Glossy flooding communication. One-hop nodes within the initiator's transmission range simultaneously receive the transmission and relay all packets simultaneously after the precise processing period. Repeated flooding enables nodes greater than two hops to receive packets sent by the initiator.  
The transmission of sensor and actuator information should be assigned to each round's data slot, considering the sampling period of the control system. First, it was necessary to examine the composition of each round, which was repeated every \(T_{period}\). Additionally, there were multiple slots in each round. Each slot was assigned to each source node that initiated the Glossy transmission, and various parameters determined its length.  
The reliability of packet reception improved with the repetition of transmission in the slot. If the transmission was repeated \(N\) times, the reliability of packet reception increased. However, N iterations were required for nodes away from the initiator to receive packets, requiring a sufficiently long slot time, which can be calculated as follows:  
\[T_{data}=(H+2N-1)*T_{hop}, \tag{3}\]  
where \(H\) is the maximal number of hops in the network, and \(T_{hop}\) is the time for one-hop transmission.  
\[T_{hop}=300\ \upmu\text{s}+L/BITRATE. \tag{4}\]\(T_{hop}\) is a function of the length of packet \(L\), and if the bitrate is 250 kbps, the value is constant. The transmission overhead is 300 us per hop, which includes the transmission of four preamble bytes and the sync word (4 B). Length of a round \(T_{round}\) depends on the physical systems and the control systems in the WSANs, with a trade-off between a higher energy overhead per round and the possibility of supporting shorter periods and deadlines. Within one round, there are multiple data slots and two \(T_{sched}\) for scheduling. There exists a time gap between the slots. During this gap time, the transmitted packets are placed into the incoming packet queue, and the received payloads are processed. The length of a round \(T_{round}\) is calculated as  
\[T_{round}=T_{sched}+T_{gap}+N_{slot}*(T_{gap}+T_{data}), \tag{5}\]  
where \(N_{slot}\) is the number of assigned slots. We used one slot for the transmission of sensor information and another slot for the transmission of actuator information in the WSANs using LWB. These two slots were repeated in cycles of sampling period \(T_{s}\). Depending on \(T_{s}\), there are various methods to set up a round. First, \(T_{round}\) can be set as long as possible, such that two slots are repeated many times within \(T_{round}\). The second method only uses two slots for communication during the round, which is achieved by setting \(T_{round}\) to be the same as \(T_{s}\). The battery performance of the system may vary depending on how the round is set. An excessively short round can cause problems in terms of battery efficiency owing to the frequent rescheduling calculations and transmissions, although there are no changes in the network. However, it is necessary to set \(T_{round}\) appropriately because, if a round is excessively long, it becomes difficult to cope with changes in the network. In this study, \(T_{round}\) was set to be the same as the sampling interval of the control system in order to explore its stability in terms of dynamic channel environments.