Sylvain Serra

Sandra Machado

Briand, whose role in the management of the PhD candidates

List of Figures

List of Tables

 Table 4-
Nomenclature and Symbols

DOTS nomenclature

𝐶

thermal capacitance (J•K -1 ) 𝐶𝑝 specific heat (J•kg -

Foreword

During the past ~250 years the planet has seen an unprecedented degree of change. The human species gained a control of its surroundings never seen before, becoming capable of transforming their environment rather than just inhabiting it. During this time humanity experienced the industrial revolution, which freed millions of people from basic activities to focus on art, science, leisure, or anything they fancied. This time saw the information revolution, granting unparalleled access to information to anyone with a linked device and the capability of instant communication. People left the fields and flocked to the cities, making it easier for everyone to obtain access to food, water, transport, electricity, health, education, and a myriad of other products and services. Never has humanity been as rich as a whole in history.

But this change did not come for free. This seemingly unlimited access to information, communication, products, and services requires great amounts of energy to be sustained.

Energy whose conversion leaves a dire mark on the planet, energy that is ever increasingly harder to obtain. This is not new for us humans; our advancements have usually come with an increase in energy use accompanied by an environmental toll. After food, wood was for millions of years our prime source of energy. As communities grew, forests disappeared. We then changed to coal, protecting our forests, and darkening our skies. Oil came next, clearing the skies by filling them with invisible pollutants and greenhouse gases…

We are at a turning point for humanity. Our decisions today will have an impact lasting for generations to come. Many of us are aware of this and are trying to find a solution to the million-year old question: Can there be development without an increase in energy use? Can there be an increase in energy use without a negative environmental effect? Many possible solutions have been proposed, the one with the most traction is possibly the change to renewable sources of energy (RES). For millions of years, we have depended on fuels to harvest energy: wood, coal, oil, uranium. A change to RES is possible, but they require a change of paradigm as well. You cannot burn wind in a reactor whenever you want, you cannot feed sunlight to a furnace whenever you are cold, you cannot make it rain as you please.

xxii xxiii

Résumé Substantiel

Mots Clés : Réseaux de chaleur, Modélisation Dynamique, Optimisation des Systèmes Dynamiques, Réseaux Thermiques Intelligents, Evaluation Energétique, Evaluation Economique, Evaluation de la Qualité de Service Le contexte de part croissante des Énergies Renouvelables (EnR), d'une production de plus en plus décentralisée, de bâtiments plus efficaces, de couplages de production multi-énergies, de systèmes énergétiques intégrés, de stockage…, en complément du déploiement croissant de réseaux de chauffage urbain basse température et de smart grids, exige une évolution dans la façon dont les réseaux d'énergie sont conçus et exploités. Avec une population mondiale de plus en plus urbaine, un nouveau modèle de ville est apparu : la Smart City. La Smart City est définie, entre autres composantes de sa définition, par un nouveau modèle de gestion de l'énergie qui vise à garantir l'approvisionnement en énergie de tous en atténuant l'impact sur l'environnement [START_REF] Schmidt | Towards smart cities: Challenges and opportunities for thermal Urban networks[END_REF].

En milieu urbain, les trois utilisations les plus importantes de l'énergie sont l'électricité, les transports et la chaleur. Des trois, la chaleur correspond à la plus grande part de la consommation finale d'énergie, représentant environ 50% de la consommation dans les villes européennes [START_REF]Final energy consumption by sector and fuel in Europe[END_REF]. Dans le cas des ménages européens, la chaleur représente plus de 75% de la consommation finale d'énergie. Cela fait de la chaleur et des réseaux de distribution de chaleur une cible importante pour mettre en oeuvre des solutions d'efficacité qui réduiraient les coûts et permettraient le déploiement de sources d'énergie alternatives.

La chaleur pour le chauffage domestique et commercial des locaux et pour l'eau chaude sanitaire peut être générée à plusieurs endroits de la ville et être utilisée via un réseau de distribution permettant la mutualisation des productions [START_REF] Lund | 4th Generation District Heating (4GDH): Integrating smart thermal grids into future sustainable energy systems[END_REF]. Ces réseaux de distribution de chaleur sont appelés réseaux de chauffage urbain (RCU en français et DH pour District

Heating en anglais). La taille de ces systèmes varie d'un ensemble de bâtiments jusqu'à une ville complète. Historiquement, la gestion des réseaux DH a été considérée comme un problème statique où le contrôle opérationnel est réduit au minimum et le réseau n'est reconfiguré qu'occasionnellement [START_REF] Bouhafs | Links to the Future: Communication Requirements and Challenges in the Smart Grid[END_REF] - [START_REF] Vesterlund | Optimization of multi-source complex district heating network, a case study[END_REF].

Ce modèle de conception et de fonctionnement s'avère obsolète et incompatible avec le concept Smart City [START_REF] Mazhar | A state of art review on the district heating systems[END_REF]. À l'avenir, le chauffage urbain devra connecter les bâtiments à faible consommation d'énergie via des réseaux basse température avec une efficacité accrue où les xxiv énergies renouvelables et la production décentralisée sont intégrées [START_REF] Lund | 4th Generation District Heating (4GDH): Integrating smart thermal grids into future sustainable energy systems[END_REF]. Ces systèmes devront être économiquement et écologiquement durables. Pour ce faire, les réseaux de chaleur s'appuieront fortement sur les Technologies d'Information et de Communication (TIC). Par analogie avec les réseaux électriques intelligents, le réseau thermique intelligent (STN) s'appuiera fortement sur le couplage des TIC, de la modélisation et de la simulation (M&S) et de l'optimisation pour le suivi de la qualité de services, afin de permettre un échange d'informations rapide et un contrôle efficace [START_REF] Gungor | Smart Grid Technologies: Communication Technologies and Standards[END_REF].

Sur cette base, l'objectif principal de la thèse est de proposer un nouveau modèle de gestion de DH en combinant des outils de modélisation, de simulation et d'optimisation, pour une compatibilité future avec une gestion via les TIC (non abordée ici). Le but est de démontrer la possibilité de transition des systèmes DH vers STN en considérant la dynamique de distribution du système, en lien avec le service énergétique proposé aux consommateurs raccordés aux réseaux. Les résultats de cette recherche montrent les capacités des réseaux DH à devenir une partie intégrante du modèle énergétique local et plus en lien avec le concept de Smart City.

Les travaux présentés ici prennent le réseau électrique intelligent comme point de référence pour proposer des solutions de gestion du réseau thermique plus efficace, tout en abordant les limites de l'analogie entre les deux systèmes de distribution. Ces différences proviennent notamment de la dynamique impliquée dans la distribution de la chaleur. Contrairement aux réseaux électriques, une variation de la production de chaleur nécessite un certain temps avant d'être perçue par les consommateurs selon leur position sur le réseau. De même, il existe une certaine inertie thermique du réseau qui impacte toute action de changement de l'état de ses variables de pilotage. Les travaux de recherche présentés ici prennent en compte cette spécificité et proposent un nouveau modèle de gestion de ces systèmes basé sur l'optimisation dynamique de la distribution, dans le but d'une sa transition vers des réseaux thermiques intelligents (ce modèle sera appelé DOTS (Dynamic Optimization of DH for its Transition towards Smart Thermal Networks) dans la suite du document).

Le modèle DOTS est constitué de trois parties : la modélisation dynamique des réseaux de distribution des DH, l'optimisation du réseau de chaleur dans son ensemble et une évaluation multicritère de sa performance. L'approche de modélisation est basée sur la modélisation physique des réseaux DH à l'aide de graphes orientés et d'une méthode modifiée des volumes finis. L'optimisation est divisée en deux étapes : L'optimisation de l'ordre de mobilisation des différents systèmes de production (dispatch) et l'optimisation de la température de xxv génération. Le dispatch correspond à un ordre de priorité basé sur le coût de production et l'optimisation des températures de production est réalisée en minimisant la production totale, la demande non satisfaite (déficit) et l'excès de chaleur (surplus). L'évaluation globale du réseau de chaleur se fait au travers d'indicateurs énergétiques, économiques et de qualité de service.

Le modèle de simulation, appelé Dynamic Model car il permet une simulation dynamique du réseau, donne des informations sur le délai entre la production de chaleur et sa disponibilité La partie optimisation de DOTS s'appelle DOft et combine deux niveaux d'optimisation via deux outils différents. L'optimisation de la production de chaleur (plus précisément du dispatch) se fait à l'aide de HeatGrid [START_REF] Marguerite | APPLICATION OF A DISTRICT HEATING NETWORK (DHN) MODEL FOR AN EX-ANTE EVALUATION[END_REF], un outil développé par IMT Atlantique qui utilise une variante de l'algorithme prédicteur-correcteur de Mehrotra pour sa routine d'optimisation. L'optimisation des températures de génération se fait à l'aide de NOMAD [START_REF] Abramson | The NOMAD project[END_REF], un outil qui utilise l'algorithme MADS [START_REF] Audet | Mesh adaptive direct search algorithms for constrained optimization[END_REF] pour l'optimisation. Ensemble, ils minimisent les coûts de production tout en minimisant la production totale, les déficits et les surplus dans tout le réseau. 1. Un test qui montre ses performances par rapport à la méthode existante Node Volumes Finis.

2. Un test qui montre sa capacité à cartographier la distribution spatio-temporelle de la température dans un réseau DH lorsque les aspects dynamiques sont considérés.

3. Un test qui montre sa capacité à rendre compte de l'inertie du système et des effets de cette inertie.

Les huit stratégies testées à l'aide de l'optimisation DOft, sont :

1. Oft-base : stratégie prenant en compte une température de génération fixe (température non optimisée), un fonctionnement en régime permanent et des coefficients de déperdition thermique moyens constants pour les canalisations du réseau. Chaque heure de fonctionnement est optimisée indépendamment des autres.

Cette stratégie sert de référence pour les autres car c'est celle qui se rapproche le plus de la gestion classique des réseaux actuels.

2. Oft 1 : stratégie prenant en compte une température de production fixe, un fonctionnement en régime permanent et des coefficients de perte de chaleur moyens variables pour les canalisations du réseau. Chaque heure de fonctionnement est optimisée indépendamment des autres.

3. DOft 2 : stratégie tenant compte de l'optimisation de la température de production, du fonctionnement en régime permanent et des coefficients de déperdition thermique moyens variables des canalisations du réseau. Chaque heure de fonctionnement est optimisée indépendamment des autres. Pour l'optimisation DOft, les résultats montrent que la prise en compte de la dynamique du système permet de réduire substantiellement les surplus et les déficits du réseau, réduisant ainsi la production totale. Cela permet également de réduire le recours aux unités de production d'appoint et les coûts associés. DOft 6 permet ainsi de réduire le déficit de that aims at guaranteeing the supply of energy to everyone living in an urban space while mitigating the impact on the environment [START_REF] Schmidt | Towards smart cities: Challenges and opportunities for thermal Urban networks[END_REF].

Within a city, the three most common uses of energy are electricity, transport, and heat. Of the three, heat usually has the largest share of final energy use, accounting for around 50% of the energy use in European cities [START_REF]Final energy consumption by sector and fuel in Europe[END_REF]. In the case of European households, heat accounts for over 75% of the final energy use. This makes heat, and the heat distribution networks, an important target to implement strategies that would increase efficiency, reduce costs, and enable the implementation of alternative sources of energy.

In any city, the heat for domestic and commercial space heating, and domestic hot water can be generated at designated locations and use a distribution network to make it available to the users through a network of pipes [START_REF] Lund | 4th Generation District Heating (4GDH): Integrating smart thermal grids into future sustainable energy systems[END_REF]. These heat distribution networks are called District Heating (DH). The scale of these systems varies from building facilities to a complete city.

Historically the management of DH networks has been considered to be a static problem where operative control is kept to a minimum and the network is reconfigured only occasionally [START_REF] Bouhafs | Links to the Future: Communication Requirements and Challenges in the Smart Grid[END_REF]- [START_REF] Vesterlund | Optimization of multi-source complex district heating network, a case study[END_REF].

This model of design and operation is proving to be outdated and not compatible with the Smart City concept [START_REF] Mazhar | A state of art review on the district heating systems[END_REF]. In the future, District Heating is expected to connect low energy buildings through low-temperature networks with increased efficiency where renewable energies and distributed generation are smoothly integrated [START_REF] Lund | 4th Generation District Heating (4GDH): Integrating smart thermal grids into future sustainable energy systems[END_REF]. These systems are expected to be economically and environmentally sustainable. To do so, DH will rely heavily on communication and control infrastructures. In analogy with the electricity Smart Grid, the xxxii Smart Thermal Network (STN) will depend on Information and Communication Technologies (ICT), Modeling and Simulation (M&S), and optimization for quality monitoring, timely information exchange and effective control [START_REF] Gungor | Smart Grid Technologies: Communication Technologies and Standards[END_REF].

Based on the relevance of Heat as one of the primary end-uses of energy in a city, and the Operator (DHO) to know the state of charge and discharge of the system's pipes and use this information to better adjust generation and supply, thus reducing the surplus and deficits experienced by the network and improving the QoS and energy efficiency of the system.

The optimization part of DOTS is named DOft and is carried out using two different optimization tools. The optimization of the dispatch of heat is done using HeatGrid [START_REF] Marguerite | APPLICATION OF A DISTRICT HEATING NETWORK (DHN) MODEL FOR AN EX-ANTE EVALUATION[END_REF], a tool developed by the IMT Atlantique that uses a variant of Mehrotra's predictor-corrector algorithm for its optimization routine. The optimization of the generation temperatures is done using NOMAD [START_REF] Abramson | The NOMAD project[END_REF], a tool that uses the MADS algorithm [START_REF] Audet | Mesh adaptive direct search algorithms for constrained optimization[END_REF] for the optimization.

Together they give as result the mode of operation that minimizes generation costs at the same time as minimizing total generation, deficits, and surplus in the whole network.

The present research identified an opportunity regarding the evaluation of DH systems in a holistic manner. Currently, studies on the optimization of DH focus primarily on optimizing its energy efficiency or its economic performance. Studies focused on the Quality of Service 1. A test that shows its performance compared to the existing Finite Volumes Node method. xxxiv 2. A test that shows its ability to map the spatial-temporal distribution of temperature in a DH network when the dynamics are considered.

3. A test that shows its ability to account for the inertia of the system and the effects that this inertia has.

The eight strategies tested using the DOft optimization, together with their names, are: Every hour of operation is optimized independently of each other.

4. DOft 3: a strategy considering generation temperature optimization, the dynamics of the operation (delay, inertia, and short-term storage of the pipes), and variable average heat loss coefficients for the pipes in the network. The optimization period is extended to three hours to guarantee convergence and every period is optimized independently of each other.

5. DOft 4: a strategy considering a constrained generation temperature optimization (no more than ±5°C between optimization periods), the dynamics of the operation, and variable average heat loss coefficients for the pipes in the network. The temperature constraint represents systems that prioritize mass flow control or systems whose generation plants cannot have quick variations in their operation temperature. The optimization period is extended to three hours and every period is optimized independently of each other.

6. DOft 5: a strategy considering a constrained generation temperature optimization (no more than ±10°C between optimization periods), the dynamics of the operation, and variable average heat loss coefficients for the pipes in the network. The optimization period is extended to three hours and every period is optimized independently of each other. xxxv 7. DOft 6: a strategy considering generation temperature optimization, the dynamics of the operation and variable average heat loss coefficients of the pipes in the network.

The optimization is changed to a three-hour horizon with a one-hour sliding window.

Within the horizon, every one-hour time step is optimized but the optimum is found for the horizon, not the independent time steps. Once a solution is found, the horizon advances one hour and the optimization is repeated. In this way all optimizations are connected to the previous and the next optimizations. This is called a horizon optimization.

8. DOft 7: a strategy considering generation temperature optimization, the dynamics of the operation, variable average heat loss coefficients for the pipes in the network and Demand Response (DR) capabilities. The optimization is changed to a horizon optimization. The horizon is set to three hours with a one-hour sliding window, thus all optimizations are connected to the previous and the next optimizations.

The results for the three tests for the Dynamic Model show that, when compared to the Finite Volumes Node method, it adds robustness to the results when working with fixed spatial discretization of the pipes and it also reduces the computation times while maintaining the accuracy. The results also showed that even when the temperature and mass flows at the generation plants is known, the number of variables and physical phenomena make it hard to know the real-time status of the network without monitoring equipment or modeling tools like the one here presented. This is relevant as many DH networks have limited monitoring to assess the behavior of the system beyond the point of view of the generation plants.

The Dynamic Model also allowed the study of the effects that the delay, the losses and the thermal inertia have on the energy supply of a system operating outside of the steady state.

The delay increases the time between generation and supply, but also increases the time that a certain output persists after the input has changed. The inertia of the system affects the After DOTS was tested for the eight optimization strategies, two of them were chosen for a

Case Study using the same network but this time using measured demand data from the DH network of the city of Nantes, in France. The chosen strategies were Oft-base, which resembles the normal management of existing DH systems the most, and DOft 7, which had the best results during the test. This case study showed that in a more realistic environment, where the demand does not remain constant during the optimization period, DOft 7 does not perform as well as in the controlled tests, but it is still capable of giving improved results.

DOft 7 achieved 4,68% better efficiency, increased the revenue by 0,47 €/MWh-demand and the profit by 2,37 €/MWh-demand. Most importantly, it substantially changed the QoS of the system. With DOft 7, the number of interruptions (SAIFI) was increased from 0,12 interruptions per customer per week to 0,85 interruptions per customer per week, mostly due to the DR scheme used. However, being able to plan the interruptions, rather than they appearing first and the system reacting later, allowed the CAIDI to be reduced from 1h38

waiting time for the costumer to just 23,42 minutes. This is of important interest for future work, as being able to effectively manage the interruptions in the system can lead to further improvements in the operation of the network.

The combination of all the results presented above show the potential of DOTS. DOft 7 uses a horizon optimization to predict future deficits (or surplus) and adapts the operation The European Commission defines Smart Cities as "a place where traditional networks and services are made more efficient with the use of digital and telecommunication technologies for the benefit of its inhabitants and business" [START_REF]Smart cities[END_REF].

This definition is broad, as the Smart City remains an evolving concept that tries to tackle as much of the urban struggles of a city as possible. However, at its core, the Smart City is a new model of resource management that aims at guaranteeing the supply of energy and other resources to everyone living in an urban space while mitigating the impact on the environment [START_REF] Schmidt | Towards smart cities: Challenges and opportunities for thermal Urban networks[END_REF]. When it comes to energy, the Smart City proposes a model where the consumer adapts to the energy availability as much as the producer adapts to the costumer's needs. When to produce, where to produce, when to consume, where to consume, when to store, where to store; all these activities become adaptable and flexible. To achieve this, the Smart City relies on an information and communication foundation that allows the free sharing of information with the goal of enabling the systems to make decisions that will improve their performance as a whole [START_REF] Niemi | Urban energy systems with smart multi-carrier energy networks and renewable energy generation[END_REF]. In this model, Information and Communication Technologies (ICTs) together with computational Modeling and Simulation (M&S) play a preponderant role.

In a Smart City, ICTs enable the access, storage, transmission, and manipulation of large amounts of data to provide the high information and communication requirements through the combination of equipment, software, signals, protocols, and regulations for the proper manual and automated operation and control of the system [START_REF] Gungor | Smart Grid Technologies: Communication Technologies and Standards[END_REF], [START_REF] Gungor | Opportunities and Challenges of Wireless Sensor Networks in Smart Grid[END_REF]. M&S become a tool to develop data for the prediction and forecast of the behavior and performance of systems in different time frames, often using physical principles in combination with mathematical representations of the system being studied. For the energy sector of a Smart City, M&S is fundamental for decision making [START_REF] Connolly | A review of computer tools for analysing the integration of renewable energy into various energy systems[END_REF].

Energy distribution networks where real-time decisions are being made with data provided by ICTs and processed by M&S are commonly known as Smart Networks [START_REF] Mourshed | Smart Grid Futures: Perspectives on the Integration of Energy and ICT Services[END_REF]. They form the backbone of the current effort to transition towards the Smart City. The Smart Network is a relatively new concept, but most authors [START_REF] Koliou | Quantifying distribution-system operators' economic incentives to promote residential demand response[END_REF]- [START_REF] Xue | An interactive building power demand management strategy for facilitating smart grid optimization[END_REF] agree that Smart Networks are systems capable of:

1) Making automated decisions concerning the current and future status of the network to guarantee its expected operation.

2) Integrating all users connected to the network and enabling them to participate actively in the network's activities.

The overall objective is that the networks achieve higher efficiencies (economic and technical) and environmental sustainability while maintaining the Quality of Service (QoS).

The Smart Network gained international attention when the electricity sector started to apply them in what we now call Smart Grids [START_REF] Crispim | Smart Grids in the EU with smart regulation: Experiences from the UK, Italy and Portugal[END_REF]. In a smart grid, multiple energy sources supply the electricity to consumers implemented with decision-capable mechanism like smart meters, smart appliances, and flexibility measures. Information is shared between consumers, producers, and the distribution network to give preference to RES and energy efficient resources without congesting the grid. Control tools and protocols are put in place to optimize the use of energy, reduce Green House Gases emissions, and guarantee the QoS [START_REF] Schmidt | Towards smart cities: Challenges and opportunities for thermal Urban networks[END_REF], [START_REF] Crispim | Smart Grids in the EU with smart regulation: Experiences from the UK, Italy and Portugal[END_REF].

The study of Smart Grids relies heavily on M&S to predict their behavior before real implementation, as well as to develop the control needed for their operation. M&S is aided by optimization algorithms to find the best solutions to the problems studied. The combination of Modeling, Simulation and Optimization has proven to be a powerful tool on the development and transition of electrical networks into the Smart Grid. An example of this can be seen in [START_REF] Christakou | A unified control strategy for active distribution networks via demand response and distributed energy storage systems[END_REF]. In this work the authors describe a control algorithm named "Unified Broadcast-Based Active Distribution Networks control" which uses the "Grid Explicit Congestion Notification Mechanism" to control and provide ancillary services in grids with dispersed generation by managing resources like transformers and electricity buses. The proposed system models the electricity network as a constrained optimization problem whose solution is the optimal nodal power adjustments and transformer positions. The solution from this optimization is fed to local controllers along the network via the notification mechanism. The local controllers react to the signals received to adjust the energy flows in the network, thus balancing the system and reducing congestion and losses. The authors of this study conclude that ICTs are determinant in the control of complex distribution systems, and control algorithms could reliably enable Smart Grids to take over the current top-down centralized energy systems.

Several examples like this can be found on Smart Grids and the improvements they bring to the electricity distribution networks. Most of them use M&S in combination with optimization algorithms to demonstrate their effectiveness (see literature review). However, electricity is not the only component of the energy sector in a city. Within a city, the three most common uses of energy are electricity, transport, and heat. Of the three, heat usually has the largest share of final energy use, accounting for around 50% of the energy use in European cities [START_REF]Final energy consumption by sector and fuel in Europe[END_REF]. In the case of European households, heat accounts for over 75% of the final energy use [START_REF]Energy consumption in households -Statistics Explained[END_REF]. This makes heat an important target for strategies that would increase efficiency, reduce costs, and enable the implementation of alternative sources of energy and new modes of operation.

In any city, the heat for domestic and commercial space heating and domestic hot water can be locally generated at the sites of consumption using natural gas, biomass, the sun, or electricity. However, it has been proven that in many cases it is better to have central locations for its generation and use a distribution network to make it available to the users [START_REF] Lund | 4th Generation District Heating (4GDH): Integrating smart thermal grids into future sustainable energy systems[END_REF]. Having centralized generation can lead to higher operational efficiencies, reduced capital cost of new developments and simpler distribution networks for other energy carriers. A centralized production also enables the investment in flue gas treatment, which is too expensive for distributed systems. In many instances heat is also already being produced as a byproduct of electricity generation, waste management and industrial processes; having a network to distribute this heat lowers the energy intensity compared to a city where this heat goes to waste and new heat is produced locally at the consumption sites. This heat distribution network is named District Heating (DH). DH is a system that supplies heat to different users connected to centralized and distributed heat generation units through a network of pipes. The scale of these systems varies from building facilities to a complete city. However, DH networks still lack widespread penetration in most of the world, including Europe, where DH supplies around 12% of the total space heating and domestic hot water demand. In the case of France, DH accounts for around 7% of the domestic and commercial heat supply, but in accordance to the Heat Road Map for 2050, DH is expected to expand to provide at least 25% of this heat by the end of 2050 [START_REF]Heat Roadmaps -Heat Roadmap Europe[END_REF]. This calls for timely action in the development of new DH systems, as well as new forms of system management.

Historically, the management of DH networks has been considered to be a static problem where operative control is kept to a minimum and the network is reconfigured only occasionally [START_REF] Bouhafs | Links to the Future: Communication Requirements and Challenges in the Smart Grid[END_REF]- [START_REF] Vesterlund | Optimization of multi-source complex district heating network, a case study[END_REF]. This model of design and operation is proving to be outdated [START_REF] Mazhar | A state of art review on the district heating systems[END_REF]. In the future, district heating is expected to connect low energy buildings through low-temperature networks with increased efficiency; it is also expected that the heat, electricity and transport sectors will be coupled together, and that renewable energies and distributed generation will be smoothly integrated [START_REF] Lund | 4th Generation District Heating (4GDH): Integrating smart thermal grids into future sustainable energy systems[END_REF]. These systems are expected to be economically and environmentally sustainable. To do so, DH will likely rely heavily on Communication and Control infrastructures, like Smart Grids do. In analogy with Electric Smart-Grids, Smart Thermal Networks will depend on ICTs, M&S and Optimization for quality monitoring, timely information exchange and effective control [START_REF] Gungor | Smart Grid Technologies: Communication Technologies and Standards[END_REF].

The implementation of Smart Networks into DH has been explored, but literature on the topic is scarcer than for Smart Grids. Studies exist on the integration of ICTs into DH and their transition towards Smart Thermal Networks, one of the most referenced is the work done by H. Lund et al. [START_REF] Lund | 4th Generation District Heating (4GDH): Integrating smart thermal grids into future sustainable energy systems[END_REF], where the authors present some key challenges for the 4 th Generation District Heating (4GDH) with an emphasis on the role of ICTs and Smart Metering and Control to overcome these challenges. However, there is still uncertainty on if and how can DH networks make this transition.

Based on the relevance of Heat as one of the primary end-uses of energy in a city and the lack of literature The present research takes the electricity smart grid as the starting point to propose M&S solutions for smart thermal networks that consider the differences existing between heat and electricity distribution systems. In the case of electricity systems, generation, supply, and consumption happen at the same time.

Generation and consumption are strictly linked and a change in one will be immediately sensed by the other. This is not the case in heat systems, where its distribution dynamics have a significant effect. If a variation is done on the generation side of a DH network, hours could pass before they are perceived by some of the consumers as the hot water takes time to travel through the pipe network (i.e. it takes 14 minutes for the water to traverse a 1 km-long pipe at a flow rate of 1.2 m/s). This delay between generation and supply changes the way that DH networks need to be operated, as a difference between supply and demand in a node far away from a generation plant could require a long time before it is solved. The delay is one of the reasons why the operative control of DH is often considered a static problem, and generation usually over-estimates the demand to guarantee that no deficits will exist. The second important difference between electricity and heat distribution networks is the inertia of the system. In heat networks, all decisions made in the past persist for a length of time in the network. No change made at any element of the system will have an immediate effect and time is needed before a previous status is dissipated and a new one instated. The combination of these two dynamic characteristics is a reason why DH networks are usually controlled on longer time steps, which help "absorb" these effects.

For this reason, to reach the objective of the present research three research questions are formulated and answered:

RQ 1: How can the dynamics of heat distribution be addressed, mitigated, or used in benefit of DH networks?

As stated above, the dynamics of heat distribution differ from those of electricity and have a substantial effect on the operation of the network. Any new mode of operation must be able to handle the delay and inertia of DH, either reducing their negative effects or, if possible, use them to the advantage of the network.

RQ 2: How can the system management of DH be improved to reduce costs, increase efficiency, and improve quality of service?

The Smart City calls for a different mode of operation. It is not only necessary it improve the individual elements of a DH system, but also how they work and interact together. How could this be done in DH is a focus of the present research.

RQ 3 How can we measure and evaluate the operation of DH from a system's perspective?

In a Smart City, energy networks are no longer viewed as providers of energy, but rather as providers of an energy service. Its players and its constitutive elements are no longer consider independently, but as part of a whole. The evaluation of this type of systems needs to be upgraded to include the new relevant aspects of it introduced by the Smart City.

To give answer to these questions and achieve the main objective of the present research, three specific objectives are proposed (see Figure 1-1) and the methodology is defined. The simulation model can address the dynamics of a DH system and give information on the delay between generation and supply, the heat inertia of the network, and the real-time distribution of temperatures in the pipes.

SO 2: Testing of different optimization strategies to optimize the use of resources, the supply of energy and the Quality of Service.

Different optimizations strategies are tested to explore the impact on the technical and economic efficiencies of the network as well as on the QoS. Each strategy is based on the results of the simulation model from the first specific objective to account for the dynamics of the system and mitigate their effect (or use them to the system advantage). With the European countries aiming at expanding their DH infrastructure as part of H2020 and the 2050 Heat Road Map, and the Smart City rising as a good alternative for urban energy systems, DH needs to be ready to face the new environment of the future. Especially now when the social environment and the social trends are changing how the users interact with the energy sector [START_REF] Sataøen | Towards a sustainable grid development regime? A comparison of British, Norwegian, and Swedish grid development[END_REF]. In developed countries/areas, people expect reliability and flexibility of the supply; low prices on the energy; and generation being done with environmentally friendly technologies that are preferably either aesthetic & quiet, or hidden to the view. They care about global warming, GHG, air pollution, etc. and react to new policies and legislation [START_REF] Nachreiner | An analysis of smart metering information systems: A psychological model of self-regulated behavioural change[END_REF], [START_REF] Skjølsvold | A traveler's guide to smart grids and the social sciences[END_REF].

Society is a capricious driving force for the transition to Smart Cities [START_REF] Skjølsvold | A traveler's guide to smart grids and the social sciences[END_REF] and the social interpretation of what a Smart City means is as important as the available technologies [START_REF] Vesnic-Alujevic | What smart grids tell about innovation narratives in the European Union: Hopes, imaginaries and policy[END_REF]. Being capable to operate in a dynamic setting, where energy has become a service more than a product is a challenge that DH has to overcome to remain the relevant, energy efficient, environmentally friendly alternative that it promises to be. For this reason, it is imperative to develop the foundations for system management that will allow the DH to operate in the Smart City context and demonstrate that DH is up to the needs our future brings.

The present research aims at this by developing and presenting a novel model for system management of DH that would ease its transition into Smart Thermal Networks and hence, our future. This work is presented in eight chapters. The literature review conducted for this research is presented in Chapter 2;

the

Literature Review

With the main objective of proposing a novel model for system management of DH by combining Modeling, Simulation, and Optimization tools, the literature review here presented focuses on the techniques, tools and software tools used in the DH area to model and simulate the operation of heat distribution networks, the characteristics of heat transport in pipes, and the optimization algorithms used to find optimum solutions to different optimization problems. Several commercial and free software already exist that can do this to some extent, and four of them are presented here and use as a benchmark for the contributions of the present research. These are TRNSYS, DER-CAM, HOMER and BoFiT.

TRNSYS is a flexible software environment with a modular structure used to simulate the behavior of transient systems [START_REF]Welcome | TRNSYS : Transient System Simulation Tool[END_REF]. It is composed of two parts: 1) the engine that reads and processes the inputs, iteratively solves the system, determines convergence, and plots system variables, and 2) a library of components. TRNSYS works by modeling each of the components of a system and simulating their interactions. Each component can be selected from a library or created by the user. Existing components can also be modified to new specifications. This flexibility makes TRNSYS a good platform for the simulation of thermal and electrical energy systems and has been extensively used for this purpose. An example of TRNSYS applied to DH can be found in [START_REF] Bava | Development and validation of a detailed TRNSYS-Matlab model for large solar collector fields for district heating applications[END_REF]. In this paper, the authors present their work to develop a detailed TRNSYS-Matlab model for the simulation of a large solar collector field used in a district heating application. They reproduce the actual control strategy for the regulation of flows in the solar plant with the results showing good agreement with field measurements. The elements of the model (i.e. pipes) were simulated using TRNSYS, but as this software cannot solve problems of flow distribution in hydraulic networks, Matlab was used to evaluate the flow distribution in the different collector rows.

The use of Matlab increased the agreement of the model with the measured data, but also increased the computation times. The authors recognize that the better levels of accuracy may not justify the longer computation times. Another example is found in [START_REF] Braas | District heating load profiles for domestic hot water preparation with realistic simultaneity using DHWcalc and TRNSYS[END_REF], where the authors use TRNSYS to model four different substation types to generate realistic load profiles of consumer buildings. They use their model for carrying out dynamic simulations of the heat load of 11 fictitious buildings for domestic hot water preparation in new residential developments. The load profiles are obtained through a yearly simulation using DHWcalc, a tool for generating domestic hot water draw-off profiles built upon a statistical method. Their results show that during the preparation period, losses account for between 27% and 52% of the final energy demand.

DER-CAM, which stands for Distributed Energy Resources Customer Adoption Model, is a technoeconomic model for the design of systems with distributed energy resources, like buildings or micro-grids [START_REF]The Distributed Energy Resources Customer Adoption Model (DER-CAM)[END_REF]. It uses information like fuel prices and hourly demand in combination with the technologies' specifications to propose the combination of technologies that should be adopted and how they should be operated. It is well versed to find the optimal selection, sizing, placement, and dispatch of distributed energy resources, while also considering actions like load shifting, peak shaving, and power exports.

DER-CAM uses Mixed-Integer Linear Programming (MILP) for its optimization model, thus it requires the optimization problem to be described using linear formulation to be able to solve it. An example of the use of DER-CAM in DH is found in [START_REF] Stadler | Optimizing Distributed Energy Resources and building retrofits with the strategic DER-CAModel[END_REF]. In this work, the authors present a DER-CAM model of an Austrian University Campus building where the model has been enhanced to consider building retrofit measures together with Distributed Energy Resources investment options to effectively optimize energy costs and CO2 emissions. According to the authors, DER-CAM was chosen as it is the only tool to their knowledge that considers passive improvements and DER technologies, and which can be used to compare the results to the existing building. The results obtained suggest that the global heat transfer coefficient of the building could be improved approximately 25% better than what it currently is. The authors conclude that the complexity of interactions between DER technologies and passive measures call for a holistic optimization approach that cannot always be found in existing software.

HOMER, which stands for Hybrid Optimization Model for Multiple Energy Resources, is a tool developed for the design and the technical and financial evaluation of on-grid or stand-alone power systems that act as a micro-grid or as distributed generation [START_REF]HOMER Pro -Microgrid Software for Designing Optimized Hybrid Microgrids[END_REF]. This tool allows the user to consider a wide variety of energy conversion technologies that can act as centralized, distributed or off-grid generation. HOMER then simulates all possible combinations of the technologies selected and proposes the one or ones deemed most viable. HOMER's simulations work on a time step between one minute and one hour and can simulate up to an entire year. For the selection of the most viable system, HOMER features a trademarked optimization algorithm, HOMER Optimizer™, that identifies the least-cost options for micro-grids or other distributed generation electrical power systems. HOMER is well versed for the simulation of electricity systems but is incapable of considering the dynamics involved in heat distribution networks. Two clear examples for the use of HOMER can be found in [START_REF] Khalil | Optimization and designing of hybrid power system using HOMER pro[END_REF] and [START_REF] Balachander | Optimization in design of hybrid electric power network using HOMER[END_REF]. In [START_REF] Khalil | Optimization and designing of hybrid power system using HOMER pro[END_REF],

