## 6 Conclusions  
This paper has described a novel design for the integrated management of energy and water as an EWMS for agriculture that employs a connected microgrid.  
We have constructed the modules of the EWMS using an MPC approach based on phenomenological models with climate conditions in order to predict the impact of actions over a future horizon. In the medium term, with a prediction horizon of 28 days and a sampling time of one day, the WMS estimates optimal irrigation volumes for crops and transmits information to the EMS. The EMS dispatches the distributed energy resources in the short term, with a prediction horizon of 48 h and a sampling time of 10 min, to satisfy the pumping water requirements. Meteorological forecasts allow hardening constraints during thoughts to avoid depleting the aquifer. In addition, pumping constraints limit reductions in the aquifer level. This strategy integrates the management of both resources and includes constraints that avoid affecting the neighboring wells in the community.  
The EWMS was tested using real data from a rural community in southern Chile. The results show that not all crops meet the minimum requirements, as they are influenced by the presence of different precipitation levels. In periods when there is little rainfall, there is no aquifer recharge, so irrigation cannot be performed. If these periods occur at critical times during cultivation, the yield will be severely diminished, possibly leading to a loss of all production. The EWMS has the flexibility to include different crops and aquifers to search for the best economic return from the crop yields according to the available water and energy. This flexibility makes EWMS suitable for boosting the local economic development of isolated communities that have access to microgrids for power generation. The methodology developed in this study is intended to be applied to other communities with similar water issues requiring the optimization of the water-energy-food nexus. The implemented EWMS optimizer allows modifications and extensions, and we intend to apply it in a real case at the pilot scale.  
Project administration, D.S.; Conceptualization, T.R., D.S., C.M. and L.D.; Data curation, T.R.; Formal analysis, T.R., D.S., C.M. and L.D.; Investigation, T.R., D.S., C.M. and L.D.; Methodology, D.S., C.M. and L.D.; Validation, T.R. and L.D.; Visualization, T.R., D.S., C.M. and L.D.; Writing--original draft, T.R., D.S., C.M. and L.D.; Writing--review and editing, T.R., D.S., C.M. and L.D. All authors have read and agreed to the published version of the manuscript.  
This research was funded by CONICYT/FONDECYT (grant number 1170683) \"Robust Distributed Predictive Control Strategies for the Coordination of Hybrid AC and DC Microgrids,\" the Instituto Sistemas Complejos de Ingenieria (ISCI) funded by ANID PIA BASAL (grant number AFB180003), the Solar Energy Research Center SERC-Chile funded by ANID/FONDAP (grant number 15110019), and the Centro de Excelencia en Geotermia de los Andes (CEGA) funded by ANID/FONDAP (grant number 15090013).  
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analysis, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Scenario** & **Costs [\(CLP\)]** & **Profit [\(CLP\)]** & **Water Consumption [m\({}^{3}\)]** \\ \hline \(S_{0}\): Normal rainfall & 120,343 & 1514 & 1159.2 \\ \hline \(S_{1}\): Decreased rainfall of 15\% & 127,135 & 1511 & 1090.2 \\ \hline \(S_{2}\): Decreased rainfall of 30\% & 140,840 & 1467 & 1105.3 \\ \hline \hline \end{tabular}
\end{table}
Table 3: EWMS results using the baseline and reduced rainfall scenarios.