## 2 Materials and Methods
### The Analogs Ensembles Method
The hypothesis is that, under certain circumstances (i.e., a particular season and/or service), it could be more beneficial to use over-estimative forecasts, while in other circumstances it might be more beneficial to use under-estimative forecasts. This is a novel way to deal with the intrinsic uncertainty of the PV production without the heavy computational burdens of commonly-used probabilistic optimization methods, such as stochastic programming, which has been used to deal with uncertainty in an EMS of a MG [11], but it is usually demanding in terms of computational resources and time. The QF approach gives the EMS an interesting capability of adaptation to different conditions as well as target services, in order to obtain the best performance possible in every situation, with very light computational requirements. All of the data have a time resolution of one hour. The aforementioned forecasts are retrieved for the site of Ecole Polytechnique (Palaiseau, France), while ground measurements for the same site are obtained from the SIRTA atmospheric observatory [31] for the years 2016 to 2018, with the same time resolution. For this work, we considered the forecasts released every 24 h, at midnight, whose target day is the same day D. The database is split in two periods: the data from the 8 th of october 2015 to the 7 th october 2017, is used as the historical database required by the AnEn to find the analogs; and the period from the 8 th of October 2017 to the 18 th October 2018 is used as the test period over which all of the performance indicators are computed. The expected PV output power of the Drahi-X building is obtained while using the GHI forecasts/measurements obtained for the study-case site. With these data, a factor is applied that matches the expected peak-power of the PV-array with the standard solar irradiance conditions (i.e., 1000 W/m\({}^{2}\)). This factor does not take into account temperature, shading or tilting effects. Even when this is not a realistic assumption, it was decided to do such simplification as in this work, one of the main objectives is to study the effects of the uncertainty of the solar resource over a MG. Hence, for consistency, GHI is considered to be the only stochastic variable and the main source of uncertainty of the PV power output. In this way, the effects of the solar resource uncertainty are isolated, without interference from other sources of uncertainty, such as temperature effects, shading, and tilting effects, or conversion efficiencies of the power converters, which are out of the scope of the present work. The prices of the electricity are assumed those of EDF (Electricite de France) for the Tempo tariff [32]. The prices vary according to three different types of days: blue, white, and red. For each type of day there are two different prices: peak-hour (HP), that goes from 06h00 to 22h00; and non-peak hour (HC), that covers from 22h00 to 06h00. There is also a contracted power monthly fee that has to be paid according to the peak power required from the grid. This contract is annual, which means that once a given peak power has been contracted, the corresponding monthly fee will be the same throughout the year. The data of the CO\({}_{2}\) content of the electricity from the utility grid are taken from the transmission system operator in France, RTE (Reseau de Transport d'Electricite) [33]. They supply real-time and historical data of the energy generation mix and CO\({}_{2}\) footprint of the electricity being produced at every moment of the year. The data has 30 min. time steps and were also averaged out to 1 h time resolution. It is important to mention that, in this work (as implemented by authors, like [PERSON] et al. [34]), the forecasts of electric consumption, prices, and carbon footprint of the electricity from utility grid, are always assumed perfect. This is done with the purpose of isolating the effects of the PV power production, and being able to evaluate \"independently\" its impact upon the EMS strategies.