the authors use HOMER Pro to propose a DG system for the region of the Baluchistan Seashore in Pakistan. HOMER Pro is used to compare a solar-wind-grid system to a solar-grid system, a wind-grid system, and a grid-only system. The systems are evaluated based on their power generation, emissions, net present cost, and average electrical production cost, which are outputs of HOMER. In [START_REF] Balachander | Optimization in design of hybrid electric power network using HOMER[END_REF] the authors propose to refine the hybrid electrical power supply of a single residence building located in Tamilnadu, India. The load is supplied using solar panels, wind turbines and a diesel generator. The simulation and optimization of the hybrid system are carried out using HOMER Pro to find the best combination of power sources to supply the demand at the lowest cost and with the lowest emissions.

BoFiT is a software developed by ProCom that uses MILP to describe heat and power plant operations [START_REF]BoFiT Optimization[END_REF]. Different objectives can be optimized using BoFiT, like investment planning, trading flexibilities and production costs of the facilities. BoFiT requires hourly resolution and, similar to DER-CAM, assumes linear dependence between inputs. This gives BoFit the capacity, i.e., to determine the heat or power plant combination that will achieve the lowest costs for each hour of operation. An example of its application in the research of DG can be found in [START_REF] Karkulahti | Optimization of a Combined Heat and Power Plant for the Future Electricity Market[END_REF]. In their Master thesis, the authors present an evaluation of the Swedish energy system for the year 2025. They focus their work on electricity spot prices and how they will affect the operation of a CHP plant. They use BoFiT to build a model for the studied CHP plant and its connected DH network. The model is tested for six scenarios where the electricity spot price is set taking into consideration the access to future wind and nuclear power. The BoFiT model assumes linear dependence between inputs but not all components had linear behavior within the range of the study, so some of the model components were broken into sections where a linear relationship could be assumed. The results show that the electricity prices tend to be more volatile in 2025 which would call for more control and regulation for the operation of this kind of systems.

From the review on some of the existing tools, TRNSYS is a flexible modeling platform that can be used for modeling and then be combined with other optimization tools. DER-CAM, HOMER and BoFiT require Linear Programming formulation, which limits their ability to answer the research questions of the present research: "How can the dynamics of heat distribution be addressed, mitigated, or used in benefit of DH networks?" These three tools are well versed to optimize DH networks under steady state operation, but they struggle with the dynamics present in heat distribution. TRNSYS can model these dynamics, but it has to be paired with an optimization tool capable of solving the resulting non-linear problem. The following literature review will address other approaches for the modeling, the simulation and the optimization of DH networks that will help achieve the main objective of the present research.

Section 2.1 presents the review on modeling tools and approaches for the modeling of DH networks, section 2.2 presents a review of the optimization algorithms commonly used to solve DH optimization problems, and section 2.3 presents the literature, or rather, the lack of, on holistic evaluation frameworks for the assessment of the performance of DH networks including the QoS and customer satisfaction as well as energy and economic indicators.

Modeling of DH systems

Modeling is an effective tool to represent real physical phenomena under controlled conditions. When properly constructed and applied, mathematical representations of the physical phenomena through differential equations, and/or statistical models, give invaluable aid on obtaining information on systems without the need to physically build them. When it comes to modeling DH networks, two main approaches have been pursued in the literature: data-driven models and physical models [START_REF] Zheng | Function method for dynamic temperature simulation of district heating network[END_REF]. Data-driven models are models that consider only the input and outputs of the system and do not need explicit knowledge of the physical behavior of the system. They are known for their speed but can present low accuracy on highly dynamic DH systems. Physical models are models that focus on the physical aspects of the system. In the explored literature, they are preferred for modeling DH when there are high or quick variations of the temperature, or when information from within the pipes is relevant (not only inputs and outputs). The present research focuses on physical models, as the information contained within the pipes is relevant for the proposed model of system management.

Many examples of physical models exist in the literature, which can be classified according to their different approach. Some of the first methods were the element method, the characteristic method, and the node method. Both the element method and the characteristic method rely on discretizing the pipe into a finite number of elements and then computing each element individually by treating the flow of water as an advection-diffusion equation, where the output of one becomes the input of the next as to follow the temperature propagation. As early as 1979, [START_REF]A stable and accurate convective modelling procedure based on quadratic upstream interpolation -ScienceDirect[END_REF] presented the QUICK scheme for solving the heat transport equation using the element method.

In the case of the node method, the outlet temperature is calculated based on the inlet temperature and the delay of the propagation. Both the element method and the node method are described in [START_REF] Benonysson | Dynamic modelling and operational optimization of district heating systems[END_REF] and later were compared in [START_REF] Gabrielaitiene | Evaluation of Approaches for Modeling Temperature Wave Propagation in District Heating Pipelines[END_REF] showing better and faster results for the node method. This method was used in [START_REF] Sataøen | Towards a sustainable grid development regime? A comparison of British, Norwegian, and Swedish grid development[END_REF] and [START_REF] Nachreiner | An analysis of smart metering information systems: A psychological model of self-regulated behavioural change[END_REF] to model the Naestved DH system in Denmark. The model's results are compared with the commercial software TERMIS and show that for near-steady state conditions no discernable difference is made between the two, but the studied model has issues with sudden or large changes in the temperature and with long pipelines.

Like the element method, the characteristic method discretizes the pipe but the equations for heat transport are transformed into an ordinary differential equation along the characteristic lines so a solution can be obtained. In [START_REF] Stevanovic | A hybrid method for the numerical prediction of enthalpy transport in fluid flow -ScienceDirect[END_REF] the authors propose a hybrid method where the momentum equation is solved using the SIMPLE2 approach [START_REF] Patankar | Numerical Heat Transfer and Fluid Flow[END_REF]. The energy equation is solved with the method of characteristics in combination with Lagrange polynomial interpolation. The method is used to predict the propagation of the heat front and locations where a boiling boundary condition during the transient of the flow could occur with good results. A model based on the characteristic method was used in [START_REF] Stevanovic | Prediction of thermal transients in district heating systems[END_REF] to model the district heating system in Zemum, Serbia. In this work the thermal transient of a system is analyzed, and the results compared with measured data; results show less than 4°C difference between the two with no significant numerical diffusion. Another methodology based on this was later developed by [START_REF] Zhou | Dynamic modeling of thermal conditions for hot-water district-heating networks[END_REF] and validated with the DH network in the city of Linyi, China. The model was able to reproduce the behavior of the network with an error below 4% for the farthest nodes. A modified approach of the characteristic method is presented in [START_REF] Dénarié | Heat transmission over long pipes: New model for fast and accurate district heating simulations[END_REF], where the authors use a model based on the method of characteristics while considering the difference between the turbulent flow and the boundary layer. This approach shows low computational times and good accuracy (less than 1.2°C difference) at different values of Reynolds numbers and the model is further validated by data gathered from real pipes.

Other methods have been proposed that have gains in computational speed, accuracy, or level of detail.

The Function Method, presented in [START_REF] Zheng | Function method for dynamic temperature simulation of district heating network[END_REF], considers the mass flow rate, the losses and the inertia to obtain the analytical solution to the transient energy equation by using the expansion of Fourier series. This method proves to be 37% faster than the Node Method while reducing the average error by 13%-45% during rapid changes in the temperature. A method to optimize the parameters used by the Function Method is proposed in [START_REF] Yuan | Dynamic temperature model of district heating system based on operation data[END_REF], where the authors use measured data to find the equivalent pipe length that better approximates the output temperature of the pipes. A method using the polynomial approximation for the steady state model of a DH network is presented in [START_REF] Hohmann | A two-stage polynomial approach to stochastic optimization of district heating networks[END_REF] to find strategies to operate DH when there is uncertain or variable demand. The authors use this model to minimize the cost of generation in a DH network under different operation strategies. Finally, a modeling approach based on the Finite Volumes method is presented in [START_REF] Wang | Thermal transient prediction of district heating pipeline: Optimal selection of the time and spatial steps for fast and accurate calculation[END_REF]. This method, named the implicit upwind method, is compared to the characteristic line method and the authors conclude that the characteristic line is faster, but the implicit upwind method provides more information on the temperature distribution within the pipe.

In [START_REF] Sartor | A comparative study for simulation of heat transport in large district heating network[END_REF] the authors present a model based on the standard TRNSYS Type 31 component, which is based on the Lagrangian approach. The model, named the plug flow model, is compared to a 1D and a 2D Finite Volumes model. The results show that the plug flow gives the same accuracy as the 1D model while using a rougher spatial discretization and presents lower sensitivity for long pipes. The need of fewer elements in the discretization also allows the plug flow model to be run much faster than the 1D model. This approach is later used by [START_REF] Oppelt | Dynamic thermo-hydraulic model of district cooling networks[END_REF] to model district cooling networks where the results demonstrate that the model is reliable for its implementation during the design phase or the optimization of the operation. Another model based on plug flow was developed by [START_REF] Van Der Heijde | Dynamic equation-based thermo-hydraulic pipe model for district heating and cooling systems[END_REF]. The model was implemented in Modelica, compiled and simulated in Dymola, and made use of the Dassl solver. The results have the same accuracy as the exact solution of the one-dimensional problem model but are obtained faster due to the rougher spatial discretization of the pipes in the system. In [START_REF] Elisa | Thermo-fluid dynamic model of large district heating networks for the analysis of primary energy savings[END_REF] the authors present a thermo-fluid dynamic model that they use for the detailed simulation of large district heating networks. The model provides the evolution of pressure and temperature in each node and mass flow in each branch using the SIMPLE algorithm. The authors conclude that having information on the state of the network can be used to optimize the operation and management of a DH network as well as for peak demand shavings.

As can be seen, many different approaches exist to model DH networks, each with their own pros and cons. Because the present research aims to be a Proof of Concept of the transition of DH into Smart Thermal Networks, models that provide detailed information on the network are preferred to those with faster computational times. For this reason, the present research develops a model based on the Finite Volumes method described in [START_REF] Wang | Thermal transient prediction of district heating pipeline: Optimal selection of the time and spatial steps for fast and accurate calculation[END_REF], which gives detailed information on the physical processes taking place in the pipes as well as their temperature distribution.

Optimization of DH systems

Optimization is an effective tool to find the values of the system's variables that would give the best output given an objective function. Optimization has been extensively used in engineering sciences to maximize performances or minimize costs of products, processes, and services. Every optimization problem requires a realistic mathematical representation of the system to be optimized and an optimization algorithm. An optimization process often involves the evaluation of the objective function many times, exploring thousands or even millions of configurations, thus it is common to use the aid of a computer to run the simulations and use an optimization algorithm to find the best solution quickly.

But even with a powerful computer, each optimization run could take hours, or days, to find a solution.

For this reason, the choice of optimization algorithm as well as the computer program to implement it is of paramount importance.

In some cases, when the amount of simulations needed is limited, the optimization can be carried out using just a simple algorithm, like evaluating the objective function for a few random, or hand-picked, input variables. This technique is especially useful if the objective is to map the solution space or to do a parameter search. In [START_REF] Li | Systematic optimization for the utilization of low-temperature industrial excess heat for district heating[END_REF] the authors propose a systematic model to optimize the temperatures in the primary distribution network and their connection to residual heat sources. They use their simulation model to map the temperature differences between the higher-temperature supply water and the lowertemperature return water in the system. The curves for the consumption of each water pump are drawn and the minimal point of each scenario is considered to be the optimized solution. The results show that heat pumps in combination with residual heat sources can be used to reduce the need of coal-fired boilers used in Chinese DH systems, thus reducing polluting emissions. While this approach can be useful for some studies, in most cases a more complex optimization algorithm is needed to expedite the finding of a solution.

Two main optimization formulations exist that can be used for solving optimization problems: 1) Linear

Programming and 2) non-Linear Programming. As the name implies, Linear Programming deals with optimization problems where the objective function, and all the constraints, are linear. This kind of problems are the easiest and fastest to solve for low number of variables. However, if any of the functions of an optimization problem cannot be described using a linear function, non-Linear Programming is required to model the problem.

Linear Programming Formulation

In the case of DH, as well as in many other heat and power systems, the optimization problems are rarely linear. For this reason, it is a common practice to try to reduce the optimization problems so they can be described by linear programming formulation, or to solve them for a linear behavior of the system only.

An example of this is presented in [START_REF] Becerra | A linear programming based model for strategic management of district heating systems[END_REF], where the authors aim at creating a decision support system that could assist district heating authorities in the management of their network. The evaluated time horizon is divided into several time steps and at each time step a linear programming-based approach is used in order to compute the optimal combination of heat power generated at the plants to meet a demand. The objective function for this research is the minimization of the energy production cost at the sources, which can be described as a linear function. The model is applied to the DH network of Beaulieu Malakoff, in the city of Nantes, France. The results show that economic savings can be achieved with this approach.

In [START_REF] Marguerite | APPLICATION OF A DISTRICT HEATING NETWORK (DHN) MODEL FOR AN EX-ANTE EVALUATION[END_REF], the authors present a DH model designed to be coupled with an economical model and an environmental model to form a global strategic management tool suitable for ex-ante and ex-post multi-criteria evaluation of DH networks. This optimization problem minimizes the objective function that describes the global heating cost in a DH network over a time step using as constraints the thermal capacity of the pipes, the heat sources capacity and the energy balance of the system. At each time step, the network is simulated via a linear programming model using MatLab and the LINPROG solver. In [START_REF] Stevanovic | Efficient numerical method for district heating system hydraulics[END_REF] the authors propose a method for the numerical simulation of the hydraulics of a DH network operating in steady state. The modeling approach is based on an Applied Solution Algorithm. The authors report that this algorithm is suitable to solve their model, which is conformed of symmetric matrices of the system described by linear equations, using an iterative optimization process. In this study the authors use the DH network in the city of Zemum, Serbia, as the case study and concluded that it was possible to supply at the desired mass flow rates with lower pump pressure, saving in electricity costs.

Linear programming is not only used in DH, but in other optimizations problems as well. In [START_REF] Lauinger | A linear programming approach to the optimization of residential energy systems[END_REF], the authors present a linear programming tool to determine the best investment decisions and operating strategy for the design and management of residential energy systems. The work considers five residential energy conversion systems: a cogeneration fuel cell, a natural gas boiler, a heat pump, photovoltaic panels and solar thermal collectors that work together with a battery and a heat tank for energy storage. The study uses linear programming to determine the investment and control decisions for a given set of weather conditions, energy use and cost data. The system is built on MatLab and solved using the simplex algorithm contained in the LINPROG function. Lastly, in [START_REF] Di Pilla | Optimizing the distribution of Italian building energy retrofit incentives with Linear Programming[END_REF] the authors present an optimization-based methodology for the evaluation of retrofit incentives using as a benchmark the wide data collection reported by the ENEA Italian Agency. They use two linear programming models, one to maximize energy savings and the other to minimize retrofit costs. The linear programming problems are solved by the freeware release of the Lindo solver that uses the Revised Simplex Method.

Non-Linear Programming Formulation

To solve optimization problems in DH networks described as non-Linear Programming problems, the Literature Review shows that a preferred approach is to use the metaheuristic algorithm named the Genetic Algorithm. Examples of this are plentiful in the literature. The study carried out in [START_REF] Wang | Optimization modeling for smart operation of multisource district heating with distributed variable-speed pumps[END_REF] uses a mathematical model developed by the authors to simulate the thermal and hydraulic characteristics of a DH system with variable speed pumps installed. They then propose two optimization horizons to guarantee the supply of the demand, a "coarse" optimization with a 1-2 hour horizon and a "fine"

optimization with a 15-20 minute horizon. Due to the non-analytical and non-smooth characteristics of the hydraulic performance of a multi-source looped pipe network, the authors use the genetic algorithm to search the minimum operational cost of the system in both optimization steps. Its application to a DH network in the city of Dezhou, China showed that the operation costs could be reduced up to 22% and the losses reduced by up to 12% compared to its normal operation.

In [START_REF] Wang | Modeling and optimization for hydraulic performance design in multi-source district heating with fluctuating renewables[END_REF] the authors propose an optimization model to find the lowest power consumption of distribution pumps in a DH network while ensuring the pressure head demands of all substations simultaneously.

They use a genetic algorithm to find the minimum electricity consumption of all pumps in a heating scenario. Using the model to evaluate a system with renewable energy sources, the authors concluded that the pumps' power demand can vary from 0.16% to 7.5% when the heat load from the renewable source changes 1%. The study presented in [START_REF] Fang | Genetic optimization of multi-plant heat production in district heating networks[END_REF] shows a method for the optimization of DH networks with generation plants at multiple locations along the network. In this study, the proposed objective function of minimizing operating costs is a non-analytic, non-smooth, function, so the authors use the genetic algorithm to solve the problem. They use data from the already installed automated meters to optimize the production of all the generations plants simultaneously from a system's point of view. The results are evaluated using a DH model that calculates the state of the network based on the temperatures and flows at the generation plants, which the authors state it can be applied to arbitrary DH networks with multiple heat plants. The optimization results show savings in fuel and pumping costs.

In [START_REF] Guelpa | Thermal request optimization in district heating networks using a clustering approach[END_REF] the authors propose a method to optimize the thermal load of a district by acting directly on the demand profiles of buildings. The optimization aims to optimize the system by anticipating the future demand to minimize the thermal peaks. To do so, monitoring stations are used to gather data of the buildings load profile and buildings with similar demands are clustered in groups. The DH model is a one-dimensional model based on energy conservation equations that uses a graph approach for the network topology. The temperature and flows of the network are found using the SIMPLE algorithm and the optimization problem is solved by using GA. The results show that the peaks could be lowered around 14%. In [START_REF] Hirvonen | Techno-economic optimization and analysis of a high latitude solar district heating system with seasonal storage, considering different community sizes[END_REF] the authors present a study for the optimization of a solar community in Finland.

The authors use TRNSYS to simulate the model and GA for the optimization. The authors use the MOBO optimization tool to optimize the Life Cycle Cost of the energy system of the community. The system is comprised of solar collectors, solar panels, centralized short-term storage, and a borehole thermal storage for seasonal storage. The results show that with more buildings connected, the storage system could provide as much as 44% of the heat demand and the electricity consumption could be reduced up to 80% when compared to the base case. The study also showed that improving the thermal insulation of the buildings was the cheapest option to improve the efficiency of the community.

While GA was found to be the most common algorithm used in this literature review, other algorithms were also used when the authors deemed them more appropriate for their specific objective functions.

In [START_REF] Qin | Integrated energy systems planning with electricity, heat and gas using particle swarm optimization[END_REF], the authors present an optimization model for integrated energy systems (heat, electricity, gas, wind, etc.) based on the objective functions of minimizing the total production costs, minimizing the wind power curtailment rate, and minimizing the variance of the peak-valley electrical load. They model the load demand, the energy production, conversion, transmission and distribution, and the capacity for expansion as uncertain parameters. The expected access to renewable energy sources is based on previous knowledge, but its real supply ability is modeled as to be known after the operation of the system. To solve this system, the optimization problem is built on Matlab and the global optimal solution is found using the Particle Swarm Optimization algorithm (PSO). The model is applied to the city of Tianjin, China, where it was found that increasing the proportions of electricity and natural gas in the final energy use on the integrated energy system of the city achieved the optimal result of operation. Another example of PSO can be found in [START_REF] Lu | Operational optimization of district heating system based on an integrated model in TRNSYS[END_REF], here the authors present a model to propose an optimization strategy of space heating systems in residential and office buildings which can simultaneously offer simulation-based optimization of energy demand and supply. The model is based on dynamic hydraulic conditions together with real-time temperatures and has the objective function of minimizing operation cost while maintaining indoor comfort levels. The optimization is done using PSO and is performed using the GenOpt software. Their approach is tested in a campus area in Harbin, China. The results show that the optimization combined with the proposed control strategy can achieve average financial saving of 27.86% in daily total cost while maintaining the indoor thermal comfort.

A different approach for the optimization of systems described by non-linear equations is found in [START_REF] Wen | Comparison and selection of operation optimization mode of multi-energy and multi-level district heating system: Case study of a district heating system in Xiong'an[END_REF].

In this work the authors use the DH system in Xiong'an, China to present and compare two optimization models for the optimization of its operation. One of them is aimed at showing the difference in the results when social benefits are considered together with the operators' profits. The first optimization model is called the Independent Optimization Model and it has the objective function of minimizing operation costs of each energy station independently; the second optimization model is called the Collaboration Optimization Model, which tries to achieve a global optimization for all energy stations by minimizing the overall operation cost. The formulation of the problem contains several nonlinear expressions; thus, the authors use piecewise linearization method to approximate the nonlinear equation.

This turns the problem into a mixed integer and linear programming model that is solved using the Gurobi solver in GAMS. The authors conclude that the Collaboration Optimization reduces the primary energy use by 19.1% but loses 18.3% of the profits for the energy integrators and increases the profits of energy suppliers by 13.8%.

In some cases, the optimization problem may have more than one objective function. When this is the case, it is common that the objectives conflict among each other. To solve this type of optimization problems, the multi-objective optimization algorithms can be used. These algorithms, instead of giving a single solution, give a Pareto front of solutions, where all the solutions contained in the Pareto front can be considered as optimal and it is up to the designer to choose one. A solution is said to belong to the Pareto front if that solution cannot be improved in one of the objectives without decreasing the performance in another objective.

In [START_REF] Coss | Multi-objective optimization of district heating network model and assessment of demand side measures using the load deviation index[END_REF] the authors propose the use of multi-objective optimization with three objective functions covering resource efficiency, environmental impact and economic feasibility of the given solution to assess the impact of demand-side measures on optimum design as well as characterize the heat load profiles of consumers. The authors use the commercial software MatLab to test this holistic approach in the optimization of the design of a biomass heat plant. To achieve this, the authors also propose the use of a new indicator named the "load deviation index". The results obtained show that demand-side measures do not always improve the performance of DH systems, but the optimization done through the multi-objective approach considering all three objectives simultaneously skips the need for weighting factors as in single-objective optimizations.

In [START_REF] Dorotić | Economical, environmental and exergetic multi-objective optimization of district heating systems on hourly level for a whole year[END_REF] the authors present a multi-objective optimization method to optimize the supply capacities and the operation of a DH network, including thermal storage, over one year. Three objectives are defined:

the minimization of total cost, the minimization of carbon dioxide emissions and the minimization of exergy destruction. The simulation model is written in the open-source, free programming language called Julia and the linear programming solver named Clp is used to obtain the solution. This study is later used in [START_REF] Dorotić | Analysis of displacing natural gas boiler units in district heating systems by using multi-objective optimization and different taxing approaches[END_REF] to propose an additional "exergy tax", which penalizes systems with high exergy destruction (i.e.

gas boilers). Results show that exergy, together with carbon tax, can effectively reduce natural gas consumption in heat-only boilers.

As can be seen, in the literature review we can find many options for the optimization of DH systems.

Due to the non-linear characteristics of heat distribution, non-linear, metaheuristic algorithms like GA and PSO are usually chosen to find the solution of DH optimization problems. Matlab is the most chosen software for running the optimization. However, other non-linear and metaheuristic algorithm exist that can be used to optimize the problem of heat distribution, like Meshed Advanced Direct Search (MADS) [START_REF] Audet | A mesh adaptive direct search algorithm for multiobjective optimization[END_REF]. That they were not found in the literature as often does not disqualify them as possible solutions.

Evaluation of DH systems

As seen in sections 2.1 and 2.2, there are various ways to model a DH network and many different approaches to optimize its operation. . However, this literature review showed that most of the works do not optimize the system as a whole, but rather focus on a specific aspect of it (like minimizing energy generation and costs). Even when multi-objective optimization is used, the objectives often included just a single objective regarding the internal operation of the system with the others being versed towards financial or environmental objectives. This literature review found that a gap exists for a specific framework to holistically evaluate the performance of DH network, especially when it comes to the combination of technical and economic objectives with the QoS.

In the papers consulted for this thesis it was found that most DH systems are evaluated on technical terms, like energy production and energy use, or economical terms, like design, operation and/or development costs. An example of a system where the results are evaluated based on technical performance is found in [START_REF] Stevanovic | Efficient numerical method for district heating system hydraulics[END_REF]. In this work the authors developed a model based on loop equations that use the energy demand and the energy generation in a DH network to predict the necessary pump pressure heads. This information is used to calculate the mass flow rates in the different elements and their pressure loss. The objective is to find the lowest pressure head needed at the different pumps in the system that would satisfy the necessary flows. Another example can be found in [START_REF] Li | Systematic optimization for the utilization of low-temperature industrial excess heat for district heating[END_REF], where the authors use the temperatures on the secondary side of a DH distribution network and the temperatures of Industrial Excess Heat to compute the electricity consumption of Heat Pumps that would transfer heat from the industrial side (lower temperature) to the secondary distribution side (higher temperature). The objective is to find the heat pump locations that would minimize the consumption of electricity.

The review showed that nowadays most works evaluate their results by transforming the energy objective function into an economic function. In [START_REF] Wang | Optimization modeling for smart operation of multisource district heating with distributed variable-speed pumps[END_REF], the authors used predicted heat demands and heat generation of a DH system to calculate the hydraulic and thermal characteristics of a DH system (pressure head, pressure drop, temperatures, thermal losses). They use a genetic algorithm to determine first the mass flows at the substations, and subsequently the flows at the generation plants and the speed of the pumps.

The objective function aims to optimize the power consumption of the pumps by minimizing the cost function of the system. The work presented in [START_REF] Fang | Genetic optimization of multi-plant heat production in district heating networks[END_REF] uses the energy demand and the operating temperature and mass flow of the generation plants to compute pressure loss, flows and temperature at the nodes.

Their study minimizes the cost of heat generation by varying the operation of plants with the objective function set as the cost of electricity and fuel. An example of a multi-objective optimization can be found in [START_REF] Dorotić | Economical, environmental and exergetic multi-objective optimization of district heating systems on hourly level for a whole year[END_REF]. Here the authors used a model based on the demand, plant use and fuel cost to minimize the cost of operation, the emissions, and the destruction of exergy. The model includes the ability to optimize supply and heat storage too.

While it is important to use technical and economic indicators to evaluate improvements to a DH network, they do not give enough information on any improvement on the QoS. The literature review

shows that the lack of a comprehensive evaluation framework of DH systems originates partially on the absence of a clear definition of QoS for DH. In electricity networks, QoS is an old concept that has become an integral part of the operation of the electricity distribution networks, with several indicators to measure it and real-life applications that are used to optimize operation, influence tariffs and define policy and regulation [START_REF]6TH CEER BENCHMARKING REPORT ON THE QUALITY OF ELECTRICITY AND GAS SUPPLY[END_REF]. One major aspect of QoS in electricity is the concept of Continuity of Supply, which addresses the availability and the reliability of electricity. In the case of DH, the literature review shows a gap in indicators to measure and evaluate the continuity of supply of heat distribution systems and its effects in the operation of the DH network. The closest thing to continuity of supply evaluation in DH found in the literature was the concept of Flexibility.

Flexibility can be defined as the capability of a consumer connected to a DH network to shift in time or magnitude its energy demand [START_REF] Ma | A literature review of energy flexibility in district heating with a survey of the stakeholders' participation[END_REF], which opens the possibility of a Demand Response (DR) strategy. In DH, consumers can be individual households, individual buildings, or aggregates of buildings. The flexibility of a consumer is strongly related to the thermal mass and the heat inertia of buildings, and thus impacted by the insulation, the energy efficiency of the building(s), and the actions of the people inhabiting them. An example of the impact of heat inertia on the flexibility of supply is presented in [START_REF] Wernstedt | Demand side management in district heating systems[END_REF].

In this study the authors use a multi-agent system to control the heat load of various buildings in a dynamic way with the objective of keeping it below a threshold value to prevent the use of back-up units.

The results show that it is possible to curtail up to 10% of the demand for short periods of time without the consumers noticing it. They also show that the cuts in supply can be made several times per hour depending on their magnitude, effectively reducing the demand of the substation around 4%. A more recent study is presented in [START_REF] Li | Estimating demand response potential under coupled thermal inertia of building and air-conditioning system[END_REF].

Here the authors explore the potential of DR on the energy supply in buildings when accounting for the heat inertia. The results show that using the heat inertia of the buildings as short-term storage allows them to experience DR events, where supply is completely curtailed, for more than 1.5 hours before the inhabitants start feeling discomfort.

In [START_REF] Zhou | Modelling and assessment of the contribution of demand response and electrical energy storage to adequacy of supply[END_REF] the authors investigate the effect of implementing DR and Electrical Energy Storage on distribution systems. They focus their studies on energy payback, flexibility, and efficiency of storage. In [START_REF] Xue | An interactive building power demand management strategy for facilitating smart grid optimization[END_REF] the authors present a strategy for building energy management when connected to a Smart Grid.

They developed a model to predict the power demand of commercial buildings and the possible alterations to this demand in order to then simulate the thermal behavior of commercial buildings and use them as short-term energy storage to balance the power flows in the grid.

These findings motivated the present research to develop an evaluation framework capable of considering the three objectives most sought after in the optimization of DH systems: maximization of energy efficiency, minimization of operation and generation costs, and optimization of flexibility measures without compromising the QoS. As this is not found for DH networks, the review turned to the existing electricity networks, in particular Smart Grids, to find the indicators that are used there to evaluate the performance of the system in terms of energy and QoS.

An overall review of what the electricity sector is doing to evaluate the performance of their distribution networks under the Smart City context can be found in [START_REF] Prakash | Optimal sizing and siting techniques for distributed generation in distribution systems: A review[END_REF]. In this review, the authors study the optimization of the installation of Distributed Generation (DG) to minimize the system losses, improve the voltage profile, enhance the system reliability, stability, and load ability etc. In the case of the reliability assessment, the authors found that it could be performed in terms of reliability indices. The authors note that the indices commonly linked with reliability in electrical networks are the SAIFI (system average interruption frequency index), SAIDI (system average interruption duration index), CAIFI (customer average interruption frequency index), CAIDI (customer average interruption duration index), AENS (average energy not supplied), ENS (energy not supplied) and EENS (expected energy not supplied).

In [START_REF] Arya | Reliability evaluation and enhancement of distribution systems in the presence of distributed generation based on standby mode[END_REF] the authors describe an analytical methodology for reliability evaluation and enhancement of distribution system having distributed generation based on SAFI, SAIDI and CAIDI. The objective function of the optimization problem is the cost of modification for failure rates/repair times and the additional cost of expected energy supplied by DG. Differential Evolution, PSO and coordinated aggregation based PSO are used to solve the problem. In the study presented in [START_REF]Application benefits of Distribution Automation and AMI systems convergence methodology for distribution power restoration analysis[END_REF], the authors explore self-healing mechanisms to minimize the impact of faults and outages on distribution grid, as these are being considered as one of the critical requirements for smart distribution networks. In this work the authors illustrate the benefits of the distribution power restoration method based on an approach named the Distribution Automation-Advanced Metering Infrastructure convergence approach. To optimize the reliability of the system, the authors also use three reliability indices: the SAIFI, the SAIDI and the CAIDI.

Literature review conclusions

The literature review found that, while different commercial and free software already exist for the simulation and optimization of DH systems, many of them are incapable of considering the dynamics present in the distribution of heat. For this reason, many studies conducted by different universities have proposed methods to model the dynamics of DH networks and then combine these models with an optimization tool or algorithm. One model for DH is the Finite Volumes method, which stands out for having longer computational times but providing detailed information for the temperature and flow of the water along the whole length of the pipes, not only at the inputs and outputs. The modeling of DH can be done in existing tools specific for this, like TRNSYS, or in general tools, like MATLAB. Which one is selected depends on the characteristics of the problem being studied.

Once the model is developed, it is common to pair it with an optimization algorithm. Depending on the objectives of the study, the optimization can have a single objective function or multiple. Depending on the formulation used to describe the problem, it is possible to use Linear Programming optimization algorithms, Mixed Integer Linear Programming optimization algorithms or non-Linear Programming optimization algorithms. Due to the characteristics of heat distribution in a DH network, it is common to linearize the equations using different approaches, the most common is assuming steady state for the distribution network. When steady state is not assumed and the dynamics are considered, GA and PSO were the two most common algorithms to solve this kind of problems.

The most common objective functions found for the optimization routines were the minimization of generation and operation costs, the optimization of operational set-points for specific equipment, the minimization of development costs, and the minimization of emissions and/or environmental impact.

Not many papers were found that focused on the optimization of the supply of heat and even less were found that were focused on the QoS provided to the consumers at the same time as the minimization of generation and operation costs.

The literature review found a gap for the holistic evaluation of DH systems. While some energy and economic indicators are used for the optimization routines, they usually look at the system from the point of view of one of its actors only (i.e. heat producers or the DHO). This was especially noted in the lack of indicators to measure the QoS provided to the consumers of a DH system, where the closest term that was found was the concept of flexibility. This motivated this literature review to look at what the electricity sector is doing, where indicators for this can be found. The three most used indicators in electricity networks are the SAIFI, the SAIDI and the CAIDI. These three can be adapted to DH systems to allow the evaluation of the operation of a DH system from the perspective of the whole system, rather than from individual actors alone.

From the literature review, it was found that an area of opportunity exists for the development of a simulation and optimization model that considers the dynamics of heat distribution. The optimization needs to focus not only on generation and operation costs, but also on the optimization of the supply of heat and on the optimization of the QoS delivered to the users connected to a DH network. The present research uses these findings together with its main objective, the proposal of a novel model for system result of the literature review, the modeling approach selected is based on the physical modeling of DH networks using the Finite Volumes method. The optimization is divided into two steps: The dispatch optimization and the generation temperature optimization. Dispatch is optimized through the cost of generation, which can be described using linear functions. For this reason, linear programming optimization is used for its minimization.

Generation temperatures are optimized through the minimization of energy generation, supply deficit and supply surplus. In DH, it is common that the supply does not always match the demand. When the supply cannot meet the demand, it is called a deficit; when the supply is higher than the demand and the extra heat cannot be used to feed any other consumers, it is called a surplus. The existence of a surplus or a deficit lower the efficiency of the DH system and, in the case of deficits, incur in economic and QoS losses. The supply is affected by the physical characteristics of the network, so its behavior needs to be described using non-linear formulation. For this reason, non-linear programming optimization is used for the optimization of generation temperatures with the objective function of minimizing generation, deficit and surplus (thus maximizing supply).

Finally, the evaluation of DH is done through energy, economic and QoS indicators. The energy performance of the DH system during the evaluation period is assessed through the total heat generated to satisfy the demand, and through the ratio of the heat generated to the demand satisfied (energy efficiency). The economic evaluation is done through the cost of generation, the expected revenue from the heat supplied, and the expected profit from the heat supplied. These three economic indicators are normalized to the total demand of the system for the evaluated period to make their comparison with other periods, and different systems, simpler. The QoS evaluation is based on the evaluation framework for Smart Grids and adapts three indicators from it: the system average interruption frequency index (SAIFI), the system average interruption duration index (SAIDI), and the customer average interruption duration index (CAIDI).

The optimization routine within DOTS is named DOft and is carried out using two different optimization tools. The first is called HeatGrid [START_REF] Marguerite | INTEGRATED MODELS TO EVALUATE DISTRICT HEATING NETWORKS[END_REF], a tool developed by the IMT Atlantique based on Linear Programming that uses a variant of Mehrotra's predictor-corrector algorithm [START_REF] Mehrotra | On the Implementation of a Primal-Dual Interior Point Method[END_REF], a primal-dual interior-point method, for the dispatch optimization. The second tool is called NOMAD [START_REF] Abramson | The NOMAD project[END_REF], which is based on non-Linear Programming and uses the MADS algorithm for the optimization of the generation temperatures. Both tools are described further in the methodology. The simulation software selected is MatLab, for being user friendly and adaptable to different programming languages.

