# An Enhanced Mechanism for Fault Tolerance in Agricultural Wireless Sensor Networks
## 5 Fault-Tolerant Scheme for WSN in Precision Agriculture  
In this kind of WSN system, the failure of the BS could completely isolate the WSN from the final user (e.g., the farmer) and cause a complete loss of the collected data. Also, the failure of a CH will deprive the end user of the information collected from the cluster field because the data cannot reach the BS. We can assume that the source of failure is mainly due to an energy problem in such a deployment scenario.  
In the existing literature for WSNs, hundreds or even thousands of routing algorithms have been proposed to address the energy problem or extend the lifetime of WSNs [43]. However, this problem still remains! Therefore, from our point of view, it is better to consider the energy problem as a failure that can occur in WSN devices. In particular, in our setting, as the agricultural farms can be separated in specific locations and can even be physically guarded, instead of considering various security-related attacks, we would rather consider the energy issue. Accordingly, we have to devise an appropriate strategy for WSNs for fault detection and recovery. Our proposal consists of constructing a fault-tolerant WSN that can be _safe_ and _live_. To say that a system is safe and live, its model must possess _safety_ and _liceness_ properties, respectively.  
The _safety_ property means that the system must never reach a disaster situation, i.e., it must not completely collapse. This is difficult to ensure but not impossible. The requirement for this is that the collected information about the controlled field must reach the end user at the right time; else, a disastrous situation can occur if the collected data are lost. For example, in the case of monitoring the humidity of the agricultural field, the user cannot intervene to irrigate the plants at the right time if they do not receive the appropriate information. On the other hand, the _liceness_ property means that the system must always be live, i.e., the information must always have a route to reach the final user at the right time, without any damage or loss.  
So, our aim here was to construct a safe and a live WSN. In this paper, we propose using the Heartbeat strategy [44; 45; 46] as a monitoring strategy for failure detection and hardware replication for recovery. The replication refers to the BS and CHs. In anticipation of a possible failure of the primary BS, we have two BSs instead of one: a primary BS and a backup one. Figure 4 shows this scenario. The same would apply to the CHs, i.e., each CH will have a backup CH which will take the role in the case of a failure of the primary CH. By using the mentioned strategies, the fault detection can be provided immediately at the moment of a device crash/failure (i.e., for a CH or BS) and then the faulty device can be replaced immediately with the undamaged backup device.  
After having discussed the topology used for the deployment of a WSN in precision agriculture, a fault-tolerant model will be detailed in the following sections. We will use the _Uppaal-4.1.26 model checker_ for the system simulation and property verification.