Prof Corinne Alonso

Prof M Josep

Guerrero

Dr Joseph M Guerrero

Juan C Vasquez

for the opportunity they gave me to perform my international internship in their facilities. That was a very enriching experience professionally speaking but also from a personal and cultural perspective.

I thank all the intern students who collaborated, in one way or another, during the different stages of this work. Their hard work, stimulating

Declaration

I hereby declare that except where specific reference is made to the work of others, the contents of this dissertation are original and have not been submitted in whole or in part for consideration for any other degree or qualification in this, or any other university. This dissertation is my own work and contains nothing which is the outcome of work done in collaboration with others, except as specified in the text and Acknowledgements. This dissertation contains fewer than 65,000 words including appendices, bibliography, footnotes, tables and equations and has fewer than 150 figures.

Fausto CALDERON-OBALDIA

July 2020

Abstract

The research work hereby presented, pretends to contribute with the well-known issue of dealing with the uncertainty of intermittent renewable sources (solar photovoltaic particularly) in a microgrid. More specifically, the objective of this work is to evaluate the impacts of solar photovoltaic production uncertainty in the performance of a microgrid that serves a smart-building, and to propose, test and validate strategies to deal with it. To tackle this problematic the work has been divided in three parts. First, the design and construction of a -laboratory scale-nanogrid (300W peak consumption) has been carried out, along with a control interface to interact with the system and collect the data. This system is intended to emulate a microgrid that is being deployed in the Drahi-X Novation Center building (campus of Ecole Polytechnique, Palaiseau, France, 48,7ºN, 2.2ºE), so that it serves as a test-bench for different energy management scenarios. The system conceived presents a direct-current common-bus architecture, where the power is freely exchanged among all the elements of the microgrid. The nanogrid is equipped with a measurements system, disconnection means for every element, as well as the capacity to control the power transacted by the battery, to some extent. The following of the real-time -scaled-consumption of the Drahi-X building is also possible. Some remote monitoring and control capabilities are included, as well as the gathering of some meteorological variables. Several months of power-flows data were gathered, that served for different analysis regarding the electrical interactions among elements of the nanogrid. This helped to improve the understanding of these type of systems in order to propose proper solutions for the uncertainty issue mentioned above. The nanogrid also served as a pedagogical tool that allowed many students to get a hands-on knowledge regarding microgrids through several practical experiences and internship projects that were performed in our laboratory using the nanogrid. The pedagogical and demonstrative outcomes obtained from the implementation of the nanogrid are considered very significant objectives for the laboratory as well as for the interests and future academic career of the author of this work.

In a following step, the topic of solar irradiance forecasts is addressed. Profiting from the expertise of the SIRTA atmospheric observatory and the Dynamic Meteorologic Laboratory in the domain of weather forecasting, a collaborative work was performed in order to evaluate x what is the reliability of readily available day-ahead solar irradiance forecasts which in turn, will be used to produce predictions of photovoltaic power production. For this, an analogsensembles method is proposed to obtain probabilistic information from the above-mentioned deterministic forecasts, to evaluate its eventual added value for an energy management system. The adapted analogs-ensembles method proposed demonstrated superior performance with respect to reference -probabilistic-forecasting methods, such as persistence, monthly climatology and a well-known commercially-available probabilistic forecasting method from the European Centre for Medium-Range Weather Forecasts (ECMWF). The methods were evaluated based on the quantile skill score decomposed in reliability, resolution and uncertainty, which are state-of-the-art metrics for probabilistic forecasting assessment. Besides, the quantile forecasts obtained from the analogs-ensembles proved to be an interesting solution to reduce forecasting uncertainty, as they provide information about the bias of the forecasting error. If chosen properly, this feature might be beneficial for the resource scheduling tasks performed by an energy management system, as proven in the last part of this work.

In the third section (Chapter 4), insights of the previous parts of this work were used in order to propose energy management strategies with the aim to deal with the uncertainty issue of PV production. These strategies are meant to favor different services that were chosen as indicators of performance for the study-case building, namely: the energy cost, the carbon footprint of the energy, the grid contracted power and the grid commitment. The impact of such strategies in the performance of the study-case microgrid is evaluated, using different forecasting approaches. The particularity of the quantile forecasts used (i.e. providing some degree of certainty regarding the bias of their errors), proved to improve performance on some of the services proposed, by properly choosing the quantile to be used. It helped in providing flexibility when facing different production, consumption and pricing scenarios. The energy management strategies proposed were compared to different reference strategies, including the case when no microgrid was deployed, in order to have a more meaningful idea of the real added-value of the strategies proposed and the microgrid deployment. In general, the EMS strategies and the quantile forecasting method proposed, outperformed the reference strategies in almost all the scenarios studied. Therefore, the presented work brought promising answers and elements that are worth putting in practice to further validate their added value in a real system.

xi

Résumé

Les travaux de recherche présentés ici sont nés de l'envie de répondre à la question bien connue de savoir comment l'incertitude des sources renouvelables intermittentes affecte les performances d'un micro-réseau et comment nous pourrions y faire face. C'est l'un des principaux inconvénients que les sources d'énergie renouvelables intermittentes doivent surmonter sur leur chemin vers les niveaux de pénétration requis pour contenir le réchauffement climatique. Par conséquent, trouver une approche adéquate pour traiter cette question, donnerait à la production distribuée avec des sources d'énergie renouvelables intermittentes une valeur ajoutée significative dans cette direction. Plus précisément, nous évaluons l'impact que pourrait avoir sur les performances l'incertitude des prévisions relatives aux ressources solaires dans un micro-réseau équipé de panneaux photovoltaïques et de batteries pour le stockage d'énergie. En outre, nous voulons proposer des stratégies pour traiter cette question. Même si plusieurs auteurs ont abordé le sujet sous des angles différents, les recherches menées ici proposent une approche intégrale où le sujet est abordé sous trois angles différents.

• Matériel et émulation: le développement d'un micro-réseau à l'échelle du laboratoire qui permet une meilleure compréhension des interactions électriques qui se produisent dans un micro-réseau et qui sert d'émulateur au futur micro-réseau Drahi-X

• Le problème de l'incertitude des prévisions: des informations sur l'incertitude des méthodes de prévision disponibles dans le commerce sont obtenues, et une méthode est proposée pour générer des informations probabilistes à partir de prévisions déterministes facilement disponibles

• Le problème de la gestion énergétique des micro-réseaux en situation d'incertitude: sur la base des caractéristiques du futur micro-réseau Drahi-X et des mesures historiques de la production et de la consommation d'énergie solaire, une stratégie de gestion énergétique est proposée qui prend en compte les informations probabilistes de la production solaire. Les impacts sur la performance du micro-réseau sont évalués sur la base de certains indicateurs de performance qui sont liés à certains services qui xii devraient être fournis par le bâtiment intelligent Drahi-X. Les recherches effectuées dans le cadre de ce travail tournent autour d'un cas d'étude particulier: le bâtiment Drahi-X Le micro-réseau du bâtiment Drahi-X Situé sur le campus de l'École Polytechnique (Palaiseau, France), le Drahi-X Novation Center -La fibre Entrepreneur, incubateur et accélérateur de start-ups, est un bâtiment à vocation tertiaire qui possède principalement des bureaux, des ateliers électroniques, ainsi que des salles de réunion et de vidéoconférence. Le système de chauffage/refroidissement est centralisé et électrique (avec des pompes à chaleur), et correspond à la plus grande partie de la consommation électrique du bâtiment. Le bâtiment est divisé en différentes zones, avec des panneaux électriques indépendants à partir desquels les données électriques sont enregistrées. Dans ce travail, nous nous concentrons sur une zone de consommation (zone 1) qui comprend principalement des bureaux et quelques laboratoires à faible consommation. Nous avons choisi de travailler exclusivement sur la consommation de la zone 1, afin de conserver un rapport production/consommation raisonnable en fonction de la capacité photovoltaïque installée prévue. Ce bâtiment est équipé de panneaux photovoltaïques, de batteries de stockage d'énergie et de certaines capacités de contrôle qui permettront de mettre en oeuvre et de tester différentes stratégies de gestion de l'énergie. Le but de l'installation du micro-réseau dans ce bâtiment est principalement de servir de démonstrateur à des fins d'enseignement et de recherche pour les étudiants de l'Ecole Polytechnique et les externes.

Le critère utilisé pour dimensionner la batterie était de permettre le stockage de deux heures d'énergie photovoltaïque, si le réseau photovoltaïque fournit sa puissance maximale. Cela a été jugé suffisant par l'équipe de conception, pour permettre la mise en oeuvre de stratégies de systèmes de gestion de l'énergie qui utilisent le stockage d'énergie, sans le surdimensionner, puisque le micro-réseau sera connecté au réseau. En outre, en raison de la nature du bâtiment (secteur tertiaire), la consommation la plus élevée se produit pendant la journée, ce qui permet d'utiliser directement l'énergie photovoltaïque sans avoir besoin de la stocker. En plus, selon les calculs, cette taille de batterie permet d'avoir un taux d'auto-consommation annuel moyen de 85%, tandis que les 15% restants de l'énergie photovoltaïque sont destinés à alimenter le point de chargement des véhicules électriques. Le taux d'auto-consommation est la proportion de l'énergie photovoltaïque potentielle (c'est-à-dire disponible) qui est effectivement utilisée dans le micro-réseau, soit pour alimenter directement la charge, soit pour charger la batterie. Les chargeurs/inverseurs de chaque batterie permettent de contrôler à distance l'échange d'énergie de la batterie si on le souhaite, ce qui permet de mettre en place un système de gestion de xiii l'énergie. En l'absence de ce dernier, ils disposent d'un système de gestion des batteries préréglé qui peut prendre en charge la gestion des batteries. Les panneaux solaires disposent d'optimiseurs de puissance maximale indépendants pour assurer un suivi indépendant de leur point de fonctionnement optimal. Comme mentionné ci-dessus, le micro-réseau disposera également d'un point de recharge pour les véhicules électriques, mais étant hors du champ de cette étude, il n'est pas pris en compte dans ce travail.

Les trois branches utilisées pour aborder le principal problème de recherche de cette thèse, donnent lieu à trois questions de recherche principales, qui sont la colonne vertébrale du travail. Ces questions principales donnent lieu, à leur tour, à plusieurs sous-questions -plus spécifiques-qui sont abordées dans chaque chapitre de cette thèse.

Emuler le micro-réseau d'un bâtiment à l'échelle d'un laboratoire L'observatoire atmosphérique SIRTA et le Laboratoire de Météorologie Dynamique (LMD) sont situés sur le campus de l'Ecole Polytechnique, à Palaiseau, France, et ont une longue expertise dans le domaine de la mesure et de la prévision des ressources solaires (et de la prévision météorologique en général). Motivés par la création d'un centre de recherche interdisciplinaire, le SIRTA et le LMD, en association avec d'autres laboratoires, ont lancé une nouvelle branche de recherche sur les micro-réseaux et ont créé le Laboratoire de recherche sur les nanoréseaux (NRLAB). L'idée était de trouver différentes applications à l'ensemble des connaissances et des accès aux données dont ils disposent dans le domaine de la prévision solaire, dans le but de contribuer à la résolution de l'une des plus grandes contraintes que connaissent les sources d'énergie renouvelables intermittentes lorsqu'il s'agit de leur déploiement massif: leur incertitude intrinsèque. C'est ce qui a donné naissance à cette thèse qui s'inscrit dans cette idée d'explorer les implications que les prévisions météorologiques et leur incertitude intrinsèque apportent au système de gestion de l'énergie d'un micro-réseau, et tous les enseignements qui peuvent être tirés de cette expérience.

Dérivée de cette idée fondatrice du NRLAB, la première question de recherche qui s'est posée était: comment émuler un micro-réseau de la taille d'un bâtiment (avec des panneaux photovoltaïques et un stockage d'énergie par batterie) avec des capacités de gestion de l'énergie, afin d'émuler un micro-réseau à échelle réelle au service d'un bâtiment intelligent?

Cela soulève plusieurs questions, telles que: quels sont les aspects clés à prendre en compte lors de la construction/gestion d'un véritable micro-réseau ? quelles sont les principales différences entre le travail avec un véritable micro-réseau et le travail avec un système simulé par ordinateur? comment les flux d'énergie s'équilibrent-ils dans un système, avec l'architecture proposée ici, et comment peut-on les manipuler? Ces questions répondent au besoin d'avoir une connaissance pratique plus approfondie des interactions électriques xiv complexes -et parfois contre-intuitives-entre les éléments d'un micro-réseau, ainsi que des contraintes posées par l'incertitude de la production solaire, afin qu'une stratégie appropriée pour la contrer puisse être développée efficacement. Ce dernier point constitue le premier objectif général de cette thèse et, par conséquent, la conception, le dimensionnement et la construction d'un micro-réseau à l'échelle du laboratoire à des fins d'enseignement et de recherche ont été considérés comme une manière pertinente de commencer ce travail de recherche.

Avec cet objectif pédagogique en tête, le développement d'un système permettant aux étudiants de réaliser des projets pratiques autour du thème des micro-réseaux, des énergies renouvelables et de la gestion de l'énergie était une exigence. Pour atteindre cet objectif, la capacité à collecter des données de variables météorologiques et de flux d'énergie de tous les éléments du système était indispensable. De plus, il était envisagé de doter le matériel de certaines capacités de gestion de l'énergie afin que certaines stratégies de gestion de l'énergie puissent être testées sur cet établi. Le système a été construit en trois itérations, qui ont été nécessaires pour résoudre différents problèmes jusqu'à atteindre un niveau acceptable de fonctionnalité, de précision et de stabilité des mesures. Dès sa conception, le système a été considéré comme équivalent au micro-réseau qui est déployé dans le batîment du Drahi-X, pour donner au micro-réseau une plus grande valeur ajoutée en répondant à un cas d'étude réel.

Le micro-réseau NRLAB à l'échelle du laboratoire (également appelée nanogrid en raison de sa petite taille), a été dotée de la capacité de suivre en temps réel la consommation du bâtiment Drahi-X, avec un facteur d'échelle choisi par l'utilisateur et limité à une consommation de pointe de 300W. La consommation est émulée par une charge électronique en courant continu entièrement contrôlable. Le nanoréseau est équipé d'une batterie lithium-ion 40Ah-12V, et le rapport entre la puissance de pointe photovoltaïque installée et la capacité de la batterie est équivalent à celui prévu pour le micro-réseau Drahi-X. Il existe également une source d'énergie contrôlable en courant continu, qui joue le rôle de connexion avec le réseau électrique, alimentant le nanoréseau en énergie lorsque la production photovoltaïque ne suffit pas à satisfaire la demande. Le nanoréseau est équipé d'un panneau photovoltaïque de 365Wp situé sur le toit du laboratoire, comme principale source d'énergie renouvelable. En raison de la proximité géographique du laboratoire (où le nanogrid est déployé) et du bâtiment Drahi-X (tous deux situés sur le campus de l'École Polytechnique), on peut considérer que les conditions météorologiques affectent les deux sites de manière similaire en termes de température et de rayonnement solaire, et qu'ils présentent donc une production photovoltaïque très similaire. Le nanoréseau est également doté de certaines capacités matérielles de base en matière de contrôle et de gestion de l'énergie, qui imitent celles prévues pour le micro-réseau xv du Drahi-X. Ces capacités sont les suivantes: contrôle de l'énergie échangée avec la batterie, connexion/déconnexion de tout élément, collecte de données en temps réel sur l'irradiation solaire, la vitesse du vent et la température de l'air, ainsi que la tension, le courant et la puissance de chaque ressource. Une description détaillée des caractéristiques, du principe de fonctionnement ainsi que de l'évolution du système jusqu'à l'état actuel est présentée au chapitre 2.

L'incertitude liée à une prévision solaire déterministe

La deuxième question générale, considérée comme un aspect essentiel de cette recherche, est la suivante: comment extraire les informations relatives à l'incertitude d'une prévision déterministe commercialement disponible? Cette question répond au besoin de savoir dans quelle mesure une prévision déterministe donnée, utilisée comme entrée dans le système de gestion de l'énergie d'un micro-réseau (qui effectue la programmation un jour à l'avance), est fiable et de trouver un moyen d'exprimer cette information de manière à ce qu'elle puisse être intégrée dans le système de gestion de l'énergie d'un micro-réseau. Ceci constitue le deuxième objectif général de cette thèse, qui est développé dans le chapitre 3.

Des questions connexes se posent lorsqu'on aborde cet objectif général, telles que: comment la précision des prévisions déterministes est-elle liée aux différentes conditions météorologiques? pouvons-nous proposer une méthode qui fournisse davantage d'informations (c'est-à-dire probabilistes) concernant la prévision des ressources solaires? quels indicateurs et méthodes pouvons-nous utiliser pour mesurer correctement l'efficacité d'une telle méthode? Pour répondre à ces questions, nous avons profité de l'expertise du observatoire météorologique SIRTA et le laboratoire de météorologie dynamique (LMD) dans le domaine des prévisions météorologiques, pour établir un travail de collaboration afin d'évaluer la fiabilité des prévisions d'irradiation solaire un jour à l'avance, qui seront à leur tour utilisées pour produire des prévisions de production d'énergie photovoltaïque. Le observatoire SIRTA a fourni toutes ses installations (également situées sur le campus de l'École Polytechnique) et l'accès aux données afin de réaliser notre étude.

Avec ce matériel, une approche permettant d'obtenir des informations probabilistes sur l'irradiation solaire à partir des prévisions numériques et météorologiques disponibles (ARPEGE de MétéoFrance) a été proposée. Les prévisions sont un élément important pour une stratégie de gestion de l'énergie, et dans ce cas, l'impact de leur incertitude a également été étudié. Par conséquent, une approche d'ensembles d'analogues a été mise en oeuvre et adaptée pour ce cas d'étude, de sorte que des informations probabilistes des prévisions déterministes originales puissent être extraites. L'approche utilise des prévisions à un jour de l'irradiation solaire horizontale, de la température et de l'humidité relative. Le xvi principe de fonctionnement de la méthode des ensembles d'analogues proposée est basé sur la disponibilité d'une prévision déterministe qui est ensuite comparée à une base de données de prévisions passées pour le même site, et les prévisions passées les plus "similaires" en termes de valeurs ponctuelles ainsi que de tendances temporelles à court terme, sont choisies. Les mesures correspondantes de l'irradiation solaire horizontale pour les prévisions choisies (également disponibles dans la base de données), sont prises pour conformer l'ensemble des analogues. À partir de cet ensemble, les 10me et 90me quantiles sont obtenus et comparés aux méthodes probabilistes de référence, en termes de fiabilité, de résolution et d'incertitude par le biais du quantile-skill-score. Les résultats montrent une performance supérieure de la méthode des ensembles d'analogues proposée par rapport aux méthodes de prévision probabilistes de référence telles que la persistance, la climatologie et même le système de prévision d'ensemble -disponible dans le commerce-du Centre Européen pour les Prévisions Météorologiques à Moyen Terme (ECMWF par son nom anglais). De cette manière, les prévisions quantitatives obtenues à partir des ensembles émis par la méthode des ensembles des analogues se sont avérées être une bonne source d'informations probabilistes/d'incertitude des prévisions déterministes utilisées comme intrants de notre approche de prévision. La méthode produit des ensembles de mesures de l'irradiance horizontale globale correspondant à des prévisions similaires (c'est-à-dire analogues) à la prévision en cours d'analyse. Des informations probabilistes sont extraites de ces ensembles sous la forme de prévisions quantile, qui sont utilisées dans les stratégies de gestion de l'énergie proposées dans la dernière étape de ce travail.

La gestion énergétique d'un micro-réseau sous l'incertitude de la production solaire La dernière question de recherche générale de ce travail, qui relie les résultats précédemment obtenus lors des deux premières étapes de la recherche, est la suivante: quelle pourrait être la valeur ajoutée de l'inclusion d'informations sur l'incertitude des prévisions de production photovoltaïque, dans le système de gestion énergétique d'un micro-réseau? Cela donne lieu à des questions dérivées telles que: à quoi pourrait ressembler un système de gestion de l'énergie, qui prend en compte les informations sur l'incertitude de la production photovoltaïque? Comment différents scénarios et stratégies de gestion de l'énergie (incluant ou non des informations sur l'incertitude des prévisions) peuvent-ils affecter la performance du micro-réseau étudié? Et comment le ciblage d'un service (lors de la planification optimale des ressources du micro-réseau) peut-il avoir un impact sur les autres services choisis pour quantifier les performances? Ces questions sont destinées à contribuer, dans une certaine mesure, à la réduction des effets négatifs causés par l'incertitude de la production photovoltaïque xvii dans un micro-réseau qui dessert un bâtiment intelligent, ce qui est l'objectif principal et final de cette thèse.

Comme première étape vers la réalisation de cet objectif, nous proposons un système de gestion de l'énergie qui inclut des informations probabilistes concernant la production d'énergie photovoltaïque. À cette fin, l'utilisation des prévisions quantitatives proposées dans la deuxième partie de ce travail est choisie comme moyen d'intégrer des informations sur l'incertitude de la production photovoltaïque et d'analyser ensuite si cela pourrait apporter un avantage ou une amélioration en termes de performance. Afin de quantifier l'impact des stratégies de systèmes de gestion de l'énergie, certains services sont proposés, ainsi que les indicateurs de performance correspondants. Il s'agit des services que le bâtiment Drahi-X devrait fournir à ses utilisateurs, une fois que le micro-réseau sera opérationnel. Quatre services différents sont proposés, à savoir: le coût de l'énergie, l'empreinte carbone, la puissance contractuelle requise (puissance de pointe du réseau) et l'engagement du réseau. Sur la base des indicateurs de performance associés, différentes stratégies de gestion de l'énergie sont proposées et évaluées, portant sur deux services à la fois.

Le système de gestion de l'énergie proposé comprend deux étapes: une étape de programmation et une étape d'équilibrage. La première étape consiste à utiliser des prévisions pour générer un profil de puissance du réseau requis par le micro-réseau pour la journée à venir. Ce profil de réseau programmé est généré en privilégiant un service, à savoir: le coût de l'énergie, l'empreinte carbone ou la puissance de pointe du réseau. Cela se fait par le biais d'un algorithme d'optimisation, utilisant soit un algorithme génétique, soit une méthode de programmation non linéaire.

Le module d'équilibrage est chargé d'assurer l'équilibre entre la production et la consommation dans des conditions réelles de production photovoltaïque, en contrant les erreurs de prévision. Il accomplit cette tâche en privilégiant toujours le service d'engagement sur le réseau, ce qui signifie qu'il s'efforce de maintenir le plus longtemps possible le profil de puissance programmé sur le réseau sans modification. Pour ce faire, elle utilise une approche fondée sur des règles. L'objectif du service d'engagement sur le réseau est de donner au gestionnaire de réseau de distribution une certitude quant aux besoins en électricité du micro-réseau pour le jour suivant. Cela pourrait être réalisé en rendant le micro-réseau capable de contrecarrer l'incertitude (de la production photovoltaïque dans ce cas) en interne, avec les ressources disponibles. Cela donnerait aux micro-réseaux une valeur ajoutée intéressante dans un scénario où la production distribuée avec des énergies renouvelables devient importante par rapport au réseau de distribution.

Différents points sont étudiés dans cette partie, tels que les effets de l'intégration des prévisions déterministes et probabilistes dans les stratégies des systèmes de gestion de xviii l'énergie, les effets de la précision des prévisions, l'interaction entre les services lorsqu'un service est favorisé par rapport aux autres, ainsi que les effets des saisons. Les résultats de cette partie montrent la polyvalence de la méthode des ensembles des analogues et des prévisions quantitatives en maximisant la performance du micro-réseau concernant un service particulier pour différentes saisons, ainsi que la manière dont d'autres services sont affectés négativement lorsqu'un service est favorisé. Cependant, il est montré qu'un bon compromis de performance peut être trouvé entre les différents services, en fonction de la priorité et des exigences des utilisateurs. En considérant l'erreur de prévision comme composée de deux parties: l'ampleur et le biais; une analyse a été effectuée concernant la façon dont ces deux composantes de l'incertitude sont plus ou moins pertinentes selon le service visé.

Les saisons jouent également un rôle dans la performance du micro-réseau, qui peut être très différente de l'été (saison la plus favorable) à l'hiver (saison la moins favorable). Différentes prévisions quantitatives doivent être utilisées pour optimiser les performances en fonction des différentes saisons. Il est démontré qu'en mettant en oeuvre certaines capacités de contrôle de base, telles que le contrôle de l'échange d'énergie de la batterie/du réseau, comme celui proposé dans la première partie de cette étude, un micro-réseau peut mettre en oeuvre des stratégies de gestion de l'énergie qui peuvent favoriser un service particulier comme celles proposées ici. Ces stratégies se sont avérées efficaces pour optimiser ces services, et ont surpassé les stratégies de gestion de l'énergie de référence dans presque tous les scénarios. L'une des clés de cette réussite a été l'utilisation de prévisions quantitatives, obtenues par la méthode des ensembles analogiques, qui se sont révélées être un outil utile pour traiter l'incertitude intrinsèque des prévisions de production d'énergie photovoltaïque.

Ce travail ouvre de nombreuses voies pour des recherches ultérieures, la première étant la mise en oeuvre et l'essai des stratégies de gestion de l'énergie proposées ici dans le nanoréseau à l'échelle du laboratoire et l'évaluation des contraintes éventuelles lors de la mise en oeuvre des stratégies dans un système réel. Cela permet d'évaluer la faisabilité de leur mise en oeuvre éventuelle dans le micro-réseau Drahi-X. Le développement détaillé de ce sujet est présenté dans le chapitre 4 de cette thèse.

Chaque chapitre est structuré avec une section d'introduction, où une vue d'ensemble du sujet particulier est effectuée ainsi qu'une revue de la littérature et la présentation des principaux objectifs du chapitre. Ensuite, une description de l'étude de cas et des méthodes suivies pour aborder le problème est décrite. Au coeur de chaque chapitre, les propositions, les indicateurs et les résultats, avec leur analyse respective, sont présentés. Enfin, une section où les principales conclusions sur les résultats, ainsi que les perspectives futures pour le sujet particulier de la section, conclut le corps de chaque chapitre. to unexpected outages of the data collection system or communication problems 2.11 Example of the experimental calculation of the equivalent resistance of the circuit by measuring the power losses due to the Joule effect . . . . . . . . 2.12 Effects of power-source-voltage variations in power flows. Only Chapter 1

List of Tables

General introduction

The research work hereby presented, emerges from the urge to answer the well-known question of how the uncertainty of intermittent renewable sources affect the performance of a microgrid? and how could we deal with it? This is one of the main drawbacks that intermittent renewable energy sources (IRES) must overcome on their way towards the levels of penetration required to contain global warming. Therefore, finding an adequate approach to deal with this issue, would give distributed generation with IRES a significant added value in this direction. More specifically, we evaluate what could be the impact in performance of the uncertainty of solar-resource forecasts in a microgrid (MG) that is provided with photovoltaic (PV) panels and battery energy storage. Besides, we want to propose strategies to deal with this issue.

Even when several authors have wandered around the subject from different perspectives [START_REF] Zhang | An Intelligent Control Strategy of Battery Energy Storage System for Microgrid Energy Management under Forecast Uncertainties[END_REF][START_REF] Mazzola | Assessing the value of forecast-based dispatch in the operation of off-grid rural microgrids[END_REF][START_REF] Li | Combined Two-Stage Stochastic Programming and Receding Horizon Control Strategy for Microgrid Energy Management Considering Uncertainty[END_REF][START_REF] Shimomachi | Development of energy management system for dc microgrid for office building:-day ahead operation scheduling considering weather scenarios[END_REF][START_REF] Khodaei | Microgrid Planning Under Uncertainty[END_REF][START_REF] Gholami | Microgrid Scheduling With Uncertainty: The Quest for Resilience[END_REF][START_REF] Zhang | Model predictive control-based operation management for a residential microgrid with considering forecast uncertainties and demand response strategies[END_REF][START_REF] Agüera-Pérez | Weather forecasts for microgrid energy management: Review, discussion and recommendations[END_REF], the research hereby conducted proposes an integral approach where the subject is addressed from three different angles:

• Emulation (Hardware): the development of a laboratory-scale MG that permits a better comprehension of the electrical interactions that happen in a MG and that serves as an emulator of the Drahi-X future MG

• The forecasting uncertainty problem: uncertainty information of commercially-available forecasting methods is obtained, and a method is proposed to generate probabilistic information out of readily-available deterministic forecasts

• The energy management problem of MGs under-uncertainty: based on the characteristics of the future Drahi-X MG and historical measurements of solar production and consumption, an energy management strategy is proposed that takes into account the probabilistic information of the solar production. The impacts on the performance of the MG are evaluated based on some performance indicators that are linked to some services expected to be provided by the Drahi-X smart-building

The research performed in this work, spins around a particular study case: the Drahi-X building. Therefore an overall description of this study case, as well as the information that have been gathered from this site to perform the present research, is presented in the following section.

The Drahi-X building microgrid

Located on the campus of the École Polytechnique (Palaiseau, France), The Drahi-X Novation Center -La fibre Entrepreneur (Figure 1.1 ), a startup incubator and accelerator, is a tertiaryoriented building that possesses mainly offices, a fablab, electronic workshops, as well as meeting and video conference rooms. The heating/cooling system is centralized and electric (with heat pumps), and corresponds to the biggest portion of the electric consumption of the building. The building is divided in different zones, with independent electrical panels from which the electrical data is recorded. In this work, we focus on one consumption zone (hereafter, zone 1), which has mainly offices and some low-consumption labs. We chose to work exclusively with the consumption of zone 1, in order to keep a reasonable production/consumption ratio according to the expected PV installed capacity. This building is being equipped with PV panels, battery energy storage and some control capabilities that will allow the implementation and test of different energy management strategies.

Figure 1.2 presents a simplified illustration of the study case MG, which presents the following characteristics:

• A 16 kWp rooftop PV array with a 16 kVA 3-phase power inverter

• 3 × BYD Li-Ion battery of 10.5kWh and 9kWp each, 100% depth-of-discharge allowed • A 3-phase bi-directional connection with the rest of the building. For the seek of the study this will be assumed as a 36 kVA connection with the utility grid, as if the MG (that is, the building zone) was actually an independent building with its own electricity billing

• A data collection system that allows to record the electrical variables of all elements with a minimum time resolution of 1 minute

The purpose of installing the MG in this building is mainly to serve as a demonstrator for teaching and research purposes. The criteria used to size the battery was to allow the storage of two hours of PV energy, if the PV array delivers its maximum power (i.e 16kW). That was considered enough by the designing team, to allow the implementation of EMS strategies that make use of energy storage, without over sizing it, as the MG will be grid-connected. Besides, due to the nature of the building (i.e. tertiary sector), the highest consumption happens during the day, which permits to use the PV energy directly without the need to store it. Moreover, according to the calculations, this battery size allows to have an average annual self-consumption rate of 85%, while the remaining 15% of PV energy is envisaged to feed the charging point for electric vehicles. The self-consumption rate (SC) is the proportion of the potential (i.e. available) PV energy that is actually used in the MG, either to directly power the load or to charge the battery. The chargers/inverters of each battery pack allow the remote control of battery power exchange if desired, allowing for an energy management system (EMS) to be implemented. In the lack of the latter, they have a preset battery management system that can take charge of the management of the batteries. The solar panels have independent maximum power optimizers (DC/DC controllers) to assure independent tracking of their optimal operation point. As mentioned above, the MG will also have an electric-vehicle charging point, that is not taken into account in this study.

The three branches used to address the main research problem of this thesis, give rise to three main research questions, that are the spinal column of the work. These main queries give, in turn, rise to several -more specific-sub-questions that are tackled in each chapter of this thesis, as described in the following sections.

A building-size microgrid emulated in a experimental lab

The SIRTA atmospheric observatory (https://sirta.ipsl.fr/) and the Dynamic Meteorology laboratory (https://www.lmd.jussieu.fr/) are located in the campus of Ecole Polytechnique, Palaiseau, France and have a long expertise in the domain of solar resource measurement and forecasting (and meteorological forecasting in general). Motivated by the creation of an interdisciplinary research center (today the Energy4Climate Center), SIRTA and LMD in association with other laboratories (GeePs, Limsi, LPICM and SAMOVAR) started a new research branch on microgrids and they created the Nanogrid Research Laboratory (NRLAB). The idea was to find different applications to all the knowledge and data access they have in the domain of solar forecasting, with the aim to contribute in the solution of one of the biggest constraints that renewable energy sources have when it comes to their massive deployment: their intrinsic uncertainty. That gave rise to this thesis which is framed under this idea of exploring the implications that weather forecasts and their intrinsic uncertainty brings to MG systems, and all the learning outcomes that can be obtained from this experience. Derived from this founding idea of the NRLAB, the first research question that arose was: how to emulate a building-size microgrid (with PV panels and battery energy storage) with energy management capabilities, in order to emulate a real-scale microgrid serving a smart-building?

This brings about several -derived-queries such as: what are the key aspects to take into account when building/managing a real microgrid? what are the main differences between working with a real microgrid and working with a computer-simulated system? how do power flows balance in a system, with the architecture as the one hereby proposed, and how can they be manipulated? These queries respond to a need of having a deeper -handson-knowledge about the intricate -and sometimes counterintuitive-electrical interactions 1.1 A building-size microgrid emulated in a experimental lab 5 between the elements of a MG, as well as the constraints posed by the uncertainty of the solar production, so that, a proper strategy to counteract it could be effectively developed. The latter constitutes the first general objective of this thesis and consequently, the conception, sizing and construction of a laboratory-scale nanogrid for teaching and research purposes was considered a pertinent way to start this research work.

With this pedagogical target in mind, developing a system that allow students to perform practical projects around the topic of MGs, renewable energies and energy management was a requirement. To achieve this goal, the ability to collect data of meteorological variables and power flows of all the elements of the system was a must. Moreover, it was envisaged to provide the hardware with some energy management capabilities so that, some energy management strategies could be tested on this workbench. The system was build through three iterations, which were required to solve different issues until achieving an acceptable level of functionality, accuracy and stability of measurements.

Since its conception, the system was thought to be equivalent to the MG that is being deployed in the Drahi-X startup incubator, to give the MG a higher added-value by responding to a real study-case. However, it must be recalled that the Drahi-X MG has an AC bus whereas the nanogrid has a DC bus, therefore, no power inverters are required in the latter. This simplification was made due to the fact that the NRLAB microgrid was conceived to emulate the Drahi-X MG mostly in a high-level of energy management (i.e. the test of optimal power transaction strategies), without entering into the (low-level) technicalities of the powerconverters electronics or control algorithms proper of an AC system. A high-level EMS dictates power settings that must be followed by the elements they are intended for, regardless if the power being transacted is AC or DC. For this reason, it was considered that a DC bus nanogrid was sufficient for the purposes it is intended for.

The laboratory-scale NRLAB microgrid (also called nanogrid due to its small-size, hereafter called NG), was provided with the ability to follow in real-time, the consumption of the Drahi-X building, with a scale factor selected by the user and limited to a peakconsumption of 300W. The consumption is emulated with a fully controllable electronic DC-load. The NG has a 40Ah-12V lithium-ion battery, and the ratio between the installed PV peak power and the battery capacity is equivalent to the one projected for the Drahi-X MG. There is also a DC controllable power source, that plays the role of the connection with the utility grid, supplying power when the PV production is not enough to satisfy the demand. However, the power source can only deliver power, therefore a bi-directional connection with the utility grid could not be emulated with this hardware. The NG is equipped with a 365Wp poly-crystalline silicon PV panel located in the rooftop of the laboratory, as main source of renewable energy. Due to the geographical closeness of the laboratory (where the NG is General introduction deployed) and the Drahi-X building (both are located in the campus of Ecole Polytechnique), it can be considered that weather conditions affect both sites in a similar way in terms of temperature and solar-irradiance, hence they would present a very similar PV production. The NG is also equipped with some basic control and energy management hardware capabilities that emulate the ones foreseen for the Drahi-X MG. These capabilities are: control of the power exchange with the battery, connection/disconnection of any resource from the main bus, real-time data collection of solar irradiance, wind speed and air temperature, as well a voltage, current and power of every resource. A detailed description of the features, working principle as well as the evolution of the system up the actual state is presented in Chapter 2.

The uncertainty associated to a deterministic solar forecast

The second general question, considered a key aspect for this research, is: how to extract information related to the uncertainty of a readily-available deterministic forecast? This question responds to the need of knowing how reliable is a given day-ahead solar deterministic forecast that is used as input in the EMS of a MG (that performs day-ahead scheduling) and finding a way to express this information in such a way that it can be integrated in the EMS of a MG. This comprises the second general objective of this thesis, which is developed in Chapter 3.

Related questions arise when addressing this general objective, such as: how the accuracy of the deterministic forecasts is related to different weather conditions? can we propose a method that delivers more (i.e. probabilistic) information regarding the solar-resource forecast? what indicators and methods can we use to properly measure the effectiveness of such method?

To answer these questions, we established a collaborative work with the PIMENT laboratory of Université de la Reunion in order to evaluate what is the reliability of readily available day-ahead solar irradiance forecasts, which in turn, will be used to produce predictions of PV power production. Numerical Weather Prediction (NWP) data from ARPEGE and AROME where available for this study from a collaboration between SIRTA and MeteoFrance. Forecasts are an important input for an energy management strategy, and in this case, also the impact of their uncertainty was a subject of study. Therefore, an Analogs Ensembles (AnEn) approach was implemented and adapted for this study-case, so that, probabilistic information of the original deterministic forecasts could be extracted. The approach uses day-ahead forecasts of solar global horizontal irradiance (GHI), air temperature at 2m above the ground (T2) and air relative humidity (RH). The working principle of the AnEn method proposed is based on the availability of a deterministic forecast (of GHI, T2 and RH), that is then compared with a database of past forecasts for the same site, and the most "similar" past forecasts in terms of punctual values as well as short-term temporal trends are chosen. The corresponding measurements of GHI for the chosen forecasts (also available in the database), are taken to conform the ensemble of analogs. From this ensemble, the 10 th and 90 th quantiles are obtained and compared to reference probabilistic methods, in terms of reliability, resolution and uncertainty through the quantile-skill-score. The results show a superior performance of the proposed AnEn with respect to benchmark probabilistic forecasting methods such as persistence, climatology and even the -commercially available-ensemble prediction system from the European Centre for Medium-Range Weather Forecasts. In this way, quantile forecasts obtained from the ensembles issued by the AnEn method, proved to be a good resource of probabilistic/uncertainty information of the numerical-weather-prediction deterministic forecasts used as the input of our forecasting approach. It outputs ensembles of past GHI measurements corresponding to similar (i.e. analogs) forecasts to the current forecast being analyzed. Probabilistic information is extracted from this ensembles in the form of quantile forecasts, which are used in the energy management strategies proposed in the last stage of this work.

Energy management of a microgrid under solar production uncertainty

The last general research question of this work, that links the results previously found on the first two stages of the research is: what could be the added value of including information about the uncertainty of PV production forecasts, in the energy management system of a microgrid? This gives rise to derived queries such as: how could an energy management system, that takes into account uncertainty information of PV production, look like? how different energy management scenarios and strategies (including forecast uncertainty information or not) can affect the performance of the study-case microgrid? and how targeting one service (when performing the optimal scheduling of resources of the microgrid), can impact the other services chosen to quantify performance? These questions are intended to contribute, to some extent, in the reduction of the negative effects caused by the uncertainty of the PV production in a MG that serves a smart-building, which is the main and concluding objective of this thesis.

As a first step towards the achievement of this goal, we propose an EMS that includes probabilistic information regarding PV power production. For this, the use of the quantile forecasts proposed in the second part of this work is chosen as the way to integrate information about the uncertainty of the PV production, and then analyze if that could bring any advantage or improvement in terms of performance. In order to quantify the impact of the EMS strategies, some services are proposed, along with their corresponding performance indicators. These are services that the Drahi-X building is expected to deliver to its users, once the MG is operational. Four different services are proposed, namely: energy cost, carbon footprint, required contracted power (grid-peak-power) and grid-commitment. Based on the associated performance indicators, different energy management strategies are proposed and evaluated, addressing two services at a time. The proposed energy management system consists of two stages: a scheduling stage and balancing stage. The former, make use of forecasts to generate an expected grid power profile required by the MG for the upcoming day. This scheduled grid profile is generated favoring one service, namely: energy cost, carbon footprint or grid-peak-power. This is done through an optimization algorithm, using either a genetic algorithm or a non-linear programming method.

The balancing module is in charge of assuring the balance between production and consumption under real PV production conditions, counteracting the forecasting errors. It performs this task always favoring the grid-commitment service, which means, trying to keep the scheduled grid power profile unmodified, as long as possible. This is performed through a ruled-based approach. The purpose of the grid commitment service is giving certainty to the distribution system operator about the power requirements of the MG for the upcoming day. This could be achieved by making the MG capable of counteracting the uncertainty (of PV production in this case) internally, with the resources available. This would give microgrids an interesting added-value in an scenario where distributed generation with renewables becomes significant with respect to the utility grid.

Different points are studied in this part, such as the effects of integrating deterministic and probabilistic forecasts in the EMS strategies, the effects of forecasts accuracy, the interaction between the services when one service is favored over the others, as well as the effects of seasons. The results of this part show the versatility of AnEn and quantile forecasts in maximizing the performance of the MG regarding one particular service for different seasons, as well as how other services are negatively affected when one service is favored. However, it is shown that a good compromise in performance can be found among the different services, depending on the priority and requirements of the users. Viewing the forecasting error as composed by two parts: the magnitude and the bias; an analysis was performed regarding how these two components of the uncertainty are more or less relevant depending on the 1.3 Energy management of a microgrid under solar production uncertainty service that is being targeted. Seasons also show to play a role in the performance of the MG, which can be very different from summer (most favorable season) to winter (least favorable season). Different quantile forecasts have to be used to optimize performance for the different seasons.

It is shown that by implementing some basic control capabilities such as the power exchange control of the battery/grid, as the one proposed in the first part of this study, a MG can implement energy management strategies that can favor a particular service as the ones hereby proposed. These strategies proved to be successful in optimizing those services, and outperformed the reference energy management strategies in almost every scenario.

A key to this achievement, was the use of quantile forecasts, obtained with the analogs ensembles method, that proved to be a useful tool to deal with the intrinsic uncertainty of PV power production forecasts. This work open many pathways for further research, being the first one, implementing and testing the energy management strategies hereby proposed in the laboratory-scale nanogrid and to evaluate eventual constraints when implementing the strategies in a real system. This permits the evaluation of the feasibility for their eventual implementation in the Drahi-X MG. The detailed development of this topic is presented in the Chapter 4 of this thesis.

Each chapter is structured with an introductory section, where an overview of the particular topic is performed as well as a literature review and the presentation of the main objectives of the chapter. Then, a description of the case-study and the methods followed to tackle the problem are described. In the core of each chapter, the proposals, indicators and results, with their respective analysis, are presented. Finally, a section where main conclusions about the results, as well as future perspectives for the particular topic of the section, concludes the body of each chapter.

Chapter 2

Experimental nanogrid development with pedagogical and demonstrator purposes

Introduction

In the growing world of renewables and the rising deployment of microgrids (MGs) and smartgrids (SGs), this subject is being added to the engineering curricula in many universities around the world, not only for those interested on the management of future electrical networks, but for all type of professionals. The complex interactions occurring on the national electricity network are being scaled-down to a prosumer level, thanks to the rise of microgrids. A prosumer can be any person or entity who is able to consume and produce electricity, regardless of the power being transacted. MGs allow final users to produce, trade, consume or sell the totality or a part of the electricity they produce. Besides, MGs are an interesting platform to increase renewable penetration through distributed generation, as highlighted in [START_REF] Lasseter | Integration of distributed energy resources[END_REF]. This makes the subject of microgrids a trans-disciplinary field that touches professionals from many different areas, passing through politicians and law makers (e.g. [START_REF] Wouters | Towards a regulatory framework for microgrids-The Singapore experience[END_REF]), financial sector (e.g. [START_REF] Costa | Economic Analysis of Microgrids Including Reliability Aspects[END_REF]) as well as the final users (e.g. [START_REF] Perea | Definition, evolution, applications and barriers for deployment of microgrids in the energy sector[END_REF]). Having stated the importance of this emerging field specially in this crucial moment of humanity regarding climate change, having a solid base on this vast area for any person working in the energy sector, is a must.

When talking about low-power distributed generation with IRES, the concept of microgrids comes along as the system that is specially conceived to integrate those resources. According to the US Department of Energy, a MG can be defined as "a group of intercon-nected loads and distributed energy resources within clearly defined electrical boundaries that acts as a single controllable entity with respect to the grid. A microgrid can connect and disconnect from the grid to enable it to operate in both grid-connected or island-mode" [START_REF] Ton | The U.S. Department of Energy's Microgrid Initiative[END_REF]. In simpler words, a MG constitutes a "small" electrical system with similar components and the same purpose of the utility grid, which is to satisfy a given consumption at every moment, keeping desirable quality levels of the electricity that is being delivered. However, as the above definition points out, these type of systems possesses characteristics that differentiate them from the high-power electric grids (i.e. utility grid). This fact makes the management of its resources a matter of each particular use case, depending on the available resources and the needs of the users. As pointed out in figure 2.1, MGs can be connected or non-connected to the main grid, and this work focus on the former case. The main difference in the management between connected and not connected microgrids is the fact of having an "infinite" source of energy at disposal in case is needed (the utility grid, for the grid-connected case), whereas in the non-connected case the auxiliary energy reserves are limited, and most of the times, expensive. This fact make non-connected MGs riskier to manage in order to assure their self-sufficiency at all times. However, to manage the resources of a grid-connected system must be done carefully as well, in order to avoid interfering with the distribution grid in terms of stability and energy quality. Figure 2.1 presents a possible classification for MGs proposed by zia et al. [START_REF] Fahad | Microgrids energy management systems: A critical review on methods, solutions, and prospects[END_REF]. According to this classification, the system proposed in this work is a DC, centralized, grid-connected, commercial MG. Even when there are examples of microgrids already deployed as demonstration projects that are serving in real-life applications as pointed out in the review performed by barnes et al. [START_REF] Barnes | Real-World MicroGrids-An Overview[END_REF], a big percentage of the literature on the subject concentrates on laboratory-scale microgrids. Some examples can be found in [START_REF] Che | Construction, operation and control of a laboratory-scale Microgrid[END_REF][START_REF] Barnes | Microgrid laboratory facilities[END_REF][START_REF] Merabet | Energy Management and Control System for Laboratory Scale Microgrid Based Wind-PV-Battery[END_REF][START_REF] Lasseter | CERTS Microgrid Laboratory Test Bed[END_REF] where they study a variety of aspects such as: the architecture and configuration, availability of different distributed energy resources (DERs), islanding constraints, test for different storage technologies, test for control strategies/energy management systems, development and test of power converters, protection strategies and interactions between different microgrids, just to mention some. The scale of these type of systems allow their deployment in laboratory facilities to serve as test-bench for the above-mentioned topics and others, and yet the results can be meaningful for real-life scale systems. Nevertheless, there are critical points to take into account when passing from laboratory to real-life scenarios such as meeting network constraints and regulatory requirements, controllability at the point of common-coupling with utility grid, protection means, low-voltage ride-through requirements when islanding and acknowledgement of local consumption, as pointed out by Liang et al. [START_REF] Tao | From laboratory Microgrid to real markets -Challenges and opportunities[END_REF].

Acknkowledging the importance of having a laboratory-scale system to perform offline tests and validations, as highlighted by the authors mentioned above, we have decided to developed a small-scale demonstrator system, as the starting point of our research work. A Nanogrid Research Lab (NRLAB) was created where a microgrid (or nanogrid as we call it due to its low power rating of 300Wp) was built. The NRLAB has been deployed in the SIRTA-E4C laboratory facilities at the Dynamic Meteorology Laboratory in the campus of Ecole Polytechnique in Palaiseau, France. Besides its intended research applicability, it is also conceived with the aim to offer undergraduate, graduate and PhD students the possibilities to get in touch with this kind of systems in a more realistic hands-on approach, that was no existent (to the best of our knowledge) in the campus before. This allows a better comprehension of the working principle, challenges and importance of doing a proper use of the resources from different points of view. It allows also students to develop practical projects where they can implement or propose new strategies for energy management and load scheduling and evaluate its performance. The system has been conceived to be a small-scale equivalent of the microgrid being installed at the Drahi-X Novation Center on the campus of the Ecole Polytechnique (see The Drahi-X building microgrid description in the general introduction of this work). Through some functionalities such as real-time consumption-following, the laboratory-scale microgrid (hereafter called the nanogrid NG), permits to explore energy management strategies and scenarios that could be implemented in the full scale system and evaluate its impacts.

In section 2.2, a summary of the different iterations that the system has had until the current version is presented, from conception to implementation, performing a thorough explanation of its functionalities and reasons of each improvement.

Experimental nanogrid development with pedagogical and demonstrator purposes

In section 2.3 we present the potential of the NG as a research, demonstration and pedagogical tool by showing the outcomes obtained with the current version of the system. Here we expose also its limitations and scope which serves to justify the work performed in the following chapters of this thesis.

In section 2.4, the different practical exercises that have been performed so far with the system are explained, and its results debriefed.

Section 2.5 presents a side outcome of the NG, which is a web-based "game" inspired in the physical system, focused on load-scheduling. It was conceived with the idea that a bigger number of students could benefit from the learning experience of the nanogrid, as well as to overcome some of the physical and technical constraints presented by the physical NG.

Finally the conclusions of the work are presented as well as a summary of the main suggestions for improvement and envisaged uses of the system.

Materials and methods

The project started with a basic out-of-the-box system build around a commercial solar charge MPPT controller, which was working in the laboratory when this study started. Being the system constrained by the limited functionalities and user-interaction allowed by the charge controller, its potential as a research and pedagogical tool was very limited. This gave rise to the initiative of building a new system from scratch, conceived since the beginning to serve as a research and pedagogical tool in the domain of microgrids. That was the ground base of the present thesis project.

The evolution of the nanogrid

The first iteration of the NRLAB NG consists in a 12Vdc microgrid powered by two photovoltaic (PV) panels: a low power (50W) indoor panel enlightened by halogen lamps, and an external 245W poly-crystalline silicon panel. This first system had a 1.2 kWh lead-acid battery as energy storage, and a programmable 300Wp electronic DC load. The system also had an adjustable 600 Wp electronic power source serving as an alternative source of energy. Hall-effect current sensors were installed whereas the voltages of the elements were measured using simple voltage dividers built with commercial resistors. The measurements were gathered by an Arduino-Mega board (https://store.arduino.cc/arduino-mega-2560-rev3) and managed by a RaspberryPi 3 board (https://www.raspberrypi.org/products/raspberrypi-3-model-b/). The monitoring of the system was performed by a Python code running in the RaspberryPi and the outputs were shown in an interface that was programmed using the open-source software called Node-Red. The exchange of the data between the Python script and the Node-Red interface was performed using an open-source MQTT server. Each branch of the system (i.e. the electrical connection from the main DC bus to a given element or resource) had a connection/disconnection relay and an overload fuse, in order to protect the lines and isolate them from the main DC bus if needed.

This first system, still "rudimentary", presented interesting functionalities such as having an indoor panel serving as a "solar simulator". This enabled the NG to emulate, in an automated way, any solar irradiance profile desired, naturally, scaled to the peak power of the indoor PV panel. The user interface was also developed from scratch, and it allowed to see in real time the measurements of current, voltage and power for each element, in the form of integers or time-series plots. Power values were calculated from current and voltage measurements. It had the option also to connect or disconnect any element remotely, and even set conditions for its automatic connection/disconnection due to over or under voltage conditions. Response-time, accuracy, reliability and repeatability of measurements, were the main drawbacks of this first system, which lead to develop a second version in order to solve those issues.

Several improvements were implemented in the system for the second version, preserving the initial idea of developing a NG with remote and automated control capabilities. Two new elements are added to the second version of the NG: a 480Wh Lithium-ion battery (in addition to the existing lead-acid unit), and a 500W vertical axis wind turbine. However, the wind turbine presented some voltage-compatibility issues, and even when some tests were performed to identify a possible solution of the problem, it was out of the scope of this work, leading to the decision of leaving its integration to the NG for a later stage. The setup of the internal PV panel was also improved, in order to decrease its temperature during operation and making the illumination more uniformly distributed. This allowed the PV panel to achieve its nominal power when exposed to full illumination of the halogen lights. Important improvements were made regarding the data gathering: new -laboratory qualitycurrent and voltage sensors have been installed in order to improve the measurements quality. Measurements of the initial version of the NG were affected by errors and stability problems, mainly due to electrical noise and temperature effects. The installation of the new sensors required the design and fabrication of the electronic circuit boards as well as its calibration. The system was completely rewired with the aim to reduce the Joule losses and to bear the increased electrical stress produced in the cables due to the new elements added to the system. Real-time meteorological information and Drahi-X consumption-following were included in this iteration of the NG in order to increase the pedagogical and research value of the system. The software has been significantly changed with respect to the initial version of the NG with the aim to reduce the stress in terms of computational power of the Raspberry Experimental nanogrid development with pedagogical and demonstrator purposes Pi and to achieve a faster response. With this in mind, the original script was split in three different codes: data-management, control and load-control script. The data management script receives the values of the electrical variables (i.e. current and voltage) measured by the sensors, through the Arduino-mega board. The power of each element is computed based on those two variables and all this data is displayed on the web-page interface. The same code is used to record the gathered data in .txt files. This operation can be performed in real-time or in a simulated-accelerated mode, where consumption and PV production profiles are given and by means of the solar simulator, they can be run in an accelerated mode, regardless of the real weather conditions. This functionality is useful to perform simulations of different daily profiles in a practical laboratory session. The state-of-charge of the battery is computed using the coulomb-counting method [START_REF] Kong | Enhanced coulomb counting method for estimating state-of-charge and state-of-health of lithiumion batteries[END_REF].

The control script has as main task the remote connection/disconnection of each element of the NG from the main bus, by means of the connecting relays. A safety over/under voltage disconnection protocol was implemented taking advantage of this functionality. The load-control script is in charge of setting the power value of the electronic DC-load, with the possibility to follow a fixed power value set by the user (via the graphical interface) or to follow the real-time consumption of the Drahi-X building. A proper scale factor can be set by the user in order to meet the maximum power rating of the electronic load. In this way, by reducing the data-traffic through the MQTT server and better organizing the information exchange, the response time of the measurements was significantly improved.

Current version of the nanogrid

Despite the aforementioned improvements achieved in the previous iterations of the NG, there were still issues to be solved, mainly regarding the quality of measurements. The Arduino-RaspberryPi configuration that was being used so far, had been conceived in its origins more as a prototyping platform than a professional measuring system. Besides, being measurements the base to perform any energy management, it was decided to change the whole measurements system by a professional data logger device, with the aim to achieve more accurate, stable and robust measurements.

In order to implement an energy management system (EMS), the system needs to be controllable and the data collection process must be reliable. Developing an EMS based on inaccurate measurements will most likely lead to wrong decisions. The CR1000X professional data-logger from Campbell Scientific (https://www.campbellsci.com/cr1000x), was chosen to substitute the Arduino-based data-collection system. This device can perform data collection and saving, along with some basic control functions. With this improvement, two Python scripts (measurement and control) were eliminated, remaining only the load Moreover, the existing -250Wp-solar panel was replaced by a 305Wp poly-crystalline silicon solar panel (model Q.PEAK-G4.1 305) and installed in the rooftop of the laboratory building. The existing DC power source had been replaced with similar equipment with the ability to deliver up to 24Vdc (model VOLTCRAFT DPPS-32-30 1-32VDC 0-30A 960W).

Experimental nanogrid development with pedagogical and demonstrator purposes The user interface continues to be based in Node-RED, as the versatility shown so far by this software for data communication, display and user interaction is considered suitable for our application. A new configuration was implemented though, in order to connect Node-RED with the new CR1000X data-logging unit. The appearance of the measurements tab where the real-time values of all the variables are displayed, is shown in figure 2.5. The capabilities of Node-RED to produce real-time plots of the current, voltage and power of the different elements of the system were successfully adapted to the new measurements system. The possibility of imposing the -scaled-real time consumption of the Drahi-X building is also a valuable tool for research implemented in this version of the NG, as it allows to emulate management strategies and observe the response of the different elements under real-life consumption conditions. The control of the disconnecting relays is now also performed by the CR1000X data-logger, making use of its digital I/O ports. Using the built-in programming language provided by Campbell Scientific, the binary activation signals could be sent to these ports at any moment from the user interface (or a central controller) to remotely open or close the relays. This feature gives some basic possibilities to perform energy management. However, due to the nature and configuration of this system, there are some restrictions to be kept in mind when disconnecting elements, such as the need of the PV controller to have the battery always connected in order to work properly, or the need to always have the power source connected when the SoC of the battery is low, so that over-discharge of the battery is avoided.

In the NRLAB-NG, the element that plays the role of the utility grid (or a genset unit if emulating an off-grid system) is the power source. In order to implement an efficient EMS, the remote-control of the power source is mandatory. The power source of the NRLAB-NG has this capability, more specifically, it allows to limit the output current and to set the output voltage desired, via 0-5V analog inputs. The CR1000X data-logger is able to send pulse-width-modulation (PWM) signals through its ports, which are used to generate the Experimental nanogrid development with pedagogical and demonstrator purposes analog signals required to control the power source. The proper calibration equations were experimentally found in order to convert between voltage/current values to PWM signals. This functionality was added in the Node-RED interface, so that the user can input the desired setting for voltage and current-limit. A schematic that summarizes the evolution process of the NRLAB NG described above, is presented in figure 2.2.

At the view of the lack of readily-available low-power fully-controllable DC-DC converters on the market, this functionality was used to -indirectly-control the power-exchange with the battery. In other words, the control of power going/coming to/from the battery, can be achieved by controlling the power delivered by the power source (i.e. limiting its current). A maximum-power-point-tracker (MPPT) controller ensures the utilization of the available PV potential (as long as there is a resource willing to consume it), so that the battery power is passively dictated by the Ohm and energy conservation laws. Explained differently, given that the PV production is dictated by the MPPT controller and the consumption is fixed either by the user or by the Drahi-X consumption, the battery and the power source are the two elements left to counteract any imbalances between production and consumption. Due to the configuration of the NG, where all the resources are connected to a common-bus and are allowed to exchange power freely, the Ohm and conservation-of-energy laws are the ones that dictate the power flows in the system. When an imbalance occurs between production and consumption, the lack/surplus of power will split between the battery and power source according to their voltage levels. For instance, if there is a lack of power (i.e. more consumption than PV production), the missing power will come from the element that has the highest voltage between the battery and the power source. Therefore, by changing the setting voltage of the power source, it could be "decided" from which element we want the power to come from. By accurately limiting the current of the power source, we could precisely decide how much power we want the power source to deliver, forcing the battery to provide the remaining power. This is an example of a situation where we indirectly fix the power exchange with the battery by means of controlling the power source output. We use this idea, to develop a simple proportional control algorithm, included in the user interface, where the user can input a desired value of power for the battery (either charge or discharge) and the system will automatically make the necessary adjustments of current-limit on the power source in order to achieve the goal, as long as the state-of-charge of the battery allows it. The feature is still in progress, as different control strategies must be tested to obtain a better matching between the set and real-values of power. However, once fully ready, it promises to give a valuable added value to the NRLAB NG, as this functionality is usually reserved for expensive high-power top-of-line laboratory equipment, and we are achieving it with low-cost and easy-to-implement components, for a low-power MG. A voltage protection system has also been implemented, which disconnect the battery from the main bus if the voltage of the battery is lower than a critical threshold (set by the user). This keeps the battery from over-discharging. A similar mechanism is implemented when the voltage of the system is higher than the setting voltage of the power source, avoiding an over-voltage condition, which would make the power source to stop working and enter the safe-mode.

Nanogrid data output

The nanogrid web interface is able to produce real-time plots of the voltage, current and power of the different resources. Figure 2.6 highlights some of the basic aspects of power systems and the interactions between the different elements in a microgrid. The plot has been generated for a particular day (2019-10-13), where the system was running without any human intervention. Aspects such as the self-balancing ability of the system to match production and consumption, the distribution of power-delivery between the power source and the battery according to the state of charge of the latter, the curtailment performed by the MPPT controller when the PV potential is greater than the demand, the priority given to the load in the use of the available PV energy, among other aspects; can be observed in this figure. All these points help to have a better comprehension of the underlying laws that rule and regulate the functioning of a power system like a microgrid. The remote-control of the power source is another very important functionality included in the NG, as it enabled the control of the battery power, to some extent. It has to be mentioned Experimental nanogrid development with pedagogical and demonstrator purposes that commercially available DC-DC converters, that could perform this task, were extensively searched without success. Most commercial devices to perform this kind of forced batterypower flow were conceived for bigger power levels and mostly AC configurations, hence not well adapted for the size and purposes of our system. If an energy management system is to be implemented, the optimal scheduling of battery power is usually required. During the discharging tests of this functionality presented in figure 2.7(a), different values of power values were set for the battery (30W, 50W, 70W) for a given period of time each. It is clear how the battery is able to follow the setting values despite of the load variations. The power source adjusted automatically its power output (by limiting the current) in order to counteract those variations so that the battery could follow is setting power value. Something similar was performed in a charging regime, as shown in figure 2.7(b), where different setting power values were imposed to the battery (-20W, -40W, -60W), keeping a constant consumption this time, and evaluating the ability of the system to follow those values. It is interesting to note that in both cases, the transient response of the system was stable presenting a damped transition between power levels, despite of the simple proportional control implemented (see equation 2.1).

∆I = ∆P V meas * k (2.1)
where ∆I is the change in the current limit that the algorithm performs at every control cycle (mili-seconds), ∆P is the difference between the set and the measured power of the power source, V meas is the measured voltage of the power source and k is the proportional factor, that in our case has been set to one. A reasonable variability of the battery power of around 2.8% was obtained, for a fixed setting value of -60W. This is considered satisfactory taking into account the accuracy of the remote-control circuitry of the hardware (i.e. the power source). An offset was present in both, discharge (see figure 2.8(a)) and charge (see figure 2.8(b)) regimes, being more notorious in the latter. This might be due to the lack of an integral term in the control algorithm as well as measurements inaccuracy. The offset achieves an average of 30% in the charging regime at a power setting of -60W. The fact of the bigger error in the charging regime might be also related to an insufficient voltage difference between the power source and the battery, that limits the amount of power that can be sent to the latter. The fact that the output voltage of the power source is manually set (hence, not taken into account in the control loop), limits the response capability of the system to achieve certain -charging-power values for the battery. This is a constraint for the proposed control scheme that should be improved in order to assure a better performance in case of EMS implementations. This issue contributed with the decision of performing the studies of EMS-strategies, presented in Chapter 4, in a computer-simulated environment. Besides, this fact could be distracting when performing demonstrative or pedagogical activities, hence the importance of "the game" proposed in the section 2.5 of this work.

With the data collected by the interface some indicators can be computed to rate the performance of the nanogrid under this natural-response (i.e. no EMS) conditions. These are similar indicators as the ones described by equations 2.3, 2.4, 2.5, 2.6 and 2.7 of section 2.5.3. For the sample day shown in figure 2.6, the NG achieved a self-consumption rate (equation 2.3) of 73%, which means that 27% of the PV energy available was not used. A self-sufficiency rate (equation 2.4) of 76% was achieved, meaning that 24% of the load had to be supplied by the utility grid (i.e. it was delivered by the power source). Here we remark that, according to the accumulated-energy values (upper-left legend of the plot), there was enough PV energy available this day to cover all the energy needs. However, some PV energy was curtailed, forcing the use of energy from the grid (i.e. power source) to cover the consumption. This highlights the importance of an energy management system, that could optimally schedule the power delivery of the battery and power source (based on forecasts of PV production), in order to make the most of the PV energy available and avoid unnecessary grid energy requirements. These two aspects are addressed in Chapter 3 (PV forecasts) and Chapter 4 (EMS strategies) of this thesis.

Besides, if dispatchable loads were present in the microgrid, a load-scheduling (i.e. demand-side-management) scheme could help the EMS to further improve self-consumption and self-sufficiency rates, by adding more flexibility to match the PV-production and consumption. This is one of the motivations to create the software-based microgrid platform presented in section 2.5. Following with the same example, the battery SoC was left a 40% higher with respect to its value a the beginning of the day (battery balance = 60%, as defined in equation 2.5). This variable is not controlled by the NG and depends only on the daily imbalances between production and consumption, as pointed out in figure 2.9. This might lead to values of SoC (at the beginning of each day) that force curtailment or unnecessary power purchase from the grid. Regarding the battery use (defined in equation 2.6), the battery had to supply 46% of the total consumption for this particular day, which shows the importance of this resource in the shifting of solar-energy-utilization throughout the day, specially during night time. The grid cost indicator (expressed in equation 2.7), if computed for a blue day (see figure 4.1) results in a value of 90%, while it takes a value of 43% for a red-day, the most expensive according to the same tariff. This means that the total daily energy cost had the margin to decrease a 57%, if the energy had been bought at the lowest price possible. This remarks again the added-value that en EMS could bring in decreasing the operating costs of a microgrid by optimally scheduling the grid power purchases.

The same power plots puts in evidence some of the limitations of the NG, as remarked in figure 2.9. Some of these limitations are related with the hardware, for instance having some inaccuracy in the measurements or not having a proper way to measure Joule losses. This might cause the mismatches observed in the power balance (i.e. the sum of powers of the elements does not sum zero as supposed). Other limitations are more software oriented, such as inaccurate models to estimate the PV potential production or the state of charge of the battery, and the lack of an energy management system. These might be the cause of the SoC going out-of-bounds, PV output energy being bigger than the PV available in some points, or the sub-optimal use of the battery and grid, if seen from an economical point of view.

Moreover, when data collected for larger periods of time was analyzed, some missing data was discovered (as depicted in figure 2.10), presumably due to unexpected outages of the data collection system. This would be an important hindrance for the test and validation of energy management strategies, as the computation of performance indicators must be done over longer periods of time, so that they are statistically meaningful for research purposes. This was another reason that motivated the decision of performing the study regarding EMS strategies presented in Chapter 4, in a computer-simulated environment, as it would be more meaningful for the purposes of this thesis. However, figure 2.10 shows other interesting aspects in periods where the load stayed -unintentionally-in a zero or a constant value. This might have happened due to communication problems with the server in charge of reading the real-time consumption of the Drahi-X building. In the zero-load period we observe how the MPPT controller curtails all the PV available, as there is no load to consume it (the battery is presumably full), therefore the power flows for all the elements are zero. The NG finds itself in a static state. On the other hand, in the constant-load periods we observe how the NG enters in a dynamic state where the power flows of the PV, battery and power source change throughout the day, despite the load being constant. This is due to the fact that the system responds to the variations in the solar production as it is the priority of the MPPT controller to favor the usage of the PV energy available.

As a concluding remark we can say that the NRLAB NG has demonstrated to have a valuable potential as a pedagogical tool, as it was stated in section 2.4. However, it has shown its limitations as well. First of all, the NG is still in evolution, hence, it has not achieved the levels of reliability, accuracy, repeatability of measurements, stability and functionalities expected for a "final" version of the system. Therefore it is comprehensible to see some mismatches between production and consumption powers, to have limitations in the battery power control algorithm, or to lack a proper online-algorithm to estimate a realistic SoC of the battery. This restraints the pedagogical scope of the NG as students cannot perform accurate analysis based on the outputs of the interface and are limited in terms of user-interaction possibilities as to test energy or demand-side management strategies. Moreover, due to the physical size of the NRLAB and the existence of only one NG, the number of students that can benefit from the system is also limited to 4 or 5 students per session. This gave way to the emergence of the idea to create a software platform that could simulate, in ideal conditions, the nanogrid, which is explained in detail in section 2.5.

Pedagogical outcomes of the nanogrid

With the capabilities of the third -and current-version of the NRLAB NG, a practical experience has been develop with the aim to help students discover and understand the basics about electric power systems, grid interactions as well as microgrids management. The experience assumes no prior knowledge about the subject from the participants, hence it was conceived as a very basic/conceptual practice. However, this experience is enough to show the most important features and possibilities that the NG offer as a didactic tool. The practical experience is presented in the following sections, which brings out the added value of the NG as a pedagogic tool.

The text of the full student guide developed for this practical experience can be consulted in Appendix D.

Experimental nanogrid development with pedagogical and demonstrator purposes

Experimental procurement of Joule losses and the equivalent resistance of the circuit

At the beginning of the practice, an introduction is made where the main learning objectives of the practice are briefly explained and students are guided to make the proper electrical connections of the elements required for the practical experience (i.e. PV panel, battery, load and power source). Then, in the first part of the experience, students are familiarized with the concepts of Joule losses in an electrical system. For this purpose, they are asked to connect only the power source and the load to the common bus of the NG and to increase the load from 10W to 90W, taking note of the currents, voltages and powers. With this data, they perform a plot where, by fitting the experimental curve obtained, they can compute the approximate equivalent resistance of the circuit R eq , that includes all the ohmic losses due to wiring and the cross-section of the cables. The equation of Joule losses used to compute the equivalent resistance of the circuit is presented in equation 2.2.

P joule = R eq • I 2 (2.2)
where the units are Watts, Ohms and Amperes respectively for P joule , R eq and I.

Then, students are asked to confirm the value obtained for the equivalent resistance, by measuring it directly with a multimeter. Usually they obtained results with a +/-10% of error margin, which is reasonable taking into account the accuracy of the measurement instrument used. An example of the fitting obtained by a group of students is shown in figure 2.11, where the blue curve represent the polynomial fit of the measured power-loss values (difference between the power delivered by the source and the power consumed by the load), presumably due to Joule losses. They are asked to confirm this fact by doing the experimental fitting, and finding the corresponding value for R eq , which they further validate by a direct measurement. The detailed procedure and tables to be filled out for this part of the experience can be found in the Joule Losses section of the student guide presented in Appendix D.

Understanding the basics of power flows and its manipulation

The core of the practical experience is devoted to understand some basic principles regarding the electrical interactions between the elements (also called distributed energy resources or DERs) of an electrical power system, which are exemplified with the nanogrid. More specifically, the learning objectives addressed in this part are:

• Voltage as a tool to manipulate power flows • Current limiting as a tool to manipulate power flows • Impact of load variations in the power flows There are some types of electrical loads whose power consumption is voltage-dependent. In general, any device with a fixed internal resistance that uses the joule effect to produce heat or light, will vary its consumption if the feeder voltage levels change. Within this category we can find drying, cooking, electric water-heating and lighting appliances, that altogether can represent an important percentage of the total consumption in an electric power system. Therefore, keeping the levels of voltage as constant as possible is one of the variables to keep an eye on in an electrical system like a MG.

To exemplify this fact, students are asked to branch only the power source and the programmable electronic load to the NRLAB-NG. Using the different load modes of this device (e.g. fixed resistance, fixed power) they are able to emulate the voltage dependent and non-dependent types of loads. Under these scenarios, students are asked to vary either the voltage of the power source (keeping a constant load power), or the load power (keeping the output voltage of the power source constant). The response of the system in each case is noted and its real-life applicability and implications are discussed. For instance, it is highlighted the fact that voltage variations in a MG can affect consumption (or vice-versa), hence, the importance of having a voltage control system in any electrical power grid.

Experimental nanogrid development with pedagogical and demonstrator purposes

This short demonstration serves to introduce the first main learning outcome, which is the use of voltage variations in order to manipulate power flows. To exemplify this topic, students are asked to connect the battery, power source and load to the main bus. The battery is a non-linear element whose behaviour is not always well understood. By varying the output voltage of the power source, the battery is taken from a charging to a discharging regime, to show students how the power exchanged by the battery can be -indirectly-manipulated by means of voltage variations. The concepts of open circuit voltage (Voc), state-of-charge (SoC), and the correlation between SoC and Voc are also tackled. The importance of the battery as an element that can react very quickly to compensate sudden power imbalances in the grid is also highlighted with this exercise.

An example of this exercise is shown in figure 2.12, where the effects of variations in the voltage of the power source (yellow curve) over the charging state of the battery are demonstrated. Results show how the battery can be taken from a discharging to a charging state by means of setting the output voltage of the power source above or below the Voc of the battery, which has been previously measured at the beginning of the exercise. In this figure, the effect of Joule losses can also be observed as the difference in the power values between the power source and the load (that should be the same when the battery power is zero, if no Joule losses were present). Figure 2.12 Effects of power-source-voltage variations in power flows. Only battery, power source and load are connected to the main bus Following this experience, the PV panel is connected to the main bus using a maximumpower-point-tracker (MPPT) charge controller. The response of this element is also non-linear, then, it is of interest to observe its interactions with the other elements. By observing its power response, students can see the maximum power point tracking algorithm working, its response time, and its reaction to grid voltage/consumption changes. Students are also asked to try to run the load only with the solar panel connected to the main bus (i.e. no battery or power source branched). This will pose some problems when sudden changes in consumption happen, as the MPPT algorithm is not able to respond as fast as required. At this point, it is explained why a battery is always important in a stand-alone PV system and why these type of MPPT solar controllers always required a battery to be plugged-in in order to work properly. Here the different types of charge controllers and inverters are explained, as well as the different configurations for connection of the elements in a MG either in DC or AC.

In the concluding section of the experience, the real-time consumption mode is activated. Here, the actual consumption of the Drahi-X building is imposed in the electronic load, with a scaling factor of 1%. This is a very valuable feature of the NG because it allows to test, on a low-power workbench, eventual strategies that respond (even in real-time) to the consumption of a real -tertiary-building, which brings an extra added-value to the teaching and research activities performed in the NRLAB. In this part of the practice students are asked to observe, for a short period of time, the real-time power plots (e.g. figure 2.13), and take note of the instantaneous interactions, changes and variations in the power and voltages of the different elements. The idea is to make a recap of all what they have learned up to this point, and put all these pieces together in order to understand why the flow of power, among the different elements, behaves the way it does. The way the system naturally arrives to the equilibrium, assuring the balance between production and consumption is also remarked. At this final recap, students can ask questions and are allowed to "play" with the setting points of the load and power source, as well as the connecting relays, and they are asked to try to predict how the system will react to compensate those perturbations, which is then denied or confirmed by observing the resulting behaviour of the system in the real-time plots generated by the interface, as the one shown in figure 2.13.

Recapitulation of learning outcomes

By the end of the session, students are asked to perform a short evaluation to recap the concepts they have just learned. The evaluation is based almost entirely in plots or figures obtained from the NG, from where students need to analyze a particular situation and choose a proper answer. An example of the type of questions present in the evaluation is shown in Experimental nanogrid development with pedagogical and demonstrator purposes Figure 2.13 Power measurements that illustrate the interactions between the resources of the microgrid. Sample day:22-06-2018 figure 2.14. In this way, without asking students to perform complicated calculations, the main concepts studied throughout the demonstrative experience are summarized. Questions are designed so that students refresh the concepts by using them to determine important indicators that have been previously reviewed, such as the self-consumption and self-sufficiency rates, among others. The evaluation is revised along with the students, question by question, to make sure that all the students have the concepts clear and depart from the practice with a similar level of understanding. This is particularly important as they will use many of these concepts in the second part of the practice which is the load scheduling game, that is explained in a following section of this work. The complete evaluation can be consulted in Appendix E.

The load scheduling on-line game

With the idea to expand and complement the possibilities of the physical nanogrid as a pedagogical tool, an on-line software platform was conceived called "the microgrid game". It consists on a high-level simulation of a microgrid (i.e. no electrical models included), that resembles on its architecture and components to the NRLAB nanogrid. The idea behind the creation of this software is to expose some of the most critical aspects regarding energy and demand-side management in ideal conditions, so that the technical-issues of the real NG do not interfere with the desired learning pathway. Even when the acknowledgment of those issues is in itself a learning outcome for the physical NG, it constraints the possibilities to perform other types of exercises and analysis where high accuracy, stability, repeatability and the simulation of different scenarios is required. Besides, the proposed platform permits to reach a bigger number of students during the practical sessions, enabling even remote connections so that students are not forced to be physically present in the same lecture room to follow the exercise.

An example of an important topic that has been left aside due to the above-mentioned limitations of the NG is the load scheduling. This is part of a wider -hot-topic in the domain of MGs and energy management, called Demand-Side-Management (DSM). As defined in [START_REF] Gellings | The concept of demand-side management for electric utilities[END_REF], "Demand-side-management is the planning and implementation of those electric utility activities designed to influence customer uses of electricity in ways that will produce desired changes in the utility's load shape". This is considered a key aspect, enabled by microgrids, that helps to address the issue of non-dispatchability of renewable energy sources (RES), as highlighted in the 2019 International Renewable Energy Agency (IRENA) report [START_REF]Innovation landscape for a renewable-powered future. website[END_REF]. Several authors have studied the DSM subject from a theoretical angle [START_REF] Fattahi Meyabadi | A review of demand-side management: Reconsidering theoretical framework[END_REF], policy-wise [START_REF]A review of demand-side management policy in the UK[END_REF], technically [START_REF]The review of demand side management and load forecasting in smart grid[END_REF] and business-model wise [START_REF] Behrangrad | A review of demand side management business models in the electricity market[END_REF]. There are also commercially available software like the System Advisor Model from the National Renewable Energy Laboratory (SAM-NREL) (https://sam.nrel.gov/) or Homer (https://www.homerenergy.com/ products/pro/index.html) that are more focused on the technical conception, sizing and economical-feasibility analysis of a microgrid or renewable power-plant project.

In this work, we pretend to tackle the subject more from a pedagogical perspective. At the moment of writing, few examples of similar projects were found were the focus was pointed in this direction. Some examples of "ongoing" projects are the ones presented in [START_REF] Cohn | Play a Game to Design a Rural Microgrid[END_REF] and [START_REF] Ayu | A Simulation Gaming Approach to Micro-grid Design and Planning: Participatory Design and Capacity Building[END_REF], but despite the references date from 2017 and 2015, no recent information was found regarding their actual implementation. A working software was found called RAPSim (Renewable Alternative Powersystems Simulation) (https://sourceforge.net/projects/ rapsim/). It is a free and open source micro-grid simulation framework intended for better understanding the power flows behavior in smart microgrids with renewable sources. It is able to simulate grid-connected or standalone microgrids with solar, wind or other renewable energy sources. The software calculates the power generated by each source in the microgrid and then it conducts a power flow analysis. Even when the software could be a useful pedagogical tool for power-flows analysis, it lacks the load-scheduling or demand-side management focus that we propose in our approach. We intend to develop three different exercises or "games", namely: a MG sizing exercise, a MG load-scheduling exercise and a short evaluation. However, the sizing exercise and the quiz are still under development, so we will focus on the load-scheduling experience, which has been already tested in several practical sessions with students.

The game Dashboard

The idea behind the load-scheduling exercise is to understand the objectives, advantages, challenges and performance indicators that might be related to a DSM scheme. The main goal of this "game" is to better match renewable production and consumption, with the aim to increase the self-consumption and reduce storage requirements. This is done by scheduling the dispatchable load (i.e. the load that can be scheduled at different moments of the day) according to the renewable production. For this, students can also decide when they want to buy energy from the utility grid (and how much) and when they prefer to make use of the energy stored in the battery. Through this daily scheduling exercise, students are introduced to the kind of tasks performed by an energy management system, which serves to acknowledge its importance, limitations, constraints and difficulties.

The dashboard of the software platform is where the user interaction occurs. The first part of this interface, presented in figure 2.15, shows three main plots. In the left plot, the hourly potential PV production (blue) and the scheduled consumption (red) are shown. The generator convention is respected, hence, any power being delivered by an element has a positive sign while any power being consumed will have a negative sign.

The potential PV production is computed based on the solar irradiance profile chosen in the Day type selection tab, in the upper right part of the dashboard. Here, four types of days are proposed varying from a clear-sky day to fully overcast conditions. The solar profiles are taken from real measurements of the SIRTA observatory in Palaiseau, France [START_REF] Kammen | Sirta, a ground-based atmospheric observatory for cloud and aerosol research[END_REF]. In this part of the interface, the user can also choose between two game modes, beginner and expert.

In the beginner mode the PV size is fixed and set to 2kW while the capacity of the battery is fixed to 6kWh, with a starting SoC of 60%. In the expert mode both, the PV installed capacity and the battery capacity, can be changed under the "parameters" tab, which allow for sizing exercises. The first plot (figure 2.15 left) allows users to graphically observe how well their consumption scheduling is matching the available PV production. The second plot (figure 2.15 center), shows the potential (blue) and consumed (red) PV energy. Students are explained that, in order to obtain a high score in the self-consumption indicator (explained later in the performance indicators section), they must try to consume all the potential PV energy available. Moreover, in the third plot (figure 2.15 right), they have the resulting SoC profile which is a direct consequence of the battery power profile which in turn, responds to the consumption scheduling they have proposed. The amount of time that battery is either empty or full can be seen in this graph, which gives an interesting feedback in order to optimize its use. The type of day regarding the grid electricity price can also be selected here. There are three different price schemes that follow the EDF tempo tariff [START_REF] Tempo | Grille tarifaire en 2020 et CGV[END_REF], namely: white, blue and red days, being the red days the most expensive and the blue days the least expensive. Each day has a peak period (from 6h to 22h) where the electricity price is higher, and a "valley" period (from 22h to 6h) when the electricity price is lower. Below the previous plots, a graph is displayed where the half-hour cumulative energy of the four elements of the microgrid is presented (see figure 2.17). Each bar shows the power mix that is being used in order to achieve the balance between the production (positive values) and consumption (negative values), following the priority rules coded for this simulated microgrid, as depicted in figure 2.16. Those rules are summarized as follows: the MG will always give priority to the use of the battery, meaning that any excess of energy (i.e. from PV) will be stored in the battery and any lack of energy required to satisfy the demand will be supplied by the battery, whenever possible. However, the user can also buy electricity from the grid at any moment in order to decrease/avoid the use of the energy stored in the battery. If battery is full and there is still excess of energy coming from PV panels, this will be curtailed as no grid selling is allowed. If there is a lack of PV energy to satisfy the demand -and battery cannot supply it-, energy can be bought from the grid in order to fulfill the energy needs. The amount of power drawn from the grid can be set between zero and 5 kW. The price of electricity bought from the grid depends on the time of the day and the type-of-day selected, as it was explained above. In figure 2.17, the simulated power flows between the resources of the microgrid (PV panel-blue-, load-red-, battery-orange-and grid-green-) are graphically displayed, which in combination with the SoC plot displayed in figure 2.15, help the user to make decisions in order to improve their proposed scheduling. Situations like the PV curtailment due to an improper matching between production and consumption can be acknowledged in this plot.

The scheduling interactive table

In the third part of the dashboard, the user makes its consumption scheduling making use of the scheduling interactive table, as depicted in figure 2.18. For every 30-minutes timestep, the user can decide how to split the required daily consumption of the household appliances proposed. Each appliance must be used a certain amount of hours during the day, assuming an hypothetical-average profile of use. This is indicated in the last-right column of the table. This interactive table allows the user to schedule consumption following certain restrictions, at the same time that permits to check the compliance with the time of use of each appliance, maximum feeder power ratings and SoC of the battery. The maximum and minimum SoC levels of the battery can also be set by the user. The user will be penalized if those limits are surpassed. The platform will not allow the user to run the simulation until all the requirements are fulfilled.

There is a based-load that corresponds to the non-dispatchable consumption (e.g. the refrigerator or the electronic devices that are always plugged), which cannot be modified. The minimum consumption period that can be selected for each home appliance is 30 minutes, as mentioned before. Most of the appliances are considered to have a fixed power rate, except for the water heater that is assumed to have a flexible power setting between zero and its nominal power. This makes this element very versatile for energy management purposes as it Figure 2.18 Scheduling interactive table to perform the daily consumption scheduling. Consumption is discretized in 30 minutes intervals can be used as storage of thermal energy in the system. It is considered to have negligible thermal losses, then the total daily-energy required to heat the water can be supplied at any moment of the day. The only constraint in this case (and for all the other appliances too), is that the maximum power drawn from the main feeder cannot surpass 5kW at any given moment.

The daily habits and routine of a person plays an important role in this exercise, which is also remarked during the explanation of the experience. Students are asked to use the common sense to schedule the different devices according to a realistic daily routine of a person that is working from home on that specific day. However, there are as many possibilities as students in the room, so what for one student might be a normal time to prepare the meal or take a shower, for other student might be rare or unrealistic. This analysis is part of the debrief that is performed at the end of the exercise when the results, obtained by the different students, are compared.

Performance indicators calculation as the game scores

There are several performance indicators that are computed using equations 2.3 to 2.7. Each one of them is related to a service that the MG provides to the users and could be in itself, an optimization objective for the game. There is also an overall performance score that is an average of those five individual scores, as the example given in figure 2.19 shows.

SELF-CONSUMPTION

= E used PV E potential PV * 100 (2.3) SELF-SUFFICIENCY = E used PV E load * 100 (2.4) BATTERY BALANCE = 100 -SoC f inal -SoC initial (2.5) BATTERY USE = 100 - E + battery E load * 100 (2.6) GRID COST = EC @lowest price grid EC grid * 100 (2.7)
where E X stands for the energy exchanged by the resource X, E + battery stands for the energy delivered by the battery (i.e. only on discharge regime), EC grid is the total cost of the energy bought to the grid while EC @lowest price grid represents the total cost of the energy bought to the grid if bought at the lowest price possible.

The self-consumption score evaluates how much of the potential PV production available is actually used. Even when an MPPT controller is assumed to be used, when there is not enough consumption or storage capacity, any PV power available has to be curtailed. This leads to a self-consumption rate below 100%. Ideally, all the solar potential should be used at all times in order to maximize the self-consumption. This in turn, will decrease the need of buying electricity from the grid which has also an impact on the grid cost indicator.

The self-sufficiency score evaluates the amount of the total energy consumption of the day that was supplied by the PV panels. The closer to 100% the more energy-autonomous the system is, meaning that less energy has to be bought from the grid.

The SoC of the battery at the end of the day, is a criteria that can be chosen arbitrary depending on the energy management strategy. It is intended to assure the sustainability and availability of battery capacity throughout the week. In this case, the SoC at the end of the day is asked to be left at the same level as it was at the beginning of the day (SoC f inal = SoC initial , 60% default value). In this way, every other day will have the same battery capacity available to perform the daily scheduling. The further the SoC from its target value (either above or below), the bigger the penalization.

The battery-use score evaluates how much the battery is used throughout the day. It is a simple way to measure the aging of the battery caused by its profile of use. The more energy Experimental nanogrid development with pedagogical and demonstrator purposes the battery delivers, the shorter its life will be. Therefore, this variable is to some extent, contradictory with other services such as self-consumption, because the optimization of one service is detrimental for the other one. This contradictory nature among some of the scores is one of the main take-aways of this exercise, which is to show that optimizing for one of the scores might negatively affect the other ones. This means that there is always a trade-off to do depending on the objective set for the load scheduling. This subject is also one of the core topics explored in detail in Chapter 4.

The grid-cost score evaluates the total cost of the electricity bought from the grid, compared to the cost of buying the same amount of energy at the lowest price possible. If all the energy was bought during the lowest-price period, the score will be 100%.

The final score is an equally-weighted average of all the previous scores, which in the case of this practice, is the objective students are asked to maximized. Other indicators such as solar potential production, energy bought from the grid and battery SoC are presented at the end of the results summary. An example of the results summary displayed at the end of the load scheduling game is shown in figure 2 Students are asked to perform a first scheduling assuming a realistic scenario, but without doing too much reflection about the scores and the optimal scheduling. After doing this first run of the game, based on each of the scores obtained, participants are asked to analyze in which of the scores they obtained the lowest grades, and try to thing about the possible causes of the results. After this reflection, they are asked to figure out how to improve each score in particular and the overall score as well. They make the adjustments they consider pertinent in the scheduling and then they run the game again to see if they achieve the expected improvement. The results of the different participants are presented to the rest of students and they are compared in order to learn the different approaches that each person took, and the reasons behind. As the last part of the practice, different solar production and/or electricity price scenarios can be selected, to show how the load scheduling must change in order to adjust to the new conditions.

The last part of the experience corresponds to a sizing exercise. Students are asked to find a proper size of PV and battery capacity so that the system can be 100% self-sufficient under the selected solar potential conditions. As there are many possible combinations to achieve this goal, the objective here is to compare the different proposals and analyze them in terms of technical adequacy and economic feasibility. As an improvement for this section, the cost of the PV panels and battery is expected to be included in the scores, so students can base their sizing on the final Levelized Cost of the Electricity (LCOE) obtained for each sizing proposal.

An article is being prepared based on this chapter, that highlights the use of the NG as a pedagogical and demonstrator tool in the domain of microgrids. The game is expected to continue its evolution by completing the missing functionalities originally envisaged. The game can be accessed using the following link: https://www.lmd.polytechnique.fr/trendx/ microgrid/index.html#home

Conclusions

The NRLAB Nanogrid was developed with the intention to serve several purposes. The first objective was to help the designer, as part of his PhD formation, to better understand the key aspects to take into account when building and implementing a real microgrid, with all the elements it requires to allow for smart functionalities. This objective was achieved through the three different iterations that had to be made in order to attain a functional system. Each new version of the system was the result of a in-deep analysis to overcome the challenges encountered during the construction and implementation of each previous version. The knowledge acquired after the three iterations is key to fully understand the details of a MG from its conception to its electrical constraints, which will be very useful for the following steps of the PhD thesis. Having a deep knowledge of how real systems work, permits to have a more realistic approach and a better criteria to analyze the results obtained in the following parts of this research. Therefore, the background knowledge acquired by the author of this Experimental nanogrid development with pedagogical and demonstrator purposes work through this learning-by-doing exercise, is considered of great value in the attainment of the objectives of this thesis.

The NRLAB nanogrid is still under constant improvement and it is still some steps away to be considered a professional system that could be used to perform high-level research or highly accurate realistic emulations of real systems. It will probably take several iterations more to achieve this highest levels of reliability, accuracy and functionalities; but in the process, it can serve as a very graphical and flexible tool to discover the world of microgrids which was the main objective for this part of the thesis. Through the number of practices that have been already performed and students that have performed their graduation projects in the NRLAB, the system has shown success in the completion of this important objective of serving as learning-by-doing pedagogical tool. This tool has enabled many students to go further in subjects related to MGs on their own, guided and motivated by the experience they have had with nanogrid.

Besides, given the future academic profile to be followed by the author of this work, the pedagogic application of the system was also of major importance. The development of a system that serves as an experimental platform, where students from very different backgrounds could get in touch with the basics regarding microgrids, energy management and load scheduling was set as an important objective for this part of the project. The system gives also the possibility to the teachers to propose different practices and exercises suited for their particular courses and approaches of the subject, which is a valuable tool for someone that will follow an academic career on this subject.

However, due to the technical constraints encountered during the development of the nanogrid, we acknowledged its limitations to develop some of the research, demonstrative and pedagogical activities that were expected for the system. This gave rise to the idea of creating an ideal software-based environment, without the technical limitations of the physical nanogrid, that would complement the activities and scope attainable with the NRLAB nanogrid. The "microgrid game", came to expand the possibilities of the physical system by allowing a bigger number of students to profit from the experience remotely, making the project universally accessible. Besides, the combination of both, the game and the physical system, opens up even greater possibilities regarding experiences and exercises to tackle the theoretical planning but also the real-time emulation, constraints and limitations on this vast domain of microgrids, energy and demand-side management.

One of the main take-aways of the game experience discussed with students, is the importance of forecasts. In the load-scheduling exercise, they can choose the electricity pricing scheme and the solar PV production, which is useful for the purposes of the game, but it is an unrealistic scenario. Students are asked to think for a while, how would they perform the same load-scheduling without knowing beforehand the prices of the electricity or the solar PV production expected for the day? The first and most common answer given by the students was: we should use forecasts. This is correct, but then students are questioned about, what would happen if those forecasts are wrong? how would they manage that uncertainty? The answers to these questions might not be straight-forward, and having acknowledged its key role when dealing with the management of resources in a microgrid, the importance of going further on this topic was evident, and that motivated the study performed in the Chapter 3 of this thesis.

Another limitation of the load-scheduling game, that was a question posed by several students, was: what is the ideal scheduling? how would an optimal scheduling look like? At this point, we did not have an answer to this question. The performance indicators developed for this game were based on very basic -and sometimes unrealistic-assumptions, that might be misleading regarding what an optimal scheduling strategy should be, if they are not properly interpreted. Besides, this game lacks of a proper optimization algorithm that computes the optimal scheduling (for the pricing and PV production conditions given) so that it can be used as true reference to compared against the scheduling proposed by students. This would give this game an important added-value, as without a proper -truly optimal-reference of performance, the conclusions and analyses that can be performed with the scheduling proposals of the students are limited. In order to implement such optimization algorithm, the objectives that want to be favored have to be clearly defined, and as the results of the game already showed, some of those objectives might even be contradictory. Then, how to propose a scheduling strategy that leads to an optimal performance? what can be considered an optimal performance indeed? To find the answers to those important questions, was the main motivation for the study performed in the fourth and last chapter of this thesis.

Current and future developments and functionalities

There are still some connectivity problems going on with the CR1000X. This needs to be solved in order to have a fully reliable system that can be used for research. Every now and then the unit re-initializes itself, which makes the interface unresponsive for a short period of time. The important thing is that measurements are not lost in these periods, but any EMS algorithm that might be running in Node-RED will stop working.

The remote control of the power source needs to be improved. By now, there is always an off-set between the desired and the real value imposed to the battery power, which makes this feature not very accurate for the moment. Given that this feature does not work when the battery reaches a certain SoC (normally above SoC=85% the battery is no longer able to Experimental nanogrid development with pedagogical and demonstrator purposes follow power charging instructions), the implementation of a precise algorithm to estimate the real SoC of the battery is a must. This would help not only the battery-power control feature to work properly, but it is also a key input in the decision-making process of an energy management system.

However, estimating the SoC of a battery under load (i.e. without being disconnected from the MG) is not a straightforward matter. Researchers seem not to agree on a generalized model that can be applied to any Li-Ion battery that accurately estimates its SoC based only on current and voltage measurements. Some simplified methods such as the coulomb counting are being implemented and validated with the help of some master students that are developing their course projects on the laboratory.

The wind turbine is expected to be fully functional in the near future. Problems with its electrical coupling to the rest of the system have made it unable to produce any energy. A deeper study and laboratory testing under controlled conditions need to be made in order to determine the source of the problem and to find a viable solution.

It has been envisaged to enable the system for the testing of demand-side-management strategies. Establishing the percentage of the load that can be curtailed or shifted throughout the day, and implementing this functionality to the load control algorithm, would be an interesting improvement towards a more flexible MG. This would allow the testing of these type of schemes that are getting more popular as an interesting feature for a microgrid to further improve performance.

Incorporating real time information regarding grid electricity price and CO 2 emissions is another feature envisaged for the near future, as those can be important aspects to be displayed in the interface but also important inputs for an energy management system. Automating the PV, wind and consumption forecasting is another feature to be added to the system in order to allow for more flexibility, intelligence and autonomy. This feature is considered a key aspect that the Drahi-X building should posses to become a smart-building.

A more accurate estimation of the Joule losses of the system (e.g. by branch) is another feature expected to be implemented in the future. Knowing where are the hot-spots regarding Joule losses in the microgrid and what are the conditions that trigger high-losses, would be a valuable detail to take into account in the management of the nanogrid. For instance, this would enable to include Joule-losses-reduction as a criteria in the energy management strategies.

Regarding the microgrid game, the evaluation section must be properly finished, with exercises that promote the reflection regarding the most important concepts that want to be conveyed in every practice. Evaluation should also be sectioned in sizing, load scheduling and general knowledge questions, so that students that have done only one game, can be evaluated accordingly.

The sizing section of the game is under construction, and presents a wide range of possibilities to be explored in terms of concepts and exercises that can be proposed for students to understand the world of PV + battery sizing. Here the possibilities are vast, then the exercises must be well designed to convey the basic concepts of microgrid-sizing that are required when facing these type of problems.

Regarding the load scheduling game, we are working on defining a more detailed usage scenario that help students through the scheduling process. Departing from a common usage scenario for a day, would help them to come up with their particular but yet, realistic proposals that at the end of the exercise can be fairly compared to each other. The implementation of an optimization algorithm that, for a given scenario of PV production and electricity prices, computes the optimal load-scheduling, would be a valuable tool that would serve as the reference and starting point for the analyses and discussions regarding the scheduling proposals made by the students. Including economical calculations for the cost of the PV and battery is also a priority that will make the sizing exercise more meaningful. Accounting for the aging of the battery according to the usage profile proposed by the students would be a highly desirable feature to be implemented as well, in order to show students how the usage of battery affects its life and in turn, the cost of the electricity delivered by the microgrid. The incorporation of forecasts of PV production is also envisaged as that would bring out the complications that a realistic scenario of uncertain PV production could pose to an energy management system, and would open up new possibilities in proposing strategies to counteract this uncertainty.

Chapter 3

Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles

Introduction

Solar irradiance and more recently, solar PV power production forecasting has been a subject widely studied due to its increasing importance in the energy sector, as the penetration of PV power generation in the electric systems around the world is becoming more important. Many of the electricity markets around the world work with a day-ahead planning-and-scheduling horizon, which makes day-ahead forecasts a key element for producers, transmission-anddistribution system operators as well as market agents. These players need to guarantee the fulfillment of the energy bids and the quality of the electricity in order to avoid penalties and to assure a satisfactory level of energy quality. Variability of the solar resource comprises two parts: a predictable one, due to the Sun-Earth geometry aspects, and an atmosphericstochastic one, due to the composition of the atmosphere and in particular, clouds. In order to deal with the latter at day-ahead time horizons, different methods of forecasting are available, being the deterministic forecasts using Numerical Weather Predictions (NWP) and statistic adaptations or machine learning techniques the most commonly used [START_REF] Nespoli | Day-ahead photovoltaic forecasting: A comparison of the most effective techniques[END_REF][START_REF] Visser | Benchmark analysis of day-ahead solar power forecasting techniques using weather predictions[END_REF]. The value of a probabilistic forecast and/or uncertainty prediction over a simple deterministic forecast stands out when estimating the optimal level of reserves that need to be allocated to compensate for solar or wind power imbalance in an electric system, as pointed-out in [START_REF] Doherty | A new approach to quantify reserve demand in systems with significant installed wind capacity[END_REF]. Deterministic forecasts have different degrees of accuracy depending on the meteorological conditions. For instance, it has been shown that, for clear skies in summer days the accuracy of solar Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles irradiance forecasts is better than in cloudy/windy autumn or spring days [START_REF] Lara-Fanego | Evaluation of the wrf model solar irradiance forecasts in andalusia (southern spain)[END_REF]. Hence, inferring trustfulness of deterministic forecasts from meteorological conditions is a way to deal with the intrinsic uncertainty of the IRES in an electric system. This becomes very important in small-scale electrical systems like microgrids where the penetration of IRES is very high (sometimes even 100 percent), making them strongly dependent on weather conditions and its intrinsic uncertainty. Even when energy storage serves as a solution to deal with the uncertainty and variability on the production side, its limitations in capacity and cost are still very restrictive, which makes its management a key aspect for a system to be reliable and feasible from an economic point of view.

The main objective of this part of the work is to obtain uncertainty information associated to a given deterministic solar irradiance forecast using an Analogs Ensembles (AnEn) method.

Besides, the performance of the AnEn hereby proposed is evaluated using different indicators and comparing it against several benchmark methods. In section 3.2, an overview of some of the state-of-the-art methods to forecast solar irradiance and PV power is presented. Probabilistic forecasts are also tackled, particularly regarding methods to obtain probabilistic forecasts from deterministic predictions. In section 3.3 we discuss and define different techniques and performance metrics to evaluate the quality of a probabilistic forecast. The analog ensemble method is presented in section 3.4, including the working principle, the considered data-sets, the predictors selection and a sensitivity analysis on the number of analogs for different training period lengths. Section 3.5 introduces the methods used as benchmark. In section 3.6, the performance and evaluation results are shown and discussed. The main conclusions are presented in section 3.7 and future perspectives for further research on the subject as well as the envisaged applicability of the results are presented in section 3.8.

From deterministic to probabilistic forecasts

A thorough and extensive review on the history and recent trends in solar irradiance and PV power forecasting can be consulted in [START_REF] Yang | History and trends in solar irradiance and pv power forecasting: A preliminary assessment and review using text mining[END_REF], where they use text mining in order to go over more than one thousand publications on the topic in an automated manner, covering most of the aspects related to solar forecasting. Another comprehensive review about PV power forecasting is performed by Antonanzas et al. [START_REF] Antonanzas | Review of photovoltaic power forecasting[END_REF] where they do a summary of the main techniques used to issue PV power predictions. They point out that most recent papers highlight the importance of probabilistic predictions and they incorporate an economic assessment of the impact of the accuracy of forecasts on the grid. Later on, they perform a classification of authors according to forecast horizons and origin of inputs. These methods are depicted in figure 3.1. In this study we focus on methods of the first category (statistical methods of probabilistic forecasts), where a Probability Distribution Function (PDF) is statistically generated. As an example of a well known forecast method within this category, we find the method proposed by Nielsen et al. [START_REF] Nielsen | Using quantile regression to extend an existing wind power forecasting system with probabilistic forecasts[END_REF] which is a quantile regression approach that uses deterministic forecasts of correlated variables to find a PDF of the wind power production of a wind farm. In this case, previous forecasts are required and the method can be extended to produce day-ahead or up to 36h-ahead forecasts. This is an example where the aim is to build a PDF of the predicted variable. There is another set of methods, this time from the group 4 of figure 3.1 (perturbation-based ensemble forecasts), that are also commonly used in producing probabilistic forecasts and have been Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles Figure 3.1 Overview of the state-of-the-art forecast methodologies to generate probabilistic forecasts. Classification taken from [START_REF] Haupt | The use of probabilistic forecasts: Applying them in theory and practice[END_REF].

used as reference to evaluate other probabilistic forecasting approaches. The ECMWF-EPS (European Centre for Medium Range Weather Forecasting-Ensemble Prediction System) are used by Sperati et al. [START_REF] Sperati | An application of the ecmwf ensemble prediction system for short-term solar power forecasting[END_REF] to build a PDF for 0-72h forecast horizons to predict PV power output of a solar farm. They further used a neural network to reduce the model bias and to generate a PDF of PV power starting from the ensembles of the correlated meteorological variables chosen as inputs. To train the models they used about two years of power data from three different solar plants. It is important to remind that the computational requirements needed to generate the ECMWF-EPS ensembles is very high, as they are generated through numerical weather prediction methods. In the aforementioned work they make use of the persistence ensembles (PeEn) technique as a reference method for comparison and validation. This method is probably the most common reference model in the solar or wind forecasting community for short term forecasting and can be used to benchmark other methods [START_REF] Diagne | Review of solar irradiance forecasting methods and a proposition for small-scale insular grids[END_REF]. For a deterministic case, the persistence model supposes that the predicted variable at time t+1 is best predicted by its value at time t. It can also be extended to produce a predictive PDF for probabilistic benchmarking, which is the case of the study performed by D.Yang [START_REF] Yang | A universal benchmarking method for probabilistic solar irradiance forecasting[END_REF].

Here, a universal PeEn method is proposed, that gets rid off the problems of interpretability of current persistence ensemble methods due to its dependence on the model parameters and forecast setup. The work presented by Yang, is a complete-history method that utilizes the 3.2 From deterministic to probabilistic forecasts 51 entire history of measurements, and forms empirical distributions of the forecasted clear-sky index (CSI) that only depend on the time of day. Within the first category of statistical methods, there are other sub-type of probabilistic forecasting methods based on analogs selection, where the predictive and distribution functions are obtained from an historical data-set of forecasts and ground measurements. The term "analogs" was already proposed by Lorenz in 1969 [START_REF] Edward | Atmospheric predictability as revealed by naturally occurring analogues[END_REF] in order to define two weather patterns that are similar to each other. The present study falls into this sub-category, where some other authors have already worked on different applications of the method. This is the case in [START_REF] Delle Monache | Probabilistic weather prediction with an analog ensemble[END_REF] and [START_REF] Delle Monache | Kalman filter and analog schemes to postprocess numerical weather predictions[END_REF] that applied this method for deterministic and probabilistic meteorological forecasting, by [START_REF] Alessandrini | A novel application of an analog ensemble for short-term wind power forecasting[END_REF] for wind power forecast, and by [START_REF] Vanvyve | Wind resource estimates with an analog ensemble approach[END_REF] for wind resource assessment. This is also the case of the work by Alessandrini et al. [START_REF] Alessandrini | An analog ensemble for short-term probabilistic solar power forecast[END_REF], where they propose an analogs-ensembles method for PV power forecasting over the 0-72h lead time period. The particularity of this method is that only a single deterministic forecast is necessary along with an historical data-set of predictions and observations to produce the predictive PDF, thus the computational power and time required is way less than the case of the ECMWF-EPS. Studies have been performed to reduce even further the computational requirements and time of such method, as the one presented by D.Yang and S.Alessandrini [START_REF] Yang | An ultra-fast way of searching weather analogs for renewable energy forecasting[END_REF]. They propose an exact, non-parametric, scalable and parallelizable method which is also non-dependant on dimensionality; that proved to be up to 100 times faster than the brute-force approach. The predictors used by Alessandrini et al. in their application, predicted by ECMWF-EPS, are: global horizontal irradiance (GHI), cloud coverage (CC), air temperature (T2), azimuth angle (AZ) and solar elevation (EL) with a half-width time window equal to 1h and a time resolution of 1h as well. The set of optimal weights for those predictors is defined by choosing the combination that minimizes the continuous ranked probability score (CRPS) over the last 60 days of the training periods. The CRPS is a measure of how good forecasts, that are expressed as probability distributions, are in matching observed outcomes (see the definition and discussion in section 3.3). Both, the location and spread of the forecast distribution, are taken into account in judging how close the distribution is to the observed value. They compare their outcomes against a quantile regression and a PeEn method to validate their results, finding that the AnEn performs generally similar or better than the reference methods specially under certain circumstances such as low solar elevation angles. Badosa et al. [START_REF] Badosa | Day-ahead probabilistic forecast of solar irradiance: A stochastic[END_REF] propose also a method to derive a probabilistic forecast of GHI from a deterministic forecast taken from the AROME NWP forecast model from MeteoFrance. They perform this task by using a time-dependent stochastic differential equation which models the evolution of the CSI. The output of the model is a probabilistic distribution from where a probabilistic forecast or information about the uncertainty of the original deterministic forecast can be ensembles obtained. There have been other approaches to try to obtain information about the uncertainty of a given deterministic forecast using analogs-based methods. This is the case of the study held by Badosa et al. [START_REF] Badosa | Reliability of day-ahead solar irradiance forecasts on reunion island depending on synoptic wind and humidity conditions[END_REF] where they investigate the influence of large-scale atmospheric parameters (synoptic conditions) on the local solar irradiance and its variability at diurnal time scale. They present an empirical statistical downscaling method based on past analogous synoptic conditions identification to perform day-ahead solar irradiance forecasts on Reunion Island to derive forecast reliability. They found that local solar irradiance shows sensitivity to synoptic wind and relative humidity conditions changes. They also concluded that overall highest reliability (that is lowest forecasting errors and lowest error variability) is found for conditions related to highest local daily irradiation; lowest reliability is found for conditions related to lowest daily irradiation.

The general approach proposed in this study is constructed following some of the principles presented in [START_REF] Alessandrini | An analog ensemble for short-term probabilistic solar power forecast[END_REF], with differences in the predictors used, the method used to obtain the weights of the predictors, the origin of the deterministic forecasts, the reference methods considered, the metrics used to evaluate the results as well as the geographical location of the study case. One of the most significant differences is the normalization of GHI using the CSI to perform the comparison between the forecast and the possible analogs in the database, as explained in section 3.4.2. This eliminates the annual and diurnal (deterministic) solar irradiance variability due to solar trajectory, isolating the effect of clouds, which is the main focus of this work, as it is the major source of uncertainty in PV power production forecasting. Besides, state-of-the-art metrics and scores, such as quantile skill score (QSS) and CRPS Score (CRPSS) as well as sharpness, are used to evaluate the performance of the AnEn approach against several benchmark ensembles methods, as presented in section 3.3. Day-ahead is selected as the planning-and-scheduling time horizon due to its pertinence in current energy markets and distribution-system-operator planning and scheduling schemes. With this in mind, the AnEn stands out as a suitable method that allows the estimation of uncertainty due to its versatility as a data post-processing method [START_REF] Delle Monache | Kalman filter and analog schemes to postprocess numerical weather predictions[END_REF] with low computational requirements.

Evaluation metrics considerations

As mentioned by Antonanzas et al. [START_REF] Antonanzas | Review of photovoltaic power forecasting[END_REF] in their review, the most commonly used metrics to evaluate performance of probabilistic forecasts are RMSE, MAE and MBE (see equations 3.1, 3.2, 3.3).

Evaluation metrics considerations

53

RMSE = 1 n Σ n i=1 P i -O i 2 (3.1) MAE = 1 n Σ n i=1 |P i -O i | (3.2) MBE = 1 n Σ n i=1 (P i -O i ) (3.3)
where P i and O i stand for predictions and observations correspondingly, while n represents the number of observations. Normalized versions of these indicators are also commonly considered by dividing each of the above indicators by the mean value of the observations O i , as presented in equations 3.5, 3.6 and 3.4.

rRMSE = RMSE 1 n ∑ n i=1 O i (3.4) rMAE = MAE 1 n ∑ n i=1 O i (3.5) rMBE = MBE 1 n ∑ n i=1 O i (3.6)
In this work, it is important to recall that the probabilistic forecasts of solar irradiance will take the form of either a Predictive Distribution Function (PDF) or a Cumulative Distribution Function (CDF), both usually referred as predictive distributions. The predictive distributions can be summarized by a set of quantiles (also called quantile forecasts) with probability levels τ spanning the unit interval. Prediction intervals can be inferred from this set of quantile forecasts. Therefore, for this type of forecasting techniques, there are other metrics that have been proposed and are considered more adequate to evaluate the skill of probabilistic forecasts, which are explained in the following sections.

Required properties for skillful probabilistic forecasts

We focus here on the evaluation of the quality of the probabilistic forecasts. Quality measures the correspondence between forecasts and observations. Three main attributes characterize the quality of the probabilistic models namely: reliability, resolution and sharpness [START_REF] Wilks | Statistical Methods in the Atmospheric Sciences[END_REF][START_REF] Jolliffe | Forecast Verification: A Practitioner's Guide in Atmospheric Science[END_REF].

Reliability or calibration evaluates the statistical consistency between the forecasts and the observations. A high reliability is obtained if forecast probability and observed frequency agree. For example, the nominal coverage rate of the prediction intervals should be equal to the empirical one (e.g. a 90% prediction interval should cover 90% of the observations).

Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles

Resolution refers to the ability of the probabilistic model to discriminate among different forecast situations. More precisely, the more distinct the probability distributions for various forecast situations are from the full climatological distribution, the more resolution the forecast model has. A high quality probabilistic model should issue reliable forecasts with high resolution. In other words, high reliability is a necessary but not a sufficient condition for a high quality probabilistic forecast. The forecast should also exhibit high resolution. For instance, climatological forecasts are perfectly reliable but exhibit no resolution.

The third property is sharpness, which measures the concentration of the predictive distribution. As this attribute is independent of the observations, it evaluates only the informativeness of the forecasts (i.e. how much do the predictive distributions differ from the climatological forecast in terms of concentration of the distribution). The higher the sharpness, the more concentrated and informative the distribution is. It differs from the resolution as sharpness focuses on differences regarding the concentration of the predictive distributions; while resolution accounts for differences in general between distributions, not necessarily regarding concentration. Consequently, a probabilistic model can generate sharp forecasts yet being useless if those probabilistic forecasts are not reliable.

Proposed evaluation framework

Following [START_REF] Lauret | Verification of solar irradiance probabilistic forecasts[END_REF], we propose to use scoring rules like the Continuous Ranked Probability Score (CRPS) and the Quantile Score (QS) to evaluate the quality of the different models. Detailed information about the forecasting performance will be obtained through the decomposition of CRPS and QS into reliability and resolution. Also, for each of these two metrics, we will calculate the skill scores namely CRPSS (CRPS Skill Score) and QSS (Quantile Skill Score). Sharpness of the forecasts will be given by the mean size of the central prediction interval (that is the distance between the quantile with probability level τ = 0.1 and quantile with probability level τ = 0.9). Finally, it must be stressed that, in this work, we will not rely on visual diagnostic tools like reliability diagrams to assess qualitatively the reliability property [START_REF] Lauret | Verification of solar irradiance probabilistic forecasts[END_REF]. Instead, the reliability assessment will be based on the numerical decomposition of the scoring rules CRPS and QS that provide, in our opinion, a sound quantitative evaluation of calibration.

Continuous Ranked Probability Score

The CRPS measures the difference between the predicted and observed cumulative distributions functions (CDF) [START_REF] Hersbach | Decomposition of the Continuous Ranked Probability Score for Ensemble Prediction Systems[END_REF]. It will permit to quantify the overall skill of each method and 3.3 Evaluation metrics considerations 55 therefore will provide an objective ranking of the probabilistic models. The CRPS reads as:

CRPS = 1 N N ∑ i=1 +∞ -∞ Fi f cst (x) -F i x obs (x) 2 dx, (3.7)
where Ff cst (x) is the predictive CDF of the predictand x (here GHI) and F x obs (x) is a cumulative-probability step function that jumps from 0 to 1 at the point where the predictand x equals the observation x obs (i.e. F x obs (x) = 1 {x≥x obs } ). The squared difference between the two CDFs is averaged over the N forecast/observation pairs. The CRPS score rewards concentration of probability around the step function located at the observed value [START_REF] Wilks | Statistical Methods in the Atmospheric Sciences[END_REF]. In other words, the CRPS penalizes lack of resolution of the predictive distributions as well as biased forecasts. Notice that the CRPS is negatively oriented (smaller values are better) and it has the same dimension as the forecasted variable.

Quantile Score

In this work, practical considerations discussed in section 3.6.2 lead us to study the skills of quantiles with probability levels τ = 0.1 and τ = 0.9. Those quantiles will be taken as representative of low (pessimistic, conservative) and high (optimistic) irradiance levels. Thus, QS will be calculated for these two specific probability levels. This score has been considered adequate to evaluate the quality of these particular quantile forecasts. QS is based on an asymmetric piece-wise linear function ψ τ called the check or pinball loss function. The check function was first defined in the context of quantile regression [START_REF] Koenker | Regression quantiles[END_REF] and is given by

ψ τ (u) =    τu if u ≥ 0 (τ -1)u if u < 0, (3.8)
with τ representing the quantile probability level. QS is given by the mean of the check function applied to the N pairs of observations x i obs and quantile forecasts for a specific probability level τ i.e, qi τ . QS reads as

QS = 1 N N ∑ i=1 ψ τ x i obs -qi τ . (3.9)
As for the CRPS, QS is negatively oriented: a lower value indicates a better performance. In this work, using the quantile score and its decomposition, a sensitivity analysis is conducted in order to determine the optimal training period needed by the analog method as well as the optimal number of analogs (see section 3.6.1). In a second step, based on the results of the previous analysis, a comparison between the AnEn method and two naive forecasting Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles methods: monthly climatology (MoCl) and persistence ensembles (PeEn) is made. An improvement from MoCl and PeEn is expected.

Decomposition of a proper score

As mentioned above, the quality of the probabilistic models will be assessed by means of numerical scoring rules like CRPS and QS. These two scores are proper scores. Significant work has been done to demonstrate the crucial point of using proper scoring rules (see [START_REF] Bröcker | Scoring probabilistic forecasts: The importance of being proper[END_REF] for a detailed discussion regarding proper scores). By definition, a proper scoring rule obtains the best expected value when the forecast distribution is equal to the true distribution of probability of the observations. Besides, using proper scoring rules allows the decomposition of the score into the two important attributes of the quality of a forecasting probabilistic model namely: resolution and reliability. This permits to understand more precisely the characteristics of the quality of the forecast. A general theoretical framework about decomposition of proper scores is available in [START_REF] Gneiting | Strictly proper scoring rules, prediction, and estimation[END_REF]. The decomposition of a generic proper score S (say for instance the CRPS or the QS) always follows equation 3.10:

S = Reliability -Resolution +Uncertainty (3.10)
In addition to reliability and resolution, the term uncertainty accounts for the variability of the observations. It is an indication of the difficulty of forecasting the target variable and cannot be modified by the forecasting model. It is also worth noting that the uncertainty part corresponds to the score of the global climatology (GlCl). For scores like CRPS or QS that are negatively oriented, the goal of a forecasting model is to minimize (resp. maximize) as much as possible the reliability term, and maximize (resp. minimize) the resolution term. In fact, a forecasting model with a high resolution term means that the model has captured the maximum of the variability present in the data (which variability is measured by the uncertainty term).

Skill Scores

For any scoring rule, it is possible to define a skill score which gauges the skill of a forecasting method against a reference forecast. In the meteorological community, often the forecast taken as reference is the climatological forecast distribution. Given a generic score S (for instance CRPS or QS), and the score of the global climatology (GlCl) denoted here by S, a generic skill score (SS) for a negatively oriented score is defined by :

SS = 1 - S S (3.11)

The Analog Ensemble method retrieval

57

A skill score is then contained in the interval [-∞, 1] and is positively oriented. In this work, we will use the definition given by Equation 3.11 to compute the CRPSS or the QSS. In other words, we will use the uncertainty part of the CRPS or the uncertainty part of the QS as the baseline value (i.e. S) . Notice that, in the solar forecasting community, the reference model or baseline model is usually the PeEn when calculating the CRPSS. However, as noted by [START_REF] Yang | A universal benchmarking method for probabilistic solar irradiance forecasting[END_REF], this definition of the CRPSS may lead to some misinterpretations of the skill score as the CRPS of the PeEn model varies according to certain parameters (e.g. number of members of the ensemble, forecast lead time, etc.). To address this issue, [START_REF] Yang | A universal benchmarking method for probabilistic solar irradiance forecasting[END_REF] proposed, instead of PeEn, a new baseline model called the complete-history PeEn (CH-PeEn) model that gives a nearly constant CRPS.

Our approach that consists in using the uncertainty component of the score (that corresponds to the score of the global climatology) is only sensitive to the observations variability and therefore, for a given location and temporal resolution of the data, does not depend on any other kind of parameters.

Sharpness evaluation

This indicator can be understood as the ability of a probabilistic forecast to get closer to a deterministic forecast in the sense that most of the probable outcomes lie well concentrated around a central value. Smaller values of sharpness would decrease the uncertainty of a deterministic forecast issued from a probabilistic forecast, which is useful as long as the outcome is also reliable. Sharpness of the predictive distributions is given by the mean size of the 80% central prediction interval denoted by δ . For an evaluation set of N forecasts, δ is given by:

δ = 1 N N ∑ i=1
( qτ=0.9 -qτ=0.1 ) .

(3.12)

3.4 The Analog Ensemble method retrieval

The Analogs method principle

The workflow principle of the AnEn is shown in figure 3.2, and it lies on the availability of two data-sets with historical data of ground measurements and forecasts (in our case from numerical weather predictions). When a new forecast is available, it is compared with the forecasts database and a certain number of past "similar" forecasts are chosen. The corresponding ground measurements to those "similar" forecasts are then used to build the predictive PDF/CDF. The dispersion (sharpness) of this ensemble of points contains Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles information about the uncertainty of the deterministic forecast. The AnEn works under the premise that past predictions that are very similar to a given forecast (in terms of meteorological conditions), should also exhibit very similar errors. This allows to make the pertinent corrections to the current forecast, based on the past errors found in the database. [START_REF] Kammen | Sirta, a ground-based atmospheric observatory for cloud and aerosol research[END_REF] for the years 2016 to 2018, with the same time resolution. For this work we considered the forecasts released every 12 hours, at noon (whose target day is the next day D+1) and at midnight (whose target day is the same day D). In other words, for a given day we take the forecast run at noon of the day before (hereafter, referred to D+1) and the midnight run (D) of the same day. We use the sub-index p1 and p2 for the AROME forecasts in figure 3.3 to refer to the two closest grid points to the case study location. Clear-sky GHI estimations were computed using the empirical model proposed by [START_REF] Badosa | Day-ahead probabilistic forecast of solar irradiance: A stochastic[END_REF]. Then the CSI is computed as a ratio between the current GHI (forecasted or measured) and the clear-sky GHI value. The database is split in two periods: 2016-2017 correspond to the historical database used by the AnEn to find the analogs; and the year 2018 is used as the test period over which all the performance indicators are computed. The comparison between the current and past forecasts is made using CSI so that similarity is evaluated only in terms of cloud effects.

Predictors selection

In order to estimate the relevance of the different inputs (predictors) available and to estimate their degree of correlation with the desired output (measured GHI), the RReliefF algorithm is used [START_REF] Kononenko | Relieff for estimation and discretization of attributes in classification, regression, and ilp problems[END_REF][START_REF] Robnik-Sikonja | An adaptation of relief for attribute estimation in regression[END_REF]. This is a feature selection algorithm based on the original relieF algorithm [START_REF] Kira | A practical approach to feature selection[END_REF][START_REF] Park | Extended relief algorithms in instance-based feature filtering[END_REF] that is adapted for regression problems. The scoring procedure of this method is based on the identification of feature value differences between nearest neighbors instance pairs, but instead of requiring the exact knowledge of whether two instances belong to the same class or not (like in the original relief algorithm), they work with a kind of probability that the predicted values of two instances (samples) are different. With the version of this algorithm that is implemented in Matlab ® , weights are assigned to each predictor. In this work, in addition to GHI, also the air temperature (T2) and the air relative humidity (RH) are also considered based on its correlation with the measured GHI and their seasonal and day-type signature. The weights assigned to the different predictor variables available are shown in figure 3.3. After the first sweep of the RReliefF algorithm with all the predictor variables available (GHI, RH and T2) the forecasting model ARPEGE-D is showing overall the highest correlation in GHI, which is the most relevant predictor variable, followed by air temperature (T2) and relative humidity (RH). Therefore, ARPEGE-D is chosen as the forecasting model to be used in the rest of the study. Then, a second sweep of the RRelieff algorithm is performed taking only the forecasts from ARPEGE-D and the final weights are found, namely 0.415, 0.322 and 0.263 corresponding to GHI, T2 and RH, respectively. These weights are used in the similarity criteria score given by equation 3.

Similarity criteria for analog selection

A variation of the score proposed in [START_REF] Delle Monache | Kalman filter and analog schemes to postprocess numerical weather predictions[END_REF], given in Eq. 3.13, is used as the similarity criteria to rank the historical forecasts on the database. The algorithm chooses hours in the data base, that are similar to the hour of the forecast day that is being analyzed, in terms of absolute value and temporal trend. From each day in the database, only the hour with the most similar Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles SZA is compared with the current forecast hour. In this way, the computation time is highly reduced as only one hour per day of the database is retrieved. Besides, this serves as a pre-similarity screening as it assures that only equivalent hours in terms of solar position are being compared, regardless of differences in the solar trajectory due to the intrinsic annual variability. In order to do this, a time window of t±w is used to evaluate the similarity of the current hour; where t is the current hour and w is the number of hours before-and-after t that will conform the time window. The idea is to find past forecasts that were predicting similar (punctual) values but also similar temporal trends for the forecasted quantity. In this case, the parameters to be optimized are the time window t w and the number of samples that conform the ensembles. The score is given by:

∥F t , A t ′ ∥ = N v ∑ i=1 W i σ f i t+w ∑ j=t-w (F i,t+ j -A i,t ′ + j ) 2 (3.13)
where ∥F t , A t ′ ∥ is the euclidean length (i.e. similarity score) between the forecast for time t and the analog forecast at time t' in the database, W i is the weight of the i th variable, N v is the number of variables, σ f i is the standard deviation of the time series of past forecasts of a given variable i, F i,t+ j is the forecast of the i th variable at time t+j, A i,t ′ + j is an analog forecast sample of the i th variable at time t'+j and w is the number of hours before and after the target hour that conform the time window, which has a lenght of 2w+1. Based on the work of S. Alessandrini and L. Monache [START_REF] Alessandrini | An analog ensemble for short-term probabilistic solar power forecast[END_REF] [START_REF] Delle Monache | Probabilistic weather prediction with an analog ensemble[END_REF] where they perform a sensitivity analysis for different parameters of the AnEn method, w=1 producing a time window of 3 hours is chosen for the rest of this study as it showed the best results. The sensitivity of the number of members is performed in section 3.6.1.

Benchmark methods

61

3.5 Benchmark methods

Climatology and persistence

Global climatology (GlCl) and persistence ensembles (PeEn) are typical reference methods used in meteorology to evaluate the performance of forecasting algorithms or to generate basic forecasts [START_REF] Stanski | Survey of common verification methods in meteorology[END_REF][START_REF] Kavasseri | Day-ahead wind speed forecasting using f-arima models[END_REF]. The GlCl method produces a forecast of the long term average weather, and requires a knowledge of the history of the weather. The idea is that for a given forecast hour, all the past observations available for the same site and hour are taken to create an ensemble of points where any value of the studied variable should fall in, if the database of past observations is representative enough. On the other hand, the persistence forecasting works under the premise that the average value of a variable for the next time step is simply equal to the average value of the same variable for the current time step (i.e. GHI value at hour h + 1 is supposed to be equal to its value at hour h). A variation can be applied to produce ensemble-type forecasts, where instead of only taking into account the immediate past time step, several past samples from a time series are taken to produce an ensemble of points. In our case, for a given hour h, the values of the same hour for the past n days, are taken to generate the persistence ensemble, where n is the same number of samples used in the AnEn method. Once an ensemble is produced, a deterministic or probabilistic forecast can be issued to serve as a reference to evaluate the performance of other forecasting methods.

Monthly Climatology

A variation of the global climatology, the monthly climatology (MoCl) model, is developed to obtain uncertainty estimations of the deterministic forecasts of GHI given by ARPEGE. This method has the advantage of taking into account the seasonal changes, hence improving the resolution with respect to the GlCl. A MoCl ensemble is obtained for every hour of the day (daytime only), of every day of a given month, that is available in the database. Here, the same database utilized for the AnEn is used, but split per months. It means that from the two-years database, one climatology ensemble is built for every month of the year. Given that there are two years of training data, there is approximately 60 members for every hour of the day (i.e. there are approximately 60 points in the data base that correspond to the same hour of the same month), that are used to build up the monthly ensemble. All the methods previously discussed are tested for the same one-year test-period data and compared with the GHI ground measurements to evaluate their performance, in the same way as for the AnEn.

Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles

ECMWF ensembles

ECMWF produces commercially available ensembles forecast for different meteorological variables. Accepting the findings from chaos theory about the sensitivity of the prediction to uncertainties in the initial conditions, they run in parallel a set, or ensemble, of predictions from different but similar initial conditions. The ECMWF Ensemble Prediction System (EPS) provides a practical tool for estimating how these small differences could affect the forecast. The ECMWF weather prediction model is run 51 times from slightly different initial conditions and produces an ensemble of points with a 3h time resolution. To take into account the effect of uncertainties in the model formulation, each forecast is made using slightly different model equations. The 51 scenarios can be combined into an average forecast (the ensemble-mean) or into a small number of alternative forecasts (the clusters), or they can be used to compute probabilities of possible future weather events [START_REF]European centre for medium range weather forecasts. Ensemble prediction introduction to chaos, predictability and ensemble forecasts[END_REF].

Raw ensemble forecasts are of great help for probabilistic forecasting, but they are known to be unreliable and in general underdispersive ( [START_REF] Vannitsem | Statistical Postprocessing of Ensemble Forecasts[END_REF]). This is why post-processing is needed to improve the quality of forecasting and especially reliability. Here the Non-homogeneous gaussian regression ("NGR") scheme has been chosen, as it is a very common and widely used post-processing model (see for example [START_REF] Gneiting | Calibrated probabilistic forecasting using ensemble model output statistics and minimum crps estimation[END_REF] for an introduction of NGR model or [START_REF] Gal La Salle | Added-value of ensemble prediction system on the quality of solarirradiance probabilistic forecasts[END_REF] for a comparison with other statistical calibration models). The NGR is a parametric model which creates a normal probability density function defined by:

N (a + M ∑ k=1 (b k X k ), c + dV 2 ) (3.14)
where M is the number of members in the ensemble, a, b 1...M ,c and d are parameters to be set from the training period, and V 2 is the variance of the ensemble. In this study, the parameters have been defined by minimizing the CRPS value over the training period.

Results

Performance of the AnEn regarding the number of members

Whereas for a classical ensemble prediction system (EPS), adding a member can be problematic because the calculation cost increases, in the case of analog ensemble, it is possible to choose the optimal number of members of the ensemble to increase the skills of the forecasting model, without having any extra "cost" in terms of computation time. Here a study has been conducted for the determination of the best number of members, according to the quality of the final forecast.

Results

63

Nine different AnEn forecasts have been produced independently corresponding to 10 to 90 members. Intuitively the optimal number of members should depend on the size of the training database, so this work has been done in two different cases with different length of the training period to take in consideration the impact of the size of the training database on the optimal number of members: For each case, the skill scores of the different forecasts have been calculated, and this calculation has been done for two quantiles with probability levels: τ = 0.1 and τ = 0.9. The results of QSS, reliability and resolution are shown on figure 3.4.

From the QSS values, it is seen that the AnEn has better skills than the GlCl being the spread of QSS values bigger for τ = 0.1 than for τ = 0.9, as values range between 0.36-0.44 for all cases for τ = 0.1 and between 0.55-0.58 for τ = 0.9. As expected, using a larger training database leads to a better forecast skills. Indeed, for every number of members, the skill score is higher for 2 years of training. These results also show that the score for the quantile τ = 0.1 is more sensitive to the number of members than for τ = 0.9. An optimal number of members is found around 50-60, for which QSS is generally maximized (with exception of τ = 0, 9 and one year database, where it starts decreasing around 30 members). Beyond this optimal number, the skill score decreases at a rate which depends on the length of the training period. This rate is higher for case 1 (1 year training database) with respect to case 2 (2 years training database). To explain why adding more members decreases the quality of the forecast, it is necessary to study the decomposition of the score. Notice that the uncertainty term is not discussed here as it only depends on the climatology. On the contrary the results of reliability terms and resolution term are studied below.

The reliability is similar for cases 1 and 2 but most of the time better for case 2. Above all, the reliability continues to increase when increasing the number of members for case 2, as shown in figure 3.4. However, this does not explain why the global performance decrease for large numbers of members.

As the resolution terms of the decomposition tends to decrease as the number of members increase, this explains why the global performance decreases for large numbers of members. Moreover, the resolution decreases more quickly for case 1 for τ = 0.9, and it explains the slope difference of skill score for cases 1 and 2. A less contrast is observed for τ = 0.1 (figure 3.4(e)), which makes case 1 and case 2 be also more similar in terms of QSS (figure 3.4(a)). Adding more members can be thought as building a forecast closer from climatology in a way

65

that if the number of members was equal to the length of the training period, the resolution would be 0 W /m 2 .

Ensembles dispersion analysis and interpretation

At the view of the results of the previous section, the AnEn is hereafter constructed with 60 members and a training period of 2 years. The obtained ensembles are meant to contain information about the uncertainty of the deterministic forecast for which the ensembles are created. It is then thought that the dispersion of the points (also called sharpness), is directly linked to the degree of uncertainty of the deterministic forecast; ensembles whose points are very spread out from each other would correspond to a deterministic forecast that is very uncertain, and vice-versa. An example of this is presented in figure 3

67

a compromise between leaving out the outliers and well capture the uncertainty, which is reflected in how narrow or broad this envelope is. An illustration of this for all considered methods for day 03-08-2018 can be seen in figure 3.6, where the envelopes for ensembles obtained with different methods are plotted, and the differences in the spread of the envelopes can be clearly observed. This suggests a different skill of each method to distinguish between forecasts with different degrees of uncertainty. In this example day, the envelopes generated with the AnEn method show the narrowest resolution, giving a more accurate idea of the possible values that the solar irradiance can have during this day (which ended up being a clear-sky day as shown by its higher CSI value). This relationship between uncertainty (through normalised sharpness) and accuracy (through the forecast error of the mean of the ensembles) is shown in Fig 3 .7 for the case of the AnEn method. A clear trend of larger errors for larger normalised sharpness values (that is, larger spread of the ensembles) is seen in general.

Forecasts comparison

In order to have an objective measure of this Analog Ensemble forecasting, a comprehensive comparison between AnEn and other forecasts has been conducted. The three selected forecasts are the PeEn forecast, the MoCl and the ECMWF-EPS (see section 3.4). ensembles

The comparison with ECMWF ensemble forecast has to be made separately, because the timestep of ECMWF ensemble forecast is 3 hours, which is different from other forecasts. In a first step, we propose a comparison between AnEn, MoCl and PeEn. For each forecast, the quantile skill score of quantiles with probability levels τ = 0.1 and τ = 0.9 has been computed, and the comprehensive decomposition of the obtained scores has been obtained. The results are shown in Table 3 The results of the MoCl justify the choice of splitting the climatology data by month and by hours. This really simple idea brings a large improvement in the result, it maintains the level of reliability, but increases the resolution. The PeEn method has a strong problem of reliability. The results show that the AnEn has the best results, combining the best resolution and the good reliability of the MoCl. Sharpness is another indicator that has been used to compare the different methods.

The results of the hourly values of sharpness of the AnEn, MoCl and PeEn are shown in figure 3.8. In this figure, a common tendency that relates sharpness and solar irradiance is noted (i.e. sharpness values follow approximately a tendency that resembles the daily solar at 13h00, when this indicator presents its highest values. However, it must be recalled that having a good performance on this indicator is beneficial only if the forecasting method (e.g. the AnEn) proves to be also reliable. In figure 3.9 the normalized sharpness (normalized with respect to the ensemble mean) for the PeEn, MoCl and AnEn is shown as a function of the CSI and the rMAE of the ARPEGE-D deterministic forecast. In the case of PeEn (left plot), the normalized sharpness does not show clear correlation neither with the CSI nor with the rMAE, as the dispersion of the data suggests. This confirms that the this method is not able to discern between days with different degrees of forecast uncertainty (i.e. easier/difficult days to forecast). On the other hand, the rMAE seems to be correlated only with the CSI, where the smallest values of rMAE correspond to the highest values of CSI (rMAE less than 0.1 for CSI values above 0.8). This correspond to mostly to clear sky days.

Sharpness dependence on day type

The same applies for the plot of the MoCl (center plot), where a similar correlation between rMAE and CSI is observed. For the MoCl there is not clear correlation either between the normalized sharpness and the CSI or the rMAE. The "discrete" shape of the plot (i.e. horizontal lines), is due to the way the MoCl ensembles are built. There is one ensemble for each month of the year (as explained in section 3.5.2), hence the existence of 12 -discrete-sharpness values. On the contrary, the AnEn (right plot) is the only method where a correlation between the normalized sharpness and the CSI, as well as the rMAE is observed. This means that the method is able to differentiate, to some extent, between forecasts with different degrees of uncertainty. However, it is interesting to note that the correlation can be seen only for values of CSI higher than 0.4. For smaller values, the normalized sharpness is not able to discern between different uncertainty conditions. There is almost a linear correlation between the normalized sharpness and CSI (for CSI values greater than 0.4), and three different sections regarding rMAE can be identified. Sharpness values lower than 0.6 present the lowest rMAE, sharpness values between 0.6 and 1.1 present intermediate rMAE values and for sharpness values above 1.1 the biggest values of rMAE are found. This is also evident in figure 3.7. Therefore, the superior resolution of the AnEn (ability to differentiate between weather conditions that lead to forecasts with different degrees of uncertainty) with respect to the reference methods (PeEn and MoCl) is clearly stated in figure 3.9.

Comparison with calibrated ECMWF ensemble prediction system

The same comparison has then been conducted with the ECMWF-EPS forecasts (postprocessed through the NGR model), hereafter called NGR. An extra step has been necessary, as the temporal resolution of ECMWF ensemble forecast is 3 hours, when the resolution of AnEn forecast is 1 hour. Thus the AnEn forecast has been recomputed with a temporal resolution of 3 hours. The results of AnEn and NGR for the quantiles 0.1 and 0.9 are presented respectively in table 3.3. The table shows better scores for AnEn method for all indicators, which might seem surprising given the fact that the NGR calibration model is generally a proven good postprocessing model ( [START_REF] Vannitsem | Statistical Postprocessing of Ensemble Forecasts[END_REF]). It is important to remark that the change in the time resolution (i.e. from 1h to 3h), changes the scores of the AnEn (i.e. reliability and resolution), as confirmed when comparing these two indicators in tables 3.2 and 3.3.

Results

71

A common way to confirm the superior performance obtained according to the QS and CRPS, is to compare the forecasting errors (measured by the rMAE) issued from deterministic forecasts inferred from the mean of each distribution. Even though it is not itself a proper score, it relies on the fact that a forecasting method that is more reliable and presents a better resolution, would produce more accurate deterministic forecasts. Indeed, the rMAE of the mean value of AnEn is 0.20 when the rMAE of the mean value of the NGR model is 0.28. This confirms the difference in the scores seen on table 3.3. As explained in 3.4.3 and 3.6.1, the mean value of NGR distribution is calculated from the mean of EPS forecast of day D-1, while the mean of Analog Ensemble forecast is driven by ARPEGE-D forecast. The importance of having a reliable predictor of the mean of the distribution is crucial. In the light of these results, it is certain that the process of choice of the best predictor has a great importance and it is one of the main reasons of the superiority of AnEn against NGR.

Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles

An article containing the main findings of this chapter has been submitted to the Renewable Energy Journal and it is currently under review.

Conclusions

A new Analog Ensemble Method (AnEn) for day-ahead probabilistic forecast of global horizontal irradiance is presented and discussed. During the set up of the AnEn, it is found that the best performance of the analogs method is obtained with approximately 60 analogs and when the three predictor variables (GHI, RH, T2) are used. However the variable that showed to have the biggest correlation and the biggest impact on the GHI forecasting performance is the GHI itself, with a correlation weight of 41,5% followed by temperature with 32.2% and relative humidity with a 26,3%. The deterministic forecast used to generate the ensembles (i.e ARPEGE vs EPS-D1) is an important aspect to obtain a good performance of the AnEn. The AnEn seems to be more sensible than reference methods such as GlCl and PeEn, in detecting different uncertainty conditions, in other words, has a better resolution. Moreover, the spread of the members (that is the sharpness indicator) is a good indicator of the expected forecast error and it shows clear dependence on day-type for the case of AnEn. Hence, it can be concluded that the analog ensembles method is able to estimate to some extent the degree of uncertainty of a deterministic solar irradiance forecast from the ARGEPE NWP model of MeteoFrance, and sharpness has shown to be a good (deterministic) indicator of such uncertainty. MoCl presents an improvement in resolution with respect to GlCl of more than 54% according to the CRPS, proving to be a not-so-naive and easy-to-implement reference method that can be useful when evaluating the performance of novel forecasting methods of solar GHI. In the AnEn, using the SZA to search for a single-similar-SZA point per day, results in a decrease of more than 80% in computational time. For this case study, AnEn has proven to produce uncertainty estimation with much less computational burdens and better performance than the commercial probabilistic forecasting algorithms from ECMWF. Even when AnEn rely on the availability of deterministic forecasts obtained from NWP, the computational time of the latter is less than that required to generate the ECMWF ensembles. In addition, it has been shown that AnEn outperforms a modeloutput-statistics-corrected version of the raw ECMWF-EPS. Besides, the computational time required by the AnEn is not dependent on the number of members chosen to build the ensemble of analogs, which gives the method a great flexibility for choosing the desired (optimal) number of members, for a particular case study. Overall, the AnEn showed superiority in performance according to the QSS and CRPS 3.8 Future perspectives 73 with respect to all the benchmark methods hereby presented for the particular case study. According to the QSS indicator, AnEn performs near 21% better for τ=0.1 and near 54% better for τ=0.9 with respect to PeEn. With respect to MoCl, the AnEn improvement in performance is around 63% for τ=0.1 and 17% for τ=0.9. Regarding CRPS, AnEn performs more than 34% better than both, PeEn and MoCl. When compared to NGR forecasts, AnEn performs more than 34% better for both quantiles (τ=0.1 and τ=0.9) according to the QS and more than 31% better according to the CRPS indicator. All these good reliability, resolution and sharpness indicators, backup the AnEn as a viable method to be used either for uncertainty estimation of a deterministic forecast or for probabilistic forecasting of solar GHI. Quantile forecasts present an interesting feature which is the capability to decouple the magnitude and bias of their forecasting error. Therefore, depending on the chosen quantile, one can have different degrees of certainty on each component (e.g. one can have more certainty regarding the sign of the bias), which gives this method of forecasting an interesting added value, that might be useful in the energy management system of a microgrid.

Future perspectives

A similar approach of the AnEn used in this study could be extended to other geographical locations to see if the results can be extrapolated to different study cases. The utilization of the AnEn method to forecast the PV power output directly, could be also interesting to explore, in order to bypass the conversion uncertainties due to the PV panels and the controller/inverter. Otherwise, the solar GHI must be converted to actual PV output power, as there are losses in the transit through the solar panels (mainly due to temperature and soiling) and the inverter/controller (due to the efficiency of the device). There are also joule losses due to the resistance of the electric conductors, among others. So a proper model should be found so that the results from this work can be translated to PV output power of a PV+Battery microgrid, as this is the input required to perform its energy management and resource scheduling tasks. Another possibility that could be explored is to use the AnEn to derive uncertainty information of the electric consumption as well. In this way, the energy management system of a microgrid could be fed with the uncertainty of the net load (load -variable renewables production) which is the case in a real system. This would account for the two main sources of uncertainty in a microgrid, the IRES and the electric consumption. Eventually this could permit to make better allocation of resources during planning. In order to achieve this, a fair Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles way to add the uncertainty from production and consumption sides should be found. The envisaged use of the results of this work is to incorporate the information about uncertainty of GHI forecast into the EMS of a microgrid that performs day-ahead optimal scheduling. This with the aim to determine to what extent this can improve the performance of a small-scale microgrid in terms of different performance indicators such as self-consumption, CO 2 emissions and operation costs, among others. Given the fact that the analogs ensembles method is able to estimate uncertainty of a deterministic forecast to some extent, a practical yet useful/meaningful way to include this information in the decision-making and/or optimization process of the energy management system must be found.

Chapter 4

Forecasts and energy management in a microgrid: Impact on services provided by a smart building

Introduction

The energy management of MGs is still an open research topic, and the variety of approaches is extensive [START_REF] Fahad | Microgrids energy management systems: A critical review on methods, solutions, and prospects[END_REF][START_REF] Luis | A Review of Optimal Control Techniques Applied to the Energy Management and Control of Microgrids[END_REF]. Regarding grid-connected MGs, several approaches have been studied and proposed by several authors for their EMS. In the review performed by basu et al. [START_REF] Kumar Basu | Microgrids: Energy management by strategic deployment of DERs-A comprehensive survey[END_REF], they highlight the importance of strategic deployment of the distributed energy resources (DERs) as the base-ground to a successful EMS strategy. If any benefit from a MG wants to be obtained, a proper technology selection and sizing of DERs, for the particular site of deployment, has to be performed. Without this important first-step properly done, is not certain that an EMS can bring benefits for the users of a MG with respect to a scenario without DERs and/or a MG. However, there is no recipe to assure neither an optimal choice of DERs technology nor to perform their sizing. It depends on many factors, having at its core the purpose of the installation and client needs. This suggests that there is always a chance that an EMS will have to deal with a non-optimally designed MG. The International Electro-technical Commission in the standard IEC 61970, related to Energy Management System application program interface in power systems management, defines an EMS as: "a computer system comprising a software platform providing basic support services and a set of applications providing the functionality needed for the effective operation of electrical generation and transmission facilities so as to assure adequate security of energy supply at minimum cost" [START_REF]Energy management system application program interface (EMS-API)[END_REF]. A typical EMS of a MG usually consists of: modules to perform decision making Forecasts and energy management in a microgrid: Impact on services provided by a smart building strategies, modules of DERs/load forecasting, human machine interfaces, supervisory control and data acquisition, among others. The techniques commonly used to perform EMS vary from case to case, and as mentioned by [START_REF] Fahad | Microgrids energy management systems: A critical review on methods, solutions, and prospects[END_REF], the supervisory control architecture of an EMS can be divided into two types, namely, centralized and decentralized. A decentralized EMS architecture has a central controller that sends and receives all the information to DERs in real-time. Each DER, having its own controller, proposes and "bargains" current and future demand or generation requests with the central controller until the global and local objectives are achieved. In this work we focus on a centralized control type. In a centralized EMS approach, the central controller gathers all the information such as power generation of DERs, cost-function, meteorological data, and energy consumption, etc. Then, the centralized EMS determines the optimal power/energy scheduling of DERs, according to a specific objective set by the user. Finally, the central controller sends these decisions to all the DERs controllers, that will follow these directions without any "questioning". At the core of a centralized EMS we find the working objective(s). It is related to a given service that the system is required to assure and/or optimize. A service provided by a MG could be defined as any action performed by the system that will improve to some extent the well-being (in the broadest sense of the word) of the users. In order to achieve the working objective, two main branches can be identified: Optimization-Based (OB-EMS) and Rule-Based (RB-EMS) methods [START_REF] Herath | Comparison of Optimization-and Rule-Based EMS for Domestic PV-Battery Installation with Time-Varying Local SoC Limits[END_REF]. The latter can assure attaining the working objective but cannot guarantee an optimal performance, whereas the former can achieve optimal or quasi-optimal performance for a given service. The optimization can be done using several algorithms, as mentioned by [START_REF] Fahad | Microgrids energy management systems: A critical review on methods, solutions, and prospects[END_REF][START_REF] Ahmad Khan | A compendium of optimization objectives, constraints, tools and algorithms for energy management in microgrids[END_REF]. We can find linear and nonlinear programming methods, dynamic and stochastic programming, meta-heuristic approaches and also machine learning/artificial intelligence techniques.

Due to its nature, a RB-EMS is normally meant to react to real-time conditions applying the rules it has been programmed with, in order to assure the proper balance between production and consumption. Rules can be conceived to favor a particular service as a secondary objective. Under this working scheme, this system does not perform time-ahead scheduling, hence does not require forecasts to work. However, if a forecast is given, this approach could also issue a time-ahead scheduling. On the other hand, an OB-EMS normally requires a forecast (at least of production and consumption), to be able to issue an optimal action to be followed. The optimization horizon can vary from seconds or minutes (intrahour) to hours (inter-hour) or days (day-ahead). For intra-day optimization, the time horizon can be fixed or receding (i.e. it gets shorter as the day passes). This is the case presented by [START_REF] Jorn | Two-stage Optimization for Building Energy Management[END_REF], where they proposed a two-stage EMS for a MG serving a building. Each stage has a different time horizon, the first being day-ahead, and the second, one-hour-ahead, and it uses a receding horizon. Each stage has different optimization objectives, and the results of the first stage are used as constraints for the second stage. The optimization objectives can vary a lot, but as pointed out by Ahmad et al. [START_REF] Ahmad Khan | A compendium of optimization objectives, constraints, tools and algorithms for energy management in microgrids[END_REF], some of the most common are: carbon emissions, capital and operational costs, energy storage cost and load shedding costs, among others.

Scheduling and unit commitment approaches

At utility scale, it is known that power producers that participate in the energy market, are asked by the Transmission System Operator (TSO) to issue in advance (usually dayahead) their expected power output for the upcoming day [START_REF]Understanding electricity markets[END_REF][START_REF] Smith | Regulation (EC) No 764/2008 of the European Parliament and of the Council[END_REF]. If they do not fulfill their projected production they are penalized correspondingly to their deviation from the committed bids. This is done by the TSO in order to reduce the uncertainty in the production side, so that it can plan and perform their "optimal" Unit Commitment (UC) at regional or national level for the next day. Unit commitment is the coordination of the production of a set of electrical generators in order to achieve some common target, usually match the energy demand at minimum cost.

When production comes from intermittent renewables, the uncertainty can be very high due to their intrinsic stochastic nature linked to the weather conditions. The less uncertainty from the producers, the better the TSO can perform the UC and hence, reduce costs and pollution while assuring reliable and high-quality energy. The problem of uncertainty related to IRES and MGs, in the distribution network, has been recognized [START_REF] Khodaei | Microgrid Planning Under Uncertainty[END_REF] and efforts are being done in order to deal with it. For instance, Gholami et al. [START_REF] Gholami | Microgrid Scheduling With Uncertainty: The Quest for Resilience[END_REF] develop a mathematical model for the optimal scheduling of MGs incorporating proper representations of prevailing uncertainties. Alternatively, Majzoobi et al. [START_REF] Majzoobi | Application of Microgrids in Supporting Distribution Grid Flexibility[END_REF] have proposed a flexibility-oriented microgrid optimal scheduling model, to coordinate the MG net load with the aggregated consumers/prosumers net load in the distribution network, with a focus on ramping issues (i.e. sudden increments of power). In their work, they start posing the question of how a MG can offer ancillary services to the utility grid, for which, the management of uncertainty is very important. Their results showed that the grid operator can efficiently leverage the flexibility of existing MGs in distribution networks to address some of the most pressing flexibility-associated challenges, while removing the need for costly investments in the generation and distribution facilities.

Other authors like Deckmyn et al. [START_REF] Deckmyn | Day-ahead unit commitment model for microgrids[END_REF], have proposed a model that aims to schedule the power among different MG units while minimising the operating costs together with the CO 2 emissions produced. The model involves the simultaneous optimisation of the fuel costs and the CO 2 emissions of the local thermal generators. The MGs are able to work in Forecasts and energy management in a microgrid: Impact on services provided by a smart building both grid-connected or islanded modes, and they scheduled the power exchange with the grid, taking into account the local power generation profiles, market conditions and possible congestion in the distribution grid, in order to further minimise the MG operating costs. They found that the environmental optimisation without congestion management results in a reduction of 11.4% in CO 2 emissions and an increase of 46.5% in microgrid operating costs, whereas purely economic UC without congestion management results in a reduction of 34.7% in MG operating costs and an increase of 48.8% in CO 2 emissions. In the same line, authors like Ferruzzi [START_REF] Ferruzzi | Optimal bidding in a Day-Ahead energy market for Micro Grid under uncertainty in renewable energy production[END_REF] have tackle a similar problem of day-ahead optimal bidding taking into account the uncertainty of IRES in low-voltage grid-connected residential MGs. Their approach proposes a prosumer which aggregates the capacity of different components (DERs) and buys or sells, for each hour, power from/to the grid. One of the main contributions of this paper claimed by the authors is the use of uncertainty evaluation to make decisions using an Analogs Ensembles (AnEn) method. They obtain the probability density function (PDF) out of the ensembles, in order to obtain the expected utility, which represents the average weighted utilities associated with each possible outcome probability, where each weight is determined by the respective outcome probability. In their work, the participation of the MG in the ancillary services market was not considered because it usually cannot satisfy the requirements of minimum power, according to the authors. However, they recognize that when there are more microgrid aggregations and consequently more prosumer aggregations, the MG participation in this market could be considered. The main focus of that work was to provide a risk bidding strategy for the day-ahead energy market to determine optimal economic choices for the management of a grid-connected residential MG.

In contrast with the above mentioned studies, at the core of the hereby proposed EMS strategy, we aim at providing one specific service for the TSO: grid-commitment. It consists in broadcasting to the TSO, one day-ahead, the hourly power-exchange profile that will be required by the MG, and engage (as far as possible) to follow it. However, this scheduled grid profile has been generated in a first stage of the EMS, with a different objective (i.e. energy cost reduction, CO 2 emissions reduction, grid-peak-power reduction). This means that, in a first stage, the MG is "selfish" and looks for its own benefit with the first optimization objective, but once it has generated the grid profile, the second stage of the EMS gives priority to the TSO, as the main beneficiary of the second objective, which is the grid-commitment. This proposal is explained with more details in section 4.5.

A scheduling strategy requires forecasts as an input, and different forecasting methods have been used in the field of energy management for MGs. Some studies directly consider solar generation predictions without considering weather forecasts, while others also receive the information from forecast services ( [START_REF] Li | Combined Two-Stage Stochastic Programming and Receding Horizon Control Strategy for Microgrid Energy Management Considering Uncertainty[END_REF][START_REF] Mazzola | Assessing the value of forecast-based dispatch in the operation of off-grid rural microgrids[END_REF]), or compute it from local power measurements by applying time-series forecasting techniques such as, auto-regressive [START_REF] Sachs | A two-stage model predictive control strategy for economic diesel-pv-battery island microgrid operation in rural areas[END_REF], persistence [START_REF] Parisio | An mpc-based energy management system for multiple residential microgrids[END_REF] or ANN [START_REF] Li | Combined Two-Stage Stochastic Programming and Receding Horizon Control Strategy for Microgrid Energy Management Considering Uncertainty[END_REF]. In all these cases, the weather conditions are implicit in the information, but no meteorological variable is directly considered. In other cases, the forecasts of PV power output are directly obtained from weather forecasts, by applying models to transform the meteorological data into output power estimations. These models can be based on real PV panels [START_REF] Liu | Bidding strategy for microgrid in day-ahead market based on hybrid stochastic robust optimization[END_REF] or theoretical equations of PV generation [START_REF] Bogaraj | Intelligent energy management control for independent microgrid[END_REF]. Overall, they assume that PV production is fundamentally dependent on irradiance and temperature. Some approaches compute solar irradiance from other parameters such as the clear sky index [START_REF] Olivares | Stochastic-predictive energy management system for isolated microgrids[END_REF], sky cover [START_REF] Dou | Multi-agent System Based Energy Management Strategies for Microgrid by using Renewable Energy Source and Load Forecasting[END_REF] or sky clearness [START_REF] Adinolfi | Advanced operational functionalities for a low voltage microgrid test site[END_REF], rather than forecasting it directly. The scheduling horizons of the forecasts vary from 72 hours to 15 minutes, depending on the EMS strategy used, however the 24-hour horizon is the most common. The time resolution of those forecasts vary from 3 hours to 15 minutes, being one hour the most common resolution [START_REF] Agüera-Pérez | Weather forecasts for microgrid energy management: Review, discussion and recommendations[END_REF].

Regarding the uncertainty, normal distribution is the most frequent option to describe these errors. Some adjustments based on the expectation and the standard deviation are commonly referenced, but they lack of numerical values (e.g. [START_REF] Olivares | Stochastic-predictive energy management system for isolated microgrids[END_REF]). Other studies assume that forecast errors are well described by a uniform distribution. Sechilariu et al. modelled solar generation forecasts by considering a random error of 10% during a 24h-ahead forecasting period [START_REF] Sechilariu | Supervision control for optimal energy cost management in DC microgrid: Design and simulation[END_REF]. In other approaches, a linear increase with the forecasting horizon as well as different levels of prediction errors are assumed [START_REF] Zhang | Model predictive control-based operation management for a residential microgrid with considering forecast uncertainties and demand response strategies[END_REF]. In their study, for a maximum horizon of 24h-ahead, the error was assumed to be 6% for the lowest level and 30% for the highest one. Similar considerations were accounted in [START_REF] Zhang | An Intelligent Control Strategy of Battery Energy Storage System for Microgrid Energy Management under Forecast Uncertainties[END_REF], but in this case, a range of 8-24% was associated with the 24h-ahead errors. Other methods such as the beta distribution and Monte Carlo method, are used to simulate scenarios of solar generation, as in [START_REF] Wang | Self-healing resilient distribution systems based on sectionalization into microgrids[END_REF]. Maximum error bounds are proposed by Mohan et al. assuming a constant value of 20% for a 24h-ahead period [START_REF] Vivek Mohan | An efficient two stage stochastic optimal energy and reserve management in a microgrid[END_REF], and by Li et al., by assuming constant bounds of 10% for the same scheduling horizon [START_REF] Li | Sizing of a stand-alone microgrid considering electric power, cooling/heating, hydrogen loads and hydrogen storage degradation[END_REF]. A different approach proposed by Shimomachi et al. divides solar forecasts in three categories (fine, cloudy and rainy) and the uncertainty is estimated according to the observed occurrence of these categories, when each of them is predicted [START_REF] Shimomachi | Development of energy management system for dc microgrid for office building:-day ahead operation scheduling considering weather scenarios[END_REF].

A thorough summary of the different forecasting techniques used for energy management of MGs, including scheduling horizons, time resolution, input variables as well as uncertainty models used, can be found in table 1 of the review performed by A. Aguera-Perez et al. [START_REF] Agüera-Pérez | Weather forecasts for microgrid energy management: Review, discussion and recommendations[END_REF].

Microgrids and energy management systems in smart-buildings

When an EMS is implemented in a building equipped with some DERs, it can bring along some degree of autonomy or "intelligence", allowing the building to make some decisions by itself, in order to optimize a given objective. The definition of smart-building (SB) is very Forecasts and energy management in a microgrid: Impact on services provided by a smart building wide, as it covers from the "architectural" conception and construction, to its capabilities to gather information and automatically respond to it. Buckman [START_REF] Buckman | What is a Smart Building? Smart and Sustainable Built Environment[END_REF] defines a smart-building as "a building which totally controls its own environment" which does not suggest user interaction at all. Of course, achieving this "full intelligence" is far from realistic, as nowadays it is usually the case that some interaction between users and the building is required for its operation. Wang et al. [START_REF] Wang | Integration of plugin hybrid electric vehicles into energy and comfort management for smart building[END_REF] mention that a smart-building "address both intelligence and sustainability issues by using computer and intelligent technologies, to achieve the optimal combinations of overall comfort level and energy consumption. They also utilize IRES to reduce the impact on natural environment".

In our case, this definition aligns better with the objectives of our case-study, where the implementation of a MG equipped with an EMS, targets both, the comfort of users and the environmental impact of the building, to some extent. In summary, at the view of the above definitions, a smart-building can be thought as an interactive unit that, besides its basic function of providing shelter to its occupants (i.e. the basic service it offers), it can also improve their well-being or comfort in a variety of areas. This task can be achieved by collecting and responding to data in an autonomous or semi-autonomous manner in order to fulfill an objective. Therefore, a building that is equipped with solar panels, energy storage and some capabilities to defer or control some loads has the potential to become a "smart-building", but without any central control or EMS, this objective will not be achieved on its own. In other words, including some DERs to a building is a necessary, but not a sufficient condition, to grant a better performance.

In this work, we propose some basic services for our study-case SB, based on the added value they provide to its users and other actors. We tackle the problem of proposing some EMS strategies targeted to provide those services. The services proposed are: grid-commitment, grid-peak-power, energy-cost and carbon-footprint. The definition of these services is explained in detail in section 4.5. For DERs and MGs, services like gridcommitment or grid-peak-power -introduced in the current work-are not common. This is mostly due to the scale and current penetration of MGs which is not significant respect to utility grids. But if we imagine a penetration scenario of IRES, that for 2050 could achieve more than 60% according to some studies [START_REF]Global renewables outlook: Energy transformation 2050[END_REF][START_REF] Tao | European roadmap for microgrids[END_REF] (being distributed generation a non-negligible percentage of it), the capacity to deliver those services could have an important added value, in terms of operational, economic and environmental benefits [START_REF] Hatziargyriou | Quantification of economic, environmental and operational benefits due to significant penetration of Microgrids in a typical LV and MV Greek network[END_REF][START_REF] Strbac | Microgrids: Enhancing the Resilience of the European Megagrid[END_REF]. Other scenario where, being able to offer a time-ahead power/energy scheduled profiles (e.g. the grid-commitment service hereby proposed), could give a significant added value to a MG, is the case when MGs are able to participate in the electricity markets. This is pointed out by [START_REF] Ferruzzi | Optimal bidding in a Day-Ahead energy market for Micro Grid under uncertainty in renewable energy production[END_REF], where they propose that a MG can offer not only base-load generation but also ancillary services. In 4.2 Objectives general, at the point where the aggregated power coming from MGs will have the potential to cause quality and stability problems to the utility/European grid, DERs uncertainty and variability would pass from being a matter of the MG owner only, to a larger-scale concern for the TSOs. So if we agree on the latter statement, making the uncertainty "invisible" to the TSO by dealing with it internally (within the electrical boundaries of the MG), would give distributed generation (based on IRES) a great competitive advantage with respect to their current standing point. That is the motivation and main objective of this work.

In section 4.2, a breakdown of the research questions and objectives searched in this chapter is presented, followed by section 4.3 that explains the use case and data utilized in the study. Section 4.5 explains the novel proposal of EMS to tackle the issue including an explanation of the methodology followed to validate its usefulness. Section 4.6 presents all the scenarios, results and analysis, that were performed in order to answer to the research questions. Finally, in section 4.7, a summary of the main conclusions is presented, as well as some possible pathways envisaged for further research on the subject.

Objectives

The main purpose of this work is to explore how a building, that has been equipped with PV panels, battery energy storage and a data acquisition system, can offer services like grid-commitment and grid-peak-power reduction (whose main beneficiary is the TSO), or other more common services such as energy cost or carbon footprint reduction, mainly meant to benefit building users. We want to explore if those services can be further enhanced by the implementation of a central control or EMS that takes into account the PV production forecasts. In relation with that, we want to analyze how the uncertainty of those forecasts can affect the performance of the building regarding the services it provides.

In order to answer that question, the statement can be broken down in several points that tackle each of the main queries associated to this general objective. They are summarized as follows:

1. What services could be provided by a smart-building and what would be the added value of providing those services? how could we measure the performance associated with those services?

2. After having chosen the services considered more pertinent for the purposes of this study, how would an EMS strategy look like, that could provide those services?

3. Once an EMS strategy has been proposed, what would be its impact in performance (related to the services being evaluated), with respect to the baseline case (no EMS)?

Forecasts and energy management in a microgrid: Impact on services provided by a smart building 4. Since deterministic forecasts (of photovoltaic production) are part of the proposed EMS strategy, how the accuracy of those forecasts can affect the performance of the EMS, regarding the services being evaluated? The analysis of the accuracy of the forecasts for the test period year is presented in Chapter 3

5. Can probabilistic forecasts help the EMS to obtain further improvements in performance? how? to what extent?

6. Since we are proposing an EMS strategy that can favor different services, how optimizing for one service affects the performance of the other services? Is it possible to find an EMS that yields a good compromise in performance for all services?

7. Given that a building is exposed to different conditions related to seasons (e.g. different weather conditions, production, pricing and consumption patterns), in what manner and to what extent it affects the performance of the proposed EMS and the final performance of the SB regarding the services under study?

The following sections are devoted to answer each of the aforementioned questions, by taking the Drahi-X future microgrid as the model for the simulations in order to evaluate and validate the proposals made throughout this work.

Use case description

Similarly to the previous chapters of this work, the study presented in this part is based on the study-case microgrid of the Drahi-X startup incubator, described in the general introduction (see chapter 1). This building is being equipped with a MG that is expected to be operational in the coming months, and that will allow the implementation and test of energy management strategies as well as the collection of data required for their validation. The simulations performed throughout this work are all performed based in data-sets of this study-case building and site, that were described in section 3.4.2 of Chapter 3. The expected PV output power of the Drahi-X building is obtained using the NWP (ARPEGE-D) GHI forecasts and ground measurements obtained for the study-case site. With this data, a factor is applied that matches the expected peak-power of the PV-array with the standard solar irradiance conditions (i.e. 1000W/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 assume such simplification for several reasons. First, It must be mentioned that at the moment of performing this study, the layout, tilting angle or type of PV panels that were going to be used in the Drahi-X microgrid was still unknown. Therefore, doing assumptions on these parameters would have lead to a non-realistic scenario anyways. Besides, one of the main objectives of this work is to study the effects of the uncertainty of the solar resource over a MG, therefore GHI was used in Chapter 3 as output variable. For consistency and to be able to compare and use the results of Chapter 3 in this chapter, GHI must be used as well. 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, that are out of the scope of this work. Last but not least important, it is well known that the factor that has the greater influence by far in photovoltaic production is the solar irradiance, therefore obtaining the PV power production by using a scale factor for the GHI was considered still meaningful for the purposes and scope of this study.

Persistence -deterministic-forecasts (PE) for PV power output are used as a naive benchmark forecasting method. The forecast is obtained by simply assuming that the average-hourly PV production profile for the day D+1 is the same as the real PV production profile of day D. Perfect -deterministic-forecasts (PF) are considered also as a benchmark forecasting method, and as its name suggests, it consists on assuming that the forecast of a given variable is actually the real (measured) value of that variable. This is used for PV power output, and represents the best possible forecast to compare against. Besides the NWP, PF and PE forecasts, the probabilistic forecasting approach called quantile forecasting, developed in Chapter 3, is used as a novel forecasting method in the domain of MG scheduling. The base for this forecasting strategy are the ensembles of analogs, that are obtained from a database of measurements and deterministic (i.e. NWP) forecasts of the desired variable [START_REF] Calderon-Obaldia | Uncertainty estimation for deterministic solar irradiance forecasts based on analogs ensembles[END_REF], as explained in Chapter 3. Once the ensembles are obtained (day-ahead) for each hour of the next day, different quantiles are obtained (from AnEn τ=0.1 to AnEn τ=0.9 ), that are used as deterministic forecasts. The idea of using this type of forecasting is to decrease the uncertainty of a deterministic forecast by "forcing" the bias of the forecasting errors to lean in a known direction.

The forecasting errors are made up of two parts: the magnitude and the bias, the latter being an indicator of the forecast being over or under estimative. By using quantile forecasting, we are able to know in average, the bias of the error, decreasing in this way its overall uncertainty. This extra information about the forecasting errors can be helpful for the EMS, as 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 better to use the opposite approach. This is considered 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 [START_REF] Li | Combined Two-Stage Stochastic Programming and Receding Horizon Control Strategy for Microgrid Energy Management Considering Uncertainty[END_REF], but it is usually demanding in terms of computational resources. Our forecasting approach, gives the EMS an interesting Forecasts and energy management in a microgrid: Impact on services provided by a smart building capability of adaptation to different climatic conditions as well as target services, in order to obtain the best performance possible in every situation, with very light computational requirements.

As mentioned in the description of the study-case in the introduction of this work, the data of electrical consumption is taken from zone 1 of the Drahi-X building for the test period. The data is formatted with a time resolution of one hour, meaning that we assume an hourly-average power consumption profile. Intra-hour power fluctuations are neither captured nor taken into account, meaning that we consider a constant power value of consumption for each hour of the day. The prices of the electricity are assumed those of EDF (Electricité de France) for the Tempo tariff [START_REF] Tempo | Grille tarifaire en 2020 et CGV[END_REF]. The prices vary according to three different types of days: blue, white and red. The color of the day is determined as the year progresses and is broadcast by EDF the day before around 12h00. Their pricing scheme is shown in figure 4.1. 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, meaning 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, is taken from the transmission system operator in France, RTE (Réseau de Transport d'Électricité) [START_REF]Eco2mix CO2[END_REF]. 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 was also averaged out to 1-hour time resolution. The annual distribution of the type of days according to the tempo tariff, as well as the grid electricity CO 2 content for the test period are depicted in figure 4.2. It is important to mention that in this work (as implemented by authors like Ferruzzi et al. [START_REF] Ferruzzi | Optimal bidding in a Day-Ahead energy market for Micro Grid under uncertainty in renewable energy production[END_REF]), the forecasts of electric consumption, prices and carbon footprint of the electricity from the utility grid, are always assumed perfect (i.e. the forecast values always matches the real values). 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. This allows us to study in depth and draw conclusions regarding the effects of its uncertainty in the performance of the SB services, by eliminating possible interference from the uncertainty brought by other stochastic variables. Even when this is not a realistic scenario, by understanding the effects of one stochastic variable (i.e. PV power production), we could comprehend some general mechanisms by which uncertainty can affect the performance of the SB, and this knowledge could be applied when integrating other stochastic variables into the game, such as the electrical consumption or the electricity prices.

In this study, a generator convention has been used, hence for any DER, positive values of power mean power being delivered by it, while negative values mean power being consumed by the DER.

Forecasts and energy management in a microgrid: Impact on services provided by a smart building

Services and performance indicators

According to the definitions presented in section 4.1, we can call services, to the objectiveoriented "actions" that a smart-building can perform (autonomously or semi-autonomously), with the help of a central control system or EMS. The type of services a SB can provide depends on the degree of automation or "intelligence" of the building and the type and amount of data that it is able to collect. In our study-case, based on the envisaged hardware capabilities of the Drahi-X building, we have chosen four services that are considered representative for the purposes of this study. The reduction in the cost of the energy consumed by the users of the MG/SB (EC) as well as its carbon footprint (CO2), are two of the services chosen, which are well known and commonly used as optimization objectives for EMS strategies, as shown in tables 3, 4 and 5 of the comprehensive review performed by ahmad et al. [START_REF] Ahmad Khan | A compendium of optimization objectives, constraints, tools and algorithms for energy management in microgrids[END_REF]. The other two services we propose, are not common for low-power MGs (they are not even mentioned in the cited review), which are: the day-ahead power commitment with the utility grid or grid-commitment (GC), and the reduction of the grid contracted power or grid-peak-power (GPP). Figure 4.3 presents a summary of the services being considered, as well as the main beneficiaries and their added value.

Service 1: Reduction in energy costs

The first service proposed, is the ability of the SB to provide electricity to its users at a competitive cost with respect to the utility grid. It is always at the top of the list when talking about optimization objectives for EMS in MGs (see [START_REF] Ahmad Khan | A compendium of optimization objectives, constraints, tools and algorithms for energy management in microgrids[END_REF]). Its added value can be thought as being able to offer electricity at a lesser cost than the utility grid. That would increase the "financial well-being" of the users of the building. The associated indicator that allows to quantify this service (i.e. its performance indicator), would be the average cost of electricity. This indicator is computed as shown in equation 4.1, its units are C/kW h and will be hereafter represented by the symbol EC.

EC = 1 E T load • H ∑ h=1 E h grid •C h grid + E h batt •C h batt + E h pv •C h pv (4.1)
where E T load represents the total energy consumed by the load during the test period, E h grid is the energy bought from the utility grid, E h batt is the energy delivered by the battery (battery discharging), E h pv stands for the PV output energy, while C h X represents the cost of the energy of the DER X, at the hour h. This cost can be either the nominal cost (see equation 4.4 for battery and equation 4.7 for PV), or a corrected cost (see equation 4.6 for battery and equation 4.9 for PV). The sum of the costs over the H hours of the test period divided by the total energy consumption yield the average cost of the energy consumed by the users of the MG. The cost of the energy coming from the grid C grid is considered known beforehand for every hour of the test period, and its values can be seen in figure 4.2.

Services and performance indicators

The nominal cost of the energy delivered by the battery C h batt , computed in equation 4.4, is adjusted using an adapted version of the approach proposed by Muenzen et al. [START_REF] Muenzel | A Multi-Factor Battery Cycle Life Prediction Methodology for Optimal Battery Management[END_REF]. They find an experimental model to estimate the full-cycle-equivalent cycling life (CL) of a Li-Ion battery, as a function of the average state-of-charge (SoC ave ) and depth-of-discharge (DoD ave ) of each charge-discharge cycle of the battery. In other words, they found an experimental equation to estimate how much the nominal cycling life of the battery is reduced due to the profile of use. With this reduction on battery life, the nominal cost of the energy coming from the battery is adjusted accordingly. The model to estimate CL is presented in equation 4.2.

CL(DoD ave , SoC

ave ) = q + u 2v (s + 100u) -200t • DoD ave +s • SoC ave + t • DoD 2 ave + u • DoD ave • SoC ave + v • SoC 2 ave (4.2)
where DoD ave is the average depth-of-discharge of all the charge-discharge cycles of the battery throughout the test period, while SoC ave is the average state-of-charge of the battery throughout the same test period. The values of the experimental coefficients of the model are presented in table 4.1. A maximum CL max ≈ 6468 cycles can be found for a DoD ave = 0% and a SoC ave ≈ 45%, which is just a theoretical maximum, as a DoD ave = 0 would imply not using the battery at all. Figure 4.4 suggests that, performing short (i.e. small DoD) charge/discharge cycles is more beneficial for the battery life, as well as staying around mid-range state-of-charge values.

The DoD ave is computed as the average change in the SoC of the discharging cycles of the battery, as presented in equation 4.3.

DoD ave = 1 H H ∑ h=1 SoC h -SoC h-1 (4.3)
where H is the number of discharging cycles during the test period, and SoC h is the state-ofcharge of the battery at hour h expressed as percentage of the nominal battery capacity. The SoC ave is computed simply as average state-of-charge of the battery during the test period, also expressed in percentage of the nominal capacity of the battery. The nominal cost for the use of the battery is computed using equation 4.4.

C nom batt =

CAPEX batt T OE min (4.4) where CAPEX batt stands for the capital expenditure (the retail price) of the battery, while the T OE min stands for the minimum through-output energy of the battery or the minimum energy that the manufacturer guarantees the battery will deliver during its lifetime (see table 4.

2).

The T OE min is computed for specific test conditions set by the manufacturer of the battery.

In our case, we assume that T OE min is computed for the nominal battery cycling life CL max . Therefore, when CL decreases, that causes TOE to decrease accordingly, increasing the cost of the energy delivered by the battery in the same proportion. The correction factor for the reduction in the battery cycling life B LR , is presented in equation 4.5.

B LR = CL CL max (4.5)
where CL is the equivalent battery cycling life obtained with equation 4.2, while CL max is the maximum battery cycling life according to figure 4.4.

Then, the factor B LR is used to adjust the nominal cost of the battery presented in equation 4.4 to obtain the corrected battery cost. This is expressed in equation 4.6.

Forecasts and energy management in a microgrid: Impact on services provided by a smart building

C corr batt = C nom batt B LR (4.6)
Then, for a given EMS strategy, the equivalent B LR can be computed in order to obtain the corrected battery cost C corr batt . This cost is considered constant for the entire test period. For the sake of simplicity, we consider that these average use conditions of the battery are kept throughout all its lifetime, so that the reduction of its cycling life is consistent with the calculations. An analogous approach as the one presented in equations 4.4, 4.5 and 4.6 can be followed to obtain the average cost of PV energy, C pv . The nominal cost of the energy delivered by the PV panels C nom pv , can be obtained with the equation 4.7.

C nom pv = CAPEX pv T OE exp (4.7)
where CAPEX pv stands for the capital expenditure (the retail price) of the PV array (without taking into account the balance-of-system costs), while T OE exp represents the expected through-output-energy, which is computed based on the historical PV output power measurements of the study-case site and the warranted life and output-power of the PV panels given by the manufacturer (see table 4.2). In the meantime, an equivalent to the B LR can be found for the PV power production, that is related to the reduction in the through output energy due to curtailment. This is called PV curtailment factor (PV CF ) and is expressed in equation 4. [START_REF] Khodaei | Microgrid Planning Under Uncertainty[END_REF].

PV CF = E potential pv -E curtailed pv E potential pv = E real pv E potential pv (4.8)
where E potential pv is the potential output energy of the PV installation during the test period for the given GHI conditions, while the E curtailed pv represent the total curtailed energy during the test period. In this case, for a particular EMS strategy, the results of equation 4.8 are extrapolated as if the PV curtailment policy were to be repeated every year for the entire life of the PV installation. Under this assumption, equation 4.6 can be rewritten to compute the corrected cost of the energy delivered by the PV panels as in equation 4.9.

C corr pv =

C nom pv PV CF (4.9)

Service 2: Reduction in electricity carbon footprint

The CO 2 content of the electricity being consumed by the users of the SB is also a common optimization objective searched when performing energy management in MGs, specially because in small electrical systems like a MG, the carbon footprint could be very high The coefficients B LR and PV CF are the same as for the calculations of EC (see equations 4.5 and 4.8), as well as the T OE min and T OE exp .

In order to compute the Through-Output-Energy (TOE), the expected annual PV production is obtained for the study-case site. This calculation is based upon historical GHI measurements during the test period (≈ 1 year). This annual energy output is then extrapolated for the number of years that PV panels are expected to last, according to the manufacturer (30 years with a 0.26% annual degradation given by the manufacturer). In this way, the -average-total energy that the PV array is expected to deliver throughout its lifetime (TOE) is obtained. Regarding the TOE value for the battery, it is the minimum -warranted-energy that the battery will deliver during its lifetime, regardless of its profile of use, according to the manufacturer. The CAPEX costs are based on -average-retail prices in Europe for PV panels and Lithium-ion batteries, for the capacity requirements of the Drahi-X MG. Regarding the embedded CO 2 emissions (greenhouse gases emitted through the manufacturing process, including extraction of raw materials), several studies were consulted and the values were taken from the ones that seemed more adapted to the European case, and to the manufacturing sites of the type of PV panels and batteries expected to be used in the Drahi-X MG. A summary of the CAPEX and embedded CO 2 emissions of the battery and PV panels, as well as their nominal energy-cost, is presented in table 4.2. The costs do not include balance-of-system expenses. The references used to obtain the TOE, CAPEX and embedded CO 2 emissions (E CO 2 ) are presented in table 4.2. With the aforementioned values, this table is completed using equations 4.11 and 4.12 to obtain the nominal values of CO 2 content per kWh of energy delivered by the battery and PV panels, respectively. In a similar manner, equations 4.4 and 4.7 are used to obtain the nominal cost per kWh delivered by the battery and PV panels, respectively.

Service 3: Day-ahead grid power commitment

This service can be thought as the ability of the SB to issue -beforehand-, an hourly-averaged power profile for the upcoming day. This information could be used by the TSO to better plan and perform their optimal UC, in an scenario where the penetration of distributed generation with renewables will be representative. The added value of this service lies on the capacity of the MG+EMS of dealing internally with the uncertainty associated with the IRES production and consumption, by using the energy storage and the curtailment of excess PV energy. A MG with such capacity, would be seen, from the TSO point of view, as a deterministic-demand unit, whose power requirements are known one day-ahead, which would allow the TSO to take that into account for its UC scheduling. The associated performance indicator used to quantify this grid-commitment service, is computed as the absolute difference between the hourly scheduled and real grid energy profiles. This indicator is normalized with respect to the total-absolute amount of energy scheduled to be exchanged with the grid during the test period. It will be called hereafter GC and it is expressed as a percentage, where 100% means a perfect match between scheduled and forecasted grid power profiles and 0% represents a deviation equivalent to the scheduled energy to be exchanged with the grid during the test period. This can be more clearly observed in equation 4. [START_REF] Perea | Definition, evolution, applications and barriers for deployment of microgrids in the energy sector[END_REF].

GC = 100 •    1 - 1 ∑ H h=1 ∆t • P sch h grid H ∑ h=1 ∆t • P real h grid -P sch h grid    (4. 15
)
where P real h grid and P sch h grid are the average-hourly real and scheduled power values exchanged with the grid. Both sums are performed over the total number of hours H of the test period.

The equation 4.15 can be expressed in a more simple way as in equation 4.16

GC 100 = 1 -GoC N = 1 - GoC ∑ H h=1 P sch h grid = 1 - ∑ H h=1 P real h grid -P sch h grid ∑ H h=1 P sch h grid (4.16)
where GoC N stands for grid-off-commitment (normalized) power and GoC stands for gridoff-commitment power (Not normalized).

Service 4: Reduction of grid peak power

If the SB-MG surpasses a certain power threshold P peak grid , the utility grid must be ready to deliver that power, even if it is required only few hours of the year. This forces the TSO to have expensive fast-responding generation units idling, that will be required a very small Forecasts and energy management in a microgrid: Impact on services provided by a smart building percentage of time. Having these idling plants ready to respond to high power peaks, can increase significantly the cost and the carbon footprint of the grid electricity. Therefore, the service hereby proposed is meant to decrease these peak power requirements from the MG, an its general added value, if thought in a high MGs penetration scenario, is the reduction of the required installed capacity in the utility grid, or even the reduction in the regional power exchanges required to satisfy the consumption peaks, which in turn implies a reduction in the cost and carbon footprint of the utility grid electricity. The performance indicator chosen to quantify this service corresponds to required contracted power according to the EDF-Tempo tariff (see figure 4.1) [START_REF] Tempo | Grille tarifaire en 2020 et CGV[END_REF]. This is directly conditioned by the maximum (i.e. peak) power in which a given EMS strategy incurs during the test period, hence its designation as the grid-peak-power, hereafter mentioned as GPP. The lower the GPP, the lower the required contracted power, hence, the lower the annual fee to be paid by the SB users. This is translated in a decrease on the final cost and carbon footprint of the electricity consumed by the users of the MG.

Proposed two-step energy management system

Performing energy management consists, in simple words, on actively deciding what resources of a MG are dispatched at what moment and with what power, in order to assure the proper functioning of the MG (the balance between production and consumption), and maybe, to favor a secondary objective(s). In order to do that, a system that makes decisions is required, as well as a hardware that allows the execution of those instructions. This process has to be performed at every moment (i.e. in real-time), otherwise the system risks to suffer a blackout. However, sometimes it might be required to plan this real-time resourcesdispatching in advance, and for a given window of time. The reasons why sometimes, this time-ahead planning is required, could vary. For instance, to perform the optimization of a variable over a longer period of time, could be beneficial. Some studies have shown that, under certain circumstances, the performance of longer optimization horizons improve and outperform shorter horizons [START_REF] Russell | Horizon extension for rolling production schedules: Length and accuracy requirements[END_REF]. Another example are day-ahead energy markets. There, producers are asked to make their energy bids one day in advance, so that the TSO can make its arrangements to guarantee the consumption for next day (unit commitment), at a lower cost [START_REF] Smith | Regulation (EC) No 764/2008 of the European Parliament and of the Council[END_REF][START_REF]Understanding electricity markets[END_REF]. Taking a real-time reactive-only approach in this case, would be risky for the stability of the grid, as power plants cannot start/respond instantaneously to consumption variations, and this would probably also increase the cost of electricity. This fact could suggest that some services can be provided only if time-ahead planning/scheduling is performed. This is the case of the grid-commitment service explained in section 4.4.3. For the above reason, we decided to propose in this work a two-stage EMS strategy, where we separate the day-ahead scheduling from the real-time power balancing. This allows to favor two different objectives (services), one favored by the scheduling module (SCH) and the other favored by the real-time balancing module (BAL).

In more detail, in a first stage of the EMS, an optimal scheduling is performed, where three different strategies (with three different objectives) are possible: energy-cost, CO 2 emissions or grid-peak-power. We call these objectives the Target Objectives or TOs. During the scheduling stage, only one TO is targeted (i.e. set as optimization objective), depending on the strategy chosen. By definition, all the other services that are not being targeted are called Non-Target Objectives or NTOs. During this first scheduling stage, the grid-commitment service cannot be targeted. A summary of the scheduling strategies along with their objective functions is presented in table 4.4. The main beneficiaries of these TOs can be seen in figure 4.3.

In the second stage of the EMS, once the scheduling module has generated a given grid and battery profiles (i.e. scheduled profiles) -while favoring one of the possible TOs-, it broadcasts the scheduled grid profile to a second module called: the balancing module (BAL). This module targets only one objective: the grid-commitment. This module runs in real-time and therefore it is in charge of compensating the forecasting errors of the PV production, by following the rules described in figure 4.7. These rules are explicitly meant to favor the grid-commitment. This means that, the BAL module will modify the scheduled battery profile or perform PV curtailment, in order to preserve the scheduled grid profile untouched, as long as physical constraints allow it (i.e. available capacity on the battery). A schematic of the proposed strategy can be seen in figure 4. 5. This proposal is different to common multi-objective optimization EMS approaches, where the optimal compromise between the different objectives is searched simultaneously during the optimization execution [START_REF] Chaouachi | Multiobjective Intelligent Energy Management for a Microgrid[END_REF][START_REF] Mohamed | Multiobjective optimization using Mesh Adaptive Direct Search for power dispatch problem of microgrid[END_REF]. In contrast, our proposal targets a different objective (i.e. service) in each one of the two stages, (in a "cascade" approach), and using different methods (optimization-based, rule-based). That makes the optimization problem easier to formulate and solve, compared to a multi-objective one. But the main reason why this approach was chosen, is because the grid-commitment, by its nature, cannot be favored in a first EMS stage, as it requires a previously scheduled profile to be followed. Therefore, it is a service that can only be favored during a second (real-time/balancing) stage, where it can be set as the criteria to decide which DERs power profiles are modified to compensate the forecasting errors, while assuring the balance between production and consumption. the value of the objective function in the optimization problem being solved (see equations 4.18, 4.19). The 100 more-fit individuals (i.e. the ones with the lowest "cost" dictated by the objective function) are selected from the current population, and they are called the "parents" of the new generation.

The GA objective function is presented in equations 4.18 or 4.19, depending on the service that is being optimized. In each generation, the SoC profile of the battery is computed for each individual, and a term in the objective function is included that severely penalizes the individuals that provoke the SoC to go out-of-bounds (i.e. out of [0%,100%]). In equations 4.18 and 4.19, this term is composed by two elements: the cost factor K, and the number of times that SoC is out-of-bounds for a given individual (SoC out ). The initial SoC of the battery is set to 50%. In order to have the same margin every day to compensate over and under estimations of PV power production, as well as to assure sustainability of the SoC throughout the week (i.e. that battery does not accumulate or lose charge as days pass), the optimization algorithms are meant to leave the battery with the same SoC of 50% by the end of the day. Therefore, another term is included in equations 4.18 and 4.19, to penalize individuals that provoke deviations from the desired SoC by the end-of-the-day (EoD). This term is composed by: the cost factor L and the deviation from the desired SoC by the EoD, SoC dev . Individuals are also penalized if they send back energy to the grid, as the idea of the study-case MG is to foster self-consumption. Therefore, even when in real-life conditions the cost of sending energy back to the utility grid is zero, we include a term with a small cost to penalize this action, in order to favor charging the battery with any PV surplus available, as long as possible. This term is composed by: the cost factor M, and the energy sent to the utility grid (P h grid < 0). When the grid delivers power (P h grid > 0), this term is not taken into account (M = 0).

Once the 100 parents with the best fitness score have been chosen (mating pool), they will create the next 1000 members of the next generation through the combination of their genomes (crossover) and mutation. The crossover is performed among every adjacent pair of parents on the mating pool. Among a pair of parents, their genome (composed of 24 chromosomes) is split in a randomly-selected position, in two parts, called A and B sections. Then, the section A of the first parent joins the section B of the second parent, giving origin to a new offspring. This new individual has then, a genome that is a combination of the genome of its parents. Besides the crossover, with the aim to avoid local-optima solutions, a mutation process is performed to every individual of the offspring generation. It consists on randomly selecting one chromosome of the individual (i.e. the battery hourly-average power of a -randomly selected-hour of the day), and replacing it with a random value within the battery power limits ([-27kW,+27kW]). The whole process is repeated as many times as Forecasts and energy management in a microgrid: Impact on services provided by a smart building required for a pair of parents, so that they will generate their offspring quota (new individuals) such that, among all the pairs of parents of the mating pool, the offspring of 1000 members of the next generation is created, in an equal proportion. The parents of each generation, are also part of the new generation, which means that after the first generation, every new generation will have 1100 members. The new generation of candidate solutions is then used in the next iteration of the algorithm. The algorithm terminates after 300 iterations, and the fittest individual is chosen as the quasi-optimal solution of the algorithm. A flow diagram of the GA hereby explained is presented in figure 4.6. The selection of the penalizing weights K, L and M was done following a priority order, where the least-desirable situation (physically impossible) is when the battery-SoC goes out-of-bounds, hence, it has the highest weight (K = 1 • 10 6 ). The second least-favorable situation is when the battery-SoC, by the EoD, is different from the desired value. This situation is physically possible, but highly undesirable, hence its has the second highest weight (L = 5), The most "benevolent" situation is when, due to a surplus on PV production, energy is sent back to the utility grid. This situation is undesired only when the battery can accept charge, as self-consumption should be favored. However, if the battery is full, sending the surplus to the utility grid is the only solution, as during the scheduling stage no PV curtailment is possible. This situation is penalized by the smallest factor (M = 1 • 10 -5 ).

The values of those weights were obtained using a random search (taking into account the priority order previously mentioned), and comparing the output of the GA (i.e. the 24-hour battery power profile) with a reference case. The reference case is a hypothetical day where there is no electrical consumption. Therefore, if we minimize the energy-cost, the optimal solution is when all the PV production of the day is sent directly to the utility grid (i.e. the battery power profile of the entire day equals zero).

We recall, as remarked in table 4.4, that the scheduling module does not perform PV curtailment, hence, any PV surplus has to be either sent to the battery or to the utility grid. The performance is evaluated based on the closeness of the battery power profile produced by the GA (for a given combination of weights K, L and M) to an all-zero profile. The number of iterations, size of the initial population, the probability of a mutation to occur, the number of chromosomes to be mutated, as well as the number of parents per generation (mating-pool size), are called the hyper-parameters of the problem, and they were chosen performing a parameter-by-parameter sensitivity exploration. Each combination of hyper-parameters was scored based on the closeness of its output with respect to the reference case, in an analogous manner as per the penalization weights K, L and M. A summary of the penalization weights and hyper-parameters obtained is shown in table 4.3. It was of interest to test the implementation and performance of a GA to solve our optimization problem for EC and CO2 due to its versatility to treat non-linear objective functions. In our problem formulation, the fact that the energy of the battery and utility grid have different costs depending on their flow direction (i.e. only delivered energy has a cost), makes our problem non-linear. Besides, we wanted to evaluate the possibility of including Forecasts and energy management in a microgrid: Impact on services provided by a smart building the correction factor of the battery cycling life (equation 4.5) in the objective function, which is also non-linear. Due to time constraints, this implementation could not be included. In following subsections, the minimization problem of the energy-cost (EC) and the carbon footprint of the energy (CO 2 ), that were performed using the genetic algorithm, are described.

Non-linear programming

Non-linear programming (NLP) is the process of solving an optimization problem where some of the constraints or the objective function are nonlinear [108]. A typical formulation of a NLP problem can be expressed as in equation 4.17.

minimize f (x) x subject to: g i (x) < 0 for each i ∈ {1, ..., m} h j (x) = 0 for each j ∈ {1, ..., p}

x ∈ X (4.17)

where n, m and p are positive integers, X is a subset of the real coordinate space R n , f , g i and h j are real-valued functions on X for each i ∈ {1, ..., m} and for each j ∈ {1, ..., p}, with at least one of f , g i and h j being non-linear. A non-linear maximization problem is defined in a similar way.

Quadratic programming is a particular type of non-linear programming [START_REF] Nocedal | Numerical optimization[END_REF], and can be defined as the process of solving a linearly constrained, quadratic optimization problem, that is, the problem of optimizing (minimizing or maximizing) a quadratic function of several variables subject to linear constraints on these variables. Contrary to heuristic methods such as the GA, quadratic programming methods do not require the tuning of hyper-parameters, which diminish the setting-up time and the uncertainty of obtaining sub-optimal solutions. It suffices to follow the standard structure of this type of method when performing the statement of the problem, and the computer solver will find the optimal solution, if feasible. An example of the statement of the problem is shown for the GPP, where this algorithm is used, as presented in section 4.5.2. The scheduling module (SCH) of the EMS hereby proposed, performs a day-ahead (D-1) scheduling of the grid average-hourly power requirements for the next day (D). The result of the scheduling is a 24h grid power profile. Three different services are proposed as optimization objectives in this stage: the cost of the electricity, the CO 2 content and the grid-peak-power. To perform the optimization, two different methods were used, a genetic algorithm and a non-linear programming approach called least-squares quadratic programming. Each method present characteristics that make them more suitable for different optimization objectives (i.e. objective function formulations), as will be discussed in the next sections.

Energy cost minimization

The energy-cost (hereafter called EC), is the first service minimized using the abovementioned GA. The costs of the battery and PV energy, included in the objective function (see equation 4.18), correspond to the constant non-corrected nominal values C nom , presented in table 4.2. The correction due to battery-life reduction and PV curtailment, expressed in equations 4.6 and 4.9, is computed once the grid power profile for the entire test period has been generated. This has to be this way since, as expressed in equations 4.2 and 4.8, a prior grid profile is required to compute the correction factors B LR and PV CF . The optimization problem, including the objective function and its constraints, is expressed in the set of equations 4.18.

Forecasts and energy management in a microgrid: Impact on services provided by a smart building

min P batt ∑ 24 h=1 ∆t • (P h grid •C h grid + P h batt •C h batt + P h pv •C h pv + M • P h grid ) + L • SoC dev + K • SoC out
where:

         C h batt = 0 if P h batt < 0 C h grid = 0 if P h grid < 0 M = 0 if P h grid > 0 s.t. P h grid + P h batt + P h pv + P h load = 0 ∆t • ∑ 24 h=1 P h batt = 0 (SoC h=24 = SoC h=1 = 50%) P h pv = P h mppt pv 0% ≤ SoC h batt ≤ 100% 0 kW ≤ P h batt ≤ 27 kW (4.18)
where P h mppt pv is the maximum possible PV power output of hour h (i.e. the power delivered by the maximum power point tracker -MPPT-controller), which depends on the GHI of that hour. The factors M, L and K represent respectively the penalizing weights of: the power sent to the grid (P h grid <0), the deviation from the desired SoC at the end of the day (SoC dev ) and SoC values that go out-of-bounds (SoC out ), for a given battery profile, as previously explained in this section. The power of the battery is capped at 27kW as it is the maximum power that the battery pack being installed in the Drahi-X MG has, as described in section 1.

It can be observed that the costs of grid and battery energy are zero when these resources consume energy. This is done this way because, in the case of the battery, the T OE min given by the manufacturer refers to delivered energy, while in the case of the grid energy, our study-case SB is not paid if energy is sent back to the grid. The optimization is supposed to be performed once a day (at midnight) when the PV output power forecasts for the next day become available. The SoC of the battery is constrained to be left, by the end of each day, at the same value as it was at the beginning of it, which in this study is set to 50%.

Proposed two-step energy management system 103 Carbon footprint minimization

The second service that can be optimized during the scheduling is the CO 2 content of the energy consumed in the MG (hereafter called CO2). This variable is also minimized using the GA approach, as for the EC. Therefore, the CO 2 content of the energy coming from the grid is considered known beforehand for every hour of the test period (see figure 4.2). The formulation of the problem is analogous to the one presented in equation 4.18. The complete formulation of the problem is presented in equation 4. [START_REF] Barnes | Microgrid laboratory facilities[END_REF].

min P batt ∆t •∑ 24 h=1 (P h grid •CO 2 h grid +P h batt •CO 2 h batt +P h pv •CO 2 h pv +M •P h grid )+L•SoC dev +K •SoC out
where:

         CO 2 h batt = 0 if P h batt < 0 CO 2 h grid = 0 if P h grid < 0 M = 0 if P h grid > 0 s.t. P h grid + P h batt + P h pv + P h load = 0 ∆t • ∑ 24 h=1 P h batt = 0 (SoC h=24 = SoC h=1 = 50%) P h pv = P h mppt pv 0% ≤ SoC h batt ≤ 100% 0 kW ≤ P h batt ≤ 27 kW (4.19)
where CO 2 content of the battery and PV energy included in the objective function, correspond to the constant non-corrected nominal values CO nom 2 , presented in table 4.2. The corrections due to battery-life reduction and PV curtailment, expressed in equations 4.13 and 4.14, are computed once the grid power profile for the entire test period has been generated, for the same reasons exposed for the EC minimization. The factors M, L and K represent respectively the penalizing weights of: the power sent to the grid (P h grid <0), the deviation from the desired SoC at the end of the day (SoC dev ) and SoC values that go out-of-bounds (SoC out ), for a given battery profile, as previously explained in this section.

Forecasts and energy management in a microgrid: Impact on services provided by a smart building

Grid peak power minimization

The third service that was envisaged to be optimized by the scheduling module was the required contracted power or grid-peak-power (hereafter called GPP). Due to the nature of its objective function, the minimization of the GPP hereby proposed, falls into the category of quadratic programming problems, therefore the NLP method, described in section 4.5.1, was considered suitable to optimize this service. The simple formulation, convergence speed, as well as its ability to find true optimal solutions, made us prefer this method over the GA to optimize this service. The formulation of the optimization problem is presented in equation 4. [START_REF] Merabet | Energy Management and Control System for Laboratory Scale Microgrid Based Wind-PV-Battery[END_REF] We note that here there are no costs associated to the power values, as the algorithm is only meant to minimize the peaks of power themselves, trying to make the profile as smooth as possible. As deduced from its objective function, the method minimizes the power peaks of the grid and the battery simultaneously, reducing not only the required contracted power, but also the depth-of-discharge of the battery, which might lead to extended battery life. There is no associated costs to the grid or battery power, as the power profile itself suffices for the optimizer to obtain the required results. As for the EC and CO2, once the algorithm generates the resulting grid and battery profiles for the entire test period, all the performance indicators can be computed and the grid profile is used as the input for the balancing module.

The balancing module

Since the scheduling is performed using day-ahead PV output power forecasts, it is expected to have errors on the forecasted PV power output. The battery is an element that allows to compensate those forecasting errors to some extent, but due to its limited capacity, it could eventually happen that the scheduled grid profiles cannot be followed as expected. In this situation, modifications to the power profiles must be done in order to assure the balance between production and consumption, which is at the end, the most important task to be assured by any MG. This task is performed by the balancing module (BAL) of the EMS. However, while fulfilling the objective just mentioned, another service is favored in this stage of the EMS: the grid-commitment (GC).

Grid commitment

The GC is a service targeted by the BAL module through a set of rules that are meant to favor this service as long as the physical constraints allow it. This means that, any unexpected PV surplus will be stored in the battery, or any lack of PV power to supply the load, will be supplied by the battery, as long as possible. The rules can be summarized as follows:

• The balancing module receives the average-hourly grid power profile issued by the scheduling module

• By taking into account the potential (mppt) PV power output and real consumption, the BAL module generates the corresponding power profile for the battery, by using the energy conservation equation 4.21

• In the case when the battery gets full and there is potential PV power surplus, it is curtailed by the controller as needed • In the opposite case, when there is lack of PV power to satisfy the demand and battery is empty, the BAL module takes this missing energy from the grid. This is, as a last resource, the only moment when the BAL module modifies the commited grid profile

P h batt = -(P h grid + P h pv + P h load ) (4.21)
In our case, the BAL module performs this operation off-line, as we are working with past data. But in a real-time implementation, we should take some considerations so that the above mentioned rules can be actually applied to a real system. A flow diagram of the working principle of the BAL module explained above is presented in figure 4.7.

Forecasts and energy management in a microgrid: Impact on services provided by a smart building As it is noted in the rules described above, this module favors the GC service, always assuring the proper balance between production and consumption. In this way, after applying the two-staged EMS, we will have favored two different objectives: GC during the BAL stage and a second objective (i.e. EC, CO2 or GPP) assured during the SCH stage.

A summary of the EMS strategies proposed in this work, including the nomenclature, services favored, working/optimization objectives as well as the possible forecasts to be used, is presented in table 4.4.

Reference strategies

It is important to compare the results with basic strategies that allow to highlight the added value (or not) of a given proposal. Therefore, in this work we compare the proposed EMS strategies against three different -basic-reference strategies that are considered meaningful to validate the contribution of our proposals.

The first EMS strategy that is envisaged to be implemented in the Drahi-X building is a basic rule-based balancing-strategy that privileges the use of all the available PV potential (self-consumption) and the battery use. Therefore, this strategy is used as a benchmark in this work to compare the performance of the proposed EMS approaches, and it is designated as PVB max . This strategy follows simple rules: the PV potential available is either used to supply the consumption or to charge the battery. In the case that there is a surplus of PV, that cannot be absorbed neither by the battery nor by the demand, it is sent back to the utility grid. On the contrary, if the PV potential production is not sufficient to satisfy the demand, the strategy will use any energy stored in the battery before making use of the grid. This strategy, even when conceived as a balancing strategy, can also perform scheduling if a forecast of the PV production is given, instead of the real PV production. Therefore, we use this as a reference strategy for both, balancing only (PVB max ), and scheduling (PVB max -NWP); as presented in table 4.5. A flow diagram representing the working principle of the strategy is presented in figure 4.8. It has to be noted that, in a real-case implementation of this strategy, the flow of actions presented should be repeated every time the state of the system changes (i.e. SoC, P load , P pv ).

Performance evaluations

This section presents the main results of this chapter, divided in five sections according to different queries that were posed in order to answer the main research question related to this chapter which is: what could be the added value of including information about the uncertainty of photovoltaic production forecasts, in the energy management system of a microgrid? A sequential analysis has been followed that unfolds, in a logical order, the different topics, issues and unknowns required to answer the main research query. This methodology also helps to deliver and highlight the most important messages and takeaways of the chapter, by guiding the reader throw the different sub-questions, tables, figures and main conclusions Forecasts and energy management in a microgrid: Impact on services provided by a smart building ) of each sub-section. This is graphically shown in figure 4.9, where the blue boxes contain the specific questions (in most of the cases derived from the results of the previous subsection), while in the green boxes the answers to the questions and the most important takeaways from each subsection are pointed out. The detailed results of each specific topic are presented through sections 4.6.1 to 4.6.5.

Added value of scheduling

Scheduling can be defined as the planning of the use of resources in a MG, for a given window of time in the future. Therefore, derived from this statement, the first advantage of performing scheduling does not requires numbers to be proven. There are services that simply, cannot be offered by a SB, if time-ahead scheduling is not performed. This is the case of the grid-power-commitment, that due to its intrinsic objective of broadcasting a grid power profile for a window of time in the future (e.g. day-ahead), it requires scheduling to be performed beforehand, hence the use of forecasts as well. Therefore, if the EMS of a MG/SB is not equipped with a scheduling module, it cannot offer this service, just to mention an example.

In order to further evaluate the added value of performing scheduling in the study-case MG with the strategies presented in section 4.5, a comparison with three different reference Figure 4.9 Reasoning flow followed in section 4.6 to tackle the main queries required to answer the main research question of Chapter 4 cases has been proposed, and the results presented in table 4.5. This table summarizes the results of three reference strategies and the three proposed EMS scheduling strategies, according to the four performance indicators (i.e. EC, CO2, GPP and GC). This is very important, as some studies in the field focus only on developing new functionalities or proposing new EMS strategies, but when it comes to the analysis of results, they lack the benchmark against basic reference cases such as no MG and/or no EMS implementation. This is important when justifying the necessity or showing the added value of having a MG and/or implementing an EMS strategy. The first reference case, and maybe the most obvious, is when we assume that there is no MG deployed (NO MG in table 4.5), therefore all the consumption is supplied by the utility grid. The second and third strategies used as reference are the PVB max balancing strategy and the PVB max -NWP scheduling strategy, that are presented in detail in section 4.5.3. A summary of the proposed strategies (scheduling and optimization-based strategy. An important reduction of 12.4% is also obtained by the latter with respect to the case when no MG is present. It is interesting to note the high cost of the energy when no microgrid is present (higher than the white and blue days of tempo tariff), which is the result of a very high consumption during the red days, that happens in winter. This has a heavy weight on the calculation of the average price of the energy during the test period, which brings its value above the average of the white and blue days (see figure 4.1 for tempo tariff). This remarks the superiority in performance that brings implementing the EC min scheduling strategy, as it optimally schedules the requirements of electricity from the utility grid when the prices are more favorable while using the energy stored in the battery in the opposite situation.

Regarding the CO2 min strategy, that aims to reduce the CO 2 content of the energy, there is an interesting result with respect to the "NO MG" reference case, where the CO2 min strategy actually produces an increase of 4.9% in CO 2 emissions. To explain this situation, it is helpful to review the figure 4.2 and table 4.2 where we find the CO 2 content of the energy coming from the grid, PV and battery. According to figure 4.2, the average grid CO 2 content for the test period is around 56 gCO 2 /kWh, with a mode of 33 gCO 2 /kWh, a minimum of 19 gCO 2 /kWh and a maximum of 128 gCO 2 /kWh. On the other hand, according to table 4.2, the energy produced by the PV panels and stored in the battery will have, at least, a CO 2 content of 56 gCO 2 /kWh. This value most likely will be higher most of the time, due to the corrections that are performed, as presented in equations 4.13 and 4.14. Therefore, one could state that in a country like France, where the electricity matrix is quite low in CO 2 content compared to the rest of Europe [START_REF] Moro | Electricity carbon intensity in European Member States: Impacts on GHG emissions of electric vehicles[END_REF], if a MG is to be deployed with the aim to reduce CO 2 emissions, thorough calculations must be performed that take into account the embedded CO 2 emissions of the PV panels and battery, to make sure that an actual reduction in CO 2 emissions can be achieved. Regarding the other two reference cases, where the PVB max strategy is used to perform balancing and scheduling, reductions of 4.5% and 7.2% are Forecasts and energy management in a microgrid: Impact on services provided by a smart building achieved correspondingly in the CO 2 emissions, when the CO2 min strategy is implemented with the NWP forecasts. In this case again, we observe that the PVB max performs better when used as a balancing strategy, which is for what it has been conceived. Regarding the third service studied, which corresponds to the grid-peak power reduction, the GPP min -NWP strategy is able to reduce the required contracted power with respect to the NO MG and the PVB max -NWP strategies, but not with respect to the PVB max balancing strategy. In order to explain this, we should remind that PVB max gives priority to the use of battery over the use of the grid. Then, when used as a balancing strategy, it compensates differences between production and consumption giving priority to the battery as much as possible. Therefore, it is reasonable to think that the highest power peaks are going to be suffered by the battery, and not the grid. On the other hand, strategies like EC min or CO2 min use the grid at will in order to fulfill their target objectives, regardless of the grid power peaks they might produce. In the case when no MG is deployed, as all the consumption is supplied by the grid, the GPP is directly related to the consumption peaks during the test period. The maximum reduction of the annual fee (due to the required contracted power) of 30.2% is achieved with respect to the NO MG and PVB max -NWP strategies. If this reduction on the annual fee is expressed in terms of its impact in the average price of electricity (for the test period), this difference would represent, for instance, a decrease of approximately 1.4%, if the price obtained with the EC min strategy (0.169 C/kWh) is taken as reference. Regarding the grid-commitment (GC) service, by definition, it can only be offered when scheduling is performed. Therefore, from the reference strategies, only the the PVB max -NWP can offer the grid-commitment. As seen in table 4.6, it obtains a worse performance than the three optimization-based strategies. Even when the output from all the scheduling strategies (including the PVB max reference strategy) pass through the BAL module -that favors the GC-, it seems that the strategy followed by PVB max , which gives priority to the use of available PV and battery energy, is not favorable for the grid-commitment. This would be the consequence of the battery being not able to compensate the forecasting errors, according to the rules followed by the GC max balancing strategy (see figure 4.7), which in turn would be the result of the battery being scheduled to spend more time in its extreme SoC states (i.e. 0% or 100%). This leaves the battery less chances to compensate forecasting errors, hence, the grid must take on the task. This is confirmed by the results shown in figure 4.10(a) and 4.10(b), were the SoC during the test period for the GPP min -NWP and the PVB max -NWP scheduling strategies is shown respectively. It confirms the previous statements as we see that for the former strategy, the battery spends more time on its extreme SoC values (particularly 0% during winter monthsblue zones), which makes it unable to counteract for forecasting errors. This makes the grid compensate for those errors instead (a greater number of times), forcing it to deviated from its scheduled profile, hence the inferior performance on GC for the PVB max strategy. In general, from tables 4.5 and 4.6 we cannot conclude that the proposed scheduling strategies always bring an improvement in performance with respect to the reference strategies. However, we must remind that NWP might not be the most suited forecasting method for the proposed strategies (fact that will be confirmed later, see table 4.10). Therefore, it would be more fair to present the results of table 4.6 using the best suited forecasting method for all the scheduling strategies, which is what table 4.7 shows. In this table, a quantile forecast expressed like: AnEn τ=x 1 :x 2 means that any probability level (i.e. quantile) between x 1 and x 2 produces the same -optimal-performance with the strategy being used. Here we can see that, with the exception of the CO2 min strategy, that is still outperformed by the NO MG reference case for the reasons mentioned above, all the proposed scheduling strategies outperform all the reference strategies in the services they target. This shows how the scheduling method proposed in this work brings an added value to the MG in terms of Forecasts and energy management in a microgrid: Impact on services provided by a smart building performance, as long as the proper forecasting method for each strategy is chosen. This conclusion brings out a question: what does it mean "a proper forecasting method"? What characteristics define it? The answer to this question is addressed in the following section.

The complete results of all performance indicators of all the scheduling strategies with all the forecasting methods used in this work, can be consulted in Appendix B.

Impact of deterministic forecasts uncertainty

At the heart of a scheduling strategy there is always a PV production forecast. An EMS that performs scheduling of DERs, for a given window of time in the future, requires forecasts as inputs, for the target time-window, in order to perform its task. But forecasts are never 100% accurate, then, their intrinsic uncertainty becomes an important subject to be studied as presumably, this will have an effect on the final performance obtained from a given scheduling strategy. Besides, this characteristic would define what a proper forecasting method is, as questioned in the previous section. As we aim to isolate and analyze the effects of the uncertainty of the solar resource, we utilize only PV production forecasts, while considering the other variables (such as energy consumption and electricity prices) deterministic and known beforehand. The -annual-relative errors of all the forecasting methods used in this work can be consulted in table A.1, where the differences between the absolute error and the bias, between the different forecasting methods, is noticeable. The ability to "swing" between these two components gives quantile forecasts a particular added value when it comes to their utilization as the input forecasts for an EMS, as explained below.

Recalling the statistical definition of quantile, what the deterministic quantile forecasts (studied in Chapter 3) say is: if a given quantile τ with probability level x is used as a prediction (i.e. x f cast = τ x ), there will be x% of probability that the bias (i.e. the forecasting error) is positive, being the bias computed as the difference between the forecast value and the observation (i.e. B = x f castx obs ). This is an interesting characteristic of the quantile forecasting method as it allows the decomposition of the forecasting error E f cast in two components, namely: the -absolute-magnitude (quantified by its MAE) and a bias (quantified by its MBE). Quantile forecasting allows us to choose (to some extent) between the absolute magnitude and the bias of the forecasting error, which can be beneficial in an application where having a bias in a given direction is more beneficial than having it in the other direction (or not having it at all). Therefore, we are going to explore if the services proposed in this work can benefit from this feature, in order to allow the EMS to enhance the performance on those services. For this, the three EMS scheduling strategies used in the section 4.6.1, are also used in this section, along with some -representative-forecasting methods. The aim is to evaluate the differences in performance (regarding the studied services) when using forecasting methods that present errors with different characteristics in terms of magnitude (absolute error) and bias. The results are obtained for the entire test period and are summarized in table 4.8. In this table, the GC indicator is also included, as grid-commitment is a common service to all the scheduling strategies (EC min , CO2 min and GPP min ), assured by the balancing module (BAL). We show here the results of using a very pessimistic forecast (AnEn τ=0.1 ), a very optimistic forecast (AnEn τ=0.9 ), an unbiased forecast (PE), a low-bias high-accuracy forecast (NWP) and a perfect forecast (PF). As states in table 4.8, the best results (bold values) for all indicators are obtained with the most accurate forecast PF, with a 100% of GC for the three scheduling strategies as well as the smallest values for EC, CO2 and GPP. This is consequent as the optimal strategies found during scheduling are being strictly followed when a perfect forecast is used, hence the optimal performance is achieved. However, this scenario is unrealistic as having a perfect PVpower forecast is most likely unachievable. With this in mind, it makes sense to compare the results obtained with realistic forecasting methods, with respect to the PF (as the theoretical best performance achievable), in order to quantify the possible effects of the differences in accuracy. This is observed in table 4.9 where the performance of the three EMS strategies, regarding all performance indicators, is presented as a percentage with respect to the PF results. In this table, the positive/negative bias represents a relative increase/decrease of the corresponding performance indicator with respect to the result obtained using a PF. The percentage of the GPP indicator, represents the percentage-difference in terms of the annual fee that must be paid depending on the contracted power required, as it was considered more meaningful for the purposes of the comparison of this indicator. The annual fee that must be paid depending on the required contracted power can be consulted in figure 4.1.

Regarding the EC min strategy, we observe some correlation with the bias of the forecasting error, as EC presents its highest (worst) value with the most pessimistic forecast (AnEn τ=0.1 ), followed by the most optimistic forecast (AnEn τ=0.9 ) and the low-bias high-absolute-error forecast (PE). It seems that this service requires low-bias and low-absolute-error forecasts to yield its best performance, as it is the case when using the NWP and PF. The difference Forecasts and energy management in a microgrid: Impact on services provided by a smart building between the best and the worst strategies (EC min -PF and EC min -AnEn τ=0.1 respectively) are as high as 92.8%, as stated in table 4.9, which represent an increase in the price of the electricity of 0.14 C/kWh. However, it must be remarked that the smallest cost obtained (using EC min -PF) is about 0.154 C/kWh, which is competitive with the tempo tariff only in the peak hours of the white and red days, where the electricity price is higher than this value. This remarks the importance of optimally deciding when to store/use energy from the battery, and when is better to buy the energy directly from the utility grid, in order to optimize this service.

Regarding the CO2 indicator, the highest value is obtained with the most optimistic forecast (AnEn τ=0.9 ) forecast, which is 41.2% higher than the reference PF case, followed by the AnEn τ=0.1 approach (+15.9%), the persistence approach (+3.2%) closing with the NWP forecasting method that presents only an increase of +1.6% with respect to the reference PF approach. There is a clear difference here between the results of the quantile forecasts (AnEn τ=0.1 ,AnEn τ=0.9 ) and the other two forecasting methods (PE, NWP), which suggests that this service is favored by low-bias forecasts.

The carbon footprint when using the CO2 min -PF strategy, is 63 gCO 2 /kWh (see table 4.8), which is higher than the mean and the mode of the carbon footprint associated to the electricity coming from the utility grid. This fact helps to explain the results obtained in table 4.5, that show that the average CO 2 content is higher when a MG is deployed, due to the high embedded CO 2 emissions of the battery and the solar panels.

Regarding the GPP min strategy, the behavior is a little bit different. In this case, the smallest contracted power (i.e. the best performance) is obtained for the most pessimistic (AnEn τ=0.1 ), most unbiased (PE) and most accurate (PF) forecasts, at the same time. From this fact, it could be concluded that optimistic forecasts such as AnEn τ=0.9 , are not favorable for the grid-peak-power service. This might result from the fact that, under-estimative (or unbiased) forecasts, are more likely to have errors that result in battery getting fully charged, hence, promoting the PV curtailment. When this happens, the scheduled -smooth-grid profile produced by the GPP min strategy remains less modified. A similar situation happens when the PF is used, as it does not produce changes to the scheduled grid profile. This is not the case when using the NWP forecasts, as it has a more over-estimative tendency compared to PE or AnEn τ=0.1 . For this indicator, the use of the AnEn τ=0.9 and NWP forecasts, leads to an increase of 9.8% in the annual fee.

A similar phenomena occurs with the grid-commitment for the three scheduling strategies, where the AnEn τ=0.1 forecast, being the most pessimistic, presents the best results. This seems to confirm the fact that under-estimative (i.e pessimistic) PV power forecasts, favor the grid-commitment service. The latter throws an interesting conclusion regarding the effect of forecasts accuracy: highly optimistic or pessimistic forecasts (such as AnEn τ=0.9 or AnEn τ=0.1 ), do affect negatively the performance in some services like EC or CO 2 content, that seem to be rather favored by low-bias forecasts (e.g. PE or NWP). On the other hand, a service like grid-commitment seems to be favored by pessimistic forecasts, while the grid contracted power, while not presenting a clearly defined behaviour, seems to prefer avoiding optimistic forecasts. Besides, even when it does not target the GC, the EC min scheduling strategy seems to be overall the most favorable for this service, as it is the strategy that manages the battery in such a way that leaves more capacity on it to compensate the forecasting errors (i.e. in average, SoC is closer to 50%). An example of this -using NWP forecasts-can be seen in figure 4.10 (c), where the EC min strategy shows less white and blue areas (100% and 0% SoC states, respectively) than the GPP min and the PVB max strategies.

With the previous results in mind, an EMS seems to be able to favor some services by using different forecasting approaches that present errors with different ratios between absolute magnitude and bias. This suggests that it does not exist an unique proper forecasting method as such, as it is dependent on the service being targeted. Therefore, if the most suitable forecasts are used for each service, how well can the EMS perform? To what extent can we improve performance in the services proposed? We try to find the answer to this question in the next section

Contribution of using quantile forecasts

It must be recalled that an optimization-based EMS, such as the ones proposed in this work, require deterministic forecasts of PV production. Therefore, quantile forecasts are a way to provide the EMS with a deterministic forecast that has intrinsic probabilistic information embedded. More specifically, the most valuable information that we can extract from a quantile forecasts is the bias with respect to the real value. This information reduces the overall uncertainty of the forecast (composed by its absolute magnitude and sign/direction related to the bias), and allows the EMS to take measurements to counteract the error. A complete description of the AnEn method and quantile forecasts used in this section can be Forecasts and energy management in a microgrid: Impact on services provided by a smart building found in Chapter 3. The results presented in figure 4.11 include the PV costs, reduction in the expected TOE of the PV array due to curtailment, as well as the correction in battery cycling life according to equation 4.2. In other words, the electricity cost and CO 2 content for the battery and PV energy is affected by the profile of use, following equations 4.6, 4.9, 4.13 and 4.14.

The results shown in figure 4.11(a) are obtained with the EC min scheduling strategy, while the ones of figure 4.11(b) are obtained with the CO2 min scheduling strategy. In both plots, the battery life is presented as a gray curve that represents the battery cycling life as a percentage of the nominal cycling life (i.e. the maximum possible cycling life), as it was depicted in figure 4.4. The first remark coming out of figures 4.11, is that the values are higher than the ones seen in figures C.1 for both, EC and CO2 indicators. This figure (found in Appendix C) contains the results of the EC min and CO2 min strategies computed for the different forecasting methods, using the nominal cost/CO 2 -content for the battery energy (equations 4.4 and 4.11)) without any correction for cycling-life reduction. Besides, the results shown in this figure do not account for any cost/CO 2 -content for the energy coming from the PV panels. Therefore, figure 4.11 present a more realistic scenario as they take into account the costs associated to the PV panels, corrections for life reduction of the battery and curtailment of PV power. However, they continue to be approximations for a particular study-case that should not be taken as a rule for other study-cases.

It seems that in both cases, the reduction in battery life, plays a major role in the behaviour of both EC and CO2 indicators, as they find its minimum value where the battery life is maximum. In both cases, the quantile forecasts permit to obtain a better performance (however marginal) than NWP, being EC and CO2 2.4% and 0.7% less than the values obtained using NWP, respectively. It is important to remark than the best performance for the EC is obtained using the AnEn τ=0.5 forecast, while the lowest carbon footprint is found using the AnEn τ=0.3 quantile forecast. This is important because it remarks the fact that not always the most accurate forecast yields the best performance in every service. Quantile forecasts give us the versatility to adapt to each service, allowing the EMS scheduling module to obtain a performance beyond of which, it could provide if a unique-deterministic forecast were used.

Regarding the minimization of the contracted power observed in figure 4.12(a), quantiles forecasts below AnEn τ=0.4 , allow a reduction of 16.6% with respect to the NWP forecasts. Above AnEn τ=0.5 , the performance is the same for both, quantile forecasts and NWP, that allow a contracted power of 18kW, according to the tempo tariff. This fact can be explained as for higher quantiles, the grid-commitment decreases (i.e. the grid off-commitment power increases), meaning that more unexpected deviations from the scheduled grid profile occur. Whereas, for lower quantiles, the GC is higher, meaning that the MG is able to stick to the scheduled grid profile, which was expressly meant to be smooth, as assured by the GPP min scheduling strategy. This is observed in figure 4.13. Adding to the latter, we observe that the grid use (gray curve in figure 4.12), increase with the quantile, which might also be related to higher grid power deviations. The grid usage is defined as the total -absolute-energy exchanged by the grid during the test period. If we look at the grid-commitment in figure 4.12(b) (GC-orange curve), it presents a pseudo-parabolic decrease with the increase of the quantile. In contrast, we observe that the self-consumption (SC-gray curve) increases following also a pseudo-parabolic pattern. This can be simply explained as follows: over-estimative forecasts (i.e. high quantiles) provoke errors that have to be counteracted by the grid, as it foresees more PV production than the actual. Therefore, all the PV power available is used (SC=100%), but the grid deviates from its scheduled profile to compensate the errors (which implies lower GC). On the other hand, for under-estimative forecasts (i.e. low quantile forecasts), there will be excess of PV power that is counteracted by means of PV power curtailment (i.e. lower SC), when the battery is full. In the latter case, the MG is able to follow closely the scheduled grid power profile, yielding the highest values of GC. The highest performance (GC = 100%) is obtained with the AnEn τ=0.1 quantile forecast (that is, at the same time, the least accurate), and it outperforms NWP by 1.5%. If PV costs are neglected (embedded CO 2 , CAPEX and corrections due to Forecasts and energy management in a microgrid: Impact on services provided by a smart building curtailment), as well as the battery cycling life corrections presented in equations 4.6 and 4.13, the behaviour observed in figures 4.11 change significantly. The analysis of this case can be found in Appendix C. In this section, we realized the advantage of the quantile forecasts, that give us the flexibility to "choose" between absolute magnitude and bias (in a given direction) of the forecasting errors, in order to optimize the performance for a particular service. Using these results we managed to improve the performance of the services (independently) to a certain extent, and we found the best combinations of scheduling-strategy + forecasting-method for each service. However, given that the best combination of scheduling-strategy + forecastingmethod is different for each service, when we chose to optimize one service, what is the impact over the other services? Can we find a strategy that produces a good performance for all services? This question is tackled in the following section.

How optimizing for one service affect the others

This section can be considered the core of this chapter, as it tackles one of the main objectives of the study, which is to explore if the fact of performing optimal scheduling for a particular service, affect the performance of the other services. If so, it would be of interest to know in which way and to what extend those other services are affected. In order to answer this question, the best combination of scheduling strategy plus forecast, for each one of the services, is run for the test period (along with the BAL module). In this way, the performance of each scheduling strategy regarding its target and not-target services can be cross-compared, to see the impact among the different strategies.

All these results are summarized in table 4.10, where the numbers in bold represent the best values obtained for each service, and the positive/negative bias represents a relative increase/decrease of the corresponding performance indicator with respect to the best result obtained. In this table, the percentage with respect to the best result of the GPP indicator, represents the percentage-difference in terms of the annual fee that must be paid depending on the contracted power required, as it was considered more meaningful for the purposes of the comparison of this indicator.

There are two main results to take away from this table, being the first one the fact that the best performance in each service, is obtained when using the scheduling-strategy-plusforecast that targets that service. This validates the usefulness of the proposed scheduling strategies, as they allow to produce improvements in performance in every service studied. The second interesting fact, and related to the previous one, is that a scheduling strategy always under-performs for those services it does not target. This is more clearly seen in table 4.10. For instance, in the case of EC, the best performance (0.165 C/kWh) is obtained with the EC min -AnEn τ=0.5 scheduling strategy. Its performance in the other services is always sub-optimal. Regarding CO 2 , the best performance is obtained with the CO2 min -AnEn τ=0.3 strategy (63 gCO 2 /kWh), and the GPP min -AnEn τ=0.4 yields the best performance in GPP (15 kW). Regarding the grid-commitment, it is not favored by any scheduling module, but by the balancing module, that is present for all the scheduling strategies. However, based on the results obtained for the test period, it was found that the EC min -AnEn τ=0.1 combination, produced the best annual performance for this service, among the different strategies.

Another important fact that comes back again in this results, is that in order to obtain the best performance in each service, different (quantile) forecasts must be used, that are not always the more accurate. That highlights the importance of the versatility provided by use of the quantile forecasts obtained with the AnEn method, that outperform results obtained with the reference NWP forecasts. Now, it is reasonable to wonder if it is possible to find a strategy that produces a good compromise, in terms of performance, among all services. It is true that, sometimes, the price to pay in order to achieve the best performance in one -target-service is big (regarding the remaining services), and the superiority in the target service might be marginal, with respect to the other strategies. For instance, if we take the EC min -AnEn τ=0.1 strategy, it yields the best performance for the grid-commitment service, with a value of 99.9%. However, the advantage in performance of this indicator with respect to the other strategies is not huge, as the worst performer in this indicator is the EC min -AnEn τ=0.5 strategy, which under-performs by only 1.2%. At the same time, the "price" in terms of performance, that the MG has to pay if it chooses the EC min -AnEn τ=0.1 strategy to obtain the best GC performance, is very significant regarding the other services, with values up to +66.5% in carbon footprint, +80% regarding EC or -57.4% in GPP. At the view of the above, it might not worth it to use the EC min -AnEn τ=0.1 strategy, and rather it would be more beneficial to choose another one that produces a better compromise among all services. If we observe the strategy that presents the smallest under-performance values of all, is the GPP min -AnEn τ=0.4 . So we could say that this strategy presents the best compromise for all the services, followed by the EC min -AnEn τ=0.5 strategy.

In order to complete this study, we present in table 4.11 a similar analysis as the one presented in table 4.10, but using a perfect forecast for all the scheduling strategies. This was considered valuable to be included in the discussion given that, though unrealistic, by default the perfect forecast is the best forecasting method for all the scheduling strategies. This allows a more uniform and fair comparison of the real impact that targeting one service has in the performance of the other services (regardless of the effects introduced by the forecasting methods), when performing energy management. In table 4.11 Regarding the energy-cost, the results show a similar behaviour, regarding the scheduling strategies, when using a PF as when using quantile forecasts. This means that, the best results of the EC indicator are obtained when the EC min strategy is used, followed by the results obtained with the CO2 min and GPP min strategies, respectively. This confirms that this service is sensitive to the scheduling strategy used, and it obtains its best performance when (EC min ) is used, as expected. Moreover, this service shows sensitivity regarding the forecasting method used, as overall, results obtained with PF (table 4.11) are lower than the ones obtained with quantile forecasts (table 4.10).

The grid-peak-power service also shows its sensitivity to the scheduling strategy, demonstrated by the GPP indicator, that shows better results when using the scheduling strategy that targets this service (i.e. CO2 min ). On the contrary, it does not seem to be that sensitive to the forecasting method used, as the results obtained in table 4.10 and 4.11 are the same for this indicator. The percentage with respect to the best result obtained for this indicator, is expressed as the percentage-difference in terms of the annual fee that must be paid depending on the contracted power required, as it was considered more meaningful for the purposes of this comparison.

A slightly different behavior is presented by the CO 2 reduction service, which seems to be more sensitive to the forecasting method, than to the scheduling strategy. This is demonstrated in table 4.11 by the fact that the same value for the CO2 indicator is obtained for the three scheduling strategies. On the contrary, differences are found with respect to table 4.10 where other forecasting methods were used. However, it is important to note that, the AnEn τ=0.3 forecast produced the same performance on this indicator as when using a PF. This remarks the added value of quantile forecasts when optimizing for this service, as it allows to obtain the same performance as the one obtained with an ideal -Perfect-forecast.

A similar behaviour is presented by the grid-commitment service that shows to be sensitive to the forecasting method more than to the scheduling strategy used. This is confirmed by the differences on the results obtained using quantile forecasts (table 4.10) and using PF (table 4.11), where the latter results outperform the former. It is important to remark here that when using PF, the GC obtains the best performance possible (100%) for the three scheduling strategies. This shows the non-sensitivity of this service to the scheduling strategy as expected, because this service is not targeted during the scheduling but during the balancing stage. However, it is clear that if the balancing module receives an unfeasible power profile proposal from the scheduling module (due to differences between forecast -scheduling-and real -balancing-PV-production), it might need to modify the scheduled grid profile, which is the reason why in table 4.10 the GC indicator obtained is different for each scheduling strategy and does not attain the 100% with any of them. Contrary to that, when PF are used, the optimal scheduled grid power profile generated by the scheduling module is rigorously followed during the balancing stage (because PV-production conditions are the same in both stages), then no modification of this profile is needed, hence the 100% performance of the GC. From this section we conclude that targeting one service (with its best schedulingstrategy + forecasting-method) affects negatively the performance on the other services (i.e. the best performance of each service is only achieved when the best combination of scheduling-strategy + forecasting-method for that particular service is used). However, a good compromise can be found with some combinations that yield satisfactory performance for all services. At the view of the above we wonder: can these results be affected by different seasonal conditions? How can these best combinations of "scheduling-strategy + forecasting-method" be adapted for each season? Could we further improve performance by Forecasts and energy management in a microgrid: Impact on services provided by a smart building applying seasonal EMS strategies rather than annual strategies? The answers to these queries are tackled in the following section.

Seasonal performance optimization and analyses

As every building is exposed to different conditions that have a seasonal behaviour (i.e. different degrees of accuracy of the PV forecasts, different PV production and consumption patterns, different prices of electricity and CO 2 content), the last question that arises regarding this analysis is: how much these seasonal effects, to which a SB is exposed, can affect either positively or negatively its performance? In order to answer this question we use in the first part NWP forecasts as reference with the three optimization-based scheduling strategies, and observe its performance for summer and winter (most and least accurate seasons for the NWP forecasts). The relative errors of the NWP approach for the different seasons of the year are shown in table 4.13. The relative errors of all the forecasting methods used in this work computed for every season of the year, as well as the annual results, are presented in Appendix A.

The results of the simulations for this part are summarized in table 4.12. In this table, the performance indicators of three of the services analyzed (EC, CO2 and GC) are presented for the EC min -NWP and CO2 min -NWP scheduling strategies. The GPP min strategy is not considered as the required contracted power GPP must be computed over the entire year, making it irrelevant if computed for one season. NWP forecasts are used as a reference -commercially available-forecasting method. Results are computed for winter and summer, which are contrasting seasons in terms of forecasting accuracy, as well as in electricity consumption, electricity prices and carbon footprint of grid electricity. The best performance of each indicator is highlighted in bold. Looking at the EC min -NWP strategy, its performance in EC is 150% worse in winter than in summer, which can be explained by the higher solar irradiance during summer (and a lower consumption), that allows to cover a high percentage of the consumption using the PV energy, which is cheaper. Besides, the grid usage is higher during winter (orange/red colors in figure 4.14(a)), and the prices of the grid electricity are higher during winter as well (see figure 4.2). This strategy seems to demand high power from the grid towards midnight during some winter days, as depicted by the purple/white points that we find in figure 4. 14(a) between January and march. This responds to the fact that the strategy has used all the energy stored in the battery during the day (as it is cheaper to use the battery in this period of the year when red days happen), therefore, it takes advantage at 22h (when electricity becomes cheaper according to the tempo tariff) to bring back the SoC of the battery to the required value of 50%, before midnight. The other strategies presented in figure 4.14(b),(c) do not present this behaviour, as they do not respond to the daily electricity pricing scheme of the tempo tariff.

The CO2 min -NWP strategy presents a similar behaviour for the CO2 indicator, where the performance in winter is 5.3% worse than in summer. If we take into account the fact that in winter, the use of the grid is higher (see figure 4.14(b)), due to both, less PV power availability and higher electrical consumption (see figure 4.14(d)), it is reasonable to have higher carbon footprint during winter; taking into account that the CO 2 content of the grid electricity is higher in this period of the year (see figure 4.2).

Even when the GPP indicator is not included in table 4.12, it is interesting to note the smoother color transitions (specially remarked in winter months) of the GPP min strategy (4.14(c)), with respect to the EC min strategy (4.14(a)) and the CO2 min strategy (4.14(b)). This brings out the proper performance of the GPP min strategy when smoothing the grid and battery power profiles.

It is interesting to note that, for the two scheduling strategies, the performance in the grid-commitment service is slightly better in winter than in summer, contrary to the other services analyzed above. Figure 4.15 presents the grid off-commitment power (GoC in equation 4.16) for the (a) EC min -NWP, (b) CO2 min and (c) GPP min strategies. From this figure we remark that the grid off-commitment power does not vary significantly throughout the year for any of the three scheduling strategies, as noted by the uniformity of the colors in the color plots. Values surrounding zero predominate for the three strategies, with some negative -greenish/blueish-values slightly concentrated towards the summer months. This slight increase in the GoC during summer, might be due to the fact that NWP forecasts tend to over-estimate a little bit in this period (i.e. positive value of rMBE for summer in table 4.13). As it was discussed in section 4.6.3, the forecasting errors caused by over-estimative As a second analysis, we take the best EMS strategy (i.e. best combination of scheduling strategy and quantile forecast) based on their performance for each service and for each season of the year. The summary of these strategies is presented in table 4.14. In this table, when a quantile forecast has two quantiles (e.g. AnEn τ=10:90 ), it means that any quantile from AnEn τ=0.1 to AnEn τ=0.9 yields the same (optimal) results for that strategy. It is already very interesting to note how, for a given scheduling strategy, the forecasts that produce the best results can be so different between seasons. For instance, if we use the CO2 min scheduling strategy, we require the AnEn τ=0.1 forecast in autumn to obtain the best results, whereas in summer or spring, is the AnEn τ=0.4 forecast the one that yields the best performance. In contrast, when using the GPP min strategy, any quantile forecast will produce the optimal performance in autumn, while is the AnEn τ=0.2 only in winter, who produces the best results. The versatility of using quantile forecasts for energy management is again highlighted here, as it permits to customize an EMS according to a particular service and season of the year, to obtain optimal performance. The strategies described in table 4.14 are run for each season, and the results are summarized in table 4.15. The values in parenthesis represent the percentage difference with respect to case when the same scheduling strategies are run using the -reference-NWP forecasts. We observe in these results that, most of the scheduling strategies that use quantile forecasts, achieved a better performance than the same scheduling strategies using NWP forecasts. The exception is the GPP during spring, summer and autumn, where there is no improvement, and the carbon footprint in summer that presented a marginal increase when using quantile forecasts. Even when some of the improvements are marginal, there are some others that are significant, such as the carbon footprint in autumn, that decreased 24.1% or the GPP in winter that decreased 16.7% when using quantile forecasts instead of NWP. This supports the added value of using quantile forecasts in energy management to obtain better performance by customizing the EMS strategy to different operating conditions and requirements.

Regarding the seasonality differences, we see clearly that, with the exception of gridcommitment (that achieved a 100% in all seasons), for the rest of services (i.e. EC, CO2 and Forecasts and energy management in a microgrid: Impact on services provided by a smart building GPP), the performance is always better in summer and spring and worst during winter and autumn. It must be recalled that several factors play a role in the differences in performance for the different services. Common to all of them, there is the annual variations in the consumption patterns, as observed in figure 4.14(d). There is also the annual variability in PV output power (i.e. PV power availability), as shown in figure 4. [START_REF] Ton | The U.S. Department of Energy's Microgrid Initiative[END_REF], where the intensity in the PV power available (e.g. red colors in summer months represent higher power available) as well as the longer duration of the night during winter months (i.e. more blue area in winter months), is a factor that clearly impacts the performance of a system powered by photovoltaic panels.

As mentioned previously, the accuracy of the forecasts also changes throughout the year, as seen in the tables of Appendix A. Besides the above mentioned aspects (common to all scheduling strategies), EC min and CO2 min are affected by the variations of the prices and CO 2 content of the electricity coming from the grid, as seen in figure 4.2. The sum of the effects of all these aspects, condition the response of the different scheduling strategies that try to find a way to achieve their goals under these constraints. In general, based on the results obtained, we can affirm that they succeed. A third question that arises after the results presented so far in this section, is if adopting a seasonal EMS strategy (i.e. using the strategies of table 4.14 during the corresponding season) produce better results, by the end of the test period, than using a unique EMS strategy for each service (i.e. EMS strategies of table 4.10) during the entire test period. The values in parenthesis of the seasonal strategies represent their percentage performance with respect to the case when the best annual-strategy for each service is used.

The results are summarized in table 4. [START_REF] Ton | The U.S. Department of Energy's Microgrid Initiative[END_REF], where we can observe that for the gridcommitment, the seasonal strategy presents only a marginal improvement of 0.1% over the annual strategy. Similarly, for the grid-peak-power there is no difference between both approaches. On the other hand, we have a marginal decrease of 0.5% in the CO 2 content for the seasonal strategy respect to the annual strategy, whereas the energy-cost experience a more significant reduction of 9.1% if the seasonal strategy is used. We can conclude then that the seasonal strategy presents an overall better performance with respect to the annual strategy. At the view of the results presented in table 4.14, where it is clearly stated that for the different seasons of the year, different forecasting methods should be used in order to obtain the optimal performance. Therefore, an annual strategy, that makes use of a single forecast throughout the test period, is expected to under-perform a seasonal strategy. We can then conclude that seasonal effects such as: prices of electricity, CO2 content, accuracy of forecasts, consumption and production patterns, do affect the performance in the services under study. There are seasons that present conditions that allow better performance (summer, spring) than others (winter, autumn). Best seasonal strategies are different than annual strategies and we proved that using seasonal strategies yield better performance than using annual strategies in some services such as the energy-cost, while for other services it seems to be indifferent (e.g. GPP).

The complete information about the annual and seasonal performance for all the EMS strategies proposed in this study, can be found in Appendix B. At the moment of writing, an article containing the most important findings of this chapter is being prepared.

Forecasts and energy management in a microgrid: Impact on services provided by a smart building

Conclusions

There are several subjects that have been tackled in this chapter, as well as several conclusions to draw. Based on the results of section 4.6.1, we can affirm that an EMS with optimizationbased scheduling strategies, as the ones hereby proposed, is able to outperform the different reference strategies in every service, with improvements up to 50% in some cases, with the exception of the carbon footprint, where having no MG produces, in average, 4.9% less carbon emissions. From this result, it is important to remark that, taking into account the embedded CO 2 emissions of the battery and PV panels, as well as the electricity mix of the country, play an important role in defining if the implementation of a MG can provide reductions in CO 2 emissions or not.

According to what is presented in section 4.6.2, we can state that more accurate forecasts result in a better performance, particularly for EC and CO2 indicators. However, PF is not a realistic scenario, as most likely we will always have forecasting errors. Then, comparing a realistic -more accurate-forecast such as NWP, with a less accurate forecast such as AnEn τ=0.1 , in an annual base, shows that for some services (i.e. grid-commitment and grid-peak-power), the most accurate forecast does not produce the best performance. This fact is supported if we see the seasonal analysis presented in section 4.6.5, where in order to obtain optimal performance in the different seasons of the year, different quantile forecasts must be used. It seems that for some services, the fact of knowing the sense of the forecasting error (i.e. if it is an under or over-estimative forecast) is more beneficial than having a very accurate forecast.

The results presented in section 4.6.3 suggest that all services are sensitive to the forecast quantile used and the optimum quantile depends on the service. In this way, quantile forecasts allow to customize the EMS strategies to different services and weather conditions. The EMS tends to counteract the errors of pessimistic forecasts via PV curtailment, while it compensates the errors of optimistic forecasts mostly using the grid. Hence, if a service such as GC is the optimization objective, pessimistic forecasts (i.e. quantiles less than AnEn τ=0.5 ) produce the best results. In an annual-based analysis, quantile forecasts permit to obtain better performance in EC, CO2 and GC, however, the improvement is mostly marginal. At the same time, in a seasonal-based analysis, the advantages of using quantile forecasts can be more significant, achieving improvements in performance of 16.7% for GPP during winter or 24.1% for CO 2 emissions during autumn, with respect to the base-case NWP forecasts. We also realized the importance of including the cost and embedded carbon content of the energy delivered by the battery and PV panels in the calculations, as well as the significance of correcting those values based on the battery-cycling-life reduction and PV power curtailment.

Those aspects showed to have an important impact not only in the magnitude of the resulting values of performance, but also in their behaviour.

In section 4.6.4, we observed how the best service indicator is found when the scheduling optimization is oriented for that service. This implies that when the scheduling strategy optimizes for one service (i.e. its target service), the system will under-perform in the other services (i.e. the non-targeted services). Results of tables 4.10 and 4.11 show how the energy-cost is sensitive to both, scheduling strategy and forecasting method used, whereas the grid-peak-power seems to be sensitive to the scheduling strategy only. Regarding the carbon footprint reduction, this service seems to be more sensitive to the forecasting method than to the scheduling strategy. This is demonstrated in table 4.10 by the fact that the same value for the CO2 indicator is obtained for the three scheduling strategies. A similar behaviour is presented by the grid-commitment service that shows to be sensitive to the forecasting method more than to the scheduling strategy used, as confirmed by the better performance obtained when using PF. As this service is targeted during the balancing stage, it is reasonable to think that it is less sensitive to the scheduling strategy, and that is the reason why, when using PF, the same performance (i.e. GC=100%) is obtained for all the strategies.

In the search of a strategy that presents a good compromise in performance among all services, we observe that targeting the grid-commitment is the most expensive decision, as it is the one that affects more negatively the other services. In other words, if we use the EC min -AnEn τ=0.1 scheduling strategy that yields the best results for GC (99.9%), the under-performance in the other services is particularly high (much higher than the other scheduling strategies). This is due to the massive PV curtailment provoked by the use of a very pessimistic forecast (AnEn τ=0.1 ). This seems not be worth it, as the improvement on the GC indicator is marginal compared to the performance obtained in this indicator using the other strategies (e.g. 1.2% improvement maximum). Therefore, a good compromise to obtain fairly good performance in all services, seems to be the GPP min -AnEn τ=0.4 strategy, followed by the EC min -AnEn τ=0.5 strategy. However, the selection of the strategy that produces the best compromise among all services, will depend on the order of priority among the services dictated by the final user.

Results of section 4.6.5 tells us 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, while autumn is the period when the energy is more loaded with CO 2 . It is important to remark that there are several variables such as: consumption and PV production profiles, electricity prices and carbon footprint of the grid electricity, that vary throughout the year and in this way, they condition the performance achieved by the EMS strategies. Isolating Forecasts and energy management in a microgrid: Impact on services provided by a smart building the effects of each of those variables is out of the scope of this study, however it would be of interest to perform this study in a further stage of the research. As quantile forecasts allow to customize 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 beneficial only regarding the energy-cost, where a decrease of up to 7.3% can be achieved. This strategy actually produces a marginal increase in the carbon content of 1.6% with respect to the annual strategy, while performance in contracted power (GPP) and grid-commitment (GC) are practically unaffected by the chosen strategy.

Perspectives for further research

This work, opens up many pathways for further research, in order to deepen into the subjects tackled in this chapter. For instance, the exploration of different services in a SB such as thermal comfort, would be of interest as it plays an important role in any building. Users expect the building to provide them with a temperature that allows the proper development of the activities, being at the same time (cooling/heating), the aspect that represent the biggest percentage of the electrical consumption in our study-case building, and it might be the case for many others.

To assess the impact that the implementation of a demand-side-management strategy in the SB could have, would be of interest to evaluate not only its feasibility but also its eventual contribution with the services presented in this study. The integration of this new service into the scheduling and balancing strategies would be an interesting subject to deepen into.

In this work, the initial state-of-charge of the battery was set to 50%. In order to have the same margin every day to compensate over and under estimations of PV power production. But given that we are using forecasts, which are known beforehand to either over or under-estimate PV production, it would be interesting to explore how different levels of initial and final state-of-charge of the battery complement different quantile forecasts, as under-estimative forecasts might benefit from lower states-of-charge, while over-estimative forecasts might benefit from higher states-of-charge.

Regarding to leave the the proposed EMS strategy also meany, it would be of major interest to implement optimization in the balancing module. In this study it was based on rules, so eventually the contribution provided by this module could be boosted if an optimization strategy, either with receding horizon and/or rolling horizon, is implemented. For this, the use of intra-day PV output power forecasts would be of interest to study, with the view to further improve the performance of the balancing module. An interesting collaborative 4.8 Perspectives for further research 135 strategy should be implemented in this case in order to assure the agreement between the optimization objectives of the scheduling and balancing modules. The comparison of the results with other EMS approaches such as decentralized/agent-based, would be an important step to validate the usefulness and performance of the strategy.

In this work, the electrical consumption was considered known beforehand as well as the CO 2 content of the grid electricity. In reality, these two variables are stochastic variables, therefore they should be foreseen. Developing forecasts strategies for these variables (e.g. using the AnEn for these variables too), would be very interesting in order to be closer to a system that can be implemented in a real-life case, where forecasts of all the stochastic variables, can be generated when required.

It would be also interesting to discretize the seasonal analysis by months, to see if this can boost the performance of the seasonal EMS strategy. If positive results were obtained, it would be interesting to implement a seasonal EMS strategy in the study-case SB.

After having completed the hardware installation in the Drahi-X building, it would be of interest to actually implement an EMS as the one proposed in this work, to see what are the practical constraints encountered, and the feasibility of implementing it in real-life. If the implementation of such a system is successful, it would be very interesting to observe if the output and performance obtained in this work match the ones obtained during real-life operation.

Chapter 5 General conclusions and perspectives

As the world is leaning headlong towards a renewable-energy based energy matrix, due to the delicate breaking point we are living regarding global warming, all the efforts aligned in this direction are welcome, in order to prepare this renewable-energy transformation. As it is mostly recognized by the scientific community, the limited dispatchability, variability and uncertainty of the intermittent renewable energy sources, are the main hindrances that are keeping these type of energy sources from a massive deployment. From this urge to find solutions to deal with the mentioned hitches, emerged this research project that in a transversal approach tackles the subject from the hardware, resource-forecasting and energymanagement sides, trying to profit from their complementarity in order to find meaningful and applicable solutions to the aforementioned issue.

As the new NRLAB (Nanogrid Research Laboratory) was being created as part of an interdisciplinary research initiative with the aim to have a tool for pedagogical, research and demonstrative applications in the field of renewable energy production, building a physical microgrid that could support those activities was considered a pertinent starting point for this project. This part of the work was devoted to the conception, construction and testing of a laboratory-scale nanogrid, with data collection, communication, user-interfacing and energy-management capabilities that would allow the attainment of the objectives.

Three iterations were required to achieve a reasonable level of functionality, each of them revealing challenges and sometimes unexpected issues that had to be analyzed in order to find a proper solution. We can state that this improvement process, which involved diving into different areas (such as metrology, power systems, basic and power electronics, applied engineering, meteorology, physics, cost-estimation and budgeting, material purchase, interdisciplinary team-work, students tutorship, among others) allowed a lot of constructive and useful outcomes, which makes good results of this part of the work.

General conclusions and perspectives

Not only a laboratory-scale nanogrid with the potential to serve as a testbench for a real-size microgrid was attained, but from its very conception phase produced demonstrative and pedagogical deliverables from which many students profited from, including the author of this work. In the technical part, key aspects regarding measurements collection and accuracy, power flows control, PV forecasting, costs and technical constraints regarding energy management were clearly identified, which helped not only to achieve the objectives of this part, but also to motivate and guide the studies to be performed in the following stages.

The difficulties posed by some of the technical constraints encountered during the development of the physical system lead to the creation of a web-based interactive game, inspired in the physical nanogrid, that came to expand the scope by allowing to explore the load-scheduling and demand-side-management schemes, giving at the same time, access to a bigger number of students to profit from this pedagogical experience. The several practical exercises performed throughout the last 3 years with this game, as well as with the physical nanogrid, proved that both are complementary tools that are useful to address complex systemic questions on microgrids and energy management.

The game threw insights regarding the importance of forecasts as the base to perform any resource-scheduling in a microgrid, that confirmed the importance of performing the study developed in the second part of this thesis. The main motivation of this section was to propose a method to extract information regarding the uncertainty of readily-available deterministic forecasts from numerical weather predictions (NWP). As it was observed that forecasts are the base for any type of time-ahead scheduling, we came up with the hypothesis that having some probabilistic information regarding the forecasts being used, could provide an added value when performing energy management of a microgrid that could be reflected in an improvement in performance.To achieve this goal, an adapted analogs-ensembles method was proposed, that was calibrated for the site of Ecole Polytechnique, where a microgrid was being deployed on a tertiary building (the Drahi-X Novation Center). This method showed not only its versatility in producing statistically meaningful probabilistic information from commercially-available deterministic forecasts, but proved to outperform benchmark methods such as monthly-climatology, persistence or a calibrated output of the well-known ensemble prediction system produced by the European Centre for Medium-Range Weather Forecasts (ECMWF). Moreover, the use of quantile forecasts, extracted from the ensembles generated by our adapted analogs-ensembles method, provided a interesting tool to integrate the uncertainty information contained in the ensembles distributions, into an energy management system of a microgrid.

In a following stage, an energy management scheme was developed, envisaging its eventual application in the Drahi-X microgrid, that allows the integration of the probabilistic information of the forecasts produced in the previous part of this work. Making use of some of the insights obtained in Chapter 3, several objectives were established as "services" to be offered by a smart-building (i.e. the Drahi-X, in our case study application), to study the impacts in performance when targeting each of them. The services proposed were: energy cost, carbon footprint, grid peak power and grid commitment. While energy cost and carbon footprint are common services used by the scientific community when it comes to the performance evaluation of energy management strategies, the grid peak power and the grid commitment were found to be little explored in the domain of microgrids. In particular, the grid commitment is considered to have a great potential in the facilitation of renewables to be massively deployed -through distributed generation-, as it gets rid off the uncertainty problem in the utility-grid side, by dealing and counteracting it internally with the resources available in the microgrid. The energy management strategies proposed in this part, present a two-stage structure that allows not only to favor the grid-commitment by default, but also to target another service among the three remaining objectives (i.e. energy cost, carbon footprint, grid peak power). The results have shown the efficacy of these strategies, along with the use of quantile forecasts, to improve performance with respect to reference scenarios with basic -or nonexistent-energy management strategies, as the one planned to be implemented in the Drahi-X microgrid at its first stage (by the second half of 2020). The analysis performed yielded interesting results regarding the antagonism among some of those services, as well as possible strategies to find a good compromise among all of them, which was one important objective set for this section. The value of quantile forecasting as a mean to integrate probabilistic/uncertainty information of forecasts into an energy management system, and to produce further enhancements in performance was also verified.

Due to the time-limited nature of a PhD, several subjects were opened-up to the discussion but no time was available to go into details or even exploring them at all, leaving space for future research through other PhD thesis or post-doctoral projects. We classify these related research pathways in four five main axes:

• Implementation of -at least some-of the energy management strategies developed in Chapter 4 in the NRLAB nanogrid

• Complementing the day-ahead scheduling strategies hereby proposed with intraday/real-time optimal energy management to further enhance performance

• Complementing those strategies with demand-side-management schemes as the ones explored with the game in Chapter 2

• Finding quantitative indicators for human satisfaction in different aspects related to human "comfort", so that it can be included in the decision-making process of the energy management system

Appendix B Performance results

In this section, the results of all the scheduling strategies proposed in chapter 4 are presented. Calculations are performed using all the forecasting methods available, for all the seasons of the year as well as for the entire test period (annual results). This appendix has been referenced in chapter 4. for lower quantiles the cost continue to grow? The reason lies in the fact that, when very under-estimative forecasts are used, there will be big errors that will have to be counteracted by means of curtailment of PV power, which in turns implies buying more energy from the grid, that compared to the PV energy is much more expensive. As a summary, we could say that the decrease in cost of the "right" part of figure C.1(a) is mostly due to less use of battery, while the increase of cost on the "left" part of the graph, is mostly due to a high PV curtailment. These results can be confirmed in figures C.2(a) and C.2(b), where the PV curtailed power and the SoC of the battery, for the entire test period and hours of the day (left axis), is shown, for forecasts AnEn τ=0.1 and AnEn τ=0.9 , respectively. These results were obtained with the EC min scheduling strategy. There, is clear how for the AnEn τ=0.1 forecast, the amount of PV power curtailed is higher, as well as the overall use of the battery that spends more time with a high SoC. This means that the battery has more energy stored ready to be delivered to the load. On the contrary, in figure C.2(b) for the AnEn τ=0.9 forecast, the PV curtailment is practically zero, and the overall SoC of the battery is low throughout the test period.

It is interesting to note here the difference in the behaviour between the winter and the summer months. For the AnEn τ=0.1 forecasts, battery reaches its highest SoC values in the summer as well as the PV curtailment (due to a surplus of PV output power). On the other hand, in figure C.2(b) (AnEn τ=0.9 forecast), it is worth to mention that the battery seems to be full more time during winter, which might be counter-intuitive as in winter there is less solar irradiation. But this is the result of the EMS, that charges the battery during early morning hours, when the electricity is cheaper, in order to use that energy during the peak hours when the electricity is more expensive, specially during the "red-days" according to tempo tariff (see figure 4.1). During these days, the prices of electricity during peak hours can be almost 3 times higher than the cost of the electricity coming from the battery. In conclusion, the EC min strategy is able to decrease both, the use of the battery and the EC.

Regarding the performance in carbon footprint, figure C.1(b) shows a different behaviour, where a minimum of CO 2 is found for the AnEn τ=0.4 forecast, but it is still higher than the one obtained using NWP forecasts. It is important to recall that in the results presented in figure C.1, the battery life correction and the PV CO 2 content are not taken into account. This explains why for lower quantiles, when the curtailment of PV is high, the CO 2 contents increases up to 3.2%, as more energy from the grid and battery must be used. The slight increase up to 0.9% for higher quantiles, might be due to the decrease in the grid commitment, which cause the MG to buy grid electricity in sub-optimal moments, when the CO 2 content might be higher. This is clearly seen in figure C.3, where the PV curtailment and the grid off-commitment(i.e. the difference between the scheduled and real grid power profiles)

4/12

From the previous measurements, we are going to obtain the joule losses in this branch of the system (from power source to load). For this, subtract the power being consumed by the load to the power coming from the battery, as follows:

𝐽𝑜𝑢𝑙𝑒 𝑙𝑜𝑠𝑠(𝑊) = 𝑃 𝑝𝑜𝑤𝑒𝑟 𝑠𝑜𝑢𝑟𝑐𝑒 -𝑃 𝑙𝑜𝑎𝑑 [START_REF] Fahad | Microgrids energy management systems: A critical review on methods, solutions, and prospects[END_REF] Besides, we are going to express the previous losses as a percentage of the power being delivered by the power source. This is the amount of power that we are wasting in the form of heat. That can be computed from the data in table 1 using equation 2 as:

𝐽𝑜𝑢𝑙𝑒 𝑙𝑜𝑠𝑠(%) = 100 * 𝐽𝑜𝑢𝑙𝑒 𝑙𝑜𝑠𝑠(𝑊) / 𝑃 𝑝𝑜𝑤𝑒𝑟 𝑠𝑜𝑢𝑟𝑐𝑒 [START_REF] Haupt | The use of probabilistic forecasts: Applying them in theory and practice[END_REF] Finally, find the equivalent resistance 'R' of this branch of the circuit (from the power source to the load) for each load condition using equation 3: 𝐽𝑜𝑢𝑙𝑒 𝑙𝑜𝑠𝑠𝑒𝑠(𝑊) = 𝑅 * 𝐼 2 𝑅 (𝑂ℎ𝑚𝑠) = 𝐽𝑜𝑢𝑙𝑒 𝑙𝑜𝑠𝑠𝑒𝑠(𝑊) / 𝐼 2 (3)

Use equations ( 1),( 2) and (3) to complete table 1.

Obtain the average value of the branch resistance 'R' for the data in table 1.

Use a spreadsheet software (like Microsoft Excel) to plot Joule losses(W) vrs load-current. With this plot you can verify the quadratic behavior of the Joule losses dictated by the theory according to equation 3.

Temperature effect on solar panels

Another important aspect that decreases the efficiency of PV-powered microgrids is the temperature. In general, with an increase of panel temperature it comes a reduction in the output power of the panel under equal solar irradiance. In other words, the PV panel will produce less power as it heats up. We are going to find the dependency between the output power and the panel temperature as well as the percentage of power that is lost due to this effect.

Procedure

Connect the relays of the PV panel, load and battery branches and disconnect the relay of the power source branch. Fix the load to 50W.

Start the fan of the solar simulator in the maximum speed. Turn on the halogen lights and using the dimmer adjust the irradiance so that we have an output power of 50W (2kW with the scale factor) coming from the PV panel. Note: Do this step as quickly as possible because once the lights are on the PV panel will start to heat up.

Start immediately to take measurements of PV panel output-power and panel temperature every 20 seconds during the first 3 minutes, every 30 seconds for the next 3 minutes and every minute during the next 4 minutes. You can use the laser thermometer to take the temperature measurements.

5/12

You can then proceed to fill up columns 2 and 3 of table 3. After finishing the previous step, you can compute the percentage of power that is lost due to the heating of the PV panel. This is computed as a ratio between the instantaneous power at time t and the power when the PV panel was 'cold' (t=0). Use equation 4 for that calculation and fill up the last column of table 3.

6/12

𝑃𝑜𝑤𝑒𝑟 𝑙𝑜𝑠𝑠(%) = 100 * 𝑃𝑉𝑜𝑢𝑡𝑝𝑢𝑡 𝑝𝑜𝑤𝑒𝑟@𝑡=0 -𝑃𝑉 𝑜𝑢𝑡𝑝𝑢𝑡 𝑝𝑜𝑤𝑒𝑟@𝑡 𝑃𝑉 𝑜𝑢𝑡𝑝𝑢𝑡 𝑝𝑜𝑤𝑒𝑟@𝑡=0 (4)

Use a spreadsheet software (like Microsoft Excel) to plot the PV output power vrs panel temperature. Make a fitting curve for the data (choose the type of fit that adjust better to the data) and find its equation. This equation will give you and approximation of the power output of the PV panel as a function of its temperature. What would be the output power if the panel reaches 90 °C? what would be the percentage of power loss in this case? do you think is possible to reach this temperature for a solar panel installed in real conditions?. Do a quick research in internet to find out what are the temperatures that PV panels can reach in different environments.

Power flows

An (electrical) power flow could be defined as the flow of electrical power between two 'nodes' that are interconnected in an electrical system. Understanding how power flows behave in an electrical system and how they can be 'manipulated' is important to understand the role of the energy management system (EMS) of a microgrid. The EMS optimizes the operation of the microgrid (based in costs and losses, among others), and to achieve this goal it has to manipulate the power flows.

Management control: the power source voltage

In a DC microgrid like the one in our lab the power flows management is achieved with the voltage control. In particular, the power source voltage is the degree of freedom that is left to the manager. Let's see the voltage control principle through the following experiment.

To start, make sure all the branches are disconnected. Turn on the adjustable power source make sure output voltage is set to 12V and the current limit to 20A. Now connect the branches of the power source, battery and load. Fix the load value to 40 Watts. Decrease or increase the output voltage of the power source so that you get zero power flowing from the power source. At this point, the power source is "floating" on the microgrid (it is turned on and connected, but it does not delivers any power). We will call this the "floating point" of the power source.

From this point, we will start taking measurements in table 2.

Note: Is better to take the measurements directly in excel

To support your results, make the plots of V , P and I vrs measurement number. You can do one graph for each variable (one for V, one for P and one for I) including the 3 gauges in the same graph.

From the previous graphs, identify the point where the battery starts getting charged (the point where the power flow to the battery changes sign). Take a look on the voltages before and after this point. What can you note? Who imposes the voltage of the system(voltage on the load) before and after this point?

Besides, From where is the power flowing in the system when the battery is charging? and when the battery is discharging? (identify these points on the graphs).

Based on the previous results, what is the condition required for the battery to get discharged? charged? (assume a constant load) From the last experience, in general, what was the mechanism utilized to manipulate/control the power flows of the battery and power source?

8/12
Load and PV volatility During a real life operation of a microgrid of our kind (offgrid, with PV+battery+gen set) one have to face two events that challenge the offer-demand equilibrium:

-Solar PV power variability (stochastic and cloud-driven) -Load demand peaks and changes

Let's simulate (in the following subsections A, B and C) these two events with our lab set and note how the system reacts.

A -Variable power source -fixed load (Current control)

Now, from the last point (when we had 40W flowing to the battery and 40W flowing to the load), decrease the current limit of the power source until the point where the current limit equals the actual current value. We will start taking measurements from this point. Decrease the current limit in fixed steps of 0.5A and take measurements at each point until you get zero current flowing from the power source. Fill up table 5.

Note: You can take the measurements directly in excel

To support your results, make the plots of V , P and I vrs measurement number. You can do one graph for each variable (one for V, one for P and one for I) including the 3 gauges in the same graph.

Identify the point where the power flowing to the battery changes sign. How do voltages behave before and after this point compared to the behaviour obtained in the previous exercise? are they different? From where to where is the power flowing in the system when the battery is charging? and when the battery is discharging? (identify these points on the graphs).

It is interesting to note that even when the output voltage of the power source was not changed, we managed to manipulate the power flows of the system. What was the mechanism used to manipulate the power flows in this case? what are the differences, advantages or disadvantages of this method compared to the voltage control studied in section A.1?

B -Variable load -fixed and "unlimited" power source Set the nominal load to 50 Watts. Increase again the current limiting knob of the power source to 20A. Adjust the voltage of the power source so that you have 25 watts flowing from the battery and the other 25 watts flowing from the power source. Let's call this point the 'Middle Point (MP)'.

Then, bring the load to zero and start increasing it steps of 10 Watts until reaching 100W nominal (use the built-in gauge of the load to set nominal values). Take measurements at every step and fill up table 6.

10/12 Does the battery ever get charged according to the plots? at which point (nominal load) does this occur? is there any other interesting remarks that you can extract from the plots? Does the 50%-50% splitting of the power (the one we had in the middle point) continues for all the measurements 'above' or 'below' the middle point? if not, what do you think is the reason?

C -Variable load -fixed and limited power source

We will repeat the procedure of the previous exercise but now we are going to limit the power source. This is a realistic situation as the PV panels in a microgrid have a maximum power they can deliver, and this is often surpassed by the demand.

Let's come back to the 'middle point (MP)' used in the last exercise using the same procedure. After reaching this point (half of the load-power delivered by the battery and half by the power source), let's decrease the current limit of the power source until the point where the current limit equals the actual current value. This will be the new current limit of the power source (the power source cannot deliver more current/power than this). This simulates a PV array for instance, given that its output power is limited by the solar irradiance it receives at any given moment.

11/12

Follow the same procedure performed in the last exercise. Bring the load to zero and start increasing it steps of 10 Watts until reaching 100W. Take measurements at every step and fill up table 7. Compare the results of the plots with the ones of the previous exercise, before and after the middle point MP. Are there any significant differences between them? how would you explain them?

D-Real time PV production (Demonstrative exercise)

In this section, the tutor will run the microgrid in real time (either with the external solar panel or with a simulated irradiance profile in the solar simulator) and you will observe the real-time curves of power for the different elements of the system. From these curves, many information can be extracted and analyzed as different situations or scenarios regarding irradiance and load occur, changing completely the state of the system (voltage, losses, power flows, etc)

6-The consumption in an islanded house is 10kWh on a particular day. If you have a battery of 5kWh (full at the beginning of the day), how much PV power should you install in order to be 100% self-sufficient? 13-Why before 9am, most of the load was supplied by the power source and after 5pm that was entirely done with the battery (even though both the power source and the battery where connected all the time)?

The power source can deliver more power than the battery

The power source can deliver more energy than the battery the battery was discharged before 9am and charged after 6pm

14-Which day had the highest PV energy consumed ?

The first day The second day Both days were similar

1. 1

 1 View of the main entrance of the Drahi-X Novation Center of Ecole Polytechnique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Schematic of the future Drahi-X microgrid . . . . . . . . . . . . . . . . . . 2.1 Microgrids classification. Taken from [1] . . . . . . . . . . . . . . . . . . 2.2 Evolution of the NRLAB nanogrid . . . . . . . . . . . . . . . . . . . . . . 2.3 Schematic of the data collection system of the Nanogrid . . . . . . . . . . . 2.4 Physical appearance of the current version of the NRLAB nanogrid . . . . . 2.5 Monitor and control interface of the nanogrid developed using Node-RED . 2.6 Important learning outcomes embodied in the power plots generated by the nanogrid interface. Sample day: 2019-10-13 . . . . . . . . . . . . . . . . . 2.7 Tests of the battery power control algorithm in discharge (a) and charge (b) regimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8 Offset of the battery power control algorithm in discharge (a) and charge (b) regimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.9 Limitations of the nanogrid revealed by the power plots generated by the interface. Sample day: 2019-10-13 (as in figure 2.6) . . . . . . . . . . . . . 2.10 Missing data and constant-load periods from 2019-07-21 to 2019-08-15 due

60 3 . 4

 34 Quantile skill score, reliability and resolution of the quantiles with nominal probabilities 0.1 and 0.9 of the AnEn as a function of the number of members 64 3.5 Ensembles of analogs obtained with the proposed AnEn method for 03-08-2018 (a) and 07-06-2018 (b) for the site of École polytechnique. The forecasts (yellow curve) correspond to the day-ahead NWP outputs from the ARPEGE model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 3.6 Percentile 10 (τ = 0.1) and 90 (τ = 0.9) for ensembles generated with the AnEn method (a), the MoCl (b), the PeEn (c) and the GlCl (d) for 03-08-2018 66 3.7 Forecast errors (rMAE) of the ensemble mean as a function of normalized sharpness in boxplot representation for the AnEn method. The green line represents the median and the boxplot limits are the quantiles τ = 0.25 to τ = 0.75 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 3.8 Comparison of the hourly sharpness for different forecasting methods . . . 69 3.9 Normalized sharpness vs the daily CSI for the PeEn, MoCl and AnEn methods. The colorscale represents the rMAE for the ARPEGE-D deterministic forecast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

)

  . . . . . . . . . . . . . . . . 4.9 Reasoning flow followed in section 4.6 to tackle the main queries required to answer the main research question of Chapter 4 . . . . . . . . . . . . . . . 4.10 State-of-charge resulting from the battery power profile generated by the (a) GPP min , the (b) PVB max and the EC min scheduling strategies, using the NWP forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.11 Impact of probabilistic forecasts in (a) the energy cost (EC) using the EC min scheduling strategy and in (b) the carbon footprint (CO2) using the CO2 min scheduling strategy. Results include correction for projected battery cycling life reduction (relative to nominal) and PV curtailment . . . . . . . . . . . 4.12 Impact of probabilistic forecasts in (a) the grid contracted power (GPP) using the GPP min scheduling strategy and in (b) the grid-commitment (GC) and self-consumption rate (SC) using the CO2 min scheduling strategy. Results include correction for projected battery cycling life reduction (relative to nominal) and PV curtailment . . . . . . . . . . . . . . . . . . . . . . . . . 4.13 PV power curtailment and grid off-commitment power for AnEn τ=0.1pessimistic-(a) and AnEn τ=0.9 -optimistic-(b) quantile forecasts, using the GPP min scheduling strategy. Power values are hourly averages . . . . . 4.14 Grid power for the EC min -NWP (a), CO2 min -NWP (b) and GPP min -NWP (c) scheduling strategies, as well as the consumption (d) for the test period. Power values are hourly averages . . . . . . . . . . . . . . . . . . . . . . . 4.15 Grid off-commitment power for the EC min -NWP (a), CO2 min -NWP (b) and GPP min -NWP (c) scheduling strategies during test period. Power values are hourly averages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.16 Daily available PV power during the test period (hourly average values) . . C.1 Impact of probabilistic forecasts in (a) the energy cost (EC) using the EC min scheduling strategy and in (b) the carbon footprint (CO2) using the CO2 min scheduling strategy. Results without correction for battery cycling life reduction. No PV costs taken into account . . . . . . . . . . . . . . . . . . . . .

Figure 1 . 1

 11 Figure 1.1 View of the main entrance of the Drahi-X Novation Center of Ecole Polytechnique

Figure 1 . 2 3 ×

 123 Figure 1.2 Schematic of the future Drahi-X microgrid

Figure 2 . 1

 21 Figure 2.1 Microgrids classification. Taken from [1]

Figure 2 . 2

 22 Figure 2.2 Evolution of the NRLAB nanogrid

Figure 2 . 3

 23 Figure 2.3 Schematic of the data collection system of the Nanogrid

Figure 2 . 4

 24 Figure 2.4 Physical appearance of the current version of the NRLAB nanogrid

Figure 2 . 5

 25 Figure 2.5 Monitor and control interface of the nanogrid developed using Node-RED

Figure 2 . 6

 26 Figure 2.6 Important learning outcomes embodied in the power plots generated by the nanogrid interface. Sample day: 2019-10-13

Figure 2 . 7

 27 Figure 2.7 Tests of the battery power control algorithm in discharge (a) and charge (b) regimes

Figure 2 . 8

 28 Figure 2.8 Offset of the battery power control algorithm in discharge (a) and charge (b) regimes

Figure 2 . 9

 29 Figure 2.9 Limitations of the nanogrid revealed by the power plots generated by the interface. Sample day: 2019-10-13 (as in figure 2.6)

Figure 2 .

 2 Figure 2.10 Missing data and constant-load periods from 2019-07-21 to 2019-08-15 due to unexpected outages of the data collection system or communication problems

2. 4 29 Figure 2 .

 4292 Figure 2.11 Example of the experimental calculation of the equivalent resistance of the circuit by measuring the power losses due to the Joule effect

Figure 2 .

 2 Figure 2.14 Sample question of the quiz, based on plots taken from the nanogrid interface

Figure 2 .

 2 Figure 2.15 Load scheduling game dashboard. Type of day selection (solar irradiance and electricity price), PV potential production, scheduled consumption and SoC profiles

Figure 2 .

 2 Figure 2.16 Flow diagram of the rules followed by the load-scheduling game

Figure 2 .

 2 Figure 2.17 Half-hour power flows distribution shown in the dashboard of the load-scheduling game

  .19.

Figure 2 .

 2 Figure 2.19 Example of the results summary displayed at the end of the load scheduling game

Figure 3 . 2

 32 Figure 3.2 Diagram that sketches the working principle of the AnEn method

13 .

 13 The results of the first screening regarding the correlation of different forecast variables from different sources (ARPEGE-D and D+1, AROME-D and D+1) are presented in figure 3.3.

Figure 3 . 3

 33 Figure 3.3 Correlation weights of the predictors obtained with the RReliefF algorithm.

case 1 :

 1 training period length of 1 year case 2 : training period length of 2 years

9 Figure 3 . 4

 934 Figure 3.4 Quantile skill score, reliability and resolution of the quantiles with nominal probabilities 0.1 and 0.9 of the AnEn as a function of the number of members

Figure 3 . 5 Figure 3 . 6

 3536 Figure 3.5 Ensembles of analogs obtained with the proposed AnEn method for 03-08-2018 (a) and 07-06-2018 (b) for the site of École polytechnique. The forecasts (yellow curve) correspond to the day-ahead NWP outputs from the ARPEGE model

Figure 3 . 7

 37 Figure 3.7 Forecast errors (rMAE) of the ensemble mean as a function of normalized sharpness in boxplot representation for the AnEn method. The green line represents the median and the boxplot limits are the quantiles τ = 0.25 to τ = 0.75

3. 6 69 Figure 3 . 8

 66938 Figure 3.8 Comparison of the hourly sharpness for different forecasting methods

Figure 3 . 9

 39 Figure 3.9 Normalized sharpness vs the daily CSI for the PeEn, MoCl and AnEn methods. The colorscale represents the rMAE for the ARPEGE-D deterministic forecast

Figure 4 . 1 EDF

 41 Figure 4.1 EDF Tempo pricing schedule[START_REF] Tempo | Grille tarifaire en 2020 et CGV[END_REF]

Figure 4 . 2

 42 Figure 4.2 Hourly grid electricity prices and CO 2 content during the test period

Figure 4 . 3

 43 Figure 4.3 Value chain of four services provided by a smart-building

Figure 4 . 4

 44 Figure 4.4 Cycling life of a Li-Ion battery as a function of its SoC ave (blue) and DoD ave (orange)[START_REF] Muenzel | A Multi-Factor Battery Cycle Life Prediction Methodology for Optimal Battery Management[END_REF]

Figure 4 . 6

 46 Figure 4.6 Flow diagram of the genetic algorithm

4. 5

 5 Proposed two-step energy management system 101 4.5.2 The scheduling module

4. 5

 5 Proposed two-step energy management system 105 4.5.

Figure 4 . 7

 47 Figure 4.7 Working principle of the balancing strategy GC max . The output of the scheduling module (P scheduled grid ), the consumption (P load ) and the real PV output (P mppt pv ) are the inputs of this module

Figure 4 . 8

 48 Figure 4.8 Flow diagram of the reference PVB max strategy. It works as a balancing strategy if real PV-production (P mppt pv ) is given, while it performs scheduling if PV forecasts are provided instead (P f orecast pv

Figure 4 .

 4 Figure 4.10 State-of-charge resulting from the battery power profile generated by the (a) GPP min , the (b) PVB max and the EC min scheduling strategies, using the NWP forecasts

Figure 4 .

 4 Figure 4.11 Impact of probabilistic forecasts in (a) the energy cost (EC) using the EC min scheduling strategy and in (b) the carbon footprint (CO2) using the CO2 min scheduling strategy. Results include correction for projected battery cycling life reduction (relative to nominal) and PV curtailment

Figure 4 .

 4 Figure 4.13 PV power curtailment and grid off-commitment power for AnEn τ=0.1 -pessimistic-(a) and AnEn τ=0.9 -optimistic-(b) quantile forecasts, using the GPP min scheduling strategy. Power values are hourly averages

Figure 4 .

 4 Figure 4.16 Daily available PV power during the test period (hourly average values)

Figure C. 1

 1 Figure C.1 Impact of probabilistic forecasts in (a) the energy cost (EC) using the EC min scheduling strategy and in (b) the carbon footprint (CO2) using the CO2 min scheduling strategy. Results without correction for battery cycling life reduction. No PV costs taken into account

  First, increase the output voltage of the adjustable power source in fix steps of 0.2V until you get a power of 40 Watts flowing to the battery. At this point you should also have another 40 Watts flowing to the load, all delivered by the power source.Note: for the power source and the battery compute the power as P = V * I Table2. Power flows: variable power source -fixed load (voltage control)

Table 5 .

 5 Power flows: variable power source -fixed load (current control)

  vrs nominal load and P vrs nominal load. Include the 3 gauges in each graph.

Table 7 .Plot

 7 Power flows: Variable load -fixed and "limited" power source V vrs nominal load and P vrs nominal load. Include the 3 gauges in each graph in the same way you did for the previous exercise.

the irradiance of the day 7 -the irradiance of the day 8 - 9 - 11 -<10% 12 -

 7891112 In a given day, your PV panels produced 10 kWh. If you have an empty battery at the beginning of the day of 10 kWh and you want to leave it at 50% SoC by the end of the day. What is the maximum load that you can afford during that day? Was the PV generation enough to cover the consumption needs on that day? What happened with all the PV potential energy that was not used (above the magenta curve) ? It was injected to grid It was charged in the battery It was curtailed by the MPPT controller and then lost 10-What would be the minimum size of battery required to use all the PV potential? How much was the PV generation compared to the PV potential on that day? >50% <50% Why did the PV generation suddenly drop in the middle of the morning? clouds blocked suddenly the Sun the battery got full and less PV power could be then consumed the load consumption suddenly decreased

15 -

 15 Why did the power source started to generate electricity around 00h on the second day? The open-circuit voltage of the battery went below the voltage of the power source The battery got discharged Both answers are correct 16-On the second day the PV generation suddenly decreased around noon because clouds blocked suddenly the Sun the battery got full and less PV power could be then consumed the load consumption suddenly decreased 17-After these two days, the State of Charge of the Li-ion battery increased decreased remained the same

  battery, power source and load are connected to the main bus . . . . . . . . . . . . 2.13 Power measurements that illustrate the interactions between the resources of the microgrid. Sample day:22-06-2018 . . . . . . . . . . . . . . . . . . . . 2.14 Sample question of the quiz, based on plots taken from the nanogrid interface xxiv List of Figures 2.15 Load scheduling game dashboard. Type of day selection (solar irradiance and electricity price), PV potential production, scheduled consumption and SoC profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2.16 Flow diagram of the rules followed by the load-scheduling game . . . . . . 36 2.17 Half-hour power flows distribution shown in the dashboard of the loadscheduling game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 2.18 Scheduling interactive table to perform the daily consumption scheduling. Consumption is discretized in 30 minutes intervals . . . . . . . . . . . . . 38 2.19 Example of the results summary displayed at the end of the load scheduling game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.1 Overview of the state-of-the-art forecast methodologies to generate probabilistic forecasts. Classification taken from [2]. . . . . . . . . . . . . . . . 50 3.2 Diagram that sketches the working principle of the AnEn method . . . . . . 58 3.3 Correlation weights of the predictors obtained with the RReliefF algorithm.

  EMS proposal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 Flow diagram of the genetic algorithm . . . . . . . . . . . . . . . . . . . . 4.7 Working principle of the balancing strategy GC max . The output of the scheduling module (P scheduled grid ), the consumption (P load ) and the real PV output (P mppt pv ) are the inputs of this module . . . . . . . . . . . . . . . . . 4.8 Flow diagram of the reference PVB max strategy. It works as a balancing strategy if real PV-production (P mppt pv ) is given, while it performs scheduling if PV forecasts are provided instead (P

	f orecast pv

4.1 Grid price and CO 2 content . . . . . . . . . . . . . . . . . . . . . . . . . . 84 4.2 Grid price and CO 2 content . . . . . . . . . . . . . . . . . . . . . . . . . . 85 4.3 Value chain of four services provided by a smart-building . . . . . . . . . . 87 4.4 Cycling life of a Li-Ion battery as a function of its SoC ave (blue) and DoD ave (orange) [3] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 List of Figures xxv 4.

5

  Decomposition indicators of the AnEn, PeEn and MoCl . . . . . . . . . . . 3.3 Different scores and their reliability and resolution components for AnEn Impact in performance of different types of forecasts . . . . . . . . . . . . 4.9 Impact in performance of different forecasting methods with respect to a perfect forecast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10 Impact of targeting one service during the scheduling over the non-targeted services. Quantile forecasts used . . . . . . . . . . . . . . . . . . . . . . . 4.11 Impact of targeting one service during the scheduling over the non-targeted Performance obtained with the scheduling strategies using NWP in summer and winter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.13 Relative errors of NWP forecasts in different seasons . . . . . . . . . . . . 4.14 Best combinations of scheduling strategy and forecasting method for the different seasons and services . . . . . . . . . . . . . . . . . . . . . . . . . 4.15 Seasonal performance using the strategies of table 4.14. Values in parenthesis respresent performance with respect to the performance obtained when using NWP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.16 Performance obtained using a seasonal and an annual energy management strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

	xxviii xxx Nomenclature xxxii	List of Tables Nomenclature xxxi Nomenclature
	DSM Demand Side Management DSO Distribution System Operator EC Energy Cost performance indicator NLP Non-Linear Programming NRLAB Nanogrid Research LABoratory PV Numerical Weather Prediction QS Skill Score SZA Solar Zenith Angle T 2 Temperature at 2 meters above the ground 4.12 Nomenclature ECMW F European Centre for Medium Range Weather Forecasts OB Optimization Based NT O Non-Target Objective
	EDF Electricite De France RB Rule Based T O Target Objective
	Greek Symbols EMS Energy Management System PDF Probability Density Function T OE Through Output Energy
	τ EoD End of Day Quantile probability level PE PErsistence forecast T SO Transmission System Operator
	Acronyms / Abbreviations EPS Ensemble Prediction System PeEn Persistence Ensembles T SO Transmission System Operator
	AC EV PF UC Unit Commitment Alternating Current Electric Vehicle Perfect Forecast
	AnEn Analogs Ensembles GA Genetic Algorithm PV Photo-Voltaic
	ARPEGE Numerical Weather Prediction model from MeteoFrance GC Grid Commitment performance indicator PW M Pulse Width Modulation
	BAL Balancing module GHI Global Horizontal Irradiance QS Quantile Score
	GlCl Global Climatology QSS Quantile Skill Score
	CAPEX CAPital EXpenditure
	GoC Grid Off-Commitment RES Renewable Energy Source(s)
	CDF Cumulative Density Function
	GPP Grid Peak Power performance indicator RH Relative Humidity
	CL	equivalent Cycling Life of the battery
	IRES Intermittent Renewable Energy Source(s) rMAE relative Mean Absolute Error
	CO2 Carbon footprint performance indicator
	MAE Mean Absolute Error rMBE relative Mean Bias Error
	CO 2 Carbon dioxide
	MBE Mean Bias Error RMSE Root Mean Square Error
	CRPS Continuous Ranked Probability Score
	MG Microgrid rRMSE relative Root Mean Square Error
	CRPSS Continuous Ranked Probability Score Skill score
	MoCl Monthly Climatology SB Smart Building
	CSI Clear Sky Index
	MPPT Maximum Power Point Tracker SC Self Consumption
	DC	Direct Current
	MQT T MosQuiTo connectivity protocol SCH Scheduling Module
	DER Distributed Energy Resource
	NG Nanogrid SoC State Of Charge
	DoD ave Average Depth of Discharge
	NGR Non-homogeneous Gaussian Regression SoC ave Average State of Charge

3.1 Relative errors for two sample days with different degrees of uncertainty.

The normalized sharpness refers to the inter-quantile range between τ = 0.1 and τ = 0.9 obtained with the AnEn method . . . . . . . . . . . . . . . . . 3.2 and NGR models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1 Experimental coefficients for equation 4.2 [3] . . . . . . . . . . . . . . . . 4.2 TOE, CAPEX and embedded carbon emissions used to compute the nominal cost and CO 2 per kW/h of the energy delivered by the battery and PV panels 4.3 Summary of the penalization weights and hyper-parameters chosen for the genetic algorithm formulation . . . . . . . . . . . . . . . . . . . . . . . . 4.4 Proposed EMS strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 Impact in performance of the proposed EMS Scheduling Strategies. NWP forecasts used for all strategies . . . . . . . . . . . . . . . . . . . . . . . . 4.6 Performance of the optimization-based scheduling strategies with respect to the reference cases. NWP forecasts used for all strategies . . . . . . . . . . 4.7 Performance of the optimization-based scheduling strategies with respect to the reference cases. The best-suited forecasting method for each strategy is used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8 services. Perfect forecasts used . . . . . . . . . . . . . . . . . . . . . . . . A.1 Annual forecasting errors . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2 Winter forecasting errors . . . . . . . . . . . . . . . . . . . . . . . . . . . A.3 Spring forecasting errors . . . . . . . . . . . . . . . . . . . . . . . . . . . A.4 Summer forecasting errors . . . . . . . . . . . . . . . . . . . . . . . . . . A.5 Autumn forecasting errors . . . . . . . . . . . . . . . . . . . . . . . . . . B.1 Performance indicators, annual results (Scheduling strategy: EC min ) . . . . B.2 Performance indicators, annual results (Scheduling strategy: CO2 min ) . . . B.3 Performance indicators, annual results (Scheduling strategy: GPP min ) . . . B.4 Performance indicators, annual results (Scheduling strategy: PV B max ) . . . B.5 Performance indicators, autumn results (Scheduling strategy: EC min ) . . . . B.6 Performance indicators, autumn results (Scheduling strategy: CO2 min ) . . . B.7 Performance indicators, autumn results (Scheduling strategy: GPP min ) . . . B.8 Performance indicators, autumn results (Scheduling strategy: PV B max ) . . . B.9 Performance indicators, spring results (Scheduling strategy: EC min ) . . . . B.10 Performance indicators, spring results (Scheduling strategy: CO2 min ) . . . . B.11 Performance indicators, spring results (Scheduling strategy: GPP min ) . . . . B.12 Performance indicators, spring results (Scheduling strategy: PV B max ) . . . B.13 Performance indicators, summer results (Scheduling strategy: EC min ) . . . B.14 Performance indicators, summer results (Scheduling strategy: CO2 min ) . . . B.15 Performance indicators, summer results (Scheduling strategy: GPP min ) . . . B.16 Performance indicators, summer results (Scheduling strategy: PV B max ) . . B.17 Performance indicators, winter results (Scheduling strategy: EC min ) . . . . B.18 Performance indicators, winter results (Scheduling strategy: CO2 min ) . . . . B.19 Performance indicators, winter results (Scheduling strategy: GPP min ) . . . . B.20 Performance indicators, winter results (Scheduling strategy: PV B max ) . . .

  They classify forecasting techniques in PV performance models, statistical models (regressive and artificial intelligence) and hybrid models. Regarding forecast horizons, they study the now-casting, intra-day, six-hours to day-ahead and two days ahead or longer. A review of the different metrics used by the researchers to evaluate performance is also performed, in order to enable fair comparisons among studies. They list typical statistical metrics such as: mean absolute error (MAE), mean bias error (MBE), root mean square error (RMSE), standard deviation of errors (SDE), correlation coefficient or the skill score (SS); being RMSE, MAE and MBE the most commonly used (see section 3.3). They also mention more recent metrics that have been applied to PV power forecasting and uncertainty estimation such as: skew and kurt which quantify the skewness (asymmetry in the distribution) and kurtosis (measures if a distribution

is more or less 'tailed' than a normal distribution). Mean absolute scaled error (MASE) is proposed as an scale-free and non-sensitive to outliers metric while the Kolmogorov-Smirnov Integral (KSI) and OVER parameter are non-parametric tests to determine if two data sets are significantly different, which are used to compare the cumulative density functions of forecasts and measurements. For uncertainty quantification they mention the Rényi entropy, that avoid the problem of classical statistical metrics, such as MAE and RMSE, that are only unbiased if they are based on a Gaussian distribution. They also list some metrics to characterize the ramps and also some economic metrics to asses the cost of reserves for grid operators. There are mainly four different methodologies to produce probabilistic forecasts, as pointed out by

[START_REF] Haupt | The use of probabilistic forecasts: Applying them in theory and practice[END_REF]

, namely: 1. Statistical methods of probabilistic forecasts 2. Statistical-based scenarios 3. Physically-based ensemble forecasts 4. Perturbation-based ensemble forecasts

Table 3 .

 3 .2. 2 Decomposition indicators of the AnEn, PeEn and MoCl

	Quantile 0.1
		AnEn	PeEn	MoCl
	Quantile Skill Score 0.44	0.20	0.16
	reliability (W/m 2 )	0.47	2.05	0.29
	resolution (W/m 2 )	12.05	6.00	4.57
	uncertainty (W/m 2 ) 25.65 25.65 25.65
	Quantile 0.9
		AnEn	PeEn	MoCl
	Quantile Skill Score 0.75	0.58	0.62
	reliability (W/m 2 )	0.28	0.65	0.43
	resolution (W/m 2 )	35.43 29.28 30.11
	uncertainty (W/m 2 ) 49.30 49.30 49.30
		CRPS
		AnEn	PeEn	MoCl
	CRPS Skill Score	0.67	0.43	0.44
	reliability (W/m 2 )	0.77	3.23	2.63
	resolution (W/m 2 )	93.04 62.26 63.73
	uncertainty (W/m 2 ) 138.93 138.93 138.93

Table 3 .

 3 3 Different scores and their reliability and resolution components for AnEn and NGR models

	Quantile 0.1
		AnEn NGR
	Quantile Score	13.0 21.6
	reliability (W/m 2 )	1.4	6.2
	resolution (W/m 2 ) 12.4	9.9
	Quantile 0.9
		AnEn NGR
	Quantile Score	16.4 26.0
	reliability (W/m 2 )	3.6	7.7
	resolution (W/m 2 ) 37.9 29.3
	CRPS
		AnEn NGR
	CRPS	42.9 62.5
	reliability (W/m 2 )	8.7	10.6
	resolution (W/m 2 ) 98.5 80.7

Table 4 .

 4

	1 Experimental coefficients for equation 4.2 [3]
	Coefficient	q	u	v	s	t
	Value	1471 0.3369 -2.295 214.3 0.6111

Table 4 .

 4 2 TOE, CAPEX and embedded carbon emissions used to compute the nominal cost and CO 2 per kW/h of the energy delivered by the battery and PV panels embedded CO 2 emissions contained in the PV panels and the battery, hence the importance of doing a proper utilization of the resources. Its added value can be understood as the ability of the SB to provide electricity with less CO 2 content than the electricity coming from the utility grid. The seemingly obvious indicator, used to quantify this service, is the equivalent amount of grams of CO 2 per unit of energy consumed in the MG. This performance indicator can be computed in a similar way as it was presented at equation 4.1 for the EC indicator. Its units are gCO 2 /kWh and will be designated hereafter as CO2. The equivalent mathematical expression to compute its value is presented in equation 4.10. /kWh, of the energy coming from the corresponding DER X. It can be either the nominal value (see equation 4.11 for battery and equation 4.12 for PV), or the corrected value (see equation 4.13 for battery and equation 4.14 for PV). The carbon footprint of the utility-grid energy (CO 2 h grid ) is considered known beforehand, and its values for each hour h of the test period are presented in figure 4.2.Following a similar method as the one presented for EC, we can compute the nominal values for the CO 2 content of the energy delivered by the battery and PV, based on their embedded carbon emissions shown in table 4.2. 2X stands for the embedded CO 2 emissions expelled to the atmosphere during the manufacturing process of the DER X. The corresponding corrected values for the CO 2 content of battery CO 2 Forecasts and energy management in a microgrid: Impact on services provided by a smart building CAPEX X in equations 4.4 and 4.7, and replacing it with the embedded CO 2 emissions during manufacturing. In these way, we obtain the relations to compute the corrected values for the CO 2 content of battery and PV energy, as presented in equations 4.13 and 4.14.

		TOE(kWh) CAPEX( C) E CO 2 (kgCO 2 e) CO nom 2 (gCO 2 /kWh) C nom ( C/kWh)
	PV (16kWp)	581000 [32] 9265 [100]	19520 [101]		33	0.016
	Battery (32kWh) 98100 [102] 20208 [102]	2300 [103]		23	0.210
	due to the CO2 =	1 load E T	•	H h=1 ∑	E h grid •CO 2	h grid + E h batt •CO 2	h batt + E h pv •CO 2	h pv	(4.10)
	where E T load represents the total energy consumed by the load during the test period, E h grid is
	the energy bought from the utility grid, E h batt is the energy delivered by the battery (battery
	discharging), E h pv stands for the PV output energy while CO 2	h X represents the CO 2 content,
	in gCO 2 CO 2	nom batt =	E CO 2batt T OE min		(4.11)
					CO 2	nom pv =	E CO 2 pv T OE exp		(4.12)
	where E CO

h batt and PV energy CO 2 h pv , are computed by changing the capital cost

Table 4 .

 4 3 Summary of the penalization weights and hyper-parameters chosen for the genetic algorithm formulation

	Penalization weights
	K 1 • 10 6
	L	5
	M 1 •10 -5
	Hyper-parameters
	# of Iterations	300
	Population size	1000
	Mutation 100% probability
	# of mutating chromosomes	1
	Mating pool size (# of parents)	100

  . We observe that the same physical constraints as for the GA formulation are present in this problem (see equations 4.18 and 4.19).

	min P grid ,P batt ∑ 24 h=1 (P h grid	2 + P h batt	2 )
	s.t.
	P h grid + P h batt + P h pv + P h load = 0
	∆t • ∑ 24 h=1 P h batt = 0 (SoC h=24 = SoC h=1 = 50%)
	P h pv = P h mppt pv
	0% ≤ SoC h batt ≤ 100%
	0 kW ≤ P h grid ≤ 36 kW
	0 kW ≤ P h batt ≤ 27 kW
	(4.20)

Table 4 .

 4 4 Proposed EMS strategies

	4.6 Performance evaluations

Table 4 .

 4 [START_REF] Li | Combined Two-Stage Stochastic Programming and Receding Horizon Control Strategy for Microgrid Energy Management Considering Uncertainty[END_REF] Performance of the optimization-based scheduling strategies with respect to the reference cases. NWP forecasts used for all strategies

	Proposed Strategy		Reference strategy	Performance
	strategy	NO MG PVB max PVB max -NWP	indicator
	EC min -NWP	-12.4%	-8.1%	-13.3%	EC ( C/kWh)
		-	-	+1.8%	GC (%)
	CO2 min -NWP	+4.9%	-4.5%	-7.2%	CO2 (gCO 2 /kWh)
		-	-	+1.2%	GC (%)
	GPP min -NWP	-30.2%	-0.0%	-30.2%	GPP (C)
		-	-	+1.8%	GC (%)

Table 4 .

 4 [START_REF] Shimomachi | Development of energy management system for dc microgrid for office building:-day ahead operation scheduling considering weather scenarios[END_REF] Performance of the optimization-based scheduling strategies with respect to the reference cases. The best-suited forecasting method for each strategy is used

	Proposed Strategy		Reference strategy	Performance
	strategy	NO MG PVB max	PVB max -	indicator
	EC min -AnEn τ=0.5	-14.5%	-10.3% -8.8% (AnEn τ=0.1:0.2 )	EC ( C/kWh)
	CO2 min -AnEn τ=0.3 +3.3%	-6.0%	-1.6% (AnEn τ=0.1 )	CO2 (gCO 2 /kWh)
	GPP min -AnEn τ=0.4 -36.5%	-9.0% -36.5% (AnEn τ=0.1:0.9 )	GPP (C)

Table 4 .

 4 8 Impact in performance of different types of forecasts

	Scheduling	Performance	AnEn τ=0.1	AnEn τ=0.9	PE	NWP	PF
	Strategy	Indicator	(Pesimistic Forecast) (Optimistic Forecast) (Unbiased Forecast 1 ) (Reference Forecast) (Most Accurate Forecast)
	EC min	EC (C/kWh) GC (%)	0.297 99.9	0.217 92.1	0.176 96.2	0.169 99.1	0.154 100
	CO2 min	CO2 (gCO 2 /kWh) GC (%)	73 99.9	89 88.1	65 94.3	64 98.5	63 100
	GPP min	GPP (kW) GC (%)	15 99.7	18 90.8	15 95.3	18 99.1	15 100

Table 4 .

 4 [START_REF] Gholami | Microgrid Scheduling With Uncertainty: The Quest for Resilience[END_REF] Impact in performance of different forecasting methods with respect to a perfect forecast

	Scheduling Strategy	Service	AnEn τ=0.1 (Most Pessimistic Forecst) (Most Optimistic Forecst) (Most Unbiased Forecast) (Commercial Forecast) AnEn τ=0.9 PE NWP
	EC min	Energy Cost Grid Commitment	+92.8% -0.1%	+41.0% -7.9%	+14.3% -3.8%	+9.7% -0.9%
	CO2 min	Carbon Footprint Grid Commitment	+15.9% -0.1%	+41.2% -11.9%	+3.2% -5.7%	+1.6% -1.5%
	GPP min	Contracted Power Grid Commitment	0% -0.3%	+9.8% -9.2%	0% -4.7%	+9.8% -0.9%

Table 4 .

 4 the numbers in bold represent the best values obtained for each service, and the positive/negative bias represents a relative Forecasts and energy management in a microgrid: Impact on services provided by a smart building 10 Impact of targeting one service during the scheduling over the non-targeted services. Quantile forecasts used EMS EC min -AnEn τ=0.5 CO2 min -AnEn τ=0.3 GPP min -AnEn τ=0.4 EC min -AnEn τ=0.1

	Intended to:	Minimize EC favor GC	Minimize CO 2 favor GC	Minimize GPP favor GC	Minimize EC favor GC
	Performance indicator		% respect to the best:		% respect to the best:		% respect to the best:		% respect to the best:
	EC (C/kWh)	0.165	0.0	0.173	+4.8	0.177	+7.3	0.297	+80.0
	CO2 (gCO 2 /kWh)	65	+3.3	63	0.0	64	+1.9	105	+66.5
	GPP (kW)	30	+57.4	30	+57.4	15	0.0	30	+57.4
	GC (%)	98.7	-1.2	99.4	-0.5	99.3	-0.6	99.9	0.0
	increase/decrease of the corresponding performance indicator with respect to the best result
	obtained.

Table 4 .

 4 [START_REF] Agüera-Pérez | Weather forecasts for microgrid energy management: Review, discussion and recommendations[END_REF] Impact of targeting one service during the scheduling over the non-targeted services. Perfect forecasts used

	EMS	EC min -PF	CO2 min -PF	GPP min -PF
	Intended to:	Minimize EC favor GC	Minimize CO2 favor GC	Minimize GPP favor GC
	Performance indicator		% respect to the best:		% respect to the best:		% respect to the best:
	EC (C/kWh)	0.154	0.0	0.171	+11.0	0.173	+12.3
	CO2 (gCO 2 /kWh)	63	0.0	63	0.0	63	0.0
	GPP (kW)	30	+57.4	30	+57.4	15	0.0
	GC (%)	100	0.0	100	0.0	100	0.0

Table 4 .

 4 [START_REF] Lasseter | Integration of distributed energy resources[END_REF] Performance obtained with the scheduling strategies using NWP in summer and winter

	Performance indicator Winter performance Summer performance
		EC min -NW P
	EC ( C/kWh)	0.240 (+150%)	0.096
	GC (%)	99.5 (+1.1%)	98.4
		CO2 min -NW P
	CO2 (gCO 2 /kWh)	59 (+5.3%)	56
	GC (%)	99.3 (+1.9%)	97.4

Table 4 .

 4 [START_REF] Wouters | Towards a regulatory framework for microgrids-The Singapore experience[END_REF] Relative errors of NWP forecasts in different seasons

		rMAE rRMSE rMBE
	Summer 0.182	0.382 -0.012
	Winter 0.316	0.787	0.004
	Spring	0.235	0.465	0.024
	Autumn 0.298	0.736 -0.041

Table 4 .

 4 14 Best combinations of scheduling strategy and forecasting method for the different seasons and services AnEn τ=0.6 EC min -AnEn τ=0.5 EC min -AnEn τ=40:50 EC min -AnEn τ=50:60 CO2 (gCO 2 /kWh) CO2 min -AnEn τ=0.3 CO2 min -AnEn τ=0.4 CO2 min -AnEn τ=0.4 CO2 min -AnEn τ=0.1 GPP (kW) GPP min -AnEn τ=0.2 GPP min -AnEn τ=20:30 GPP min -AnEn τ=10:80 GPP min -AnEn τ=10:90 GC (%) EC min -AnEn τ=0.2 EC min -AnEn τ=10:20 EC min -AnEn τ=0.1 EC min -AnEn τ=0.1

	Performance indicator	Best Winter EMS	Best Spring EMS	Best Summer EMS	Best Autumn EMS
	EC (C/kWh)	EC min -

Table 4 .

 4 [START_REF] Perea | Definition, evolution, applications and barriers for deployment of microgrids in the energy sector[END_REF] Seasonal performance using the strategies of table 4.14. Values in parenthesis respresent performance with respect to the performance obtained when using NWP

	Performance indicator	Winter	Spring	Summer	Autumn
	EC (C/kWh) 0.236 (-1.7%) 0.114 (-2.6%) 0.091 (-5.2%) 0.173 (-2.2%)
	CO2 (gCO 2 /kWh)	58 (-2.1%)	53 (-0.6%)	56 (+1.1%)	89 (-24.1%)
	GPP (kW) 15 (-16.7%)	12 (0%)	9 (0%)	15 (0%)
	GC (%) 100 (+0.4%)	100 (+1.8%)	100 (+1.6%)	100 (+0.1%)

Table 4 .

 4 [START_REF] Ton | The U.S. Department of Energy's Microgrid Initiative[END_REF] Performance obtained using a seasonal and an annual energy management strategy

	Performance indicator	EMS strategy Seasonal Annual
	EC ( C/kWh) 0.150 (-9.1%) 0.165
	CO2 (gCO 2 /kWh) 62.8 (-0.5%)	63.1
	GPP (kW)	15 (0%)	15
	GC (%) 100 (+0.1%)	99.9

Table A

 A

	.2 Winter forecasting errors Table A.4 Summer forecasting errors
	Forecast rMAE rRMSE rMBE Forecast rMAE rRMSE rMBE
	PF	PF	0	0	0	0	0	0
	PE	PE	0.628 0.29	1.499 -0.012 0.581 0.008
	NWP NWP	0.316 0.182	0.787 0.382 -0.012 0.004
	AnEn τ=0.1 0.498 AnEn τ=0.1 0.317	1.178 -0.467 0.547 -0.278
	AnEn τ=0.2 0.368 AnEn τ=0.2 0.225	0.895 -0.285 0.421 -0.14
	AnEn τ=0.3 0.305 AnEn τ=0.3 0.184	0.757 -0.146 0.37 -0.05
	AnEn τ=0.4 0.283 AnEn τ=0.4 0.168	0.717 -0.029 0.356 0.014
	AnEn τ=0.5 0.288 AnEn τ=0.5 0.166	0.739 0.362	0.077 0.064
	AnEn τ=0.6 0.315 AnEn τ=0.6 0.173	0.824 0.379	0.18 0.106
	AnEn τ=0.7 0.371 AnEn τ=0.7 0.186	0.96 0.406	0.287 0.144
	AnEn τ=0.8 0.452 AnEn τ=0.8 0.202	1.138 0.438	0.411 0.178
	AnEn τ=0.9 0.595 AnEn τ=0.9 0.227	1.409 0.48	0.578 0.215
	Table A.3 Spring forecasting errors Table A.5 Autumn forecasting errors
	Forecast rMAE rRMSE rMBE Forecast rMAE rRMSE rMBE
	PF	PF	0	0	0	0	0	0
	PE	PE	0.39 0.471	0.751 -0.008 1.142 0.018
	NWP NWP	0.235 0.298	0.465 0.736 -0.041 0.024
	AnEn τ=0.1 0.422 AnEn τ=0.1 0.479	0.74 1.109 -0.459 -0.398
	AnEn τ=0.2 0.314 AnEn τ=0.2 0.359	0.566 0.871 -0.295 -0.25
	AnEn τ=0.3 0.251 AnEn τ=0.3 0.297	0.462 -0.133 0.742 -0.166
	AnEn τ=0.4 0.223 AnEn τ=0.4 0.271	0.419 -0.038 0.691 -0.064
	AnEn τ=0.5 0.218 AnEn τ=0.5 0.266	0.421 0.683	0.044 0.03
	AnEn τ=0.6 0.228 AnEn τ=0.6 0.279	0.453 0.714	0.121 0.119
	AnEn τ=0.7 0.256 AnEn τ=0.7 0.311	0.513 0.78	0.195 0.21
	AnEn τ=0.8 0.302 AnEn τ=0.8 0.367	0.594 0.885	0.271 0.31
	AnEn τ=0.9 0.374 AnEn τ=0.9 0.464	0.709 1.065	0.362 0.435

Table B .

 B 1 Performance indicators, annual results (Scheduling strategy: EC min ) Percentage of time that grid -absolute-power surpasses X kW during test period Table B.2 Performance indicators, annual results (Scheduling strategy: CO2 min )

	Table B.4 Performance indicators, annual results (Scheduling strategy: PV B max ) Table B.6 Performance indicators, autumn results (Scheduling strategy: CO2 min ) Table B.8 Performance indicators, autumn results (Scheduling strategy: PV B max )
	GC (%) ( C/kWh) (gCO 2 /kWh) (%) EC CO2 G>9* G>12* G>15* G>18* G>30* (%) (%) (%) (%) AnEn τ=0.1 99.9 0.297 105 8.3 3.8 1 0.4 0 AnEn τ=0.2 99.9 0.224 83 8.6 3.7 1.1 0.4 0 AnEn τ=0.3 99.7 0.183 70 9.1 3.6 0.9 0.4 0 AnEn τ=0.4 99.4 0.168 66 9.3 3.5 1 0.4 0 AnEn τ=0.5 98.7 0.165 65 9.5 3.7 1 0.4 0 AnEn τ=0.6 97.8 0.17 67 9.7 3.6 1 0.4 0 AnEn τ=0.7 96.6 0.181 71 9.6 3.7 1.1 0.5 0 AnEn τ=0.8 94.9 0.197 76 9.4 3.7 1.1 0.5 0 AnEn τ=0.9 92.1 0.217 82 9.3 3.5 1 0.5 0 NWP 99.1 0.169 66 9.7 3.8 1.1 0.5 0 PE 96.2 0.176 67 9.4 3.8 1.1 0.4 0 PF 100 0.154 63 9.8 3.7 1 0.4 0 EC CO2 G>9 G>12 G>15 G>18 G>30 (%) (C/kWh) (gCO 2 /kWh) (%) (%) (%) (%) (%) AnEn τ=0.1 99.9 0.206 73 8.6 4 1 0.1 AnEn τ=0.2 99.7 0.183 66 8.7 3.9 0.9 0.2 AnEn τ=0.3 99.4 0.173 63 8.9 3.9 1 0.1 AnEn τ=0.4 98.8 0.174 64 9.4 3.8 0.8 0.1 AnEn τ=0.5 97.8 0.183 66 9.4 3.9 1 0.2 AnEn τ=0.6 96.3 0.196 70 9.4 3.9 0.9 0.2 AnEn τ=0.7 94.4 0.213 75 9.2 3.9 1 0.2 AnEn τ=0.8 91.8 0.231 81 9.3 3.9 0.9 0.2 AnEn τ=0.9 88.1 0.259 89 9.5 3.8 0.9 0.3 NWP 98.5 0.175 64 9.6 4 1 0.3 PE 94.3 0.181 65 9.6 4.1 1 0.2 PF 100 0.171 63 9.2 3.9 0.9 0.2 Table B.3 Performance indicators, annual results (Scheduling strategy: GPP min ) GC EC CO2 G>9 G>12 G>15 G>18 G>30 (%) (C/kWh) (gCO 2 /kWh) (%) (%) (%) (%) (%) AnEn τ=0.1 99.7 0.255 87 5.6 0.9 0 0 AnEn τ=0.2 99.8 0.21 74 5.4 0.8 0 0 AnEn τ=0.3 99.7 0.185 67 5.3 0.8 0 0 AnEn τ=0.4 99.3 0.177 64 5.2 0.8 0 0 AnEn τ=0.5 98.6 0.179 65 5.3 0.9 0.1 0 AnEn τ=0.6 97.5 0.186 67 5.4 0.9 0.1 0 AnEn τ=0.7 96 0.198 71 5.5 0.9 0.1 0 AnEn τ=0.8 93.9 0.213 76 5.6 1 0.1 0 GC EC CO2 G>9 G>12 G>15 G>18 G>30 (%) (C/kWh) (gCO 2 /kWh) (%) (%) (%) (%) (%) AnEn τ=0.1 99.9 0.181 64 8.8 4.1 1 0.1 0 AnEn τ=0.2 99.5 0.181 65 9.1 4 0.9 0.1 0 AnEn τ=0.3 98.8 0.187 67 9.4 3.9 0.8 0.1 0 AnEn τ=0.4 97.8 0.195 69 9.7 3.9 0.8 0.1 0 AnEn τ=0.5 96.4 0.205 72 9.9 4 0.8 0.1 0 AnEn τ=0.6 94.6 0.215 76 10 4 0.8 0.1 0 AnEn τ=0.7 92.4 0.226 79 10.1 4.1 0.7 0.1 0 AnEn τ=0.8 89.7 0.238 83 10.3 4.2 0.7 0.1 0 AnEn τ=0.9 86 0.255 88 10.4 4.2 0.7 0.1 0 NWP 97.3 0.195 69 9.9 4.1 0.8 0.1 0 PE 92.9 0.194 68 10.1 4.2 0.9 0.1 0 PF 100 0.184 67 9.7 3.7 0.7 0.1 0 Table B.5 Performance indicators, autumn results (Scheduling strategy: EC min ) GC EC CO2 G>9 G>12 G>15 G>18 G>30 (%) (C/kWh) (gCO 2 /kWh) (%) (%) (%) (%) (%) AnEn τ=0.1 100.0 0.259 126 5.6 1.1 0.3 0 AnEn τ=0.2 99.9 0.21 103 5.2 1.2 0.3 0 AnEn τ=0.3 99.9 0.187 93 5.3 0.9 0.3 0.1 AnEn τ=0.4 99.8 0.177 89 5.3 0.9 0.4 0.1 AnEn τ=0.5 99.7 0.173 87 5.3 0.9 0.3 0.1 AnEn τ=0.6 99.6 0.173 87 4.9 1 0.4 0 AnEn τ=0.7 99.5 0.177 89 5.2 1 0.6 0 AnEn τ=0.8 99.3 0.187 93 4.9 1.2 0.5 0.1 GC EC CO2 G>9 G>12 G>15 G>18 G>30 (%) (C/kWh) (gCO 2 /kWh) (%) (%) (%) (%) (%) AnEn τ=0.1 100.0 0.194 89 6.5 1 0.1 0 AnEn τ=0.2 99.8 0.209 96 6 1 0.3 0 AnEn τ=0.3 99.4 0.23 106 6 1.1 0.3 0 AnEn τ=0.4 98.8 0.249 115 6 1 0.3 0 AnEn τ=0.5 98.1 0.275 127 6 1.2 0.5 0.1 AnEn τ=0.6 97.0 0.297 136 5.8 1 0.4 0.1 AnEn τ=0.7 95.6 0.316 145 5.8 1.2 0.5 0.1 AnEn τ=0.8 94.0 0.34 156 5.5 1 0.3 0 AnEn τ=0.9 91.5 0.367 169 5.3 0.9 0.5 0.1 NWP 98.5 0.255 117 6.2 1.2 0.6 0 PE 95.9 0.241 111 5.8 1 0.3 0 PF 100.0 0.295 136 6.1 1 0.4 0.1 Table B.7 Performance indicators, autumn results (Scheduling strategy: GPP min ) GC EC CO2 G>9 G>12 G>15 G>18 G>30 (%) (C/kWh) (gCO 2 /kWh) (%) (%) (%) (%) (%) AnEn τ=0.1 100.0 0.239 110 0.3 0 0 0 AnEn τ=0.2 100.0 0.208 96 0.3 0 0 0 AnEn τ=0.3 100.0 0.192 89 0.3 0 0 0 AnEn τ=0.4 99.9 0.187 87 0.3 0 0 0 AnEn τ=0.5 99.8 0.186 86 0.4 0 0 0 AnEn τ=0.6 99.6 0.19 88 0.3 0 0 0 AnEn τ=0.7 99.3 0.197 92 0.3 0 0 0 AnEn τ=0.8 98.9 0.21 98 0.3 0 0 0 GC EC CO2 G>9 G>12 G>15 G>18 G>30 (%) (C/kWh) (gCO 2 /kWh) (%) (%) (%) (%) (%) AnEn τ=0.1 99.9 0.245 112 6.3 0.7 0.1 0 AnEn τ=0.2 99.6 0.288 132 6.2 0.7 0.1 0 AnEn τ=0.3 99.1 0.333 155 6.1 0.7 0.1 0 AnEn τ=0.4 98.5 0.374 175 5.9 0.6 0.1 0 AnEn τ=0.5 97.7 0.413 194 5.7 0.6 0.1 0 AnEn τ=0.6 96.6 0.447 211 5.6 0.6 0.1 0 AnEn τ=0.7 95.2 0.476 225 5.5 0.5 0.1 0 AnEn τ=0.8 93.6 0.502 238 5.6 0.5 0.1 0 AnEn τ=0.9 91.1 0.517 245 5.4 0.5 0.1 0 NWP 98.2 0.381 178 6.1 0.6 0.1 0 PE 95.6 0.332 154 5.8 0.5 0.1 0 PF 100 0.517 246 5.4 0.5 0.1 0 Table B.9 Performance indicators, spring results (Scheduling strategy: EC min ) GC EC CO2 G>9 G>12 G>15 G>18 G>30 (%) (C/kWh) (gCO 2 /kWh) (%) (%) (%) (%) (%) AnEn τ=0.1 100.0 0.279 99 1.9 0 0 0 AnEn τ=0.2 100.0 0.193 75 2.4 0 0 0 AnEn τ=0.3 99.9 0.138 61 3.4 0 0 0 AnEn τ=0.4 99.6 0.116 55 4.1 0 0 0 AnEn τ=0.5 98.0 0.114 54 5 0 0 0 AnEn τ=0.6 95.5 0.12 57 5.1 0 0 0 AnEn τ=0.7 92.5 0.139 62 5.1 0.1 0 0 AnEn τ=0.8 87.8 0.163 69 5 0.1 0 0 *G > X: GC AnEn τ=0.9 90.8 0.232 82 5.7 1 0.1 0 AnEn τ=0.9 98.8 0.202 100 4.6 1 0.4 0 AnEn τ=0.9 97.9 0.229 106 0.3 0 0 0 AnEn τ=0.9 81.2 0.189 77 4.9 0.1 0 0
	NWP 99.1 NWP 99.8 NWP 99.9 NWP 98.2	0.177 0.177 0.187 0.117	64 87	88 55	5.3	5.8	0.9 0.4 5.6	0.1 0	1 0	0 0	0.5 0	0	0 0
	PE 95.3 PE 99.4 PE 99.0 PE 92.2	0.182 0.181 0.188 0.123	65 87	89 57	5.7	5.1	1 0.5 5.3	0 0	1.3 0	0 0	0.5 0	0	0 0
	PF 100 PF 100.0 PF 100.0 PF 100.0	0.173 0.165 0.184 0.095	63 86	85 52	5.3	5.2	0.8 0.3 5.3	0 0	1 0	0 0	0.3 0	0	0 0

Table B .

 B 12 Performance indicators, spring results (Scheduling strategy: PV B max )

	GC	EC	CO2	G>9 G>12 G>15 G>18 G>30
	(%) (C/kWh) (gCO 2 /kWh) (%)	(%)	(%)	(%)	(%)
	AnEn τ=0.1 99.8	0.137	56	2		0	0
	AnEn τ=0.2 99.3	0.123	53	2.6		0	0
	AnEn τ=0.3 98.2	0.118	52	3.6		0	0
	AnEn τ=0.4 96.2	0.118	53	4.5		0	0
	AnEn τ=0.5 93.4	0.121	54	5.1		0	0
	AnEn τ=0.6 89.2	0.126	55	5.5		0	0
	AnEn τ=0.7 83.8	0.131	56	6		0	0
	AnEn τ=0.8 78	0.14	59	6.1		0	0
	AnEn τ=0.9 70.8	0.152	62	6.6		0	0
	NWP 94.7	0.121	53	4.9		0	0
	PE 84.8	0.125	54	5.1		0	0
	PF 100	0.108	51	4.6		0	0

Table B .

 B [START_REF] Wouters | Towards a regulatory framework for microgrids-The Singapore experience[END_REF] Performance indicators, summer results (Scheduling strategy: EC min )

	Table B.18 Performance indicators, winter results (Scheduling strategy: CO2 min )
	GC	EC	CO2	G>9 G>12 G>15 G>18 G>30
	(%) (C/kWh) (gCO 2 /kWh) (%)	(%)	(%)	(%)	(%)
	AnEn τ=0.1 99.9	0.269	65	22.3 11.5	3.4	0.5
	AnEn τ=0.2 99.9	0.246	60	21.7 11.1	3.1	0.4
	AnEn τ=0.3 99.7	0.237	58	21.4 11.2	3.1	0.3
	AnEn τ=0.4 99.4	0.237	59	21.7 10.7	2.8	0.3
	AnEn τ=0.5 99.1	0.246	61	21.8 11.2	3.1	0.4
	AnEn τ=0.6 98.6	0.259	64	21.5 10.9	3.1	0.4
	AnEn τ=0.7 97.8	0.276	68	20.9 10.8	3.3	0.5
	AnEn τ=0.8 96.7	0.297	73	20.9	11	2.9	0.5
	AnEn τ=0.9 94.8	0.331	81	21.2 10.6	3	0.6
	NWP 99.3	0.24	59	22.1 11.3	3.2	0.6
	PE 97.8	0.247	60	21.9 11.2	3.1	0.5
	PF 100	0.237	59	21	10.6	3	0.5
	GC	EC	CO2	G>9 G>12 G>15 G>18 G>30
	(%) (C/kWh) (gCO 2 /kWh) (%)	(%)	(%)	(%)	(%)
	AnEn τ=0.1 100	0.173	83	0.3	0	0
	AnEn τ=0.2 99.4	0.121	68	1.6	0	0
	AnEn τ=0.3 98.7	0.097	62	2.5	0	0
	AnEn τ=0.4 98	0.091	61	3.2	0.1	0
	AnEn τ=0.5 96.5	0.091	62	3.5	0.3	0
	AnEn τ=0.6 94.7	0.096	63	3.9	0.3	0
	AnEn τ=0.7 92.6	0.103	65	4.2	0.5	0
	AnEn τ=0.8 90.4	0.111	68	4.1	0.4	0
	AnEn τ=0.9 87.1	0.119	71	3.8	0.4	0
	NWP 98.4	0.096	62	3.1	0.1	0
	PE 91.7	0.103	63	3.6	0.6	0
	PF 100	0.073	59	3.7	0.2	0

Table B .

 B [START_REF] Barnes | Microgrid laboratory facilities[END_REF] Performance indicators, winter results (Scheduling strategy: GPP min )

								165
	GC	EC	CO2	G>9 G>12 G>15 G>18 G>30
	(%) (C/kWh) (gCO 2 /kWh) (%)	(%)	(%)	(%)	(%)
	AnEn τ=0.1 99.4	0.297	71	16.2	3.7	0	0
	AnEn τ=0.2 99.9	0.266	64	16	3.4	0	0
	AnEn τ=0.3 99.8	0.251	61	15.5	3.2	0.1	0
	AnEn τ=0.4 99.6	0.247	60	15.3	3.2	0.2	0
	AnEn τ=0.5 99.4	0.249	61	15.3	3.4	0.2	0
	AnEn τ=0.6 99	0.257	62	15.7	3.6	0.4	0
	AnEn τ=0.7 98.4	0.268	65	15.7	3.7	0.4	0
	AnEn τ=0.8 97.5	0.285	69	15.8	4	0.5	0
	AnEn τ=0.9 96	0.31	75	16	4.1	0.6	0
	NWP 99.6	0.247	60	15.6	3.4	0.2	0
	PE 97.6	0.251	61	16.4	3.9	0.1	0
	PF 100	0.246	60	15.5	3.3	0.1	0

Table B .

 B 20 Performance indicators, winter results (Scheduling strategy: PV B max )

	GC	EC	CO2	G>9 G>12 G>15 G>18 G>30
	(%) (C/kWh) (gCO 2 /kWh) (%)	(%)	(%)	(%)	(%)
	AnEn τ=0.1 99.9	0.354	83	22.9 12.1	3.9	0.3
	AnEn τ=0.2 99.6	0.431	101	22.3 11.5	3.2	0.2
	AnEn τ=0.3 99.2	0.523	124	21.7 11.2	2.9	0.2
	AnEn τ=0.4 98.5	0.616	146	21.5 11.2	2.9	0.2
	AnEn τ=0.5 97.7	0.709	168	21.5 10.9	2.9	0.2
	AnEn τ=0.6 96.6	0.779	185	21.2 10.7	2.8	0.2
	AnEn τ=0.7 95.3	0.847	201	20.9 10.5	2.8	0.2
	AnEn τ=0.8 93.5	0.882	210	20.9 10.5	2.7	0.2
	AnEn τ=0.9 90.9	0.91	216	20.8 10.3	2.7	0.2
	NWP 98.2	0.631	149	21.9 11.3	3.1	0.4
	PE 95.7	0.425	100	22.2 11.4	3.4	0.2
	PF 100	0.913	217	20.8 10.3	2.7	0.2

Table 6 .

 6 Power flows: Variable load -fixed and "unlimited" power source

Aside from the perfect forecast (PF)

Microgrid performance and management experience

Acknowledgements

Special thanks to Josselin Le Gal and Philippe Lauret, from the project, enriching it from the technical side but also as a personal and inter-cultural experience.

Special thanks to the Universidad de Costa Rica (UCR) that through its scholarship program for the academic staff, managed by the bureau of international affairs (OAICE), made possible this journey of postgraduate studies. Besides, I want to thank the chair of the Electrical Engineering faculty, Dr. Lochi Yu Lo, for all his support and trust during this period.

This work benefited from the support of the Energy4Climate Interdisciplinary Center (E4C) of IP Paris and Ecole des Ponts ParisTech. It was supported by 3rd Programme d'Investissement d'Avenir (ANR-18-EUR-006-02). It was also supported by the Foundation of Ecole Polytechnique (through the Chaire DTER) and the Siebel Energy Institute.

The optimization algorithms

Two different optimization algorithms, namely a genetic algorithm (GA) and a non-linear programming algorithm (NLP) are used in the scheduling module to optimize the different services that can be targeted in this stage. The basics and implementation details of those methods, for the problem in question, are explained in the following sections.

Genetic Algorithm

In computer science, a genetic algorithm (GA) is a meta-heuristic method inspired by the process of natural selection that belongs to the larger class of evolutionary algorithms. Genetic algorithms are commonly used to generate quasi-optimal solutions to optimization and search problems by relying on biologically inspired operators such as mutation, crossover and selection [START_REF]An introduction to genetic algorithms[END_REF].

The proposed genetic algorithm is composed of a population of 1000 candidates solutions (called individuals) to the optimization problem, which are evolved toward better solutions. Each individual has a set of properties (its chromosomes) which can be mutated and altered. In our case, an individual contains 24 chromosomes, being each of them the average-hourly power of the battery. Their values are limited to the maximum power of the battery (±27kW). The evolution starts from a population of 1000 -randomly generated-individuals. In an iterative process (after 300 iterations), the algorithm converges to a solution, presumably quasi-optimal. The population created in each iteration is called a generation. In each generation, the fitness of every individual in the population is evaluated. The fitness score is Forecasts and energy management in a microgrid: Impact on services provided by a smart building balancing), including the type of algorithm used, the target objective as well as the reference to the objective function equations (when applicable), is presented in table 4.4. The idea in this section of the study is to observe if the proposed optimization-based scheduling strategies, are able to yield a better performance in the services they are meant to favor, with respect to the reference strategies. In this part, NWP forecast is chosen for all the EMS scheduling strategies in order to simulate a realistic scenario where a -commercially available-deterministic forecast is used. The performance in each service (i.e. EC, CO2 and GPP) is computed for the entire test period. The output of all scheduling strategies, pass through the balancing module GC max , after which the performance indicators are computed, as shown in table 4.5. Here, the performance indicators of the four services (i.e. EC, CO2, GPP and GC) are computed for the three reference strategies and the three proposed scheduling strategies (using the NWP forecasts). Values in bold represent the best performance obtained for each indicator. However, to enrich and facilitate the analysis and the comparison of the proposed strategies against the reference strategies (which can be more valuable than just analyzing the absolute values obtained for the indicators), table 4.6 was constructed, where the percentage difference of the proposed scheduling strategies with respect to each reference strategy (for all performance indicators) is computed. In this table, the positive/negative bias represents a relative increase/decrease of the corresponding performance indicator with respect to the best result obtained. The percentage with respect to the best result of the GPP indicator, represents the percentage-difference in terms of the annual fee that must be paid depending on the contracted power required, as it was considered more meaningful for the purposes of the comparison of this indicator.

Regarding the EC min strategy, it actually manages to reduce the cost of the electricity with respect to all the reference cases. The maximum reduction of 13.3% is achieved with respect to the rule-based scheduling strategy PVB max , which is understandable as this strategy is not conceived neither to perform scheduling nor to target the energy-cost reduction in its rules. When the PVB max is used as a balancing strategy, it obtains the best performance among the reference strategies considered (-8.1%), but still worse than the EC min -NWP Forecasts and energy management in a microgrid: Impact on services provided by a smart building

Seasonal forecasting errors

In this section, the relative errors (rMAE, rRMSE, rMBE) are computed for all the forecasting methods used in this work, for the entire test period (annual forecasting errors), as well as for each season of the year. This appendix has been referenced in chapter 4.

Appendix C Energy cost and carbon footprint

In this section, the main results and a short analysis is presented, when the energy cost (EC) and the carbon footprint (CO2) indicators are computed without taking into account any PV associated costs or corrections for battery cycling-life reduction. This is an extension of the results presented in section 4.6.3 of chapter 4. , show the performance results regarding the energy cost and CO 2 content of the energy, when using different quantile forecasts. For the energy cost, the EC min scheduling strategy is used, whereas for the carbon footprint, the corresponding CO 2min strategy is applied during the scheduling. The BAL module is common to all scheduling strategies, as usual. These results are obtained with the nominal -constant-values of TOE and embedded CO 2 emissions for the battery only, without the corrections of equations 4.6 and 4.13. This means that, the total energy delivered by the battery throughout its life (TOE), is considered constant, no matter how the EMS use this resource. PV costs and embedded CO 2 are not taken into account in these results.

Figure C.1(a) suggest a decreasing correlation between the energy cost and the quantile used as forecast, with the exception of the quantile AnEn τ=0.1 . In general, the greater the quantile the less the battery is used (i.e. battery is empty more time during the year), due to the over-estimative forecasts, therefore the cost decreases, as the electricity coming from battery has a high cost compared to the grid electricity.

In the lower quantiles, we observe an interesting fact that doesn't follow the abovementioned logic. First of all, the battery use (i.e. total energy exchange by the battery during the test period) tends to decrease. This happens because the battery is used mostly to store the PV surplus, and if the EMS receives very pessimistic forecasts (i.e. low quantile forecasts), it will not schedule the battery to charge, as it will "think" that there will be almost no PV surplus to be stored. Now, if the battery use is less, and the higher use of battery was mentioned before to be the cause of an increase in the electricity cost, we wonder why The complete guide of the practical experience proposed to the students using the nanogrid is presented in this section. All the exercises, indications as well as tables to be filled out by the students during the practice are included. This complements the presentation of the pedagofical outcomes of the nanogrid presented in chapter 2.

Executive Education -Entrepreneurship in Renewable Energy -2018

Microgrid performance and management experience (source: https://www.esolar.co.nz/off-grid-solar-systems/ )

Microgrids Lab

The general objective of the next experiences is to understand some basics about microgrids (particularly PV-powered microgrids). We will study some issues that one must face during its operation (such as Joule losses and temperature-related losses) as well as how the power flows behave and how we can control them. In the last part, we will play a game to study the importance of the consumption planning and management in order to make the most of the solar energy and to decrease the overall cost of the system.

DC Power Flows and Joule Losses

Objective: Understand the behavior of DC power flows in a microgrid and explore basic ways to control them. Study the effects of joule loses within a microgrid.

Connections

Check and understand the connections of the components as depicted in Figure 1. Make sure that both, power source and variable load are turned off before connection. To connect/disconnect any branch of the system use the relays provided for that purpose. You can operate them from the software interface or manually using the switch located next to each relay.

Figure 1. Connections Sketch

Joule Losses

Joule losses play an important role in any electrical system, especially in a PV-powered microgrid, where the main goal is to make the most of solar energy by maximizing efficiency and reducing losses as much as possible. In building-size microgrids, these losses can account for a high percentage of the total solar production, decreasing the overall efficiency of the system, hence, making it more expensive. For this reason, we are going to observe how much power we are losing in a small-scale system in the form of heat (Joule losses).

Procedure

Connect the power source and variable load branches. Make sure the other 2 branches are disconnected. Turn on the power source and adjust the current limit to 20 Amps and the output voltage to 13 Volts. Then, turn on the variable load and increase the consumption in steps of 10 Watts (from 0 up to 90 Watts) taking note of the voltage, current and power at every step in the load and power source. You can create a table to write down the measurements as follows: Are there differences between the measurements in the load and power source in terms of voltage, power or current? You can plot power vrs current and voltage vrs power (including load and power-source in the same plot) to help observing any difference. Current should be the same for both, load and power source, as they are connected in series.

If you find differences in power and/or voltage, how could you explain each of those differences?

12/12 When a change in the system occur (in load and/or irradiance) try to observe how the system passively (without any intervention from your part) compensates and adjusts itself so that the balance between generation and consumption is assured. Try different irradiance scenarios (simulated ones) and also the real PV production with the exterior PV panel and see the reaction of the system. You can manually play with the load, leave it constant or use a predefined load profile.

You can also play with power source (either voltage level or the current limiter) to observe how you can provoque also changes in the natural state of the system regarding power flows and voltage levels.

Try to provoke a situation when the total production of the system is not enough to In this appendix, a sample of the evaluation applied to the students at the end of the practical experience described in chapter 2 is presented. After solving the quizz individually, the solution is performed step by step and a final discussion is favored in order to bring out the main learning outcomes of the session.