A summary of the methodology is depicted in The detailed description of each of the three steps is presented in the following sections. The modeling approach in section 3.1, the optimization in section 3.2, and the evaluation in section 3.3.

Modeling of DH systems

The first step in the modeling of DH systems is the mathematical representation of a DH network. This is usually done by a graph of nodes interconnected by vertices. Generation and consumption sites are represented by the nodes and the vertices represent the supply and return pipes buried underground.

Nodes feed and take energy and mass from the vertices; the vertices transport the energy along the network. This approach has been used by many studies that aim at modeling DH.

While there are different ways of translating the node and vertex model into mathematical form, a natural way of representing DH networks is using directed graphs. A directed graph is a set of objects (vertices and nodes) that are connected, each connection having a determined direction. In a directed graph all flows follow the direction of the connections. If the directed graph does not have a pair of symmetric vertices, meaning that there are no nodes connected in both ways, the graph is called an oriented graph.

Figure 3-1: Methodology diagram. The Dynamic Model stands at the center (yellow). Its integration into HeatGrid becomes the Oft optimization (green). Integration of Oft with NOMAD creates DOft (purple). DOft and the Evaluation framework combine into DOTS (blue).

In this work, oriented graphs are used to determine the connections and the flows in the network. Each connection is then modeled using a variation of the Finite Volumes Node method (FVN) to simulate the heat transport in the pipes. Each node is modeled using continuity equations and a heat balance for the processes inside the nodes. The full model is named the Dynamic Model for simplicity and it is presented in section 3.1.1. The sub-model for the heat transport in the pipes is presented in section 3.1.2 and the sub-model for the heat balances in the nodes is presented in section 3.1.3.

Figure 3-2: Example of an Oriented Graph (top) and its adjacency matrix(bottom). The nodes in the oriented graph

are identified using letters (a -h) and the branches using numbers (1 -9). In the matrix, the number "1" indicates a connection between the node and the branch, the sign indicates the direction of the flow: positive (outflow) and negative (inflow).

The Dynamic Model 3

The Dynamic Model is meant to recreate the topology of the network, the node dynamics, the transport phenomena, and the heat losses. To achieve this, a combination of two sub-models is proposed. One sub-model evaluates the processes inside the nodes while the other sub-model evaluates the transport of energy through the pipes. The model allows for every node to have generation, consumption, storage, and flow joints and splits. These give the model the capability to represent various elements of the network like central and distributed generation, central and distributed storage, prosumers, etc. However, not all the possible elements will be explored in the present research. A simplified example of the operation of these two sub-models working together for a segment of a network can be seen in For the modeling of the heat transport in the pipes, the present research proposes a model based on the FVN. Every pipe is discretized into finite elements. While the water resides within each pipe element, it will lose some of its energy due to the heat transfer occurring between the water and the walls of the pipe. As time progresses, some of the water contained within the pipe elements will flow towards the next element; this water will be replaced by the same amount from the previous pipe element to maintain continuity. The amount of water that is replaced depends on the volume of the element and the mass flow rate of the hot water. This is the basis of energy transport in a pipe for the FVN.

The pressure needed to maintain the mass flow is calculated using the Darcy-Weissbach equation for head loss in the pipe (see Equation 3-1). This equation can also be used to compute the hydraulic balance of networks with reversible flows in the pipes, like networks with a looped topology or networks with energy storage systems.

Equation 3-1: Darcy-Weissbach equation.

𝐷𝑊 = 4𝑓 𝑓 𝐿𝑢 2 2𝑔𝑑

In this equation 𝐿 is the length of the pipe, 𝑢 is the speed of the flow, 𝑔 is the gravity, 𝑑 is the diameter of the pipe and 𝑓 is the friction factor. This last parameter can be calculated using Equation 3-2, an explicit equation introduced by Barr [84], which provides accurate results for Reynolds numbers higher than 10 5 . In Equation 3-2, 𝑒 𝑠 is the effective roughness and Re is the Reynolds' number. The Dynamic Model can simulate the operation of a DH network and give as a result the spatial-temporal distribution of temperatures and energy, the real losses in the pipes and the real supply at the nodes in any kind of DH network configuration, including looped topologies with reversible flows. This makes the Dynamic Model a good asset to combine with an optimization routine to improve the operation of DH systems 4 . In the present research only branched configurations are studied, but ring and looped topologies can also be modeled using this methodology. The detailed description of each of the submodels that constitute the Dynamic Model are presented next.

Modeling Heat Transport in Pipes

The modeling of the heat transport in the pipes derives from the heat balance of the energy flows in a discretized pipe. The energy flow, or heat flow, is composed by two different components. The axial component, called advection, that carries the heat along the pipe by a medium (i.e., hot water), and the radial component, called conduction, in which heat is lost through the walls of the pipe. Each element of the pipe is described as a finite volume, i.e. at every instant each volume contains a mass of hot water determined by the element's volume and the density of the water. The energy associated to the mass of hot water is the stored heat in the pipe.

Mathematically this can be expressed as follows. Each pipe element has three associated heat flows that determine the change in its stored heat (∆𝑄 𝑣𝑜𝑙 ). On the axial axis there are the heat that flows in from the upstream element (𝑄 𝑖𝑛 ) and the heat that is passed on to the downstream element (𝑄 𝑜𝑢𝑡 ). On the radial axis there is the heat that is lost through heat transfer during the time the water resides in the evaluated element (𝑄 𝑙𝑜𝑠𝑠 ). This heat depends on the difference in temperatures between the pipe wall and the water. The heat balance for an element 𝒋 of the water in the pipe at time 𝒊 is shown in Equation indicates the mass flow. The dots indicate the average temperature of the element. Sub-index "w" stands for water, "st" for the pipe, "ins" for the insulation, "gro" for the ground, and "a" for ambient. Sub-index "j" indicates element in the spatial discretization and super-index "i" indicates moment in the temporal discretization. The dots indicate the average temperature of the element. Sub-index "w" stands for water, "st" for the pipe, "ins" for the insulation, "gro" for the ground, and "a" for ambient. Sub-index "j" indicates element in the spatial discretization and super-index "i" indicates moment in the temporal discretization.

Based on the systems presented in To solve the heat balance, it is necessary to know the temperature of the pipe wall (𝑇 𝑠𝑡 𝑗 𝑖 ). In the FVN method a second heat balance is made for the pipe wall as shown in Equation 3-5. In this case, the change of the energy in the pipe is caused by the heat transferred from the water to the pipe (-𝑄 𝑙𝑜𝑠𝑠 )

and the heat transferred from the pipe to the environment (𝑄 𝑠𝑡-𝑎 ). The former is indicated on the item at the right side of the equality in Equation 3-5 and the latter on the item at the left of this equality. In this equation 𝑇 𝑎 is the ambient temperature (assumed to be constant in this work), 𝑅 𝑤-𝑠𝑡 𝑗 𝑖 is the thermal resistance between the water and the pipe, and 𝑅 𝑠𝑡-𝑎 is the thermal resistance between the pipe and the surroundings (including insulation resistance and soil resistance). For a full description of the equation used refer to the Annex. To solve this system, it is necessary to make some considerations. The pressure wave propagates about 1000 times faster than the temperature wave [START_REF] Zhou | Dynamic modeling of thermal conditions for hot-water district-heating networks[END_REF], the flow occurs under low velocity conditions and the fluid used in the heat networks is liquid water. In that case the following assumptions are made without significant loss of precision [START_REF] Stevanovic | Prediction of thermal transients in district heating systems[END_REF], [START_REF] Yuan | Dynamic temperature model of district heating system based on operation data[END_REF]:

• the flow is one-dimensional and incompressible;

• the effects of hydraulic dispersion are neglected;

• thermal diffusion, and axial heat transfer are neglected;

• heat dissipation is ignored due to low velocity flows;

• the specific heat at constant pressure (Cp) is constant in the evaluated range;

• each element of the discretized pipe has a lumped mass with a single temperature;

• heat inertia of insulation and ground are ignored.

These considerations are similar to those taken in other works which report accurate results for the modeling of thermal networks [START_REF] Dénarié | Heat transmission over long pipes: New model for fast and accurate district heating simulations[END_REF], [START_REF] Van Der Heijde | Dynamic equation-based thermo-hydraulic pipe model for district heating and cooling systems[END_REF], [START_REF] Del Hoyo Arce | Models for fast modelling of district heating and cooling networks[END_REF].

While this method has proven to be useful, an improvement can be made by including the inertia of the heat transfer between its elements, as well as the storage capacity of the pipe. For this work we developed a modified method of FVN in which 𝑇 𝑠𝑡 𝑗 𝑖 is obtained using the electrical analogy of the system. The thermal conductivities are associated to electrical resistances, the heat capacities to electrical capacitances and the temperature gradients to voltage difference. The system can be solved as an RC circuit. The converted circuit for a pipe like the one shown in and volume (𝑉 𝑠𝑡 ) of the material of the pipe, i.e. steel. The thermal resistance between 𝑇 𝑔𝑟𝑜 and 𝑇 𝑎 is calculated using the resistance equivalent for a cylindrical geometry and the shape factor for a constant temperature cylinder buried in a half infinite domain.

The solution for the circuit in Figure 3-6 for the change from time step 𝑖 to time step 𝑖 + 1 can be found using the Laplace transform of the system. Using 𝑇 𝑠𝑡 𝑗 𝑖 as the reference temperature for the temperature change, the resulting system of equations can be seen in Equation 3-7. By solving this system of equations, it is possible to solve the heat balance for any pipe element 𝑗.

Because this approach is based on Finite Volumes, the spatial and temporal discretization is important to guarantee stability and prevent numerical diffusion. To ensure the reliability of the results, the volume of the water evaluated in one element must be equal or greater than the volume of the flow of water entering the element. This constraint is known as the Courant-Friedrich-Levy condition (𝐶𝐹𝐿

= 𝑢•∆𝑡 𝐷𝑦𝑚 ∆𝑥 ≤ 1)
, where 𝑢 is the flow velocity, ∆𝑡 𝐷𝑦𝑚 is the time step duration and ∆𝑥 is the spatial step length. If 𝐶𝐹𝐿 > 1 the system presents numerical instability, if 𝐶𝐹𝐿 < 1 the system presents numerical diffusion.

In the Dynamic Model the temporal discretization is fixed during the whole simulation and can be set to any desired value. The spatial discretization is then calculated using the temporal discretization, the target CFL and the flow rate for each pipe at each time step. In this way, every pipe has their own spatial discretization at every time step of the simulation and thus the target CFL is always reached. Because the pipe's spatial discretization may vary several times during each simulation, a check is made between time steps to ensure that the number of elements has not changed. If the discretization has changed, then the temperature distribution is updated to the new number of elements using quadratic interpolation.

Modeling Heat Balance in a Node

The next step is to model the processes that take place at the different nodes of a DH network. To illustrate the heat balance in a node, Figure 3 𝑚̇𝑟 𝑜𝑢𝑡 ) while the back-up is not in operation. A special case would be nodes representing a junction or a split. In a junction, the node has in its supply side two mass flow rates with different temperature at its input and one mass flow rate with one temperature at its output. In a split, the node has in its supply side one mass flow rate with one temperature at its input but two different mass flow rates with the same temperature at its output. In the case of the return side, junctions become splits and splits junctions. For these cases, the energy balance must consider the energy conservation equations and the mass conservation equations for all inflows and outflows. In the present research, the temperatures and mass flow at the secondary side of the heat exchanger are outside the scope and are not further analyzed. The same for the temperatures and mass flow on the side of the heat exchanger connected to the generation plant. The input mass flow rates and temperatures for the supply and return lines depend on their upstream nodes. The temperature and mass flow rates at the heat exchanger of the substation can be obtained once the demand (𝑄 𝐷 𝑘 ) and the heat exchangers efficiency (𝜂 𝑘 ) are known (calculating the heat exchangers efficiency is outside the scope of this work, so it is assumed to be known). The output mass flow rates and temperatures of the supply and return lines can be calculated once their input temperatures and mass flows and the mass flow of the heat exchangers are known.

Optimization of DH systems

In the present research, the optimization of the DH system modeled as described in section 3.1 is carried out with two different methods. The optimization of the dispatch of heat is done using HeatGrid [START_REF] Marguerite | APPLICATION OF A DISTRICT HEATING NETWORK (DHN) MODEL FOR AN EX-ANTE EVALUATION[END_REF], a tool developed by the IMT Atlantique that uses a variant of Mehrotra's predictor-corrector algorithm for its optimization routine. The optimization of the generation temperatures is done using NOMAD [START_REF] Abramson | The NOMAD project[END_REF],

a tool that uses the MADS algorithm [START_REF] Audet | Mesh adaptive direct search algorithms for constrained optimization[END_REF] for the optimization. Together they give as result the mode of operation that minimizes generation costs at the same time as minimizing total generation, deficits, and surplus in the whole network. The results obtained with the optimization are the basis of the present research to answer the research question: How, through mathematical modeling, simulation and optimization, can the dynamics of heat distribution be used to aid in the management of DH systems, reduce costs, and increase efficiency and QoS?

Dispatch Optimization

HeatGrid is based on Linear Programming formulation and is presented in [START_REF] Marguerite | APPLICATION OF A DISTRICT HEATING NETWORK (DHN) MODEL FOR AN EX-ANTE EVALUATION[END_REF]. This tool enables the modeling of networks with different architectures, energy sources, conversion technologies and demand structure simulating its operation over a determined period. It is especially useful in the case of networks with large-capacity generation units but little flexibility and/or networks where prices are varying during the simulation period. A short explanation of HeatGrid is presented here, but the reader is encouraged to see the original publication [START_REF] Marguerite | APPLICATION OF A DISTRICT HEATING NETWORK (DHN) MODEL FOR AN EX-ANTE EVALUATION[END_REF].

HeatGrid models the network using an oriented graph. This graph has n number of nodes and m number of branches. Each node stands for a substation or a heating plant in the network and each branch stands for the pair of supply and return pipes connecting the nodes. Each node incorporates either a heat source (heating plant) or a heat sink (substation). The basic network topology is provided to the model via a simple graph format matrix which describes how the nodes and branches are linked together. At every time step 𝑡 each branch has a constraint on the maximum power that can flow through the branch and an Average Heat Loss Coefficient which is assumed to be a function of the handled power. The maximum power is a function of the temperature and mass flow in the branch. The mass flow is constrained to the maximum pressure that the branch can handle which depends on the pipe's inner diameter, length, thickness and material. The Average Heat Loss Coefficient is defined as the ratio between the heat losses of the pipe, and the difference between the average temperature of the water inside it and the temperature of the environment (Equation 3-9). In other words, the Average Heat Loss Coefficient is the coefficient that, multiplied by the average temperature difference between the water and the environment, would

give the heat losses of the pipe. programming model is chosen for its speed and simplicity. The optimization problem is solved by using a variant of Mehrotra's predictor-corrector algorithm [START_REF] Mehrotra | On the Implementation of a Primal-Dual Interior Point Method[END_REF], a primal-dual interior-point method.

The number of state variables is 𝑚 + 𝑛, where 𝑛 is the number of node powers and 𝑚 is the number of branch powers. The optimization is run at each time step to simulate the network during operating conditions and return the best combination of heating sources and power flows in pipes.

HeatGrid is capable of simulating branched and looped topologies with a variety of generation plants and technologies distributed all along the network. The costs of generation and the demand profiles can be set to consider diverse factors that change from time step to time step. Nevertheless, HeatGrid optimizes the power generation over a time step but cannot optimize the delivery of this power. All in all, the objective of HeatGrid is to evaluate energy performances over the long term while optimization routines are used at each time step to simulate short term management and control assuming steady state conditions. This optimization routine selects the best generation strategy to supply the demand at the lowest economic cost, thus optimizing the use of resources in the production of heat (economical dispatch).

To overcome the limitation of steady state assumptions, the simulation model described in section 3.1 is integrated into HeatGrid to improve HeatGrid's results. This integration is done to extend optimization capabilities and applicability of both. The integration also allows the evaluation of the performance of a network using HeatGrid for the optimization of its dispatch.

The combination of the Dynamic Model with HeatGrid is named Oft and it is done through the Oriented Graphs on which both models are based on. HeatGrid relies on an Oriented Graphs to determine the flows of mass and energy in the network but, due to the Linear Programming formulation, the transport of energy is considered to be instantaneous. The Dynamic Model also relies on an Oriented Graph to determine the flows of the network but feeds this information into a transport sub-model in order to calculate the real transport times and losses in the pipes.

It is proposed here to run HeatGrid, which will give the optimum plant operation to minimize costs, together with the Dynamic Model to evaluate the real supply of energy in the network. The Dynamic Model evaluates the real losses taking place in each pipe for every time step 𝑖; at the end of the HeatGrid optimization time step 𝑡, an updated Average Heat Loss Coefficient is calculated and fed into HeatGrid to adapt its generation plan to the real losses in the network. Because every change in HeatGrid's operation plan will have an effect on the losses in the network, the integration of the models works in an iterative manner on which the updated loss coefficient is fed back into HeatGrid until convergence is found between the operation plan and the losses in the network (Error<0.02%). A visual diagram of this integration can be seen in Figure 3-8.

Temperature Optimization

One way of improving the supply of DH systems is by optimizing not only the dispatch of heat (done using HeatGrid), but also the way in which this heat is delivered. Heat plants supply heat as a function of temperature and the mass-flow rate at which water is being injected in a system. HeatGrid gives as a result the value of this function (Power) but does not optimize the effect of these variables, temperature, and mass flow rate, in the system. The integration of a new optimization routine that optimizes the effect of temperature and mass flow rate on the system can further increase the efficiency and reliability of DH networks. This optimization is called DOft.

The effect of temperature and mass flow rate in the supply of the system is non-linear, as can be easily seen in some of the transport equations of the dynamic model, like Equation 3-7. This calls for the use of an optimization tool based on non-Linear Programming formulation to solve for the optimum temperature/mass flow rate operation values. The literature review presented in Chapter 2 found that the most common optimization algorithms used to solve the optimization problem of energy supply in a heat distribution network are the Genetic Algorithm and the Particle Swarm Optimization. In the present research the first algorithm to be tested was GA, but as the modeling approach is computationally intensive, it was found that the GA optimization routine could take 10 hours to optimize 24 hours of operation. In order to expedite the optimization cycle without losing accuracy or precision, a different optimization algorithm was tested and selected to use in DOft: The Mesh Adaptive Direct Search (MADS). MADS is an optimization algorithm used to solve constrained optimization problems where the objective function and constraints are evaluated using a simulation tool. In particular, we use the NOMAD tool, which stands for Nonlinear Optimization by Mesh Adaptive Direct Search [START_REF] Abramson | The NOMAD project[END_REF]. NOMAD can efficiently explore the space of complex optimization problems, like the dynamic modeling of heat transport in DH network used in the present research. In this case, it was able to reduce the computational time by a factor of five. A short explanation of NOMAD and MADS is given here, but for further understanding see [START_REF] Audet | Mesh adaptive direct search algorithms for constrained optimization[END_REF], [START_REF] Audet | A mesh adaptive direct search algorithm for multiobjective optimization[END_REF].

The MADS algorithm generates an underlying series of meshes on the domain space and then performs an iterative, adaptive search on the meshes. A mesh is a subset of the search space delimited by the set in the real matrix. At every iteration, the mesh is defined by the union of the matrix and the set of points where the objective function has already been evaluated. During the search, MADS also controls the refinement of the meshes. At each iteration MADS has the objective of finding a point on the mesh that improves the current best solution. If an iteration fails to find a better solution, it refines the mesh for the next iteration.

In a MADS optimization, given an initial iterate 𝜒 0 ∈ Ω, the algorithm tries to find a minimizer for the function 𝑓 by evaluating 𝑓 Ω on some trial points. At each iteration a finite number of trial points are generated, the objective function value for each point is then compared to the current best value 𝑓 Ω (𝜒 𝑙 ),

where 𝑙 is the iteration number. All the trial points evaluated on each iteration are contained within the current mesh.

At iteration 𝑙, the current mesh is defined by Equation 3-12.

Equation 3-12: Mesh equation for the MADS algorithm.

𝑀𝑒𝑠ℎ 𝑙 = ⋃{𝜒 + Δ 𝑙 ℎ 𝐷𝑧 ∶ 𝑧 ∈ ℕ 𝑛 𝐷 } 𝜒∈𝑆 𝑙
𝑆 𝑙 is the set of points where the objective function 𝑓 had been evaluated at the start of the iteration, 𝐷 is a 𝑛 × 𝑛 𝐷 real matrix, Δ 𝑙 ℎ is a scaling mesh size parameter, 𝑛 𝐷 is a finite fixed set of directions, 𝑧 is an integer vector where ℕ denotes non-negative integers. The objective of the iteration is to find a trial mesh point with a lower objective function value than the current best value 𝑓 Ω (𝜒 𝑙 ). If such a point is found, the iteration is considered successful and the trial point is called an improved mesh point.

At each iteration, a finite number of points is evaluated for 𝑓 Ω . If an improved mesh point is found the algorithm can be stopped, or a new iteration can be started to try to find a better point. The new iteration must have a scaling factor Δ 𝑙 ℎ equal or greater than in the iteration before and use the new value of 𝑓 Ω (𝜒 𝑙 )

found in the previous iteration. This process is called a search. However, if no improved mesh point is found (unsuccessful iteration), a second step called poll is invoked before terminating the iteration.

The polling step consists of a new iteration with a new mesh that is finer than the mesh used in the unsuccessful search by reducing the scaling factor Δ 𝑙+1 ℎ . The iteration is initiated in any point 𝜒 𝑙+1 ∈ 𝑆 𝑙+1

where 𝑓 Ω (𝜒 𝑙+1 ) = 𝑓 Ω (𝜒 𝑙 ). In this way, a better solution is searched for nearer to the current best solution. The main difference between MADS and similar algorithms, like the Generalized Pattern Search [START_REF] Sherif | Optimization by pattern search[END_REF], is that it introduces a second scaling parameter, Δ 𝑙 𝑝 , for the polling step such that Δ 𝑙 ℎ ≤ Δ 𝑙 𝑝 for all 𝑙.

This new scaling parameter must satisfy lim 𝑙∈𝐿 Δ 𝑙 ℎ = 0 if and only if lim 𝑙∈𝐿 Δ 𝑙 𝑝 = 0 for any infinite subsets of indices 𝐿.

The search step is important because it gives MADS algorithms the flexibility to explore the search space.

However, as the objective is to find the point that improves the current best solution, expansive search is not always the best. The poll step is not as flexible as the search step, but it is the basis on which MADS gains convergence and reliability on finding a better solution.

As seen in the short explanation, MADS does not depend on the optimization function to find a solution.

This makes it well versed to solve the problem of heat supply when considering its complex dynamics.

New optimization variables had to be defined as well as a new Objective Function to be solved by MADS through the NOMAD tool.

For the DOft optimization, the variables chosen were the temperatures at which each heat plant will operate. Because power is a function of temperature and mass flow rates, the combination of NOMAD, which defines the operating temperature, and HeatGrid, which defines the operating powers, will give the operating mass flow rates of the network. NOMAD will be used to optimize the temperature at which each heat plant supplies its power proposed by HeatGrid. Indirectly, this will give NOMAD control on the supply, as higher temperatures will translate to longer delay times and vice versa. With this function, NOMAD explores the different solutions given by HeatGrid depending on the selected operating temperature and chooses the one with the lowest heat generation. At the same time, it uses the results of the Dynamic Model to ensure that the solution has the best ratio between generation and supply, reducing any deficits or surplus in the system. The combination of the two formulations, Linear Programming for the linear functions and non-Linear Programming for the non-linear functions allowed the optimization to arrive to a solution in a fraction of the time that the same problem required when formulated only in non-linear formulation while retaining he same level of reliability. The diagram for this approach is presented in Figure 3456789.

This approach increases the ability of the Dynamic Model to communicate information to the optimization cycles. It communicates the real losses to HeatGrid via an updated average heat loss coefficient and the difference in generation and supply to NOMAD via the deficit and surplus. Together with this, by combining NOMAD and HeatGrid, it can also communicate the inertia of the system to both.

Due to the Dynamic Model's ability to track the energy distribution in the network, and the optimization's ability to control this distribution, it is possible to use this information to allow the model to consider the energy in the pipes as a possible source to supply the demand or as a possible heat sink for short term storage. This is done by exchanging the Average Heat Loss Coefficient of the Network with a new coefficient named the Pipe Supply Factor (PSF). The PSF, which is explained in detail in section 4.2, is an indicator of the ratio between the energy entering a pipe and the energy exiting the pipe. This indicator can be used to take advantage of any heat already contained inside a pipe to reduce the generation for that period, or by increasing generation to prepare for a future expected surge in demand. Many DH systems already have pre-heating strategies, in which the temperature of the network is raised before an expected period of high demand (i.e. early morning). This strategy guarantees the QoS when the control of the network is based on steady state assumptions, but in practice it commonly increases the losses and the surplus. Contrary to this, the PSF is meant to allow the system to react to changes in the demand by taking into account the dynamics of the system. Considering the heat already in the pipes, or their storage capacity, can have an impact in generation and surplus, reducing both.

Lastly, by keeping track of where the heat is in the network at all times, future deficits can be foreseen.

If a faraway node is in danger of losing its QoS (see section 3.3.3), the optimization can be used to include the capability of forcing a short curtailment of energy in the nodes closer to generation to prevent a deficit in the more distant nodes, reducing the time that the network needs to regain its QoS.

Evaluation of DH systems

When working with optimization tools, it is important to have indicators to evaluate the effectiveness of the proposed solutions. DOft gives as its solution an operation strategy that minimizes the energy generation, the deficit, and the surplus, and finds the dispatch strategy that minimizes the costs of heat generation. However, to prove the viability of DH to operate within the Smart City context, it is necessary to evaluate the results within an evaluation framework that represents the magnitude of the benefits. For this reason, this work proposes a novel evaluation framework that will allow the quantification of the technical and economic gains achieved by the DOft optimization, as well as its impact in the QoS. As

Energy Indicator

The first indication of an improved performance of the network is an increase in the energy efficiency.

The energy efficiency of a DH network can be defined as the ratio between the energy supplied over the period of evaluation and the energy generated to supply this demand. In equation form it can be seen in Equation 3-16.

Equation 3-16: Energy efficiency.

𝜂 𝑒𝑛𝑒𝑟𝑔𝑦 = 𝑄 𝑠 𝑄 𝑔𝑒𝑛

In this equation, 𝑄 𝑠 is the heat supplied and 𝑄 𝑔𝑒𝑛 the heat generated. With the optimization of the operation of the plants, it is expected that the energy generated, and the energy surplus will be reduced. This in turn will increase the efficiency ratio, creating an operating strategy with less waste.

Economic Indicators

In a real DH network, the costs of operation include the cost of the fuel, the cost of operation of the heat production facility, the cost of operation of the DH network, the cost of connection to the consumer buildings and the costs pertaining to operation and maintenance. In the present research however, the objective is to propose a new model of system management through improved optimization and control of the network. The cost most affected by the model proposed is the cost of generation due to fuel consumption, so this becomes the first of two economic indicators used in this research. The second economic indicator comes from the expected revenues and profits the network operator may obtain from the supply of the heat. The cost of generation is given by HeatGrid as part of its optimization, but the expected revenues and profits require further assumptions and calculations.

Real DH systems are usually state-owned natural monopolies, and the heat they provide is considered a public service, thus they are not allowed to make a profit from its supply [START_REF] Djørup | District Heating Tariffs, Economic Optimisation and Local Strategies during Radical Technological Change[END_REF]. The price the consumers have to pay is therefore composed of the different costs of the operation of the network, as well as the cost of future projects and investments, taxes and VAT, financial support and/or grants, and, in some cases, the cost of electricity (i.e. CHP plants). The revenue a DHO would get from the supply of heat is linked to the price the consumer has to pay depending on the variables above, and the profit would be zero. The full tariff systems however are outside the scope the present research. To evaluate the results this work proposes the use of a flat tariff for each kWh of heat supplied. This way, the revenue will be the product of this tariff and the supply, and the profit would be the difference between this revenue and the generation costs. Let it be clear, that even though the present research uses the term "profit", it does not indicate that the DHO is making money out of its service, but rather the leftover cash after generation costs that would be used by the DHO to pay for other aspects of the network, like distribution costs, 𝑄 𝑔𝑒𝑛 𝑘 is the heat generated at each node 𝑘, 𝐷 𝑡𝑜𝑡𝑎𝑙 is the demand for the whole period in MWh and 𝑄 𝑠 is the total heat supplied. The heat generation cost, the revenue and the profit are normalized to the demand to give equal ground for evaluation. This also allows their easier comparison to other systems studied with the same methodology, even if they vary vastly in the size of the system, the number of generation plants or the demand.

Quality of Service indicators

There are different ways of defining the Quality of Service (QoS). In its broadest terms for DH, QoS is the ability to supply a demand, with a low response time and preventing any deficit. Due to the natural delay existing in DH networks, QoS can be a difficult thing to manage as the times are too long for reactionary control. However, the heat inertia of the systems connected to a DH network provides some flexibility on the supply, as deficits need to persist for some time before they are perceived by the consumers.

In the present research, a new way of evaluation of the QoS from the primary side is proposed. The supply is divided into three levels, each indicating an overall status of the QoS for all customers connected to individual substations:

• A level of 1 indicates that the system can supply the entirety of the demand, or that any existing deficits can be absorbed by the heat inertia of the building or managed with flexibility tools like load shifting or Demand Response (DR). To abide by results obtained in studies like [START_REF] Wernstedt | Demand side management in district heating systems[END_REF], [START_REF] Li | Estimating demand response potential under coupled thermal inertia of building and air-conditioning system[END_REF], [START_REF] Foteinaki | Evaluation of energy flexibility of low-energy residential buildings connected to district heating[END_REF], the maximum deficit allowed at each substation is of 1% of the instant demand to achieve a level of 1.

• A level of 2 indicates that the deficit will not be perceived by the costumers if its duration is short but will cause discomfort if it persists. Depending on the type of building connected, the time a deficit can exist before it is perceived by the customer can vary a lot. For this study we propose to use a duration value on the lower end of the spectrum to guarantee the QoS to all buildings. In this work, to get a level of 2 the deficit must have a duration shorter than 10 minutes and always be below 10% of the instant demand.

• A level of 3 indicates that the deficit will cause discomfort on the costumers and that no flexibility measure will be able to cover for it. This level is obtained under two circumstances: 1) a deficit lower than 10% of instant demand that persists for more than 10 minutes or, 2) the substation experiences a deficit higher than 10% of instant demand for any duration of time.

The three levels of QoS by themselves are useful to evaluate the performance of the DH system at a certain moment in time. They can also become the foundation to evaluate the performance of a DH network over a period of operation when combined with the existing indicators for QoS in electricity grids. The third indicator, the CAIDI, is an indicator of the average time that a customer must wait for heat to be restored when an interruption to their service occurs, i.e. the average CAIDI for the electricity sector in Europe during the first half of the past decade was of ~120 minutes per interruption [START_REF]6TH CEER BENCHMARKING REPORT ON THE QUALITY OF ELECTRICITY AND GAS SUPPLY[END_REF]. An interruption in electricity is very straightforward, as any interruption is immediately felt by the consumers. In the other hand, as presented above, interruptions can occur in DH without affecting the consumers. For this reason, we proposed the three levels of QoS and consider that an interruption occurs in DH whenever the QoS reaches a level of 3. The duration of each interruption is calculated as the time required for the QoS to go back to 1.

The second consideration focuses on the scope of this research work. As DH networks are analyzed from the primary side point of view, no information on the final customer is available. For this reason, normalized values of customers are proposed to calculate the SAIFI, SAIDI and CAIDI. Each substation is assumed to have a number of customers related to their average demand and this number is normalized to the total demand as presented in Equation 3-24:

Equation 3-24: Equivalent customers.

𝑁 𝑘 = 𝑎𝑣𝑒𝑟𝑎𝑔𝑒 𝑑𝑒𝑚𝑎𝑛𝑑 𝑎𝑡 𝑠𝑢𝑏𝑠𝑡𝑎𝑡𝑖𝑜𝑛 𝑘 𝑎𝑣𝑒𝑟𝑎𝑔𝑒 𝑑𝑒𝑚𝑎𝑛𝑑 𝑜𝑓 𝑡ℎ𝑒 𝑛𝑒𝑡𝑤𝑜𝑟𝑘 × 100 𝑒𝑞𝑢𝑖𝑣𝑎𝑙𝑒𝑛𝑡 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠

Substations with a larger number of equivalent costumers have a greater impact on the value of the Indexes. By using 𝑁 𝑘 to represent the number of equivalent customers connected to each substation, the impact of each substation will be balanced with its size. If information is available on the real number of consumers connected, it should be used to replace the value of 𝑁 𝑘 .

The SAIFI, SAIDI and CAIDI give valuable information on the operation of a DH system. Due to the physical characteristics of DH, which cause a significant delay between generation and supply, it is common for a system to be operating above the required capacity and still be unable to satisfy the demand. Other times, the changes in generation that reduced costs and supposedly increase efficiency leave some customers without access to heat for long periods of time. Many works try to address this from the consumer point of view and propose actions that can be done by the building managers or single users. Having indicators that allow the District Heating Operator (DHO) to evaluate the effectiveness of the system's supply can help solve these issues from a systemic point of view rather than from a case by case scenario.

of the pipes, and the mass conservation equations. The pipes have been sized using the hydraulic balance of the system (Equation 3-1 and Equation 3-2) and their physical properties taken from a manufacturer's catalogue [START_REF]Set Pipes | District heating[END_REF], [START_REF]Pre-insulated Steel Pipe[END_REF]. The pipes' length and properties are described in Table 4-1.

In Table 4-1, 𝑑 is the interior diameter of the pipe, 𝑠 𝑠𝑡 is the thickness of the pipe, 𝑠 𝑖𝑛𝑠 is the thickness of the insulation, 𝑧 𝑑𝑒𝑝𝑡ℎ is the depth at which the pipes are burrowed, 𝑘 𝑠𝑡 is the thermal conductivity of the pipe, 𝑘 𝑖𝑛𝑠 is the thermal conductivity of the insulation, 𝑘 𝑔𝑟𝑜 is the thermal conductivity of the soil, 𝜌 𝑠𝑡 is the density of the pipe and 𝐶𝑝 𝑠𝑡 is the thermal capacitance of the pipe.

The network is simulated for two different operation conditions:

1) the "pre-heating" process, where the temperature of the network is raised while no demand exists (e.g. early in the morning to anticipate the peak demand).

2) the "normal operation" of the District Heating network using heat demand data based on the real measurement from a network in the city of Nantes, France.

For the first operation condition, two simulations are done, one using the FVN method and another using the Dynamic Model to compare the results. For the second operation condition, only the Dynamic Model is used. In these simulations, the generation plants are represented by their supply temperature, which is set to 90°C for the whole simulation. The mass flows at the generation plants are also kept constant so each plant delivers power at a steady rate (8 kg/s for Node 1 and 6 kg/s for Node 2). Each consumer node is represented by a substation that takes flow from the supply line to feed a heat exchanger and returns the cooled flow to the return line. The modeling of the heat exchanger is outside the scope of this work, so the flow taken is a function of the temperature and the demand. In the case of pre-heating, the consumption nodes are not supplied until their temperature reaches the network's minimum supply temperature.

Pre-heating test results

