## 4 Adaptive Fault-Tolerant Communication Scheme
### Resource Reservation Based on Priority Queue  
In order to reduce the effect of channel impairments, AFTCS adopts a channel bandwidth reservation method, which is similar to the approach used in [11, 21]. The control node measures the available channel bandwidth at runtime. When it finds out that the channel impairments occur, it will re-allocate the bandwidth to the sensors according to the fault-tolerant priorities and the bandwidth requirements. The bandwidth reservation method includes three parts: effective bandwidth measurement, bandwidth requirements calculation and bandwidth allocation based on the fault-tolerant priority, as shown in Figure 5. The effective bandwidth represented by the time interval is divided into two parts: reserved bandwidth and best-effort bandwidth. Based on the priority queue, the reserved bandwidth is allocated to the sensors with higher priorities, while the sensors with lower priorities may be served by best-effort communications, and \(T_{i}\times D_{i}\) represents the time allocated to the sensor \(S_{i}\) to send \(D_{i}\) packets within each time interval. In the cases of initiation of a new sensor, changes in effective bandwidth or sensors' priorities, _etc._\(T_{i}\times D_{i}\) may be recalculated to reallocate the effective bandwidth. For example, for \(S_{S}\) and \(S_{4}\), on account of the changes in their priorities, we can reserve bandwidths for \(S_{4}\), while \(S_{S}\) is served by best-effort communications. Conventional bandwidth measurement methods usually depend on radio platforms. For example, in CODA [22], each node samples the channel information periodically to get the effective channel bandwidth at runtime. This method is effective for radios with the carrier sense ability. However, it is not suitable for frequency hopping spread spectrum radios such as Bluetooth [23]. AFTCS adopts the same bandwidth measurement method used in [11], which is a radio-agnostic method based on Virtual MAC (VMAC). The control node sends a polling packet to the biosensor to request the sensor to send acknowledgement packets within specific time. The control node will record the actual waiting time and the number of packets successfully received. In this case the effective channel bandwidth is:  
Figure 5: Bandwidth reservation based on priority queue. \[BW_{\mathit{effective}}=\frac{Size_{\mathit{pkt}}\times N_{\mathit{ received}}+Size_{\mathit{pollingPkt}}}{T_{\mathit{wait}}} \tag{4}\]  
where \(Size_{\mathit{pkt}}\) and \(Size_{\mathit{pollingPkt}}\) are the data payload of data packet and polling packet size in bytes, respectively. If \(T_{wait}=T_{i}\times D_{i}+T_{maxPkt}\) and \(N_{\mathit{received}}=0\), then the polling packet is considered lost. As illustrated in Figure 5, in order to adaptively schedule bandwidth, we should dynamically calculate the values of \(D_{i}\) and \(T_{i}\). In the case of channel impairments, the effective bandwidth \(BW_{\mathit{effective}}\) will decrease, and the allocated time for sending one packet \(T_{i}\) will increase, which is given as follows:  
\[T_{i}^{\cdot}=\min\left\{T_{\mathit{minPkt}}\times\frac{BW_{\mathit{ideal}}} {BW_{\mathit{effective}}},\ T_{\mathit{maxPkt}}\right\} \tag{5}\]  
where \(BW_{\mathit{ideal}}=(N_{\mathit{pkt}}\times S_{\mathit{pkt}}\times 8)/T_{\mathit{ interval}}\), \(N_{\mathit{pkt}}\) is the maximum number of packets that can be received or transmitted within each \(T_{\mathit{interval}}\), assuming a clean channel, \(S_{\mathit{pkt}}\) is the data payload of each packet size in bytes, and \(T_{\mathit{maxPkt}}\) is the maximum MAC response time for handling a packet transmission request. In the ideal case, \(T_{i}^{\cdot}=T_{\mathit{minPkt}}\). Hence we can get:  
\[D_{i}^{\cdot}=D_{i}\times\frac{BW_{\mathit{ideal}}\ /\ BW_{\mathit{ effective}}}{T_{i}^{\cdot}/T_{\mathit{minPkt}}} \tag{6}\]  
For highly delay-sensitive sensors, the number of the packets transmitted within each time interval should not be less than \(K_{\mathit{min}}\).