# An Enhanced Mechanism for Fault Tolerance in Agricultural Wireless Sensor Networks
## 4 Theoretical Model for Our Fault-Tolerant WSN
: _A fault-tolerant BS, \(FT_{BS}=(Primary_{BS},\ Backup_{BS})\), is able to offer safe and live data transmission to the end user._  
Proof. : Let us consider a WSN composed of a set of clusters and one non-fault-tolerant Base Station with a residual energy, \(\mu\in\left[\mu^{Max},\mu^{Min}\right]\). Let us consider the following scenarios:  
At moment \(t\), the BS receives data from the set of \(CH_{i=1\ldots n}\). If we assume that a single data reception consumes \(\sigma\), then, \(\mu=\mu-(n\times\sigma)\), \(\mu^{Min}\leq\mu\leq\mu^{Max}\). At moment \(t^{\prime}(t^{\prime}>t)\), the \(BS\) aggregates and transmits data to the end user. If we assume that this task needs \(\varphi\) amounts of energy, then the residual energy is \(\mu-(n\times\sigma+\varphi)\), \(\mu^{Min}\leq\mu\leq\mu^{Max}\). At moment \(t^{\prime\prime}(t^{\prime\prime}>t^{\prime})\), after repeating the process \(\omega\) times, \(\mu=\mu-\omega\times(n\times\sigma+\varphi)\leq\mu^{Min}\); at this time, the BS has exhausted its energy and then stops operating. The \(CH\)'s data will then be lost and the entire WSN will become disconnected from the external world. Therefore, _safety_ and _liveness_ are both violated in the WSN system. On the other hand, a backup BS can come to the rescue of the situation at moment \(t^{\prime\prime}\) (i.e., after the detection of failure of primary BS). We can conclude that a fault-tolerant BS can ensure _safe_ and _live_ data transmission in the WSN. \(\square\)  
**Definition 6**. : _A WSN system \(wsn=(\ C,\ L,\ T,\ BS)\) is defined by a composition of set of clusters that rely on a set of connection links and one Base Station such that_  
\(C=\{C_{0}\ldots C_{n}\}\) _is the set of clusters;_  
\(L=\{l_{0},l_{1},l_{2},\ldots,l_{n}\}\) _is the set of connection links, such that_ \(\left\{\forall l_{i\in(1..n)},l_{i}reliesC_{i}toBS\right\}\)_;_  
\(T\) _is a set of transitions_ \(\tau\)_, and each transition is a tuple of the form_ \(\tau=(CH_{i},\ l_{i},p_{i},\ d_{i},BS)\)__\((i=1..n)\)_, where_  
\(CH_{i}\) _is the leader in cluster_ \(i\)_;_  
\(l_{i}\in\gamma\) _is the communication link between the_ \(CH_{i}\) _and the Base Station;_  
\(p_{i}\in[p_{Min},p_{Max}]\) _is the transmission power consumed by the_ \(CH_{i}\)_;_  
\(d_{i}\) _is the transmitted data from_ \(CH_{i}\) _to the Base Station;_  
\(BS\) _is the unique Base Station._  
**Definition 7**. : _A fault-tolerant \(FT_{wsn}=(\ FT_{c},\ L,\ T,\ FT_{BS}\ )\) is composed of s sets of fault-tolerant clusters, \(FT_{C}^{i=1..n}\), and a set of connectors, \(L\), relies on a fault-tolerant Base Station \(FT_{BS}\)._  
**Theorem 1**. : _A fault-tolerant \(FT_{wsn}=(\ FT_{c},\ L,\ T,\ FT_{BS}\ )\ WSN\) is able to ensure safe and live agricultural data transmission._  
Proof. : Let us consider a WSN composed of a set of fault-tolerant clusters presented by their CHs (\(FT_{CH1},\ \ FT_{CH2},\ \ FT_{CH3}\)) and one non-fault Base Station (BS). Let us discuss the first scenario. During time \([t_{0}-t_{1}]\), the three clusters collect the environmental information and transmit the data to the Base Station. At moment \(t_{2}\), the BS transmits data to the end user. During time \([t_{2}-t_{3}]\), the Cluster Heads \(FT_{CH1}\) and \(FT_{CH2}\) deplete their energy, and only \(FT_{CH3}\) collects information and sends data to the BS. At moment \(t_{4}\), the backup Cluster Heads, \(FT_{BCH1}\) and \(FT_{BCH2}\), take over the role and transmit the collected data to the BS. At moment \(t_{5}\), the BS aggregates and transmits data to the end user, and Cluster Head \(FT_{CH3}\) exhausts its energy and it will be replaced by the its backup: \(FT_{BCH3}\). During time \([t_{6}-t_{7}]\), the backup Cluster Heads \(FT_{BCH1}\), \(FT_{BCH2}\), and \(FT_{BCH3}\) collect, aggregate, and transmit data to the BS. At that moment, the BS depletes its energy and stops operating. Unfortunately, cluster's data will be lost and the WSN service will be interrupted until the Base Station is repaired. Hence, _safety_ and _liveness_ are violated in such a scenario.