The first test consists of a simulation of the network after a time when the water inside was allowed to cool down. During the pre-heating, the network will re-circulate the water to the heat plants until it reaches a minimum set point temperature, after which the consumer nodes start to extract heat from the network. The simulation covers a period of five hours and it uses a 15s time step. The FVN and the Dynamic Model are simulated five times using a different fixed spatial discretization each time. Because the spatial discretization is fixed during these simulations, each discretization is linked to a different target CFL value (1, 0.95, 0.75, 0.5 and 0.3). The spatial discretization is kept constant as it is not an uncommon practice in the simulation of real systems. In this way, it will be possible to test the stability and precision of the two models. The ambient temperature is kept constant at 20°C for the duration of the simulation.

The first two simulations to be compared are done using a target CFL value of 1. This value of CFL indicates that all the mass contained in a discrete volume is passed unto the next volume when the time step advances, greatly reducing the numerical diffusion. Simulating the network under the CFL=1 constraint allows to compare the precision of the Dynamic Model to that of the FVN method. Figure 4-2 shows the evolution of the power available at each consumer node obtained in the simulations. The FVN method took 724s to simulate and the Dynamic Model took 763s to run. Figure 4-2 shows one set of lines only as there is no perceived difference between the two approaches. This result confirms the validity of the Dynamic Model, i.e. for CFL=1 the dynamic model is equivalent to the FVN and the computational effort is similar (an increase of the computational time of only 2.8%).

From Figure 4-2 it can be seen that there is a delay between generation and supply and that it varies from 135 min to 170 min depending on the distance of the consumer node to the heat plants. Once the results from the Dynamic Model are validated against the FVN method using a CFL=1, four more simulations are performed varying the spatial discretization. Increasing the spatial discretization has 4 effects:

1) it reduces the CFL value, as not all flow in one element will be displaced each time step, 2) it reduces the number of elements in the network, reducing the computational time,

3) it increases the flexibility of the network, allowing for a wider range of flow rates without changing the discretization, and 4) it increases the numerical diffusion, reducing the precision of the results.

It is common to increase the spatial discretization to achieve a target combination of precision and simulation times. Models that retain their precision at lower CFL values are usually preferred over those that do not.

The results for the simulations using target CFL values of 0.95, 0.75, 0.5 and 0.3 are summarized in As before, in the top graphs the CFL value has direct influence on the numerical diffusion. However, with the Dynamic Model the numerical diffusion is less than with the FVN method. Looking at the bottom graphs in the two figures, the maximum error varies between 30kW for CFL=0.95 and 155.47kW for CFL=0.3. Interestingly, the error is larger for CFL=0.95 than in the FVN method but gets smaller as the CFL decreases. The maximum absolute error as well as the computation times for the different CFL values can be seen in Table 4-2. The time needed to obtain similar error with the FVN method, which requires a finer discretization of the pipe, is also presented in this Table. These results show that the Dynamic Model has better robustness than the FVN method for smaller CFL values, although the FVN method has better accuracy for CFL values slightly lower than 1. As in dynamic systems the CFL can vary greatly during time, the robustness of the Dynamic Model is preferred when the system presents continuous changes in mass flow rates. In Table 4-2 it can also be seen that to obtain the same absolute error in the Dynamic Model with FVN, the computation times are an average of 3.5 times higher.

"Normal operation" test results

The second test simulates the network working under normal operation. To do this, real demand data is used. The data contains the demands for the day 02/12/2017, which can be seen in Figure 4-7. This day was chosen as the demand is low compared to the size of the system, which causes low flows in the network increasing the residence time and thus, the losses. The demand is a mixture of residential and commercial buildings gathered every 10 min. The simulation is done with a time step of 60s, with the demand remaining constant during each 10-minute period. During this test, the generation temperature is considered to remain constant during the simulated time of 24 hours. The consumer nodes extract energy from the supply side by deviating part of the mass flow to their own heat exchangers and injecting the cooled flow into the return side of the network. The return temperature (𝑇 𝑠𝑢𝑏,𝑜𝑢𝑡 ) at each heat exchanger is assumed to be fixed at 40°C, except on the case of nodes at the end of a branch, where it can be higher if there is any surplus energy. To prevent heat waste caused by unnecessary surplus, the mass flows output from the generation units is varied to approximate the power generation with the demand and losses at every time step.

The variables analyzed are the spatial-temporal distribution of the temperature in the network, the mass flow rates, the difference between supply temperature 𝑇 𝑠 𝑖 and return temperature 𝑇 𝑟 𝑖 at the nodes(see

∆𝑇 𝑘

𝑖 is used to assess the efficiency of the supply in the network. In an ideal scenario it should remain around a set value and vary only during a change in the demand, as the system operates under constant temperature inputs. In a real scenario, the dynamics of the network will cause it to vary much more as the variation of the mass flow rates influence the losses and the delay creates deficits and surplus. Both the losses and the surplus decrease the ∆𝑇 𝑘 𝑖 by reducing the available temperature at the node or increasing the temperature on the return side. ∆𝑇 𝑘 𝑖 lower than the set value indicates lower efficiency of supply.

𝐾𝑃𝐼 𝑘 𝑖 is used to assess the efficiency of generation. If the system's generation and demand match perfectly, the sum of the individual KPIs would be equal to one. But because of the losses in the network, the generation is generally higher than the demand and thus the KPI is higher than one. The higher the KPI is from 1, the more inefficient the generation is. If the KPI is lower than one, it could indicate that there is a deficit in the network.

The chosen generation temperature for this case study is of 90°C. seen that the farther away a node is from the generation plant, the lower its temperature will be due to losses in the network. In this case the losses are remarkably high, with a temperature drop of 8°C in the farthest-away node. This is due to the low mass flows in the network, increasing the residence time of the hot water inside the pipes. The insulation values of the pipes also play a role, which in this test are low for the system to exacerbate the dynamics of heat transport and validate the Dynamic Model. By comparing the two graphs, it can be noticed that the temperature difference between the supply side and the return side are lower when the mass flows are higher. This shows the importance of correctly sizing the pipes in a DH network to prevent long residence times of the hot water. The sum of the two is larger than 1, as can be seen in the added KPI line. By taking the arithmetic mean of the KPI during the 24 hours of operation, the result is 1.27, which means that on average 27% more energy is being injected into the system than is demanded by the connected users.

These results show the ability of the Dynamic Model to track and map the spatial-temporal distribution of temperatures in a network, as well as offering a view of the effects that the delay, the losses and the thermal inertia have on the distribution of heat. In the following section a single pipe will be studied to analyze in depth the effects of these three characteristics of DH and a solution to include them into the optimization routine is presented.

Delay, Losses and Thermal Inertia in DH networks

Section 4.1.1 shows the results obtained with the Dynamic Model when applied to a simple network during the pre-heating operation. As can be seen in Figure 4-2, these results show that even when the generation plants operate at a constant output, a delay exists between the time that energy is generated and the time that the energy is finally supplied. The results also show that the power curves for each consumer node present a slanted "s" shape while they rise from the initial state temperature to the new steady state temperature. These effects are caused by the losses through the pipe walls suffered during transport and by the thermal inertia of the system.

The use of the Dynamic Model allows to explore the effects that the delay, the losses and the thermal inertia have on heat distribution and use its findings to propose new ways on which these dynamics can be mitigated and even turned into beneficial for the operation of DH systems, which are explored in the DOft optimization (Chapter 5).

Temperature step increase in a pipe

The first test is with a single steel pipe of 1000 m in length with an inner radius of 10.5 cm, a thickness of 0.45 cm and a polyurethane insulation of 6.8 cm in thickness. The pipe operates under a constant mass flow rate of 35 kg/s and a temperature step function that raises temperature from 60°C to 90°C at its input. The test is run for an hour with a 20 s temporal discretization and a 𝐶𝐹𝐿 = 1. The variables studied are the heat at the input of the pipe (𝑄 ̇𝑖𝑛), the heat at the output of the pipe (𝑄 ̇𝑜𝑢𝑡), the change in the heat contained in the pipe at every time step (𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑) and the losses through the walls of the pipe (𝑄 ̇𝑙𝑜𝑠𝑠). The step function occurs on minute 8 of the simulation, when power starts to be supplied to the pipe.

The results from this test are presented in Figure 4-11. Here it can be seen that, while heat starts to enter the pipe on minute 8, the output does not show any change until minute 24, when the output heat starts to rise. The heat signal at the output of the pipe continues to rise until minute 30, when the pipe finally reaches steady state. The difference between the input and the output of the pipe shows the effects of the delay and the inertia on the transport of heat in a pipe. The delay caused by the distance between the input and the output of the pipe causes the heat front to arrive at the output 16 minutes later, and the inertia of the system, resisting the increase of the temperature, causes it to be delayed 5 minutes longer before the system reaches steady state. The delay is easily explained, as it corresponds to a mass flow rate of 35kg/s through a pipe with a radius of 10.5cm that flows with a velocity of ~1m/s. This means that it would take a particle of hot water 16.48 minutes to cross the 1000m of the pipe's length.

To understand the effect of the inertia it is necessary to look at the two other curves in 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 is constant, indicating that the energy contained in the pipe continuously rises. An interesting feature of this curve is that the magnitude of 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 is smaller than that of 𝑄 ̇𝑖𝑛, meaning that not all the energy going into the pipe remains in the pipe. This difference between 𝑄 ̇𝑖𝑛 and 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 is explained by the fourth curve presented in Figure 4-11: 𝑄 ̇𝑙𝑜𝑠𝑠 (which is depicted using a secondary axis for easier reading). In the same figure, 𝑄 ̇𝑙𝑜𝑠𝑠 increases significantly during the transition between steady states. This increase in losses is caused by the higher temperature difference between the water and the pipe when the heat front reaches a section of the pipe that previously contained colder water. This behavior between 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 and 𝑄 ̇𝑙𝑜𝑠𝑠 explains the inertia of the system, a greater temperature difference causes a higher heat flux from the water to the pipe and from the pipe to the ground. This heat flow remains high until all elements reach the new steady state temperatures. Because the heat front will always face the steeper temperature differences, it will experience the greater losses, explaining the slopes for 𝑄 ̇𝑜𝑢𝑡, 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 and 𝑄 ̇𝑙𝑜𝑠𝑠.

When the time frame being studied is long enough, and the inputs are constant, the temperature difference between the input and the output of the pipe is dominated by the steady state losses, and the delay and the inertia become negligible. This is a reason why in many studies steady state is always considered. It is interesting however to see what happens in the time between a change occurs and the time steady state is regained. Figure 4-11 shows that while the pipe is being "charged up" the losses increase too, increasing also the time needed to reach steady state. This effect is especially interesting when the step function marks a decrease rather than an increase in the input temperature/power. 16.48 min. This delay is extended three minutes by the inertia of the system, requiring a total time of ~20 minutes to reach steady state. It is interesting to see that in this case, the duration of the effects of the inertia is reduced in half compared to the step increase in temperature (Figure 4567891011). This can be explained by the temperature and the losses, the higher the temperature the greater the losses, thus an increase in temperature comes with an increase in losses and an extension for the time required to reach steady state. However, the most interesting thing from this figure comes from the curves for 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 and 𝑄 ̇𝑙𝑜𝑠𝑠. Contrary to the previous case presented in Figure 4-11, where 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 was slightly lower than 𝑄 ̇𝑖𝑛 due to 𝑄 ̇𝑙𝑜𝑠𝑠, in this case 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 is negative. This indicates that the system is losing energy rather than gaining it, which makes sense as the power entering the pipe has dropped. However, 𝑄 ̇𝑙𝑜𝑠𝑠 is also negative during the transition period; this would indicate that the system is gaining energy through the pipe walls rather than losing it. While at first this may appear counterintuitive, this reflects the same inertia effect as in the step-increase case. As the now colder water flows into a section of the pipe that contained hotter water previously, the water interacts with the higher temperature pipe with the heat flow going from the pipe to the water. This effect is of particular interest, as it means that during a temperature increase the system should expect higher losses, but during a temperature decrease the losses would be lowered.

While the effects of the delay and the inertia can be neglected when the system operates in steady state for long and continuous intervals of time, these tests showed that during the transition between steady states they have a perceivable impact. The delay keeps the output of the system operating at certain level for minutes (or even hours) after the conditions at the input have changed. The inertia of the system modifies the shape of the input's profile, extends the delay and, most importantly, has a direct effect on the losses experienced by the system. This brings up the question: How does this affect the operation of a highly dynamic system?

Temperature sinusoidal variation in a pipe

To answer this question, the pipe from the previous two tests is used to test a non-constant input in the form of a sinusoidal function. As before, the test is initialized with the whole pipe having the same temperature, with the main difference being that the sinusoidal function is active from the first time step.

The results of this test are shown in Figure 4-13. Like in the previous tests, while the input is higher than the output, the heat in the pipe increases and the losses remain high. If the output is greater than the input, the heat in the pipe decreases and the losses become negative. From this figure it is interesting to see that 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 and 𝑄 ̇𝑙𝑜𝑠𝑠 follow a similar pattern, but the magnitude of the negative losses is lower than the magnitude of the positive losses. This is due to losses to the environment always being present, even when some of the heat in the pipe wall is flowing into the water, making the losses appear as gains.

From this figure it is also interesting to notice that none of the curves is in complete phase with another.

𝑄 ̇𝑜𝑢𝑡 is delayed compared to 𝑄 ̇𝑖𝑛; 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 has a period equal to the time between 𝑄 ̇𝑖𝑛 -𝑄 ̇𝑜𝑢𝑡 changing sign and back again; and 𝑄 ̇𝑙𝑜𝑠𝑠 is slightly delayed to 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑.

The results obtained in these tests highlight the importance of considering the delay and the inertia of a system when scheduling the generation at the heat plants in a DH network. In this particular case, when the input is changed it takes the system 20 min before it reaches steady state at its output. If the input is adjusted every hour, one third of the time will be spent in transition periods. In current DH networks it is common for the system to go through a period of pre-heating to compensate for this transition, starting supply after the system has reached steady state. But in the more dynamic environment of the Smart City, DH systems will rarely operate at the same level for long enough for the steady state to be reached. In order to create a new model of DH system management that would operate reliable in a dynamic environment, it is important to account for the real supply, and not only the steady state expected supply, as many operating strategies currently do. However, the results also point at the combination of the inertia and the delay being able to work for the benefit of the system, maintaining the output for a certain period even when generation drops, thus preventing deficits in dynamic environments.

As can be seen in Figure 4-12 and Figure 4-13, after generation is reduced there is still some time while the output remains at the level it was before. Just as generation can be started early to avoid a deficit in the supply, it could also be stopped early without compromising the QoS while preventing energy waste.

In a dynamic environment the delay and the inertia can act as a short-term source of heat for the system.

For this reason, a new indicator is proposed in the present research called the Pipe Supply Factor (PSF).

Pipe Supply Factor

The PSF is an indicator of the ratio between the energy exiting the pipe (𝑄𝑜𝑢𝑡) and the energy entering the pipe (𝑄𝑖𝑛) in a defined time frame (see Equation 4-3).

Equation 4-3: Pipe Supply Factor for time frame 𝑖.

𝑃𝑆𝐹 𝑔 𝑖 = 1 - 𝑄𝑜𝑢𝑡 𝑖 𝑔 𝑄𝑖𝑛 𝑖

𝑔

If the PSF is positive, it means that more energy entered the pipe than the energy that left it; if the PSF is negative, it means that more energy left the pipe than the energy that entered it. In steady state operation the PSF is always positive and it is equal to the average heat transfer coefficient of the pipe. In dynamic operation however, the PSF can get negative values, i.e., when generation drops after a period of high temperature operation.

This characteristic of DH networks, the temporal disassociation between generation and supply caused by the inertia and the delay marks some opportunities to improve the management of DH. Firstly, in order to mitigate the delay when demand goes up and reduce the surplus when it goes down, the control strategy can consider past and future time steps to find the best strategy for the operation of the generation units. Secondly, the PSF can be used to modify the generation by increasing it if the PSF is higher than 1, or decreasing it if it is lower than 1, thus reducing the surplus and deficits experienced by the network and improving the QoS and energy efficiency of the system with it. This contrasts with the steady state models that optimize each time step independently.

In the next chapter we demonstrate how the delay and inertia can be used to optimize the performance of DH network.

Conclusion

This section presented the results of implementing the Dynamic Model to compute the temperature distribution, in time and space, of a DH system during two different operations: pre-heating and normal operation. The results show the energy flows in the supply and return pipes. It can be concluded that using the Dynamic Model gives robustness to the simulations when working with fixed spatial discretization for a range of flows, reducing the computation times while keeping accuracy.

By comparing the results to those obtained with the FVN approach, the use of the Dynamic Model to evaluate the operation of DH networks was validated. The Dynamic Model was then used to simulate a 6-node network for a 24-hour period of normal operation. The results highlighted the importance of using tools like the one here presented to aid in the operation of the network, as simply monitoring the temperatures of the water in the generation nodes is not enough to determine the temperatures and powers in the rest of the network, especially on the far away nodes where any surplus or deficit could be attenuated on the return network and not be noticeable on the generation units.

The results show also that even when the temperature and mass flows at the input nodes is known and time series exist to estimate the consumption at the middle nodes, the number of variables and physical phenomena make it hard to know the real-time status of the network without the appropriate tools. This is relevant as many DH networks have limited monitoring to assess the behavior of the system beyond the point of view of the generation plants.

The Dynamic Model also allowed the study of the effects that the delay, the losses and the thermal inertia have on the energy supply of a system operating outside of the steady state. The delay increases the time between generation and supply, but also increases the time that a certain output persists after the input has changed. The inertia of the system affects the output's profile compared to its input, extends the delay, and increases or decreases the losses depending on the direction of the temperature change. These effects together are usually considered a challenge in DH but may be used to the advantage of the system with proper control.

These results justify the use of the Dynamic Model in combination with optimization tools to propose and evaluate different modes of operation of DH networks that would allow the transition of this kind of systems into Smart Thermal Networks and their integration as part of the Smart City.

DOft Optimization: Results and Discussion

The Dynamic Model presented in the Chapter 3 allows the tracking of the heat front in a DH network and the temperature distribution within the pipes. This is used to calculate the spatial-temporal distribution of temperatures, the delay, and the real supply at the consumer nodes. This information opens the possibility to use the Dynamic Model in combination with an optimization strategy to determine the best operational scheme for a DH network.

To test the relevance of coupling the Dynamic Model with an optimization strategy a case study composed of a seven-node network with six connections is proposed. The topology of the network can be seen in Figure 5-1 and the characteristics of the pipes for this network are presented in Table 5-1. MW gas plant and Node 6 is a 17 MW gas-fired back-up boiler. Nodes 3, 4, 5 and 7 are the result of aggregated commercial and residential consumers, thus only the backbone of the primary side of the network is considered. This is done to represent the point of view of the District Heating Operator (DHO), who usually only has access to the substations on the primary side. In Chapter 8, where future work is presented, the capability of escalating the methodology to include the secondary side of the network is discussed.

For the case of the heat plants, each uses different fuels and operates at different efficiencies; thus, each has different fuel prices per kWh of heat. These can be seen in Table 5-2. For this test, the efficiency of the three heat plants is considered constant and the total cost of generation is only a function of the fuel price and the heat produced. Nevertheless, the model can incorporate efficiency functions for generation to better represent real implementation of the methodology. With this topology, DOft (or Oft if the generation temperature optimization is not used) will be tested for eight different optimization strategies. The strategies go from "steady state operation" (Oft-base) to "dynamic optimization with Demand Response capabilities using a sliding-window horizon" (DOft 7).

All optimization strategies are initialized using the same conditions and allowed to run for six hours before the evaluated period, this is done to ensure that the initial conditions do not influence the results.

It is important to mention that this work makes the assumption of having a "perfect forecast" of the demand, i.e. the exact demand curves presented in Figure 5-2 are known in advance. The evaluation of forecasting tools is outside the scope of this study. Table 5-3 presents a summary of the optimization strategies considered in this study. The first optimization strategy to be tested is the optimization of heat dispatch assuming steady state operation. In the present research this strategy is named "Oft-base" and it uses the existing tool HeatGrid to optimize the use of the three generation plants described above. Each time step is optimized independently, and for each steady state is assumed in the optimization routine. The losses in the network are calculated as a function of the steady state temperature of the pipes and the ambient temperature.

The Dynamic Model presented in Chapter 3 is used to evaluate the results obtained from the optimization carried out by HeatGrid by measuring how neglecting the inertia and the delay affect the expected results. The results from this strategy will be used as the base of comparison for the other seven strategies.

The second strategy to be tested is named Oft 1, which uses the Dynamic Model in combination with HeatGrid. The Dynamic Model is used to calculate the real losses of the network and with the losses it calculates an updated Average Heat Loss Coefficient (Equation 3-9). This updated coefficient is fed back to HeatGrid to increase the precision of the results. The optimization is run again in an iterative manner until convergence between the current and updated Average Heat Loss Coefficients is reached.

In this optimization strategy, steady state is considered, and each time step is optimized independently of each other.

The next optimization strategy is DOft 2. This strategy includes the temperature optimization but continues to assume steady state conditions. HeatGrid is used to optimize the dispatch and NOMAD is now used to optimize the generation temperatures. For this strategy, the time step is increased from one hour to three hours. The optimization failed to reach convergence in the results with periods shorter than three hours as the maximum time for the system to reach steady state, and thus allow the objective function to consider the effects of the generation temperature, was of two and a half hours. The demand data for each three-hour time step is the average of the demand of the three individual hours. Steady state is considered for the HeatGrid optimization and each time step is optimized independently of each other.

The inclusion of the NOMAD optimization in combination of the Dynamic Model allows to find the pair of temperature and mass flow rates that the generation plants need to minimize the negative effects of the delay and the thermal inertia.

DOft 3 is the first to consider the thermal inertia of the distribution system as short-term storage.

HeatGrid is used to optimize the dispatch of heat and NOMAD is used to optimize the temperatures at which each heat plant operates. The thermal inertia is included in the optimization routine by using the but the shorter time frame for its optimization cycle coupled with the Dynamic Model and the sliding window optimization for NOMAD, allows to evaluate the system's dynamics even when steady state is never reached. This approach also maximizes the benefits from replacing the average heat loss coefficient with the PSF.

DOft 7 uses the same strategy as DOft 6 with the inclusion of a new variable. In the previous strategies, each node would always extract as much energy from the network as needed to satisfy its own demand.

This changes in DOft 7, where the Demand Response Factor (𝛼 𝑘 , see section 5.8) is introduced to limit the maximum amount of energy that each node can extract from the network. 𝛼 𝑘 is calculated at the end of each optimization iteration as the individual factor for each node that would increase the local deficit but reduce the overall deficit of the network. This strategy mimics the implementation of a form of Demand Response.

All DOft strategies try to minimize the power generation of the system while preventing any deficit or To complete the DOTS model, the evaluation of the results using the proposed evaluation framework is presented in Chapter 6.

Oft-base: Optimization using HeatGrid and the Dynamic Model

To be able to evaluate the improvements obtained with an optimization strategy, it is necessary to have a reference to which compare the results. In this study we use as comparative base the results of the DH operating under the strategy proposed by HeatGrid alone, which is the strategy that replicates the normal operation of existing DH the most. HeatGrid gives the dispatch, or generation plant usage, and the Dynamic Model is used to evaluate the spatial-temporal distribution of temperatures and the real supply in the proposed network.

The results of Oft-base, presented in Figure 5-3 show important characteristics. First of all, by looking at the top graph alone it can be seen that the generation is always higher than the demand by a fair margin and that the back-up is only used when the maximum generation capacity of the other two plants has been reached. These two behaviors can be explained by understanding how HeatGrid, and many real networks, operate. Generation needs to be higher than the demand due to the heat losses the network experiences during the transport of the heat, however, the Average Heat Loss Coefficient of the network is usually overestimated to prevent any deficits from happening. This causes generation to be higher than it must be. The second behavior, that of the back-up only being used after the other plants have reached capacity, comes from the assumption of steady state operation. If the inertia and the delay are ignored, then generation and supply happen at the same time, indicating to the system that the demand at the farthest away node can be supplied instantly by any heat plant upstream from it. If the assumption that any heat plant can supply the demand is accepted, then the DHO will prioritize cheaper generation and the back-up will not be used until all other plants are at full capacity.

In this same figure the demand and the generation temperature follow similar patterns (first and third graphs). In this strategy, HeatGrid proposes its own operating temperature for all heat plants based on the demand and the outside temperature. Having a temperature-controlled system operating under the assumption of steady state causes the temperature to rise when the demand increases and to fall when the demand decreases. The real systems however do not operate in continuous steady state. The inertia and the delay cause a temporal gap between supply and demand that can already be seen in the temperature profile at Node 6. The temperature at this node follows a similar pattern to the other two generation plants, but it is displaced in time. Between two and three hours in this case. This causes the energy being generated to not match the energy that is reaching the consumption nodes. This is indicated by the global PSF (second graph): here it can be seen that when demand, and thus generation, increases, the global PSF also increases, signaling that more energy is currently being charged into the pipes. When generation decreases then the global PSF decreases indicating that the pipes are being discharged.

This has substantial implications on the system as can be seen in the surplus and deficits curves (bottom graph). In this mode of operation, where steady state is assumed, when demand increases or decreases, generation immediately follows suit, but supply does not. Looking at the period between the 540 th and 720 th minute, the demand is increasing accompanied by an increase in generation, but also by an increase in global PSF. The increase in global PSF indicates that more energy is currently in transit inside the pipes, and thus it has not yet reached the consumption nodes. Because the energy is still in transit, or being stored in the pipes, it is not reaching the consumer nodes and the system presents a deficit. This contrasts with what happens when the demand goes down, like between the 360 th and the 540 th minute.

Here generation also decreases but, because there is still energy from the previous generation in transit in the system, so does the global PSF, being negative. This means that more energy than necessary is being supplied to the nodes, creating a surplus.

A temperature-controlled system working under the steady assumption will not be able to properly supply the demand as it cannot account for the delay and the inertia. Surplus will exist when the demand decreases, and deficits appear when the demand rises. A similar magnitude change in the demand will not always cause the same change in the magnitude of the global PSF, the surplus or the deficit. This is most apparent at the 180 th minute, where the surplus has a large increase and the global PSF a large drop after a seemingly smaller reduction in the demand. At this moment, the generation temperature decreases following the change in the demand, but as it can be seen on the fourth graph, the mass flow rate at the heat plants increases. This is of particular interest, as a change in the mass flow rate has a much faster effect in a DH network than a change in the temperature does. In this strategy, the increase in the mass flow rate accelerates the speed at which the pipes discharge the energy conserved from the previous, higher temperature, time step. The higher temperature water stored in the pipes combined with the higher water flow greatly increases the available energy at the consumption nodes in a time when they do not need it, causing a high surplus and wasted energy. Another interesting moment period in this network is during the 1 300 th minute and the 1 480 th minute, where a deficit and a surplus exist at the same time.

This happens because the studied system has two end-of-the-line nodes: Node 5 and Node 7. The dispatch optimization in this strategy, which uses Linear Programming formulation, considers the mass flow rates and temperatures in each pipe constant. In reality the mass flows and the temperatures vary;

this opens the possibility that the heat diverted from Node 4 to Node 5 is not enough and that the heat generated in Node 6 is higher than what is needed in Node 7. This shows the limitations of using only Linear formulation to optimize DH systems.

These results highlight the importance of considering the delay and the inertia of DH systems. Demand, generation, temperature, and mass flow rate all have effects that are felt by the system at different times.

If these times are disregarded, the management of the system becomes ineffective and inefficient, with the surplus being as high as 17.5% of the demand and the deficit lasting for more than four hours. This emphasizes the current limitations of this strategy for the management of DH systems. Without any information on the status of the network, the systems usually over produces heat to cover for any potential deficits. This surplus consumes fuel, has an associated cost, and reduces the efficiency of the network. Nevertheless, this strategy can still cause a deficit due to the long transportation times of the network, especially when the demand rises.

The following seven strategies tackle the problem from different perspectives, with the latest strategies considering higher levels of network functionality and ICT implementation.

Oft 1: Optimization using HeatGrid, the Dynamic Model and the real losses

The first strategy to improve the results is to use the Dynamic Model to calculate the real losses taking place in the network and feed them back to HeatGrid to improve its solutions. This is done by updating the average heat loss coefficient used by HeatGrid in its calculations. This optimization strategy works in an iterative manner in which HeatGrid proposes a generation scheme, the system is evaluated with the Dynamic Model, the new average loss coefficient is calculated, and it is fed back to HeatGrid. HeatGrid then proposes a new generation scheme and the process is repeated until the average heat loss coefficient calculated with the Dynamic Model and the average heat loss coefficient used by HeatGrid converge.

This strategy aims to reduce the over generation of heat by working with more accurate coefficients.

As before, the results are presented in a multi-graph figure aligned vertically for easier reading (Figure 5-4). The top graph shows the generation at each heat plant and the demand. Here it can be seen that the results are like those obtained with Oft-base. Looking at the top graph, the generation continues being always higher than the demand and the back-up continues being used only when the other two heat plants have reached maximum capacity.

The main distinction to Oft-base is that this time the difference between the heat generation and the demand for individual hours can vary more due to the updated average heat loss coefficient, which varies depending on the combination of temperature and mass flow rate. This is most visible between the 240 th and 300 th minute, where total generation and total demand are almost the same, while in Oft-base there was always a clear difference between the two. The rest of the results are very consistent with what was obtained with Oft-base. Like before, the system operates under the assumption of steady state. Rises and falls in demand are followed by rises and falls in generation temperature. Looking at the PSF graph between the 1200 th minute and the 1620 th minute, it can be seen that as demand increases, the global PSF rises, indicating that the heat entering the pipe is not yet reaching the output of the pipe, and a deficit appears; and as the demand decreases, the global PSF becomes smaller (to the point where it can turn negative), this indicates that more energy is exiting the pipe than it is entering it, and a surplus appears.

As before, the surplus and deficits remain linked to the global PSF, but their magnitude is proportional to the mass flow rate. minute, where the difference between generation and demand significantly decreases, from 2 500 kW in the previous time step to 750 kW. During this period, the system operates at lower mass flow rate and temperature, which in turn reduces the average heat loss coefficient of the network and hence the generation needed to supply the demand. Between the 600 th and the 1020 th the demand increases at the beginning of the period but then remains somewhat constant, as a result the system first experiences a rise in the global PSF, and a deficit appears. However, as the demand remains at the same level for most of this period, generation temperature and mass flows stabilize. This causes the system to gradually approach steady state, lowering the global PSF and reducing the deficit until it turns into a surplus. After this period, the demand starts to fall again, further lowering the global PSF until it turns negative and increases the surplus. Lastly, between the 1 320 th and the 1 380 th minute, a surplus and a deficit occur again at the same time. Once more this is caused by the system failing to feed the demand in Node 5 with the flow from Node 4 and the back-up in Node 6 over-generating, causing a surplus in Node 7 while the deficit in Node 5 remains.

Several moments of interest exist in

This optimization strategy, using HeatGrid to minimize the cost of power plants and using the Dynamic Model to update the real losses occurring in the network, has little impact on the efficiency and efficacy of the system. In the scope of the Smart City, where highly dynamic distribution systems are connected with all their actors through communication networks that share real-time information, DH systems need more done to upgrade their operation and management. The next strategy presents an optimization strategy that not only tries to optimize the power generation of a DH system, but also the manner on which this power is delivered. This is accomplished by optimizing the temperatures at which each heat plant operates.

DOft 2: Optimization using HeatGrid, the Dynamic Model, real losses, mean demands and NOMAD

The previous strategy showed how HeatGrid in combination with the Dynamic Model can influence the energy generation of a DH system by using the expected average heat loss coefficient of the system rather than a previously set one. However, it also showed that the effect of this strategy is limited. The strategy presented in this section shows the results of an optimization strategy that not only aims at minimizing generation costs, but also at improving the supply of energy to the consumers to prevent surplus or deficits. This is achieved by including a second optimization routine that controls the temperatures at which the power plants operate while allowing HeatGrid to compute the powers and mass flows at the generation plants. The operating temperatures will be selected with an optimization routine; whose result aligns better with the internal needs of the network than basing the temperature on the demand alone.

The optimization of the generation temperature is carried out using non-Linear formulation and the NOMAD tool. The results from this strategy are presented in Figure 5-5 through the same five, vertically aligned graphs as before. The main difference between Figure 5-5 and the previous two is the length of the time step. For the NOMAD optimization to converge it was necessary to increase the length of the time step enough to ensure that steady state is reached. For this reason, the time steps are lengthened to three hours instead of one and the demand used for both optimization algorithms is replaced by the mean demand of the period. Increasing the time step to guarantee steady state at the end of the period already shows strong consequences in the results. While generation remains higher than the demand for every time step, the global PSF never falls below zero. Instead, the global PSF rises slightly at the beginning of every new time step and then it slowly declines. As seen in section 4.2, as the system nears steady state operation the global PSF tends to the average heat loss coefficient value, which is what can be seen in these results.

Also, important to notice in these results is the way the system manages the deficit and the surplus. First, it can be observed that the deficit and the surplus are significantly lower than they were for Oft 1 and Oft-base. This is a sign that the new strategy has positive effects on the system. The change in the strategy becomes even more apparent when looking at the temperature and mass flow rate graphs. In this strategy, temperature no longer follows the same pattern as the demand but is rather set by the optimization routine. Interesting to note is that during this period the solution gives a temperature profile that steadily rises as the simulation continues. The mass flow rates also present changes, while the output of the wasteto-heat plant remains somewhat constant and very similar to the previous two strategies, the mass flow output at the gas plant in Node 2, now more closely follows the demand. These results are biased by using the averaged demand over the three-hour period, but they still show promise on the effects that a different management strategy could have on DH systems.

The surplus and deficit graph also show an insight on how DOft works. The NOMAD optimization tries to maximize effective supply by minimizing the deficit and the surplus. This approach affects the results for this strategy by now showing an alternation between deficit and surplus. The deficit always appears at the beginning of every time step and it is later followed by a surplus. This optimization strategy, while it does reduce the deficit and surplus, it also increases the number of times that a deficit will exist. Like on the previous strategies, during the times the back-up is used, a deficit and a surplus can occur at the same time.

This optimization strategy clearly shows that having temperature control (and thus mass flow control)

can have a positive impact on DH systems. A lower surplus indicates less energy waste and points towards lower generation costs. The increase in the number of times a deficit happens, however, shows an important limitation of this strategy. Even when the deficit is small compared to the local demand, it could mean that some customer will suffer a complete interruption of their service. If these deficits are not managed properly, the same group of customers would be left without heat several times during the day, which could be worse for the QoS than a single, longer, interruption.

An aspect of DH systems that cannot be overlooked is their dynamics, like the delay and the inertia. As explained above, after each optimization time step, the pipes are full of hot water that can be used as an alternative source of short-term supply. This is explored in the next optimization strategy, which tries to take advantage of the energy already contained in the system to reduce even further the energy generation, the surplus and the deficit. This is done through the implementation of the global PSF as a replacer of the average heat loss coefficient.

DOft 3: Optimization using HeatGrid, the Dynamic Model, the real losses, mean demands, NOMAD and the Pipe Supply Factor

The heat inertia of the system, together with the delay, have historically been considered as a challenge on DH control. In simple terms, the delay is the time needed for a heat front to traverse a specific distance in the network, i.e. the time needed for a consumption node to receive the energy from a generation node. To overcome this, traditional systems try to forecast the demand to generate the energy before it is needed, but often they simply over-produce heat. The effects of delay can be mitigated by improved system management as shown on section 4.2. When a node's demand changes there is a delay before the new generation reaches it, however, during this time supply continues. This supply is the result of the past decisions in the network and its thermal inertia. This optimization strategy aims at taking advantage of this inertia to act as a short-term source of heat when possible. In other words, this strategy uses the energy stored in the pipes from the previous optimization time step as an alternative heat source. This is integrated in the optimization via the PSF. If a pipe has enough energy to supply part of the demand, indicated by a negative PSF, this value will replace the average heat loss coefficient of the pipe in the dispatch optimization. This will cause HeatGrid to see the systems as having gains rather than losses, and it will reduce the energy generation consequently. While every pipe has its own PSF, the results presented show only the global PSF of the system as it serves as a good indicator to the combined effect of the individual PSF's.

The results for this optimization strategy are shown in Figure 56. The first thing that immediately jumps to the eye is that generation is no longer always higher than the demand. Between the 180 th and the 360 th minute, and between the 720 th and the 900 th minute, the heat generated in the system is lower than the system's demand. Intuitively, this would look like a sure sign that the deficit will be high, but this is not the case. Results in the bottom graph,

showing the surplus and deficit of the system, display smaller deficits during these periods than in others where generation is higher, and in both periods even a surplus is present. This is a direct effect of DOft using the PSF to adjust generation based on the energy already contained in the system. In both periods when the generation drops below the demand, the global PSF of the system is negative, indicating that the pipes contain stored energy that is being injected into the system and can be used as an alternative source of supply.

These results already indicate that using the PSF to take advantage of the delay and the inertia could prove to be a good strategy. However, the rest of the results for this strategy point at it being flawed.

Looking at the generation graph, with this strategy there are long periods of time where the back-up plant

DOft 4: Optimization using HeatGrid, the Dynamic Model, the real losses, mean demands, NOMAD, the Pipe Supply Factor and ±5°C T° constraint

As explained above, the present research has as one of its specific objectives to explore how the dynamics of DH can be mitigated, or even taken advantage of, with a new manner of system management. The results obtained in section 5. [START_REF] Bouhafs | Links to the Future: Communication Requirements and Challenges in the Smart Grid[END_REF] show that the inertia and the delay can have a positive impact on the network, but also a negative one if they are not properly considered. In this section, the optimization strategy from DOft 3 is repeated, but this time constraining the amount of energy that the system supplies from the heat stored in its pipes. This is done as a temperature constraint at generation, which limits the generation plants T° variation to ±5°C. This constraint ensures that every time step new heat is being injected into the network and that some of the supply will always come from the generation plants.

The results for this strategy are presented in Figure 567. The first thing to be observed is that the results are better than in DOft 3. Looking at the top graph, it can be seen that periods where generation is lower than the demand continue to exist, but that this time the back-up plant is not used as often or at the same high capacity as in the unconstrained strategy. Looking at this graph in combination with the global PSF, whenever the global PSF is lower than zero, the generation is lower than the demand. If the strategy is working properly, then these same periods should also not present a high deficit. Focusing on the three periods where the global PSF is negative and the generation is below the demand (between the 360 th and 540 th minutes, the 900 th and 1 080 th minutes, and the 1 440 th and 1 620 th minutes), it can be observed that these are also the periods with the lowest deficit of all. These results show that using the global PSF to account for the delay and the inertia can indeed reduce the energy generation of the system without negatively impacting the QoS.

From Figure 567, it is also interesting to note that the surplus and deficit present a similar effect to that in DOft 2, with periods of surplus and periods of deficit alternating between each other. However, unlike all the previous strategies, there are moments where a surplus and a deficit coexist even when the backup is not in use. This is most observable between the 540 th and 720 th minute and the 1 800 th and 1 980 th minutes. These two periods present a constant deficit with two small spikes in the surplus. The explanation to this comes from the combination of three factors: 1) the formulation that HeatGrid uses to determine the flows in each pipe, 2) the real heat in the pipes and, 3) the real temperatures of the nodes. HeatGrid assumes steady state operation, which conflicts with the real flows and temperatures of the network. Each node is programmed to take as much energy as is necessary/available to satisfy its demand, but because the temperature of the water varies, so do the mass flow rates. During both periods the mass flow rate in Pipes 3-4, 4-6 and 6-7 has a small intra-period variation that coincides with a small change in the global PSF. These indicate that there were pockets of hotter water between colder water, creating the small spikes.

