## 4 Adaptive Fault-Tolerant Communication Scheme
### Resource Reservation Based on Priority Queue
For \(Q_{\mathit{reserved}}\), the time complexity for building the minimum heap is \(O(m)\); the time complexity for the insertion or removal of the sensor is \(O(\lg m)\); the time complexity for the traversal of all sensors is \(O(m\lg m)\). Similarly, for \(Q_{\mathit{removed}}\), the time complexity for building the maximum heap is \(O(n\)-\(m)\); the time complexity for the insertion or removal of the sensor is \(O(\lg(n\)-\(m))\); the time complexity for the traversal of all sensors is \(O((n\)-\(m)\lg(n\)-\(m))\). Therefore, the time complexity is as follows. \[T(n)=O(m\lg m)+O((n-m)\lg(n-m))=O(n\lg n) \tag{9}\]

## 5 Performance Evaluation

We evaluated AFTCS on the Castalia simulator [24]. Castalia is an open source, discrete event-driven simulator based on OMNeT\(++\)[25]. The experiment simulates a typical body sensor network, in which sensors measure a person's physiological parameters. We configure the body sensor network with three types of biosensors: ECG sensor, SpO\({}_{2}\) sensor and Temperature sensor. All nodes adopt Castalia standard CC2420 IEEE802.15.4 radios. In the whole experiment seven fault-tolerant priorities are adopted. The range of fault-tolerant priority is 0-6, where a smaller value indicates a higher priority. Tables 3 and 4 describe the detailed simulation parameters and sensor node specifications, respectively. We compare our AFTCS scheme with the BodyQoS scheme [11]. \begin{table}
\begin{tabular}{l l} \hline
**Parameter** & **Value** \\ \hline Number of sensor types & 3 \\ Wireless channel model & Log shadowing wireless model \\ Path loss exponent & 2.4 \\ Collision model & Additive interference model \\ Physical and MAC layer & IEEE 802.15.4 standard \\ Data transmission rate & 250 Kbps \\ Buffer size & 1,024 KBytes \\ Max physical layer frame size & 127 Bytes \\ Physical layer frame overhead & 6 Bytes \\ MAC layer frame overhead & 13 Bytes \\ Ideal noise floor & \(-\)100 dBm \\ Simulation time & 600 s \\ Number of simulation runs & 50 \\ \hline \end{tabular}
\end{table} 
Table 3: Simulation settings. The simulation includes six time periods. In the first time period (0 s\(\sim\)100 s), the system operates in an ideal state, and the readings of all sensors are normal. In the second time period (100 s\(\sim\)200 s), noise signals are generated to introduce the channel impairment. The noise floor is increased to \(-\)80 dBm. In the third time period (200 s\(\sim\)300 s), the noise floor is increased to \(-\)70 dBm. Besides, the readings of the temperature sensor become high with large fluctuations. In the fourth time period (300 s\(\sim\)400 s), the readings of the SpO\({}_{2}\) sensor become exceptional and the readings of the temperature sensor become normal. In the fifth time period (400 s\(\sim\)500 s), the noise floor is reduced to \(-\)80 dBm. In the sixth time period (500 s\(\sim\)600 s), the noise floor becomes ideal. In other words, the system operates in an ideal state once again. In the whole experiment, two metrics are used for performance evaluation: packet loss rate and average packet latency. The packet loss rate is used to evaluate the performance of reliability and the average packet latency is used to evaluate the performance of timeliness. Figure 8 presents the fault-tolerant priority changes of each sensor during the simulation. In the first time period, the fault-tolerant priorities of all sensors decrease, because they have operated in the fault-free state for a certain time. In the second time period, the priorities of the ECG sensor and the SpO\({}_{2}\) sensor increase due to the channel impairment, while the priority of the temperature sensor doesn't change, because its channel sensitivity is relatively low. In the third time period, the priorities of the ECG sensor and the SpO\({}_{2}\) sensor further increase due to the increase of the noise level. The priority of the temperature sensor increases rapidly because of the abnormality of readings and the channel impairment.