# A Hybrid Scheme for Disaster-Monitoring Applications in Wireless Sensor Networks
## 4 Scheme Description
### Abnormity Handling  
For reliable transmission in a disaster-monitoring system, the operating mode under abnormal situations should be considered in HT-MAC. In the following, we analyze abnormal situations and describe the handling methods based on the previous work [48]. When a node is abnormal and unavailable, the situation is shown in Figure 4. Figure 4a shows the normal ring. When a node leaves the neighbor node's coverage, for example, in the case in which Node 1 leaves the coverage of Node 4, Node 4 is responsible for handling the situation. In the HT-MAC scheme, a node receives an acknowledgment frame to confirm that its successor accepts the polling token. Hence, Node 1 begins transmitting data once its acknowledgment frame is received by Node 4. If the acknowledgment frame is not received, Node 4 continues to deliver a polling token to Node 1. After several attempts, Node 4 drops delivering the polling token. At this point, the virtual ring is opened. In such a situation, Node 4 delivers a token to arrange for Node 2 to be its new successor. When Node 2 accepts the token, it sets Node 4 as its predecessor and delivers a token reply to Node 4. Node 4 accepts the reply and sets Node 2 as its successor. This virtual ring is then closed, as shown in Figure 4b. The algorithm for handling abnormalities when a node is unavailable is presented in Algorithm 1. In the case of a node moving out of coverage, the aforementioned operating procedure is also applicable. In fact, because the successor node cannot differentiate between failure, quitting, and interference from link noise, Algorithm 1 can be applied to all these cases. Figure 4: Situation in which a node is unavailable (1, 2, 3, and 4 denote nodes 1, 2, 3, and 4): (**a**) the normal ring; (**b**) after abnormity handling. Figure 3: Situation when a node leaves a ring (1, 2, 3, and 4 denote nodes 1, 2, 3, and 4): (**a**) when Node 1 is about to leave the ring; (**b**) after Node 1 leaves. For the abnormal situation of a no-polling token in a virtual ring, efforts must be made to bring the virtual ring to work. This is illustrated in Figure 5a. At that moment, Node 1 departs from the coverage of all the other nodes; meanwhile, Node 1 owns the polling token, as shown in Figure 5b. In such a situation, there are no active polling tokens in the network. In the HT-MAC scheme, if a node has not received a polling token within the maximum period time, it generates a new token to deliver. Consequently, each node ultimately creates a new polling token. Therefore, multiple tokens exist in the ring simultaneously. This case is processed as follows. This method can remove multiple polling tokens, as shown in Figure 6. In HT-MAC, each polling token frame contains two parts: a token identifier and a sequence number. The token maker is a node that generates a polled token. The token identifier is determined by the MAC addresses of the token maker node. The token maker produces an integer as the polling token sequence number and increases it by one each time the token passes through the maker. Figure 5: Situation without a token in the ring (1, 2, 3, and 4 denote nodes 1, 2, 3, and 4): (**a**) when Node 1 owns the polling token; (**b**) after Node 1 departs from the coverage of all the other nodes. Figure 6: Situation with multiple tokens (1, 2, 3, and 4 denote nodes 1, 2, 3, and 4): (**a**) the normal situation; (**b**) with multiple tokens. Based on the received polling token, the sequence number and token identifier are recorded by each node in the ring. Whenever a new polling token arrives, the node checks whether the sequence number of the new token is less than that of the previous token. If this is the case, the token is deleted by the node. Meanwhile, the node checks the received token for whether the sequence number of this token is the same as the previous one, and whether the token identifier is less than the previous token. If this is the case, the token will also be deleted by the node.