The results from this operation strategy confirm that it is possible to use the heat inertia of the network to the advantage of the system. However, they also show that the strategy is still not optimal. Several periods of deficit still exist and there are moments where the flows in the network are not perfectly balanced, like when both a deficit and a surplus exist. This can be attributed to the lack of "communication" between optimization time steps. This could cause individual optimum which do not guaranty the global optimum and whose accumulation can even cause a worst global solution (like seen on DOft 3). To overcome this, the optimizations could be interconnected. In this way, the results from a time step do not harm the operation of the next time step. Before exploring this, it is interesting to see what happens when the temperature constraints are relaxed to test the sensitivity of the system under this optimization strategy. The next section presents this same strategy but with a temperature constraint of ±10°C instead of ±5°C. is that each time step is optimized independently of the others, resulting in the accumulation of individual optima to cause a worst global solution. A way of addressing this is by linking the results from a specific time step to the results from previous or future time steps. This can be done by changing the optimization to an advancing horizon optimization with a sliding window to concatenate the results.

NOMAD, the Pipe Supply Factor and a Sliding Window

As seen in the previous sections, the consideration of the heat inertia of the system can lead to a reduction on the heat generation of a DH network. Nevertheless, considering each time step as independent of each other lead to inferior management strategies that overused the back-up plant and increased the number of deficits in the system. In the present research this is addressed by changing the optimization strategy to work using a horizon optimization with a sliding window rather than a temperature constraint.

With a sliding window it is no longer necessary to use average values of the variables over a three-hour period and the optimization can go back to operate with 1-hour time steps. As the optimizations are now connected, it is also no longer necessary to constraint the generation temperature. To guarantee that all the effects of the optimized hour on the subsequent ones is considered, the window is set to a three-hour horizon, as this is the longest time required for the tested network to reach steady state with unvarying input conditions. Larger networks will require a wider horizon, but the basis here presented will not change.

The results are shown in Figure 56789. Observing the top graph three things are apparently relevant; the first is that there is a huge gap between generation and demand at the beginning of the results. All optimization strategies were initialized using the same conditions and allowed to run for a while before the evaluated period, this was done to ensure that the initial conditions did not influence the results. In this strategy, the previous time steps created the settings needed for a period of low generation. These results were consistent after several trials and are deemed reliable even though they appear strange. The second thing that is clearly visible is that the back-up plant is barely used. Except for a short period at the 24 th hour of simulation, the back-up is always off; this indicates that with improved system management all heat can be supplied by the main heat plants and any transient deficits can be covered by the inertia of the system. Third, with this strategy the generation and demand profiles match each other more closely. This shows that not only the back-up is no longer needed as much, but the overall generation of the system has been reduced. Very interesting to see is the profile of the global PSF curve, while it has a large variation in the first hours of the simulation, once the generation settles to always being higher than the demand, the global PSF settles to a value very similar, if not equal, to the average heat loss coefficient. This immediately indicates that, even if the system is not operating in steady state, this optimization strategy gives results resembling steady state operation.

Looking at the graph showing the generation temperatures, it is observed that the operating temperature at the main generation plants is almost constant for the whole period and it is lower than in all the previous strategies. These results not only demonstrate that with better system management it is not necessary to vary the temperature at generation that much, but that it is possible to operate at lower supply temperatures; because losses are a function of the temperature, this helps explain how the optimization strategy is able to reduce the generation so much. This also explains the behavior of the global PSF, as the temperature is not changing between time steps, the temperature dynamics are not present. In this graph it can also be seen that at the beginning of the simulation, the temperature at Node 6 is higher. This gives an idea of the operation of the network in the time steps before the presented results. The network was operating at a higher temperature and this is the reason why generation is so low at the beginning of the printed results; the system had a lot of inertia.

In the graph showing the mass flow rate it becomes clear that the system is operating under mass flowbased control rather than temperature-based control. During this period, the temperature at generation is kept constant while the mass flow varies to match the profile of the demand. Of note is the small steps seen in the first hours of simulation where the mass flow rate rapidly increases. During this time, the network had an elevated temperature, and the system supplied the demand by increasing the mass flow rate, to make use of this heat, rather than increasing generation. This explains the low generation seen in the top graph during the first hours of simulation.

The last graph to analyze is the bottom one showing the surplus and the deficit. From this graph it is immediately easy to see that this strategy significantly reduces the surplus and the deficit experienced by the system during the simulated period. Except for the beginning of the simulation, where small spikes of both surplus and deficit exist, for most of the simulation both surplus and deficit are negligible. This, in combination with the rest of the results showing lower generation, lower operating temperatures and dynamic operation resembling steady state, show the power of having an appropriate strategy for the management of DH systems.

However, within the scope of the Smart City, distribution systems do not operate independently from the users connected to it. In a Smart Network all actors connected to a distribution network participate in the exchange of information and decision making. This operation strategy has demonstrated that it is possible to operate a DH system in a more dynamic way, and that it is possible to use the system's dynamics to aid the operation of the system itself. But to be fully integrated in a Smart City, DH networks need to be able to include the end-users in its operations too.

The next and final strategy includes user participation in the management of the network through Demand Response. In this way individual users agree to curtail their energy use for a short period to improve the overall efficiency of the network. The previous section demonstrated that it is possible to have a strategy for system management of DH that considers the dynamics to aid the supply of the system and increase response times. However, the results also show that surplus and deficit, though reduced, persist. In a branched system like the one studied in the present research, the deficits are always felt first and foremost by the consumer nodes the farthest away from a generation plant, as they have the longest delay to resume supply. Because this work is done in the scope of the Smart City, it is necessary to consider all the actors of a DH network, not only distribution and generation. This optimization strategy introduces the users of a network as active participants of the system. In this simulation, some of them agree to reduce or curtail their demand for a short period of time to help the network reach higher efficiencies and QoS at the farthest consumer nodes.

The introduction of the consumer participation in the system is done in the form of DR. DR can be defined in a simple manner as the temporary reduction of consumption by the consumer. But in the case of DH, due to the thermal characteristics of the systems connected to it (usually buildings), the broader definition proposed in this research is the temporary reduction of consumption by the consumer or the temporary curtailment of supply by the DHO that would not change the state of comfort felt by the consumer. Implementing this into our model would allow to shift a deficit from a far node to a node closer to generation, thus making it easier for the system to balance out generation and supply. The way this is implemented in the optimization is that every node allows up to 5% deficit in its supply and the optimization uses this flexibility to better balance out the deficit among all nodes, given priority to assign a deficit to the nodes closer to a main generation plant. This flexibility is given the variable name alpha (𝛼) and each node is assigned a value 𝛼 𝑘 . If the system experiences a deficit at any time, the optimization finds the values of 𝛼 𝑘 for all consumer nodes that would minimize the deficit at the farthest away nodes using the function The results for this strategy are presented in Figure 5-10. In the top graph it can be observed that the back-up has higher use than in DOft 6 and that most of it occurs during the same period that DOft 6 had exceptionally low generation. While for DOft 6 the initialization of the optimization created the conditions for a period of low generation, in this strategy the same period now needed increased generation. These results already show that DR is influencing the operation of the system. From this same graph it can also be seen that generation and demand have similar profiles; with the resolution used, it is almost impossible to note the difference between the two in many periods. The global PSF graph also shows interesting results: at the beginning of the simulation, while the back-up operates, the global PSF increases. This is followed by a moment when the global PSF drops to a value close to zero, then rises until finally settling at a value close to the average heat loss coefficient of the network.

Looking at the Temperature and Mass Flow Rate graphs helps explain the behavior of the global PSF.

The temperature is almost constant during the whole studied period, and as the heat losses are more affected by the water temperature than the speed of the flow, they also remain almost constant. What varies the most during this time are the mass flow rates, but as was seen in DOft 6 and repeated here, having a horizon optimization with a sliding window to link the results of a time step to its past and its future does have a positive impact. This, in combination with DR, allows DOft 7 to propose a solution that maximizes supply throughout most of the system's operation, greatly reducing the adverse effects of delay and inertia. This can be verified by looking at the bottom graph showing the surplus and the deficit.

Other than two occasions at the beginning of the simulation, where a surplus is followed by a deficit, the surplus and the deficit remain low. This graph shows the power of the strategy presented in this section, and its effects. An important take-away from the results obtained with this strategy is that the network is operating at a lower temperature. However, the demand has not changed. This means that the mass flow rates are higher than in Oft-base. For this specific network, the pipes can handle the increased flow (and associated pressure), but it is true that some existing networks will not be able to handle an increase like this. Because this work aims to be a proof of concept, these flows were accepted.

Other than that, these results are promising. They confirm the original assumption that other forms of system management exist for DH that can increase its efficiency and QoS. Moreover, the system management strategy presented in this strategy can operate under a dynamic environment, taking advantage of the delay and the inertia for the benefit of the system. Most significant result of all, is that considering the dynamics and the active participation of users further increased the reliability of this kind of systems. These results strongly indicate that DH can be upgraded to be a constitutive component of the Smart City and that heat should not be forgotten in place of electricity.

Temperature, deficit, surplus and PSF mapping

The above sections presented the results for eight different optimization strategies. These results included the heat generated at every heat plant, the global PSF, the temperature of the nodes where a heat plant is located, the mass flow rates and the global deficit and surplus. In this section, two of the strategies are selected to present the results of the spatial and temporal distribution of temperature in the network, the increase compared to the temperature of Node 3, the PSF tends to the average heat loss coefficient when the temperature difference remains somewhat constant, and the PSF drops below zero when the temperature of Nodes 1 and 2 is lower than that of Node 3. This effect is the same for every two nodes and the pipe that connects them. But in the case of the global PSF, it was seen that it remains above the zero line as long as the generation temperature is above the network temperatures and falls below it when the generation temperature is below the temperatures of the network. In this strategy, the individual PSFs settle around a constant value at different moments (this value is close to the average heat loss coefficient of their respective pipes, as explained in section 4.2.4), but as can be seen in the global PSF presented in Figure 5-10, their combined effects do not allow the global PSF to have a constant value at any moment. This is caused by the global PSF representing the sum of effects in the network, and the system changing too fast for all the network to operate near steady state at any one time, even when some pipes have already reached close to constant operation. Lastly, from Figure 5-12, the bottom graph shows the surplus and the deficit. This graph shows how the individual PSFs are great for mapping the network, but the global PSF is better for a general analysis of the whole network. This figure shows that a deficit exists between the 540 th minute and the 720 th minute.

During this time, the generation temperature is increasing, but the rest of the network remains at a lower temperature, with the difference between Node 1 and Node 7 being as high as 6.5°C. At the beginning of this period, the global PSF is increasing, as well as the PSFs of Pipe 1-3 and Pipe 2-3. The PSFs of Pipe 4-5, Pipe 4-6, and Pipe 6-7 however, continue to be below the zero line. Looking at the top graph, while the network is increasing its temperature, these three nodes are still experiencing a decrease in their local temperature, causing the negative PSF. The temperature of Node 5 and Node 7 is too low to supply the demand, and thus a deficit exists. Once the heat front reaches these two nodes and their temperature starts to rise, they are finally able to better supply their demand, turning the deficit into a surplus when their temperature rises by ~5°C. What is very interesting to see from these two nodes, and the PSF of the pipes connected to them, is that the peak of the deficit and the peak of the PSF coincide, with the PSF being able to indicate that a deficit was occurring due to the heat not having reached the nodes yet.

However, the global PSF had experienced its peak one hour earlier, when the deficit was just beginning to appear, already indicating that a larger deficit should be expected. This shows how the individual PSFs are a good tool to map a DH network, and how the global PSF is a good indicator of the sum of effects that the dynamics are causing in the system. In larger networks, the individual PSFs could also be used for local control of segments of the network, i.e. individual meshes or single branches, and a segment PSF could also be defined to represent the dynamics of the segment for distributed control. In this figure the y-axis has been changed to a smaller range compared to Figure 5-12. The two figures cannot be overlapped for comparison as was the case for the previous figures in sections 5.1 to 5.8, but the change in the y-axis makes the reading of the results easier. The first thing to note is the difference in the temperature profiles. While in Oft-base the temperature varied between 366K and 354K, with a maximum difference between nodes temperature of 7°C, with DOft 7 the generation temperature remained at 338K for most of the simulation. The temperature difference between the hottest node and the coldest was also reduced to half a degree centigrade.

From Figure 5-13, the most interesting thing to note is that having constant temperatures in the network causes the individual PSFs to be almost constant, as explained in section 4.2.4, This causes the PSF to settle at a value close to the average heat loss coefficient of the individual pipes (between 0.004 and 0.011), as the PSF is only affected by the heat losses during steady state operation. The global PSF also remains at a value close to the average heat loss coefficient of the network (0.013). These results show an important effect of DOft 7. This optimization allowed the system to operate near steady state temperatures, even when everything else was varying. Because a change in the mass flow rate is felt at the same time by all the elements in the network, it makes the PSF to be constant and the control of the network easier. This can be seen in the bottom graph of Figure 5-13. Where apart from a moment at the beginning of the simulation, the deficits and surplus are small compared to the demand, with the deficit never surpassing 2.8% of the instant demand and the surplus 4.1% of the instant demand. Also of note is that the deficits are spread between nodes 3, 5 and 7, instead of being concentrated in only one node.

Conclusion

The results obtained throughout the eight strategies show that it is possible to operate DH networks accounting for their dynamics in a manner that reduces the generation (and thus fuel consumption) and prevents deficits from occurring (thus increasing the QoS as will be seen in the next chapter). Each strategy showed the power of combining modeling and optimization to improve DH system management, as well as new opportunities for DH operation. Using the heat inertia to the advantage of the system, using near-future horizons for a sliding window optimization, and using active costumers as a manner of system balancing, all proved to be implementable in DH systems and to have positive effects if done correctly.

Evaluation of DH: Results and Discussion

As a result of the literature review, the present research found a vacuum for the systemic evaluation of DH networks. This motivated the development of a novel evaluation framework based on energy, economic and QoS indicators. This framework is presented and explained in Chapter 3.3. By applying it to each of the strategies analyzed in Chapter 5, it is possible to compare them based on a reliable foundation and fully understand the gains obtained with each of the strategies, not only for the generation plants or the DHO, but for all actors connected to a DH network.

The evaluation is presented in three sections: the energy evaluation is presented in section 6.1; section 6.2 presents the economic evaluation of the strategies; section 6.3 presents the innovative part of the evaluation framework, with the analysis of the QoS from a system's point of view. All strategies are labeled with their numerals except Oft-base. For reference, each strategy is summarized in Table 5-3.

Energy Indicators

The total generation of the eight strategies is presented in the top graph of Figure 6-1. Each bar represents a strategy, and it is divided by the heat plant that provided the generation. The dark blue is the generation of the waste-to-heat plant, the light blue is the generation of the gas plant, and the red is the generation of the back-up plant. The green line represents the demand of the system for the whole period.

In this graph it can be seen that DOft 6 is the only strategy where the generation is lower than the demand; DOft 4, DOft 5 and DOft 7 have a generation that is slightly higher than the demand; and the rest all present higher generation that ranges between 66 MWh and 123 MWh higher than the demand.

The energy efficiency is defined in Equation 3-16 in Chapter 3, this indicator tells how the energy generated during the evaluated period compares to the supplied demand. The lower this value is, the more waste that exists in the network. The energy efficiency for each of the optimization strategies is presented in the second graph of Figure 6-1. Here it can be seen that the best efficiency is obtained with DOft 6, followed closely by DOft 7 and DOft 4. The worst efficiency, with a value of 88,79% is obtained with DOft 3. Oft 1 and DOft 2 have efficiencies similar to Oft-base. DOft 3 is the first attempt to use the inertia of the system to act as short-term supply. In this strategy the system oscillated between periods of high and low generation as the energy stored in the network was emptied and replenished. Because each period of high generation had to make up for the deficit caused by the period of low generation a lot of energy was wasted, explaining the low efficiency. The efficiency of 101.61% obtained with DOft 6 indicates that for the period of the simulation, part of the demand is being supplied by energy generated before the analysis. When the system is analyzed in a specific, short time frame, it is possible that previous generation is not accounted for which aids in increasing the efficiency of the network.

These results show that the best efficiency values are obtained when the heat inertia of the system is considered in an appropriate manner. If this is done incorrectly, the results show that the system could suffer rather than benefit from it (DOft 3). Because the results presented in section 5.6 showed that the system can be very sensitive to the way this is addressed, we can conclude that while DOft 4 has the third best efficiency, this is misleading, as a change in the conditions can rapidly reduce the efficiency of the network. Also of note is the possibility of having an efficiency higher than 100%. This is caused by the delay and the inertia of the system, where some of the supply in the analyzed period comes from earlier generation. If longer periods of time are considered, i.e., one year, the effect of this will be too small to notice. The results obtained in the present research still hold true, as the aim is to prove that efficiency can be increased.

Economic Indicators

In the previous section, the generation and efficiency of the network were analyzed. An increased efficiency usually indicates lower generation, as less energy is wasted. This savings in energy can translate to economic savings associated to the cost of producing the excess energy in the lower efficiency strategies. More so, a better management of the system can reduce the use of heat plants with higher fuel and operation costs, further reducing the costs of the system and increasing the economic savings.

In the present research the system has three different operating heat plants, each using its own fuel. The fuel costs are presented in Table 5-2. Figure 6-1 shows the results for the operation costs, the revenue, and the profit for each of the eight strategies, as well as an analysis of the source of the difference in profit. These indicators are defined in Equation 3-17. In the present research, the heat is sold to the consumer at a fixed tariff of 0.10 €/MWh.

The operation costs are presented in the third graph of this figure and use the same color pattern as the top graph. The dark blue indicates the cost of the waste-to-heat plant, the light blue the cost of the gas plant, and the red the cost of the back-up plant. The green line shows the cost of a system where generation, supply and demand match perfectly, in other words, a system with no delay, no inertia and no losses. In the present research this is named Perfect Supply, and it represents the best, but physically impossible, scenario a DHO could expect. The costs in this graph are expressed as € per MWh of demand. Here it can be seen that all strategies have a higher cost of operation than the Perfect Supply base (35,84 €/MWh-demand) except for DOft 6, which is 0,44 €/MWh-demand lower. This is again explained by this strategy being the only one in which a significant part of the supply for the first hours of evaluation was generated before the period analyzed. In all the strategies most of the costs come from the gas plant, as it is the heat plant with the highest capacity and thus, the highest generation. For DOft The profit for each strategy is indicated by a dark green bar and with an orange line for Perfect Supply.

The revenue comes from the supplying of heat, each MWh of demand met will create the revenue indicated by the dark green bar. The difference between this bar and the Perfect Supply revenue is caused by part of the demand not being met. The profit is this revenue minus the operation costs, the larger the deficit or the higher the operation costs, the lower the profit. The lowest profit is obtained with DOft 3, which is expected as this strategy has the lowest efficiency and the highest operation costs. DOft 6 and DOft 7 have the profits closest to Perfect Supply, with DOft 7 being 0,60 €/MWh-demand lower and DOft 6 being 0,44 €/MWh-demand higher. DOft 6 having higher profit than Perfect Supply seems counter intuitive, as Perfect Supply is the best scenario the DHO can hope for. This is explained by the limited time period that is studied. Enough of the demand of DOft 6 is supplied by generation that took place before the evaluated period, so its costs are not accounted for. In the operation of DH there will always be short periods where results like this can happen, with profit being higher than the best-case scenario, but once longer time frames are studied, the savings at the beginning balance out with the rest of the operation. These results however do not cease to be interesting, even if they are misleading.

The bottom graph of Figure 6-1 shows the origin of the differences in profit. As explained above, profit can be lost by higher generation costs or lower supply of the demand. From this graph it can be seen that for Oft-base, Oft 1, DOft 2, DOft 3 and DOft 7 most of the profit loss comes from higher generation needed to supply the demand. For DOft 4 and DOft 5, most of the lost profit comes from the higher use of the back-up plant. DOft 6 is a special strategy, as the use of the back-up incurs in some loss of profit, but the lower generation compensates for this, giving as a result a better profit for the studied period of time. It is also important to note that while the results obtained with DOft 4 look similar to those obtained with DOft 7, the results from Chapter 5.5 showed that DOft 4 has sensitivity to the temperature constraint. This sensitivity could cause different results on different evaluation periods and different systems. These nodes are located at the end of their respective branches and show how a node becomes more vulnerable the farther away it is from a generation plant. An interesting strategy to analyze is DOft 7, this is the only strategy where interruptions occur in a node other than Nodes 5 and 7. As detailed in section 5.8, the reduction in supply at a node product of the DR strategy could lead to a loss of the QoS, this is set this way on purpose to test the difference in losing QoS near a generation plant rather than far away from it. This strategy increased the total number of interruptions but decreased the interruptions in Nodes 5 and 7.

With the number of interruptions, it is possible to calculate the failure rate of each node (𝜆 𝑘 ). The failure rates are presented in Figure 6-3 and can be thought as the number of interruptions a consumer connected to a node will experience during the evaluated period. In this figure it can be observed that DOft 5, DOft 3 and DOft 4 are again the worst performing, having the highest failure rates. The best results for Nodes 5 and 7 are obtained with Oft-base, Oft 1 and DOft 7. It is interesting to see that from the failure rate perspective Oft-base and Oft 1 perform well, but at the expense of system efficiency as seen in section 6.1. Something of note is that in this figure, as well as Figure 6-2, DOft 6 no longer has the best results. This ties back to the results seen in Figure 6-1, where DOft 6 had the best efficiency and the lowest generation. Looking at the failure rate of DOft 6, it is obvious now that the increased efficiency came from the period of higher generation before the period being evaluated, which caused the lower generation seen at the beginning of the presented results (Figure 56789). When evaluating DH systems, if the evaluation period is not significantly longer than the effects of the delay and the inertia, distortion in the results may occur due to the previous states of the network. The failure rate (𝜆)and the average duration of interruption per customer (𝑈) can be used to obtain the SAIFI, SAIDI and CAIDI indicators using the equations presented in Chapter 3. These indicators help translate the known information from the primary side into information from the connected customers.

The higher the SAIFI, the higher the likelihood for a customer to experience an interruption during the evaluated period; the higher the SAIDI, the longer the average duration of interruption for every customer connected; the higher the CAIDI, the longer will a customer have to wait to have their supply restored. These results are presented in Figure 6-6 and Table 6-1. Here it can be seen that the smallest SAIFI is obtained with Oft-base, followed by Oft 1 and DOft 7. The shortest interruptions are obtained with DOft 7 followed by DOft 6. The shortest heat restoration times for the consumers are also obtained with DOft 7 and DOft 6. Figure 6-6 is especially interesting because it shows the separation between the system's perspective and the customer's perspective by looking at the difference between the SAIDI and the CAIDI. The SAIDI shows the duration of the interruption averaged through all the connected customers, as if every customer experienced a short interruption. The CAIDI shows that only some of the customers are affected by the interruption, thus extending the time that the interruption persists in reality. The Oft-base appears to be a good strategy because it has a low chance for an interruption to happen (0.024 interruptions per customer per day), but if an interruption does happen, it takes the system a long time to react (0.098 hours per customer per interruption). This concludes in, if you are the customer experiencing the interruption, it could take 4.033 hours for the system to restore your supply.

Comparatively, with DOft 7 the system will experience 0.051 interruptions per customer per day, but it will take only 0.019 hours per interruption per customer for the system to react. This causes the customer to experience a lack of supply for only 0.373 hours (23 minutes) if an interruption happens. With DOft 7 there is twice the chance for an interruption to happen, but the system will react in a fifth of the time, cutting the duration of the interruption to the customer by a factor of 10.

Conclusion

These results show the importance of a comprehensive framework for the evaluation of DH systems.

Based on the energy efficiency and economic savings alone, it appears that the best operating strategy is the one used in DOft 6, where the participation of the consumers is not considered. However, the results obtained with the evaluation framework proposed in this research shows that the energy and economic indicators show only one side of the story. The inclusion of the users in the activities of the network, which is a fundamental aspect, has a significant impact on the main objective of any energy distribution network: the reliable supply of energy to its users.

continues until 06h00 on December 10 th . The results here presented start at 06h00 on the 3 rd of December to guarantee that the effects of the initial conditions have been dissipated. DOft 7 still uses 1-hour time steps (containing four 15-min periods) for HeatGrid, and a time horizon of 3 hours with a 1-hour sliding window for NOMAD to concatenate the optimizations contained within the horizon. 1. The heat generated at each heat plant and the demand profile.

2. The global PSF.

3. The generation temperature at the waste-to-heat and gas plants, and the node temperature at the back-up plant.

4. The mass flow rates at each of the seven pipes.

5. The surplus and deficit experienced by the system.

The results for Oft-base strategy are presented in is observed that the global PSF also follows a similar pattern as before. When the demand increases and the generation follows, the global PSF also goes up, when demand and generation decrease, the global PSF goes down. This is especially relevant as it highlights again the biggest weakness of control strategies that assume steady state. The increased generation used to match the demand is not going into the consumer nodes, but rather into the pipes of the system for its transport. The effects of this are clearly seen in the bottom graph of Figure 7-2, where large deficits exist every time there is a peak in the demand and surplus appear when the demand goes down. This behavior is common in existing DH networks, where in some cases the end-users have had to grow used to "wait for heat to be restored" in a regular basis.

Lastly from Figure 7-2, it is interesting to see the curves for the temperature and the mass flow rates.

Similar to Oft-base in section 5.1, the generation temperature at Nodes 1 and 2 closely follows the profile of the demand. The temperature on Node 6 however is displaced in time. This is a direct effect of the delay and inertia of the system that show once more why operating DH under the assumption of steady state is not a good idea. The energy needed to feed the consumption nodes is not arriving in time, and when it finally arrives, the demand has changed and a fraction of it ends up being wasted. Looking at the mass flow rates graph, the mass flows show more variation than previously, but it is still the temperature that follows the pattern of the demand. Interesting to see is how the mass flow rate in the pipe connecting Nodes 4 and 6 goes down every time there is an evening peak and the back-up is used. This could indicate that, having not being able to properly prepare for the higher demand, the system needs to divert more flow from Node 4 to Node 5 and the back-up is then required to supply more of the demand of Node 7. As before, Figure 7-2 shows that an operation strategy like the one proposed as Oft-base is not optimal, presenting several deficits and a high waste of energy.

Using DOft 7 on the same system gives the results presented in Figure 7-3. The demand is the same as for Oft-base, but it can immediately be observed that the generation has changed its pattern. Looking at the top graph, now the peaks on generation happen before the peaks of the demand on many occasions, indicating that the system is preparing in advance to the periods of high demand. It can also be seen that there are several periods where generation is lower than the demand, indicating once again that the system is making use of the energy stored in the pipes to supply part of it. The global PSF also shows a change in its profile, now it is more constant during several periods, indicating that the system is operating in near-steady state conditions, even if the environment remains dynamic. Also, the global PSF is still presenting positive and negative peaks, the positive peaks happen when the system is preparing for a high demand period by increasing generation, or when the back-up is being used. These periods are always followed by a negative peak, showing that the system is discharging the energy previously injected into the pipes.

The effect of the DOft 7 optimization is clearer to see by looking at the bottom graph portraying the surplus and the deficit. Here it can be seen that the magnitude and the duration of both is significantly reduced, but now they appear more often. Especially in the case of the deficit, where a small deficit is almost always present. To explain this it is necessary to look at Figure 7-4, here it can be seen that in this optimization, where 𝛼 𝑘 has no duration constraints and can be used as often as the optimization wants, Demand Response is used often. The DR factor is active in Node 3 for around two thirds of the time and in Node 4 for a third of the time. Figure 7-5, which shows a zoom-in for the period between Tuesday at 6h00 and Tuesday at 18h00, shows that 𝛼 can be continuously active for periods longer than one hour and/or be re-activated within a few minutes. At first this may appear as a limitation of the proposed optimization and an indication that time constraints are needed for the use of the Demand Response scheme. However, this is not the case, as the QoS results will show. It is important to remember that the Demand Response called for by 𝛼 𝑘 is assumed to not be applied to all the consumers connected to the substation, but to a selected few. If enough consumers are part of the Demand Response initiative, then the reduction can be spread among them, where everyone suffers a short curtailment that won't affect their QoS, rather than all of them experiencing a reduction that will affect the QoS. Each small deficit peak can be attributed to a single costumer, and they are so short that may not compromise their QoS. This is further explored below where the QoS indicators for this week of operation are presented.

Lastly, it is interesting to look at the temperature and mass flow profiles for the system. In the optimization strategies presented in Chapter 5, DOft 7 led to a system operating at a mostly constant temperature. However, now that the system has larger demands that vary intra-hourly, faster than generation is adjusted, this is no longer the case. demand. By comparing the temperature graph to the global PSF and generation graphs, the periods of higher generation temperatures coincide with the increase in generation and the higher global PSF values.

These periods usually appear before a peak in demand, demonstrating that DOft 7 uses the delay and the inertia of the system to prepare for periods where demand can be hard to supply by "charging up" the network. And as before, while the temperatures remain somewhat constant and rise only when needed, the mass flows vary much more and have a profile similar to the demand. Interesting to see in the mass flow rate graph are the several moments where the mass flow in Pipe 4-6 drops (red line) compared to the mass flow rate in Pipe 6-7, indicating that the back-up plant in Node 6 is supplying heat to Node 7.

There are even two periods where the flow drops to zero and the back-up plants supplies the entirety of the demand in Node 7. These same periods can also be seen on the generation graph, where the red area indicates that the back-up is in use. This again shows the importance of having a horizon optimization, as there will be times when the generation plants are too far away from the nodes that require supply, and the back-up will be the only way of supplying the demand. Planning ahead however reduces the number of times that the back-up will take over.

From this last graph it is important to note that while the profit loss due to not satisfying the whole demand is similar in both cases, the way the deficits occur in each of them is different. For Oft-base the deficits are few, but higher in magnitude, longer in duration and, most importantly, not planned. For DOft 7, the deficits are many, but small in magnitude and short in duration. These deficits also occur as part of the DR program implemented in the optimization algorithm, so they can be predicted by the DHO. This makes a significant difference in the QoS of the system.

To finish evaluating the effects of DOft 7 on a DH system, it is necessary to look at the QoS indicators.

As seen in Figure 7-4, DR, which reduces supply on some nodes to divert more energy to others, is used often during the studied week. In some cases, power was constrained to a node continuously for periods over an hour long. This could cause discomfort on the users, or even a complete loss of the QoS. To evaluate how this affects the consumers the indicators of SAIFI, SAIDI and CAIDI are used. The results for Oft-base and for DOft 7 are presented in Table 7-1. In Table 7-1, it can be seen that, as expected, the SAIFI is higher for DOft 7 than for Oft-base, as the DR scheme is active very often. This causes the SAIDI to also be higher for DOft 7 than it is for Oftbase, as more consumers are experiencing more interruptions. These results can be deceiving, as they make it look like DOft 7 has made things worse. The CAIDI however shows that with DOft 7, the time that a consumer is left without heat is just a quarter of that of Oft-base, with 20 minutes compared to 1h23. These results are explained as follows: while Oft-base tries to maintain the QoS by over-generating energy, when it fails to properly predict the demand, it will take the system more than one hour to restore power to the affected consumers, who are usually those at the end of the a network branch. DOft 7 on the other hand reduces the supply in specific nodes to re-balance the network as best as possible, this creates more interruptions overall, but greatly reduces the time that a consumer is left without access to heat. The shorter times of service curtailment are achieved by distributing the interruptions throughout the network, where more consumers will experience shorter interruptions. The way DOft 7 behaves can be tuned to reduce the number of interruptions or their length, but for the purpose of the present research they are left "as is" to better see and understand the effects.

Conclusion

