# Energy-Efficient Wireless Communication Strategy for Precision Agriculture Irrigation Control
## 3 Energy-Efficient Communication
### Algorithm Design  
The proposed energy-efficient algorithm ran in each sensor node to communicate soil moisture readings using the sleep/wake-up strategy. The algorithm implemented the triggering conditions defined by Equations (7) and (12) according to the specific dynamics of the pecan crop irrigation system. First, we describe how self-triggered constant values for \(\sigma\) and \(P\) were selected, and then we explain how the sensor node executed the algorithm to estimate the next sampling instance based on the soil moisture dynamics specified by Equations (4) and (5), with the identified coefficients denoted in Table 1.  
To select suitable values for the \(\sigma\) constant, we conducted four-week off-line simulations with different initial conditions. As seen in Figure 6 there was a trade-off between the number of communication messages and the estimated water consumption by the irrigation system. Therefore, we selected the \(\sigma\) values of 0.10 and 0.60 for triggering conditions \(\gamma_{1}\) and \(\gamma_{2}\) respectively, where the message's curve was in the inflection point, and the expected water consumption was in the lower values. From Equations (9) and (10), we observed that, for \(V\) to be a Lyapunov function, it is necessary and sufficient that there exist a positive definite matrix \(P\) that satisfies  
\[\Phi^{T}\;P\;\Phi-P<-Q, \tag{13}\]  
where \(Q\) is positive definite. One way of determining the Lyapunov function is to choose a positive definite matrix \(Q\) and then obtain \(P\) from Equation (13), if \(P\) is positive definite then the system is asymptotically stable [43]. Typically an identity matrix is chosen for \(Q\); however, for this specific problem, we assigned more weight to state variable \(\delta\) than variable \(\theta\), since we were more interested in increment sampling based on soil moisture variations rather than the soil moisture value. Therefore, to calculate \(P\) for any value of \(\Phi\) given by Table 1, we use matrix  
\[Q= \begin{bmatrix}0.002&0\\ 0&1.5\end{bmatrix} . \tag{14}\]  
For the algorithm, each node is required to wake up, take soil moisture readings, transmit data to the controller, estimate the next sampling instant, and go to sleep again, as described by Algorithm 1. Function read_input_sensors() conducts the measurement from the three sensors providing an average soil moisture value, then select_coefficients() obtain from a lookup table the proper values for matrices \(\Phi\) and \(\overline{\Gamma}\) according to the moisture region. Finally, the sensor node communicates with the controller and calculates the time for the next sampling instance before going into standby mode. For periodic sampling, the function that calculates the next sampling instant returns a fixed time value. For aperiodic sampling, a function in Algorithm 2 implements the error-based triggering condition \(\gamma_{1}\) and Algorithm 3 describes the Lyapunov-based condition \(\gamma_{2}\). In the Lyapunov approach, function select_P_matrix() obtains from a lookup table the pre-calculated value of \(P\) that solves Lyapunov Equation (13). In self-triggered control, usually, there is an upper bound sampling period in order to provide robustness guarantees for the controller, for the current implementation max_limit is defined with a value of  
Figure 6: Estimated transmitted messages and water consumption: (**a**) Error-based triggering condition \(\gamma_{1}\). (**b**) Lyapunov-based triggering condition \(\gamma_{2}\). 120 min in order to ensure that the sampling period does not go beyond this limit. This value limits the number of cycles in the loop, thus, avoiding excessive processing loads.