# Energy-Water Management System Based on MPC for a Greenhouse in a Mapuche Indigenous Community
## 4 Climate Predictions
### Medium-Term Climate Prediction  
The main objective of medium-term climate prediction is to estimate the reference evapotranspiration daily for the next 28 days; this is required because these estimates play an important role in the WMS, as described in detail in the next section. Here, it was possible to reduce the needed information to the following variables: net radiation in the greenhouse \(R_{n}(k)\), wind speed at height \(z\)\(u_{z}(k)\), maximum greenhouse temperature \(T_{max}(k)\), minimum greenhouse temperature \(T_{min}(k)\), maximum greenhouse relative humidity \(HR_{max}(k)\), and minimum greenhouse relative humidity \(HR_{min}(k)\). For the first two days, it was possible to reuse the short-term prediction results; however, for subsequent days, other strategies are used.  
To estimate \(R_{n}(k)\), the following equations are used:  
\[R_{n}(k) =\frac{R_{sm}(k)}{A_{g}}\cdot\frac{86,400}{1,000,000}, \tag{19}\] \[R_{sm} =A_{s}\cdot\big{[}Irra(k)\cdot\big{(}\alpha_{gr}+\tau_{gr}\cdot \alpha_{gc}\big{)}\big{]}, \tag{20}\]  
where \(\alpha_{gr}\) and \(\tau_{gr}\) are the absorptivity and transmissivity coefficients for the greenhouse structure, respectively; \(\alpha_{gc}\) is the absorptivity coefficient of the crops and soil and is proportional to the amount of ground cover; and \(R_{ms}\) is the average radiation inside the greenhouse on day \(k\). The second term of (19) is a transformation factor that allows Wm\({}^{-2}\) to be transformed to MJ m\({}^{-2}\)day\({}^{-1}\); this factor considers the number of seconds in a day and the conversion factor from units to Mega units. Additionally, \(A_{g}\) and \(A_{s}\) correspond to the area of the greenhouse floor and cover, respectively. In (20), the solar irradiance \(Irra(k)\) is the mean irradiance predicted for day \(k\) using a moving average.  
A fixed value is used for future wind speed \(u_{z}(k)\) and, consequently, \(u_{2}(k)\). This value is calculated as follows:  
\[u_{2}(k)=\max\Bigl{(}W_{perf}u_{2}^{avg},0.5\Bigr{)} \tag{21}\]  
where \(W_{avg}\) is the average openness of windows during simulations, and \(u_{2}^{avg}\) is the average wind speed at a height of 2 m.  
Finally, the estimated averages for the first two days predicted with the short-term models are used for the greenhouse temperature and the relative humidity. Thus, the values \(T_{min}(j)\), \(T_{max}(j)\), \(HR_{min}(j)\), and \(HR_{max}(j)\) are fixed for all \(j\geq 3\) and equal to the average of values on the first and second days of the prediction horizon (e.g., for \(j\geq 3\), \(T_{min}(j)\) is the average value between \(T_{min}(1)\) and \(T_{min}(2)\)). This approach was used because the predictions provided by the model are less accurate in the medium term than in the short term due to the high stochasticity of the climatic variables and the limited availability of data for establishing long-term predictive models.  
It was assumed that all of these variables could be regulated with greenhouse climate control. Therefore, their behavior should be the same across the prediction horizon under similar conditions.  
With the predictive models for the short and medium terms, the greenhouse control could be established. In the following section, the details of climate control and the energy and water management systems are provided.