The combination of all the results presented above paint the picture of the potential of the proposed management strategy of DH systems. The proposed methodology in the present research uses a horizon optimization to predict future deficits or surplus and adapts the operation of the heat plants to prepare the network to cope with them, either by increasing generation to "charge up" the pipes with extra energy

Conclusions and Future Works

The present research has as its main objective the proposal of a novel model for system management of The dynamic modeling of DH networks, which in the present research is done through Oriented Graphs, heat balance and a modified version of the Finite Volumes Node method, showed that the losses, the delay and the inertia have a significant impact on the real operation of the DH system, especially on networks with a long distance between generation and consumption. The losses reduce the energy available at the consumer nodes, the delay postpones the time this energy is available, and the inertia distorts the shape of the heat signal compared to its input at generation. This is in accordance with the findings of the literature review, where the inertia and the delay are considered challenges and/or constraints for the operation of DH systems. In the present research however, the inertia and the delay were considered not as challenges, but as assets of heat distribution. Using the Pipe Supply Factor (PSF), an indicator developed and proposed in the present research, it is possible to model the delay and the inertia to make the pipes act as short-term alternative sources of heat (or short-term storage). This opened the possibility of doing the optimization of DH systems without assuming steady state for the transport equations of heat.

The optimization part of DOTS is carried out by the developed tool called DOft (or Oft if the temperature optimization is not included). DOft is an optimization tool that uses two different optimization cycles, one for the dispatch of energy and one for the temperature of the energy dispatched, to find the mode of operation that would minimize the energy generation, the deficits, the surplus and the costs of generation simultaneously. The dispatch optimization uses a cost function as its objective, which is described using Linear Programming formulation and is minimized using HeatGrid, an optimization tool that uses a variant of Mehrotra's predictor-corrector algorithm. The temperature optimization uses an objective function composed of the generation, the deficit, and the surplus. It is described with non-Linear Programming formulation and thus is minimized using NOMAD, an optimization tool that uses the MADS algorithm. The combination of the two formulations, Linear

Programming for the linear functions and non-Linear Programming for the non-linear functions allowed the optimization to arrive to a solution in a fraction of the time that the same problem required when formulated only in non-linear formulation. The results from the combined formulation also had the same level of reliability as those obtained with a pure non-linear model. After DOTS was tested for the eight optimization strategies, two of them were chosen for a Case Study using real data from the city of Nantes, in France. The chosen strategies were Oft-base, which resembles the normal management of existing DH systems the most, and DOft 7, which had the best results during the test. This case study showed that in a real environment, DOft 7 does not perform as well as in the controlled tests, but it is still capable of giving improved results. DOft 7 achieved 4,68% better efficiency, increased the revenue by 0,47 €/MWh-demand and the profit by 2,37 €/MWh-demand. Most importantly, it substantially changed the QoS of the system. With DOft 7, the number of interruptions (SAIFI) was increased from 0,12 interruptions per customer per week to 0,85 interruptions per customer per week, mostly due to the DR scheme used. However, being able to plan the interruptions, rather than they appearing first and the system reacting later, allowed the CAIDI to be reduced from 1h38 of waiting time to regain service for the costumer to just 23,42 minutes. This is of important interest for future work, as being able to effectively manage the interruptions in the system can lead to further improvements in the operation of the network.

The combination of all the results presented above paint the picture of the potential of DOTS. DOft 7 uses a horizon optimization to predict future deficits (or surplus) and adapts the operation of the heat A limitation of the present research, however, is that it studies the DH networks solely from the primary side and assumes that the secondary side and the final distribution is equipped to deal with the reductions in supply originated form the Demand Response scheme. Future work originated form this study includes the modeling and optimization of the secondary side and the final users. This will allow the inclusion of more detailed flexibility measures and capabilities by considering the thermal mass of the consumer buildings, the local generation and/or storage, and demand models to better represent the operation of the network within the Smart City context and guarantee that the QoS is never lost.

As explained in Chapter 7, the results from DOft were left unconstrained on regard of the Demand Response scheme, which caused that most consumers in the studied network to experience on average a 20 min interruption per week. These interruptions could be shortened and made less frequent with properly constraining the Demand Response function, but they were left as is as it opens the possibility to further the present research by studying the secondary side of DH. In future work, where the methodology is escalated to include the secondary side of the network as well as models for the thermal mass of the buildings and for the demand, the Demand Response function can be tuned to better improve the QoS by allocating the interruptions to the consumers with the most flexibility or shorter reconnection times. This approach however would increase the computational intensity of the simulations and may require better equipment or an alternative to the Dynamic Model here presented.

Another limitation of the present research, as stated above, is that it does not consider the effects of distributed generation and storage. This would be important because, even though it has been proved that centralized generation of heat is better than distributed for DH networks, the electrification of the energy sector together with the trend to have distributed generation of electricity, could create the environment where heat would be produced locally at lower efficiency to act as a "dump" or "buffer" for excess electricity. Moreover, this could create the scenario where there is extensive distributed storage, either as installed capacity or as flexibility from the buildings. In this scenario, heat could act as a good tool to improve the efficiency of electricity networks by coupling heat and electricity networks via heat pumps and improved management of Combined Heat and Power plants (CHP). For real time control, DH could create an opportunity for multi-layer control. Depending on the time frame of the action needed, the excess or lack of energy can be solved by using heat pumps to draw or dump energy into, from shortest term to longest, the inertia of the network, flexibility of buildings, local storage, and seasonal storage. This is especially attractive when heat storage is present, as heat is easier to store for long periods of time than electricity.

Lastly, another limitation of the present research is the lack of demand models for the horizon optimization. The future demand of buildings, as well as their flexibility, can be obtained through physical models like the Dynamic Model here proposed to simulate the energy transport in a DH network. These models however can be computationally intensive and prone to error. In the future, with ICTs, Smart

Metering and the Internet of Things, it is expected that there will be easy (and secure) access to the information of the individual consumers. This opens the possibility of data-driven models for the consumer side that would greatly improve the results from the methodology in the present research. It also opens the possibility for weather forecasting and for finding and locating faulty sensors. These models however were outside the scope of this research, but their selection and implementation appear as another good opportunity for the future work from this thesis.

In the future the results from the present research could be used to develop a comprehensive tool for the optimization and evaluation of DH systems. This tool would include the Dynamic Optimization developed during this PhD and here presented and combine it with, or expand it, to include the secondary side and the final users. This would greatly increase the capability of the flexibility measures to increase efficiency and reduce costs without jeopardizing the QoS. This would also allow to consider variables as the thermal inertia of the buildings, access to local heat generation, access to local heat storage, CHP plants, among others, thus integrating this optimization with the electricity sector and further advancing into the realm of the Smart City.

All in all, the results from the present research are an enticing indication of what the future of DH could look like. A future where the energy sectors and their various actors are better integrated and all of them cooperate to achieve a better, greener, more sustainable future.

Afterword

This novel model of system management relies heavily on access to reliable information on the network, a communication infrastructure, and control devices to execute the necessary adjustments to the operation of the system. The access of information required comes in two levels: historical information and real-time information. Historical information, or long-term information which could be in the form of time series and databases, is needed to evaluate the systems as well as for forecasting the required generation and the expected demand. Historic consumption can be used to determine the yearly, seasonal, and even weekly demands. The demand profiles for longer extents of time do not need to be very precise and could be used in daily averages or weekly profiles. This information can aid the design of new networks, the expansion or refurbishment of existing ones, and prepare the system operators for an expected level of generation. This information however cannot give the exact amount of heat that will be consumed or that needs to be generated at each period of operation.

To plan for generation and supply during a day of operation, the expected demand from the less precise yearly, seasonal, monthly, or weekly forecast can be updated with information from the previous hours.

If data on demand, ambient temperature and QoS is available, it becomes easier to determine the generation needed for the next period of operation. If this information is combined with Artificial Intelligence, it can forecast the next few hours of demand and increase even further the efficacy and efficiency of the generation plan for the next hour.

Real-time information can be used, not to plan, but to react to unforeseen circumstances. A drop or surge in the demand, interruptions in the network, loss of QoS, etc. have negative effects on the efficiency of the system and the comfort of the consumers. While historic information can be collected and stored two to four times per hour, real time information needs to be collected and shared more often than that, like every one or two minutes. This creates data bases that are too big for permanent storage and older data is frequently erased to make space for the more recent data. This information, however, can be used together with the Artificial Intelligence forecast to increase the precision of the prediction and allow the system to better manage its assets.

To enable a DH system to handle the volume of information required for its operation within the Smart City scope, a solid communications infrastructure is needed. Monitoring equipment needs to be placed at the primary and secondary side substations and metering equipment at the final consumers. For historic data, measurements on mass flow rate and flow temperature need to be made, as well as on ambient temperature, time and date. This information needs to be stored, probably locally at first, and then sent to a centralized data center for processing, cleaning, and permanent storage. The frequency at which the information needs to be collected and sent varies from network to network, but a collection rate of two to four times per hour with the data being sent once every hour is enough for an operating strategy as the one in the present research.

For real-time data, the rate of collection and sharing of information is faster. As the information is put into service of the system in a more immediate manner, centralized data centers for processing and cleaning are not a viable solution. The system will often work with unclean data and, to prevent congestion of the communication channels, not all the system will have access to all the information.

Because real-time information is only relevant if a correction needs to be made, nodes could refrain from sharing their data unless it is needed. This would give way for a distributed system of data collection and sharing, with nodes communicating only with those closest to them and only when needed.

The amount, type and collection rate of the information required for operation under the Smart City concept calls for a robust communication infrastructure. This infrastructure would be constituted by different technologies each with specific objectives and tasks. The speed at which ICTs continue to evolve and develop make it impractical to name the specific technologies that could be use, as they may change in less than a year, but their expected functionality can be defined. Metering equipment needs to be installed at consumer level, giving information to the consumer and to the District Heating Operator (DHO) about their consumption. If the consumer agrees, indoor temperature and comfort could also be monitored and coupled with a flexibility program (like the Demand Response used in the present research), improving the decision-making capabilities of the building administrator or the DHO. If a drop of comfort or a surge of consumption are perceived, the information could be shared in real time with the building manager, secondary substation, and/or primary substation for quick decision making and network re-balance. If Smart Metering is not available and the DHO has access to building data only, the building substation could still be used a source of flexibility for the system. Though in this case all customers in the building would suffer a curtailment of service rather than just individual ones.

Monitoring equipment would also need to be installed at the primary and secondary substations. The communications infrastructure at these substations would need to play two different roles. On the one hand, data on mass flow rate and temperature would be collected and shared with the DHO and/or the data giving the basis for the operation and control of the generation plants. In this way the ICTs act in a vertical, centralized manner giving as a result an hourly plan for the network and updated information on the long-term profiles of the system. On the other hand, this infrastructure should also be capable of communicating real-time in a more horizontal, distributed manner. In this way the system would be able

Figure 1 - 1 : 6 Figure 3 - 1 : 28 Figure 3 - 2 : 29 Figure 3 - 3 : 30 Figure 3 - 4 : 32 Figure 3 - 5 : 33 Figure 3 - 6 : 35 Figure 3 - 7 : 37 Figure 3 - 8 : 42 Figure 3 - 9 : 47 Figure 4 - 1 : 56 Figure 4 - 2 : 58 Figure 4 - 3 : 59 Figure 4 - 4 : 60 Figure 4 - 5 : 61 Figure 4 - 6 : 62 Figure 4 - 7 : 63 Figure 4 - 8 : 65 Figure 4 - 9 :Figure 4 - 10 : 66 Figure 4 - 11 : 68 Figure 4 - 12 : 69 Figure 4 - 13 : 71 Figure 5 - 1 : 75 Figure 5 - 2 : 77 Figure 5 - 3 : 84 Figure 5 - 4 : 87 Figure 5 - 5 : 90 Figure 5 - 6 :Figure 5 - 7 :Figure 5 - 8 :Figure 5 - 9 :Figure 5 - 10 :Figure 5 - 11 :Figure 5 - 12 :Figure 5 - 13 :

 1163128322933303432353336353737384239474156425843594460456146624763486549410664116841269413715175527753845487559056575859510511512513 Figure 1-1: Main Objective, Research Questions and Specific Objectives. ............................. 6

Figure 6 - 1 :Figure 6 - 2 :Figure 6 - 3 :Figure 6 - 4 :Figure 6 - 5 :Figure 6 - 6 :Figure 7 - 1 :Figure 7 - 2 :Figure 7 - 3 :Figure 7 - 4 :Figure 7 - 5 :Figure 7 - 6 :

 616263646566717273747576 Figure 6-1: Energy generation, energy efficiency, cost of generation, revenue and profit from supply, and source of the difference from revenue and profit for each optimization strategy. ........................................................................................... 119

1 :Table 4 - 2 :Table 5 - 1 :Table 5 - 2 :Table 5 - 3 :Table 6 - 1 :Table 7 - 1 :

 1425152536171 Characteristics of the pipes in the network. ............................................................ Max Absolute and Relative Errors for different CFLs using FVN and the Dynamic Model. ...................................................................................................... Pipe characteristics. ..................................................................................................... Fuel price for the 3 heat plants. ................................................................................ Simulation and optimization characteristics of each strategy. .............................. SAIFI, SAIDI and CAIDI for each strategy. ........................................................ QoS indicators for Oft-base and DOft 7. .............................................................

à

  chaque sous station, l'inertie thermique du réseau, l'énergie stockée dans les conduites, et sur la distribution en temps réel des températures dans les tuyaux. Pour aborder la dynamique du réseau, ce travail propose l'utilisation d'un nouvel indicateur de fonctionnement appelé Facteur de Charge des Conduites (PSF en anglais pour Pipe Supply Factor). Le PSF donne le rapport entre l'énergie entrant dans une conduite et l'énergie qui en ressort. Le modèle dynamique et le PSF doivent ainsi permettre à l'opérateur du réseau de chaleur (DHO) de connaître l'état de charge et de décharge des conduites du réseau et d'utiliser ces informations pour mieux ajuster la production et la distribution d'énergie, réduisant ainsi les surplus et les déficits subis par le réseau et améliorant la Qualité de Service (QoS) ainsi que l'efficacité énergétique du système.

  Les travaux présentés ici proposent également une stratégie d'évaluation des réseaux DH d'une manière holistique. Actuellement, les études portant sur l'optimisation de ces systèmes, ciblent principalement l'optimisation de son efficacité énergétique ou de sa performance économique. Les études axées sur la qualité de service (QoS) sont peu nombreuses et souvent traitées du point de vue de l'utilisateur final uniquement. Est proposé ici un cadre d'évaluation basé sur des indicateurs énergétiques et économiques existants, comme l'efficacité énergétique et le coût de fonctionnement par MWh de demande, mais aussi des indicateurs de qualité de service inspirés de ce qui existe pour les réseaux électriques (non encore xxvi appliqués aux réseaux de chaleur). Ces indicateurs sont le System Average Interruption Frequency Index (SAIFI), le System Average Interruption Duration Index (SAIDI) et le Costumer Average Interruption Duration Index (CAIDI). Les SAIFI, SAIDI et CAIDI donnent des informations précieuses sur le fonctionnement du réseau DH qui permettent à l'opérateur (DHO) d'évaluer l'efficacité du système et d'ajuster la distribution d'énergie d'un point de vue plus systémique. Afin d'analyser la solution DOTS, les travaux présentent les résultats obtenus à partir de trois tests développés pour démontrer la fiabilité et les capacités du modèle dynamique et les effets de huit stratégies d'optimisation différentes réalisées avec DOft. Les huit stratégies d'optimisation sont évaluées en analysant l'impact des solutions proposées d'un point de vue énergétique, économique et de qualité de service. Les trois tests du modèle dynamique sont:

xxvii 4 . 5 . 6 . 7 . 8 .

 45678 DOft 3 : stratégie prenant en compte l'optimisation de la température de production, la dynamique de fonctionnement (retard, inertie et stockage à court terme dans les canalisations), et des coefficients de déperdition thermique moyens variables pour les canalisations du réseau. La période d'optimisation est étendue à trois heures pour garantir la convergence et chaque période est optimisée indépendamment des autres. DOft 4 : stratégie prenant en compte une optimisation de la température de génération sous contrainte (pas plus de ± 5 ° C d'écart entre les périodes d'optimisation), la dynamique de l'exploitation et des coefficients de déperdition thermique moyens variables pour les canalisations du réseau. La contrainte de température représente les systèmes qui donnent la priorité au contrôle du débit massique ou les systèmes dont les centrales de production ne peuvent pas avoir de variations rapides de leur température de fonctionnement. La période d'optimisation est étendue à trois heures et chaque période est optimisée indépendamment des autres. DOft 5 : stratégie prenant en compte une optimisation de la température de génération contrainte (pas plus de ± 10 °C d'écart entre les périodes d'optimisation), la dynamique de l'exploitation et des coefficients de déperdition thermique moyens variables pour les canalisations du réseau. La période d'optimisation est étendue à trois heures et chaque période est optimisée indépendamment des autres. DOft 6 : stratégie tenant compte de l'optimisation de la température de production, de la dynamique de fonctionnement et des coefficients de déperdition calorifique moyens variables des canalisations du réseau. L'optimisation est changée en une optimisation d'horizon, où l'horizon a une durée de trois heures et contient une fenêtre glissante d'une heure. Dans l'horizon, chaque pas de temps d'une heure est optimisé mais l'optimum est trouvé pour l'horizon, pas pour les pas de temps indépendants. Une fois qu'une solution est trouvée, l'horizon avance d'une heure et l'optimisation est répétée. De cette manière, toutes les optimisations sont connectées aux optimisations précédentes et suivantes. Cette optimisation est ici nommée optimisation d'horizon. DOft 7 : stratégie tenant compte de l'optimisation de la température de production, de la dynamique de l'exploitation, des coefficients de déperdition thermique moyens variables des canalisations du réseau et des capacités de réponse à la demande (DR) des sous stations. L'optimisation est changée en une optimisation d'horizon. xxviii L'horizon est fixé à trois heures avec une fenêtre glissante d'une heure, ainsi toutes les optimisations sont liées aux optimisations précédentes et suivantes. Les résultats des trois tests du modèle dynamique montrent que, par rapport à la méthode Node Volumes Finis, il ajoute de la robustesse aux résultats lorsque l'on travaille avec une discrétisation spatiale fixe des tuyaux et il réduit également les temps de calcul tout en maintenant la précision. Les résultats ont également montré que même lorsque la température et les débits massiques au niveau des centrales de production sont connus, le nombre de variables et de phénomènes physiques rend difficile la connaissance de l'état du réseau en temps réel. Le modèle proposé montre sa pertinence, d'autant que, comme évoqué précédemment, de nombreux réseaux DH ont un monitoring limité focalisant principalement sur les centrales de production. Le modèle dynamique a également permis d'étudier les effets que le retard, les pertes et l'inertie thermique ont sur l'alimentation en énergie d'un système en dehors du régime permanent. Il quantifie le délai entre la génération et la fourniture de la chaleur au niveau des sous stations, mais prend en compte également le phénomène capacitif de tout tronçon de conduite du réseau, du fait de cette inertie. En effet, pour un tronçon de conduite donné, celle-ci affecte le profil de la sortie par rapport à son entrée, prolonge le retard et augmente ou diminue les pertes en fonction du sens de changement de température. Ces effets combinés sont généralement considérés comme un défi dans la gestion des réseaux de chaleur, mais peuvent être utilisés à l'avantage du système avec un contrôle approprié. Ces résultats justifient donc l'utilisation du modèle dynamique en combinaison avec des outils d'optimisation pour proposer et évaluer différents modes de fonctionnement des réseaux DH qui permettraient la transition de ce type de systèmes vers des réseaux thermiques intelligents.

  still small amount of literature on the transition of DH into STN, the main objective of the present research is to propose a novel model for system management of DH by combining modeling, simulation, and optimization tools. This with the aim of demonstrating the possibility of DH systems to transition into STN by considering the distribution dynamics of the system and the active participation of the connected consumers. The results from this research show the capabilities of DH to become an integral part of the Smart City model. The present research takes the electricity smart grid as the starting point to propose the smart thermal network and addresses the differences existing between heat and electricity distribution systems. These differences arise from the dynamics involved in heat distribution, contrary to electricity grids, a variation done on the generation side of a DH network needs time before it is perceived by all the consumers of a network and time is needed before a previous status is dissipated and a new one instated. Taking these differences into consideration, the present research proposes a new model of system management named the Dynamic Optimization of DH for its Transition towards Smart Thermal Networks (DOTS). DOTS is constituted by three parts: the dynamic modeling of DH networks, the optimization of DH systems, and the evaluation of DH systems. The modeling approach is based on the physical modeling of DH networks using Oriented Graphs and a modified Finite Volumes method. The optimization is divided into two steps: The dispatch optimization and the generation temperature optimization. Dispatch is optimized through the cost of generation and the optimization of generation temperatures is optimized through the minimization of the total generation, the demand not satisfied (deficit) and the excess heat (surplus). The evaluation of DH is done through energy, economic and QoS indicators. The simulation model, named the Dynamic Model as it is capable of simulating the dynamics in the network, gives information on the delay between generation and supply, the heat inertia of the network, the energy stored in the connective elements of the system (pipes), and the real-time distribution of temperatures in the pipes. To address the dynamics in the network, the present research proposes the use of a new operation indicator named the Pipe Supply Factor (PSF). The PSF gives the ratio between the energy entering a pipe and the energy exiting the pipe. The Dynamic Model and the PSF allow the District Heating xxxiii

(

  QoS) are few and often are from the point of view of the end-user only. The present research proposes an evaluation framework based on existing energy and economic indicators, like energy efficiency and cost of operation per MWh of demand, but also QoS indicators that exist for electricity grids but that are not yet applied to DH networks. These last indicators are the System Average Interruption Frequency Index (SAIFI), the System Average Interruption Duration Index (SAIDI), and the Costumer Average Interruption Duration Index (CAIDI). The SAIFI, SAIDI and CAIDI give valuable information on the operation of a DH system that allow the District Heating Operator (DHO) to evaluate the effectiveness of the system's supply and adjust the distribution of energy from a systemic point of view rather than a case by case scenario. To showcase the potential of DOTS, the present research presents the results obtained from three tests developed to demonstrate the reliability and capabilities of the Dynamic Model and the effects of eight different optimization strategies performed with DOft. The results from the eight optimization strategies are evaluated using the evaluation framework proposed in the present research to assess the magnitude of the impact each of them have on the distribution of heat from an energy, economic and QoS perspective. The three tests for the Dynamic Model are:

  output's profile compared to its input, extends the delay, and increases or decreases the losses depending on the direction of the temperature change. These effects together are usually considered a challenge in DH but may be used to the advantage of the system with proper control. These results justify the use of the Dynamic Model in combination with optimization tools to propose and evaluate different modes of operation of DH networks that would allow the transition of this kind of systems into Smart Thermal Networks.For the DOft optimization, the results show that considering the dynamics of the system can substantially reduce the surplus and deficits in the network, thus reducing the total xxxvi generation and its associated costs. DOft 6 reduced the deficit by 37,76% and the surplus by 95,99% compared to the base case (Oft-base), and DOft 7 reduced the deficit by 84,37% and the surplus by 97,71% compared to Oft-base. Nevertheless, the results show that the use of the PSF can lead to negative results if the influence that one time step has on the next is not considered, or if the right constraints are not applied. DOft 3, which use the PSF without any constraints and optimized each time step independently, increased the deficit by 208,38% compared to Oft-base. DOft 5, which also optimized each time step independently and which had a constraint that allowed more flexibility between time steps, increased the deficit by 303,50% compared to Oft-base. The results showed that the PSF is an appropriate indicator to keep track and make use of the energy inside the distribution pipes, but that the effects of the delay and the inertia are not limited to individual time steps and will influence future optimization time steps. This could cause individual optimum which do not guaranty the global optimum. Due to the independent treatment of the time steps, their accumulation can even cause a worst global solution like seen on DOft 3. To avoid this situation, the latest optimization strategies of DOft change to a horizon optimization with a sliding window (DOft 6 and DOft 7). In this way, the optimization of every time step is tied to the results of the previous optimization time steps. The results obtained from two of the optimization strategies (Oft-base and DOft 7) are used to showcase the capabilities of the Dynamic Model to provide the information needed to map the spatial and temporal distribution of temperatures and heat flows in the network. This information is used to better understand the effects of the dynamics in the surplus and deficit of the system and to focus the changes made by the DOft 7 optimization strategy. These results highlight the ability of the PSF of the individual pipes to act as indicators of the heat flows in the network, and the ability of the global PSF to be a systemic indicator for the evaluation of the network operation. For the evaluation of DOft, the results show that the implementation of the PSF together with the horizon optimization (DOft 6 and DOft 7) have lower generation, higher efficiency, lower generation costs, and higher revenue and profit. DOft 6 increases efficiency by 7,72%, increases revenue by 0,16 €/MWh-demand and increases profit by 3,63 €/MWh-demand compared to Oft-base; and DOft 7 increases efficiency by 4,95%, increases revenue by 0,33 €/MWh-demand and increases profit by 2,59 €/MWh-demand compared to Oft-base.Moreover, the results show that the QoS is positively impacted, with the interruptions of the service being shorter and of lower magnitude. This is especially the case for DOft 7, which also includes a flexibility measure in the form of Demand Response. Having DR in the xxxvii network allowed for easier network re-balance and faster interruption corrections without jeopardizing the QoS. DOft 7 has a SAIFI 0,027 lower than Oft-base, a SAIDI 0,080 lower, and a CAIDI 3,66 lower.

1 Introduction

 1 of the heat plants to prepare the network to cope with them, either by increasing generation to "charge up" the pipes with extra energy or by reducing generation and use the heat already in the pipes. To react in real-time to the intra-hour variations of the demand, DOft 7 uses DR to limit the supply in the nodes closer to the generation plants and divert the energy to the nodes farther away. This strategy reduces the operation costs, increases efficiency, and proposes a new mode of QoS management, where interruptions are considered acceptable if they are short and do not affect the same costumer several times in a row. These results point at the possibility of the transition of DH into the Smart Thermal Network and its capabilities of becoming an integral part of the Smart City model. . xxxviii The increasing use of Renewable Energy Sources, Distributed Generation, Low Energy Buildings, Multi-Energy Carriers, Integrated Energy Systems, Distributed Storage and the possibility of developing Low-Temperature District Heating, among others, is demanding a change in the way energy networks are conceived and operated inside an urban environment. Just as people are studying technologies to better harness the power of RES, many others are studying how our understanding of energy use and its conversion processes should change. With the global population migrating to urban environments, a new model has arisen within the global context of the Smart City [12].

  on the transition of DH into Smart Thermal Networks, the main objective of the present research is to propose a novel model for system management of District Heating by combining Modeling, Simulation, and Optimization tools. This with the aim of demonstrating the possibility of DH systems to transition into STN by considering the distribution dynamics of the system and the active participation of the connected consumers. The results from this research show the capabilities of DH to become an integral part of the Smart City model.

SO 1 :

 1 Development of a simulation model for DH systems based on the physical characteristics of the network thatconsiders the dynamics of the system.

SO 3 :

 3 Development of the framework needed to evaluate the operation and performance of DH systems within the Smart City Scope. The present research identified a vacuum regarding evaluation frameworks for the assessment of DH systems performance in a holistic manner. For this reason, a novel evaluation framework based on indicators used in electricity grids and adapted to heat distribution networks is developed and proposed in the present research.

Figure 1 - 1 :

 11 Figure 1-1: Main Objective, Research Questions and Specific Objectives.

From

  the literature review, the present research proposes that these three indicators used in electricity grids, the SAIFI, the SAIDI and the CAIDI, can be translated into DH indicators to formulate a comprehensive, holistic evaluation framework for DH. Instead of the AENS, ENS and EENS, the present research uses as indicators the Deficit and the Surplus of the network, as well as a new indicator here presented called the Pipe Supply Factor. The definition for these last three indicators is presented in Chapter 3.

3 Methodology

 3 management of District Heating by combining Modeling, Simulation, and Optimization tools, to develop a comprehensive simulation and optimization tool named the Dynamic Optimization of DH for its Transition to Smart Thermal Networks (DOTS). The results from DOTS become a proof of concept that demonstrates the possibility of DH systems to transition into Smart Thermal Networks and their capabilities of integration into the Smart City model. To demonstrate that it is possible to upgrade DH systems management within the scope of the Smart City, the objective of this work is to propose a model of control and operation of District Heating by combining Modeling, Simulation, and Optimization tools. The proposed model, named the Dynamic Optimization of DH for its Transition to Smart Thermal Networks (DOTS), is constituted by three parts: the modeling of DH systems, the optimization of DH systems, and the evaluation of DH systems. As a

Figure 3 - 1 .

 31 As shown in this figure, the core of the proposed methodology is the Dynamic Model for the simulation of DH networks (yellow). This model gives the spatial-temporal distribution of temperature within time step 𝑖 of duration ∆𝑡 𝐷𝑦𝑚 , which combined with the mass flow rates gives the spatial-temporal distribution of powers. This information is what allows the present research to know the delay, inertia, real losses, and real supply, hence allowing for their optimization and evaluation. The two optimization tools are used together to determine the temperatures, mass flow rates and generation powers within time step 𝑡 of duration ∆𝑡 𝑜𝑝 that would better supply the demand, at the lowest cost and with minimal waste (∆𝑡 𝐷𝑦𝑚 < ∆𝑡 𝑜𝑝 ). HeatGrid optimizes dispatch by minimizing generation costs (green) and NOMAD optimizes generation temperatures by minimizing overall generation, deficit and surplus (purple). DOft is capable of being used without the temperature optimization and is named Oft instead. The results obtained with DOft (or Oft) are evaluated through energy, economic and QoS indicators to assess their effectiveness, not only technical, but economical and qualitative too (blue).

  Oriented graphs transform the nodes and vertices topology into mathematical form by converting them into an adjacency matrix with 𝑛 nodes and 𝑚 branches. If two nodes are connected, this is denoted in the adjacency matrix with the number 1 or -1 (see Figure 3-2 bottom), if the nodes are not connected, then the intersection of line 𝑛 with column 𝑚 is zero. The direction of the flow between two nodes is indicated by the sign, 1 if the flow exits the node and -1 if the flow enters the node. An example of an oriented graph with eight nodes and nine pipes, together with its adjacency matrix, is shown in Figure 3-2.

Figure 3 - 3 .

 33 In this figure, 𝑇 indicates temperature, 𝑚̇ mass flow rate, 𝐷 demand and 𝜂 heat exchanger efficiency. Subindex 𝑠 indicates the supply side and 𝑟 the return side of the network. Subindices 𝑖𝑛 and 𝑜𝑢𝑡 indicate input or output, respectively. The numerical subindex indicates the node the variable refers to.In this example two nodes are analyzed. Node 1 and Node 2 are consumption nodes, but Node 2 is an end of the line node, which means that any mass flow not consumed by the substation is injected directly into the return line. The resulting supply temperatures and mass flow rates from Node 1 are fed into the supply Pipe 1-2 towards Node 2. Because Node 2 is at the end of the line, its results are fed to the return Pipe 2-1, which in turn are fed into the return side of Node 1. This process is repeated for any number of nodes, always starting from the first upstream nodes to the end of the lines for the supply line and from the last downstream nodes to the first upstream nodes for the return line. In addition, it considers the existence of junctions and splits and calculates the respective heat and mass flows of each branch using the energy conservation and mass conservation equations for each node and pipe. The temperatures and mass flow rates are calculated for every time step 𝑖.

Figure 3 - 3 :

 33 Figure 3-3: Diagram of the Dynamic Model in graphic form (left) and descriptive form (right).

3- 3 .Equation 3 - 3 :

 333 Heat balance inside a pipe element. 𝑄 𝑖𝑛 𝑗 𝑖 -𝑄 𝑜𝑢𝑡 𝑗 𝑖 -𝑄 𝑙𝑜𝑠𝑠 𝑗 𝑖 = ∆𝑄 𝑣𝑜𝑙 𝑗 𝑖 To illustrate the flows, the diagram of the heat flows for the water is shown in Figure 3-4 and the diagram for the heat flows inside a pipe wall is shown in Figure 3-5. In these figures 𝑇 denotes temperatures; 𝑚̇ denotes the mass flow rate of the water; and 𝑄 denotes the heat flows.

Figure 3 - 4 :

 34 Figure 3-4: Heat balance for the water inside element j of a pipe. Red arrows indicate the heat flows and blue arrow

Figure 3 - 5 :

 35 Figure 3-5: Heat balance for element j of the pipe. Red arrows indicate the heat flows and blue arrow indicates the mass flow.The dots indicate the average temperature of the element. Sub-index "w" stands for water, "st" for the pipe, "ins" for the insulation, "gro" for the ground, and "a" for ambient. Sub-index "j" indicates element in the spatial discretization and super-index "i" indicates moment in the temporal discretization.

Figure 3 - 4 andEquation 3 - 4 :

 3434 Figure 3-5, the balance in Equation 3-3 can be expressed using the two variables for the system: the mass flow rate (𝑚̇) and the temperature of the water (𝑇 𝑤 ). In explicit form, these can be seen in Equation 3-4 for each of the heat flows. Balance equations for the water inside a pipe element in explicit form. 𝑄 𝑖𝑛 𝑗 𝑖 = 𝑚̇𝑖𝐶𝑝 𝑤 𝑇 𝑤 𝑗-1 𝑖-1 ∆𝑡 𝐷𝑦𝑚 𝑄 𝑜𝑢𝑡 𝑗 𝑖 = 𝑚̇𝑖𝐶𝑝 𝑤 𝑇 𝑤 𝑗 𝑖-1 ∆𝑡 𝐷𝑦𝑚 𝑄 𝑙𝑜𝑠𝑠 𝑗 𝑖 = (𝑇 𝑤 𝑗 𝑖 -𝑇 𝑠𝑡 𝑗 𝑖 ) 𝑅 𝑤-𝑠𝑡 𝑗 𝑖 ∆𝑡 𝐷𝑦𝑚 ∆𝑄 𝑣𝑜𝑙 𝑗 𝑖 = 𝜌 𝑤 𝐶𝑝 𝑤 𝑉 𝑤 (𝑇 𝑤 𝑗 𝑖 -𝑇 𝑤 𝑗 𝑖-1 )

Figure 3 - 5 Figure 3 - 6 :

 3536 Figure 3-6: Thermal Circuit for an insulated pipe considering only one capacitance. The resistors indicate a thermal resistance and the capacitor a thermal capacitance. The dots indicate the average temperature of the elements. The base line indicates the reference temperature of the circuit. In Figure 3-6, 𝑇 𝑖𝑛𝑠 𝑗 𝑖

Figure 3 - 7 :

 37 Figure 3-7: Representation of a node and its flows in a DH system. Red arrow represents the supply side and the yellow arrow the return side. Sub-index "gen" denotes local generation and sub-index "sub" denotes the local substation. Generation and substation are represented by heat exchangers.

