# Energy-Water Management System Based on MPC for a Greenhouse in a Mapuche Indigenous Community
## 4 Climate Predictions
### Short-Term Climate Prediction
#### 4.1.2 Prediction of Internal Climatic Variables
\(Q_{g}\) is the heat exchange with the ground, which is described by:  
\[Q_{g}(k)=K_{g}\cdot A_{g}\cdot\frac{(T_{gr}(k)-T_{ss}(k))}{L_{ss}}, \tag{11}\]  
where \(K_{g}\) is the ground thermal conductivity, \(A_{g}\) is the area of the ground surface in the greenhouse in m\({}^{2}\), and \(L_{ss}\) is the depth of temperature measurements in the soil. Finally, \(Q_{evap}\) is the heat loss from evapotranspiration, represented by:  
\[Q_{evap}(k)=\frac{\sum_{c-1}^{Crop}\lambda_{c}ET_{pc}(k)A_{c}}{3600}, \tag{12}\]  
with \(\lambda_{o}\) being the latent heat of water, \(ET_{pc}\) the potential evapotranspiration of crop \(c\), and \(A_{c}\) the corresponding crop's area. Additionally, in Equations (6) and (7), the constants \(\rho_{air}\) and \(\rho_{g}\) are the air and soil densities in kg/m\({}^{3}\), respectively; \(c_{pa}\), \(c_{pv}\), and \(c_{pg}\) denote the specific heat of dry air, water vapor, and the soil in J kg\({}^{-1}\)K\({}^{-1}\), respectively; and, finally, \(V_{gr}\) is the air mass volume in the greenhouse. The phenomenological model used for internal humidity \(X_{gr}\) estimation is defined as:  
\[X_{gr}^{aux}\bigg{(}k+\frac{j}{J}\bigg{)} =X_{gr}^{aux}\bigg{(}k+\frac{j-1}{J}\bigg{)}+\Delta t_{s}\cdot dX \bigg{(}k+\frac{j-1}{J}\bigg{)}, \tag{13}\] \[dX\bigg{(}k+\frac{j-1}{J}\bigg{)} =-dX_{ren}\bigg{(}k+\frac{j-1}{J}\bigg{)}+dX_{evap}\bigg{(}k+\frac {j-1}{J}\bigg{)}-dX_{c}\bigg{(}k+\frac{j-1}{J}\bigg{)}, \tag{14}\]  
where \(dX\) is the total humidity variation. Additionally, in (14), \(dX_{ren}\) corresponds to the absolute humidity variation via air exchange, which is computed as:  
\[dX_{ren}(k)=\frac{V_{gr}Ren(k)}{3600}(X_{gr}(k)-X_{ext}(k)), \tag{15}\]  
where \(Ren\) is the air renovation rate. \(dX_{evap}\) represents the absolute humidity variation via evapotranspiration, which is obtained using:  
\[dX_{evap}(k)=\frac{\sum_{-1}^{Crops}1000 ET_{R_{R}}(k)A_{c}}{V_{gr}3600} \tag{16}\]  
similar to the expression in Equation (12) for the heat loss case. Finally, \(dX_{c}\) is the absolute humidity variation via condensation, which is obtained based on:  
\[dX_{c}(k)=\frac{A_{g}}{V_{gr}}g_{c}\{0.2522e^{0.0485\cdot T_{gr}(k)}\}(T_{gr} (k)-T_{ext}(k))-(X_{gr}^{sat}(k)-X_{gr}(k))\}, \tag{17}\]  
\[g_{c}=\max\bigg{(}0,P_{gc}\big{(}T_{gr}-T_{c}\big{)}^{\frac{1}{3}}\bigg{)}, \tag{18}\]  
where \(P_{gc}\) is a constant that was computed in [24] based on the area of the greenhouse, and \(T_{c}\) is the temperature of the greenhouse cover. At this point, the different models presented above could be used to obtain the climate predictions necessary for the short-term control of the greenhouse. However, some elements of the control strategy required medium-term predictions to obtain adequate references for water use in the greenhouse. In this case, it is not recommended to use the same kind of model because of the loss in precision when trying to obtain predictions far into the future. The process of medium-term prediction is described in the following subsection.