## 3 Smart Irrigation System Considering Optimal Energy Management with Predictive Control
### Expert System for the Generation of Optimal Irrigation--(First Stage)  
In order to guarantee optimum irrigation, we start with the study of the type of soil and the knowledge of its characteristics that help to maintain sufficient moisture for the crop without exceeding the limits of the field capacity and permanent wilting point. The analysis of the water balance is analyzed daily throughout the crop, the limits depend on the depth of the roots and how much water was contributed to or removed from the crop. The upper part of Figure 3 shows the forecasting data needed to determine the optimum irrigation (average temperature \(\hat{T}\), wind speed \(\hat{u_{2}}\), Solar radiation \(\hat{R_{m}}\) and precipitation \(\hat{P}\)), irrigation is automatically determined by an automatic expert system, which executes the following steps: (i) meteorological data and prediction models with a control horizon of one day during the cultivation time are obtained to determine the reference evapotranspiration (\(ET_{o}\)) with Equation (7); (ii) the expert system determines the crop evapotranspiration (\(ET_{c}\)) in one day with Equation (6), which depends on the value of the crop coefficient (\(Kc\)) in its different growth stages, determining the amount of water consumed or removed in the root zone; (iii) by means of the water balance of Equation (1), the soil moisture at the  
Figure 3: Proposal for a smart irrigation system, considering optimal EMS. end of the day is known, thus determining the need for irrigation by means of the input of forecasts involved in the water balance. In the automatic expert system, the lamina at the field capacity (\(L_{Cc}\)) of the plants is determined by Equation (2), which depends on the depth of the crop root (\(Z_{r}\)) and the bulk density of the soil (\(D_{a}\)). The lamina at field capacity is the maximum limit of water required in the crop and at this level water is optimally absorbed. The lower limit is lamina at permanent wilting point (\(L_{Pmp}\)); at this point the amount of water adheres only to the soil particles, which makes it impossible for the plant to obtain water and would generate water stress; therefore, to prevent the crop from reaching this point, the water content is determined at a suitable threshold (\(Pw\)), which results from the sum of the value of \(L_{Pmp}\) with \(L_{AFD}\), thus preventing the water content at the root from reaching \(L_{Pmp}\). The irrigation required each day occurs when \(H\leq Pw\), i.e., when the initial soil moisture \(H\) is less than or equal to (\(Pw\)), it is necessary to provide water to the crop, and the system has the capacity to automatically determine the necessary amount of irrigation lamina (\(R\)) by means of Equation (8), where the irrigation lamina (\(R\)) must be less than the field capacity lamina \(R\leq L_{Cc}\), and the forecasted precipitation (\(\bar{P}\)) is also taken into account to determine the amount of effective irrigation lamina (\(R\)), so that the crop does not suffer soil saturation. \[R(t)=L_{Cc}-H(t)-P(t+1) \tag{8}\]  
Once the water requirement of the crop is determined, the gross or total irrigation lamina is determined to ensure sufficient penetration of water in the root zone, by Equation (9), since not all the water will be consumed by the plant, it is, therefore, necessary to apply a greater amount of water in irrigation with respect to the efficiency of the irrigation system [28]. \[L_{b}=\frac{R}{Ef} \tag{9}\]  
In Equation (9), \(L_{b}\) is the gross lamina in mm, \(R\) is the required irrigation lamina in mm and \(Ef\) is the efficiency of the irrigation system. To determine the all-day demand, the switch-on time of the pump is obtained by Equation (10) [30]. \[t_{r}=\frac{L_{b}}{Pms} \tag{10}\]  
In Equation (10), \(t_{r}\) is the irrigation time in hours and \(Pms\) is the average rainfall of the system.