Equation 3 - 9 :)Equation 3 - 10 :

 39310 Average Heat Loss Coefficient.𝐴𝑣𝑒𝑟𝑎𝑔𝑒 𝐻𝑒𝑎𝑡 𝐿𝑜𝑠𝑠 𝐶𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡 = 𝑄𝑙𝑜𝑠𝑠 𝑇 𝑤 -𝑇 𝑎The temperature at which the generation plants of the DH system operate are calculated by HeatGrid using the function presented in Equation 3-10. In this equation, 𝑇 𝑠 𝑚𝑖𝑛 is the minimum allowed supply temperature, 𝑇 𝑠 𝑚𝑎𝑥 is the maximum allowed supply temperature, ∑ 𝐷 𝑘 𝑡 𝑘 is the total demand at time step is the maximum total demand during the whole simulated period, and 𝐻 is the global heat loss coefficient of the network, which is assumed known and constant by HeatGrid. Operation temperature calculation by HeatGrid.𝑇 𝑠 𝑡 = 𝑇 𝑠 𝑚𝑖𝑛 + (𝑇 𝑠 𝑚𝑎𝑥 -𝑇 𝑠 𝑚𝑖𝑛 )At every time step HeatGrid aims to determine two unknown variables: the heat flows transferred in each branch and the power production at each heat source. To find the values of these variables HeatGrid minimizes the objective function 𝑓 that describes the heat production cost of the whole network for every time step (Equation 3-11

Figure 3 - 8 :

 38 Figure 3-8: Diagram of the integration of HeatGrid with the Dynamic Model (Oft).

Equation 3 - 13 :Equation 3 - 14 :Equation 3 - 15 :

 313314315 The objective function for DOft is the minimization of the total energy generated plus the energy surplus that goes to waste, without incurring in a loss of QoS. Thus, NOMAD will propose the operating temperature at the generation nodes to minimize the losses and the effects of the inertia and the delay, and HeatGrid will propose the heat plant usage that complies with those values in order to reduce the network generation costs. The objective function proposed for DOft is presented in detail in Equation 3-13. This equation is based on the energy generated during a time step and the deficit and surplus occurring during this time step. Objective function of DOft. referring to the heat generation and 𝑆𝑛𝐷 𝑡 is a function of the surplus and the deficit. The first is defined in Equation 3-14 and the second in Equation 3-15. Energy generation. 𝑄 𝑔𝑒𝑛 𝑡 = ∑ 𝑚̇𝑘 𝑖 𝐶𝑝(𝑇 𝑘 𝑖 -𝑇 𝑟𝑘 𝑖 ) 𝑖,𝑘 Deficit and Surplus. Equation 3-14 indicates that the total heat generated within the optimization time step 𝑡 is calculated by adding the power generated at every node 𝑘 at each Dynamic Model time step 𝑖.The individual heat of each node is calculated by the product of their mass flow rate 𝑚̇𝑘 𝑖 , the heat capacitance of the water 𝐶𝑝, and the temperature difference between the supply temperature 𝑇 𝑘 𝑖 and the return temperature 𝑇 𝑟𝑘 𝑖 . This equation is only applied if the node has heat generation.𝑆𝑛𝐷 𝑡 is a function of the surplus and deficits in the network. It is calculated by adding all surplus in all nodes and all deficits in all nodes at every time step 𝑖. The terms 𝑐𝑡𝑒 𝑠𝑢𝑟 and 𝑐𝑡𝑒 𝑑𝑒𝑓 are scaling factors that can be changed to give more weight to one term or the other. In the present research both are equal to one.In Equation 3-13 it can be seen that the term 𝑆𝑛𝐷 𝑡 is part of an exponential function. This was done to use a single objective instead of a multi-objective optimization. The term 𝑒𝑥𝑝 ( penalize the value of 𝑓 Ω if the surplus and deficit function 𝑆𝑛𝐷 𝑡 is large compared to the demand at the evaluated time step (𝑄 𝐷 𝑡 ). To indicate that the largest accepted value of 𝑆𝑛𝐷 𝑡 is 2% of the demand, it is multiplied by 50.

Figure 3 - 9 :

 39 Figure 3-9: Diagram of integration of NOMAD, HeatGrid and the Dynamic Model (DOft).

presented in Chapter 3 ,

 3 the Dynamic Model combined with DOft and the new evaluation framework is named DOTS (Dynamic Optimization of DH for its Transition to Smart Thermal Networks). The proposed evaluation framework is based on existing indicators of DH, as well as indicators that are not found in the literature to evaluate DH networks but are common in the evaluation of other networks like electricity grids. These indicators are: 1) energy indicators in the form of total energy generation and energy efficiency of the system, 2) economic indicators in the form of the generation costs per unit of demand, revenue per unit of demand and profit per unit of demand, and 3) QoS indicators in the form of the SAIFI, SAIDI and the CAIDI.

Equation 3 - 17 :

 317 O&M and future investments. The equations for calculating generation costs, revenue and profit in the present research are shown in Equation 3-17. Generation cost, revenue and profit. 𝐶𝑜𝑠𝑡 𝑔𝑒𝑛 = ∑ 𝑄 𝑔𝑒𝑛 𝑘 (𝑘𝑊ℎ) * 𝑓𝑢𝑒𝑙 𝑐𝑜𝑠𝑡 𝑘 (

19 and Equation 3 - 20 .Equation 3 - 18 : 3 - 19 :Equation 3 - 20 :

 19320318319320 Three indicators exist in electricity to evaluate the QoS of the grid: the System Average Interruption Frequency Index (SAIFI), the System Average Interruption Duration Index (SAIDI), and the Costumer Average Interruption Duration Index (CAIDI)[START_REF] Arya | Reliability evaluation and enhancement of distribution systems in the presence of distributed generation based on standby mode[END_REF]. Each of them shows a different perspective of the quality of the service provided by an energy network. The three indicators are based on the number of customers being served by one substation (𝑁 𝑘 ), the failure rate of a substation (𝜆 𝑘 ), the average duration of an interruption (𝑈 𝑘 ), and the average time required to regain service (𝑟 𝑘 ). The sub-index 𝑘 indicates each individual substation. The definition of 𝜆 𝑘 , 𝑟 𝑘 , and 𝑈 𝑘 is shown in Equation 3-18, Equation 3-Failure rate. 𝜆 𝑘 = 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑖𝑛𝑡𝑒𝑟𝑟𝑢𝑝𝑡𝑖𝑜𝑛𝑠 𝑡𝑜𝑡𝑎𝑙 𝑡𝑖𝑚𝑒 𝑜𝑓 𝑜𝑝𝑒𝑟𝑎𝑡𝑖𝑜𝑛 Equation Repair rate. 𝑟 𝑘 = ∑ 𝑑𝑢𝑟𝑎𝑡𝑖𝑜𝑛 𝑜𝑓 𝑒𝑎𝑐ℎ 𝑖𝑛𝑡𝑒𝑟𝑟𝑢𝑝𝑡𝑖𝑜𝑛 𝑡𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑖𝑛𝑡𝑒𝑟𝑟𝑢𝑝𝑡𝑖𝑜𝑛𝑠 Average duration of interruption per customer.𝑈 𝑘 = 𝜆 𝑘 • 𝑟 𝑘The first indicator used, the SAIFI, is an indicator of the likely number of interruptions that a customer would perceive during the operation time. The numerical value of this indicator tells the likely number of interruptions that each consumer would experience in the period of evaluation, i.e. the average SAIFI for the electricity sector in Europe during the first half of the past decade was of ~2 interruptions per customer per year[START_REF]6TH CEER BENCHMARKING REPORT ON THE QUALITY OF ELECTRICITY AND GAS SUPPLY[END_REF]. The SAIFI is defined by Equation 3𝑝𝑒𝑟 𝑒𝑣𝑎𝑙𝑢𝑎𝑡𝑖𝑜𝑛 𝑝𝑒𝑟𝑖𝑜𝑑)The second indicator, the SAIDI, is an indicator of the average duration of the interruptions per customers. Its numerical value indicates the average time (usually hours) that the system experienced an interruption, , i.e. the average SAIDI for the electricity sector in Europe during the first half of the past decade was of ~240 minutes per customer per year[START_REF]6TH CEER BENCHMARKING REPORT ON THE QUALITY OF ELECTRICITY AND GAS SUPPLY[END_REF]. It is defined by Equation 3𝑝𝑒𝑟 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟 𝑝𝑒𝑟 𝑒𝑣𝑎𝑙𝑢𝑎𝑡𝑖𝑜𝑛 𝑝𝑒𝑟𝑖𝑜𝑑)

  Two important considerations are made in this study. The first is the definition of interruption in DH.

Figure 4 - 1 :

 41 Figure 4-1: Network topology used. The network is composed of two generation nodes (Node 1 and Node 2) and 4 consumer nodes (Nodes 4 -6). Node 3 is a consumer, a junction, and a split at the same time.

Figure 4 - 2

 42 also shows a two-step profile, where the temperature rises, reaches a plateau, and then rises again to the normal operation temperature. This profile is explained by the difference in length between the pipes connecting Node 1 and Node 3, and the pipes connecting Node 2 and Node 3. Pipe 1-3 is 3 km longer than pipe 2-3, so the heat front from Node 1 arrives approximately one hour after the heat front from Node 2.

Figure 4 - 2 :

 42 Figure 4-2: Available power comparison at every node in the network for the FVN method and the Dynamic Model with CFL=1. Only one set of lines is presented as there is no visible difference between the two.

Figure 4 - 3 ,Figure 4 - 4 ,Figure 4 - 5 and Figure 4 - 6 .

 43444546 Figure 4-3, Figure 4-4, Figure 4-5 and Figure 4-6. Figure 4-3 shows the results using the FVN method for the nearest node (Node 3) and Figure 4-4 shows the results using the FVN method for farthest node

Figure 4 - 3 :

 43 Figure 4-3: Power available (top) and Absolute Error (bottom) at Node 3 for five CFL values using the FVN method.

Figure 4 - 4 :

 44 Figure 4-4: Power available (top) and Absolute Error (bottom) at Node 6 for five CFL values using the FVN method.

Figure 4 - 5 and

 45 Figure 4-5 and Figure 4-6 show the results using the Dynamic Model developed in the present research.

Figure 4 - 5 :

 45 Figure 4-5: Power available (top) and Absolute Error (bottom) at Node 3 for five CFL values using the Dynamic Model.

Figure 4 - 6 :

 46 Figure 4-6: Power available (top) and Absolute Error (bottom) at Node 6 for five CFL values using the Dynamic Model.

Figure 4 - 7 :

 47 Figure 4-7: Demand of every consumer node for the evaluated period.

Figure 4 - 8

 48 shows the spatial-temporal distribution of the temperature at the different nodes (top) and the mass flow rates in the different pipes (bottom), only one line is shown for each pair of supply and return pipes as their mass flow rates are the same but flow in the opposite direction.Figure 4-9 shows the temperature difference ΔT between the supply and return sides of the network at every node and Figure 4-10 shows the KPI ratio between the energy generated and the energy demand. The top graph of Figure 4-8 shows the mass flows in each pipe during the simulated period. The bottom graph of Figure 4-8 shows the temperature at the different nodes in the network. In this figure it can be

Figure 4 - 8 :

 48 Figure 4-8: Mass flow rates for every pipe in the network (top); Spatial-Temporal distribution of the temperature in the supply network (bottom).

Figure 4 - 9 :

 49 Figure 4-9: Temperature difference between supply and return side at every Node.

Figure 4 - 10 :

 410 Figure 4-10: KPI for the two generation nodes and for the entire system.

Figure 4 - 9

 49 Figure4-9 shows the temperature difference between the supply and return lines at every node. As expected, the highest difference exists in the generation units at around 50°C and the smallest at the farthest away node at around 37°C. In the case of the generation plants, the variation of ΔT in Nodes 1 and 2 is under 2°C for most of the system's operation, but in a consumer node, like Node 4, it can be as high as 7°C. The high variation of ΔT at Node 4 can be explained by its position in the network's topology. It is at the end of a branch (no nodes downstream of it), so any excess energy it receives will be injected directly into the return line reducing the local ΔT. It is important to highlight that even though the variation of ΔT at Node 4 indicates surplus of energy being wasted in the branch 3-4, no noticeable effect can be perceived by this on Nodes 1 and 2. If a network's operation is based on monitoring the ΔT at the heat plants only, which is common in DH, inefficiencies can be hard to see. Real-time monitoring throughout the network is needed to have clear and true information on the performance of the operation strategy.

Figure 4 - 11 :

 411 Figure 4-11: Delay and Inertia for a 1000m pipe during a step input from 60°C to 90°C with a mass flow rate of 35 kg/s. All variables are referenced to the base line of water at 60°C.

Figure 4 - 11 .

 411 The change in the heat contained inside the volume of the pipe between time steps (𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑) is depicted by the green line. In this test it can be seen that during steady state operation the change has a value of zero, but in the time between the step function takes place and the time steady state is regained,

4. 2 . 2 Figure 4 -

 224 Figure 4-12 shows the curves for 𝑄 ̇𝑖𝑛, 𝑄𝑜𝑢𝑡, 𝛥𝑄 ̇𝑠𝑡𝑜𝑟𝑒𝑑 and 𝑄 ̇𝑙𝑜𝑠𝑠 for a pipe that experiences a sudden drop of temperature at its input flow, from 90°C to 60°C.

Figure 4 - 12 :

 412 Figure 4-12: Delay and Inertia for a 1000m pipe during a step input from 90°C to 60°C with a mass flow rate of 35 kg/s. All variables are referenced to the base line of water at 60°C. Similar to Figure 4-11, Figure 4-12 shows that a delay exists between the heat signals at the input and the output of the pipe. The mass flow rate is the same for this case (35 kg/s), so the delay remains at

Figure 4 - 13 :

 413 Figure 4-13: Delay and Inertia for a 1000m pipe during a sine input with a mass flow rate of 35 kg/s. All variables are referenced to the base line of water at 60°C.

Figure 5 - 1 :

 51 Figure 5-1: Network topology. The network contains three generation nodes (red) and four consumer nodes (blue). Node 3 is a consumer and a junction; Node 4 is a consumer and a split.

Figure 5 - 2 .

 52 days 21 st and 22 nd of February in the city of Nantes, France is used. The demand for this period is shown in Nodes 3, 4 and 5 represent equivalent clusters of consumers and thus share the same demand. Node 7 represents a cluster of high-demand consumers. Only the primary side of the network is studied, so the configuration of the 4 clusters of consumers is not explored. The results from this section could vary once the topology of the secondary side is also considered.

Figure 5 - 2 :

 52 Figure 5-2: Demand of the proposed network for the evaluated period. The system operates to fully supply the demand of Node 5 from Node 4 before sending energy to Node 6. In case Node 5 fully consumes the energy at the outlet of Node 4, the pipe between Node 4 and Node 6 has zero flow and all the demand from Node 7 is supplied by the back-up boiler. In case there is enough energy to supply Nodes 5 and 7 at the outlet of Node 4, the generation at Node 6 would be zero.

  PSF of each individual pipe to replace the average heat loss coefficient used by HeatGrid (the PSF is introduced in Equation 4-3, section 4.2.4). This strategy continues to use three-hour time steps and each time step is optimized independently of each other. DOft 4 and DOft 5 follow the same optimization strategy as DOft 3, with the main difference of adding a constraint to NOMAD for the generation temperature. In DOft 4 the generation temperature of time step 𝑡 is constrained to be ±5°C of the generation temperature of time step 𝑡 -1. In DOft 5 this constraint is relaxed to be ±10°C. The objective of these two optimization strategies is to assess the sensitivity of the generation temperature optimization. The time step for these two strategies continues to be of three hours and each time step is connected to the previous only through the temperature constraint. DOft 6 exchanges the temperature constraint for a sliding window optimization. The time step for HeatGrid is reduced back to 1 hour and NOMAD operates now on a 3-hour horizon with a time window sliding one hour each time step, thus concatenating all the optimization results to the previous and following optimizations. In this strategy, HeatGrid still operates under the assumption of steady state,

  surplus in the network. The results for Oft-base and the other seven optimization strategies are shown in the following sections. They are presented in figures composed of five different graphs. The first from top to bottom depicts the Generation of each heat plant for the evaluated period. The dark blue area corresponds to the waste-to-heat plant on Node 1, the light blue area to the gas plant in Node 2, the red area to the gas-fired boiler in Node 6 and the green line represents the energy demand. The second graph shows the global PSF for the whole network: the present manuscript shows the global PSF instead of the individual PSF of each pipe, as it gives a good representation of the dynamics in the network and makes the graph easier to read. The third graph shows the Temperatures at the generation nodes and the back-up. The purple line shows the generation temperatures at the waste-to-heat plant and at the gas plant, and the orange line shows the temperature at the node containing the back-up. This temperature is the combination of the generation at the back-up and the flow from the upstream nodes. The fourth graph shows the Mass Flow Rates of each pipe, represented by its unique color: Pipe 1-3 green, Pipe 2-3 purple, Pipe 3-4 light blue, Pipe 4-5 dark blue, Pipe 4-6 red, and Pipe 6-7 orange. Finally, the fifth graph the Surplus and Deficits of the system: the orange area represents the surplus and the purple area the deficit. This color scheme remains constant for all the optimization strategies. The graphs are aligned vertically through the time axis, so a point in any one graph shows the same moment as the others. The x-axis at the bottom of the figure shows the time in minutes, with every 60 minutes representing one simulation time step. In DOft 2, DOft 3, DOft 4 and DOft 5 every 180 minutes represent one simulation time step, as in these strategies the time steps were extended. The y-axis scales of each graph are kept the same for better comparison between the different optimization strategies.

Figure 5 - 3 :

 53 Figure 5-3: Generation, global PSF, Temperatures, Mass Flow Rates, total Surplus and Deficit for Oft-base.

Figure 5 - 4

 54 that reaffirm what was seen in Oft-base. Between the 60 th and 120 th minute there is a drop in the mass flow rate which causes the surplus to become smaller but the global PSF to rise, showing how changes in mass flow have a greater short-term effect on the network than temperature changes. Another moment of interest happens between the 240 th and the 300 th

Figure 5 - 4 :

 54 Figure 5-4: Generation, global PSF, Temperature, Mass Flow Rate, Surplus and Deficit for Oft 1.

Figure 5 - 5 :

 55 Figure 5-5: Generation, global PSF , Temperature, Mass Flow Rate, Surplus and Deficit for DOft 2.

Figure 5 - 6 :

 56 Figure 5-6: Generation, global PSF, Temperature, Mass Flow Rate, Surplus and Deficit for DOft 3.

Figure 5 - 7 :

 57 Figure 5-7: Generation, global PSF, Temperature, Mass Flow Rate, Surplus and Deficit for DOft 4.

Figure 5 - 8 :

 58 Figure 5-8: Generation, global PSF, Temperature, Mass Flow Rate, Surplus and Deficit for DOft 5.

5. 7 DOft 6 :

 76 Optimization using HeatGrid, the Dynamic Model, the real losses,

Figure 5 - 9 :

 59 Figure 5-9: Generation, global PSF, Temperature, Mass Flow Rate, Surplus and Deficit for DOft 6.

5. 8 DOft 7 :

 87 Optimization using HeatGrid, the Dynamic Model, the real losses, NOMAD, the Pipe Supply Factor, a Sliding Window and Demand Response

presented in Equation 5 - 1 ,Equation 5 - 1 :

 5151 where 0 ≤ 𝛼 𝑘 ≤ 0.05. Non-consumer nodes have a fixed 𝛼 𝑘 = 0, in Equation 5-1 the subindices 1,2,… indicate consumer node 1, consumer node 2,…, where each consumer node is numbered from the closest to the main generation plants to the farthest. The reduction in supply of 5% (0.05) is large enough to cause a loss in the QoS of the node. This is done on purpose to see the difference on losing QoS at a node close to generation and at a node far away. Alpha calculation for time step 𝑖. -1 ) ⟹ 𝛼 𝑘 > 0

Figure 5 - 10 :

 510 Figure 5-10: Generation, global PSF, Temperature, Mass Flow Rate, Surplus and Deficit for DOft 7.

Figure 5 - 11 :

 511 Figure 5-11: Demand Response factor (Alpha).

2 .

 2 figure shows the PSF for every pipe. From this graph something interesting can readily be observed. The global PSF has in general a larger period than the individual PSF of each pipe. Looking at the time between the 540 th and 1020 th minutes, in Figure 5-3 the global PSF rises, reaches a maximum, and then starts to fall. During this time, in Figure 5-12 the individual PSFs follow a similar pattern but at different moments in time and with a shorter duration. The PSF of Pipes 1-3 and 2-3 starts to rise at the 480 thminute, reaches its maximum at the 600 th minute, after which it starts to fall until it settles around the 780 th minute. This same behavior is seen in Pipe 3-4, starting at the 540 th minute and ending at the 840 th minute; Pipe 4-5 and Pipe 4-6, starting at the 600 th minute and ending at the 1020 th minute; and Pipe 6-7, starting at the 660 th minute and ending at the 1020 th minute. These results show that the global PSF is an indicator of the heat as it advances through the network and it represents the combination of status experienced by the system during a period of time.

Figure 5 - 12 :

 512 Figure 5-12: Spatial Temporal distribution of temperature, individual and global PSF, and deficit and surplus per node for Oft-base. The second optimization strategy to be analyzed in this section is DOft 7. As in the previous strategy, the results are presented in vertically aligned graphs depicting from top to bottom the temperature distribution, the individual PSF and the individual surplus and deficit. These are shown in Figure 5-13.

Figure 5 - 13 :

 513 Figure 5-13: Spatial Temporal distribution of temperature, individual and global PSF, and deficit and surplus per node for DOft 7.

3 and DOft 5 ,

 5 it can be observed that it is the increased use of the back-up what elevates the operation costs. DOft 4 and DOft 7 have the generation costs closest to the Perfect Supply with only a small difference caused by the use of the back-up. The next graph in Figure 6-1 shows the Revenue and the Profit. The revenue for each strategy is indicated in the light green bar and the revenue for the Perfect Supply is indicated by the burgundy line.

Figure 6 - 1 : 6 - 2 .

 6162 Figure 6-1: Energy generation, energy efficiency, cost of generation, revenue and profit from supply, and source of the difference from revenue and profit for each optimization strategy.

Figure 6 - 2 :

 62 Figure 6-2: Number of interruptions per consumption node for each strategy.So far, Oft-base has the lowest number of interruptions and the lowest failure rate, this contrasts with the results presented in Figure5-3, where it had a large deficit compared to the rest of the strategies. An explanation to this comes by looking at the results in Figure6-4. Here it can be seen that Oft-base has the longest repair rate of an interruption in a node by a fair margin, with the longest one lasting 4.77 hours. The strategy with the second longest repair rate is Oft 1 with 2.47 hours. DOft 2 to DOft 5 have similar repair rates and the shortest rates are found with DOft 6 and DOft 7. This makes sense, as the optimizations strategies for these last two strategies aimed at linking the individual optimizations to prevent deficits at the change of an optimization time step. These results also show that the repair rates of DOft 7 are the shortest of all the strategies, but DOft 7 is also the only strategy where Node 3 has a repair rate. Interesting to see is that the repair rate of Node 3 has the second shortest duration of interruptions from all the analyzed strategies, even when DOft 7 had a comparatively large number of interruptions at this node.

Figure 6 - 3 :

 63 Figure 6-3: Failure rate per consumption node for each strategy.

Figure 6 - 4 : 6 - 3 Figure 6 - 4

 646364 Figure 6-4: Repair rate per consumption node for each strategy.Once the number of interruptions and the repair rate are calculated for every node, it is possible to calculate the average duration of interruption per customer (𝑈 𝑘 ). This is the result of the product of the failure rate and the repair rate as defined in Equation 3-20 and it is presented in Figure 6-5. In Figure 6-3 Oft-base and Oft 1 had a los failure rate while DOft 3 and DOft 5 had the highest failure rates; in Figure 6-4 Oft-base and Oft 1 had the longest repair rates while DOft 3 and DOft 5 presented better

Figure 6 - 5 :

 65 Figure 6-5: Average duration of interruption per customer for each strategy.

Figure 6 - 6 :

 66 Figure 6-6: SAIFI, SAIDI and CAIDI for each strategy.

Figure 7 - 1 : 7 presented in section 5 . 8 .

 71758 Figure 7-1: Demand for the simulated period. The network is simulated with two different optimization strategies so the results can be compared. The first strategy is the one used for Oft-base in section 5.1 and the second one is the one used for DOft 7 presented in section 5.8. As before, the results are presented in vertically aligned graphs containing from top to bottom:

Figure 7 - 2 Figure 7 - 3 .Figure 7 - 5 . 7 - 2 ,in section 5 . 1 .

 7273757251 Figure 7-3. In the case of DOft 7, extra graphs for the DR factor 𝛼 𝑘 are included in Figure 7-4 and Figure 7-5.

Figure 7 - 2 :

 72 Figure 7-2: Generation, global PSF, Temperature, Mass Flow Rate, Surplus and Deficit for 1 week using Oft-base strategy.

Figure 7 - 3 Figure 7 - 3 :

 7373 Figure 7-3: Generation, global PSF, Temperature, Mass Flow Rate, Surplus and Deficit for 1 week using DOft 7 strategy.

Figure 7 - 4 :Figure 7 - 5 :

 7475 Figure 7-4: Demand Response factor for the whole week

Figure 7 - 6 :

 76 Figure 7-6: Energy generation, energy efficiency, cost of generation, revenue and profit from supply, and source of the difference from revenue and profit for 1 week simulation.

  or by reducing generation to prevent a surplus. To react in real-time to the intra-hour variations of the demand, the proposed methodology uses a Demand Response scheme to reduce or curtail supply in the nodes closer to the generation plants to divert this energy to the nodes farther away. This strategy reduces the operation costs, increases efficiency, and proposes a new mode of QoS management, where interruptions are considered acceptable if they are short and do not affect the same costumer several times in a row. Interesting from this model of operation is that interruption appear more often throughout the network but are significantly shorter. Depending on the physical characteristics of the buildings connected to the DH network, interruptions of 20, 30 or even 60 minutes could be deemed acceptable, increasing the efficiency and QoS of the system.The results also highlight the importance of implementing ICTs throughout a DH network. To achieve the results in the present research, information of the network is mandatory, and ICTs would play an indispensable role. Real-time information is needed to know the intra-hourly variations of the demand, data bases are needed to create demand profiles and time series and, in combination with artificial intelligence, to forecast the near future demand for the horizon optimization. Smart valves and controllers are also needed to control the supply of energy, allowing the system to set the flows at the substations and the implementation of the Demand Response scheme.

  DH by combining Modeling, Simulation, and Optimization tools. The model developed and here presented is named DOTS (Dynamic Optimization of DH for its Transition to Smart Thermal Networks) and it is constituted by a dynamic model for the distribution of heat in a DH network, an optimization tool (DOft) and an evaluation tool. The results obtained from DOTS show that it is possible to change the way that DH is managed to increase the energy efficiency, reduce generation costs, and increase the QoS in dynamic environments. The results also show that having flexibility measures, like Demand Response, further increase the ability of DH systems to reliably operate in the dynamic environment studied in the present research. The results obtained with DOTS are good indication of the capability of DH systems to transition into Smart Thermal Networks and their integration into the Smart City model.

  DOft and Oft are tested for eight optimization strategies, each strategy describing a different model of system management. The results show that considering the dynamics of the system through the PSF can substantially reduce the surplus and deficits in the network, thus reducing the total generation and its associated costs. DOft 6 reduces the deficit by 34,87% and the surplus by 95,99% compared to the base case (Oft-base), and DOft 7 reduces the deficit by 74,54% and the surplus by 97,71% compared to Oftbase. Nevertheless, the results also show that doing an incorrect implementation of the PSF can lead to negative results, with DOft 3 increasing the deficit by 197,68% and DOft 5 increasing the deficit by 275,65% compared to Oft-base. While the PSF is a reliable indicator, the effects of the delay and the inertia can easily transcend the optimization time step. Due to the independent treatment of the time steps, the accumulation of individual optima, which already cannot guarantee an optimal global solution, can even cause a worst global solution than with an optimization that does not consider the PSF (like DOft 3). To avoid this situation, the latest optimization strategies of DOft change to a horizon optimization with a sliding window (DOft 6 and DOft 7). In this way, the optimization of every time step would be tied to the results from the previous and the following time steps, evading the case where a local optimum worsens the global solution. For the evaluation of the results from DOft, the present research proposes a new evaluation framework based on energy, economic and QoS indicators. The energy indicators used are the total generation and the energy efficiency (ratio between supply and generation). The economic indicators are the cost of MWh produced per each MWh of demand, the expected revenue per MWh of demand, and the expected profit per MWh of demand. The QoS is evaluated using indicators that already exist and are implemented in the evaluation of electricity distribution networks, but that are not yet used extensively in heat distribution networks. These are the SAIFI, the SAIDI and the CAIDI. The results show that the implementation of the PSF together with the horizon optimization (DOft 6 and DOft 7) have lower generation, higher efficiency, lower generation costs, and higher revenue and profit. DOft 6 increases efficiency in 7,99%, increases revenue by 0,16 €/MWh-demand and increases profit by 3,63 €/MWhdemand compared to Oft-base; and DOft 7 increases efficiency in 5,21%, increases revenue by 0,33 €/MWh-demand and increases profit by 2,59 €/MWh-demand compared to Oft-base. Moreover, the results show that the QoS is positively impacted, with the interruptions of the service being shorter and of lower magnitude. This is especially the case for DOft 7, which also includes a flexibility measure in the form of Demand Response. Having DR in the network allowed for easier network re-balance and faster interruption corrections without jeopardizing the QoS. DOft 7 has a SAIFI 0,027 lower than Oftbase, a SAIDI 0,080 lower, and a CAIDI 3,66 lower.

  plants to prepare the network to cope with them, either by increasing generation to "charge up" the pipes with extra energy or by reducing generation and use the heat already in the pipes. To react in real-time to the intra-hour variations of the demand, DOft 7 uses a Demand Response scheme to reduce or curtail supply in the nodes closer to the generation plants to divert this energy to the nodes farther away. This strategy reduces the operation costs, increases efficiency, and proposes a new mode of QoS management, where interruptions are considered acceptable if they are short and do not affect the same costumer several times in a row. These results point at the possibility of the transition of DH into the Smart City and lay a path for future work towards enabling the transition to the Smart Thermal Network and the Smart City to occur faster and more smoothly.

- 7 :

 7 to track drops or surges in demand, supply and QoS and react accordingly by exacting flexibility demands Equation 0Equivalent resistance of a buried pipe with insulation and internal flow.𝑅 𝑒 = 𝑅 𝑤 + 𝑅 𝑠𝑡 + 𝑅 𝑖𝑛𝑠 + 𝑅 𝑔𝑟𝑜 Titre : Évaluation énergétique, économique et de la qualité de services, basée sur la modélisation et l'optimisation dynamique, pour une gestion intelligente des réseaux de chaleur Mots Clés : Réseaux de chaleur, Modélisation Dynamique, Optimisation des Systèmes Dynamiques, Réseaux Thermiques Intelligents, Evaluation Energétique, Evaluation Economique, Evaluation de la Qualité de Service.Résumé : Ces travaux considèrent les Smart Grid électrique comme point de départ pour proposer un nouveau modèle de gestion des réseaux de chaleur, baptisé Optimisation Dynamique des réseaux de chaleur pour une transition vers les Réseaux Intelligents (acronyme DOTS en anglais). Le modèle DOTS est constitué de trois parties : la modélisation dynamique des réseaux de distribution, l'optimisation du réseau de chaleur dans son ensemble et une évaluation multicritère de sa performance. La modélisation physique des réseaux est associée à une représentation en graphes orientés et à une méthode modifiée des volumes finis. En complément, ce travail propose l'utilisation d'un nouvel indicateur de fonctionnement dynamique appelé Facteur de Charge des Conduites (PSF en anglais pour Pipe Supply Factor). Le PSF donne le rapport entre l'énergie entrant dans une conduite et l'énergie qui en ressort. L'optimisation est divisée en deux étapes : L'optimisation de l'ordre de mobilisation des différents systèmes de production (dispatch) et l'optimisation de la température de génération. Le dispatch correspond à un ordre de priorité basé sur le coût de production et l'optimisation des températures de production est optimisée grâce à la minimisation de la production totale, de la demande non satisfaite (déficit) et de l'excès de chaleur (surplus). L'évaluation globale du réseau de chaleur se fait au travers d'indicateurs énergétiques, économiques et de qualité de service. Les résultats indiquent la possibilité de la transition des réseaux de chaleur (existants ou nouveaux) vers les Smart Thermal Networks et leur capacité à devenir partie intégrante du modèle Smart City. Title: Energy, Economic and Quality of Service assessment using Dynamic Modelling and Optimization for Smart Management of District Heating networks Keywords: District Heating; Dynamic Modeling; Optimization of Dynamic Systems; Smart Thermal Networks; Energy, Economic and Quality of Service Evaluation.Abstract: Based on the relevance of Heat as one of the primary end-uses of energy in a city and the still small amount of literature on the transition of District Heating (DH) into Smart Thermal Networks, the main objective of the present research is to propose a novel model for system management of DH by combining Modeling, Simulation, and Optimization tools. This with the aim to be a proof of concept that demonstrates the possibility of DH systems to transition into Smart Thermal Networks and their capabilities of integration into the Smart City model. The present research takes the electricity smart grid as the starting point to propose a new model of DH system management named Dynamic Optimization of DH for its Transition to Smart Networks (DOTS). This model is constituted by three parts: the modeling of DH networks, the optimization of DH systems, and the evaluation of DH systems. The modeling approach is based on the physical modeling of DH networks using Oriented Graphs and a variation of the Finite Volumes method. The optimization is divided into two steps: The Dispatch optimization using linear programming formulation, and the Generation Temperature optimization using non-linear programming formulation. The evaluation of DH is done through energy, economic and, new to DH, Quality of Service (QoS) indicators. To account for the dynamics of heat distribution, the present research proposes the use of a new operative indicator named the Pipe Supply Factor (PSF) to allow the network to consider the delay times and the thermal inertia of the system.

  pas de temps indépendamment, voit la part de déficit augmentée de 208,38% par rapport à Oft-base (scénarios de référence). DOft 5, qui optimise également chaque pas de temps indépendamment et qui a une contrainte qui permet plus de flexibilité entre les pas de temps, conduit à une augmentation du déficit de 303,50% par rapport à Oftbase. Les résultats montrent que le PSF est un indicateur approprié pour suivre et tirer parti de l'énergie contenue dans les conduites de distribution, mais que les effets du retard et de l'inertie ne se limitent pas à des pas de temps individuels et influencent les futurs pas de temps d'optimisation. Cela peut conduire à des optimums individuels qui ne garantissent pas l'optimum global. Du fait de l'optimisation indépendante des différents pas de temps, cela peut même conduire à une dégradation cet optimum global, par effet cumulative. Pour éviter cette situation, les dernières stratégies d'optimisation de DOft proposent une optimisation compromettre la qualité de service. DOft 7 a ainsi un SAIFI de 0.027, un SAIDI de 0.080 et un CAIDI de 3.66, tous inférieurs au cas de référence Après le test de DOTS pour les huit stratégies d'optimisation, deux d'entre elles ont été choisies pour une étude de cas utilisant le même réseau mais cette fois en utilisant les données de demande issues d'un réseau de chaleur de la ville de Nantes, en France. Les stratégies choisies sont Oft-base, qui se rapproche le plus à la gestion normale des systèmes DH existants, et DOft 7, qui a obtenu les meilleurs résultats lors du test. Cette étude de cas montre que dans un environnement plus réaliste, où la demande ne reste pas constante pendant la période d'optimisation, DOft 7 ne fonctionne pas aussi bien que dans les tests contrôlés, mais donne cependant de meilleurs résultats que les autres stratégies. La stratégie

	Long Abstract
	Key Words: District Heating, Dynamic Modeling, Optimization of Dynamic Systems, Smart
	Thermal Networks, Smart City, Energy Evaluation, Economic Evaluation, Quality of Service
	Evaluation
	The increasing use of RES and the following increase in Distributed Generation, Low Energy
	Buildings, Multi-Energy Carriers, Integrated Energy Systems, Distributed Storage and the
	possibility of developing Low-Temperature District Heating, among others, is demanding a
	change in the way energy networks are conceived and operated inside an urban environment.
	MWh-demande et augmente le profit de 3,63 € / MWh-demande par rapport à Oft-base ; et
	DOft 7 augmente l'efficacité de 4,95%, augmente le chiffre d'affaires de 0,33 € / MWh-37,76% et l'excédent de 95,99% par rapport au scénario de référence (Oft-base), et DOft 7 de réduire le déficit de 84,37% et l'excédent de 97,71% par rapport à la même référence. demande et augmente le bénéfice de 2,59 € / MWh-demande par rapport à la référence Oft-
	xxxi

