## 4 Conclusions  
A new framework methodology for energy management in smart-buildings that are equipped with a photovoltaic plant and a battery storage system has been presented. Four services that are related with economical and environmental aspects are used to evaluate performance that target not only the microgrid users, but also the distribution system operator. A novel service in the domain of microgrids, the grid commitment. Its purpose is to turn a microgrid into a deterministic prosumption (i.e., production-consumption) unit, to the view of the distribution system operator. The results show that an EMS with optimization-based scheduling strategies, as the ones hereby proposed, is able to outperform the different reference strategies in every service, with improvements of up to 50% in some cases, with the exception of the carbon footprint, where having no microgrid (MG) produces, on average, 4.9% less carbon emissions. More accurate forecasts (e.g., numerical weather prediction forecasts compared to eccentric quantiles from the analog ensemble method) are seen to result in a better performance, particularly for EC and CO\({}_{2}\) indicators. However, for some services, in particular the grid-commitment and grid-peak-power, and for some optimisation periods, this is not the case. This is particularly palpable in the seasonal analysis, where scheduling strategies using eccentric quantile forecasts outperform numerical weather prediction forecasts (NWP). Improvements in performance of 16.7% for GPP during winter or 24.1% for CO\({}_{2}\) emissions during autumn can be obtained. In an annual-based analysis, quantile forecasts permit obtaining better performance in EC, CO\({}_{2}\), and GC, in comparison with the deterministic NWP forecasts. However, the improvement is mostly marginal. At the same time, in a seasonal-based analysis, the advantages of using quantile forecasts  
Figure 8: Flow planning that depicts the main research questions and answers addressed in Section 3.  
can be more significant, achieving improvements in performance of 16.7% for GPP during winter or 24.1% for CO2 emissions during autumn, with respect to the base-case NWP forecasts. The results confirm that the best service indicator is found when the scheduling optimization is oriented for that service, while under-performing in the non-targeted services. Targeting the grid-commitment is the most expensive decision, as it is the one that affects more negatively the other services. This is due to the massive PV curtailment that is provoked by the use of a very pessimistic forecast (AnEn\({}_{\tau=0.1}\)). Therefore, a good compromise to obtain fairly good performance in all services, is found with the GPP\({}_{\text{min}}\)-AnEn\({}_{\tau=0.4}\) strategy, followed by the EC\({}_{\text{min}}\)-AnEn\({}_{\tau=0.5}\) strategy. The seasonal analyses show that the best accuracy of forecasts and performance of EC, CO2 and GPP is obtained in summer and spring,while the worst performance is obtained in winter and autumn. Winter is particularly the season when the price of the electricity is the highest and solar resource is at its lowest, while autumn is the period when the energy is more loaded with CO2. As quantile forecasts allow for customising the scheduling optimization for each season of the year, the implementation of a seasonally-adapted EMS strategy might be plausible. However, the results for this study-case demonstrated that a seasonal EMS strategy is only beneficial regarding the energy-cost, where a decrease of up to 9.1% can be achieved. F.C.-O. : Main research, results analysis, figures and tables creation and writing of the article. J.B.: Revision and validation of results, funding obtention. A.M.-D., V.B. : Revision of the article. All authors have read and agreed to the published version of the manuscript. This action benefited from the support of the Chair-Challenging Technology for Responsible Energy--led by 1Y--Ecole polytechnique and the Fondation de l'Ecole polytechnique, sponsored by TOTAL.