Néanmoins, les résultats montrent que l'utilisation du PSF peut conduire à des résultats négatifs si l'influence d'un pas de temps sur le suivant n'est pas prise en compte, ou si les bonnes contraintes ne sont pas appliquées.

DOft

3, qui utilise le PSF sans aucune contrainte xxix et optimise chaque d'horizon avec une fenêtre glissante (DOft 6 et DOft 7). De cette manière, l'optimisation de chaque pas de temps est liée aux résultats d'optimisation des pas de temps précédentes. Les résultats obtenus à partir de deux des stratégies d'optimisation (Oft-base et DOft 7) sont utilisés pour mettre en valeur les capacités du modèle dynamique à fournir les informations nécessaires pour cartographier la distribution spatiale et temporelle des températures et des flux de chaleur dans le réseau. Ces informations permettent de mieux comprendre les effets de la dynamique locale (chaque sous station et conduite) sur l'excédent et le déficit de production du système et de préciser les changements apportés par la stratégie d'optimisation de DOft 7. Ces résultats mettent en évidence à la fois la capacité du PSF des différentes canalisations à agir comme des indicateurs des flux thermiques dans le réseau, et, à la fois, la capacité du PSF global à être un indicateur systémique pour l'évaluation du fonctionnement du réseau. Pour l'évaluation de DOft, les résultats montrent que la mise en oeuvre du PSF ainsi que l'optimisation de l'horizon (DOft 6 et DOft 7) conduisent à une production plus faible, une efficacité plus élevée, des coûts de production inférieurs et des revenus et des bénéfices plus élevés. DOft 6 augmente l'efficacité de 7,72%, augmente le chiffre d'affaires de 0,16 € / base. De plus, les résultats montrent que la qualité de service est positivement impactée, les interruptions de service étant plus courtes et de moindre ampleur. C'est notamment le cas pour DOft 7, qui comprend également une mesure de flexibilité sous forme de Demand Response. Cela permet un rééquilibrage plus facile du réseau et des corrections d'interruption xxx plus rapides sans DOft 7 permet d'atteindre un rendement supérieur de 4,68%, d'augmenter le chiffre d'affaires de 0,47 € / MWh-demande et le bénéfice de 2,37 € / MWh-demande. Plus important encore, cela modifie considérablement la qualité de service du système. Avec DOft 7, le nombre d'interruptions (SAIFI) passe de 0,12 interruptions par client et par semaine à 0,85 interruptions par client et par semaine, principalement en raison du schéma de Demand Response utilisé. De plus, le fait de pouvoir anticiper les interruptions, plutôt que de les subir permet de réduire le CAIDI de 1h38 d'attente pour le client à seulement 23.42 minutes. Ceci est d'un intérêt important pour les travaux futurs, car être en mesure de gérer efficacement les interruptions du système peut conduire à de nouvelles améliorations dans l'exploitation du réseau. La combinaison de tous les résultats présentés montre bien le potentiel de la stratégie DOTS proposée. DOft 7 utilise une optimisation d'horizon pour prédire les futurs déficits (ou surplus) et adapte le fonctionnement des centrales thermiques pour préparer le réseau à y faire face, soit en augmentant la production pour « recharger » les canalisations avec un surplus d'énergie, soit en réduisant la production et utilisez la chaleur déjà présente dans les tuyaux. Pour réagir en temps réel aux variations intra-horaires de la demande, DOft 7 utilise la Réponse à la Demande comme complément pour limiter l'énergie fournie aux noeuds plus proches des centrales de production et préserver suffisamment d'énergie pour les noeuds plus éloignés. Cette stratégie réduit les coûts d'exploitation, augmente l'efficacité et propose un nouveau mode de gestion de la qualité de service, où les interruptions sont considérées comme acceptables si elles sont courtes et n'affectent pas le même client plusieurs fois de suite. Ces résultats indiquent la possibilité de la transition de la DH (existants ou nouveaux) vers le Smart Thermal Network et leur capacité à devenir partie intégrante du modèle Smart City. With the global population migrating to cities, a new model has arisen within the global context of the Smart City. The Smart City is at its core a new model of energy management

  1. Oft-base: a strategy considering fixed generation temperature (temperature not optimized), steady state operation and constant average heat loss coefficients for the pipes in the network. Every hour of operation is optimized independently of each other. This strategy is set as the base for the comparison of all others as it resembles the normal operation of real DH networks the most.

2. Oft 1: a strategy considering fixed generation temperature, steady state operation and variable average heat loss coefficients for the pipes in the network. Every hour of operation is optimized independently of each other.

3. DOft 2: a strategy considering generation temperature optimization, steady state operation and variable average heat loss coefficients for the pipes in the network.

Chapter 3; the results obtained with the simulation model are presented in Chapter 4; the results for the different optimization strategies proposed are presented in Chapter 5; the results for the new evaluation framework are presented in Chapter 6; the results of a Case Study with real data from the city of Nantes are analyzed in Chapter 7; Chapter 8 concludes the present research.

  methodology followed in the present research is detailed in

  can be arranged in a 𝐴𝑥 = 𝐵 matrix, where 𝐴 and 𝐵 are the matrices describing the equations and 𝑥 the solution vector. Such system is shown in Equation 3-6.

	𝜌 𝑠𝑡 𝐶𝑝 𝑠𝑡 𝑉 𝑠𝑡 (𝑇 𝑠𝑡 𝑗 𝑖 -𝑇 𝑠𝑡 𝑗 𝑖-1 ) = [	(𝑇 𝑤 𝑗 𝑖 -𝑇 𝑠𝑡 𝑖 𝑅 𝑤-𝑠𝑡 𝑗 𝑖	𝑗 )	-	(𝑇 𝑠𝑡 𝑗 𝑖 -𝑇 𝑎 ) 𝑅 𝑠𝑡-𝑎	] [∆𝑡 𝐷𝑦𝑚 ]
	Equation 3-3 and Equation 3-5 Equation 3-6: Equations in Ax=B matrix form.
	[ 𝜌 𝑤 𝐶𝑝 𝑤 𝑉 𝑤 ∆𝑡 𝐷𝑦𝑚 -1 + 𝑅 𝑤-𝑠𝑡 𝑗 𝑅 𝑤-𝑠𝑡 𝑗 1 𝑖 𝑖	𝜌 𝑠𝑡 𝐶𝑝 𝑠𝑡 𝑉 𝑠𝑡 ∆𝑡 𝐷𝑦𝑚	-1 𝑅 𝑤-𝑠𝑡 𝑗 𝑖 + 1 𝑅 𝑤-𝑠𝑡 𝑗 𝑖	+	1 𝑅 𝑠𝑡-𝑎 ]	[	𝑇 𝑤 𝑗 𝑖 𝑇 𝑠𝑡 𝑗 𝑖	] =	𝑚̇𝐶𝑝 𝑤 𝑇 𝑤 𝑗-1 𝑖-1 + ( [ 𝜌 𝑠𝑡 𝐶𝑝 𝑠𝑡 𝑉 𝑠𝑡 𝜌 𝑤 𝑉 𝑤 ∆𝑡 𝐷𝑦𝑚 ∆𝑡 𝐷𝑦𝑚 𝑇 𝑠𝑡 𝑗 𝑖-1 + -𝑚̇) 𝐶𝑝 𝑤 𝑇 𝑤 𝑗 𝑖-1 𝑇 𝑎 𝑅 𝑠𝑡-𝑎	]

Equation 3-5: Heat balance for a pipe wall.

Equation 3 - 7 :

 37 Equations for the Dynamic Model.

	Equation 3-8: Time Constant.
	𝜏 =	𝑅 𝑤-𝑠𝑡 𝑗 𝑖 𝑅 𝑤-𝑠𝑡 𝑗 • 𝑅 𝑠𝑡-𝑎 • 𝐶 𝑠𝑡 𝑖 + 𝑅 𝑠𝑡-𝑎
	[ 𝜌 𝑤 𝐶𝑝 𝑤 𝑉 𝑤 ∆𝑡 𝐷𝑦𝑚 -𝑒𝑥𝑝(-∆𝑡 𝐷𝑦𝑚 𝜏 + 1 𝑅 𝑤-𝑠𝑡 𝑗 𝑖 ⁄ ) 𝑅 𝑤-𝑠𝑡 𝑗 𝑖	( ∆𝑡 𝐷𝑦𝑚 𝐶 𝑠𝑡 𝜌 𝑠𝑡 𝐶𝑝 𝑠𝑡 𝑉 𝑠𝑡 ∆𝑡 𝐷𝑦𝑚 +	+ 𝑒𝑥𝑝(-∆𝑡 𝐷𝑦𝑚 𝜏 1 ) 𝑅 𝑠𝑡-𝑎 ⁄ ) 𝑅 𝑤-𝑠𝑡 𝑗 𝑖	]	𝑇 𝑤 𝑗 𝑖+1 [ 𝑇 𝑠𝑡 𝑗 𝑖+1	] =
	𝑚̇𝐶𝑝 𝑤 𝑇 𝑤 𝑗-1 𝑖 [	+ ( ∆𝑡 𝐷𝑦𝑚 𝜌 𝑤 𝑉 𝑤 𝜌 𝑠𝑡 𝐶𝑝 𝑠𝑡 𝑉 𝑠𝑡 -𝑚̇) 𝐶𝑝 𝑤 𝑇 𝑤 𝑗 𝑖 + 𝐶 𝑠𝑡 𝑇 𝑠𝑡 𝑗 𝑖 + ∆𝑡 𝐷𝑦𝑚 𝑇 𝑠𝑡 𝑗	𝑇 𝑎 𝑅 𝑠𝑡-𝑎

𝑖 ]

In Equation 3-7, 𝜏 is the time constant of the system and is defined by Equation 3-8.

  -7 shows a substation node with a local heat source. In this figure we can see that, at every time step 𝑖, a node with local generation has six mass flow rates (𝑚̇𝑠 𝑖𝑛 ; 𝑚̇𝑠 𝑜𝑢𝑡 ; 𝑚̇𝑟 𝑖𝑛 ; 𝑚̇𝑟 𝑜𝑢𝑡 ; 𝑚̇𝑔 𝑒𝑛 ; 𝑚̇𝑠 𝑢𝑏 ) and eight temperatures (𝑇 𝑠 𝑖𝑛 ; 𝑇 𝑠 𝑜𝑢𝑡 ; 𝑇 𝑟 𝑖𝑛 ; 𝑇 𝑟 𝑜𝑢𝑡 ; 𝑇 𝑔𝑒𝑛 𝑖𝑛 ; 𝑇 𝑔𝑒𝑛 𝑜𝑢𝑡 ; 𝑇 𝑠𝑢𝑏 𝑖𝑛 ; 𝑇 𝑠𝑢𝑏 𝑜𝑢𝑡 ) that have to be determined: • In the supply side: Four temperatures (𝑇 𝑠 𝑖𝑛 ; 𝑇 𝑠 𝑜𝑢𝑡 ; 𝑇 𝑠𝑢𝑏 𝑖𝑛 ; 𝑇 𝑔𝑒𝑛 𝑜𝑢𝑡 ) and four mass flow rates (𝑚̇𝑠 𝑖𝑛 ; 𝑚̇𝑠 𝑜𝑢𝑡 ; 𝑚̇𝑔 𝑒𝑛 ; 𝑚̇𝑠 𝑢𝑏 ). The temperature of the water going into the substation heat exchanger is the same as the supply temperature at the input of the node. Other nodes may have a different balance, i.e. a node connected to a back-up plant and no consumption has only two temperatures (𝑇 𝑠 𝑖𝑛 = 𝑇 𝑠 𝑜𝑢𝑡 ; 𝑇 𝑟 𝑖𝑛 = 𝑇 𝑟 𝑜𝑢𝑡 ) and two mass flows (𝑚̇𝑠 𝑖𝑛 = 𝑚̇𝑠 𝑜𝑢𝑡 ; 𝑚̇𝑟 𝑖𝑛 =

• In the return side: Four temperatures (𝑇 𝑟 𝑖𝑛 ; 𝑇 𝑟 𝑜𝑢𝑡 ; 𝑇 𝑔𝑒𝑛 𝑖𝑛 ; 𝑇 𝑠𝑢𝑏 𝑜𝑢𝑡 ) and four mass flow rates (𝑚̇𝑟 𝑖𝑛 ; 𝑚̇𝑟 𝑜𝑢𝑡 ; 𝑚̇𝑔 𝑒𝑛 ; 𝑚̇𝑠 𝑢𝑏 ). The temperature of the water going into the generation heat exchanger is the same as the return temperature at the input of the node.

  ). In this equation 𝐶𝑜𝑠𝑡 𝑘 𝑡 is the operation cost of each plant 𝑘 at time step 𝑡; 𝑃 𝑆𝑟𝑐𝑒 𝑘 𝑡 is the heat produced at plant 𝑆𝑟𝑐𝑒 𝑘 at time step 𝑡 and; ∆𝑡 𝑜𝑝 indicates the duration of each time step.To calculate the values of these state variables HeatGrid uses three different types of constraints at each 𝑔 is the heat handled in the pipe 𝑔, 𝑃 𝑘 -is the heat exiting node 𝑘, 𝑃 𝑘 + is the heat entering node 𝑘, and 𝑃 𝑘 𝐷 is the demand in node 𝑘. The objective function as well as the constraints are linear, so a linear

	node:
	• Thermal pipes capacity	0 ≤ 𝑃 𝑚 𝑔 ≤ 𝑃 𝑚 𝑔 𝑚𝑎𝑥
	• Heat sources capacity	0 ≤ 𝑃 𝑘 -≤ 𝑃 𝑆𝑟𝑐𝑒 𝑘 𝑚𝑎𝑥
	• Energy balance		𝑃 𝑘 + = 𝑃 𝑘 -+ 𝑃 𝑘 𝐷
	𝑃 𝑚
	Equation 3-11: Operation cost of the DH network.
	𝑓 𝑡 = ∑ 𝐶𝑜𝑠𝑡 𝑘 𝑡 × 𝑃 𝑆𝑟𝑐𝑒 𝑘 𝑡 𝑡∈𝑆	× ∆𝑡 𝑜𝑝

Table 4 - 1 :

 41 Characteristics of the pipes in the network.

	Length	𝑑	𝑠 𝑠𝑡	𝑠 𝑖𝑛𝑠 𝑧 𝑑𝑒𝑝𝑡ℎ 𝑘 𝑠𝑡	𝑘 𝑖𝑛𝑠	𝑘 𝑔𝑟𝑜	𝜌 𝑠𝑡	𝐶𝑝 𝑠𝑡
	Pipe
	(𝑚)		(𝑚𝑚)		(𝑚)	(𝑊 • 𝑚 -1 • 𝐾 -1 )	(𝑘𝑔 • 𝑚 -3 ) (𝐽 • 𝑘𝑔 -1 • 𝐾 -1 )
	1-3 5000 102.2 11.4 29	1	54 0.024 1.2	7850	465
	2-3 2000	90	10 26.5	1	54 0.024 1.2	7850	465
	3-4 750	73.6 8.2 36.5	1	54 0.024 1.2	7850	465
	3-5 1200	90	10 26.5	1	54 0.024 1.2	7850	465
	5-6 450	90	10 26.5	1	54 0.024 1.2	7850	465

Table 4 -

 4

		Max Absolute Error		Computation Time
	CFL	kW			s
		FVN	Dynamic Model	FVN	Dynamic Model	FVN same accuracy
	1	0	0	716	736	N/A
	0.95	13.44	30.08	679	704	N/A
	0.75	87.00	76.36	666	696	2520
	0.5	173.13	99.74	663	682	2451
	0.3	265.9	155.47	664	672	2554

2: Max Absolute and Relative Errors for different CFLs using FVN and the Dynamic Model.

Table 5 - 1 :

 51 Pipe characteristics.

	Pipe	Length	∅	𝑠 𝑠𝑡 𝑠 𝑖𝑛𝑠 𝑧 𝑑𝑒𝑝𝑡ℎ 𝑘 𝑠𝑡 𝑘 𝑖𝑛𝑠 𝑘 𝑠𝑜𝑖𝑙	𝜌 𝑠𝑡	𝐶𝑝 𝑠𝑡
		(𝑚)		(𝑚𝑚)	(𝑚)	(𝑊 • 𝑚 -1 • 𝐾 -1 )	(𝑘𝑔 • 𝑚 -3 ) (𝐽 • 𝑘𝑔 -1 • 𝐾 -1 )
	1-3	5000 219.1 4.5 68	1	54 0.024 1.2	7850	465
	2-3	6124 406.4 6.3 111	1	54 0.024 1.2	7850	465
	3-4	5000 406.4 6.3 111	1	54 0.024 1.2	7850	465
	4-5	5000 219.1 4.5 68	1	54 0.024 1.2	7850	465
	4-6	5000 323.9 5.6 88	1	54 0.024 1.2	7850	465
	6-7	5000 323.9 5.6 88	1	54 0.024 1.2	7850	465
	This system contains two generation nodes (Nodes 1 and 2), one back-up plant (Node 6), and four
	consumer nodes (Nodes 3, 4, 5, 7). Node 1 is a 7 MW waste-to-heat generation plant, Node 2 is a 30

Table 5 - 2 :

 52 Fuel price for the 3 heat plants.

	Heat Plant	Fuel	Fuel Price
	Waste Incinerator	Urban solid waste	0.02 €/kWh
	Gas Plant	Natural Gas	0.04 €/kWh
	Gas-fired Boiler	Natural Gas	0.05 €/kWh

To simulate the behavior of the proposed topology, treated demand data in 1-hour intervals from the

Table 5 - 3 :

 53 Simulation and optimization characteristics of each strategy.

	Strategy Name	Characteristics	Time step	Steady state or dynamic
	Oft-base	Linear Programming Optimization (HG) + The Dynamic Model (DM)	1h	Steady state
	Oft 1	HG + DM + Real Losses	1h	Steady state
		HG + DM + Real Losses + mean demands +
	DOft 2	non-Linear Programming Optimization	3h	Steady state
		(NOMAD)
	DOft 3	HG + DM + Real Losses + mean demands + NOMAD + Pipe Supply Factor (PSF)	3h	Dynamic
	DOft 4	HG + DM + Real Losses + mean demands + NOMAD + PSF + ±5°C T° constraint	3h	Dynamic
	DOft 5	HG + DM + Real Losses + mean demands + NOMAD + PSF + ±10°C T° constraint	3h	Dynamic
	DOft 6	HG + DM + Real Losses + NOMAD + PSF + sliding window	1h	Dynamic
	DOft 7	HG + DM + Real Losses + NOMAD + PSF + sliding window + Demand Response	1h	Dynamic

Table 6 - 1 :

 61 SAIFI, SAIDI and CAIDI for each strategy.

		SAIFI	SAIDI	CAIDI
		(interruptions per	(average interruption duration per	(average time to regain
		evaluation period)	customer)	service)
	Oft-base	0,024	0,098	4,033
	Oft 1	0,038	0,080	2,109
	DOft 2	0,114	0,108	0,945
	DOft 3	0,196	0,194	0,993
	DOft 4	0,144	0,171	1,189
	DOft 5	0,174	0,199	1,141
	DOft 6	0,128	0,064	0,504
	DOft 7	0,051	0,019	0,373

Table 7 - 1 :

 71 QoS indicators for Oft-base and DOft 7.

		SAIFI	SAIDI	CAIDI
		(average number of	(average duration of	(average duration of
		interruptions per customer	interruptions per customer	interruptions per
		per week)	per week (h))	customer (h))
	Oft-base	0,128	0,158	1,230
	DOft 7	0,891	0,298	0,335

SIMPLE is a widely used algorithm to solve the Navier-Stokes equations in Computational Fluid Mechanics.

Figures and Tablesin sections 3.1.1, 3.1.2 and 3.1.3 were first published in[START_REF] Schwarz | Modified finite volumes method for the simulation of dynamic district heating networks[END_REF]

The present research focuses on Heat distribution networks. In the case of Cooling networks many of the same principles can be applied, and the methodology here presented can be adapted.

Acknowledgments

The present research is performed within the framework of the Erasmus Mundus Joint Doctorate SELECT+ program 'Environomical Pathways for Sustainable Energy Services' and funded with support from the Education, Audiovisual, and Culture Executive Agency (EACEA) (Nr 2012-0034) of the European Commission. Support from the IN+ strategic Project UID/EEA/50009/2013 is also gratefully acknowledged. This publication reflects the views only of the author(s), and the Commission cannot be held responsible for any use, which may be made of the information contained therein.

Dynamic Model: Results and Discussion

In this chapter, the results obtained using the Dynamic Model to simulate DH networks are analyzed to assess its relevance and performance for the objective of coupling it with optimization. First, the Dynamic Model is validated on a network composed of six nodes and five pipes (Figure 4-1). This network is the same as used in [START_REF] Marguerite | INTEGRATED MODELS TO EVALUATE DISTRICT HEATING NETWORKS[END_REF], a predecessor of this work. The results from this test are analyzed to evaluate the ability of the Dynamic Model to describe the operation of DH systems, to map the spatial-temporal distribution of temperatures in the network, and to compare it with the existing Finite Volumes Node method (FVN). After the Dynamic Model has been validated, a single pipe will be tested for different operation conditions to analyze in depth the behavior of the delay, the losses and the thermal inertia of heat during its transport, and propose a possible application for it.

Validation of the Dynamic Model 5

The network used to validate the Dynamic Model contains two generation nodes (Nodes 1 and 2) and four consumer nodes (Nodes 3 -6). Node 3 is a junction and a split, meaning that the mass flows coming from Nodes 1 and 2 will mix here and acquire a new temperature based on the energy conservation equations. The flow will then be divided into two new flows, one going to Node 4 and one to Node 5, both with the same temperature but mass flows determined by the downstream demands, the capacity 5 All Figures and Tables in section 4.1 were first published in [START_REF] Schwarz | Modified finite volumes method for the simulation of dynamic district heating networks[END_REF] is operating at high capacity, especially between the 900 th and the 1 440 th minutes. The back-up plant has the highest operation costs of all heat plants in the system, which already makes this strategy to be less desirable. But what shows the failure of this approach the most, is the surplus and deficit experienced by the system. As it can be seen in the bottom graph, as times advances, the surplus and the deficit grow larger in magnitude, with a distinct oscillation in which a period of deficit is followed by a period of surplus, each growing as the simulation continues. This behavior can be explained by looking at the generation temperatures and the mass flow rates of the system.

Using this optimization strategy, the generation temperatures present an oscillatory pattern. As the simulation continues, the generation temperature alternates between higher and lower values. This is accompanied by a similar behavior of the mass flow rates. The mass flow output of Node 1 follows an inverse pattern as its temperature, increasing when the temperature falls (which makes sense as its power output is constant). In the case of the gas plant in Node 2, it is much more variable than in previous strategies. Between the 900 th and the 960 th minute it even drops considerably when the back-up takes on a significant share of the generation. These patterns tell the story of a system that, as it is generating heat, a good portion of it is being stored in the system. As times goes on, the energy stored in the system is enough to supply a fair share of the demand, so generation drops, and the energy of the system is mostly discharged. In the time step following the discharge of the heat in the pipes, the system finds it hard to supply the demand, so it over-generates to compensate. This increases the energy stored in the system and the cycle repeats itself. This characteristic, that of alternating between high and low generation periods, is detrimental for the system. Even when in individual time steps the generation is reduced and an increased in efficiency can be inferred, the use of the back-up and the increased deficits point at an overall reduction of the performance of the system. This optimization strategy proved to be a failure, but it showed a lot of promise in its potential. The main problem observed is that with the implementation of the PSF without any type of constraint, the system relied too much on the inertia during some periods, which in turn caused the network to make up for it by ramping up generation and over-using the backup plant in other periods. One way of counteracting this is by implementing constraints in the optimization algorithm to limit how much energy is charged or discharged from the pipes at each optimization time step.

DOft 5: Optimization using HeatGrid, the Dynamic Model, the real losses, mean demands, NOMAD, the Pipe Supply Factor and ±10°C T° constraint

The strategy used to optimize DOft 3 showed that there is potential in using the PSF to improve the performance of DH in dynamic environments, but that it can also backfire if done incorrectly.

Constraining the temperature change between time steps, as presented in DOft 4, improved the results, but is no clear indication of how sensitive a DH system is to this type of constraint. The objective of this strategy is to test the sensitivity of this optimization approach to a variation on the imposed constraints. The constraints are relaxed to ±10°C from ±5°C.

The results for this strategy are shown in Figure 5678. Looking at the top graph, it can be seen that relaxing the constraint of generation temperature by just 5°C is enough to once again see an increase in the use of the gas-fired boiler in the back-up plant. With this optimization strategy, the generation is sometimes lower than the demand, indicating that the delay and the inertia are being taken into account, but once again, as was the case in DOft 3, the back-up plant sees increased use and the deficits in the network remain high. Steps of 10°C at the generation plants of a DH system are not unlikely, so the results already show that this optimization strategy is not viable. DH systems are too sensitive to a temperature constraint and it would be highly likely that issues will arise if they are managed under this strategy. However, Figure 5-8 does present some interesting behaviors that are worth of being analyzed further.

Looking at the period between the 180 th and the 360 th minute, the generation from Node 2 is reduced and the back-up plant in Node 6 supplies all the demand of Node 7. This is known by looking at the mass flow rate of Pipe 4-6, which is zero during this period. In the period immediately after this one, between the 360 th and the 540 th minute, the temperature at Node 6 drops drastically. During this time, the back-up is not in operation, so all the energy flowing into Node 6 comes from Pipe 4-6. However, for the whole duration of the previous period the flow of this pipe had been zero, so the hot water within the pipe was laying still, exchanging heat with the environment. As each period is three hours long, it was enough for the hot water contained in the pipe to lose a fair share of its heat. It is not until the end part of this time step that the temperature can be seen to rise again with the new hot flow finally reaching the node. From this period, it is also interesting to see that it is the first time that the global PSF changes sign mid-time step with such a high difference. This phenomenon is repeated during the following two time steps where similar conditions happen again.

These results show once more that considering the inertia can have an impact but doing it improperly can render the results worse than doing nothing. Constraining the temperature is a possible solution but prone to errors due to its high sensitivity. A possible source for this limitation of the proposed strategy The DR scheme used for this strategy is implemented as a factor 𝛼 𝑘 that reduces the energy taken by a substation to supply its demand. This will translate into reduction of supply to the final user or even a curtailment, which explains the deficits seen in Results also show the ability of DOft for mapping the spatial-temporal distribution of temperatures in the network as well as the PSF in all the pipes. Knowing how the heat is distributed in the network and the pipes in which it is in transit allows for better control and operation of the system. The heat and PSF maps give a clear picture of how the heat flows through a DH network and open the possibility for further applications that are not discussed here, like optimization of heat storage installation or the implementation of cogeneration plants.

For this reason, the next chapter proposes a new framework of network evaluation that is applicable to any DH system and will aid the decision makers in investing on the transition to Smart Thermal Networks and the Smart City.

All in all, the combination of these indicators shows how a better model of system management can benefit the operation of DH networks. Better control translates into better efficiencies and more effective supply, which in turn translates into higher revenues and better profit. These results also show that accounting for the inertia and the delay can create the conditions for a period of time where the efficiency and the profit are better than the best-case scenario. This situation however is not sustainable and will disappear if longer periods of time are evaluated. These results are encouraging and can lead to conclude that DOft 6 is the best strategy, as it has the best energy and economic results. However, a DH should not be evaluated form the point of view of the heat plants and the DHO only. The next section shows the implications of each optimization strategy on the QoS given to the consumers.

Quality of Service Indicators

Within the scope of the Smart City, all actors connected to a distribution network will play an active role in the management of the system. This includes the consumers as well as the generation plants and the distribution system operators. The present research found that there was a lack of an evaluation framework to assess the operation of a DH system beyond its energy and economic performances. For this reason, a new evaluation framework is proposed, which also considers the QoS delivered by the system from the system's point of view.

As presented and explained in the methodology in Chapter 3, an important part of the DOTS model is the evaluation framework, especially the evaluation of the QoS. The QoS evaluation for DOTS is based on the evaluation framework used in existing electricity networks. In these networks, the QoS indicates how likely it is for the system to curtail service to a customer and how long will a curtailment be when it happens. These curtailments are called interruptions, and they have a different definition in DH as they have in electricity. In electricity networks, an interruption exists the moment that a consumer ceases to receive supply. In the present research, an interruption in DH networks is defined as a curtailment that will cause discomfort on the costumers and that no flexibility measure will be able to cover for it. In DH, not all curtailments become an interruption of service.

The indicators used for this evaluation are the SAIFI, the SAIDI and the CAIDI. These indicators use the information known from the primary side of the system to produce information from the customer's perspective. This allows the assessment of the QoS delivered from the system's point of view, which is something lacking in the literature The SAIFI indicates how likely it is for a customer connected to the system to experience an interruption, the SAIDI indicates the average duration of the interruptions per customer connected, and the CAIDI indicates how long is the customer expected to wait to regain service when they experience an interruption. In order to compute them, as described in Equation 3-21,

Application of DOTS to a Test Network using Real Data

The previous chapter presented the results obtained with DOft under different optimization strategies.

From these results it is concluded that it is plausible to upgrade DH networks to operate within the Smart City context under a much more dynamic environment. It is also concluded that including the consumers as active participants in the system could have significant positive effects on the management and QoS of the system. These results however were obtained using clean data series in 1-hour intervals, which do not fully resemble the real heat demand in an operating network. To prove that the methodology introduced in the present research is valid for implementation in real networks, as well as in longer time frames, this chapter presents the results obtained with Oft-base and DOft 7 applied to a network with real data obtained from the city of Nantes, France.

The period studied is comprised between the 3 rd of December 2017 and the 10 th of December 2017. The network being simulated remains the same presented in Figure 5-1, but the demand at each of the four substations comes from real measurements taken every 15 min in the DH network of the city of Nantes.

These are shown in Figure 7-1. The present research did not make the measurements. The first thing to notice in this figure is the pattern of the demand. All days present two distinct peaks, a smaller one in the morrow and a larger one at the end of the afternoon. These peaks coincide with the morning demand and for the time between the returning home of people from school and work, and bedtime. These peaks are better defined during the working weekdays. On the weekend, when people remain home, the demand is higher across the whole day. The optimization of this period starts at 00h00 on 03/12/2017 and Of special interest from the mass flows obtained from DOft 7 when compared to Oft-base, is that for DOft 7 (see Figure 7-3) the mass flows are between 50% and 75% higher than they were for Oft-base (see Figure 7-2). This increase in the mass flows creates a higher pressure drop in the pipes and could lead to the pipes being unable to handle the increased pumping pressure required. The increase in pumping pressure would also lead to higher operation costs of the network due to the increase in electricity consumption. In the present research, the proposed network topology was able to handle the new operation pressure and the pumping costs were neglected due to them being too low when compared to heat generation costs. However, in the case of the real implementation of this methodology, it could be the case where the pumping costs would rise to high, that new pumps would be required, or that the network would not be able to handle the new pressure. This could be solved by adding the maximum mass flows as a constraint to the supply temperature optimization and by including pumping costs in the dispatch optimization. All these factors will need to be considered when implementing this methodology to a different case.

Evaluation of the results

When compared to Oft-base, the new form of system management proposed in the present research achieves lower generation, avoids the use of back-up units, and obtains better QoS. Using a horizon optimization, the network can predict future deficits and prepare for them by storing energy in the pipes; using a Demand Response scheme, the network can react in real-time to deficits occurring by a mismatch between expected and real demands. The effects of this can be seen in Figure 7-6.

The top graph of Figure 7-6 shows the total energy generation obtained with Oft-base and with DOft 7. The dark blue area corresponds to the generation with the waste-to-heat plant, the light blue area to the gas plant and the red area to the back-up plant. The green line in this graph shows the total demand for this period. DOft 7 achieves lower generation than Oft-base, with most of the reduced generation coming from less use of the gas plant. This lower generation obtained with DOft 7 allows the system to increase the efficiency of the system in 4,68%, as can be seen in the second graph of this figure. The third graph shows the operation costs for the two strategies, which remain consistent to the generation results presented in the top graph. The use of DOft 7 reduces the costs of operation compared to Oft-base by 1,90 €/MWh-demand. The fourth graph shows the revenue and profit for each strategy and for Perfect Supply. Here it can be seen that the revenues are similar for both optimization strategies, but the profits are higher for DOft 7. This difference is explained by looking at the bottom graph of Figure 7-6. Here it can be seen that the loss of profit caused by not meeting the demand is similar for both cases, but the profit lost due to increased generation is lower for DOft 7.

from the consumers and enacting a network rebalance, like the Demand Response scheme proposed in the present research.

Once the information to be collected is defined and the communications infrastructure for its exchange put in place, DH systems need to be equipped with the ability not only to make decisions based on data, but to act on those decisions. To enable DH to do something with all the information that will be exchanged in the Smart City environment, it requires to be equipped with actuators that change the realtime operation of the system. These actuators could come in the form of smart valves that allow the DHO, the building administrator, or the final consumer to control the flow of hot water through their substations or heat exchangers. By controlling how much flow each substation can extract from the primary side, the network can be re-balanced to redirect energy to consumers farther away from the generation plants, as was demonstrated in the present research. If done correctly, this increases the efficiency of the system and reduces costs without compromising the QoS. Once the primary substations are set to optimum efficiency, the consumers in the flexibility program will allow the system to curtail their supply for a short time by letting their intake valves be automatically closed.

While not directly addressed in the present research, the implementation of ICTs is fundamental to allow DH networks to transition into Smart Thermal Networks and the Smart City. The present research studied the primary side of DH networks and used modeling, simulation, and optimization to propose a novel model of system management on the assumption that the network had access to a communications infrastructure and smart valves. ICTs would allow the system to better forecast the short term demand of the network, allowing the application of a horizon optimization, and to know the real time status of the supply, allowing the implementation of a flexibility measure like Demand Response. It is already expected that ICTs would be an ever-present tool in the Smart City and thus, the future DH, proving the relevance of this work.

Annex Heat Transfer Equations

The equations for heat transfer from the water to the environment are a combination of the heat transfer equations for a pipe with internal flow, the thermal resistance for a compound cylinder and the thermal resistance for a cylinder buried in a semi-infinite medium. In these equations 𝑃𝑟 is the Prandtl number calculated using the heat capacity of the fluid (𝐶𝑝), the dynamic viscosity of the fluid (𝜇) and the thermal conductivity of the fluid (𝑘). In this way it is possible to obtain the convective heat transfer coefficient for the water. Where 𝑟2 is the external radius of the cylinder (pipe or insulation), 𝑟1 is the internal radius of the cylinder, 𝐿 is the length of the cylinder's section and 𝑘 is the thermal conductivity of the cylinder.

The thermal resistance of the soil can be calculated with the resistance equivalent for a cylindrical geometry and the shape factor for a constant temperature cylinder buried in a half infinite domain (see Equation 0-6).

Equation 0-6: Thermal resistance of the soil around a buried pipe. Where 𝑧 𝑑𝑒𝑝𝑡ℎ is the depth at which the pipes are buried and 𝑑 is the total diameter of the pipe (pipe and insulation).

The equivalent thermal resistance of the whole system is given by the sum of these resistances as shown in Equation 0-7: