21

Transactive Control of Coupled Electric Power and District Heating Networks

KARLSRUHER BEITRÄGE ZUR REGELUNGS-UND STEUERUNGSTECHNIK

# Jona Maurer

# Transactive Control of Coupled Electric Power and District Heating Networks

Jona Maurer

# **Transactive Control of Coupled Electric Power and District Heating Networks**

Karlsruher Beiträge zur Regelungs- und Steuerungstechnik Karlsruher Institut für Technologie

Band 21

# **Transactive Control of Coupled Electric Power and District Heating Networks**

by Jona Maurer

Karlsruher Institut für Technologie Institut für Regelungs- und Steuerungssysteme

Transactive Control of Coupled Electric Power and District Heating Networks

Zur Erlangung des akademischen Grades eines Doktor-Ingenieurs von der KIT-Fakultät für Elektrotechnik und Informationstechnik des Karlsruher Instituts für Technologie (KIT) genehmigte Dissertation

von Jona Maurer, M.Sc.

Tag der mündlichen Prüfung: 28. September 2022 Hauptreferent: Prof. Dr.-Ing. Sören Hohmann Korreferent: Prof. Dr. Kankar Bhattacharya

### **Impressum**

Karlsruher Institut für Technologie (KIT) KIT Scientific Publishing Straße am Forum 2 D-76131 Karlsruhe

KIT Scientific Publishing is a registered trademark of Karlsruhe Institute of Technology. Reprint using the book cover is not allowed.

www.ksp.kit.edu

*This document – excluding parts marked otherwise, the cover, pictures and graphs – is licensed under a Creative Commons Attribution-Share Alike 4.0 International License (CC BY-SA 4.0): https://creativecommons.org/licenses/by-sa/4.0/deed.en*

*The cover page is licensed under a Creative Commons Attribution-No Derivatives 4.0 International License (CC BY-ND 4.0): https://creativecommons.org/licenses/by-nd/4.0/deed.en*

Print on Demand 2023 – Gedruckt auf FSC-zertifiziertem Papier

ISSN 2511-6312 ISBN 978-3-7315-1276-9 DOI 10.5445/KSP/1000155178

# **Abstract**

The aim to decarbonize the energy supply represents a major technical and social challenge. The design of approaches for future energy network operation faces the technical challenge of needing to coordinate a vast number of new network participants spatially and temporally, in order to balance energy supply and demand, while achieving secure network operation. At the same time these approaches should ideally provide economic optimal solutions. In order to meet this challenge, the research field of *transactive control* emerged, which is based on an appropriate interaction of market and control mechanisms. These approaches have been extensively studied for electric power networks. In order to account for the strong differences between the operation of electric power networks and other energy networks, new approaches need to be developed. Therefore, within this work a new transactive control approach for Coupled Electric Power and District Heating Networks (CEPDHNs) is presented. As this is built upon a model-based control approach, a suitable model is designed first, which enables to operate coupled electric power and district heating networks as efficient as possible. Also, for the transactive control approach a new fitted procedure is developed to determine market clearing prices in the multi-energy system. Further, a distributed form of district heating network operation is designed in this context. The effectiveness of the presented approach is analyzed in multiple simulations, based on real world networks.

# **Kurzfassung**

Die Dekarbonisierung der Energieversorgung stellt eine enorme technische und gesellschaftliche Herausforderung dar. Der Entwurf von Ansätzen zur Betriebsführung zukünftiger Energienetze sieht sich dabei zum einen der technischen Herausforderung gegenüber, eine enorme Anzahl von neuen Netzteilnehmern zeitlich und örtlich zu koordieren, um Erzeugung und Verbrauch in Einklang zu bringen und dabei gleichzeitig einen sicheren Netzbetrieb zu gewährleisten. Zum anderen sollten diese Ansätze idealerweise ökonomisch optimale Lösungen hervorbringen. Um dieser Herausforderung zu begegnen entstand das Forschungsfeld der *Transactive Control* Ansätze, welches auf einer geeigneten Verzahnung von Markt- und Regelmechanismen beruht. Diese Ansätze wurden bisher umfassend für rein elektrische Netze untersucht. Um den großen Unterschieden in der Betriebsführung zwischen Stromnetzen und anderen Energienetzen Rechnung zu tragen, bedarf es der Entwicklung neuer Verfahren. Daher wird im Rahmen dieser Arbeit ein neuer *Transactive Control* Ansatz für gekoppelte Strom- und Wärmenetze vorgestellt. Da dieser auf einem modellbasierten Regelungsverfahren beruht, wird zunächst ein geeignetes Modell entworfen, welches es ermöglicht, gekoppelte Strom- und Wärmenetze möglichst effizient zu betreiben. Zudem wird für den *Transactive Control* Ansatz ein neues Verfahren zur Bestimmung geeigneter Markträumungspreise, im sektorengekoppelten System, entwickelt. Außerdem wird in diesem Kontext ein neues Verfahren zur verteilten Betriebsführung von Wärmenetzen entworfen. Die Wirksamkeit der Verfahren wird an Simulationsergebnissen, basierend auf realen Netzdaten, analysiert.

# **Thanks**

To Sören Hohmann for giving excellent classes, creating unknown levels of motivation during my time as a student at the KIT. Also, for providing the chance of pursuing this work and the great leadership all the way.

To Kankar Bhattacharya for taking the time to be my second examiner and for the great guidance, including long fruitful discussions during my research stay in Waterloo.

To Mathias, Claudio, Stefan, and Martin for great mentorship.

To Armin, Martin, Bertus, Pol, and Felicitas for reviewing this work.

To Jochen and Nicolai for sophisticated implementations.

To the Stadtwerke Kiel and Ettlingen, especially Silas Reigardt and Eberhard Oehler, for reviewing results and providing valuable practical insight.

To Kaori Nagato-Plum for her advice.

To Sophie for affectionate illustrations.

To my students for their motivation, questions, and ideas.

To the entire IRS staff, including Lennart Merkart, for thought-provoking impulses and companionship.

To my family and friends for ongoing support.

To Franzi and Kalea for being the best imaginable substitute colleagues during the pandemic creation times of this thesis.

Karlsruhe, August 2022

*As the saying goes, the Stone Age did not end because we ran out of stones; we transitioned to better solutions. The same opportunity lies before us with energy efficiency and clean energy.*

Steven Chu

# **Contents**



# **List of Figures**




# **List of Tables**


# **Abbreviations and Symbols**

# **Abbreviations**




# **Symbols**







# **Operators**


# **Indices and Superscripts**





# **1 Introduction**

# **1.1 Motivation**

To limit the impacts of climate change societies around the world are putting forward large efforts to decarbonize their energy supply. In order to maintain social acceptance political authorities thereby always seek to keep the financial burden as low as possible [GCM17]. Thus, the following four measures have been partly, and further need to be, implemented to achieve the aforementioned goals:

First, a **CO**<sup>2</sup> **free supply with electricity and heat** needs to be achieved. Therefore, Renewable Energy Sources (RESs) such as wind, solar, biogas, hydro, marine and geothermal power plants are integrated into energy networks in large scale to decarbonize the energy supply. Renewable energy accounted for 12.6 % of the total energy supply in 2020 and more than 10 % of the electric power demand in 2021 worldwide [REN22]. However, the energy production of RESs is strongly volatile [LLJZ20] and largely decentralizes the power infeed into the energy systems [ZBC04], which necessitates further measures stated below. The decarbonization of District Heating Networks (DHNs) is achieved by installing Combined Heat and Power (CHP) plants, Heat Pumps (HPs) and Electric Boilers (EBs) which are then run with green gas and electricity produced by RESs [NMZ+16]. This intensifies the interaction of Electric Power Networks (EPNs) and DHNs [CWW+18b]. This coupling is further increased by utilizing the waste heat originating from the cooling of supermarkets [GS21a], data centers [LSG+17], and industrial processes powered by electricity [PSH20]. The possibility of using this (decentral) waste heat is a major driver to further expand existing DHNs and design new forms of DHN operation [LSG+17]. Already nowadays, the utilization of DHNs reduces the CO<sup>2</sup> emissions in Europe by 113 million tons per year, which sums up to 2.6 % of the European CO<sup>2</sup> emissions [LSZW15]. Thus, DHNs will play a central role in future energy systems [MD17].

Second, the **provision of flexibility** through storages, power plants and Demand-Side Management (DSM) is mandatory to match energy supply and demand in the presence of strongly volatile energy supply of RESs. Therefore, storage systems<sup>1</sup> are more and more integrated in the EPNs. Nevertheless, storing electric energy with high efficiency, low costs, and ecologic compatibility is still a major issue [ARRB16], [GT17b]. However, storing thermal energy over long, even seasonal, periods at low costs is comparatively simple [XWL14] and thus thermal storages are an inherent part of facilities and DHNs[CMT+17, p. 76]. Thus, operators of DHNs have been incentivized to construct large water storages in the last years in Germany

<sup>1</sup> For example battery power plants, pumped storage hydro power stations or compressed air energy storages. Other concepts such as the usage of electric vehicles [DTKM18], gravity storages [Fyk19], underwater hydro storages [KAA+19], chemical storages [DDKB+20], and thermal storages [SS18] are also being tested.

[CMT+17, p. 79]. Further, a large potential is seen in utilizing the thermal water storages in facilities. For example in Germany 90 % of the present buildings using a heat pump are also equipped with a thermal water storage [ZWW+21]. These potentials need to be made utilizable by creating incentives for facilities by adequate jurisdictions and market frameworks [CN17]. General benefits arising from flexibility provision by DSM include less needed generator capacities, reduced generation costs due to less fossil fuels needed to run stand by capacities, and thus also less emissions [Str08].

Third, the **prevention of network congestions** is a major task in the EPNs as the existing networks were planed based on scenarios with different energy flows<sup>2</sup> . Therefore, grid reinforcements are necessary to adjust the EPNs to the current and future power flows. However, these take long planning periods and are very costly. Alone in Germany around 70 billion euros are necessary for the extension of the transmission network until 2035 [Bun19b, p. 4] and another 54 to 75 billion euros for the distribution networks until 2050 [Ago19, p.10]. Thus, flexibilities already named above should not only be used to match demand and supply, but also to prevent congestions and thereby decrease the amount of necessary grid reinforcements. In this context, several studies have shown the effectiveness of optimally coordinating demand and supply of grid participants to reduce network reinforcements [CN17, p. 30].

Fourth, **avoiding economic and technical inefficiencies** is of central importance. Three aspects will be highlighted in the following. The prior and purely technical aspects regarded, are the heat losses in DHNs. Heat losses mainly occur in DHNs, based on the heat flow through pipeline insulation. As heat losses increase with rising difference between the fluid and the ambient temperature, these can be minimized by keeping the temperatures as low as possible [ZLG13].<sup>3</sup> Therefore, DHN operators aim to set the mass flows through the heat exchangers of Flexible Network Participants (FNPs) such that the temperature difference between supply and return network is maximized, and thereby the mass flows and the resulting pump costs are minimized [ZLG13]. These mass flows are adjusted by pumps, Differential Pressure Regulators (DPRs), their respective control paths, and valves. As heat losses are in the range of 12 % to 20 % [VSLD13, ÇYÇ04, LMMD10], an efficient operation based on variable mass flows and variable temperatures is of significant interest.

A further aspect causing technical and economic inefficiencies arises when market and control mechanisms work separately or uncoordinated. Cases, where market mechanisms implemented without fully integrating the control mechanisms can be found in electricity markets

<sup>2</sup> Thereby, it was assumed, that energy is produced in a few large central plants and then distributed to the consumers over hierarchical structured networks. However, in the meantime the majority of newly connected RESs feed power into distribution networks instead of transmission networks [CN17, p. 29]. Additionally, novel consumers such as HPs and Electric Vehicles (EVs) consume more electric power and do so simultaneously in the same regions. Also, different RESs types, as solar panels and Wind Power Plants (WPPs), each generate regional correlations in their respective power supply due to similar meteorological conditions. The interplay of these effects as well as new regulations enabling competitive energy markets with numerous new decentralized market participants creates a rising amount of network congestions in EPNs [PKK15].

<sup>3</sup> Supply network temperatures can only be reduced to a certain level in order to sufficiently supply the heat demand of customers.

cleared by uniform pricing. For example, in the European energy sector, electric energy markets are operated based on uniform marginal pricing<sup>4</sup> . Whenever the power flows resulting from their allocation lead to network congestions in Germany, a highly regulated redispatch procedure takes place which leads to uplift costs. Grid operators order redispatch and select suitable power plants. The units that are shut down receive compensation, while those that are started receive a corresponding payment. These additional costs are passed on to all electricity consumers as network fees [Bun18b]. The costs for these redispatch measures<sup>5</sup> have risen in the past decades and exceeded 1.4 billion euros in 2020 in Germany [Bun22]. Also, the high amount of necessary command and control instructions has led to very complicated scenarios for system operators, in networks operated by these markets mechanisms [MSC03].

Last but not least, the aspect of techno-economic issues created by a separate operation of each domain of a Multi-Energy System (MES)<sup>6</sup> has to be kept in mind. Energy converters that are connected to DHNs and EPNs as e.g. PtH plants, or Combined Heat and Power (CHP) plants, are usually operated heat-driven or power-driven<sup>7</sup> . This form of operation and the concomitant form of pricing of energy, leads to cross-subsidies from one energy network to the other. A well known example of this phenomenon is the alternative power method, where the prices in DHNs are dependent on the outcome of electricity markets [DLS+19]. More general, when heat markets and electricity market clearing processes affect each other, for example due to energy converters which take part in both markets, simultaneous clearing with instantaneous communication between both markets is of interest to obtain an overall optimal result. Otherwise, in the case of sequential clearing, the first clearing process is dependent on predicted information of the second clearing process, and the feasible region of the second market clearing could be unfavorably constrained [ZWW+21]. Further, a pure heat-driven or power-driven operation of energy converters neglects the ability to counteract contingencies in one of the connected network types. Besides, flexibilities existing in the DHNs, as large water storages [ZWW+21], pipeline storage capabilities [Ick95] and DSM can not be optimally utilized to support the EPN in matching supply and demand. Also, due to a lack of coordinated operation of DHNs and EPNs, wind power is curtailed in many cases which could have been used in PtH devices, to supply heat to DHNs [DF14, MKP20]. In addition to the aforementioned, Multi-Energy System (MES) also exploit better conversion efficiencies and increase the environmental performance [Man14]. In summary, the benefits resulting from a joint operation of Coupled Electric Power and District Heating Networks (CEPDHNs) and their markets are well documented [ZWW+21, WYJ+16, LSF14, DLS+19].

<sup>4</sup> Within every price zone.

<sup>5</sup> Including feed-in management, countertrading as well as procurement and usage of network reserves.

<sup>6</sup> Besides MES, further terms used in the same context are integrated energy systems [WYJ+16], multi-carrier energy systems [CWW+18a], and sometimes energy internet [ZLGZ17].

<sup>7</sup> These two forms of operation are also known as following thermal load or following electric load in the literature, see e.g. [LWW18].

Based on the above stated challenges in CEPDHNs, the following **beneficial properties** can be deduced to achieve a technically efficient and economically optimal operation of future CEPDHNs:


# **1.2 State of the Art**

To face the interdisciplinary context of the presented work, four different fields of research spanning optimal operation of CEPDHNs are stated here. It should be noted, that these research fields partly overlap, since they all deal with the same aim of optimizing FNPs in CEPDHNs. However, the individual approaches differ largely, due to assumptions on information sharing between entities as network operators, market operators, and FNPs, the regarded form of network operation, as well as the chosen objectives as e.g. cost minimization or social welfare maximization. The first group of papers tackles the cost minimizing operation of CEPDHNs. These approaches model cost minimizing scheduling and dispatch as performed by system operators. The second group of papers focuses on distributed operation approaches for CEPDHNs with the aim of enabling real-time implementation of large optimization problems through parallelization and/or protection of confidential information of system operators running connected and interacting systems. The third field of interest considers approaches for market-based operation of CEPDHNs. These papers focus on the market aspects and mechanisms relevant in the context of energy markets. The fourth and last cluster of the state of the art describes the most relevant and recent work within the field of Transactive Control (TC). The domain free concept of TC brings together market and control mechanisms to attain global objectives within energy system operations. Finally, the last part of this section gives a discussion of the content of the presented literature and describes the existing research gap. This comprises the missing full integration of market and control mechanisms, the insufficient CEPDHN modeling detail for efficient operation, and the lack of scalability of most optimal CEPDHN operation approaches.

<sup>8</sup> All network states are within operational boundaries provided in Section 3.3.1.

### **1.2.1 Cost Minimizing Operation of CEPDHNs**

The approaches presented within the section have been developed for cost minimizing scheduling and dispatch as performed by system operators. In this context, market mechanisms as e.g. different forms of pricing which are necessary in deregulated markets, are neglected. The operations mostly differ by the used CEPDHNs model, which lead to diverse classes of optimization problems solved by different methods. The following works are characterized by a high technical detail in comparison with the ones outlaid in the other three following subsections.

The authors of [GA07] identified the need for MES modeling and operation early and presented relevant work in the field of optimal dispatch of MES. Therein, they used purely stationary network models and the energy hub concept. This concept is also applied by the authors of [BHH+12] to provide DSM<sup>9</sup> . Herein mathematical models for different household devices and their respective demands are presented. These are used to formulate the optimization problem of a residential micro hub, with which different objectives as e.g. cost minimization or emission reduction can be pursued. The overall optimization problem of the residential micro hub is thereby formulated as a Mixed Integer Linear Programming (MILP) problem. The approach is demonstrated in simulations and with real prototypes. In this work, the heat loads are solely supplied by household devices. Energy hubs are a possible form of structuring models of entities as e.g. distribution networks, facilities or dwellings. Typically the power flows within the energy hubs are modeled as lossless and the power conversion between different energy carriers are modeled by conversion efficiencies. As this concept neglects operational constraints of the multi-carrier networks within the hubs and creates modeling overhead in the context of this work, it is not further regarded here.

An approach for the heat and power dispatch in a CEPDHN is proposed in [LWS+15]. Thereby, the operation costs of CHP units, of thermal plants, and the curtailment of wind power is minimized. The EPN is modeled based on a Direct Current (DC) power flow model, neglecting the reactive power flows and voltage magnitudes of real Alternating Current (AC) operation. The pressure losses within the DHN are calculated based on constant friction factor coefficients within the Darcy–Weisbach equation. Also, loops within the DHN are neglected, as no constraint is used to fix the pressure drops within a loop of the network. Mass flows throughout the network are modeled as being variable, whereas the mass flow direction remains fixed. To represent the thermal dynamics of the temperature fronts within the DHN, the authors base the thermal pipeline model on the node method [Ben91], which is presented in detail in Section 2.3.3. This results in a Mixed Integer Nonlinear Programming (MINLP) problem. To circumvent the MINLP, the authors propose a decoupled approach, where the complicating variables<sup>10</sup> are determined based on the results of the previous optimization. The solution is then obtained by several iterative optimizations and recalculations of the complicating variables. The authors assure, that this procedure shows good convergence in practical applications, even though a proof of convergence is still an open field of research. Information on

<sup>9</sup> An overview on the different forms of DSM, as energy efficiency, time of use, demand response, and spinning reserve is found in [PD11].

<sup>10</sup> These are integer variables here.

necessary Central Processing Unit (CPU) time for the calculations is not given. However, this work shows, how the storage capacity of the DHN pipelines can be used effectively to increase the economic efficiency of the entire CEPDHN operation.

The MINLP problem from [LWS+15] is reduced to a MILP problem in [LWW+15] by assuming a constant flow and variable temperature control (CF-VT) operation form. This approach is used to obtain the cost minimizing Unit Commitment (UC) solution of the regarded CEPDHN for different problems. These are a pure deterministic UC calculation of the entire CEPDHN, a separate master slave optimization of the EPN and the subsequent DHN optimization based on benders decomposition, and a robust optimization problem, which enables to take uncertainties of the wind power infeed into account.

A further unit commitment approach for optimal operation of a CEPDHN is presented in [GWL+17]. In this work, the thermal inertia of buildings is also used to lower the operation costs of the CEPDHN and to achieve a higher utilization rate of the wind power. Therefore, dynamic models are introduced to considered the thermal storage and loss of the buildings. The proposed MINLP problem approach is also based on the Constant Flow and Variable Temperature (CFVT) control mode assumption for the DHN and the EPN is modeled solely by a real power balance equation, omitting any further constraints as e.g. flow constraints. A case study of a real world radial CEPDHN is performed to show the functionality of the approach. CPU calculation times are not given.

In [WGJ+17] the fuel cost minimizing scheduling of a CEPDHN is performed by solving a MINLP. For that matter, the optimal interaction of CHPs, EBs, Thermal Energy Storage Systems (TESSs), and consumers is pursued. The authors describe the presented approach as a form of Model Predictive Control (MPC). The DHN is operated by the CFVT control strategy. Hence, all mass flows, incorporating their flow directions, are defined in advance while the temperatures are dependent on the MPC control signals. The EPN is modeled by linear power balance and flow constraints.

An integrated heat and electricity dispatch model is developed in [ZZZW18b], and implemented to minimize the daily operation cost as well as the wind power curtailment in the CEPDHN. The DHN pipelines are modeled based on the node method. The DHN is operated based on a special CFVT form, where the flow can be varied in advance for different time steps. The EPN is represented by a linear real power balance equation. Based on the aforementioned simplifications, the overall dispatch optimization problem is reduced to a large scale linear programming problem. This approach was extended in [ZZZW18a], by taking into account variable mass flows and the possibility of utilizing the thermal building inertia. As the auxiliary variables necessary for the node method seem to be predetermined in some way, the problem still remains a large scale linear programming problem. No information on the accuracy of the proposed models is given. Also the flow directions in the pipelines of the DHN are fixed, which is surprising, due to the variable flow control and the amount of producing units in the case study. However, the paper gives a good overview on the basic forms of DHN operation.

The nonlinear unit commitment problem solved in [LWW+19], with nonlinear constraints, is approximated to obtain a Mixed Integer Quadratic Programming (MIQP) problem. This is then solvable in a few seconds for a simple test system and within 15 minutes for larger test systems, considering uncertainty. However, no information of the model accuracy, e.g. by giving a comparison of the model output with measurement data is given. Further work with similarities to the above mentioned is found in [ZLZ+19, YCC+19].

A good overview on the modeling and solution methods for operational optimization of CEPDHNs , thereby named the Integrated Electricity and Heat System (IEHS) is given in [ZWW+21]. Important conclusions, which are given in this paper and concur with the analysis of the author of this work are: First, "the electrical, thermal, and hydraulic processes are tightly coupled in the IEHS, leading to a large computational burden for the integrated energy flow calculation"; second "nonlinear terms or non convex feasible region caused by device characteristics, network constraints, and optimization under uncertainty make the original problem computationally intractable"; third, "the time delays and thermal dynamic characteristics in the pipelines of the DHS are non-negligible"<sup>11</sup> .

The central assumption which strongly facilitates the original problem of efficient DHN, and thereby also CEPDHN, operation comprises a constant mass flow [HTWL19]. By consequence, this brings along a second assumption which is typically not valid in efficient DHN operation: Mass flow directions are predetermined before solving the optimal operation unit commitment or dispatch problem. This fundamental aspect is explained in the following Remark.

### **Remark 1.1:**

*As soon as more than one point of heat power infeed exists or the DHN has a meshed structure within the supply or return network<sup>12</sup> Varying Mass Flow Directions (VMFDs) can occur during network operation [Opp15, p. 75]. This is due to the fact, that the flow directions on DHN edges is dependent on valve and pump operation set points in DHNs, and these set points are varied by the network operators, producers and consumers.*

To the authors knowledge, the only two approaches published, which do not use these assumptions for optimal CEPDHN operation are found in [Trö99, HTWL19]. In [Trö99] an approach for the optimal dispatch of the producers of a DHN operator is presented. The chosen objective is to minimize the necessary energy purchase. Thereby, the interaction with the EPN is regarded to model the amount of produced electricity to enable economic assessment of different solutions. The approach enables to incorporate the storage capabilities of the DHN pipelines while regarding multiple producers at different locations within a meshed network. To represent the temperature dynamics in the case of VMFDs a pipeline model based on the linear interpolation of node temperatures as in [Ben91] is presented. However, this approach assumes a uniform flow direction for the entire prediction horizon, which creates deviations of the pipeline outlet temperature, when this assumption is not fulfilled. Necessary integer variables are approximated by continuous variables, utilizing additional nonlinear constraints. Also not continuous differentiable constraints, as e.g. with absolute value operators, are approximated by nonlinear continuous differentiable approximations. To reduce the computational burden of the proposed approach, stationary DHN models are used to calculate initial solutions. The non stationary thermal variables of the stationary solution are then recalculated based on a dynamic simulation model. The resulting values are then utilized as the starting points for the overall Nonlinear Programming (NLP) problem.

<sup>11</sup> District Heating System (DHS).

<sup>12</sup> DHNs are typically constructed symmetrically. However, it is important to note that the meshes occur within the supply or return network as, when taking both network parts into account, every DHN is of meshed structure.

The approach in [HTWL19] is proposed for economic dispatch of a CEPDHN , where VMFDs are taken into account in the DHN . Therefore, first a complex non-convex MINLP model is established, which is then approximated by a Mixed Integer Conic Programming (MICP) problem. This new convex model problem can then be solved efficiently by standard of the shelf solvers. The initial nonlinear model is of stationary form and thus disregards the propagation of the temperature fronts through the DHN pipelines. Also the friction factor in the Darcy-Weisbach equation is modeled by a constant coefficient, which is a strong assumption as will be shown in detail in Section 2.3.2. Further, if storages are charged or discharged has to be defined before the optimization, as this defines their outlet temperature. The EPN is modeled by a DC line flow model. Determining the accuracy of the proposed approximated model is left for future work.

### **1.2.2 Distributed Operation of CEPDHNs**

The literature summarized within this section is based on multiple distributed controllers operating CEPDHNs. Note, that in this work the terms **distributed** and **decentralized**, are defined as follows<sup>13</sup> .

### **Definition 1.1**

*A distributed control approach contains multiple local controllers which share information, while no centralized authority is in charge for this task. In contrast to that, decentralized control comprises subsystems, which are controlled independently by not communicating controls [Lun14a].*

The motivation for distributed operation approaches typically comes from at least one of the following five reasons: First, the large number of FNPs, needs parallel computation in order to solve the resulting large scale optimization problems. Second, the burden of communication increases with larger distance and amount of the individual entities. Third, a central control unit would need frequent redesign, as a change in a single element would require adaption. Fourth, information exchange may be nontrivial due to unwillingness<sup>14</sup> or lack of means, also aspects of cybersecurity become more relevant if data is accessible at many different points. Fifth, a central controller is more vulnerable, due to a single point of failure [YMS14, MDS+17].

Early work in this field was published in [GHVO96]. Therein, the heat and power dispatch are performed in two sub problems, which are coupled through the feasible region constraints of possible heat-power production of the co-generation units. Through the exchange of information the two sub problems converge to the global solution. As well the EPN and the DHN are represented by power balance equations.

<sup>13</sup> Throughout the literature concerning the optimal operation of CEPDHN, the terms **distributed** and **decentralized** are used by different authors describing the same ideas. This results from the fact, that different criteria, as e.g. demand for communication or the location of necessary hardware, is utilized to decide if an approach is decentralized or distributed. Within this work we use the definitions coming from the control theory background [Lun14a]. However, this definition is also used frequently in power engineering, see e.g. [YMS14].

<sup>14</sup> For example, the EPN and the DHN can belong to different operators [ZWW+21].

In [Arn11] a Distributed Model Predictive Control (DMPC) approach is presented to solve the optimal dispatch of energy hubs in different control areas. The power and gas networks between the hubs are represented by stationary models as in [GA07]. Heat flows and the system dynamics representing storage devices are considered only within the hubs. The Optimality Condition Decomposition (OCD) approach is used to decompose the global dispatch problem into a distributed multi-area optimization problem.

In [LFZC16] a new nonlinear CEPDHN dispatch model is presented together with a new distributed algorithm for the calculation of the optimal solution of the distributed dispatch of the DHN and the EPN. The EPN model is based on the accurate AC power flow model. However, the DHN model uses several new component models, while a validation of the model is missing. The general convergence properties of the developed distribution approach are not given.

A combined heat and power ED approach is given in [LWZS17]. Based on a constant mass flow and constant load assumptions for the DHN and a DC power flow model the overall ED problem can be formulated as a Quadratic Programming (QP) problem. The central problem is solved in distributed form by the DHN and EPN operators using benders decomposition. In every iteration, the EPN operator will calculate boundary variables, by performing an optimization, and communicates these to the DHN operator. Then, the last mentioned calculates the optimal DHN dispatch, based on constant boundary variables. These results are then used, in different forms in case of feasibility or infeasibility of the DHN dispatch, to initialize the next iteration of the EPN dispatch. Based on this, the solutions converge to the same solution as the central problem. The authors show, that the benders decomposition performs better than the Alternative Direction Method of Multipliers (ADMM) in their case study. However, the central problem calculation converges faster in the large scale problem in the presented simulations. This could arise from the fact, that benders cuts can offer few information on the central problem, which can result in weak convergence properties [LGZ+19].

The contributions of [HLW17] are threefold. First, the coordination framework for a CEPDHN is proposed with multiple DHNs and a single EPN, with their respective operators. Second, a convex economic dispatch optimization problem for the overall CEPDHN is formulated. Third, a distributed solution scheme, based on Optimality Condition Decomposition (OCD) is introduced. For that matter, the EPN and DHN operators communicate real power flow values over the tie lines, the phase angles of their respective buses and the Lagrange multipliers of the complicating constraints. The decomposition over electric tie lines has already been performed before, e,g. in [Arn11]<sup>15</sup>. As the central ED optimization problem is convex, convergence of the OCD procedure is guaranteed. However, the convexity is only achieved, by assuming constant mass flows and a DC power flow model.

The distributed optimization in the following papers [XWZ+19, LGZ+19, TWW+20] is based on the Alternative Direction Method of Multipliers (ADMM) . All of these papers use the constant mass flow operation form for the DHN operation. The EPN models are based on linearized AC branch flow models [XWZ+19], real power balance equations [LGZ+19], and a DC power flow model [TWW+20]. The entire non-convex MINLP CEPDHN scheduling

<sup>15</sup> Herein, different variables are shared among the areas, due to a slight different formulation of the problem

problem proposed in [XWZ+19] is reformulated as a Mixed Integer Second-Order Cone Programming (MISOCP) by replacing the nonlinearities by approximations. This problem is then decomposed into sub problems using the ADMM approach. To avoid the non convexities coming from the remaining integer variables, the MISOCP sub problems are then solved by further decompositions. The authors of [TWW+20] performed multiple optimizations with different time step intervals in order to understand the computational impact of this parameter choice. Based on their calculations, they propose 30 to 20 min as a good time interval for their multi period optimal CEPDHN dispatch, solved with the ADMM parallel computation approach. In [TWW+20] a Locally Adaptiv ADMM (LA-ADMM ) approach is introduced to improve the convergence properties of the basic ADMM algorithm. No information is given on the accuracy of the proposed models used in the three previously discussed papers [XWZ+19, LGZ+19, TWW+20].

### **1.2.3 Market-based operation of CEPDHNs**

The presented works in the following focus on the economic issues arising in optimal coordination for CEPDHN operation. Thereby, game theoretic methods, emerging market equilibria, arrangement of pricing mechanisms, and the interplay of DHN and EPN market operators are designed and analyzed.

Aggregators are envisioned in [SDWS17] to supply consumer heat and power demand at low prices. Therefore the aggregators are enabled to adjust the consumers demand<sup>16</sup> in order to minimize the energy purchase costs. Further it is assumed, that the entire CEPDHN is operated by a single Independent System Operator (ISO). The ISO maximizes the social welfare based consumer and aggregator bids. The entire energy dispatch, modeled as two-level optimization problem, is analyzed in case studies showing the efficient integration of wind power through flexible demand. The authors assume constant supply temperatures and variable mass flows, using a stationary DHN pipeline model and the EPN is modeled as a single node by a power balance equation.

The energy trading market equilibrium in a CEPDHN is determined in [CWL+18]. Optimization problems are developed for the analysis of the market impact of strategical behavior of producers and flexible consumers. The power distribution network market is cleared based on an AC flow model, which takes losses into account. For the DHN market clearing a CFVT DHN operation mode is used.

Similarly, in [LWM+18] a mathematical program with equilibrium constraints is introduced to analyze the strategic behavior of energy hubs in deregulated day-ahead heat and power markets with game theoretic methodology. In this context, the authors propose to use the pay-as-bid pricing method. The DHN model is based on a linear thermal flow model resulting from the constant mass flow assumption. The EPN representation is based on a linearized branch flow model.

<sup>16</sup> Also known as Direct Load Control (DLC) [PD11].

The parallel distributed dispatch of a DHN and an EPN, which are coupled to a CEPDHN is presented in [CWW+18b]. The optimal thermal flow problem of the DHN incorporates variable temperatures and variable flows. Also VMFDs can be represented in the model, but not within the DHN dispatch. The market driven approach presented, determines the prices, here Locational Marginal Prices (LMPs), by which the EPN and DHN operators sell heat or power to the other operator. Also the electric and heat power production of CHPs and HPs, owned and operated by either of the two operators, is determined in this fashion. Due to convergence problems, the authors utilize a continuous LMP demand curve approximation to overcome occurring oscillations. The approach exchanges similar information between the two network operators as the OCD approach in [HLW17], but the complicating constraints are not relaxed to the objective functions of the other operator17. Thus, this additional information, used to calculate the search direction, which is used in the OCD approaches, as depicted in detail in Section 3.3.2, is left out here.

In [DLS+19] the Locational Marginal Pricing Approach (LMPA), which has been extensively studied and used for electric energy markets is extended to heat markets. More detailed, the effect of transmission delay of DHN pipelines on the LMPs is analyzed. The authors conclude, that the LMPA can be also used for DHN pricing, advancing its well known benefits to the entire CEPDHN. The authors use a constant flow assumption for the DHN within their work.

The work in [MKP20] and [ZH21] propose a sequential clearing of the heat and power markets. In [MKP20] the heat market optimization problem takes the electricity market clearing into account, in order to obtain a high level of coordination in the clearing of the two independent operated markets. The authors developed this approach as a trade-off between state of the art uncoordinated market clearing and a fully integrated heat and power market, which would need very strong adaption of jurisdictions based on the authors estimate. The decomposed clearing is achieved by utilizing the benders decomposition. Based on case studies, the authors show, that the stronger market coordination enables a maximization of RESs power infeed. In contrast to this, the authors of [ZH21] propose to clear the power market before the DHN operators decide on their optimal schedule. Therein, price incentives are used to motivate the DHN operators to fully exploit the pipeline storage capabilities. The optimal thermal flow problem used for the DHN optimization is based on the CFVT operation mode.

The approaches presented in the first three fields of literature above, bring along a stronger focus on either the technical operation or the market mechanism design. An approach that regards both aspects in an integrated form is TC.

### **1.2.4 Transactive Control**

This section, presents the most relevant literature in the field of TC. In the context of the aforementioned challenges, see Section 1.1, neither control nor market mechanisms alone can provide the essential basis for efficient economic and secure<sup>8</sup> CEPDHN operation. In this context, the concepts of Transactive Energy (TE) and TC have been developed [KW16]. These are defined as:

<sup>17</sup> Even though the Lagrange multipliers, here named LMPs, are used within the objective functions of the opposed network operator.

### **Definition 1.2**

*Based on [Cou15], TE is "a system of economic and control mechanisms that allows the dynamic balance of supply and demand across the entire electrical infrastructure using value as a key operational parameter."*

### **Definition 1.3**

*The concept of TC [LLJZ20] is "a domain-free approach that integrates market-based coordination and value-based control for a group of resources to achieve certain global objectives."*

Thereby, value is usually understood as market price [LLJZ20]. In this sense, TC enables, optimal coordination of FNPs while considering privacy18[KW16, LLJZ20], overcoming the disadvantages of earlier concepts such as direct load control and price-responsive control, as the former does not consider user preferences and the latter lacks predictability of the load response [LLJZ20]. When TC is applied to an EPN, it is usually referred to as a TE system [LLJZ20], studied in a large number of papers, as summarized in [LLJZ20, ALFV19, LWHZ17]. As stated in [LLJZ20] TE, and therefore also TC, is characterized by: "the following distinctive features":


These features distinguish TC approaches from the three aforementioned fields of research for optimal CEPDHN operation (cost minimizing operation, distributed operation, and marketbased operation). Still, some of the distributed operation approaches presented in Section 1.2.2 try to provide scalability and most of the market-based operation approaches discussed in Section 1.2.3 take bidding consumers into account. But none of the presented approaches of the aforementioned fields brings together all of these distinctive features.

Due to the fundamental difference of the underlying physics, in network operation of EPNs and DHNs, such as relatively slow propagation of energy and the potential to store energy within DHNs, it is not possible to apply TC approaches developed for EPN operation to DHNs. Furthermore, as opposed to TC for EPNs , TC approaches for CEPDHNs have not been fully studied, as the application of TC techniques to multi-energy systems is relatively new. For example, in [BCDC18], thermostatic loads of heat pumps and air conditioners are operated based on the TC paradigm, while maintaining comfortable temperatures. A TC modeling and

<sup>18</sup> The aspect of privacy regarded here is [KW16]: "the approach protects the end user's privacy as the bids communicate only information about energy quantities and prices."

assessment framework for distributed multi-energy systems is presented in [GCHM19]. The authors of [WJH+19] propose a double auction retail market framework to enable optimal supply and consumption with electricity and heat. A form of the ADMM is used in a TC system to coordinate the distributed energy sharing among multi-energy micro grids in [YHA+20] and [XZL+20]. A double stage stochastic approach, which allows thermal energy storages of buildings to manage the uncertainty resulting from energy procurement in a TC context, is reported in [YP21]. Finally, a TC approach based on peer-to-peer transactions in the context of multiple energy hubs, with multiple energy carriers and high infeed of RESs, is discussed in [GYYW21].

However, these papers do not discuss issues associated with market-based operation that considers the relevant physical aspects of efficient CEPDHNs operation. In general the presented TC papers use very simple CEPDHN models, mostly neglecting thermal flows within the DHNs.

### **1.2.5 Discussion and Research Gap**

A discussion of the above presented literature and a derivation of the research gap thereof is provided within this section.

Existing models for optimal operation of CEPDHNs suffer from unjustified simplifications. The following assumptions are questionable in real world examples:


**Figure 1.1:** Example DHN with four nodes, two consumers and two producers.

• A radial and lossless DC EPN model is used. These assumptions help to avoid nonlinear and non-convex AC power flow equations. Still, electric distribution networks line losses should be taken into account [CWL+18] and meshed structured distribution networks exist as well.

Using the aforementioned simplifications enables to avoid non-convex and nonlinear constraints and integer variables within the optimization problems. However, not considering relevant physical effects may have severe consequences on technical efficiency and the market outcome. Exemplary direct consequences of the assumptions above on technical efficiency and market clearing are:

• Constant mass flow: In this case the valves and pumps are all modeled as operated at predefined set points and therefore for example a consumer can not increase its power consumption, as the maximum power consumption is defined by the supply network temperature and the fixed mass flow passing through the heat exchanger of the consumer. Similarly, this limits the possible variation of heat power supply of the producers. This does not only prevent ideal coordination of supply and demand for example through DSM, but it also has a large impact on the technical efficiency of the DHN as explained in [MTK+22, pp. 6-7]. Heat losses mainly occur in DHNs, based on the heat flow through pipeline insulations. As heat losses increase with rising difference between the fluid and the ambient temperature, these can be minimized by keeping the temperatures as low as possible [ZLG13]<sup>19</sup>. Therefore, DHN operators aim to set the mass flows through the heat exchangers of consumers and producers such that the temperature difference between supply and return network is maximized, and thereby the mass flows and the resulting pump costs are minimized [ZLG13]. As heat losses are in the range of 12 % to 20 % [VSLD13, ÇYÇ04, LMMD10], an efficient operation based on variable mass flows (and variable temperatures) is of significant interest.

<sup>19</sup> Supply network temperatures can only be reduced to a certain level in order to sufficiently supply the heat demand of customers.


None of the presented papers presented in the previous Sections 1.2.1 to 1.2.4, addressed the full necessary technical detail needed to achieve technical efficient and economic optimal CEPDHN operation. Thus, the second beneficial property, stated in Section 1.1, is so far not fulfilled within the state of the art.

### **Remark 1.2:**

*As discussed here, the optimization problem for market-based operation is either described by a significantly simplified convex model or by an accurate non-convex model. Based on the aforementioned, one cannot guarantee in practice finding the Pareto optimal solution for the real problem. When referring to economic optimal solutions in this work, this always refers to a welfare maximizing solution of the given optimization problem. If this is obtained by a non-convex optimization problem, it should be kept in mind that this solution does not have to be the Pareto optimal solution, as it could represent a local optimum.*

Further, on the one side the more technical work presented in Section 1.2.1 and 1.2.2 lack the joint design of market and operational mechanisms, as the scope of these papers is not set towards economic issues. On the other side, most of the more economically oriented approaches presented in Section 1.2.3 and 1.2.4 cannot guarantee optimal spatial and temporal coordination of the FNPs as well as secure network operation<sup>8</sup> , due to the strongly simplified network models. Therefore, the third beneficial property, deduced in Section 1.1, is not reached in the current literature. Still, market and control mechanisms have strong mutual interdependencies. Just to name a few, for example, pricing mechanisms will affect the Market Participants (MPs) bidding behavior, and thus the amount of power dispatchable at a certain point of time and a certain location. Further, defining prediction horizons and time step intervals in TC approaches, will directly impact the bid structures, the dispatch results and thereby also again the market prices. Also several interrelations of market and control mechanisms, explained in detail in Chapter 3, can on the one side limit the applicability of certain approaches, and on the other side increase the performance of the Transactive Control System (TCS) if adequately employed. Therefore, designing these market and control mechanisms in a joint coordinated process is a key element to achieve technical efficiency and economic optimality at the same time.

Distributed operation approaches, can help to overcome the computational burden of operational optimization of large CEPDHNs with numerous FNPs and hence enable scalability. A large amount of literature is found, proposing approaches for the distributed optimization of EPNs, see [MDS+17] for a review. However, so far the proposed distributed CEPDHN operation approaches, stated in Section 1.2.2, only decompose the CEPDHNs along EPN tie lines or the energy converters between DHNs and EPNs. The decomposition within DHNs is still to be performed. To the best of the authors knowledge the only approach provided so far is based on a MILP optimal DHN operation model [KMHG21]. Thus the authors of [ZWW+21] stated this as future work: "In solution methods for decentralized optimization, decomposition scheme suitable for more complex coupling constraints need to be exploited".<sup>20</sup> Note, that a clear motivation for distributed DHN operation approaches arises from the high computational cost of detailed DHN models [ZWW+21], as well as the simulation results from large real world DHNs, in Chapter 4.

To overcome the challenges stated in Section 1.1 it is of high interest that future CEPDHN operation approaches enable scalability, ensure secure network operation, coordinate FNPs in EPNs and DHNs spatially and temporally, prevent technical inefficiency, and provide market and control mechanisms that interact in a joint concerted form. Thus the research gap, defined by the deviation between these beneficial properties to the status quo and the current literature can be summarized as follows:

### **Research Gap:**

	- *a) The necessary technical modeling detail for efficient CEPDHNs operation, is not reached within the state of the art on model-based CEPDHNs operation.*
	- *b) The technical modeling detail directly impacts the market outcome. This aspect has not been sufficiently addressed within the state of the art on CEPDHN operation.*

<sup>20</sup> Note, that the authors definition of *decentralized*, corresponds to the definition of *distributed* used within this work.

# **1.3 Research Objective and Statement of Contributions**

In order to bridge the outlaid research gap, the objective and main contribution of this thesis is:

### **Contribution 1:**

*The design of a new TCS for CEPDHNs. Thereby, bringing together market and control mechanisms in a form that enables a technically efficient and secure<sup>8</sup> operation for future CEPDHNs. Additionally, the proposed TCS enables parallelization of computations by applying a distributed optimization approach.*

The contributed approach is designed based on a TC framework as the aforementioned is best suited to provide the beneficial properties listed in Section 1.1. This is due to the fact, that distinctive features of TC approaches are the ability to coordinate supply and demand through market interactions, while providing control signals coordinating large numbers of FNPs to respect energy system operation constraints, enabling scalability and additionally providing salient features as privacy preserving information exchanges of smart energy management systems [KW16, LLJZ20]. Still, different TC approaches can vary strongly, see [LLJZ20]. Therefore, Contribution 1 comprises the definition of entities and their respective information exchange, the design of complementary market and control mechanisms, and the embedding in ambient control loops existing in EPNs and DHNs. As the chosen control mechanism is a distributed optimization based rolling horizon implementation, an important design criterion is the selection of an appropriate distributed optimization approach for NLP problems. Contribution 1 is presented in Chapter 3 and its application is demonstrated in Chapter 4. Note, that the central Contribution 1 is build upon two further contributions stated below, as depicted in Figure 1.2 showing the relation of the four contributions of this work. Within this TCS ap-

**Figure 1.2:** The relation of the four contributions of this thesis. Contribution 1 is built upon Contributions 2 and 3. Further, Contribution 4 is also based on Contribution 2.

proach, an adequate model of the CEPDHN is of high relevance in order to guarantee secure<sup>8</sup> and efficient CEPDHN operation based on calculations that can be performed at runtime.

Thus the second contribution of this thesis is:

### **Contribution 2:**

*The composition of a novel detailed CEPDHN model for operational optimization. This model avoids the questionable simplifications discussed in Section 1.2.5.*

The tradeoff between computational burden and exactness of representation of physical effects lead to a nonlinear non-convex model, in which several variables are approximated by parameters which are adequately precalculated. While for several components of the CEPDHN the selection of an adequate model is performed by using models based on existing literature, a quantitative and qualitative comparison of existing dynamic thermal DHN pipeline models performed by the author in [MRMH21] showed that no DHN pipeline model fully suits the requirements. In this context, the main requirement is a high model accuracy as pipelines are the most common components and therefore imprecise models can lead to significant subsequent errors. Besides, the ability to take into account pipeline storage through dynamic models and the potential to incorporate VMFDs are important. Last but not least, the computational cost is to be kept limited. The newly developed dynamic DHN pipeline model, which is presented in Section 2.3.3 suits these requirements, and is designed to optimally fit within the control mechanisms. Furthermore, the overall CEPDHN model is able to take into account Variable Flow and Variable Temperature (VFVT) operation conditions with VMFDs, the dynamics of temperature front propagation, control of active hydraulic components as pumps, valves and DPRs, and the full AC power flow. Contribution 2 is presented in Chapter 2.

Also, different pricing mechanisms are compared for their suitability for coupled CEPDHN market clearing within the newly developed TCS. As no existing pricing mechanism is optimally suited for the given problem, a new pricing approach was developed, thus the last contribution is:

### **Contribution 3:**

*A new hybrid pricing based mechanism for coordinated CEPDHN market clearing, in order to facilitate incentive compatibility while preventing uplift costs from redispatch.*

A detailed description of this approach is given in Section 3.2.3. Further, note that simulational results demonstrating the effectiveness of the stated contributions are presented in Chapter 4.

The last contribution of this work is:

### **Contribution 4:**

*A distributed optimal operation approach for DHNs based on OCD.*

As described in detail in Section 3.3.2, OCD is well suited for the implementation of distributed optimal dispatch problems of EPNs. When applying OCD to DHNs, the symmetric structure of supply and return networks, and especially the representing network models are nontrivial to decompose into sub problems. Thus, the key challenge is to find a form of decomposition that reduces the coupling between the subproblems, in order to enable the distributed approach to converge to the same solution as a central optimization. At the same time, the proposed reformulation enables to take all physical constraints into account, while preventing the elimination of all degrees of freedom of the underlying models of the small subproblems. This was achieved by an appropriate reformulation of the initial optimal dispatch problem for DHNs, developed within Contribution 2. Based on the aforementioned, the application of OCD is demonstrated and the limitations of the approach are discussed. The methods are presented in Section 3.3.2.

# **1.4 Structure and Notation**

In order to provide readability and orientation, the notation and structure of this work are provided below.

### **1.4.1 Structure**

The introduction, stated above, is followed by the three main chapters. Chapter 2 presents the CEPDHN model, which comprises the EPN model, the EC models, and the thermal and hydraulic DHN models. All of these models, are optimally suited for utilization in the TCS system which is introduced in detail in Chapter 3. Therein the market and control mechanisms are designed in a coordinated form. This includes different pricing strategies, the control approaches, as well as presenting different distributed optimization algorithms. This is followed by a variety of case studies in Chapter 4, showing the practical usefulness of the newly developed TCS to different CEPDHNs, indicating various aspects of the market based operation as for example loss reduction, providing flexibility, computational burden and price signals arising from the selected pricing mechanism. Finally, the main conclusions of this work are drawn together in Chapter 5.

### **1.4.2 Notation**

Matrices and vectors are written in bold symbols. For notational simplicity, the vertical concatenation of (row) vectors is written as e.g. x all = - x za , x zb instead of the formal correct form x all = - (x za) <sup>⊤</sup>,(x zb) ⊤ ⊤ .

The gradient of function f of a stacked vector - x za , x zb is written as ∇f[xza,xzb] , while the second-order derivative of f of x za and x zb is written as ∇<sup>2</sup>fxza,xzb = ∇xzb (∇xza f).

If not further clarified, all variables and parameters are real-valued. Complex symbols are written in underlined form, e.g. the admittance Y . Indices and superscripts written in italic form represent variable entries, while non italic superscripts represent identifiers.

# **2 Modeling of Coupled Electric Power and District Heating Networks**

Representing CEPDHNs in adequate models for operational optimization is a complex task, as the characteristics of CEPDHNs bring along [ZWW+21]: "a large computational burden and nonlinear and non-convex properties." Thus, the combination of suitable component models, representing the relevant physical effects while preserving real time computation is of central importance for this work. After an introduction, focusing on the main physical effects in CEPDHNs and the properties of the EPN, the DHNs, and the Network Participants (NPs), the single components will be presented. Note, that NPs include producers, consumers, storages and energy converters between the EPN and the DHNs. All together, these models form a new detailed CEPDHN model for the TCS presented in this work.

The following Remark 2.1 helps to understand the aim of the model design and the terminology used within this chapter:

### **Remark 2.1:**

*The TCS design is based on a model-based rolling horizon<sup>21</sup> approach. The basic idea of this control mechanism is to carry out an optimization, based on a dynamic system model, of the CEPDHNs, to determine the optimal control values. The optimization problem solved for every time step* k *takes into account all time steps on the rolling horizon* k ∈ Sk*. Then the control values of the last optimization are sent to the controlled units, measurement data is used to update the system state variables, the rolling horizon time shift is performed and the optimization is carried out again. This procedure is continuously repeated during system operation. Since the presented model can also be used to simulate CEPDHNs, when the control values are entered as predetermined parameters, the term simulation horizon will be used in the same sense as prediction horizon in the following descriptions.*

The presented overall CEPDHN model enables efficient operation through high technical detail, while maintaining computability, forming Contribution 2 of this thesis. Parts of this chapter have been published in [MEKH18, MRMH21], and [MTK+22].

Within this work, the CEPDHN is modeled as a combination of multiple directed graphs. Therein, the EPN and each DHN are modeled as a directed graph. These initially separated graphs are coupled through ECs, which represent a subset of the NPs, connecting buses of the EPN and respective edges in the DHNs, see Figure 2.1. The DHN network graph elements, are defined by the set of all edges e ∈ S dhn e and all nodes i ∈ S dhn i . Due to the interplay of supply and return networks, these DHN graphs are strongly connected<sup>22</sup>. The connectivity

<sup>21</sup> Also known as receding or moving horizon [Arn11].

<sup>22</sup> If only the supply network is regarded, the directed graph becomes weakly connected.

**Figure 2.1:** Exemplary network of the entire CEPDHN structure.

of nodes i and edges e within a DHN is defined within the DHN node edge incidence matrix A dhn, defined as23:

$$A\_{i,e}^{\text{dhn}} = \left\{ \begin{aligned} 1, \text{if } e \text{ is directed towards } i, \\ -1, \text{if } e \text{ is directed away from } i, \\ 0, \text{if } e \text{ is not connected to } i, \end{aligned} \right\} \forall i \in \mathbb{S}\_i^{\text{dhn}}, e \in \mathbb{S}\_e^{\text{dhn}} \tag{2.1}$$

Note, that the EPN node edge incidence matrix A epn is modeled similarly, by exchanging the respective sets in equation (2.1) to the set of all buses of the EPN S epn i and the set of all edges of the EPN, specifically S epn e . The EPN graph spanned up by A epn is assumed to be a weakly connected graph, thereby the case of multiple unconnected power grids is neglected.<sup>24</sup>

<sup>23</sup> For notational simplicity and without the loss of generality, the DHN model given within this chapter is limited to a specific DHN, leaving aside ability to distinguish between multiple DHNs.

<sup>24</sup> This does not represent a major limitation of the approach as islanded micro grids represent an absolute minor part in the German and central European power supply, which is considered as the focus of this work.


**Table 2.1:** Signal propagation compared for different physical values relevant in CEPDHN models [Ill20, p. 15], [SGS+17, p. 3015], and [Opp15, p. 25].

The connections of NPs, which are either linked to edges in the DHNs, buses in the EPN or to both if they represent energy converters, are described in the bus-NP incidence matrix25,26 , for the EPN Mepn and the edge-NP incidence matrix for the DHN Mdhn :

$$\begin{aligned} M\_{i,n}^{\text{exp}} &= \begin{cases} 1, & \text{if } n \text{ is a network participation connected to } i, \\ 0, & \text{else}, \end{cases} \\\ M\_{e,n}^{\text{dhn}} &= \begin{cases} 1, & \text{if } n \text{ is a network participant connected to } e, \\ 0, & \text{else}, \end{cases} \end{aligned} \tag{2.2}$$

Therein, all network participants n are accumulated in Sn. Based on the above mentioned, the entire CEPDHN structure is defined as shown in Figure 2.1.

An important physical aspect for CEPDHN models for operational optimization is the large difference in signal propagation of voltages, pressures and temperatures as stated in Table 2.1: Typical time step intervals of operational optimization of EPNs and DHNs , as economic dispatch with elastic demand, are within the scale of several minutes [LGZ+19]. By taking into account the propagation times from Table 2.1, it can be deduced that the EPN and the hydraulic effects of the DHN can be modeled in stationary state27, while the propagation of thermal fronts needs to be represented by dynamic models, to prevent suboptimal or infeasible solutions within operational optimization approaches. This is a common assumption used in modeling of DHNs [ZWW+21]. A further important difference between DHN and EPN models, that is given in Table 2.1 is the fact, that DHN models possess two effort variables, pressure and temperature, while in contrast these are only represented by voltages in EPNs. Of course, apart from the mentioned differences, several obvious parallels exist between the stationary hydraulic DHN and the EPN models, as e.g. the Kirchhoffs circuit laws are similarly repre-

<sup>25</sup> Note, that in general NPs could also be modeled as connected to nodes in the DHNs. However in this case the return network and the DHN components between the return and the supply network as e.g. heat exchangers, pumps, and valves, would have to be neglected.

<sup>26</sup> Note that power flows from the DHN to the EPN are not precluded by the modeling approach, but do not play a relevant role in the practical cases regarded here.

<sup>27</sup> Since e.g. dynamic frequency or pressure regulation are not performed in this time scale and the respective transient effects are thus neglectable provided adequate controls for the before mentioned.

**Figure 2.2:** Infinitesimal element of length dx of transmission line of network edge e [GECC18, p. 68]. The superscripts f and t of voltages V and currents I label the two ends of the transmission line, representing *from* and *to*. For usual power lines, the shunt conductance G′ is neglectable [Kun93, p. 204], which is why it is only indicated in this Figure.

sented within the hydraulic models, as depicted in the following of this chapter. All model components of the CEPDHN model for operational optimization are given in detail below.

# **2.1 Electric Power Network**

This section describes the EPN model used within the TCS for CEPDHNs. The modeling of power flows in EPNs is a well studied field. Several well known models exist, which represent the power flows over transmission lines between network buses. These models differ in DC vs AC, transmission vs distribution, convex vs non-convex, linear vs nonlinear, limited to radial vs applicable to meshed network structure, and lossy vs lossless network representation, see e.g. [MDS+17]. Since the energy converters, see Section 2.2, are connected to electric distribution networks [CWL+18], this work focuses on electric distribution systems<sup>28</sup> within the CEPDHNs. The subsequent Sections 2.1.1 until 2.1.3 present the used transmission line, bus, and overall network model.

### **2.1.1 Transmission Line**

Assuming balanced and sinusoidal steady-state conditions<sup>29</sup>, electric transmission lines, can be modeled as an infinite sequence of infinitesimal elements of length dx, as illustrated in Figure 2.2 [GECC18, p. 68]: where the parameters of the series resistance R′<sup>30</sup>, the series inductance L ind′ , the shunt conductance G′ , and the shunt capacitance C ′ are all defined per length and per phase.

<sup>28</sup> Leaving electric transmission networks aside.

<sup>29</sup> The later can be derived from Table 2.1.

<sup>30</sup> Note, that indices are only provided with the respective symbols in the text, if they are of relevance within the explanation.

**Figure 2.3:** π-equivalent circuit of a transmission line using lumped parameters, see e.g. [Kun93, p. 207].

Based on the parameters, the serial impedance Z ′ and shunt admittance Y ′ per length and phase for every edge e of the set of all EPN edges S epn e are defined by [Kun93, p. 202]:

$$
\underline{Z'\_e} = R'\_e + j\omega L^{\rm ind'}\_{\ e}, \quad \underline{Y'\_e} = G'\_e + j\omega C'\_e, \quad \forall \ e \in \mathbb{S}^{\rm open}\_e \tag{2.4}
$$

Based on the aforementioned, the characteristic impedance Z char and the propagation constant γ pc are calculated by[MBB11, p. 66]:

$$
\underline{Z}\_e^{\text{char}} = \sqrt{\frac{\underline{Z}\_e'}{\underline{Y}\_e'}}, \quad \underline{\gamma}\_e^{\text{pc}} = \sqrt{\underline{Z}\_e' \underline{Y}\_e'}, \quad \forall \, e \in \mathbb{S}\_e^{\text{epn}} \tag{2.5}
$$

Using lumped parameters for a given transmission line e of length Le, the simplified πequivalent circuit, as shown in Figure 2.3 can be stated, with the π-equivalent impedance Z π e and admittance Y π e given by [Kun93, p. 207]:

$$
\underline{Z}\_e^{\pi} = \underline{Z}\_e^{\text{char}} \sinh\left(\underline{\gamma}\_e^{\text{pc}} L\_e\right), \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\text{epn}} \tag{2.6}
$$

$$\frac{\underline{Y}^{\pi}}{2} = \frac{1}{\underline{Z}\_e^{\text{char}}} \tanh\left(\frac{\underline{\gamma}\_e^{\text{pc}} L\_e}{2}\right), \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\text{epn}} \tag{2.7}$$

Based on the aforementioned, the transmission line admittance matrix Y trl <sup>e</sup> of network edge e can be calculated by:

$$\underline{\mathbf{Y}}\_{e}^{\mathrm{trl}} = \begin{bmatrix} \frac{\underline{I}^{t}}{\underline{V}^{t}} \Big|\_{\underline{V}^{t}\_{e} = 0} & \frac{\underline{I}^{t}}{\underline{V}^{t}} \Big|\_{\underline{V}^{t}\_{e} = 0} \\\\ \frac{\underline{I}^{t}}{\underline{V}^{t}} \Big|\_{\underline{V}^{t}\_{e} = 0} & \frac{\underline{I}^{t}}{\underline{V}^{t}} \Big|\_{\underline{V}^{t}\_{e} = 0} \end{bmatrix} = \begin{bmatrix} \frac{1}{\underline{Z}^{\pi}\_{e}} + \frac{Y^{\pi}\_{\mathrm{m}}}{2} & -\frac{1}{\underline{Z}^{\pi}\_{e}} \\\\ -\frac{1}{\underline{Z}^{\pi}\_{e}} & \frac{1}{\underline{Z}^{\pi}\_{e}} + \frac{Y^{\pi}\_{\mathrm{m}}}{2} \end{bmatrix}, \quad \forall \ e \in \mathbb{S}\_{e}^{\mathrm{eqn}} \tag{2.8}$$

This transmission line admittance matrix is then used in Section 2.1.3 to set up the nodal admittance matrix Y bus describing the admittances of the entire EPN.

### **2.1.2 Bus**

Shunt admittances represent the connection of a bus i to the ground:

$$\underline{Y}\_i^{\text{sh}} = G\_i^{\text{sh}} + jB\_i^{\text{sh}}, \quad \forall i \in \mathbb{S}\_i^{\text{epn}} \tag{2.9}$$

Concatenating all shunts of the EPN into the column vector Y sh is written as:

$$\underline{Y}^{\rm sh} = \begin{bmatrix} \underline{Y}\_1^{\rm sh}, \dots, \underline{Y}\_i^{\rm sh}, \dots, \underline{Y}\_{\rm n^{\rm ch}}^{\rm sh} \end{bmatrix} \tag{2.10}$$

with the cardinality of the EPN buses given by n ci = |S epn i |. Also, this vector will be used in the following Section 2.1.3 to describe the entire EPN.

The real and reactive power, Pi,k and Qi,k, injected at bus i and time step k by all network participants n connected at this bus, is defined as:

$$P\_{i,k} = \sum\_{n \in \mathbb{S}\_n^{\mathrm{epn}}} M\_{i,n}^{\mathrm{epn}} P\_{n,k}, \qquad \qquad \forall \, i \in \mathbb{S}\_i^{\mathrm{epn}}, \, k \in \mathbb{S}\_k \tag{2.11}$$

$$Q\_{i,k} = \sum\_{n \in \mathbb{S}\_n^{\mathrm{epn}}} M\_{i,n}^{\mathrm{epn}} Q\_{n,k}, \qquad \qquad \forall \, i \in \mathbb{S}\_i^{\mathrm{epn}}, \,\, k \in \mathbb{S}\_k \tag{2.12}$$

where the elements of the bus-NP incidence matrix Mepn i,n are defined as in (2.2) and <sup>S</sup><sup>k</sup> comprises all time steps k on the prediction/simulation horizon<sup>31</sup> .

### **2.1.3 Network**

The nodal admittance matrix Y bus of the entire EPN is calculated by [ZMS11]:

$$\underline{\mathbf{Y}}^{\text{bus}} = \underline{\mathbf{A}}^{\text{epn},-} \underline{\mathbf{Y}}^{\text{f}} + \underline{\mathbf{A}}^{\text{epn},+} \underline{\mathbf{Y}}^{\text{t}} \text{diag}(\underline{\mathbf{Y}}^{\text{sh}}) \tag{2.13}$$

where the auxiliary admittance matrices Y f and Y t are built by parameters from the transmission line admittance matrices Y trl <sup>e</sup> of the network edges as given in the Appendix A. Further, the incoming and leaving edge bus incidence matrices A epn,<sup>+</sup> and A epn,<sup>−</sup> are defined as:

A epn,+ i,e = ( 1, if A epn i,e = +1 <sup>0</sup>, else, ) ∀ i ∈ S epn i , e ∈ S epn e A epn,− i,e = ( 1, if A epn i,e = −1 <sup>0</sup>, else, ) ∀ i ∈ S epn i , e ∈ S epn e (2.14)

Note, that A epn i,e is defined analog to Adhn i,e in (2.1). The following property of the nodal admittance matrix Y bus will be considered in Section 3.3.2:

<sup>31</sup> See Definition 2.3 for more information.

### **Remark 2.2:**

*The nodal admittance matrix* Y bus *is typically sparse, and the degree of sparsity increases with the size of the EPN network size [Kun93, p. 258].*

An accurate model of the meshed lossy AC distribution system is based on the nonlinear and non-convex<sup>32</sup> AC power flow equations [MBB11, p. 115]:

$$P\_{i,k} = \sum\_{j \in \mathbb{S}\_i^{\text{eps}}} V\_{i,k} V\_{j,k} [B\_{i,j}^{\text{bus}} \sin(\delta\_{i,k} - \delta\_{j,k}) \text{ }$$

$$+ G\_{i,j}^{\text{bus}} \cos(\delta\_{i,k} - \delta\_{j,k})], \qquad \forall \ i \in \mathbb{S}\_i^{\text{eps}}, \ k \in \mathbb{S}\_k \tag{2.15}$$

$$Q\_{i,k} = \sum\_{j \in \mathbb{S}\_i^{\text{eps}}} V\_{i,k} V\_{j,k} [G\_{i,j}^{\text{bus}} \sin(\delta\_{i,k} - \delta\_{j,k}) \text{ }$$

$$-B\_{i,j}^{\text{bus}} \cos(\delta\_{i,k} - \delta\_{j,k})], \qquad \forall \ i \in \mathbb{S}\_i^{\text{eps}}, \ k \in \mathbb{S}\_k \tag{2.16}$$

where Pi,k and Qi,k denote the active and reactive power injected into the system at bus i at time k by all network participants n connected at this bus, as defined in equation (2.11) and (2.12). The conductance Gbus i,j and the susceptance Bbus i,j refer to the nodal admittance matrix element Y bus i,j . The bus voltage angles are given as δ.

# **2.2 Energy Converter**

The energy converters, such as heat pumps, electric boilers or CHP units are often modeled by constant (efficiency) coefficients in most MES models for operational optimization, see e.g. [GA07]. A more detailed model, which incorporates this constant (efficiency) coefficient model form, is given using polynomial functions, representing the Coefficient of Performance (COP) or rather the coupling factor in general, as follows [Sau19, p. 108]:

$$\Phi\_{n^{\text{dh}},k} = \sum\_{m=0}^{3} \sum\_{n^{\text{cpu}} \in \mathbb{S}\_n^{\text{cpu},ac}} a\_{n^{\text{cpu}},n^{\text{dh}},m} \cdot \left(P\_{n^{\text{cpu}},k}\right)^m, \quad \forall \ n^{\text{dh}} \in \mathbb{S}\_n^{\text{dhn},ac}, k \in \mathbb{S}\_k \tag{2.17}$$

Therein, the (polynomial) coefficients a are ∈ R, the polynomial order is given by m, the heat power output of an EC is defined by Φ, and the electric real power injected (or consumed) is stated as P. Further, the index n representing an FNP is provided here with an EPN or DHN superscript to specify the connected network and the set of all network participants n representing energy converters connected to the DHN is given by S dhn,ec n . Note, that the presented model is not limited to these kind of polynomial energy converter models. More complex functions of the coupling factor of energy converters in MESs, as e.g. presented in [MSKH16] can also be included. Further, as an alternative to (2.17) descriptions using possible areas of operation through polygons, see Figure 2.4, which are then described by inequalities,

<sup>32</sup> The nonlinear and non-convex form of these equations has not prevented numerous successful implementations, e.g. Optimal Power Flow (OPF) problem based applications, using this exact model form [MDS+17].

limiting possible ratios of Φ to P instead of equation (2.17) can be used [DLS+19, LWZS17]:

Produced heat power Φ

**Figure 2.4:** Feasible region of the operation ratio of Φn,k to Pn,k of an extraction-condensing CHP unit n.

$$a\_{1,b,n} P\_{n^{\text{cpu}},k} + a\_{2,b,n} \Phi\_{n^{\text{dhn}},k} \le a\_{3,b,n}, \quad \forall \ n^{\text{dhn}} \in \mathbb{S}\_n^{\text{dhn},\text{ec}}, \ b \in \mathbb{S}\_b, \ k \in \mathbb{S}\_k \tag{2.18}$$

With the coefficients a1, a<sup>2</sup> and a<sup>3</sup> given for every energy converter modeled by this set of inequalities and the set S<sup>b</sup> is comprised of all boundaries b. These inequalities (2.18) are often used to model the feasible operation areas of CHPs [ZWW+21].

# **2.3 District Heating Network**

The most relevant components considered within operational optimization of DHNs are pumps, pipes, valves, DPRs, storages, heat exchangers, and the connectors of pipelines, typically referred to as nodes. Note, that producers, energy converters and consumers are only modeled until the heat exchanger side, directly connected to the DHNs, as usually done within the state of the art [ZWW+21]. As warm water is transported from producers to consumers through the supply network, and back through the return network, these networks are inherently meshed. The form of implemented network operation influences the network model, thus the typical forms of DHN operation [ZZZW18a] are listed below:


• Variable Flow Variable Temperature (VFVT) operation: Here, mass flows and temperatures through the network are varied in order to keep losses as small as possible. In this form of operation, the set points of valves, pumps and the power supplied to heat exchangers within the producers is varied in a coordinated form.

Note, that within the CFVT and the VFCT operation modes the constant values, mass flows or temperatures, can be varied step wise, e.g. dependent on the ambient temperature T a . Also, many DHNs are operated based on a combination of weather forecast, historical measurement data, as well as expert knowledge and experience of operation staff. However, it is well known that using the full system flexibility by the VFVT operation mode brings the highest efficiency [DLS+19, ZZZW18a]33. Therefore, this form of network operation is envisioned, for the designed model, in this thesis. As the CFVT and the VFCT operation modes are a special case of the VFVT network operation, a model designed for this form of operation can also be applied in case a DHN is operated with CFVT or VFCT conditions. Therefore, this selection of operation form for the DHN model does not represent a limitation but instead enables to represent all major forms of network operation.

The characteristics of the most important elements in DHNs are described in the following. These are nodes, loops, control paths, pumps, DPRs, valves, heat exchangers, pipelines, and TESSs. Therefore, hydraulic and the thermal models of the network components are given. The hydraulic model defines the mass flows and differential pressures throughout the DHN. The thermal model describes the temperature changes in the different network components and the propagation of temperature fronts throughout the network. Before the hydraulic and the thermal models are presented, the most relevant material properties of water are given below.

### **2.3.1 Material Properties of Water**

The density ρ <sup>w</sup>, the specific heat capacity c <sup>w</sup> and the kinematic viscosity<sup>34</sup> ν of liquid water are dependent on temperature and pressure levels. In Figure 2.5, the degree of these variations is depicted for possible ranges of pressure and temperature values in DHN operation. Therefrom, it can be seen that the density reaches values of 939.16 kg/m<sup>3</sup> ≤ ρ <sup>w</sup> ≤ 998.35 kg/m<sup>3</sup> . Thus, modeling water as incompressible, utilizing a value of ρ <sup>w</sup> = 960 kg/m<sup>3</sup> , leads to a resulting maximal possible deviation of 3.99 %. Similarly, the specific heat capacity ranges from 4.173 kJ/(kg K) ≤ c <sup>w</sup> ≤ 4.255 kJ/(kg K). With a constant value of c <sup>w</sup> = 4.214 kJ/(kg K) the largest occurring error is 0.97 %. Hence, the resulting errors, brought into the model by constant values of ρ <sup>w</sup> and c <sup>w</sup>, are assumed to be negligibly small as they are below 4 %.

More detailed examination is needed for the kinematic viscosity as value ranges are within 0.2366 × 10<sup>−</sup><sup>6</sup> m<sup>2</sup>/s ≤ ν ≤ 1.8 × 10<sup>−</sup><sup>6</sup> m<sup>2</sup>/s. Consequently, a kinematic viscosity of ν = 0.8369×10<sup>−</sup><sup>6</sup> m<sup>2</sup>/sleads to a possible deviation of 115.08 %. To understand the impact of this deviation on the pressure difference over a pipeline a parameter study was performed, which

<sup>33</sup> In this context, it should also be noted, that within the aforementioned forms of operation, different forms of pump operation can be found. A good overview on these is provided in [NTJK20].

<sup>34</sup> Note, that there is a difference between the dynamic viscosity and the kinematic viscosity which are both utilized throughout the literature, typically as constant values e.g. in [Trö99].

**Figure 2.5:** Values of the density ρ <sup>w</sup>, the specific heat capacity c <sup>w</sup> and the kinematic viscosity ν of liquid water for different temperatures and absolute pressure levels from [Els18, VDI13]. These are possible operation values of DHNs, see e.g. [ZWW+21, NTJK20]. The values of the kinematic viscosity change strongly for temperatures ≥ 100 °C combined with low pressure values of 1 bar [VDI13]. These conditions are avoided in DHN operation, by setting the minimal absolute pressure pmin accordingly > 1 bar, to prevent evaporation [NTJK20] and are thus not plotted here for the kinematic viscosity. Exemplary values of e.g. pmin = 3 bar are given in [NTJK20, p. 57].

is shown in Figure 2.6. Therein, the pressure difference over a pipeline is given for possible flow velocities v and the minimal, maximal and utilized value of the kinematic viscosity ν. The maximal possible deviation between these differential pressures calculated with the minimal or maximal and the utilized value of ν is shown in red. Similarly, as with the approximation of the friction factor calculation in Section 2.3.2, the possible deviation reaches values of 35.85 % for less likely low flow velocities and drops below 15 % for typical flows of v ≥ 1.4 m/s. For the proposed rolling horizon approach, see Remark 2.1, the obtained accuracy is seen as sufficient and thus this aspect is disregarded. However, if more accuracy is needed it is possible to integrate look-up tables into the implementation which adapt the values of νe,k for every pipeline and time step before the optimization.

**Figure 2.6:** Influence of varying kinematic viscosity ν on the resulting differential pressure over a pipeline, based on the parameters for a pipeline taken from the hydraulic pipeline calculations in Section 2.3.2.

Summarizing the aforementioned leads to:

**Assumption 2.1.** *The resulting errors, brought into the model by constant values of the density* ρ <sup>w</sup>*, the specific heat capacity* c <sup>w</sup>*, and the kinematic viscosity* ν *of water are negligibly small.*

Besides the aforementioned, a typical assumption usually used within operational optimization models, and also within most DHN simulation models is: [OUGP16, DAM19]:

**Assumption 2.2.** *The cross-section of a component, e.g. a pipeline, has spatially homogeneous velocity and temperature throughout.*

Using this assumptions leads to much simpler 1D component models.

### **2.3.2 Hydraulic model**

The models of all typical hydraulic elements are given below. For all components representing DHN edges e, a general stationary relation of the mass flow m˙ and the pressure difference can be defined as [Ill20]:

$$
\Delta p\_{e,k} = \beta\_{e,k} + \mu\_{e,k} \dot{m}\_{e,k} |\dot{m}\_{e,k}|\_{\Delta e}, \qquad \forall \, e \in \mathbb{S}\_e^{\text{dhn}}, \, k \in \mathbb{S}\_k, \tag{2.19}
$$

where β and µ are the variable component coefficients, which are given in detail for each component below. This equation is continuously differentiable as the absolute value function of the mass flow m˙ is replaced by a continuous differentiable approximation given by:

$$|\dot{m}\_{e,k}|\_{\Delta \varepsilon} = \sqrt{\Delta \varepsilon + (\dot{m}\_{e,k})^2} \tag{2.20}$$

wherein ∆ε > 0 is a sufficiently small parameter.

In case of predefined positive flow direction35, thus when the e is not element of the set of all edges with VMFDs S vmfd e , (2.19) can be written as:

$$
\Delta p\_{e,k} = \beta\_{e,k} + \mu\_{e,k} (\dot{m}\_{e,k})^2, \qquad \forall \, e \in \mathbb{S}\_e^{\text{dhn}}, e \notin \mathbb{S}\_e^{\text{vmfd}}, \, k \in \mathbb{S}\_k \tag{2.21}
$$

The pressure difference ∆p over the edges is defined as:

$$
\Delta p\_{e,k} = -\sum\_{i \in \mathbb{S}\_i^{dhn}} A\_{i,e}^{\text{dhn}} p\_{i,k}, \qquad \forall \, e \in \mathbb{S}\_e^{dhn}, \,\, k \in \mathbb{S}\_k \tag{2.22}
$$

where p<sup>i</sup> describes the absolute nodal pressure values<sup>36</sup> .

**Node** The law of conservation of mass is represented by (2.23)<sup>37</sup> to model the equality of mass flows entering and leaving a node i:

$$\sum\_{e \in \mathbb{S}\_e^{\text{dhn}}} A\_{i,e}^{\text{dhn}} \dot{m}\_{e,k} = 0, \qquad \qquad \forall \, i \in \mathbb{S}\_i^{\text{dhn}}, \, k \in \mathbb{S}\_k \tag{2.23}$$

Therein, the mass flow through edge e at time step k is defined as m˙ e,k and the DHN node edge incidence matrix elements Adhn i,e are defined as in (2.1).

**Loop** The second important conservation law used to model the elementary hydraulic processes is the conservation of energy. This states, that the pressure differences ∆pe,k along a

<sup>35</sup> Flow direction equals the edge orientation.

<sup>36</sup> A pressure maintenance unit guarantees a constant base pressure p<sup>0</sup> at a distinct node of the DHN. This is typically a node in the return network near larger DHN pumps [NTJK18]. Based on this, the pressure differences created through water loss and density variations of the medium caused by temperature variations are balanced.

<sup>37</sup> When only the supply network is modeled for simplicity reasons, the right hand side of (2.23) is extended by nodal mass flows, describing the mass flows fed into the supply network by e.g. producers or storages [MGR+21].

loop l must add up to zero:

$$\sum\_{e \in \mathbb{S}\_{\epsilon}^{\text{dhn}}} B\_{l,e} \Delta p\_{e,k} = 0, \qquad \qquad \forall \, l \in \mathbb{S}\_{l}^{\text{dhn}}, \,\, k \in \mathbb{S}\_{k} \tag{2.24}$$

where the set of all loops of the DHN is S dhn l and the loop edge incidence matrix elements are given as:

$$B\_{l,e} = \left\{ \begin{aligned} 1, \text{if } e \text{ is directed as } l, \\ -1, \text{if } e \text{ is directed in opposite to } l, \\ 0, \text{if } e \text{ is not element of } l, \end{aligned} \right\} \forall l \in \mathbb{S}\_l^{\text{dhn}}, e \in \mathbb{S}\_e^{\text{dhn}} \tag{2.25}$$

**Control Path** Besides the loops, control paths are also not component models, as they model the interaction of multiple components. Control paths consider the influence of controlled pumps and valves on the respective network edges, from the controlled element to the element where the controlled variable is measured. Typically the controlled variable is the predefined differential pressure ∆p pre over a pump, a set of edges, a valve or a consumer substation. The control path is then modeled, by defining, that the pressure drop over all edges of the control path should equal ∆p pre:

$$\sum\_{e \in \mathbb{S}\_e^{\text{dhn}}} R\_{cp,e} \Delta p\_{e,k} = \Delta p^{\text{pre}}, \qquad \qquad \forall \, cp \in \mathbb{S}\_{cp}^{\text{dhn}}, \, k \in \mathbb{S}\_k \tag{2.26}$$

Therein, the control path edge incidence matrix elements Rcp,e are given as:

$$R\_{cp,e} = \left\{ \begin{aligned} 1, \text{if } e \text{ is directed as } cp, \\ -1, \text{if } e \text{ is directed in opposite to } c, p \\ 0, \text{ if } e \text{ is not element of } cp, \end{aligned} \right\} \forall cp \in \mathbb{S}\_{cp}^{\text{dhn}}, e \in \mathbb{S}\_{e}^{\text{dhn}} \tag{2.27}$$

**Pump** The pumps are utilized in DHNs to create the necessary differential pressure to circulate the water throughout the other components of the networks. These are typically powered by electricity and local pump controllers, which adjust the motor rotation speed in order to achieve the desired differential pressure. Within the model this is represented by [OUGP16]:

$$
\Delta p\_{e,k} = \beta\_{e,k}, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\text{pump}}, \,\, k \in \mathbb{S}\_k \tag{2.28}
$$

where S pump <sup>e</sup> describes all edges holding pumps and β can either be a fixed parameter in the case of a predefined pressure difference over the pump<sup>38</sup> or a variable which is obtained from the solution process of the optimization presented in Chapter 3. Note, that within this model form further forms of pump operation can be represented. Using control paths, described in the previous paragraph, a certain differential pressure over several sequential edges of the

<sup>38</sup> Defined by the control room of the DHN, as often performed today.

network can be achieved. Also, the pressure p at a certain node i of the network<sup>39</sup> or the amount of mass flow m˙ thought the pump [Opp15, NTJK20] can be controlled, by adding additional constraints to the optimization problem, as pi,k = p pre i or m˙ e,k = ˙mpre <sup>e</sup> ∀k ∈ Sk. Where p pre i and m˙ pre e represent the predefined set values of the absolute pressure and the mass flow in either of these cases.

**Differential Pressure Regulator** DPRs help to improve the efficiency of DHN operation. These components represent valves, which are opened and closed in order to keep the pressure drop over a control path, e.g. a consumer sub station, constant. This provides two important functionalities. First, large pressure changes can affect the operational functionality of simple valve controls which can cause unwanted pressure oscillations. The later can cause material fatigue and inefficient valve operation [Opp15, p. 47]. Second, the utilization of DPRs helps to implement an efficient hydraulic balance within the DHN [NTJK20, pp. 146-147]. This accomplishes that the mass flows through consumers farther away from the producers are streamed through with a similar power as the consumers which are very close to the producers. The model is given as:

$$
\Delta p\_{e,k} = \beta\_{e,k}, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\mathrm{dpr}}, \, k \in \mathbb{S}\_k \tag{2.29}
$$

the value of the variable β is obtained from the solution of the optimization problem presented in Chapter 3 and S dpr <sup>e</sup> describes the set of all edges with DPRs.

**Valve** Together with pumps and DPRs, valves are the central active components defining the hydraulic effects with in a DHN. The pressure difference over this component type is dependent on the mass flow through the valve and can be modeled as [OUGP16]:

$$
\Delta p\_{e,k} = \mu\_{e,k} \dot{m}\_{e,k} |\dot{m}\_{e,k}|\_{\Delta \varepsilon}, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\text{vlv}}, \, k \in \mathbb{S}\_k \tag{2.30}
$$

$$
\mu\_{e,k} = \frac{\Delta p\_0 (c^{\text{temp}})^2}{(K\_{e,k})^2 \rho\_0 \rho^{\text{w}}}, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\text{vlv}}, \, k \in \mathbb{S}\_k \tag{2.31}
$$

where the pressure coefficient µ is dependent on the valve flow factor K, its pressure reference ∆p0, the density of water ρ <sup>w</sup>, the density reference ρ0, and the temporal conversion factor c temp = 3600 s h<sup>−</sup><sup>1</sup> . Further, the set of all valves, is stated as a subset of all edges as S vlv e . Note, that the operational limits of K refer to open and closed valve state, see Section 3.3.1.

**Heat Exchanger of Consumer or Producer** The pressure difference over heat exchangers of consumers and producers can be modeled as:

$$
\Delta p\_{e,k} = \mu\_{e,k} \dot{m}\_{e,k} |\dot{m}\_{e,k}|\_{\Delta \varepsilon}, \qquad \forall \, e \in \mathbb{S}\_{e}^{\text{exch}}, \, k \in \mathbb{S}\_{k} \tag{2.32}
$$

$$
\mu\_{e,k} = \frac{1}{\rho^{\mathrm{w}} (d\_e)^4} \xi\_e, \quad \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\mathrm{exch}}, \, k \in \mathbb{S}\_k \tag{2.33}
$$

<sup>39</sup> E.g. the point with lowest differential pressure between supply and return network, which often describes the consumer with the largest distance to heat production.

as given in [Köc00] for all e which are in the set of edges containing heat exchangers S exch e . The friction factor ξ and the diameter de, and thereby µ, are determined by parameter identification procedures. Note, that this comprises models, as implemented in [OUGP16, Opp15], where µ = 0 is used.

**Pipeline** For all edges e representing pipelines S pipe e the model is defined as:

$$
\Delta p\_{e,k} = \beta\_{e,k} + \mu\_{e,k} \dot{m}\_{e,k} |\dot{m}\_{e,k}|\_{\Delta e}, \qquad \forall \, e \in \mathbb{S}\_e^{\text{pipe}}, \, k \in \mathbb{S}\_k \tag{2.34}
$$

$$
\beta\_{e,k} = \rho^{\mathrm{w}} g^{\mathrm{acc}} \Delta h, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\mathrm{pipe}}, \, k \in \mathbb{S}\_k \tag{2.35}
$$

$$
\mu\_{e,k} = \frac{8}{\pi^2 d\_e^4 \rho^{\rm w}} (\frac{L\_e}{d\_e} \xi\_{e,k} + \psi\_e), \qquad \forall \, e \in \mathbb{S}\_e^{\rm pipe}, \, k \in \mathbb{S}\_k \tag{2.36}
$$

Therein, the differential pressure is dependent on the height difference ∆h between both nodes at the beginning and end of the respective pipeline and the gravitational acceleration g acc [Köc00, Trö99]. The pressure coefficient µ is dependent on the diameter d and the length L of the pipeline, the density of the water ρ <sup>w</sup> and the friction factor ξ. Also further pressure loss coefficients, e.g. resulting from curvature are accumulated in ψ. The Darcy friction factor ξ itself is highly dependent on the flow conditions, defined by the Reynolds number Re. For laminar flows, which are found beneath the critical Reynolds numbers of Recrit = 2300 for water, the Darcy friction factor can be calculated by [VDI13]:

$$\xi\_{e,k} = \frac{64}{\text{Re}\_{k,e}}, \quad \forall e \in \mathbb{S}\_e^{\text{pipe}}, \ k \in \mathbb{S}\_k \tag{2.37}$$

for larger Reynolds numbers, Re > Recrit, which describe the transition zone towards turbulent flow and turbulent flow conditions40, the Prandtl-Colebrook equation is utilized to determine the Darcy friction factor as [Ick95]:

$$\frac{1}{\sqrt{\xi\_{e,k}}} = -2\log\_{10}\left(\frac{2.51}{\mathrm{Re}\_{e,k}\sqrt{\xi\_{e,k}}} + \frac{r\_e}{3.7d\_e}\right), \qquad \forall \, e \in \mathbb{S}\_e^{\mathrm{pipe}}, \, k \in \mathbb{S}\_k \tag{2.38}$$

$$\approx -1.8 \log\_{10} \left( \left( \frac{r\_e}{3.71d\_e} \right)^{1.11} + \frac{6.9}{\text{Re}\_{k,e}} \right), \qquad \forall \, e \in \mathbb{S}\_e^{\text{pipe}}, \, k \in \mathbb{S}\_k \tag{2.39}$$

$$\approx -2\log\_{10}\left(\left(\frac{r\_e}{3.71d\_e}\right) + \frac{5.74}{(\text{Re}\_{k,e})^{0.9}}\right), \qquad \forall \, e \in \mathbb{S}\_e^{\text{pipe}}, \, k \in \mathbb{S}\_k \tag{2.40}$$

Two approximations of (2.38) are given above. The first is the Haaland and the second the Swamee approximation, which both enable to replace the implicit Prandtl-Colebrook equation by an explicit alternative [Brk11]. The roughness values of the pipeline wall r is typically around r ≈ 0.01 mm in DHN pipelines [NTJK18, p. 118].

<sup>40</sup> The transition zone between laminar and turbulent flow is defined around 2300 < Re < 5000, see [Opp15, p. 33] for more details, as well as [VDI13, p. 1225] and [NTJK20, p. 118].

e

The Reynolds number itself is defined as [VDI13]:

ν

$$\begin{split} \text{Re}\_{e,k} &= \frac{d\_e \upsilon\_{e,k}}{\nu}, \quad & \forall \, e \in \mathbb{S}\_e^{\text{pipe}}, \, k \in \mathbb{S}\_k \\ &\approx \frac{d\_e |\upsilon\_{e,k}|\_{\Delta e}}{\nu}, \quad & \forall \, e \in \mathbb{S}\_e^{\text{pipe}}, \, k \in \mathbb{S}\_k \end{split} \tag{2.41}$$

In order to calculate the Reynolds number of a pipeline correctly, independent of the flow direction, the absolute value approximation is used in equation (2.42) as in equation (2.20) and [Trö99]. It is dependent on the flow velocity v and the kinematic viscosity of water ν. In normal DHN operation the absolute values of the flow velocities v in the pipelines range from 0.8 m/s to 3 m/s [Glü85b, p. 29], however to also cover less likely lower flows a lower limit of 1 × 10<sup>−</sup><sup>3</sup> m/s is regarded here. The kinematic viscosity of water can range from 0.2366 × 10<sup>−</sup><sup>6</sup> m2/s ≤ ν ≤ 1.8×10<sup>−</sup><sup>6</sup> m2/sfor typical pressure and temperature ranges of DHN states, see material properties of water in Section 2.3.1. Thus, possible Reynolds numbers<sup>41</sup> are within 2.722 × 10<sup>2</sup> ≤ Re ≤ 6.3339 × 10<sup>6</sup> . This leads to:

**Assumption 2.3.** *The Prandtl-Colebrook equation, stated in equation* (2.38)*, can be adequately represented by the Haaland or the Swamee approximation, given in* (2.39) *and* (2.40)*, for all possible Reynolds numbers.*

This is due to the fact, that for Re > Recrit the deviation between (2.38) and (2.39) or (2.40) is small, and the larger deviation for lower Reynolds numbers has a minor effect, as the overall pressure drop becomes negligible in this case, compared to other pipelines with higher flow rates [Trö99]. To underline these facts, the following example quantifies the impact of the utilized approximation. The calculations are performed for a pipeline with a diameter of d = 0.5 m, a length of L = 100 m, and a roughness value of r = 0.01 mm. Further a constant density of water of ρ <sup>w</sup> = 960 kg/m<sup>3</sup> is used, due to the small relative changes of the water density for DHN operation conditions, see Assumption 2.1 in Section 2.3.1. The resulting pipeline friction factors ξ are shown in Figure 2.7. Note, that the values of the friction factor resulting from the Haaland and the Swamee approximation only show very small deviations below 1.4 %. Therefore these approximations are hard to distinguish before Figure 2.10.

Based on the friction factors ξ, the pressure coefficients µ can be determined, which are shown in Figure 2.8. This graph shows the desired reference as the *Laminar and Prandtl-Colebrook* case, which is based on a calculation of ξ with (2.37) for Re < Recrit and (2.38) for Re > Recrit . The differential pressure over the entire pipeline calculated by (2.34) for different flow velocities is shown in Figure 2.9. Therefore, the differential pressure is once calculated with the desired reference values of µ, given as the laminar and Prandtl-Colebrook case in Figure 2.8<sup>42</sup> and once with the values of µ calculated with the Haaland approximation in (2.39). For increasing flow velocities, the lowest possible Reynolds numbers increase as well, see (2.41). These limits Remin are now defined by the maximal value of the kinematic viscosity of water ν max = 1.8 × 10<sup>−</sup><sup>6</sup> m<sup>2</sup>/s. To depict the limits of the possible differential pressures and the deviations of the later, for the different flow velocities, the aforementioned Remin limits

<sup>41</sup> Given minimal flow velocities of v = 1 × 10−<sup>3</sup> m/s.

<sup>42</sup> Plotted in green color.

**Figure 2.7:** Darcy friction factor for possibly occurring Reynolds numbers in DHN operation conditions, including laminar and turbulent flows.

**Figure 2.8:** Values of the pipeline pressure coefficient µ for possibly occurring Reynolds numbers in DHN operation conditions resulting from the different Darcy friction factor calculation forms.

**Figure 2.9:** Differential pressure ∆p for different flow velocities v<sup>1</sup> = 1 × 10−<sup>3</sup> m/s, v<sup>2</sup> = 1 m/s, v<sup>3</sup> = 2 m/s and v<sup>4</sup> = 3 m/s for possibly occurring Reynolds numbers in DHN operation conditions, obtained from different calculations of the friction factor. Note, that due to the small differences between the Haaland and the Swamee approximation, only the prior is shown here. However both are further compared in the following analysis.

are shown as well in Figure 2.9 and 2.10. The resulting absolute deviation ∆p dev between the pressure drop resulting from the exact calculation from the pressure drop reference ∆p ref with the stated approximations ∆p haa or ∆p swamee is given in Figure 2.10. The relative error arising from the used approximations on the calculated differential pressure over the pipeline is given in Table 2.2 and 2.3. The quantitative study shows, that the hydraulic pipeline model using either the Swamee or the Haaland approximation for all flow conditions is very accurate, with errors below 1.3 %, for flow velocities v > 1 m/s. Further, for flow velocities of v crit = 8.28 × 10<sup>−</sup><sup>3</sup> m/s the critical Reynolds number is definitely reached. Therefore, it can be understood, that in DHNs the non laminar flow conditions represent the prevailing case. Much more, based on typical flow velocities turbulent flow can be assumed in DHN pipelines [NTJK20, p. 117]. For Re > Recrit the relative error instantly decreases to the lower singledigit percent range. Thus, the used approximations lead to very exact results in the prevailing cases. In the case of very low flow velocities v < vcrit the resulting pressure drop over the pipeline becomes negligibly small, as it is a factor 10<sup>6</sup> smaller than the largest possible pressure drop. Therefore, the errors brought to the rest of the model, e.g. pressure drops of other pipelines, are then also neglectable.

**Figure 2.10:** Pressure difference deviation occurring from different calculations of the friction factor for differing velocities for possibly occurring Reynolds numbers in DHN operation conditions

**Table 2.2:** Set of relevant values for estimation of occurring error through the used Swamee approximation for the Darcy friction factor calculation.


**Storage** The storage model is highly dependable on the type of the storage and its form of operation. We restrict ourselves to unpressurized sensible<sup>43</sup> hot water storages [NTJK20], which are directly connected to the grid, as sensible hot water storages are the most used form in practice, due to the low costs and the high level of technological maturity [NTJK18] [CMT+17, p. 73f]. Hereby, there is no hydraulic separation between the grid and the storage.

<sup>43</sup> "In sensible heat storage, a storage medium is heated or cooled without phase change." [NTJK20, p. 37]


**Table 2.3:** Set of relevant values for estimation of occurring error through the used Haaland approximation for the Darcy friction factor calculation.

Therefore, the hydraulics of the storage can be modeled similarly as a pipeline with a large diameter.

$$
\Delta p\_{e,k} = \beta\_{e,k} + \mu\_{e,k} \dot{m}\_{e,k} |\dot{m}\_{e,k}|\_{\Delta e}, \qquad \forall \, e \in \mathbb{S}\_e^{\text{stor}}, \, k \in \mathbb{S}\_k \tag{2.43}
$$

$$
\beta\_{e,k} = \rho^{\mathrm{w}} g \Delta h, \tag{2.44}
\\
\text{where} \qquad \forall \, e \in \mathbb{S}\_e^{\mathrm{stor}}, \,\, k \in \mathbb{S}\_k \tag{2.44}
$$

The values of the pressure coefficient µ depend on the special design form e.g. if plates are used to help preserve the stratification. The coefficient is determined by a parameter identification procedure, with µ ≥ 0. Further, ∆pe,k can become ≥ 0 and ≤ 0 based on the two possible cases, charging and discharging. The set of all edges containing thermal storage devices is given by S stor e .

### **2.3.3 Thermal model**

The thermal model describes the temperature changes occurring in the different network components and the storage dynamics of pipelines and Thermal Energy Storage Systems (TESS).

**Node** In network graphs in general and for DHNs specifically, nodes are the components connecting multiple edges at a certain location. The thermal node models determine the node temperatures, which are important as they define the temperatures of the water entering the connected edges with water inflow. These node temperatures are calculated by using the following simplification:

**Assumption 2.4.** *Water flowing into a DHN node* i *from multiple edges* e *undergoes perfect instant intermixture and therefore the out flowing water has a homogeneous temperature* T*.*

Note, that this assumption is used in the prevailing amount of literature in the field of optimal DHN operation, see e.g. [DLS+19, LWS+15, CWW+18b, Trö99] and also in many simulation models [LWJB16, OUGP16, Ick95]. The thermal balance equation is given below for two cases. The first is the simpler case, where only edges with predefined flow directions are connected to the node. The set of nodes i for which this condition holds is given as the set of all nodes excluding the nodes where edges with possibly VMFDs are connected, thus S dhn <sup>i</sup> ∧ i /∈ S vmfd i . This very common equation in DHN modeling can be found e.g. in [LWS+15]:

$$\sum\_{e \in \mathbb{S}\_{e}^{\text{dhn}}} A\_{i,e}^{\text{dhn},-} \dot{m}\_{e,k} T\_{i,k} = \sum\_{e \in \mathbb{S}\_{e}^{\text{dhn}}} (A\_{i,e}^{\text{dhn},+} \dot{m}\_{e,k} T\_{e,k}^{\text{out}}), \quad \forall \, i \in \mathbb{S}\_{i}^{\text{dhn}} \land i \notin \mathbb{S}\_{i}^{\text{ymfd}}, k \in \mathbb{S}\_{k} \tag{2.45}$$

The node temperature T<sup>i</sup> and the outlet temperatures T out of the edges with water flowing into the node are found in the above equation, as well as the elements of the incoming and leaving edge node incidence matrices A dhn,<sup>+</sup> and A dhn,<sup>−</sup> of the DHN. These elements are defined as:

$$\begin{aligned} A\_{i,e}^{\text{dhn},+} &= \begin{cases} 1, \text{if } A\_{i,e}^{\text{dhn}} = +1, \\ 0, \text{else}, \end{cases} \\\ A\_{i,e}^{\text{dhn},-} &= \begin{cases} 1, \text{if } A\_{i,e}^{\text{dhn}} = -1, \\ 0, \text{else}, \end{cases} \end{aligned} \qquad \forall \ i \in \mathbb{S}\_{i}^{\text{dhn}}, e \in \mathbb{S}\_{e}^{\text{dhn}}$$

The second case is defined for all nodes where at least on one connected edge a flow direction change can take place. These nodes i are consolidated in S vmfd i . In this case the heat balance equation considers all possible flow conditions, as given in [Trö99]:

$$\begin{split} & \left( \sum\_{e \in \mathbb{S}\_{e}^{\text{dhn}}} A\_{i,e}^{\text{dhn},-} \max \left( \dot{m}\_{e,k}, 0 \right) + \sum\_{e \in \mathbb{S}\_{e}^{\text{dhn}}} A\_{i,e}^{\text{dhn},+} \max \left( -\dot{m}\_{e,k}, 0 \right) \right) T\_{i,k} \\ & = \sum\_{e \in \mathbb{S}\_{e}^{\text{dhn}}} \left( A\_{i,e}^{\text{dhn},+} \max \left( \dot{m}\_{e,k}, 0 \right) T\_{e,k}^{\text{out}} \right) + \sum\_{e \in \mathbb{S}\_{e}^{\text{dhn}}} \left( A\_{i,e}^{\text{dhn},-} \max \left( -\dot{m}\_{e,k}, 0 \right) T\_{e,k}^{\text{in}} \right), \\ & \quad \forall \ i \in \mathbb{S}\_{i}^{\text{dhn}} \land i \in \mathbb{S}\_{i}^{\text{ymfd}}, k \in \mathbb{S}\_{k} \end{split} \tag{2.47}$$

The right-hand side of equation (2.47) contains the sum of all temperatures entering this node, weighted by their mass flows m˙ . This has to equal the node temperature T<sup>i</sup> , which is multiplied by the mass flows leaving the node. All possible cases, based on the varying mass flow directions in the pipelines, are distinguished by combining the incoming and leaving node edge incidence matrix elements A dhn,+ i,e and A dhn,− i,e , and the approximated maximum operator. The approximation is analogous to the absolute value function approximation in (2.20) and defined as:

$$\max(\dot{m}\_{e,k}, 0) \approx \frac{\sqrt{\dot{m}\_{e,k}^2 + \Delta \varepsilon} + \dot{m}\_{e,k}}{2} \tag{2.48}$$

**Input temperature of all components except nodes, storages and pipes** Assuming the utilization of check valves<sup>44</sup> in all components except nodes, all components in storages systems<sup>45</sup>, and pipes, the flow direction can be modeled as unidirectional through these edges.

<sup>44</sup> Valves, often utilized in water networks, which can only be streamed through in one direction.

<sup>45</sup> These include a valve, a pump and the heat exchanger of a storage system.

Thus, the input temperature of the respective components can be defined by:

$$\begin{split} T\_{e,k}^{\text{in}} &= \sum\_{i \in \mathbb{S}\_i^{\text{dhn}}} A\_{i,e}^{\text{dhn},-} T\_{i,k}, \\ \forall e \in \mathbb{S}\_e^{\text{dhn}} \land e \notin \mathbb{S}\_e^{\text{pipe}} \land e \notin \mathbb{S}\_e^{\text{star}} \land e \notin \mathbb{S}\_e^{\text{vlv,star}} \land e \notin \mathbb{S}\_e^{\text{pump,star}}, k \in \mathbb{S}\_k \end{split} \tag{2.49}$$

where the set of all storage valves and pumps are given by S vlv,stor e and S pump,stor e .

**Pump** The mechanical degree of efficiency of pumps η pump describes the rate of coupling power to the delivery rate. Assuming all losses will heat up water, it can be used to describe the temperature change over a pump, as follows<sup>46</sup> [Opp15]:

$$|T\_{e,k}^{\rm out} - T\_{e,k}^{\rm in}| = |\Delta p\_{e,k}| \frac{1 - \eta^{\rm pump}}{\eta^{\rm pump} \rho^{\rm w} c^{\rm w}}, \qquad \forall \, e \in \mathbb{S}\_{e}^{\rm pump}, k \in \mathbb{S}\_{k} \tag{2.50}$$

The following example will show that it is possible to neglect the temperature gain over a pump in a DHN due to the small resulting error. For a given DHN pump [DHN] with a minimal mechanical efficiency η pump of 30 %, a maximal differential pressure ∆p of 16 bar, a minimal specific heat capacity of 4.182 kJ/(kg K), and a minimal density of water ρ <sup>w</sup> of 939.2 kg/m<sup>3</sup> the resulting temperature gain over the pump is given in Figure 2.11. Therefrom, it can be seen that the maximal temperature change is below 1 K and can thus be neglected for simplicity reasons. Based on the above, the temperature gain over a pump can be neglected, and equation (2.50) can be simplified to [Trö99]:

$$T\_{e,k}^{\rm out} = T\_{e,k}^{\rm in}, \qquad \forall \, e \in \mathbb{S}\_e^{\rm pump} \land e \notin \mathbb{S}\_e^{\rm pump,str}, k \in \mathbb{S}\_k \tag{2.51}$$

Pumps installed to fill or unload storage systems can be operated in both flow directions. Consequently, the in- or outlet temperature of the edge is defined by:

$$\begin{split} \chi\_{\boldsymbol{e},k,\sigma+}T\_{\boldsymbol{e},k}^{\mathrm{out}} &+ \chi\_{\boldsymbol{e},k,\sigma-}T\_{\boldsymbol{e},k}^{\mathrm{in}} \\ &= \sum\_{i \in \mathbb{S}\_{i}^{\mathrm{dhn}}} \left( A\_{i,\boldsymbol{e}}^{\mathrm{dhn},-} \chi\_{\boldsymbol{e},k,\sigma+} + A\_{i,\boldsymbol{e}}^{\mathrm{dhn},+} \chi\_{\boldsymbol{e},k,\sigma-} \right) T\_{i,k}, \\ \forall \; \boldsymbol{e} \in \mathbb{S}\_{e}^{\mathrm{pump},\mathrm{stor}}, k \in \mathbb{S}\_{k} \end{split} \tag{2.52}$$

The variables χe,k,σ<sup>+</sup> and χe,k,σ<sup>−</sup> are used to approximate the utilization of boolean integer variables, becoming 0 or 1 for positive or negative flow on the respective edge. These variables are calculated by using a continuous differentiable approximation of the Heaviside step

<sup>46</sup> For that matter, the flow direction is assumed to align with the edge orientation.

**Figure 2.11:** Temperature gain over DHN pump for different mechanical efficiency factors and differential pressures.

function and its at the axis of the ordinate reflected counterpart, defined as follows:

$$\chi\_{e,k,\sigma^{+}} = \frac{\sqrt{(\dot{m}\_{e,k} + \Delta\varepsilon)^{2} + \Delta\varepsilon^{2}} - \sqrt{(\dot{m}\_{e,k} - \Delta\varepsilon)^{2} + \Delta\varepsilon^{2}} + 2\Delta\varepsilon}{4\Delta\varepsilon}$$

$$\approx \begin{cases} 1 \text{ for } \dot{m}\_{e,k} > 0, \\ 0 \text{ for } \dot{m}\_{e,k} < 0, \end{cases} \quad \forall \, e \in \mathbb{S}\_{e}^{\text{stor}}, \; k \in \mathbb{S}\_{k} \tag{2.53}$$

$$
\chi\_{e,k,\sigma^+} = 1 - \chi\_{e,k,\sigma^-}, \qquad \forall \, e \in \mathbb{S}\_e^{\text{star}}, \, k \in \mathbb{S}\_k \tag{2.54}
$$

**Valve** The temperature gain<sup>46</sup> over valves, can be calculated by [Ick95]:

$$T\_{e,k}^{\rm out} - T\_{e,k}^{\rm in} = \frac{|\Delta p\_{e,k}|}{\rho^{\rm w} c^{\rm w}}, \qquad \qquad \forall \, e \in \mathbb{S}\_{e}^{\rm vlr}, k \in \mathbb{S}\_{k} \tag{2.55}$$

For a theoretically maximal possible pressure difference of 25 bar occurring in DHNs [ZWW+21], the temperature change would be below 0.64 K<sup>47</sup>. Thus, the thermal models of valves can be simplified to [Trö99]:

$$T\_{e,k}^{\rm out} = T\_{e,k}^{\rm in}, \qquad \forall \, e \in \mathbb{S}\_e^{\rm vlr} \land e \notin \mathbb{S}\_e^{\rm vlr, star}, k \in \mathbb{S}\_k \tag{2.56}$$

<sup>47</sup> The calculation is based on the same values for ρ <sup>w</sup> and c w as in Subsection 2.3.3.

For valves used in storage systems, the input or output temperature is defined as follows, in order to represent both flow directions in the model:

$$\begin{split} & \chi\_{e,k,\sigma^{+}} T\_{e,k}^{\mathrm{out}} + \chi\_{e,k,\sigma^{-}} T\_{e,k}^{\mathrm{in}} \\ & \qquad = \sum\_{i \in \mathbb{S}\_{i}^{\mathrm{dhn}}} \left( A\_{i,e}^{\mathrm{dhn},-} \chi\_{e,k,\sigma^{+}} + A\_{i,e}^{\mathrm{dhn},+} \chi\_{e,k,\sigma^{-}} \right) T\_{i,k}, \qquad \forall \, e \in \mathbb{S}\_{e}^{\mathrm{vlv},\mathrm{star}}, k \in \mathbb{S}\_{k} \end{split} \tag{2.57}$$

**Differential Pressure Regulator** DPRs are special valves which are controlled to keep the pressure difference over a control path constant. Still, their buildup does not deviate from other valves. Thus, they can be modeled as regular valves [Opp15], see equation (2.56):

$$T\_{e,k}^{\rm out} = T\_{e,k}^{\rm in}, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\rm dpr}, k \in \mathbb{S}\_k \tag{2.58}$$

**Consumer and Producer** The heat power supply or demand Φ of producers, energy converters, and consumers is defined by the following equation, throughout the existing literature, as e.g. given in [LWJB16]:

$$\Phi\_{n,k} = c^{\text{w}} \sum\_{e \in \mathbb{S}\_{e}^{n}} M\_{e,n}^{\text{dhn}} \dot{m}\_{e,k} (T\_{e,k}^{\text{out}} - T\_{e,k}^{\text{in}}), \qquad \forall \, n \in \mathbb{S}\_{n}^{\text{exch}} \land n \notin \mathbb{S}\_{n}^{\text{stor}}, k \in \mathbb{S}\_{k} \tag{2.59}$$

Note, that opposed to the State of the Art (SOTA) we have included an edge NP matrix element Mdhn e,n , as defined in equation (2.3), into the equation (2.59) above. Thereby, the needed sum over the set of all edges which have NPs connected S n e , is used, to enable a clear mapping of an NP to the respective edge in the DHN .

**Storage** As discussed in Subsection 2.3.2 sensible hot water storages are regarded in this work. These TESS typically store large amounts of water, in order to store heat for days (short term TESS) up to seasons (long-term TESS) [GV19]. Short term storages for cities usually have capacities of around 15 000 m<sup>3</sup> [GV19] up to 30 000 m<sup>3</sup> [Kie16]. Further, they contain baffle plates which enhance the stratification process. In these storage systems, a thermocline layer separates a layer of hot water at the top of the storage from a layer of cold water at the bottom [SDPT16]. Therefore, within the application presented here, it is possible to model the temperature entering and leaving the TESS T in and T out by constant temperature values T top n,k and <sup>T</sup> bot n,k found at the top and bottom of the storage. Concerning the large amounts of water within these systems and the stratification, the values T top n,k and <sup>T</sup> bot n,k are assumed to remain constant over the simulation/prediction horizon<sup>48</sup> and are updated with measurement data after every time step. Following the aforementioned, for discharging and charging the

<sup>48</sup> As the presented model can be applied for simulation or optimization of CEPDHNs, simulation and prediction horizon are used both here, referring to the same set of time steps Sk.

temperature of the water leaving the storage is defined by:

$$T\_{e,k}^{\rm out} = \sum\_{n \in \mathbb{S}\_n^{\rm dhn,star}} M\_{e,n}^{\rm dhn} T\_{n,k}^{\rm top}, \qquad \forall \, e \in \mathbb{S}\_e^{\rm star}, k \in \mathbb{S}\_k \tag{2.60}$$

$$T\_{e,k}^{\rm in} = \sum\_{n \in \mathbb{S}\_n^{\rm dhn}} M\_{e,n}^{\rm dhn} T\_{n,k}^{\rm bot}, \qquad \forall \, e \in \mathbb{S}\_e^{\rm stor}, k \in \mathbb{S}\_k \tag{2.61}$$

The heat input or output is defined as in [NTJK18]. Note, that this equation is formulated for charging and discharging here, with the respective efficiency factors for the charging η stor,chr and the discharging η stor,dchr process, as given in [VSG+17]49:

$$\begin{split} \Phi\_{n,k} &= c^{\text{w}} \sum\_{e \in \mathbb{S}\_{e}^{\text{tor}}} M\_{e,n}^{\text{dhn}} |\dot{m}\_{e,k}|\_{\Delta \varepsilon} \Big[ \left( \eta\_{n}^{\text{tor},\text{dchr}} \chi\_{e,k,\sigma^{+}} T\_{e,k}^{\text{out}} + \eta\_{n}^{\text{tor},\text{dr}} \chi\_{e,k,\sigma^{-}} T\_{e,k}^{\text{in}} \right) \\ &- \sum\_{i \in \mathbb{S}\_{i}^{\text{dhn}}} \left( \eta\_{n}^{\text{tor},\text{dchr}} A\_{i,e}^{\text{dhn},-} \chi\_{e,k,\sigma^{+}} + \eta\_{n}^{\text{tor},\text{dr}} A\_{i,e}^{\text{dhn},+} \chi\_{e,k,\sigma^{-}} \right) T\_{i,k} \Big], \\ &\forall n \in \mathbb{S}\_{n}^{\text{stor}}, k \in \mathbb{S}\_{k} \end{split} \tag{2.62}$$

Note, that the approximated binary variables, χσ<sup>+</sup> and χσ<sup>−</sup> , calculated during the solution process from (2.57), based on the flow direction, define if the TESS is charged or discharged. In the later case, the sign of the heat power is positive Φ > 0, following the active sign convention. Further, when the storage is discharged the mass flow is positive m > ˙ 0, this implies, that the edge directions of the storage components, defined in the node edge incidence matrix A dhn, are directed from the return network toward the supply network, see Figure 4.13. The stored quantity of heat E, the State of Charge (SOC), is defined over time as in [VSG+17, WYA+15]49:

$$E\_{n,k+1} = E\_{n,k} - \Delta k \Phi\_{n,k} + l\_{n,k}, \qquad \forall \, n \in \mathbb{S}\_n^{\text{tor}}, k < |\mathbb{S}\_k| \in \mathbb{S}\_k \tag{2.63}$$

$$E\_{n,k\_1} = E\_{n,k\_1}^{\text{meas}}, \tag{2.6}$$

The storage losses l are calculated as defined in [VSG+17] by:

$$l\_{n,k} = \Delta k A\_n^{\text{star}} R\_n^{\text{star}} (T\_{n,k}^{\text{star}, \text{mean}} - T^{\text{a}}), \qquad \forall \, n \in \mathbb{S}\_n^{\text{star}}, k < |\mathbb{S}\_k| \in \mathbb{S}\_k \tag{2.65}$$

with the surface of the TESS Astor, the heat transfer coefficient Rstor, and the mean temperature of the water in the storage is given by T stor,mean .

**Pipeline** The choice of an adequate pipeline model is of high relevance for operational optimization tasks of CEPDHNs. This is due to the fact, that pipelines are the most common components in DHNs and thus imprecise pipeline models can lead to significant subsequent

<sup>49</sup> The charging and discharging efficiencies used within equation (2.63) of this work as in [VSG+17], are included in equation (2.62).

errors<sup>50</sup>. At the same time the amount of optimization variables used for every pipeline should be limited in order to keep the amount of optimization variables of the entire CEPDHN optimization problem manageable. Thus, in previous work of the author [MRMH21] the most common pipeline models used within CEPDHN models, namely the Node Method (NM), approximations of the NM, the Lagrangian approach and different Finite Difference (FD) approaches are qualitatively and quantitatively compared for the application within operational optimization. The results of the quantitative comparison in [MRMH21] clearly show, that the the NM brings along the highest modeling accuracy.

The downside of the NM in its original form, as presented in [Ben91], is that the pipeline model itself is dependent on the solution of integer optimization problems which need to be solved at runtime if the model is directly used within operational optimization. This turns the NLP problem into a MINLP problem, which scales badly. To circumvent the computational burden, in [LWS+15] an iterative procedure is presented which calculates the solutions of the integer optimization problems and uses these in the dispatch problem before repeating both calculations sequentially. However, the approach presented in [LWS+15] uses an approximation of the length of stay of the water masses within a pipeline and is further limited to unidirectional mass flow conditions, which are usually not given in DHNs. A different approach using a thermal pipeline model, based on a linear interpolation of node temperatures, that can be applied in the case of VMFDs is presented in [Trö99]. Still due to convergence issues, the flow direction of every edge is fixed over the entire prediction horizon to one flow direction.

The pipeline model contributed within this work, and presented below, brings together the advantages of the aforementioned approaches [Ben91, LWS+15, Trö99] and augments these by two aspects. First, a new and more precise formula for the calculation of the length of stay of a water mass within a pipeline is used, which was first presented in the authors previous work [MEKH18]. Second, the concept of the flow direction path is introduced to limit the possible combinatorial flow direction options within a pipeline over the prediction horizon.

Besides the Assumptions 2.1 and 2.2, the pipeline model is based on the following simplifications [HAH17, DAM19, Opp15]:

**Assumption 2.5.** *Frictional heat is negligible, the pipeline is cylindrical, has a constant heat transmission coefficient, and the ambient temperature is constant along the length of the pipeline.*

### **Assumption 2.6.** *Heat diffusion in the axial direction can be neglected.*

Note, that the comparison of simulated results of the author based on the NM with the measurement data from [HFT+17] showed very small Root-Mean-Square Errors (RMSEs) of 0.507 °C for multiple scenarios [MRMH21]. Therefore, the assumptions above are appropriate for operational optimization. Further, within the model below the following simplification is used:

### **Assumption 2.7.** *Pipelines do not possess a steel core.*

<sup>50</sup> The trivial worst case includes multiple serial pipes all modeled with a thermal model providing a too high/low output temperature.

This simplification is no limitation to the used methodology, as the model presented below could be extended to steel cores, by using equation (6) and (7) from [MRMH21], for both flow directions. Nevertheless, future fourth and fifth generation DHNs will be operated at lower temperatures [LSG+17], and thus steel cores will no more be used within the respective pipelines.

The model, presented first within this work, tracks the water masses defined by a respective quadruple (e, k, ζ, σ). These indices defining a certain water mass in a pipeline e, at time step k, at position ζ, and for the flow direction σ. The position ζ represents an integer value numbering the different water masses in ascending order from the entering end of the pipeline to the outgoing end. Note, that the entering and outgoing end are in this case dependent on the flow direction. As all parameters are given for positive and negative flow direction, the entire model is set up twice, once for every flow direction. The size of the water masses is defined by the mass flow m˙ flowing into the pipe at the respective time step. The temperature of the water masses is set equal to the corresponding temperature of the node T<sup>i</sup> , through which the water mass entered the pipeline. The main variables and parameters, which will be fully described in the following, are depicted in Figure 2.12. Here, for simplicity reasons in this Figure 2.12 it is assumed that only the positive flow direction σ + case is possible for all time steps. The mass flow values defining the length of the water masses<sup>51</sup> shown in Figure 2.12 are predicted mass flows mˆ˙ . These are obtained from the last optimization of the rolling horizon approach, see Remark 2.1. Using these predicted mass flows prevents having to solve the integer optimization problems, stated in Section 2.3.3, during runtime of the optimization, presented in Chapter 3.

**Figure 2.12:** Scheme of a pipeline and relevant variables and parameters in the node method. For simplicity only the positive flow direction case σ + is shown here. The pipeline cross section and length are stated by Across and L. The positions ζ<sup>γ</sup> and ζ<sup>ε</sup> define the temporally seen last and first water masses leaving the pipeline. The water masses Rwm and S wm describe aggregated water masses of all water elements on the positions from the beginning of the pipeline up to the one determined by γ and ε − 1. Note, that the calculation of these parameters is provided in Section 2.3.3.

<sup>51</sup> Resulting from the flow velocity during the respective time steps.

The assignment of a node temperature T<sup>i</sup> to the respective water mass temperature Te,k,ζ,σ is provided by the following equation:

$$T\_{e,k,\zeta,\sigma} = \sum\_{\tilde{\sigma} \in \mathbb{S}\_{\sigma}} \sum\_{i \in \mathbb{S}\_{i}^{\text{dim}}} \left( A\_{i,e,\tilde{\sigma}}^{\text{dhn},\text{sgn}} \left( \sum\_{\tilde{k} \in \mathbb{S}\_{k}} Z\_{e,k,\zeta,\sigma,\tilde{k},\tilde{\sigma}} T\_{i,\tilde{k}} + \sum\_{k^{p} \in \mathbb{S}\_{k^{p}}} Z\_{e,k,\zeta,\sigma,k^{p},\tilde{\sigma}}^{\text{p}} T\_{i,k^{p}}^{\text{p}} \right) \right), \tag{2.62}$$
 
$$\forall \, e \in \mathbb{S}\_{e}^{\text{pipe}}, k \in \mathbb{S}\_{k}, \zeta \in \mathbb{S}\_{\zeta}, \sigma \in \mathbb{S}\_{\sigma} \tag{2.63}$$

in which the set of all positions ζ and flow directions σ are stated as S<sup>ζ</sup> and Sσ. The node temperatures within the current prediction horizon Ti,k and the past time steps T p i,k<sup>p</sup> are used<sup>52</sup> . Further the correct mapping of the respective (past) node temperature to the distinct water mass is accomplished by three sums iterating over all flow directions σ, all nodes i and all (past) time steps (k p /)k, and two matrices. The first is the flow direction dependent incoming/leaving node edge incidence matrix A dhn,sgn. This is used to select the appropriate nodes from which the water mass has entered the pipeline which is assigned by the flow direction and the regarded edge, and is defined as given below:

$$A\_{i,e,\tilde{\sigma}}^{\text{dhn},\text{sgn}} = \begin{cases} 1, & \text{if } \tilde{\sigma} = 1 \text{ and } A\_{i,e}^{\text{dhn},-} = 1, \\ & \text{or if } \tilde{\sigma} = 2 \text{ and } A\_{i,e}^{\text{dhn},+} = 1, \\ 0, & \text{else}, \end{cases}$$

$$\forall \, i \in \mathbb{S}\_{i}^{\text{dhn}}, e \in \mathbb{S}\_{e}^{\text{pipe}}, \tilde{\sigma} \in \mathbb{S}\_{\sigma} \tag{2.67}$$

The second matrix utilized in equation (2.66) is the six dimensional *entering time step matrix* Z, which is defined as Z p for past time steps k p . For a given quadruple (e, k, ζ, σ) defining a certain water mass53, the entering time step matrix Z/past time step matrix Z p provides the information at which time step ˜k/past time step k p this water mass has entered the pipeline and with which flow direction σ˜. The single matrix elements are given as:

$$Z\_{e,k,\zeta,\sigma,\tilde{k},\tilde{\sigma}} = \begin{cases} 1, & \text{if in pipeline } e, \text{at time step } k, \text{ the water mass at position } \zeta \\ & \text{of flow direction } \sigma \text{ has entered the pipeline at} \\ & \text{time step } \tilde{k} \text{ with flow direction } \tilde{\sigma}, \\ 0, & \text{else,} \end{cases}$$

$$\forall e \in \mathbb{S}\_e^{\text{pipe}}, \ k, \tilde{k} \in \mathbb{S}\_k, \ \zeta \in \mathbb{S}\_\zeta, \ \sigma, \tilde{\sigma} \in \mathbb{S}\_\sigma \tag{2.68}$$

Z p e,k,ζ,σ,kp,σ˜ = 1, if in pipeline e, at time step k, the water mass at position ζ of flow direction σ has entered the pipeline at the past time step k <sup>p</sup> with the flow direction σ, ˜ 0, else,

$$\forall e \in \mathbb{S}\_e^{\text{pipe}}, \ k \in \mathbb{S}\_k, \ \zeta \in \mathbb{S}\_{\zeta}, \ k^{\text{p}} \in \mathbb{S}\_{k^{\text{p}}}, \ \sigma, \tilde{\sigma} \in \mathbb{S}\_{\sigma} \tag{2.69}$$

<sup>52</sup> Note that <sup>k</sup>˜ and <sup>k</sup>, as well as <sup>σ</sup>˜ and <sup>σ</sup> are defined for the same set <sup>S</sup><sup>k</sup> and <sup>S</sup><sup>σ</sup> respectively.

<sup>53</sup> Within the model, in a pipeline e, at time step k, at position ζ, and for the flow direction σ.

For a more intuitive understanding, exemplary values for entries in the matrices Z and Z p are provided in Example 2.1 in (2.86) and (2.87).

The lossless outlet temperature of a pipeline is calculated based on a weighted sum of the temperatures of the water masses leaving the pipeline in the current time step, see also Figure 2.12, as given in [Ben91]<sup>54</sup>:

$$T\_{e,k,\sigma}^{\text{out1}} = w\_{e,k,\gamma,\sigma} T\_{e,k,\gamma,\sigma} + \sum\_{\zeta=\gamma+1}^{\varepsilon-1} w\_{e,k,\zeta,\sigma} T\_{e,k,\zeta,\sigma} + w\_{e,k,e,\sigma} T\_{e,k,\varepsilon,\sigma}$$

$$= \sum\_{\zeta=\gamma}^{e} w\_{e,k,\zeta,\sigma} T\_{e,k,\zeta,\sigma}, \qquad \forall \ e \in \mathbb{S}\_{e}^{\text{pipe}}, k \in \mathbb{S}\_{k}, \sigma \in \mathbb{S}\_{\sigma} \tag{2.70}$$

Note, that for both flow directions an output temperature is provided, as the index σ can stand for positive or negative flow direction σ <sup>+</sup> or σ <sup>−</sup>, also see Figure 2.13. The exact calculation of the weights w ∈ [0, 1] used in the above equation (2.70) are given later in equations (2.100) to (2.102). The temperature drop occurring to water masses leaving the pipeline is calculated by equation (2.71). Heat losses rise with increasing length of stay t and difference between the lossless outlet temperature T out1 and the ambient temperature T a . Thus, the lossy outlet temperature T out2 is given by [Ben91]:

$$T\_{e,k,\sigma}^{\rm out,2} = T^{\rm a} + (T\_{e,k,\sigma}^{\rm out,1} - T^{\rm a}) \exp\left(-\frac{t\_{e,k,\sigma}}{\tau\_e}\right), \qquad \forall \, e \in \mathbb{S}\_e^{\rm pipe}, k \in \mathbb{S}\_k, \sigma \in \mathbb{S}\_\sigma \tag{2.71}$$

The used loss coefficient τ<sup>e</sup> is dependent on the cross section of the pipeline Across and its thermal resistance Rtherm and is calculated by: τ<sup>e</sup> = ρ wc <sup>w</sup>Across <sup>e</sup> Rtherm e . The temperature of the water mass leaving the pipeline in case of positive or negative flow direction σ <sup>+</sup> or σ <sup>−</sup> is then matched with the leaving or entering edge temperature T out <sup>e</sup> or T in e by:

$$T\_{e,k}^{\rm out} = T\_{e,k,\sigma^+}^{\rm out2}, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\rm pipe}, k \in \mathbb{S}\_k \tag{2.72}$$

$$T\_{e,k}^{\rm in} = T\_{e,k,\sigma^-}^{\rm out2}, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\rm pipe}, k \in \mathbb{S}\_k \tag{2.73}$$

Note, that in the thermal node equations (2.45) and (2.47) only T out <sup>e</sup> or T in <sup>e</sup> has a relevant impact on the temperature T<sup>i</sup> of one of the nodes connected to the pipeline i. This is due to the fact that either max( ˙m, 0) or max(−m, ˙ 0) in (2.47) will become nearly zero depending on the flow direction or that only T out e is taken into account in (2.45). The other temperature T out <sup>e</sup> or T in e respectively does not further impact the model.

After the standard rolling horizon implementation, see Remark 2.1 or Section 3.3, which is used for most of the variables in the approach presented, the rolling horizon implementation for the following parameters <sup>Z</sup>e,k,ζ,σ,k, ˜ <sup>σ</sup>˜ , Z p e,k,ζ,σ,kp,σ˜ , <sup>m</sup>b˙ e,k,ζ,σ, and <sup>κ</sup>e,k,ζ,σ needs special treatment in order to adequately represent possible flow direction changes. The values in κe,k,ζ,σ represent the time steps a water mass has been in the pipeline since entering it, which are important values to determine the temperature losses occurring in the pipe. As soon as these parameters

<sup>54</sup> Note that in [Ben91] this equation is not given for both flow directions, also the notation is slightly different as the weights w are replaced by their exact definition, which is given later in equations (2.100) to (2.102).

are determined, the parameters dependent on <sup>m</sup>b˙ e,k,ζ,σ and <sup>κ</sup>e,k,ζ,σ can be recalculated for the upcoming time step. These dependent parameters<sup>55</sup> are needed to calculate the lossless outlet temperature of a pipeline T out1 with (2.70) as well as the lossy outlet temperature T out2 in (2.71), and will be introduced in Section 2.3.3. Before the special form of rolling horizon parameter assignment, which was developed for this model, is presented, the flow direction path concept is introduced, as it plays an important role thereby.

**The flow direction path concept** As stated above the temperatures and mass flows of the water masses in the pipelines are taken into account throughout the model for positive and negative flow directions. However, representing all 2 n ck possible flow combinations over the entire prediction/simulation horizon48, with the cardinality of the time steps on the prediction horizon n ck = |Sk|, would result in a large number of parameters and variables, which would have to be taken into account. Thus, only the most likely flow conditions are utilized as the

**Figure 2.13:** The Flow Direction Path (FDP) for a pipeline e depicted as a combination of flow directions σ over the time steps k of the prediction horizon assuming constant mass flow and thus equally sized water masses. The Opposed to Flow Direction Path (OFDP) flow directions are also shown, which are directly determined as the opposed flow directions to the FDP, for every time step k. The resulting position ζ of a specific water mass is highlighted to visualize the position changes based on the shown flow directions.

base case, while the model is also equipped with the ability to factor unexpected flow direction changes, e.g. resulting from inaccurate mass flow forecasts <sup>m</sup>b˙ .

<sup>55</sup> <sup>γ</sup>e,k,σ, εe,k,σ, Rwm e,k,σ, Swm e,k,σ, we,k,ζ,σ, and <sup>t</sup>e,k,σ.

### **Definition 2.1**

*The Flow Direction Path (FDP) represents the predicted combination of positive and negative flow directions* σ *for a specific pipeline* e *for every time step* k *on the prediction horizon. These most likely flow conditions are obtained from the network flows of the last optimization. An example of the FDP is provided in Figure 2.13. The mathematical definition is given as:*

$$
\sigma\_{e,k}^{\text{fdp}} = \text{sgn}(\dot{m}\_{e,k}), \quad \forall e \in \mathbb{S}\_e^{\text{pipe}}, \ k \in \mathbb{S}\_k \tag{2.74}
$$

*The combination of flow directions* σ *for the respective pipe* e *over the prediction horizon going in the opposite direction are defined as the Opposed to the Flow Direction Path (OFDP) case, which is analogously provided by:*

$$
\sigma\_{e,k}^{\text{ofdp}} = -\text{sgn}(\dot{m}\_{e,k}), \quad \forall e \in \mathbb{S}\_e^{\text{pipe}}, \ k \in \mathbb{S}\_k \tag{2.75}
$$

*Note, that the values* m˙ e,k *in* (2.74) *and* (2.75) *represent the initial values of the upcoming optimization. As the standard rolling horizon time shift is already performed for all variables at this point within the overall procedure, as explained in detail in Section 3.3.1.*

Based on Definition 2.1 it can be understood, that the FDP and the case OFDP, as shown in Figure 2.13, are determined through the solution of the last optimization/simulation, within the rolling horizon procedure. Thus, both FDP and the OFDP case are fixed during every optimization, always taking into account the latest predictions of the last optimizations and further information as will be explained in detail in Section 3.3.1. During the upcoming solution process of the next optimization/simulation, the sign of the mass flow sgn( ˙me,k) of a certain pipeline e and distinct time step k will affect, if the FDP or the OFDP lossy outlet temperature will have a relevant impact on the node bordering the left or right side of the pipeline. The two possible cases can be seen in Figure 2.13. Regarding a certain pipe e and k1, the first case occurs for sgn( ˙me,k) = 1 as σ fdp = σ + the lossy outlet temperature at the right end of the pipeline T out2 e,k,σ<sup>+</sup> will impact the node temperature at the right end through (2.72) which links T out2 e,k,σ<sup>+</sup> to the thermal node equation (2.45). Analogously, for <sup>k</sup><sup>1</sup> and <sup>σ</sup> ofdp = σ − the left side outlet temperature T out2 e,k,σ<sup>−</sup> will impact the node temperature at the left side of the pipeline. The lossy outlet temperatures are thereby dependent on the pipeline parameters stated in this section and the node temperatures, representing variables during the solution process. Changing mass flow values during the solution procedure affect which outlet temperature of both pipeline ends is used, but not which value this outlet temperature will have. This is comprehensible from (2.70), wherein the weights w are parameters, and (2.71). Therefrom it can be understood, that as soon as an unforeseen flow direction changes occur, the current and all further time steps on the prediction horizon will show deviations. As quality of the predictions are assumed to be of high quality in general and increase for time steps closer to the current point in time, usual temperature deviations are expected to be within the lower single digit range, see Section 2.99. The major advantage of this approach is that it reduces the amount of possible flow conditions taken into account from 2 n ck to 2nck, which has an increasing effect for longer prediction horizons with n ck time steps k. Thus, the advantages coming from the gain in computation time prevail in the context of the application.

As soon as the entire CEPDHN model is solved at a given time step k, the pipeline parameters are updated to optimally suit the latest mass flow values m˙ . Thereby, first, all pipeline parameters on the FDP are updated for all time steps of the prediction horizon of all pipelines, as stated in Case A below. As soon as these values are calculated, the parameters for the flow directions OFDP are also updated, see the description of Case B in the subsequent paragraph. These OFDP values are of relevance to the model in order to approximate the outlet temperature T out2 in the case of an unpredicted mass flow change.

### **Case A: Rolling horizon time step shift of the pipeline parameters on the flow direction path**

The rolling horizon time step shift is performed in ascending order for k starting with k1. There are two main cases that need to be differentiated between within Case A:


These two cases are illustrated in Figure 2.14 and 2.15. The formulas are given below after two further remarks.

**Figure 2.14:** Case A.1: Basic idea of the approach if the flow direction on the flow direction path σ fdp within a pipeline e stays the same between two consecutive time steps k and k + 1, assuming constant mass flows.

<sup>56</sup> Of the new time step.

**Figure 2.15:** Case A.2: Basic idea of approach if the flow direction on the flow direction path σ fdp within a pipeline e changes between two consecutive time steps k and k + 1.

Note that in the following equations, multiple indices again have sub-indices. Thus, for brevity and simplicity, the following notation is defined:

### **Definition 2.2**

*If not explicitly stated differently, all sub-indices result from the so called "main indices", which are the edge* e *(only pipelines here), time step* k*, and flow direction* σ*. Exemplary the following expression can be simplified asa,b:*

$$
\widehat{\dot{m}}\_{e,k-1,\zeta\_{\gamma\_{e,k-1},\sigma^{\text{fdp}}\_{e,k-1}}}, \sigma^{\text{fdp}}\_{e,k-1} = \widehat{\dot{m}}\_{e,k-1,\zeta\_{\gamma},\sigma^{\text{fdp}}} \tag{2.76}
$$

*<sup>a</sup>* Note, that the penultimate and last index, k˜ and σ˜, of the matrices Z and Z<sup>p</sup> do not possess sub-indices. *<sup>b</sup>* The parameter γ in this equation describes the position of the (temporally speaking) last water mass, leaving the pipeline, see Figure 2.12.

The subsequent differing time step types are defined for clarity reasons in the following as:

### **Definition 2.3**

*The time step types occurring are:*


*An illustration of these definitions is provided in Figure 2.16.*

The rolling horizon definition for the pipeline parameters in **Case A.1**, also referred to as *move ahead* are assigned as given below. The predicted water masses <sup>m</sup>b˙ are updated with last measurements or latest predictions resulting from the last optimization m˙ . Note, that only the absolute values are necessary here, as the flow direction information is already available in σ fdp. For the last time step of the prediction horizon no predicted value is available at this point in time, thus this value is assumed to be identical to the mass flow of the next to last time step k = |Sk|. The exact assignment is given by:

$$\hat{\boldsymbol{m}}\_{e,k,\zeta,\sigma^{\rm fdp}} = \begin{cases} |\dot{\boldsymbol{m}}\_{e,k}| \text{ for } \zeta = 1 \text{ and } k < |\mathbb{S}\_k|,\\ |\dot{\boldsymbol{m}}\_{e,k-1}| \text{ for } \zeta = 1 \text{ and } k = |\mathbb{S}\_k|,\\ \forall e \in \mathbb{S}\_e^{\rm pipe}, \ k \in \mathbb{S}\_k, \ \sigma^{\rm fdp} \in \mathbb{S}\_\sigma \end{cases} \tag{2.77}$$

As soon as the values of the first positions ζ<sup>1</sup> in the pipeline are updated, the values for the rest of the positions can be shifted ahead as expected on a moving horizon approach, as always with ascending order of k by:

$$\hat{\boldsymbol{m}}\_{e,k,\zeta,\sigma^{\mathsf{fdp}}}^{\uparrow} = \begin{cases} \hat{\boldsymbol{m}}\_{e,k\_{1},\zeta-1,\sigma^{\mathsf{fdp}}}^{\textbf{brb}} \text{ for } k=1, \text{ and } \zeta < |\mathbb{S}\_{\zeta}|,\\ \hat{\boldsymbol{m}}\_{e,k-1,\zeta-1,\sigma^{\mathsf{fdp}}}^{\textbf{bpr}} \text{ for } k > 1, \text{ and } \zeta < |\mathbb{S}\_{\zeta}|,\\ \frac{1}{\Delta k} \rho^{\textbf{w}} A\_{e}^{\textbf{crs}} L\_{e} \text{ for } \zeta = |\mathbb{S}\_{\zeta}|,\\ \forall \, e \in \mathbb{S}\_{e}^{\textbf{pipe}}, \; k \in \mathbb{S}\_{k}, \; 1 < \zeta \le |\mathbb{S}\_{\zeta}|, \; \sigma^{\mathsf{fdp}} \in \mathbb{S}\_{\sigma} \end{cases} \tag{2.78}$$

The only exception to this procedure is the safety definition utilized for the last position, in order to avoid not fully filled pipelines in the model due to a limited amount of positions in the case of low mass flow rates in the past time steps. Such low mass flow rates occurring in multiple consecutive time steps are unlikely as DHN operators try to keep the water mass circulating in order to prevent accumulation of deposits, as described in last two subsections of Section 3.3.1. However, with the following definition, which artificially extends the water mass of the last position in the pipe model to the size of the entire pipeline, the model can also handle the described scenario<sup>57</sup> .

The new entering time step matrix Z is obtained from:

$$Z\_{e,k,\zeta,\sigma^{\text{fdp}},\tilde{k},\tilde{\sigma}} = \begin{cases} 1, \text{ if } \zeta > 1, k > 1, \text{ and } Z\_{e,k-1,\zeta-1,\sigma^{\text{fdp}},\tilde{k},\tilde{\sigma}} = 1, \\ \text{ or if, } \zeta = 1, \text{ } \tilde{k} = k \text{ and } \sigma^{\text{fdp}} = \tilde{\sigma}, \\ 0, \text{ else,} \end{cases}$$

$$\forall e \in \mathbb{S}\_{e}^{\text{pipe}}, \ k, \tilde{k} \in \mathbb{S}\_{k}, \ \zeta \in \mathbb{S}\_{\zeta}, \ \sigma^{\text{fdp}}, \tilde{\sigma} \in \mathbb{S}\_{\sigma} \tag{2.79}$$

Therein, the matrix element becomes nonzero if one of the following conditions holds. First, a water mass which has entered the pipeline before, during a time step on the prediction horizon, is "pushed" one position ahead by the entering water mass. Second, a water mass is entering the pipeline at the respective time step ˜k = k, and thus filling the first position ζ = 1.

<sup>57</sup> As long as <sup>|</sup>S<sup>ζ</sup> <sup>|</sup> + 1 ≥ |Sk|, the calculation of <sup>γ</sup>, <sup>ε</sup>, <sup>R</sup>, and <sup>S</sup>, which are defined towards the end of the current Section, will always be possible with this definition as well.

Using this notation, the rolling horizon time step shift of the entering past time step matrix Z p is given by:

$$Z\_{e,k,\zeta,\sigma^{\mathrm{fdp}},k^{\mathrm{p}},\tilde{\sigma}}^{\mathrm{p}} = \begin{cases} 1, \text{ if } k > 1, \text{ and } Z\_{e,k-1,\zeta-1,\sigma^{\mathrm{fdp}},k^{\mathrm{p}},\tilde{\sigma}}^{\mathrm{p}} = 1, \\ \quad \text{or if } \zeta = 2, \, k = k^{\mathrm{p}} = 1, \text{and } \sigma^{\mathrm{fdp}} = \tilde{\sigma}, \\ \quad \text{or if } \zeta > 2, \, k = 1, \, k^{\mathrm{p}} > 1, \, \text{and } Z\_{e,k,\zeta-1,\sigma^{\mathrm{fdp}},k^{\mathrm{p}}-1,\tilde{\sigma}}^{\mathrm{p},\mathrm{p}\mathbf{h}} = 1, \\ 0, \text{ else,} \end{cases}$$

$$\forall \, e \in \mathbb{S}\_{e}^{\mathrm{pipe}}, \, \, k \in \mathbb{S}\_{k}, \, \, k^{\mathrm{p}} \in \mathbb{S}\_{k^{\mathrm{p}}}, \, \, \zeta \in \mathbb{S}\_{\zeta}, \, \, \sigma^{\mathrm{fdp}}, \, \bar{\sigma} \in \mathbb{S}\_{\sigma} \quad \text{(2.80)}$$

Elements of this sparse matrix are nonzero in the following three conditions:


The definition of the amounts of time steps a respective water mass was in the pipeline can be calculated by increasing the value of the last time step by one. Only the water mass in the first position is regarded as just entering the pipeline and thus the current time step is not taken into account here. The resulting equation is given by:

$$\kappa\_{e,k,\zeta,\sigma^{\rm fdp}} = \begin{cases} 0, \text{ if } \zeta = 1, \\ \kappa\_{e,k,\zeta-1,\sigma^{\rm fdp}}^{\text{brh}} + 1, \text{ for } \zeta \neq 1, \text{ and } k = 1, \\ \kappa\_{e,k-1,\zeta-1,\sigma^{\rm fdp}} + 1, \text{ for } \zeta \neq 1, \text{ and } k > 1, \\ \forall e \in \mathbb{S}\_{e}^{\text{pipe}}, \ k \in \mathbb{S}\_{k}, \ \zeta \in \mathbb{S}\_{\zeta}, \ \tilde{\sigma} \in \mathbb{S}\_{\sigma} \end{cases} \tag{2.81}$$

In **Case A.2**, also named *insert and copy previous time step*, when the flow direction on the flow direction path σ fdp changes between two consecutive time steps, the pipeline storage parameters are assigned as follows: For the first position ζ1, measurement data or results of the last optimization are utilized for the parameter definition. Visually speaking these values are newly *inserted* into the model, see the water mass marked in orange in Figure 2.15. Additionally, the values for all positions ζ > 1 are assigned from the parameters already derived for the last time step (*copy previous time step*).

<sup>58</sup> Note that this condition can also be understood as the transition of a nonzero matrix element (representing a water mass) from Z to Zp.

<sup>59</sup> Note, that as indicated by Definition 2.3 the index k<sup>1</sup> in Zp,brh refers to a different time step than k<sup>1</sup> in Zp. Precisely, these two indexes k<sup>1</sup> describe two subsequent time steps, as can be understood from Figure 2.16.

The parameters of the predicted water masses <sup>m</sup>b˙ are updated as follows for the first time step k1:

$$
\hat{\hat{m}}\_{e,k\_{1},\zeta,\sigma^{\text{dip}}} = \begin{cases}
\hat{\hat{m}}\_{e,k\_{1},\zeta,\sigma^{\text{dip}}}^{\text{turb}} - \frac{1}{\Delta k} (R\_{e,k\_{1},\sigma^{\text{dip}}}^{\text{rem},\text{kph}} - \rho^{\text{w}} A\_{e}^{\text{cross}} L\_{e}) & \text{for } \zeta = 2 \\
\hat{\hat{m}}\_{e,k\_{1},\zeta,\sigma^{\text{dip}}}^{\text{turb}} & \text{for } \zeta = 3 \\
\vdots & \vdots & \vdots \\
\hat{\hat{m}}\_{e,k\_{1},\zeta\_{1},\sigma^{\text{dip}}}^{\text{btr}} & \text{for } \zeta = 2 + \gamma\_{e,k\_{1},\sigma^{\text{dip}}}^{\text{btr}} - 1 \\
\frac{1}{\Delta k} \rho^{\text{w}} A\_{e}^{\text{cross}} L\_{e} & \vdots \\
\vdots & \vdots & \vdots \\
\frac{1}{\Delta k} \rho^{\text{w}} A\_{e}^{\text{cross}} L\_{e} & \text{for } \zeta = |\mathbb{S}\_{\zeta}| \\
\end{cases}
$$

$$
\forall e \in \mathbb{S}\_{e}^{\text{pipe}}, \quad \zeta \in \mathbb{S}\_{\zeta}, \quad \sigma^{\text{dip}} \in \mathbb{S}\_{\sigma}
$$

and as follows for all further time steps:

$$
\hat{\boldsymbol{m}}\_{e,k,\zeta,\sigma^{\text{dip}}} = \begin{cases}
\hat{\boldsymbol{m}}\_{e,k-1,\zeta\_{\sigma},\sigma^{\text{dip}}} - \frac{1}{\Delta k} (R\_{e,k-1,\sigma^{\text{dip}}}^{\text{run}} - \rho^{\text{w}} A\_{e}^{\text{cross}} L\_{e}) & \text{for } \zeta = 2 \\
\hat{\boldsymbol{m}}\_{e,k-1,\zeta\_{\sigma},\sigma^{\text{dip}}} & \text{for } \zeta = 3 \\
\vdots & \vdots & \vdots \\
\hat{\boldsymbol{m}}\_{e,k-1,\zeta\_{\zeta},\sigma^{\text{dip}}} & \text{for } \zeta = 2 + \gamma\_{e,k-1,\sigma^{\text{dip}}} - 1 \\
\frac{1}{\Delta k} \rho^{\text{w}} A\_{e}^{\text{cross}} L\_{e} & \vdots \\
\vdots & \vdots & \vdots \\
\frac{1}{\Delta k} \rho^{\text{w}} A\_{e}^{\text{cross}} L\_{e} & \text{for } \zeta = |\mathbb{S}\_{\zeta}| \\
\end{cases}
$$

$$
\forall \ e \in \mathbb{S}\_{e}^{\text{pipe}}, \quad k > 1 \in \mathbb{S}\_{k}, \ \zeta \in \mathbb{S}\_{\zeta}, \quad \sigma^{\text{dip}} \in \mathbb{S}\_{\sigma}
$$

The values of the predicted water masses <sup>m</sup>b˙ for the first position <sup>ζ</sup><sup>1</sup> are updated with measurements or latest predictions resulting from the last optimization m˙ . Then all parameters which can be copied from the previous time step are utilized. In this context, Definition 2.2 has to be taken into account, as it concretizes the notation. For the second position ζ = 2, the water mass from the previous time step <sup>m</sup>b˙ e,k−1,ζ<sup>γ</sup> ,σfdp , is reduced by the amount of water, which has already left the pipeline. For this assignment the values of two further parameters γ and Rwm are necessary, see Figure 2.12. The exact form of calculation of these parameters is given in equation (2.98a) and (2.99a). The first describes the position of the last water mass which is leaving the pipeline, in the respective time step and flow direction. The second defines the aggregated water mass of all water elements on the positions from the beginning of the pipeline up to the one determined by γ. Note, that these parameters γ and Rwm are always updated based on the current values of the predicted mass flows <sup>m</sup>b˙ . The last value, which can be copied is taken from the first position of the previous time step ζ1. All further predicted water masses for the positions ζ > 2 + γe,k−1,σfdp − 1 are then set to the value which fills the pipeline in a single time step <sup>1</sup> ∆k ρ <sup>w</sup>Across <sup>e</sup> Le. Again, this prevents the unexpected case, that the pipeline could be "not completely filled" with water masses, within the model in case of a small number of positions |S<sup>ζ</sup> | and low mass flows in the current and past time steps<sup>60</sup>. Also take into account the following aspects:


Further, the rolling horizon time step shift for Case A.2 of the entering time step matrix Z is given by:

$$Z\_{e,k,\zeta,\sigma^{\mathrm{fdp}},\tilde{k},\tilde{\sigma}} = \begin{cases} 1, \text{ if } \zeta = 1, \, \tilde{k} = k, \text{ and } \sigma^{\mathrm{fdp}} = \tilde{\sigma}, \\ \text{ or if } \zeta > 1, \text{ and } k > 1, \text{ and } Z\_{e,k-1,\stackrel{\circ}{\zeta},\sigma^{\mathrm{fdp}},\tilde{k},\tilde{\sigma}} = 1 \\ \text{ with } \zeta = 2 + \gamma\_{e,k-1,\sigma^{\mathrm{fdp}}} - \zeta, \\ 0, \text{ else,} \end{cases}$$

$$\forall \, e \in \mathbb{S}\_{e}^{\mathrm{pipe}}, \quad k, \tilde{k} \in \mathbb{S}\_{k}, \; \zeta, \dot{\zeta} \in \mathbb{S}\_{\zeta}, \quad \sigma^{\mathrm{fdp}}, \tilde{\sigma} \in \mathbb{S}\_{\sigma} \tag{2.84}$$

Elements of the sparse matrix are nonzero if either the element represents a water mass which is just about to enter the pipeline or if the element represents a water mass which was in the pipeline before. In this case the conditions (considering the entering time step ˜k and entering flow direction σ˜) can be copied from the opposite flow direction which was present in the previous time step (on the FDP ) in the regarded Case A.261,62 .

### **Remark 2.3:**

*The index* ˚ζ *is used here, to determine the positions of the last time step, which are now "copied" to the current time step. Thereby, the* □˚ *operator is chosen, instead of the previously used* □˜ *operator within the indices of e.g.* Z*. This difference is chosen as the* □˜ *operator refers to other time steps and flow directions, where the water masses entered the pipeline, while the* □˚ *operator indicates a certain position which is determined by the copying procedure.*

<sup>60</sup> Theoretically, all predicted water masses <sup>m</sup>b˙ for the positions ζ > 2 + <sup>γ</sup>e,k−1,σfdp <sup>−</sup> 1 + 1 could also be set to 0 as they are not further needed for the approach in theory. However, defining them as in equation (2.83), also leads to feasible solutions of (2.98a) in the very unlikely case of previous and current mass flow values of <sup>m</sup>b˙ <sup>≈</sup> <sup>0</sup> and numeric inaccuracies, e.g. if stop criteria of solvers would be loosened.

<sup>61</sup> Note that σ fdp is dependent on the time step here, as given in Definition 2.1 above.

<sup>62</sup> The used values of <sup>γ</sup> are always updated, based on the new determined values of <sup>m</sup>b˙ in the assignment process.

The elements of the past time step entering time matrix Z p is defined by:

$$Z\_{e,k,\zeta,\sigma^{\mathrm{dip}},k^{\mathrm{p}},\tilde{\sigma}}^{\mathrm{p}} = \begin{cases} 1,\ \text{if } k=\bar{k}=k^{\mathrm{p}}=1,\ \text{and }\bar{\zeta}\_{1}=2+\gamma\_{e,k^{\mathrm{p}},\sigma^{\mathrm{dip}}}^{\mathrm{rph}}-\zeta,\\ \qquad\text{and } Z\_{e,k,\zeta,\sigma^{\mathrm{dip}},k^{\mathrm{p}},\tilde{\sigma}}^{\mathrm{rph}}=1,\ \text{and }\sigma\_{e,k}^{\mathrm{fp}}=\tilde{\sigma}\_{e,k},\\ \qquad\text{or if } k>1,\ \text{and }Z\_{e,k-1,\zeta,\sigma^{\mathrm{dip}},k^{\mathrm{p}},\tilde{\sigma}}^{\mathrm{p}}=1\\ \qquad\quad\text{with }\bar{\zeta}=2+\gamma\_{e,k-1,\sigma^{\mathrm{dip}}}-\zeta,\\ \qquad\text{or if }\zeta>1,\ k=1,\ k^{\mathrm{p}}>1,\ \text{and }Z\_{e,k,\zeta,\sigma^{\mathrm{dip}},k^{\mathrm{p}},\mathcal{S}^{\mathrm{p}}-1,\tilde{\sigma}}^{\mathrm{p},\mathrm{bph}}=1,\\ \qquad\quad\text{with }\bar{\zeta}=2+\gamma\_{e,k,1,\sigma^{\mathrm{dip}}}^{\mathrm{bph}}-\zeta,\\ \}0,\ \text{else},\\ \qquad\quad\forall\,e\in\mathbb{S}\_{e}^{\mathrm{pipe}},\ k,\bar{k}\in\mathbb{S}\_{k},\ k^{\mathrm{p}}\in\mathbb{S}\_{k^{\mathrm{p}}},\ \zeta,\bar{\zeta}\in\mathbb{S}\_{\mathrm{s}},\ \sigma^{\mathrm{dip}},\bar{\sigma}\in\mathbb{S}\_{\mathrm{s}}\tag{2.85}} \end{cases}$$

For the following three cases the elements are nonzero:


The following Example 2.1 illustrates the provided equations (2.84) and (2.85).

### **Example 2.1:**

*The regarded example is shown in Figure 2.17. As this is a visualization of Case A.2, the flow directions looked at within this example represent the flow directions on the flow direction path* σ fdp e1,k<sup>3</sup> = σ <sup>+</sup> *and* σ fdp e1,k<sup>4</sup> = σ <sup>−</sup>*. The flow directions not on the flow direction path are shown transparent in Figure 2.17.*

**Figure 2.17:** Example for Case A.2: Basic idea of approach if the flow direction on the flow direction path σ fdp within a pipeline e changes between two consecutive time steps k and k + 1.

*For this example it is assumed, that the* Z *and* Z p *are already updated for pipeline/edge* e1*, time step* k<sup>3</sup> *with positive flow direction* σ <sup>+</sup>*. These values are shown in Figure 2.17 and below:*

Ze1,k3,ζ,σ+,k, ˜ <sup>σ</sup>˜<sup>+</sup> = ˜k1 ˜k2 ˜k3 ˜k4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 , Ze1,k3,ζ,σ+,k, ˜ <sup>σ</sup>˜<sup>−</sup> = ˜k1 ˜k2 ˜k3 ˜k4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (2.86) Z p <sup>e</sup>1,k3,ζ,σ+,kp,σ˜<sup>+</sup> = k p 1 k p 2 k p 3 k p 4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 , Z p <sup>e</sup>1,k3,ζ,σ+,kp,σ˜<sup>−</sup> = k p 1 k p 2 k p 3 k p 4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 (2.87)

*Based on the above, the novel matrix* Z *and* Z p *entries for the next time step* k<sup>4</sup> *with negative flow direction* σ <sup>−</sup> *are calculated with* (2.84) *as well as* (2.85) *and given by:*

Ze1,k4,ζ,σ−,k, ˜ <sup>σ</sup>˜<sup>+</sup> = ˜k1 ˜k2 ˜k3 ˜k4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 , Ze1,k4,ζ,σ−,k, ˜ <sup>σ</sup>˜<sup>−</sup> = ˜k1 ˜k2 ˜k3 ˜k4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (2.88) Z p <sup>e</sup>1,k4,ζ,σ−,kp,σ˜<sup>+</sup> = k p 1 k p 2 k p 3 k p 4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 , Z p <sup>e</sup>1,k4,ζ,σ−,kp,σ˜<sup>−</sup> = k p 1 k p 2 k p 3 k p 4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (2.89)

*Note, that the value* <sup>γ</sup>e,k−1,σfdp *used in* (2.84) *to determine the new values of* <sup>Z</sup>e1,k4,ζ,σ−,k, ˜ <sup>σ</sup>˜ *is given by* γe1,k3,σ<sup>+</sup> = 4*. Further, the same value is used in* (2.85) *to determine* Ze1,k4,ζ,σ−,kp,σ˜*. The blue marked entry is optional and represents the additional accuracy measure described in Remark 2.4.*

The number of time steps a water mass was in the pipeline κ is updated for the first time step k<sup>1</sup> by:

$$
\kappa\_{e,k\_1,\zeta,\sigma^{\text{disp}}} = \begin{cases}
0 & \text{for } \zeta = 1 \\
\kappa\_{e,k\_1,\zeta,\sigma^{\text{disp}}}^{\text{brb}} + 1 & \text{for } \zeta = 2 \\
\kappa\_{e,k\_1,\zeta,\sigma^{\text{disp}}}^{\text{brb}} + 1 & \text{for } \zeta = 3 \\
\vdots & \vdots \\
\kappa\_{e,k\_1,\zeta,\sigma^{\text{disp}}}^{\text{brb}} + 1 & \text{for } \zeta = 2 + \gamma\_{e,k\_1,\sigma^{\text{disp}}}^{\text{brb}} - 1 \\
0 & \vdots \\
\vdots & \vdots \\
0 & \text{for } \zeta = |\mathbb{S}\_{\zeta}| \\
\end{cases}
$$

$$
\forall e \in \mathbb{S}\_e^{\text{pipe}}, \quad \zeta, \dot{\zeta} \in \mathbb{S}\_{\zeta}, \quad \bar{\sigma} \in \mathbb{S}\_{\sigma}
$$

and for all following time steps by:

$$
\kappa\_{e,k,\zeta,\sigma^{\rm fdp}} = \begin{cases}
0 & \text{for } \zeta = 1 \\
\kappa\_{e,k-1,\zeta\_{\gamma},\sigma^{\rm fdp}} + 1 & \text{for } \zeta = 2 \\
\kappa\_{e,k-1,\zeta\_{\gamma}-1,\sigma^{\rm fdp}} + 1 & \text{for } \zeta = 3 \\
\vdots & \vdots \\
\kappa\_{e,k-1,\zeta\_{1},\sigma^{\rm fdp}} + 1 & \text{for } \zeta = 2 + \gamma\_{e,k-1,\sigma^{\rm fdp}} - 1 \\
0 & \vdots \\
\vdots & \vdots \\
0 & \text{for } \zeta = |\mathbb{S}\_{\zeta}| \\
\end{cases}
$$

$$
\forall e \in \mathbb{S}\_{e}^{\rm pipe}, \ k > 1 \in \mathbb{S}\_{k}, \ \zeta, \dot{\zeta} \in \mathbb{S}\_{\zeta}, \ \bar{\sigma} \in \mathbb{S}\_{\sigma}
\tag{2.91}
$$

As in equation (2.81), the elements in the first position ζ = 1 of the pipeline are set to 0, while all further values are *copied from the previous time step* and increased by one. The values of all elements, which are not known as they can not be copied from the previous time step as ζ > 2 + γe,k−1,σfdp − 1, are set to κ = 0, as they also do not impact the calculation of the outlet temperature<sup>63</sup> .

After all parameters on the rolling horizon have been newly assigned as given above, the parameters for all cases not on the flow direction path are updated based on the new values on the flow direction path as given below.

<sup>63</sup> In contrast to the assignment of the predicted mass flows <sup>m</sup>b˙ in equation (2.83), no safety definition is performed here, as the value of κ has much less impact on T out2 as the values of <sup>m</sup>b˙ .

### **Case B: Rolling horizon time step shift of the pipeline parameters not on the flow direction path**

In analogy to Case A.2 stated above, the central idea of Case B is to *insert and copy from the current time step*, as shown in Figure 2.18. For the first position ζ<sup>1</sup> measurement data or results of the last optimization are utilized for the parameter definition. Then, values of the parameters for the positions ζ > 1 OFDP are copied from the parameters which have already been updated on the FDP. The main difference between Case B and Case A.2 is that parameters describing water masses of different parts of the "source pipeline" are copied in both cases. In Case A.2 the water masses copied from the previous time step are found in the positions ζ ≤ ζγ, describing all water masses in the pipeline up to the last water mass which is leaving the pipeline in the previous time step. While in Case B all water masses starting from the second position ζ<sup>2</sup> up to the first water mass which is leaving the pipeline ζ<sup>ε</sup> in the current time step are copied. Following this principle the predicted water masses <sup>m</sup>b˙ are given as stated:

**Figure 2.18:** Case B: Basic idea of new assignment of the pipeline parameters opposed to the flow direction path σ ofdp for a time step k by inserting and copying from the current time step. Note that in this example σ fdp = σ <sup>+</sup> and thus σ ofdp = σ−. Further it should be kept in mind, that the amount of water flowing into the pipeline is equal to the amount of water leaving the pipeline at a certain time step, see Figure 2.12. An explanation of the water mass marked with T = 0 is provided later in Remark 2.4.

$$
\hat{\boldsymbol{m}}\_{e,k,\zeta,\sigma^{\text{ddp}}} = \begin{cases}
\hat{\boldsymbol{m}}\_{e,k,\zeta\_e,\sigma^{\text{ddp}}} - \frac{1}{\Delta k} (S\_{e,k,\sigma^{\text{ddp}}}^{\text{rpm}} - \rho^{\text{w}} A\_e^{\text{cross}} L\_e) & \text{for } \zeta = 2 \\
\hat{\boldsymbol{m}}\_{e,k,\zeta\_e,\sigma^{\text{ddp}}} & \text{for } \zeta = 3 \\
\vdots & \vdots \\
\hat{\boldsymbol{m}}\_{e,k,\zeta\_2,\sigma^{\text{ddp}}} & \text{for } \zeta = 2 + \varepsilon\_{e,k,\sigma^{\text{ddp}}} - 1 \\
\frac{1}{\Delta k} \rho^{\text{w}} A\_e^{\text{cross}} L\_e & \vdots \\
\vdots & \vdots \\
\frac{1}{\Delta k} \rho^{\text{w}} A\_e^{\text{cross}} L\_e & \text{for } \zeta = |\mathbb{S}\_{\zeta}| \\
\end{cases}
$$

$$
\forall e \in \mathbb{S}\_e^{\text{pipe}}, \ k \in \mathbb{S}\_k, \ \zeta, \bar{\zeta} \in \mathbb{S}\_{\zeta}, \ \sigma^{\text{fdp}}, \sigma^{\text{ofdp}} \in \mathbb{S}\_{\sigma}
$$

Here, and in the following equations it is important to note that the flow directions are distinguished as on the FDP σ fdp and OFDP σ ofdp. The predicted mass flow of the first position ζ<sup>1</sup> is updated with the last values of the optimization or if available the respective sensors. Then, for the second position ζ2, the parameter is updated by subtracting the water mass S wm, see Figure 2.12, from the sum of the entire water mass of the pipeline ρ <sup>w</sup>Across <sup>e</sup> L<sup>e</sup> and the first water mass which is currently leaving the pipeline in the FDP case. This first water mass has the position ε. The parameters ε and S wm are calculated with equation (2.98b) and (2.99b). Note, that ε and S wm are always updated with the latest values of <sup>m</sup>b˙ . All following positions with 2 < ζ ≤ 2 + εe,k,σfdp − 1 are simply copied. In analogy to equation (2.83) the predicted water masses <sup>m</sup>b˙ are set to the mass flow, which is necessary to fill the entire pipeline within one time step 1 ∆k ρ <sup>w</sup>Across <sup>e</sup> <sup>L</sup><sup>e</sup> in order to prevent model inaccuracies in case of numeric issues<sup>60</sup> .

The elements of the entering time step and flow direction matrix Z are given as follows for Case B:

$$Z\_{e,k,\zeta,\sigma^{\text{cdfp}},\tilde{k},\tilde{\sigma}} = \begin{cases} 1, \text{ if } \zeta = 1 \text{ and } \tilde{k} = k \text{ and } \sigma^{\text{cdfp}} = \tilde{\sigma}, \\ \quad \text{or if } Z\_{e,k,\dot{\zeta},\sigma^{\text{fdp}},\tilde{k},\tilde{\sigma}} = 1 \\ \quad \text{ with } \zeta = 2 + \varepsilon\_{e,k,\sigma^{\text{fdp}}} - \zeta, \\ 0, \text{ else,} \\ 0, \text{ else,} \end{cases}$$

$$\forall \, e \in \mathbb{S}\_{e}^{\text{pipe}}, \quad k, \tilde{k} \in \mathbb{S}\_{k}, \ \zeta, \dot{\zeta} \in \mathbb{S}\_{\zeta}, \quad \sigma^{\text{fdp}}, \sigma^{\text{cdfp}}, \tilde{\sigma} \in \mathbb{S}\_{\sigma} \tag{2.93}$$

Therein, the elements are nonzero if either a new element is *inserted* or if the elements are *copied* from the FDP of *the current time step*. In this context, the equation ˚ζ = 2 +εe,k,σfdp −ζ maps the respective positions of the water mass elements in the pipeline model on the FDP and OFDP. An example for the determination of Z in Case B is provided in Example 2.2. The past entering time step and flow direction matrix Z p is defined similarly as:

$$Z\_{e,k,\zeta,\sigma^{\text{cldp}},k^{\text{p}},\tilde{\sigma}}^{\text{p}} = \begin{cases} 1, \text{ if } Z\_{e,k,\tilde{\zeta},\sigma^{\text{cldp}},k^{\text{p}},\tilde{\sigma}}^{\text{p}} = 1 \\ \text{ with } \tilde{\zeta} = 2 + \varepsilon\_{e,k,\sigma^{\text{cldp}}} - \zeta, \\ 0, \text{ else,} \end{cases}$$

$$\forall e \in \mathbb{S}\_{e}^{\text{pipe}}, \ k, \tilde{k} \in \mathbb{S}\_{k}, \ k^{\text{p}} \in \mathbb{S}\_{k^{\text{p}}}, \ \zeta, \tilde{\zeta} \in \mathbb{S}\_{\zeta}, \ \sigma^{\text{cldp}}, \sigma^{\text{cdfp}}, \tilde{\sigma} \in \mathbb{S}\_{\sigma} \tag{2.94}$$

Note, that this updating process is simple here as only some information is *copied* from the FDP of *the current time step* therefore. Exemplary values are also given in the following Example 2.2.

### **Example 2.2:**

*An example for Case B is depicted in Figure 2.19. Note, that the flow direction on the flow direction path is* σ fdp e1,k<sup>3</sup> = σ +*.*

**Figure 2.19:** Example for Case B: Basic idea of new assignment of the pipeline parameters opposed to the flow direction path σ ofdp for time step k<sup>3</sup> by inserting and copying from the current time step. Note that in this example σ fdp = σ <sup>+</sup> and thus σ ofdp = σ−. An explanation of the water mass marked with T = 0 is provided in Remark 2.4.

*For this example it is assumed, that the* Z *and* Z p *are already updated for pipeline/edge* e1*, time step* k<sup>3</sup> *with positive flow direction* σ <sup>+</sup>*. These values are shown in Figure 2.19 and given in* (2.86) *and* (2.87)*. Based on these, the novel matrix entries of* Z *and* Z p *for the opposed negative flow direction* σ <sup>−</sup> *are calculated with* (2.93) *as well as* (2.94) *and given by:*

Ze1,k3,ζ,σ−,k, ˜ <sup>σ</sup>˜<sup>+</sup> = ˜k1 ˜k2 ˜k3 ˜k4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 , Ze1,k3,ζ,σ−,k, ˜ <sup>σ</sup>˜<sup>−</sup> = ˜k1 ˜k2 ˜k3 ˜k4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (2.95) Z p <sup>e</sup>1,k3,ζ,σ−,kp,σ˜<sup>+</sup> = k p 1 k p 2 k p 3 k p 4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 , Z p <sup>e</sup>1,k3,ζ,σ−,kp,σ˜<sup>−</sup> = k p 1 k p 2 k p 3 k p 4 ζ1 ζ2 ζ3 ζ4 ζ5 ζ6 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 (2.96)

*The value* <sup>ε</sup>e,k,σfdp *used in* (2.93) *to determine the new values of* <sup>Z</sup><sup>e</sup>1,k3,ζ,σ−,k, ˜ <sup>σ</sup>˜ *is given by* ε<sup>e</sup>1,k3,σ<sup>+</sup> = 5*. Further, the same value is used in* (2.94) *to determine* Z<sup>e</sup>1,k3,ζ,σ−,kp,σ˜*. The blue marked entry is optional and represents the additional accuracy measure described in Remark 2.4.*

Also the values for the number of time steps a water mass was in the pipeline κ are updated accordingly to the previous assignments in Case B:

$$\kappa\_{e,k,\zeta,\sigma^{\mathrm{cdip}}} = \begin{cases} 0 & \text{for } \zeta = 1 \\ \kappa\_{e,k,\zeta\_e,\sigma^{\mathrm{d\mathrm{d\bar{p}}}}} & \text{for } \zeta = 2 \\ \kappa\_{e,k,\zeta\_e-1,\sigma^{\mathrm{d\bar{p}}}} & \text{for } \zeta = 3 \\ \vdots & \vdots \\ \kappa\_{e,k,\zeta\_2,\sigma^{\mathrm{d\bar{p}}}} & \text{for } \zeta = 2 + \varepsilon\_{e,k,\sigma^{\mathrm{d\bar{p}}}} - 1 \\ 0 & \vdots \\ \vdots & \vdots \\ 0 & \text{for } \zeta = |\mathbb{S}\_{\zeta}| \end{cases} \quad \text{for } \zeta = |\mathbb{S}\_{\zeta}|$$

$$\forall \, e \in \mathbb{S}\_{e}^{\mathrm{pipe}}, \ k \in \mathbb{S}\_{k}, \ \zeta, \bar{\zeta} \in \mathbb{S}\_{\zeta}, \ \sigma^{\mathrm{d\bar{p}}}, \sigma^{\mathrm{d\bar{p}}}, \bar{\sigma} \in \mathbb{S}\_{\sigma} \tag{2.97}$$

The values of κ for the new *inserted* water masses on position ζ = 1 are set to κ = 0, while all further values are *copied* as in the earlier assignments of Case B above.

### **Remark 2.4:**

*When copying water masses from the current or previous time step in Case A.2 or Case B some water masses outside the newly assigned pipeline, will possess the temperature value* T = 0*. An example of this case is shown as the white water mass in Figure 2.18. In theory, the approach will always provide sufficiently filled pipes as well as out flowing water masses with accordingly assigned node temperatures to enable an accurate calculation of the outlet temperature of the pipelines* T out2*. However, in case of numerical inaccuracy of the calculation of the outlet temperature of the pipeline, a small fraction of the last water mass with* T = 0 *could be used by the approach. The resulting error through this effect is neglectable. Still, for example if larger solver tolerances are to be used, this effect can be simply reduced. Therefore, visually speaking, the temperature is kept constant at the end of the pipeline, as soon as no temperature values are known any more. This is done by setting the last water masses of the pipeline model, which would usually not be set (thus* T = 0*), to the temperature of the last known water mass temperature. This would be the dark red water mass to the right of the white water mass in Figure 2.18. In this case all values of* Z *and* Z p *, which do not have a nonzero entry, over all dimensions for a certain position* ζ ∈ S<sup>ζ</sup> *, are set to the last set time step* k *or* k p *. See Example 2.1 for an illustration.*

In summary, the above explanations described how the pipeline parameters <sup>Z</sup>e,k,ζ,σ,k, ˜ <sup>σ</sup>˜ ,

Z p e,k,ζ,σ,kp,σ˜ , <sup>m</sup>b˙ e,k,ζ,σ, and <sup>κ</sup>e,k,ζ,σ are updated the realize the rolling horizon time shift. The matrices Z and Z p are used to assign the respective (past) node temperatures to the water masses in the pipelines. As explained in the upcoming paragraph the mass flow values <sup>m</sup>b˙ are used to determine the weights w used to define which out flowing water mass should be taken into account by which percentage in the weighted sum used to calculate the lossless outlet temperature in (2.70). Further, the parameters κ, which describe the amounts of time steps a water mass was in the given pipeline, are used to calculate the length of stay of the leaving water mass.

**Calculation of Pipeline Parameters Dependent on Updated Values of** m˙ **and** κ **of the Water Masses** Based on the newly calculated stored mass flow values <sup>m</sup>b˙ e,k,ζ,σ, the pipeline position parameters γe,k,σ, εe,k,σ are updated as defined below:

$$\gamma\_{e,k,\sigma} = \min\_{x} \left\{ x : \qquad \sum\_{\zeta=1}^{x} \left( \hat{m}\_{e,k,\zeta,\sigma} \Delta k \right) \ge \rho^{\le} A\_{e}^{\text{cross}} L\_{e},$$

$$x \ge 1, \ x \in \mathbb{Z} \right\}, \qquad \forall \, e \in \mathbb{S}\_{e}^{\text{pipe}}, k \in \mathbb{S}\_{k}, \sigma \in \mathbb{S}\_{\sigma} \tag{2.98a}$$

$$\varepsilon\_{e,k,\sigma} = \min\_{z} \left\{ z : \qquad \sum\_{\zeta=2}^{z} \left( \hat{m}\_{e,k,\zeta,\sigma} \Delta k \right) \ge \rho^{\le} A\_{e}^{\text{cross}} L\_{e},$$

$$z \ge 2, \ z \in \mathbb{Z} \right\}, \qquad \forall \, e \in \mathbb{S}\_{e}^{\text{pipe}}, k \in \mathbb{S}\_{k}, \sigma \in \mathbb{S}\_{\sigma} \tag{2.98b}$$

An intuitive understanding of the positions defined by these parameters can be obtained from Figure 2.12. The pipeline position parameter γ defines the temporally seen last water mass leaving the pipeline e in the current time step k for a given flow direction σ. Analogously the position ε defines the first water mass leaving the pipeline. Based on these values also the auxiliary water masses Rwm e,k,σ, and <sup>S</sup> wm e,k,σ can be calculated as stated:

$$R\_{e,k,\sigma}^{\mathrm{wym}} = \sum\_{\zeta=1}^{\gamma\_{e,k,\sigma}} \left( \hat{\tilde{m}}\_{e,k,\zeta,\sigma} \Delta k \right), \qquad \forall \, e \in \mathbb{S}\_e^{\mathrm{pipe}}, k \in \mathbb{S}\_k, \sigma \in \mathbb{S}\_{\sigma} \tag{2.99a}$$

$$S\_{e,k,\sigma}^{\mathrm{wym}} = \left\{ \left. \sum\_{\zeta=1}^{e\_{e,k,\sigma}-1} \left( \hat{\tilde{m}}\_{e,k,\zeta,\sigma} \Delta k \right), \right. \right. \right. \\\\ \left. \left. \begin{aligned} \left( \hat{\tilde{m}}\_{e,k,\zeta,\sigma} \Delta k \right), \\ \quad \text{if } e \in \mathbb{S}\_e^{\mathrm{pipe}}, k \in \mathbb{S}\_k, \sigma \in \mathbb{S}\_{\sigma} \\ \quad R\_{e,k,\sigma}^{\mathrm{wym}}, \qquad \text{else}, \end{aligned} \right. \right. \\\\ \left. \tag{2.99b}$$

Regarding Figure 2.12 it is understood, that Rwm defines the aggregated water mass of all water elements on the positions from the beginning of the pipeline up to the one determined by γ. Similarly the auxiliary water mass S wm is defined by the position ε − 1. Taking into account the parameters γe,k,σ, εe,k,σ, Rwm e,k,σ, and <sup>S</sup> wm e,k,σ also the weights can be defined <sup>w</sup>e,k,ζ,σ as:

$$w\_{e,k,\zeta,\sigma} = \frac{1}{|\dot{m}\_{e,k}|\Delta k} (R\_{e,k,\sigma}^{\text{wm}} - \rho^{\text{w}} A\_e^{\text{cross}} L\_e),$$

$$\text{if } \zeta = \gamma\_{e,k,\sigma}, \forall e \in \mathbb{S}\_e^{\text{pipe}}, k \in \mathbb{S}\_k, \sigma \in \mathbb{S}\_\sigma,\tag{2.100}$$

$$1 \qquad \qquad \qquad \qquad \qquad \qquad \vert \llcorner \rangle.\tag{2.101}$$

$$\begin{aligned} w\_{e,k,\zeta,\sigma} &= \overline{|\dot{m}\_{e,k}|\Delta k} (|\dot{m}\_{e,k,\zeta,\sigma}|\Delta k) \\ &\text{if } \gamma\_{e,k,\sigma} < \zeta < \varepsilon\_{e,k,\sigma}, \forall e \in \mathbb{S}\_e^{\text{pipe}}, k \in \mathbb{S}\_k, \sigma \in \mathbb{S}\_\sigma \\ &\qquad \{\cdot \quad : \quad \cdot \quad \cdot \quad \text{---} \quad \text{---} \quad \} \end{aligned} \tag{2.101}$$

$$w\_{e,k,\zeta,\sigma} = \begin{cases} \frac{1}{|\dot{m}\_{e,k}|\Delta k} (|\dot{m}\_{e,k}|\Delta k + \rho^{\rm w} A\_e^{\rm cross} L\_e - S\_{e,k,\sigma}^{\rm wm}),\\ \text{if } \zeta = \varepsilon\_{e,k,\sigma} \text{ and } \gamma\_{e,k,\sigma} < \varepsilon\_{e,k,\sigma}, \forall \, e \in \mathbb{S}\_e^{\rm pipe}, k \in \mathbb{S}\_k, \sigma \in \mathbb{S}\_\sigma,\\ \frac{1}{|\dot{m}\_{e,k}|\Delta k} (|\dot{m}\_{e,k}|\Delta k + \rho^{\rm w} A\_e^{\rm cross} L\_e - S\_{e,k,\sigma}^{\rm wm}) + w\_{e,k,\zeta,\sigma},\\ \text{if } \zeta = \varepsilon\_{e,k,\sigma} \text{ and } \gamma\_{e,k,\sigma} = \varepsilon\_{e,k,\sigma}, \forall \, e \in \mathbb{S}\_e^{\rm pipe}, k \in \mathbb{S}\_k, \sigma \in \mathbb{S}\_\sigma \end{cases} \tag{2.102}$$

Using these weights w, the length of stay within the pipeline te,k,σ of the leaving water mass can be calculated by a weighted sum, as:

$$t\_{e,k,\sigma} = \left(w\_{e,k,\gamma,\sigma}\kappa\_{e,k,\gamma,\sigma} + \sum\_{\zeta=\gamma+1}^{\varepsilon-1} w\_{e,k,\zeta,\sigma}\kappa\_{e,k,\zeta,\sigma} + w\_{e,k,e,\sigma}\kappa\_{e,k,e,\sigma}\right)\Delta k$$

$$= \left(\sum\_{\zeta=\gamma}^{\varepsilon} w\_{e,k,\zeta,\sigma}\kappa\_{e,k,\zeta,\sigma}\right)\Delta k, \qquad \forall \, e \in \mathbb{S}\_{e}^{\mathrm{pipe}}, k \in \mathbb{S}\_{k}, \sigma \in \mathbb{S}\_{\sigma} \tag{2.103}$$

Therein the values of κ represent the amounts of time steps a certain water mass was in the given pipeline.

Based on the newly calculated weights w and the length of stay t, all parameters are given to calculate the lossless outlet temperature of a pipeline T out1 with (2.70) as well as the lossy outlet temperature T out2 in (2.71). Thereby, the entire thermal pipeline model is provided.

**Upper Bound of Possible Modeling Errors** This section determines an upper bound of possibly occurring errors from the above described thermal pipeline model. The accuracy of the presented model is dependent on the quality of the predicted mass flow estimates <sup>m</sup>b˙ . These predicted values are then used to calculate the weights w, which then determine the length of stay of the water masses in the pipeline t and the outlet temperature T out2. In case of perfect flow predictions, the presented model accuracy equals the results of the NM, showing very small RMSEs of 0.507 °C [MRMH21], as stated above. In case the predictions show deviations from the actual flow conditions within the DHN, an upper bound of the possible modeling error ∆T max,dev e,k for a given pipeline <sup>e</sup> and time step <sup>k</sup> can be derived as follows. Therefore, the maximal deviation of the actual temperature measured at the outlet of a pipeline T meas and the results of the simulation based on the flow direction T out2 e,k,σ<sup>+</sup> or <sup>T</sup> out2 e,k,σ<sup>−</sup> is used. Next, T out2 is replaced by the possible minimal or maximal temperature values, which can occur at the outlet of the pipeline. These are the minimal or maximal values of all past or current node temperatures Ti,k<sup>p</sup> or Ti,kal of all nodes i bordering the respective edge e, thus fulfilling the condition |Adhn i,e | > 0. Note, that the minimal outlet temperature values are calculated by taking into account the largest possible losses over the pipeline, thus using the longest possible length of stay of a water mass t max e,k . The formal expression is:

$$\begin{split} \Delta T\_{e,k}^{\text{max,dev}} &= \max \qquad \left( |T\_{e,k}^{\text{meas}} - T\_{e,k,\sigma^{\text{t}}}^{\text{out2}} |, |T\_{e,k}^{\text{meas}} - T\_{e,k,\sigma^{\text{t}}}^{\text{out2}} | \right) \\ &\leq \max\_{\forall\_{\forall} \in \mathcal{S}\_{e}^{\text{dim}} \atop \forall \text{ with} \, |A\_{i,k}^{\text{th}}| > 0, \quad |T\_{e,k}^{\text{meas}} - \left( T^{\text{a}} + (T\_{i,k} - T^{\text{a}}) \exp\left( -\frac{t\_{e,k}^{\text{max}}}{\tau\_{e}} \right) \right) |, \\ &\qquad \qquad \qquad \qquad \left| A\_{i,k}^{\text{meas}} - A\_{i}^{\text{meas}} - \left( T^{\text{a}} + (T\_{i,k} - T^{\text{a}}) \exp\left( -\frac{t\_{e,k}^{\text{max}}}{\tau\_{e}} \right) \right) \right|, \\ &\qquad \qquad \qquad \qquad \qquad \qquad \qquad |T\_{e,k}^{\text{meas}} - \left( T^{\text{a}} + (T\_{i,k} - T^{\text{a}}) \exp\left( -\frac{t\_{e,k}^{\text{max}}}{\tau\_{e}} \right) \right) |, \\ &\forall e \in \mathcal{S}\_{e}^{\text{pipe}}, k \in \mathbb{S}\_{k} \end{split} \tag{2.104}$$

The upper bound of possible modeling errors, can be approximated by the product of the time interval and the maximal gradient of temperature changes at nodes in DHN operation which are in the range of 3 °C/h [MMW+20] and 2 °C/min [Rat19, p.25-26]. In general DHN operators are interested in keeping these gradients small to prevent fast aging of the pipe insulation material [MMW+20]. When carrying out parameter studies to evaluate the model accuracy, the quality of the mass flow predictions is of high interest, as they directly impact the outlet temperature of the pipeline. These predicted mass flow values originate form the last optimization of the rolling horizon approach. Thus, in [Tsc19] a comparison of the lossy pipeline outlet temperatures, based on the predicted mass flow values, with the exact mass flow values for a small DHN with fixed mass flow directions was performed. The predicted mass flows were obtained from the rolling horizon optimization of the last time step, while the exact mass flow values resulted from the mass flows obtained from the current optimization. Based on this, it can be seen, that the amount of time steps included in the prediction horizon largely impact the accuracy of the predicted mass flow values and thus the outlet temperature. For a prediction horizon of 1 time step, see Figure 2.20, the deviations are below 4 K within the entire DHN except for a single time step, where the maximum deviation of 10.22 K is reached at Node 8. For a larger prediction horizon of 14 time steps, see Figure 2.20, the maximum error falls below 1.5 K and even 0.1 K after the stronger deviations created through the initialization of the rolling horizon approach. Further, in [SWW+19] it is reported, that mass flow predictions with maximum errors in the mean values of 1 % and 6 % in the standard deviation can be obtained. All in all, the given upper bound, the parameter study and the cited literature indicate that temperature deviations will most likely be in the lower single digit range. Further, the presented simulation results show the salient features of the combination of the presented thermal pipeline model with the rolling horizon approach, which will be presented in detail in Section 3.3. Through the rolling horizon approach, the quality of the predicted mass flow values will most likely increase toward the current operation time for a sufficient prediction horizon. Besides, within this model no additional numeric effects, as dispersive and dissipative errors, cause additional deviations as this is the case e.g. for finite difference DHN pipeline modeling approaches [MRMH21].

**Figure 2.20:** Deviation between the exact simulated temperature and the one calculated from the proposed pipeline model for 1 time step on the prediction horizon.

**Figure 2.21:** Deviation between the exact simulated temperature and the one calculated from the proposed pipeline model for 14 time steps on the prediction horizon.

# **2.4 Summary and Discussion**

CEPDHNs are complex large systems that result in extensive network models. The model presented in this chapter can be represented as a nonlinear system of algebraic equations:

$$h(x) = 0\tag{2.105}$$

For that matter (2.105) is constructed by stacking the presented equations of all CEPDHN components for all time steps. Precisely, these equations are (2.11), (2.12), (2.15), (2.16), (2.17), (2.21), (2.23), (2.24), (2.26), (2.28), (2.29), (2.30), (2.31), (2.32), (2.33), (2.34), (2.35), (2.36), (2.39), (2.42), (2.43), (2.44), (2.45), (2.47), (2.49), (2.51), (2.52), (2.53), (2.54), (2.56), (2.57), (2.58), (2.59) , (2.60), (2.61), (2.62), (2.63), (2.64), (2.65), (2.66), (2.70), (2.71), (2.72), and (2.73).

Before this system (2.105) can be simulated/solved, based on an initial value x0, several input parameters need to be provided. These are the network parameters, the power injections or demand of all NPs, the set points of pumps and valves, and the parameters needed for the pipeline model. This shows, that in general the proposed model could also be used for simulating CEPDHNs. Still, this model was especially developed for application within operational optimization. This new CEPDHN model incorporates difficult aspects which are usually neglected within operation optimization of CEPDHNs, as: VFVT operation of DHNs including the effects of pipeline storage, VMFDs, control paths of pumps and differential pressure regulators, pipeline friction factor calculations based on close approximations of the Prandtl-Colebrook equation, and the full AC power flow.

As it can be seen from literature cited with the proper network element models, the presented high detail CEPDHN model is the result of a customized combination and extension of existing models. The most relevant works, with the largest impact on the provided network representation (2.105) are [Trö99, Opp15]. Note, that the model in [Opp15] was designed for simulation purposes. Thus, the model is not continuously differentiable as it relies on conditions, which need to be checked during the solution process. Further, this work does not incorporate EPNs and is based on the assumption of fixed flow directions. The model in [Trö99] neglects control paths and differential pressure regulators, and the EPN is modeled as a single bus. Also both approaches [Trö99, Opp15] do not provide TESS models, and use deviating thermal pipeline models. The contributed thermal pipeline model, first presented in this work, is built upon the node method which was first presented in [Ben91]. Combining this with ideas from [LWS+15] and [Trö99] as well as further improvements of the author, as stated in Section 2.3.3, led to new thermal pipeline model, which enables to take VMFDs into account. Further, as shown towards the end of Section 2.3.3 the thermal pipeline model profits from the operation principle of a rolling horizon approach, as the predicted mass flow values used to calculate the output temperatures tend to become more and more precise the closer the regarded time step is to the actual point in time. This is of importance as the propagation of the temperature fronts through the DHN pipelines are the only physical effect, that needs to be modeled through dynamic models, in the context of operational optimization [ZWW+21]. In total this CEPDHN model is the central element of the model based control approach of the TCS presented in the following chapter.

The comparatively high modeling detail of the presented CEPDHN model has two salient features. First, it enables a technically efficient form of CEPDHN operation. This is achieved by representing variable flows and variable temperature operating conditions, which are the core of the most efficient form of DHN operation [DLS+19, ZZZW18a]. Also the consideration of VMFDs, pipeline storage and the losses occurring in EPNs and DHNs account for technical efficiency, when considered within optimal operation approaches. Second, the aforementioned modeling detail has a direct effect on the possible solution set of market-based operation approaches, and thus on the maximum achievable welfare result. Since, for example preventing VMFDs can have severe consequences on the objective value/market outcome, see Section 1.2.5. In summary, the detailed CEPDHN model forms Contribution 2 of this work, bridging the element 1. a) of the research gap stated in Section 1.2.5.

# **3 Transactive Control System Design**

This chapter outlines the specific methods used to design the TCS for CEPDHNs which is the central contribution of this work. Therefore the general system design is presented in Section 3.1. Therein, the different entities which are part of the presented approach are stated and their actions and information exchange are outlaid. This comprises the basic market and control mechanisms applied by design. A detailed description of possible and the selected market mechanisms is than given in Section 3.2. The subsequent Section 3.3 describes the control mechanisms, specially designed for the novel TCS. Parts of this chapter have been published in [MTK+22], [MGR+21], and [MIJSH22].

# **3.1 System Design**

Within this section, the big picture and basic functionality of the new TCS system design, proposed in this work, is introduced. Note, that parts of the descriptions in this section have been previously published in [MTK+22]. For the optimal economic operation of CEPDHNs, FNPs should be operated in a way that maximizes social welfare [ZXL+17]. To this effect, an intraday TCS auction market64, activated after settlement of a day-ahead energy market, is assumed<sup>65</sup> to coordinate the interests of all FNPs. The proposed intraday energy market is auction based and considered within the Independent System Operator Energy Management Systems (ISOEMSs), which are designed using a *distributed rolling horizon approach*, described in detail in Section 3.3. Therefore, the ISOEMSs take into account all necessary information as the nonlinear dynamic and stationary network models, operational constraints, predictions of power supply and demand of inflexible units, and bids of FNPs to determine the optimal control values/dispatch solutions that maximizes social welfare and ensures secure network operations<sup>8</sup> at the same time. Note, that the ISOEMSs therefore solve a nonlinear optimization problem in a parallel but coordinated manner in order to enable real-time implementation of this large scale dispatch problem. This indicates the necessity of a prior decomposition of the entire market clearing dispatch problem into multiple subproblems. As will be discussed in detail in Section 3.3.2, this decomposition is performed by decomposing the CEPDHN network into multiple operation zones<sup>66</sup>. Note, that the dispatch solution of the distributed ISOEMSs is the same as it would be calculated by a single ISOEMS for the entire CEPDHN. Thereby, the proposed market and control mechanisms, which are briefly presented in this section and discussed in detail in the following Sections 3.2 and 3.3, are integrated into a new TCS to

<sup>64</sup> Precisely, this market represents the integration of an electric intraday market and a heat intraday market for every DHN, which are all cleared in a coordinated joint simultaneous procedure, as explained in detail in Section 3.2.

<sup>65</sup> See Assumption 3.3 for more details.

<sup>66</sup> The term *operation* zone is utilized here in order to enable to distinguish between operation and price zones in the following.

**Figure 3.1:** Proposed approach showing information flow between the two hierarchy levels of the TCS, i.e., the ISOEMS (TCS Level II) and the EMSSAs of the FNPs (TCS Level I), and the energy supply and demand of flexible and inflexible network participants connected to the CEPDHN.

optimally operate CEPDHNs. An overview of the proposed TCS is shown in Figure 3.1 for the case of a single ISOEMS, and in Figure 3.2 for multiple distributed ISOEMSs. The basic procedure of the TCS can be described as follows:


This procedure is repeated for several time steps, based on a rolling horizon approach of the NMPC [Grü17]. The bids/offers, predictions, and control values are sent and determined for all time steps of the prediction horizon<sup>68</sup> .

<sup>67</sup> Every energy converter is modeled as an FNP in the EPN and DHN. Thus, when an energy converter is located at the border of an operation zone, as shown in Figure 3.2 the EMSSA of this energy converter sends bids/offers to ISOEMSs of both bordering operational zones.

<sup>68</sup> FNPs are incentivized to keep bids/offers for a specific time step constant over the prediction horizon to avoid penalty fees. However, the proposed approach can also handle cases where FNPs change their bids/offers over time.

**Figure 3.2:** Multiple ISOEMSs, each in charge for the operation of its proper operational zone, dispatching the CEPDHN and thereby clearing the intraday TCS auction market in a coordinated form. All elements of the CEPDHN not explained in the given legend are labeled in the legend of Figure 2.1.

The proposed TCS intraday auction market is distinctly different from the traditional wholesale energy markets. This is due to the fact, that the proposed TCS auction is a multi-period combined auction of two or more coupled market platforms associated with the EPN and every DHN, respectively, where these markets are cleared in a coordinated manner and simultaneously.

The energy dispatches in the proposed TCS auction market, operating in 15-minute intervals, change for every time step using a *rolling horizon* technique, in order to optimally adapt to the updated forecasts of supply and demand of inflexible network participants. The bids and offers of the FNPs are assumed to be provided by local EMSSAs, such as existing facility Energy Management Systems (EMSs). These automatically send bids to the ISOEMS for each time step based on the calculated flexibility of their respective facility, such as offices, factories, Battery Energy Storage Systems (BESSs), and/or energy hubs. Observe that these bids and offers are only known to the individual market participant and the TCS auction market operator, thus enhancing privacy as defined in [KW16]. No other information such as indoor temperatures, state of charge of batteries, or electric vehicle data is shared. Note, that privacy is a direct outcome from the information sharing specifications in the proposed TCS. Other approaches, such as direct load control [LLJZ20], which coordinate flexible resources based on monetary incentives, require sharing information not needed in the presented TCS.

The flexibility of consumer facilities can be determined by their EMSSAs by first calculating the predicted minimum power demand for the next hours and the expected usable amount of energy [AB19]. Based on these, two profile bids with minimum and maximum power values can be calculated. The bid prices of the FNPs are determined by their respective EMSSAs using an approach such as [AW14b].

As stated above, the network operators provide predictions to the ISOEMSs, this leads to:

**Assumption 3.1.** *Sufficiently accurate predictions on the aggregated electric real and reactive power infeed or demand,* <sup>P</sup>b*, and* <sup>Q</sup>b*, of all INPs connected to a specific bus in the EPN, can be provided for every time step on the prediction horizon. Similarly predictions on mass flows* <sup>m</sup>b˙ *, differential pressures* <sup>∆</sup>c<sup>p</sup> *and temperatures* <sup>T</sup><sup>b</sup> *of DHN network parts affiliated to INPs can be provided.*

Projects and literature showing the effective prediction of electric power values at single distribution network buses are given e.g. by [ZSL+17, Sau19]. Besides this practical insight, several approaches can be found within the SOTA, that enable high quality predictions based on measurement data of sensors within the network smart meters at single NPs [MAFH21, WCHK18]. Two additional remarks are necessary here:

### **Remark 3.1:**

*For notational simplicity and without loss of generality, within this work it is assumed, that all NPs* n ∈ S<sup>n</sup> *are FNPs* n ∈ S fnp n *, and so* S<sup>n</sup> = S fnp n *. Further, this entails the set of all INPs is empty* S inp <sup>n</sup> = ∅*.*

### **Remark 3.2:**

*The presented TCS approach<sup>69</sup> is seen as incorporated into the current form of EPN and DHN operation. This means earlier cleared markets and energy trading forms, as e.g. the day-ahead market, futures or Over the Counter (OTC) trading, define the UC . Further, ancillary services as e.g. frequency and voltage regulation in the EPN are present [MBB11]. Similarly in DHNs pressure and expansion maintenance is operating, and the controls of DPRs and pumps are active [NTJK20].*

# **3.2 Market Mechanisms**

In this section the market mechanisms used within the context of this work are presented. These are the auction design and market clearing procedure, the allocation objective and the selection of an adequate pricing mechanism. Before these are depicted in detail below, the following assumption is introduced and discussed:

**Assumption 3.2.** *An intraday heat energy market is implemented in DHNs, if these have a sufficient large amount of MPs in order to limit issues related to market power.*

<sup>69</sup> With the exact definition of a single ISOEMS presented later in Section 3.3.1 or multiple ISOEMSs outlaid in Section 3.3.2.

Note, that this assumption is widely used within literature [LWM+18, ZGX13, LSZW15] due to the following reasons:


Therefore, DHN markets could play an important role in future CEPDHNs, and are thus assumed in operation within this work besides a well known electric energy intraday market.

### **3.2.1 Auction Design and Market Clearing**

When two or more partly coupled energy markets are cleared, here the EPN and multiple DHN markets70, these markets are either cleared sequentially or simultaneously in the prevailing approaches found in the respective literature [MKP20, DLS+19]. In the case of market based operation approaches for CEPDHNs sequential market clearing approaches typically clear the EPN market first, and then clear the DHN thereafter. Unfortunately, this procedure creates cross-subsidies and limits the feasible allocations of the secondarily cleared market, thus limiting market efficiency. This happens e.g. when using the Alternative Power Method (APM) implemented in Sweden and Finland [DLS+19]. Simultaneous market clearing approaches enable to overcome this downside. However, this is only achieved through information exchange between the Independent Market Operators (IMOs) of the different markets during the market clearing procedure. The TCS presented in this work is built upon a simultaneous market clearing procedure.

Here, a double sided multi-period combined auction is used for all markets within the TCS in order to enable DSM. The market clearing for the EPN and all DHN markets is simultaneously performed for every time step. The time interval ∆k between to consecutive time steps is thereby set in the range of current intraday markets, thus within 5 min ≤ ∆k ≤ 15 min [Ott03], [KP17]. Therefore, bids and offers for the entire prediction horizon are taken into account, but the market clearing is only carried out for the previous time step. The MPs are

<sup>70</sup> One for each DHN.

incentivized to keep their bids and offers constant, in price and power quantities for a specific time step, during the rolling horizon time step shifts in order to prevent penal fees.

### **3.2.2 Allocation Objective**

The allocation of the multi-period combined auction is derived, based on the welfare W maximization. The latter is defined as the sum of the benefits of all EPN and DHN consumers n ∈ S d,epn n and n ∈ S d,dhn n , and net costs of all EPN and DHN producers n ∈ S s,epn n and n ∈ S s,dhn n , for all time steps on the prediction horizon k ∈ Sk, given as follows:

$$W = \sum\_{k \in \mathbb{S}\_k} \left[ \sum\_{n \in \mathbb{S}\_n^{\text{d}, \text{epn}}} c\_{n,k} P\_{n,k} + \sum\_{n \in \mathbb{S}\_n^{\text{s,epn}}} c\_{n,k} P\_{n,k} \right]$$

$$+ \sum\_{n \in \mathbb{S}\_n^{\text{d}, \text{dhn}}} c\_{n,k} \Phi\_{n,k} + \sum\_{n \in \mathbb{S}\_n^{\text{s,dhn}}} c\_{n,k} \Phi\_{n,k} \Bigg|\tag{3.1}$$

where the bid or offer price per unit is defined by c<sup>n</sup> [MCC05], the electric real power injection is given by P and heat power supply is stated as Φ. Note, that consumer powers can only become negative signs in equation (3.1), while producer powers, and all costs have positive values. Storage units may appear either as a consumer (when charging) or as producer (when discharging), and inflexible participants are considered to provide a zero-priced bid/offer, cn,k = 0. The ECs of the CEPDHN submit a DHN offer and an EPN bid/offer depending on their type. For example EBs will send EPN bids while CHPs, supplying also electricity, will submit an EPN offer for every time step.

### **Remark 3.3:**

*More complex cost functions, e.g. piecewise linear functions resulting from the approximated efficiency curves of generators can be integrated directly into the approach presented here. An FNP can submit multiple bids or offers, one for every segment of the piecewise linear cost function. The allocation based on the optimization of equation* (3.1) *ensures that the bids and offers are allocated successively, e.g. first the lowest priced offer of generator/FNP* n*, then the second lowest priced offer and so on. For notational simplicity and without loss of generality this work is restricted to a single bid or a single offer for consumers and producers.*

### **3.2.3 Pricing Mechanisms**

Four common pricing approaches used to clear energy markets are presented below. These are discriminatory pricing, uniform marginal pricing, zonal pricing and locational marginal pricing. After that, a fifth pricing approach, named as Hybrid Pricing Approach (HPA), developed within the context of this thesis, for the application in CEPDHN market environments is introduced. For that matter, potential benefits and drawbacks occurring by the application of these different pricing methods are presented. A discussion and selection of a pricing approach for the presented TCS is then given after the description of all five pricing methodologies.

### **Discriminatory Pricing**

Following a discriminatory pricing approach the market participants will by paid as bid. The motivation behind this form of pricing is that producers with low energy production costs are supposed to submit low bid prices and will thus be paid low. Following this logic, this would increase the auctioneer's and consumers welfare at the suppliers expense [HL12]. However, the fundamental problem behind discriminatory pricing approaches is the missing incentive compatibility, due to the opportunities for strategic behavior [SBLS04]. This pricing approach is e.g. used in Iran [HL12].

### **Uniform Marginal Pricing**

The Uniform Marginal Pricing Approach (UMPA) relies on insignificance of congestions within the regarded market area [MSC03], this is often referred to as the "copper plate" assumption [CN17, p. 34]. In the tradeoff between market liquidity and price efficiency, UMPA enhances market liquidity [MSC03].

One-shot auctions using the UMPA are proven to be incentive compatible [Vic61, ACP+14]. The Uniform Marginal Price (UMP) is thereby calculated as follows: The IMO aggregates all supply offers into one marginal cost function f s (x s ) by applying the Merit Order (MO). The supplied power of all producers of this allocation is given by x s . Similarly, the demand bids are aggregated vice versa into the marginal cost function f d (x d ), dependent on the power demand x d of all consumers for the regarded allocation, and both are matched. Assuming an unconstrained lossless network, the intersection of the marginal supply and demand bid cost functions f s (x s ) and f d (x d ) define the UMP c ump71, and the total amount of power units traded U ump72. In this case, incentive compatibility is ensured because no benefit can be achieved by submitting offers higher than the actual cost value for a producer [SRG08a], and likewise in a double-sided auction, this also prevents consumers from submitting bids with costs lower than their real costs. This is due to the fact, that by submitting bids or offers with their marginal costs, MPs will either increase their revenue, or will at least receive their necessary utility. Therefore, in a sealed bid AD with uniform marginal pricing, the participants are incentivized to reveal their marginal costs [Nou95].

In the case of occurring system contingencies, UMPA causes false incentives through inadequate price signals, necessitating command and control interventions in order to maintain secure network operation<sup>8</sup> , see [MSC03] for examples on strategic behavior of the MPs. This procedure stands contrary to the desired form of competitive markets, reducing market efficiency due to uplift costs[MSC03]. In Germany, these redispatch costs have risen in the past decades and exceeded 900 million euros in 2017 [Bun18b].

<sup>71</sup> Note, that in the unconstrained lossless Security Constrained Economic Dispatch (SCED) case, the UMP is equivalent to the energy component of the LMP presented below.

<sup>72</sup> A definition of the UMP in special cases as an overlap of f s (x s ) and f <sup>d</sup>(x <sup>d</sup>) for multiple points is given in [Zim10].

### **Zonal Pricing**

The Zonal Pricing Approach (ZPA) is used in energy markets in Denmark, Sweden, and Norway [HL12]. In case congestions only occur on very few transmission lines between predefined price zones which can be appointed a priori, zonal pricing is a valuable alternative to UMPA. Advocates of this approach invoke the simplicity of the procedure compared to the much more complex LMPA<sup>73</sup>, and that the networks in many cases can be divided naturally into the respective price zones [HL12]. Still, as soon as intra zonal congestions appear, the problems of zonal pricing are equivalent to those of the UMPA, within a zone, again leading to the socialization of uplift costs [MSC03]. Further, real world experience shows, that it is a tough and nontrivial task to predefine adequate price zones. This originates from the fact that congestions are often not rare and do not follow clear spatial patterns [MSC03].

### **Locational Marginal Pricing**

For electric energy market price signals, the LMPA was first presented in [CBS82]. For EPNs the LMPs can be obtained from the dual variables of the power balancing constraints (2.15)74. Every single LMP λ tot consists of three price components, the energy price λ energy, the congestion price λ cong, and the loss price components λ loss, given as:

$$
\lambda\_{i,k}^{\text{tot}} = \lambda\_{i,k}^{\text{energy}} + \lambda\_{i,k}^{\text{cong}} + \lambda\_{i,k}^{\text{loss}}, \quad \forall \ i \in \mathbb{S}\_i, \ k \in \mathbb{S}\_k \tag{3.2}
$$

Thus, λ tot i,k expresses the marginal cost to provide the last increment of electric power at a specific busi in the EPN [MSC03] for a respective time step k. The LMPA inherently overcomes the inefficiencies of the UMPA and the zonal pricing approaches. It comprises uplift costs by directly taking congestions into account, reflecting these in the nodal prices. Hence, the approach inherently calculates optimal price zones for every dispatched solution, which can vary in size from a single node up to the entire network. Multiple studies, listing a slight superiority, by 0.8 % to 1.5 % welfare increase, of the LMPA compared to UMPAs are stated in [HL12]. Also studies showing the superiority of the LMPA in contrast to ZPAs are listed in [HL12]. A major advantage of the LMPA is the ability to provide investors with incentives to construct and connect flexibilities at suited buses [MSC03], and thereby reduce congestion and loss costs<sup>75</sup>. However, the LMPA cannot fully prevent strategic behavior and the obtained prices can be dependent on the chosen reference bus [NAB14].

In MES the concept of LMPAs has been applied within the given literature [GA07, DLS+19]. For a DHN, the dual variables of the thermal node equation (2.45)<sup>76</sup> reflect the LMPs. Note, that the thermal node equation needs to be multiplied by the specific heat capacity of water c <sup>w</sup> before, to obtain properly scaled values for the LMPs. In the case of dynamic network models, as

<sup>73</sup> Which is introduced below.

<sup>74</sup> If the LMPA is implemented within distribution networks, it is often referred to as Distribution Locational Marginal Price (DLMP) [HCC+12]. Thereby, losses should be taken into account, as they are larger as in transmission systems [CWL+18]. The AC power flow equation (2.15) used in this work is thereby often suggested within the literature, see e.g. [OCS04, HCC+12, MC11, CWL+18].

<sup>75</sup> It should be noted, that changing the pricing mechanism to LMPA in the European Energy markets would need high political effort.

<sup>76</sup> Or (2.47) in the case of VMFDs.

often occurring in optimal dispatch problems of DHNs, the LMPs are also dependent on time delay effects [DLS+19]. The time delay can influence all three components of the LMPs mentioned above. These time delay effects still conform with the basic principle of the LMPs, as it charges MPs by the truly arising costs at a specific location in a certain point of time [DLS+19]. However, in DHNs, as FNPs are always connected to supply and return networks, applying the LMPA results in two possible LMPs for every FNP. Furthermore, these two marginal prices for an FNP can differ, due to different constraints applied to the DHN nodes. This happens, e.g. in the context of limiting the temperature ranges of supply and return nodes [MTK+22]. Thus, the assignment of an LMP to each FNP within TCS for (CEP)DHNs remains an open question. In the current form, the LMPA is not suitable for DHNs, as it is not possible to identify a clear buying/selling price for every FNP.

### **Hybrid Pricing Approach**

The description of the HPA is based on the authors previous work [MGR+21, pp. 4-7]. The basic idea behind this approach is to aim for incentive compatibility, and maximize allocation efficiency, while preventing uplift costs due to redispatch. Therefore, in the HPA, uniform marginal pricing is mainly used as it ensures incentive compatibility but also considers network restrictions within the dispatch procedure. However, in the case of network congestion, pure uniform marginal pricing is not incentive compatible, as explained below in this section. Therefore, a fraction of the bids and offers, which exceed U umpd, the amount of power traded at the Uniform Marginal Price obtained from Dispatch (UMPD) c umpd, are then priced via paidas-bid and pay-as-bid vice versa. The UMPD is defined, as the intersection of the dispatched consumer and producer bid and offer curves, and not by the intersection of the submitted consumer and producer bid and offer functions, in order to take network congestions into account. For simplicity reasons, first lossless energy networks of any domain are assumed.

### **Remark 3.4:**

*It is important to distinguish between the UMP* c ump *obtained from the UMPA introduced in Section 3.2.3 and the UMPD* c umpd *resulting from the dispatch taking network congestion into account. Therefore the UMPD* c umpd *is written with an additional "d" for dispatch in the following. Note that, in the case of an uncongested network* c ump = c umpd *always holds.*

After the allocation of the power traded between all MPs n, also known as dispatch procedure, the prices paid by all MPs are determined as follows<sup>77</sup>:

The UMPD c umpd is defined as the marginal price at the intersection of the dispatched marginal supply and demand curves f <sup>s</sup>,dis(x <sup>s</sup>,dis) and f <sup>d</sup>,dis(x <sup>d</sup>,dis), see Figure 3.3 (a). All dispatched bids and offers which are to the right of U umpd, the power value at the UMP, also shown in Figure 3.3 (a), are priced via pay-as-bid/paid-as-bid. This is necessary, as in real-world (congested) networks, dispatching the system, while maximizing the welfare, does not always result in a solution, where the total amount of power dispatched is equal to the power value at the UMP U umpd .

<sup>77</sup> The trivial case, in which absolutely no power is traded is left aside here. This would arise if all consumer bids are below all producer offers.

An example of this case is given in Figure 3.3 (a). Here some bids and offers, those bordering the orange shaded area ω wf, need to be priced by via pay-as-bid/paid-as-bid. A detailed description of the reason for this phenomenon is given in Example 3.1 below. Still, this is not always necessary; an example that does not need pay-as bid pricing of some bids is provided in Figure 3.4 (d). Concerning the definition of the UMPD, two special cases are described here:


As stated above, when optimizing a CEPDHN respecting the operational constraints, a situation may occur where the dispatched power values of x <sup>s</sup>,dis and x d,dis are not equal to the point U umpd, where f <sup>s</sup>,dis(x <sup>s</sup>,dis) and f <sup>d</sup>,dis(x <sup>d</sup>,dis) intersect. This situation arises depending on the network constraints, operational limits, and supply offers and demand bids in the auction. This would not occur, by using the "copper plate assumption", where congestions can not emerge, as in the UMPA approach in Section 3.2.3. However, in reality, network constraints and the operational constraints of the CEPDHN limit the solution set, as shown in the example below:

### **Example 3.1:**

*A lossless DC EPN with two buses is shown in Figure 3.5. The respective sources and demands can vary their power demand or infeed between the stated limits at the costs of the offers and bids. The transmission limit is set to* 5 *p.u.. The result of the social welfare maximization with respect to the transmission capacities is shown in Figure 3.3 (c). Thereby, the transmission capacity between bus* 1 *and* 2 *is lower than the amount of power that could be supplied by source S1.*

**Figure 3.5:** An elementary example of a market clearing based on a congested network with two busses connected by a transmission line.

**Figure 3.3:** Different possible pricing constellations (a) and (c) based on submitted and dispatched offers and bids of producers and consumers sorted by merit order. Further, the resulting UMPDs and welfare areas are shown determined by the optimal dispatch. Note, that the general currency sign ¤ is used here.

**Figure 3.4:** Different possible pricing constellations (b) and (d) based on submitted and dispatched offers and bids of producers and consumers sorted by merit order. Further, the resulting UMPDs and welfare areas are shown determined by the optimal dispatch. Note, that the general currency sign ¤ is used here.

In the underlying optimization of the ISOEMS , the total utility of all MPs in the system is maximized. If that allocation is to the right of the intersection of the supply and demand curves as shown in Figure 3.3 (c), the welfare determined by the integral over the orange area ω wf is subtracted from the integral of the green area β wf to receive the final overall system welfare. Since the minimal possible welfare result, based on the optimization is zero, β wf ≥ ω wf , and the optimizer will always try to minimize ω wf while maximizing β wf. The pricing for all MP bids and offers allocated in ω wf is pay-as-bid/paid-as-bid, meaning all consumers pay exactly their bid price and all suppliers earn their respective offer price. The difference between supply and demand prices is paid by the system operator and transferred to all network participants through a grid fee. However, the pay-as-bid/paid-as-bid mechanism encourages strategic behavior. A supplier could gain experience over time and try to place its offer in ω wf and thereby receive higher revenue. Likewise, a consumer could try to set its bid in the same space to pay a lower price. This strategic behavior would go against the incentive compatibility principle implemented with an AD with uniform marginal pricing. Yet, the predictability of RESs is limited and therefore increases the risks resulting from strategic behavior. In a scenario with incomplete or imperfect information, where all participants have neither all nor correct information on all other participants bidding strategies, energy supply or demand and the network topology, the incentive for strategic behavior depends on the size of ω wf. To use the advantage of a UMPA, more precisely, ensuring incentive compatibility to reveal true marginal costs of the market participants, the HPA is efficient for small ω wf compared to β wf . An advantage of the approach compared to a standard UMPA with uplift costs coming from redispatch is, that these costs are directly avoided. This can be understood in the context of the Example 3.1 with Figure 3.5. If source S2 and load D2 would submit offers and bids with the same prices but rising amounts of power, the uplift costs due to redispatch would rise after a standard uniform marginal pricing approach. When applying the HPA presented here, these uplift costs are completely avoided. Instead, a grid fee has to be paid by all network participants to cover the costs of the negative welfare ω wf. As the optimizer inherently minimizes ω wf, this grid fee will stay small no matter how big the offers and bids of source S2 and load D2 would become, in the Example 3.1 stated above. Therefore, this approach will lead to a better overall system efficiency, if the effects of the lost incentive compatibility and the total costs of the grid fee, used to compensate the gap between the bids and offers priced by paidas-bid/pay-as-bid, are smaller than the gains through the omitted uplift costs. It has to be kept in mind that full incentive compatibility is also currently not given in the uniform marginal pricing-based markets, as bidding parties, for example power plant operators, can be incentivized to bid for redispatch capacities [STRW18]. Finally, following remarks are provided for additional information and clarity:

### **Remark 3.5:**

*The consideration of losses and dynamics in network models or ramping constraints is also possible. Similar as network congestions both aspects will change the dispatch result but do not limit the applicability of the pricing procedure of the HPA introduced above. A detailed discussion on the integration of loss bids into the allocation process in order to ensure allocation efficiency is given in [MGR*<sup>+</sup>*21]. The main idea is to integrate the losses of the EPN and the DHN as a consumer bid into the allocation objective* (3.1)*. This ensures allocation efficiency, as also trade for bids and* *offers with identical marginal costs, is achieved, which would not be the case, if network losses would not be factored during the dispatch procedure. In this matter, the challenge is to determine an adequate marginal bid price* c loss *for the loss bids. The closer the defined value of* c loss *is to the UMPD as defined in this section above, the less undesired side effects, which will be explained in the following, are created. Choosing* c loss *to high will on the one side lead to additional unwanted network losses, causing undesired costs. Note, that expenses created through the loss bids are covered through grid fees paid by all market participants. On the other side, if* c loss *is set to low, the desired market efficiency can not be fully provided. A reasonable choice is to determine* c loss *by the UMP as defined in Section 3.2.3, neglecting network constraints. This enables to use the available a-priori knowledge based on the submitted bids and offers to estimate the new UMPD calculated by taking into account network losses and network constraints. Examples of this procedure are given in the Case Study I in Section 4.1.*

### **Remark 3.6:**

*The HPA explained above is performed for every price zone individually after the dispatch, which is carried out for the entire CEPDHN at once in a distributed form. Within the approach, the EPN and every DHN represents a single price zone. This separation of EPN and DHNs price zones is made in order to account for the different bid price levels, as heat is typically a cheaper form of energy as electricity [Kon18, p. 155],[SMA22].*

### **Remark 3.7:**

*Within the description of the HPA, the pricing is always referred to as a combination of UMPA and pay-as-bid/paid-as-bid. Still, some readers might understand HPA much more as a combination of zonal pricing and pay-as-bid/paid-as-bid. Even though the HPA is used in multiple price zones, the expression zonal pricing will not be used in here for two reasons. First, in contrast to a ZPA the price zones are not determined by a priori knowledge on occurring congestions, but as explained above in Remark 3.6. Further, the CEPDHN is decomposed into multiple operational zones which are controlled by an ISOEMS each. As these zones do not represent the price zones as exemplary depicted in Figure 3.6, the term zonal pricing is not used here to describe the HPA in order to prevent misleading of the readers.*

### **Remark 3.8:**

*Uniform marginal prices as introduced in Section 3.2.3 can be obtained from the marginal of a balance constraint of power demand, power supply and network losses [DF05], thereby neglecting network constraints. Using this form of determining the UMPDs here would have several drawbacks. First, network constraints would not be taken into account. Second, such a model constraint does not align trivially with the CEPDHN model, introduced in Chapter 2, which includes dynamic effects as for example pipeline storage. Third, using such a balance constraint within the distributed optimization of the ISOEMSs, would necessitate to assign this constraint to one of the resulting subproblems of the operational zones. This would lead to a complicating constraint, see Definition 3.3, which would need variables from all operational zones, for which the UMP is to be calculated. This can create a strong form of coupling among the subproblems which can have negative effects on the convergence properties of distributed optimization approaches as explained in Section 3.3.2.*

**Figure 3.6:** Exemplary price zones and operational zones in a CEPDHN from Figure 2.1.

### **Discussion and Selection**

None of the presented approaches is able to prevent incentives for strategic behavior in real world energy markets, especially not in the constrained case, when certain MPs can exploit their market power. However, within pure electric energy markets, the LMPA can be seen as the most efficient pricing approach for market clearing [MSC03]. Still, the application of the LMPA in the TCS for CEPDHNs brings along several problems, that need to be taken into account. First, as mentioned earlier in Section 3.2.3, the LMPA is not suitable for DHNs, as it is not possible to identify a clear buying and selling price for every FNPs. Second, as the TCS is designed as a system of distributed EMSs solving a large optimization problem in parallel, methodical aspects of these distributed optimization approaches need to be considered. For example, the tuning of parameters in the widely used ADMM approach represents a tradeoff between convergence speed and a remaining gap between the dual variables of the central solution to the distributed solution, see Section 3.3.2. This is an undesired feature when using the LMPA in a TCS as convergence speed and accuracy of the LMPs are both of high importance. Third, in order to achieve high technical efficiency, the CEPDHN models become strongly nonlinear. In this context, the utilization of soft constraints can help to consider operational limits within the solution of the optimization problems, also in the case of VMFDs , see Section 3.3.1. However, by using a LMPA , these soft constraints would also directly affect the LMPs creating unwanted deviations. Besides the LMPA, the difficulty of a ZPA, lies in the definition of appropriate zones, for all operation conditions, as outlaid in Section 3.2.3.

Apart from the methodological aspects mentioned above, it has to be recognized, that this work is seen as anchored within the European context, in which a uniform pricing energy market clearing is established<sup>78</sup>. Hence, the implementation of an approach achieving the optimal interaction and coordination of potentially emerging heating markets with the electricity markets would presumably be facilitated by adopting similar pricing mechanisms in the heating markets. Besides, a pure UMPA leads to additional uplift costs, which can entailed high costs, as discussed in Section 3.2.3. This is why, this work is based on the HPA presented in the previous Section 3.2.3. Using this approach, incentive compatibility is achieved under the conditions mentioned before, and the different price levels in the EPN and the DHNs are adequately represented. Summarizing the requirements stemming from the auction design, the market clearing procedure, and the HPA, leads to the following statement:

**Assumption 3.3.** *The EPN and all DHN markets are cleared in a joint, coordinated procedure simultaneously, while taking into account physical network constraints during welfare maximization.*

In doing so, additional uplift costs due to redispatch are prevented.

# **3.3 Control Mechanisms**

The control mechanisms regarded and chosen within the TCS design process are outlaid in the following sections. The basic problem structure of the ISOEMSs and the used class of control approach is presented first introducing the necessary terminology. Then Section 3.3.1 explains how a central ISOEMS controller can be designed in detail. This is followed by the design of the ISOEMSs using a distributed control approach in Section 3.3.2.

In this work a rolling horizon control mechanism is used as it enables to maximize a general predefined objective, taking system constraints into account, including measurement data and predicted INP power demand and supply as well as operational parameters as pump and DPR operational set points. Within the TCS for CEPDHNs presented here, the objective is to maximize the welfare W, resembling the market allocation objective defined in equation (3.1). Whereas, the system constraints are determined by the network models, given in Chapter 2, and the operational limits, stated in the following Section 3.3.1.

<sup>78</sup> Within the different price zones.

Within the context of control engineering, the ISOEMSs within the TCS represent a *nonlinear distributed economic time-variant hybrid discrete model predictive control approach* for specific flow conditions within the DHNs. The terminology is explained as follows:

• *Nonlinear Model Predictive Control (NMPC)* : Given a nonlinear optimal control problem, following [DFH09, p. 393]:

$$\min\_{\mathbf{x}^{\mathrm{st}}, \mathbf{z}^{\mathrm{st}}, \mathbf{u}} \sum\_{k \in \mathbb{S}\_k} q^{\mathrm{obj}}(\mathbf{x}\_k^{\mathrm{st}}, \mathbf{z}\_k^{\mathrm{st}}, \mathbf{u}\_k) \tag{3.3a}$$

subject to

$$\begin{aligned} \mathbf{x}\_1^{\text{st}} - \overline{\mathbf{x}}^{\text{st},0} & \quad &= \mathbf{0}, \end{aligned} \tag{3.3b}$$

$$\left(x\_{k+1}^{\rm st} - f\_k^{\rm sys} \left(x\_k^{\rm st}, z\_k^{\rm st}, u\_k\right)\right) \quad = \mathbf{0}, \quad \forall \, k \in \mathbb{S}\_k, k < |\mathbb{S}\_k| \tag{3.3c}$$

$$h\_k(x\_k^{\rm st}, z\_k^{\rm st}, u\_k) \qquad \qquad = \mathbf{0}, \quad \forall \, k \in \mathbb{S}\_k \tag{3.3d}$$

$$g\_k(x\_k^{\rm st}, z\_k^{\rm st}, u\_k) \qquad \qquad \le \mathbf{0}, \quad \forall \, k \in \mathbb{S}\_k \tag{3.3e}$$

with the system state space variables of all time steps x st = [x st 1 , ..., x st k , ..., x st <sup>n</sup>ck ], the algebraic state variables z st = [z st 1 , ..., z st k , ..., z st <sup>n</sup>ck ] and the control values given by u = [u1, ...,uk, ...,u ck n ] with the cardinality of all time steps on the prediction horizon given by n ck = |Sk|. Further, the initial system state is defined by x st,0 . The nonlinear discrete dynamic system model is given in equation (3.3c). Together, the equality constraints described with h in equation (3.3d), and the nonlinear discrete dynamic model (3.3c) represent forms a Differential Algebraic Equation (DAE) form [DFH09, p. 392f]. Additionally, the system boundaries are aggregated in g. Solving the discrete dynamic nonlinear optimization problem (3.3) for every time step, in order to find the optimal control values u <sup>∗</sup> minimizing the objective q obj, taking into account latest system state measurements x st,0 is referred to as MPC [BBM17]. Using the *nonlinear* system model (3.3c) is usually referred to as NMPC [Grü17]. The term *discrete* stems from the discrete system description.


For the ISOEMSs in the TCS used for the control of the CEPDHN the following assignment of variables to x st , u, and z st can be made:


In control theory, many control approaches, as NMPC are based on a (nonlinear) state space model of the controlled system. In the case of the CEPDHN controlled by the ISOEMS , obtaining such a regular state space model is not possible, as explained in the following Remark 3.9.

### **Remark 3.9:**

*Assuming constant mass flows and thus also constant flow directions, a pipeline can be modeled as a (damped) dead-time element model, which can be formulated as a discrete dynamic state space system model as in* (3.3c)*. However, this will only lead to accurate results, if the dead-time* t dead *can be expressed through multiple time step intervals* t dead = n∆k*, with* n ∈ N >0 *, see [Lun14b, p. 113f], [Lun14c, p. 441]. Therefore, this would necessitate a very small time step interval* ∆k *in order to achieve the demanded accuracy, which would entail a large number of optimization variables. Besides, the assumption of constant flow conditions is not valid if highly efficient DHN operation is to be achieved, see Section 1.2.5, as aimed for in this work. Note, that varying flow velocities<sup>79</sup> lead to changing dead-times, and therefore to a variation of the system model. Thus, this results in a hybrid system with a hybrid time-invariant state space model, where the events are a change of the mass flow within a pipeline.*

Besides the pipelines, large TESSs represent the second CEPDHN components which are represented within equation (3.3c).

### **Remark 3.10:**

*TESSs are distinguished into two groups. The first, are large storages which are owned and operated by the network operator. As these are directly connected to the DHN <sup>80</sup>, meaning that no heat exchanger is used to separate the water circulation of the DHN from the storage, they are seen as part of the modeled primary network<sup>81</sup> and thus their thermal and hydraulic interaction with the other network components and their SOC is explicitly taken into account by the model, see Section 2.3.3. The losses of these water tanks* l *are time dependent<sup>82</sup>, see equation* (2.65)*, and thereby an example for the time variance of the system model* (3.3c)*. The second group of TESS are owned and operated by FNPs and indirectly connected to the DHN through heat exchangers. For*

<sup>79</sup> Assuming constant flow direction.

<sup>80</sup> Assuming sensible hot water storages as defined in Section 2.3.3.

<sup>81</sup> Water circuit of the main pipelines of the DHN [NTJK20]. All indirectly connected producers and consumers have their own secondary networks behind the heat exchanger. In large DHNs secondary networks can also be used to distribute heat at lower temperatures as in the primary network to local consumers, then the local network participants have their own tertiary networks.

<sup>82</sup> As they are dependent on the mean temperature of the water within the storage system T stor,mean which is time dependent.

*these storages, the SOC is not known by the ISOEMS, and thus equation* (2.63)*<sup>83</sup> are not taken into account. Thus, also no state variables are assigned to these storages. Thus, they are regarded by the approach as regular consumers or producers.*

Also, note, that a large TESS is not necessarily found in every Zone assigned to an ISOEMS. Further, also other constraints, as ramping constraints introduced later on in Section 3.3.1 bring along dynamics, which can not be incorporated in (3.3), as (3.3e) is only dependent on a single time step.

Due to the aspects mentioned above, the overall control approach implemented in the TCS is referred to as a *distributed rolling horizon approach*, which is explained in detail in the following subsections. For that matter, first the design of a central ISOEMS is presented, which is then extended to the distributed case.

### **3.3.1 Centralized ISOEMS**

Within this Subsection the rolling horizon approach, used in case of a single ISOEMS controlling the entire CEPDHN is designed. The optimization problem solved within every time step k by the ISOEMS can be generalized as the following nonlinear problem:

$$\min\_{x} f(x) \tag{3.4a}$$

subject to

$$h(x) = \mathbf{0},\tag{3.4b}$$

$$g(x) \le 0\tag{3.4c}$$

Therein, x represents the vector of all optimization variables. Note, that a classification of the variables in x into system states x st, algebraic state variables z st, and control values u is left aside from here on, due to the aspects mentioned in Remarks 3.9, and 3.10. Also, this helps to facilitate the notation, especially considering the distributed optimization approaches presented in Section 3.3.2. The exact objective function f and the operational constraints g, used by the ISOEMS, are depicted below in the *Objective Function* part in Section 3.3.1 and the *Operational Constraints* part in Section 3.3.1. The equality constraints combined in h represent the CEPDHN model summarized in (2.105) and introduced in Chapter 2.

The overall operation procedure of the ISOEMS within the TCS is given in the Nassi-Shneidermann diagram in Figure 3.7.

Two significantly important design parameters are the time step length ∆k and the prediction horizon, understood as the amount of future time steps taken into account n <sup>p</sup> = n ck = |Sk|. It is a commonplace that ∆k is to be chosen as small as possible, to achieve high model accuracy, while n p should be chosen as large as possible, in order to enable foresighted control actions. However, both of these incentives tend to enlarge the amount/vector of the optimization variables x of (3.4). Thus, a tradeoff between small temporal discretization, length of the prediction horizon, and the resulting computation time needed to solve (3.4) needs to be

<sup>83</sup> And consequently also equations (2.64) and (2.65).


**Figure 3.7:** Nassi-Shneidermann diagram of ISOEMS operation procedure including the rolling horizon approach.

performed [ZWW+21]. Through a reasonable choice, this enables to calculate x ∗ the optimal solution of (3.4) within ∆k during operation. A reasonable choice of the time step length ∆k is within 5 min ≤ ∆k ≤ 15 min. These ranges are typically applied in Economic Dispatch (ED) [Arn11, p. 26] and are thus also a valid choice here. Further, as these time step ranges are also applied in intraday markets, as introduced already in Section 3.2.1, it is reasonable to use the same time step interval within the market and control mechanisms, thereby enabling technical efficiency and economic optimality simultaneously. Possible choices for prediction horizons will be discussed within the results in Chapter 4 in detail.

### **Objective Function**

Typical flow velocity limits in DHNs are given in the range of 0.8 m/s to 3 m/s [Glü85b, p. 29]. The lower limits are applied to prevent deposits and the overheating of pumps [NTJK20, p. 124]. In the case of VMFDs it is not possible to implement box constraints, as in the following Section 3.3.1 for the mass flows, which would bound the flows away from zero |m˙ | > ∆ε, with ∆ε > 0. Note, that this would prevent possible flow direction changes, defining these by the initial flow directions.

This can be faced, by introducing soft constraints into the objective function f of the ISOEMS in problem (3.4), which incentivizes the solver to find a solution x ∗ in which the mass flows are slightly bounded away from zero |m˙ | > ∆ε, with ∆ε > 0. Therefore, the objective is put together by the sum of the following two parts:

$$f(x) = f^{\text{eco}}(x) + f^{\text{soft}}(x) \tag{3.5}$$

Therein the economic objective f eco, is defined as the allocation objective, the negative signed welfare W stated in equation (3.1), resulting in f eco = −W. Further, the soft constraints are given as f soft. These soft constraints are implemented by using continuous differentiable approximation of of the rectangular function:

$$f^{\text{soft}}(\mathbf{z}) = \sum\_{e \in \mathbb{S}\_a^{\text{ymfd}}} \sum\_{k \in \mathbb{S}\_k} f^{\text{rect}}(\dot{m}\_{e,k}) \tag{3.6}$$

with

$$f^{\text{rect}}(\dot{m}\_{e,k}) = w\_{e,k}^{\text{rect,h}} \left[ 1 + \text{sgn}\_{\Delta \varepsilon} \left( w\_{e,k}^{\text{rect,w}} - (\dot{m}\_{e,k})^2 \right) \right] \tag{3.7}$$

The weighting factors w rect e,k define the form of the rectangular function approximation. In doing so, the width of f rect is enlarged by w rect,w e,k , while the height is set by <sup>w</sup> rect,h e,k , as shown in Figure 3.8. The used continuously differentiable approximation of the signum function in equation (3.7) is given by:

$$\text{sgn}\_{\Delta \varepsilon}(x) = \frac{x}{|x|\_{\Delta \varepsilon}}\tag{3.8}$$

**Figure 3.8:** Approximation of the rectangular function, given weighting factors w rect,w e,k = 1 and the height w rect,h e,k = 0.<sup>1</sup> of <sup>f</sup> rect .

while the continuous differentiable approximation of the absolute value function is defined as in equation (2.20).

### **Remark 3.11:**

*Besides the operational benefits, the presented soft constraints* f soft *also provide a second salient feature. Reports on convergence issues of optimization problems, stemming from the consideration of VMFDs are found in [ZWW*<sup>+</sup>*21] and [Trö99]. Also within the DHN model presented in Chapter 2, in some cases, convergence issues were seen, especially when mass flows were near zero* m˙ ≈ 0*. In this context, using the soft constraints* f soft *to slightly bound* m˙ *away from zero enhances the convergence properties.*

### **Operational Constraints**

P

The specification of operational constraints is given below for the EPN, and the DHN respectively. These boundaries not only ensure secure and preserving network operation but also improve the NLP solver performance [Cor20, p. 319]. The variable bounds of the EPN, and the FNPs connected to it are:

$$V\_i^{\min} \le V\_{i,k} \le V\_i^{\max}, \qquad \qquad \forall \ i \in \mathbb{S}\_i^{\text{epn}}, k \in \mathbb{S}\_k \tag{3.9}$$

$$P\_{n,k}^{\min} \le P\_{n,k} \le P\_{n,k}^{\max}, \qquad \qquad \forall \ n \in \mathbb{S}\_n^{\text{epn}}, k \in \mathbb{S}\_k \tag{3.10}$$

$$Q\_{n,k}^{\min} \le Q\_{n,k} \le Q\_{n,k}^{\max}, \qquad \qquad \forall \, n \in \mathbb{S}\_n^{\text{epn}}, k \in \mathbb{S}\_k \tag{3.11}$$

Voltage amplitudes V at buses i are kept within minimum and maximum values, usually defined in the per unit system. The limits on active and reactive power are defined by relevant distribution system transformer capacities, in the EPN , and represent the bid and offer limits set by the EMSSAs of the FNPs, and may vary over time. Note, that feeder limits can also be readily included in the proposed EPN model.

The inequalities used to represent the operational DHN, and the connected FNPs, limits are:

$$\begin{aligned} p\_i^{\min} \le p\_{i,k} \le \Delta p\_i^{\max}, & \quad \forall \, i \in \mathbb{S}\_i^{\text{dhn}}, \, k \in \mathbb{S}\_k\\ \Delta p\_e^{\min} \le \Delta p\_{e,k} \le \Delta p\_e^{\max}, & \quad \forall \, e \in \mathbb{S}\_e^{\text{dhn}}, \, k \in \mathbb{S}\_k \end{aligned} \tag{3.12}$$

$$
\dot{m}\_e^{\min} \le \dot{m}\_{e,k} \le \dot{m}\_e^{\max}, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\text{dhn}}, \, k \in \mathbb{S}\_k \tag{3.14}
$$

$$K\_e^{\min} \le K\_{e,k} \le K\_e^{\max}, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\text{vlv}}, \, k \in \mathbb{S}\_k \tag{3.15}$$

$$T\_{i,k}^{\min} \le T\_{i,k} \le T\_{i,k}^{\max}, \qquad \qquad \forall \, i \in \mathbb{S}\_i^{\text{dhn}}, k \in \mathbb{S}\_k \tag{3.16}$$

$$E\_n^{\min} \le E\_{n,k} \le E\_n^{\max}, \qquad \qquad \forall \ n \in \mathbb{S}\_n^{\text{stor}}, k \in \mathbb{S}\_k \tag{3.17}$$

$$T^{\min} < T^{\text{out}} < T^{\max} \tag{3.18}$$

$$T^{\min} \le T\_{e,k}^{\text{out}} \le T^{\max}, \qquad \qquad \forall \, e \in \mathbb{S}\_e^{\text{exch}}, k \in \mathbb{S}\_k \tag{3.18}$$

$$\Phi\_{n,k}^{\text{min}} \le \Phi\_{n,k} \le \Phi\_{n,k}^{\text{max}}, \qquad \qquad \forall \, n \in \mathbb{S}\_n^{\text{dhn}}, k \in \mathbb{S}\_k \tag{3.19}$$

$$
\Phi\_{n,k}^{\min} \le \Phi\_{n,k} \le \Phi\_{n,k}^{\max}, \quad \qquad \qquad \forall \ n \in \mathbb{S}\_n^{\text{dhn}}, k \in \mathbb{S}\_k \tag{3.19}
$$

Pressure potentials p need to be maintained within respective bounds at all nodes i, since the minimum limits p min i prevent evaporation and corrosion and maximum limits p max i prevent damage of the network components. Similarly, this security aspect applies to the differential pressures over DHN edges ∆p, where the lower bounds also guarantee satisfactory mass flow to meet the power demand of consumers. As already mentioned in Section 3.3.1 the lower bounds on mass flows m˙ min <sup>e</sup> prevent the accumulation of deposits and the overheating of pumps, while the upper bounds m˙ max <sup>e</sup> prohibit high pressure losses and thereby lower the power necessary for operation of the pumping devices. Note, that for edges e with VMFDs the lower bound is defined as m˙ min <sup>e</sup> = −m˙ max e , while soft constraints bound the mass flows away from zero, see Remark 3.11. For edges with fixed flow directions, for example due to a check valve in the respective *string of edges*<sup>84</sup> m˙ min <sup>e</sup> > 0, is used to define the flow direction within the operation NLP problem (3.4). The valve flow factor limits are used to represent the two extreme values of operation; a closed valve for Kmin e and an open valve for Kmax e . The node

<sup>84</sup> A sequence of edges, where every node only connects two edges of the regarded sequence.


**Table 3.1:** Typical boundaries values of most relevant operational variables in CEPDHNs.

temperatures T<sup>i</sup> are limited in the supply network to guarantee satisfactory heat power provision to consumers and prevent damage of network components; when applied, limits on the return network temperatures enable a high operation efficiency with low losses. The possible SOC of a TESS E is limited by the maximal admissible water temperature and the volume of the TESS. Minimal outlet temperatures of FNPs T out e,k can be set, if the prediction horizon is insufficient to exhibit, that lower values of T out e,k will lead to nodal temperatures at the last critical consumer going below the temperature limits T min i,k , necessary for sufficient heat supply. Limits on heat power infeed or demand Φ min n,k and <sup>Φ</sup> max n,k originate from the bids and offers of the FNPs.

### **Remark 3.12:**

*In cases, where variables of* x *appear in the demoninator of a specific model equation, the operational limits should be bounded away slightly from zero by setting* x min = ∆ε*, with sufficiently small* ∆ε > 0*. This applies e.g. for the minimum valve flow factor* Kmin e *, see equation* (2.31)*.*

In general, it is not possible to give one set of parameters applicable to every CEPDHN for all operation conditions, due to large differences in design and operation form. Still, for the most important variable limits of the operational bounds mentioned above, parameter ranges are stated in Table 3.1. Ramping constraints can be applied if needed to represent limits in electric power injection changes of FNPs<sup>89</sup>:

$$P\_{n,k-1} - \Delta P\_n^{\text{ramp}} \le P\_{n,k} \le P\_{n,k-1} + \Delta P\_n^{\text{ramp}}, \qquad \forall \, n \in \mathbb{S}\_n^{\text{cpu}}, k \in \mathbb{S}\_k \tag{3.20}$$

$$Q\_{n,k-1} - \Delta Q\_n^{\text{ramp}} \le Q\_{n,k} \le Q\_{n,k-1} + \Delta Q\_n^{\text{ramp}}, \qquad \forall \, n \in \mathbb{S}\_n^{\text{cpu}}, k \in \mathbb{S}\_k \tag{3.21}$$

The FNP ramping limits are given by ∆P ramp n for real and ∆Qramp n for reactive power.

<sup>85</sup> "This means that at the highest point of the network the pressure of the district heating water must be at least 0.5 bar higher than the steam pressure at the maximum network temperature [...]. An additional 1 bar is recommended for any unexpected events."[NTJK20, p. 52]

<sup>86</sup> "the pressure at maximum load at a specified point and at maximum network temperature"[NTJK20, p. 52].

<sup>87</sup> Typical pipeline diameters are in the range of 20 mm to 1000 mm [NTJK20, p. 64]. Also see Remark 3.11

<sup>88</sup> The maximum value of a value below the freezing temperature T freeze and the ambient temperature T a , are possible from a technical stand point. Often return network temperatures do not fall below 35 °C [ZWW+21].

<sup>89</sup> For k1, the previous time step k<sup>1</sup> − 1 is equal to the first past time step k p 1 .

Similarly ramp limits are applicable for the DHN operation, as<sup>89</sup>:

$$\begin{split} &\Delta p\_{e,k-1} - \Delta p\_e^{\text{ramp}} \le \Delta p\_{e,k} \le \Delta p\_{e,k-1} + \Delta p\_e^{\text{ramp}}, \qquad \forall \ e \in \mathbb{S}\_e^{\text{dhn}}, \ k \in \mathbb{S}\_k \quad \text{(3.22)}\\ &\dot{m}\_{e,k-1} - \Delta \dot{m}\_e^{\text{ramp}} \le \dot{m}\_{e,k} \le \dot{m}\_{e,k-1} + \Delta \dot{m}\_e^{\text{ramp}}, \qquad \forall \ e \in \mathbb{S}\_e^{\text{dhn}}, \ k \in \mathbb{S}\_k \quad \text{(3.23)}\\ &T\_{i,k-1} - \Delta T\_i^{\text{ramp},\text{node}} \le T\_{i,k} \le T\_{i,k-1} + \Delta T\_i^{\text{mode}}, \qquad \forall \ i \in \mathbb{S}\_i^{\text{dhn}}, k \in \mathbb{S}\_k \quad \text{(3.24)}\\ &T\_{e,k-1}^{\text{out}} - \Delta T\_e^{\text{ramp},\text{out}} \le T\_{e,k}^{\text{out}} \le T\_{e,k-1}^{\text{out}} + \Delta T\_e^{\text{ramp},\text{out}}, \qquad \forall \ e \in \mathbb{S}\_e^{\text{cech}}, k \in \mathbb{S}\_k \quad \text{(3.25)}\\ &\Phi\_{n,k-1} - \Delta \Phi\_n^{\text{ramp}} \le \Phi\_{n,k} \le \Phi\_{n,k-1} + \Delta \Phi\_n^{\text{ramp}}, \qquad \forall \ n \in \mathbb{S}\_n^{\text{dhn}}, k \in \mathbb{S}\_k \quad \text{(3.26)} \end{split}$$

Ramping limits on differential pressure ∆p ramp <sup>e</sup> or mass flows ∆ ˙mramp e are used to limit set point changes of pumps which help to prevent material fatigue. Similarly, the limits on temperature differences between time steps ∆T ramp,node i helps to reduce aging of pipeline insulation, see [MMW+20] or Section 2.99. This can also be applied to the FNPs, where a restriction of the variation of the output temperature ∆T ramp,out n , and the heat power ∆Φramp n , can be used to prevent fast aging of heat exchangers.

### **3.3.2 Multiple Distributed ISOEMSs**

There are two main reasons motivating the design of a *distributed* rolling horizon approach, with multiple distributed ISOEMSs, solving the operation NLP problem (3.4), in a coordinated form. The first reason is to reduce the computational burden of the potentially large scale NLP problem solved for every time step by parallelization [CNP02]. The second is the ability to reduce the amount of information sharing between different stakeholders, network operation systems and NPs. Note, that as stated in [LGZ+19]: "for the aim of privacy protection, passing some sensitive information such as the system configurations, network data, building parameters, and user preferences to the other party is not acceptable." Thus, a TCS designed for a CEPDHN reaching over the areas of multiple network operators, could be possibly implemented more simply if the operational zones of the ISOEMSs were aligned with the network boundaries of the different network operators. Apart from Germany, in many regions Distribution System Operators (DSOs) do not operate EPNs and DHNs but these are operated by different institutions [LWM+18].

### **Remark 3.13:**

*Optimal dispatch problems with dynamic models, ranging over multiple time steps, can be decomposed into subproblems by two different forms. The first form divides the underlying network models into multiple operational zones, thereby applying a spatial decomposition [MDS*<sup>+</sup>*17]. The second separates the time steps into multiple sets with consecutive time steps [RMIMD13]. In this work, only spatial decompositions are taken into account, as in most sources on distributed optimal dispatch of energy systems, see e.g. [MDS*<sup>+</sup>*17]. This is done as it is expected that the dynamics of the thermal pipeline model presented in Section 2.3.3, the TESSs model provided in Section 2.3.3, and the ramping constraints stated in Section 3.3.1 necessitate more information exchange and create more complicating constraints<sup>90</sup> in the case of a temporal decomposition, as the network models in case of spatial decomposition over tie lines and pipelines. Note, that alone the pipeline*

<sup>90</sup> A constraint that is dependant on variables from a different subproblem (here operational zone), see Definition 3.3.

*model would coupled multiple time steps, for every time step* k *and every pipeline in the regarded DHN , through the mapping of the node temperatures to the positions in the respective pipelines and the outlet temperatures, see* (2.70) *which incorporates* (2.66)*. Additionally, a temporal decomposition does not solve the privacy issues stemming from the information sharing between different ISOEMSs mentioned before.*

For this spatial form of decomposition, all network elements will be assigned to a specific operational zone. Thereby, the following special network elements are defined:

### **Definition 3.1**


Before different approaches are presented which can be used to decompose the NLP problem (3.4) below, a further entity is defined, which is needed to enable a distributed solution. This is the coordinator:

### **Definition 3.2**

*The coordinator synchronizes calculations and checks if the stopping criterion<sup>a</sup> is fulfilled for every iteration of the distributed optimization approach [HLW17], applied in the design of the ISOEMSs. Note, that in this context synchronizing is understood as starting and ending parallel or sequential calculations of the different entities, in the correct order and point in time.*

*a* Different stopping criteria, are provided in Section 3.3.2, with the respective distributed optimization approaches.

In the following Sections different approaches, which can be used to perform a distributed NLP problem optimization are presented and discussed.

### **Distributed Optimization Approaches**

Several approaches exist which can be used to solve large scale optimization problems through decomposition into smaller subproblems which are then solved in parallel [CCMGB06]. A wide number of papers has been published on the application of such techniques to the OPF problem, in order to find optimal dispatch solutions of large scale EPNs. In doing so, distributed operation is enabled while achieving global optimality [NPC03]. An overview of these approaches applied to different forms of the OPF problem is given in [MDS+17].

OCD and ADMM represent the SOTA and have been successfully applied within the context of optimal dispatch of MESs , as will be stated in detail below. Thus, these two approaches and further developments of these algorithms will be presented in the following four paragraphs on a high level. Thereafter, toward the end of the current section, the aim is to select an appropriate distributed optimization approach for the design of the ISOEMSs within the TCS . This selection is based on a methodical comparison.

**Alternating Direction Method of Multipliers** The ADMM approach brings together the Dual Decomposition, the Augmented Lagrangian, and the Method of Multipliers methodologies [MDS+17]. The description of the ADMM algorithm and properties below follow [BPC+11, pp. 13-17]. Given the following problem:

$$\min\_{x,z} f(x) + g(z) \tag{3.27a}$$

subject to

$$
\mathbf{\tilde{A}}x + \mathbf{\tilde{B}}z = \mathbf{\tilde{c}}\tag{3.27b}
$$

with optimization variable vectors x and z, objective functions f and g, matrices A˜ and B˜ , and vector c˜. The Augmented Lagrangian (AL) L al of problem (3.27) is given by:

$$\mathcal{L}^{\text{al}}(x, z, \lambda) = f(x) + g(z) + \lambda^\top (\tilde{A}x + \tilde{B}z - \tilde{c}) + (\rho^{\text{al}}/2)||\tilde{A}x + \tilde{B}z - \tilde{c}||\_2^2 \tag{3.28}$$

with the AL penalty parameter ρ al and the dual variable vector λ. The different ADMM iterations ν are defined as:

$$\mathbf{x}\_{\nu+1} \coloneqq \operatorname\*{argmin}\_{\mathbf{z}} \ L\_{\rho^{\mathrm{ul}}}(\mathbf{z}, \mathbf{z}\_{\nu}, \lambda\_{\nu}) \tag{3.29a}$$

$$\mathbf{z}\_{\nu+1} \coloneqq \operatorname\*{argmin}\_{\mathbf{z}} \ L\_{\rho^{\mathrm{ul}}}(\mathbf{z}\_{\nu+1}, \mathbf{z}, \lambda\_{\nu}) \tag{3.29b}$$

$$\lambda\_{\nu+1} := \lambda\_{\nu} + \rho^{\mathrm{al}} (\mathbf{\tilde{A}} x\_{\nu+1} + \mathbf{\tilde{B}} z\_{\nu+1} - \mathbf{\tilde{c}}) \tag{3.29c}$$

Supposing, the two following assumptions hold:

**Assumption 3.4.** *The functions* f *and* g *are proper, convex, and closed.*

**Assumption 3.5.** *There exists a saddle point on the (unaugmented) Lagrangian* L *91 .*

Then, the following convergence properties are shown in [BPC+11]: For ν → ∞ the value of f(xν) + g(zν) will converge to the optimal objective of (3.27), fulfilling (3.27b). Further, λ<sup>ν</sup> converges towards the dual optimal vector λ ∗ .

<sup>91</sup> With L = Lal for ρ al = 0.

For practical implementations it is of interest to use a stopping criterion, which defines when the procedure defined in (3.29) can be ended. This is typically checked by the coordinator as described in Definition 3.2. A possible stopping criterion is given in [BPC+11, p. 33].

Within the application of an optimal dispatch problem of energy systems with two ISOEMSs, one for operational Zone a and one for Zone b. Then, the variables x are optimized during the optimization of the ISOEMS in Zone a and similarly, the ISOEMS responsible for Zone b optimizes the variables z. Then through (3.27b) a subset of the variables in x and z become equal.

Further properties of the ADMM approach are listed in Table 3.2. Thereby it is important to note, that the basic ADMM approach presented here needs a central coordinator performing the calculation (3.29c) and the calculations in (3.29) are performed sequentially, first by Zone a, then by Zone b and finally by the coordinator. Thus, ADMM in this basic form helps to reduce the problem sizes of the subproblems, but does not enable parallel computation. Further, ADMM in this basic form is no fully distributed approach following Definition 1.1, due to the calculations of the coordinator.

**Distributed Approaches of the Alternating Direction Method of Multipliers** Different approaches exist, to enable a fully distributed and thus parallel calculation of an ADMM implementation. The main difference to the standard ADMM approach introduced in the last paragraph is that the calculation of λ is performed by every operational zone in parallel instead of using a central coordinator. Hence, the role of the coordinator becomes less important and the information exchange between the subproblem solving controllers and the coordinator can be reduced, compare Table 3.2 and Table 3.3. The central basic idea behind these approaches, that makes it possible to use ADMM in a distributed form, is presented here for the case of two operational zones/subproblems. These are Zone a and Zone b notated by the superscripts "za" and "zb" in the following. Supposing subproblems with local variables, here x za and x zb, the main idea is to introduce global consensus variables z which will be recalculated based on the average values of all local variables in x = [x za , x zb], representing the consensus variable locally. Assuming a central problem of the following form, considered as a General Form Consensus Problem (GFCP) in [BPC+11]:

$$\min\_{\mathbf{x}, \mathbf{z}} f^{\mathbf{z}\mathbf{a}}(\mathbf{z}^{\mathbf{z}\mathbf{a}}) + f^{\mathbf{z}\mathbf{b}}(\mathbf{z}^{\mathbf{z}\mathbf{b}}) \tag{3.30a}$$

subject to

$$
\tilde{A}x = z \tag{3.30b}
$$

with z = [z za , z zb], matrices A˜ = diag(A˜ za , A˜ zb), and the objective functions of both operational zones f za and f zb. Therein, a subset of the local variables in x, is represented in both subproblems and thus in x za and x zb. Therefore, as described before for the general ADMM approach, also in this case, some variables of the initial central optimization problem will be found in both subproblems.


**Table 3.2:** Properties of the ADMM algorithm.

Note, that the general form consensus problem given in (3.30) arises from (3.27), by setting:

$$f(\mathbf{z}) = f^{\text{za}}(\mathbf{z}^{\text{za}}) + f^{\text{xb}}(\mathbf{z}^{\text{xb}}), \qquad g(\mathbf{z}) = 0, \qquad \tilde{\mathbf{B}} = -I, \qquad \tilde{\mathbf{c}} = \mathbf{0} \tag{3.31}$$

where I defines the identity matrix.

The distributed ADMM iterations for operational Zone a can then be calculated by:

$$\mathbf{x}^{\mathbf{za}}\_{\nu+1} := \operatorname\*{argmin}\_{\mathbf{z}^{\mathbf{za}}} f^{\mathbf{za}}(\mathbf{z}^{\mathbf{za}}) + \boldsymbol{\lambda}^{\mathbf{za}^{\top}} \left( \mathbf{\tilde{A}}^{\mathbf{za}} \mathbf{z}^{\mathbf{za}} - \mathbf{z}^{\mathbf{za}}\_{\nu} \right) + \frac{\rho^{\mathbf{al}}}{2} ||\mathbf{\tilde{A}}^{\mathbf{za}} \mathbf{z}^{\mathbf{za}} - \mathbf{z}^{\mathbf{za}}\_{\nu}||\_2^2 \tag{3.32a}$$

$$\mathbf{z}\_{\nu+1}^{\rm xa} := \frac{1}{2} (\mathbf{\tilde{A}}^{\rm xa} x\_{\nu+1}^{\rm xa} + \mathbf{\tilde{A}}^{\rm xb} x\_{\nu+1}^{\rm xb}) \tag{3.32b}$$

$$
\lambda\_{\nu+1}^{\text{xa}} := \lambda\_{\nu}^{\text{xa}} + \rho^{\text{al}} (\tilde{\mathbf{A}}^{\text{xa}} x\_{\nu+1}^{\text{xa}} - z\_{\nu+1}^{\text{xa}}) \tag{3.32c}
$$

thereby, it can be seen, that x za <sup>ν</sup>+1 can be directly calculated independently of Zone b. For the calculation of z za <sup>ν</sup>+1 in (3.32b) the newly calculated variables of Zone b x zb <sup>ν</sup>+1 need to be communicated. The new values of the dual variables λ za <sup>ν</sup>+1 are then again calculable independently. Note, that the primal and dual variables of Zone b are equally calculated, by replacing all "za" entries in (3.32) by "zb" and vice versa<sup>92</sup> .

Further, note, that it is possible to limit x and z in (3.30) and thus also in (3.32a) to x za ∈ X za , x zb ∈ X zb, and z ∈ Z. Where, the spaces X za , X zb, and Z can be defined by (local) constraints. This enables to e.g. include nonlinear power flow constraints, when this approach is applied to solve distributed optimal dispatch problems, as in [GHT17].

**Optimality Condition Decomposition** The decomposition approach is presented for the case of two subproblems/operational zones, marked with the superscripts za and zb below. An exemplary central optimization problem used to illustrate the approach is given as [CCMGB06]:

$$\min\_{\mathbf{x}^{\mathrm{za}}, \mathbf{a}^{\mathrm{xb}}} f^{\mathrm{xa}} \left( \mathbf{x}^{\mathrm{za}} \right) + f^{\mathrm{xb}} \left( \mathbf{x}^{\mathrm{xb}} \right) \tag{3.33a}$$

subject to

$$h^{\rm za}(x^{\rm za}, x^{\rm zb}) = \mathbf{0},\tag{3.33b}$$

$$h^{\rm zb}(x^{\rm za}, x^{\rm zb}) = \mathbf{0} \tag{3.33c}$$

with the equality constraints divided into to parts h za and h za. Then, the Lagrangian is defined as:

$$\begin{split} \mathcal{L}\left(\mathbf{z}^{\text{za}}, \mathbf{z}^{\text{zb}}, \boldsymbol{\lambda}^{\text{za}}, \boldsymbol{\lambda}^{\text{zb}}\right) &= f^{\text{za}}\left(\mathbf{z}^{\text{za}}\right) + f^{\text{xb}}\left(\mathbf{z}^{\text{xb}}\right) \\ &+ \left(\boldsymbol{\lambda}^{\text{za}}\right)^{\top} \boldsymbol{h}^{\text{za}}\left(\mathbf{z}^{\text{za}}, \mathbf{z}^{\text{xb}}\right) + \left(\boldsymbol{\lambda}^{\text{xb}}\right)^{\top} \boldsymbol{h}^{\text{xb}}\left(\mathbf{z}^{\text{xa}}, \mathbf{z}^{\text{xb}}\right) \end{split} \tag{3.34}$$

<sup>92</sup> Therefrom it can be seen, that in the case of two operational zones/subproblems the global variables which are of relevance in Zone a and Zone b are the same, as z za = z zb.


**Table 3.3:** Properties of the class of distributed ADMM algorithms.

Setting up the Karush-Kuhn-Tucker (KKT) conditions and applying the Newton-Raphson method leads to the following set of equations, that is solved for every Newton iteration ν [Arn11]:

$$\underbrace{\begin{bmatrix} \mathbf{KKT}^{\mathrm{za}} & \mathbf{KKT}^{\mathrm{zb},\mathrm{za}} \\ \mathbf{KKT}^{\mathrm{za},\mathrm{zb}} & \mathbf{KKT}^{\mathrm{zb}} \end{bmatrix}}\_{\mathbf{KKT}} \underbrace{\begin{bmatrix} \boldsymbol{\Delta}^{\mathrm{cent},\mathrm{za}} \\ \boldsymbol{\Delta}^{\mathrm{cent},\mathrm{zb}} \end{bmatrix}}\_{\boldsymbol{\Delta}^{\mathrm{cent}}} = -\underbrace{\begin{bmatrix} \nabla\_{[\mathbf{z}^{\mathrm{za}},\lambda^{\mathrm{za}}]} \mathcal{L} \\ \nabla\_{[\mathbf{z}^{\mathrm{a}\mathrm{b}},\lambda^{\mathrm{zb}}]} \mathcal{L} \end{bmatrix}}\_{\nabla \mathcal{L}} \tag{3.35}$$

with the differential operator ∇ and the search directions of the central problem given by ∆cent,za = - ∆x cent,za , ∆λ cent,za and ∆cent,zb = - ∆x cent,zb , ∆λ cent,zb . Further, the KKT matrices are defined as [CCMGB06]:

$$\begin{aligned} \textbf{KKT^{za}} &= \begin{bmatrix} \nabla\_{\textbf{z}^{\text{za}}, \textbf{z}^{\text{za}}}^{\nabla} \mathcal{L} & \begin{pmatrix} \nabla\_{\textbf{z}^{\text{za}}} h^{\text{za}} \end{pmatrix}^{\top} \\ \nabla\_{\textbf{z}^{\text{za}}} h^{\text{za}} & \mathbf{0} \end{bmatrix}, & \textbf{KKT^{zb,za}} = \begin{bmatrix} \nabla\_{\textbf{z}^{\text{za}}, \textbf{z}^{\text{za}}}^{\nabla} \mathcal{L} & \begin{pmatrix} \nabla\_{\textbf{z}^{\text{za}}} h^{\text{z}} \end{pmatrix}^{\top} \\ \textbf{KKT^{za,zb}} &= \begin{pmatrix} \textbf{KKT^{za,zb}}^{\textbf{z}^{\text{za}}} \end{pmatrix}^{\top} , & \textbf{KKT^{zb}} = \begin{bmatrix} \nabla\_{\textbf{z}^{\text{za}}} h^{\text{za}} \end{bmatrix}^{\top} \end{aligned} \\ \textbf{KKT^{za,zb}} &= \begin{bmatrix} \nabla\_{\textbf{z}^{\text{za}}, \textbf{z}^{\text{za}}}^{\nabla} \mathcal{L} & \begin{pmatrix} \nabla\_{\textbf{z}^{\text{za}}} h^{\text{z}} \end{bmatrix}^{\top} \\ \textbf{V}\_{\textbf{z}^{\text{za}}} h^{\text{zb}} & \mathbf{0} \end{bmatrix} \end{aligned} \tag{3.36}$$

Applying the OCD approach to (3.33) leads to the following two subproblems, for Zone a:

$$\min\_{\mathbf{z}^{\mathrm{za}}} f^{\mathrm{za}}(\mathbf{z}^{\mathrm{za}}) + \left(\overline{\lambda}^{\mathrm{zb}}\right)^{\top} h^{\mathrm{hb}}(\mathbf{z}^{\mathrm{za}}, \overline{\mathbf{z}}^{\mathrm{zb}}) \tag{3.37a}$$

subject to

$$h^{\rm za}(x^{\rm za}, \overline{x}^{\rm zb}) = \mathbf{0} \tag{3.37b}$$

and Zone b:

$$\min\_{\mathbf{z}^{\mathrm{zrb}}} f^{\mathrm{zb}}\left(\mathbf{z}^{\mathrm{zrb}}\right) + \left(\overline{\lambda}^{\mathrm{za}}\right)^{\top} h^{\mathrm{za}}\left(\overline{\mathbf{z}}^{\mathrm{za}}, \mathbf{z}^{\mathrm{zb}}\right) \tag{3.38a}$$

subject to

$$h^{\rm zb}(\overline{x}^{\rm za}, x^{\rm zb}) = \mathbf{0} \tag{3.38b}$$

where the □ operator indicates, that these (dual) variables have been turned into parameters. And all variables and constraints have been assigned to a certain operational zone, while the objective function has been split up into two parts. Further (3.37b) and (3.38b) represent complicating constraints, which are understood as:

### **Definition 3.3**

*A complicating constraint is dependent on one or more variables of its proper operational zone and one or more variables from one or more further operational zones. All variable values coming from different operational zones are then turned into parameters by the approach, and are thus treated as constants, updated for every iteration* ν*.*

It has to be noted, that complicating constraints are not only considered within their proper operational zone by the approach, but also as soft constraints within the objectives of the operational zones, from which the □ parameters originate from, when they are used as constraints, see (3.37) and (3.38). In either case, the used □ parameters are obtained from the (dual) variables of the other operational zone from the last Newton iteration v − 1. This indicates the basic OCD algorithm for every Newton iteration ν:


Different stopping criteria are stated in the given literature. In [CCMGB06, p. 216f] and [Arn11, p. 97] a tolerance ϵ of the (exchanged) optimization variables between two iterations is used, while in [CNP02], also the first order optimality measure is compared against a used tolerance. Computing these distributed subproblems with Newtons method is equal to solving the following set of equations, within every Newton iteration [Arn11]:

$$\underbrace{\begin{bmatrix} \mathbf{KKT^{za}} & \mathbf{0} \\ \mathbf{0} & \mathbf{KKT^{xb}} \end{bmatrix}}\_{\mathbf{KKT}} \underbrace{\begin{bmatrix} \boldsymbol{\Delta}^{\text{dist,za}} \\ \boldsymbol{\Delta}^{\text{dist,xb}} \end{bmatrix}}\_{\mathbf{\Delta}^{\text{dist}}} = -\begin{bmatrix} \nabla\_{\left[\boldsymbol{x}^{\text{xa}}, \boldsymbol{\lambda}^{\text{xa}}\right]} \mathcal{L} \\ \nabla\_{\left[\boldsymbol{x}^{\text{xb}}, \boldsymbol{\lambda}^{\text{xb}}\right]} \mathcal{L} \end{bmatrix} \tag{3.39}$$

with the distributed search directions ∆dist,za = - ∆x dist,za , ∆λ dist,za and ∆dist,zb = - ∆x dist,zb , ∆λ dist,zb as well as the approximated KKT matrix KKT. Note that by comparing (3.39) with (3.35) it is understood that KKT is obtained from KKT by setting the matrices on the secondary diagonals to 0. Now, convergence of the distributed solution towards the central solution of (3.33) can be shown if at the provided second-order KKT point y <sup>∗</sup> = - x za , x zb ,λ za ,λ zb the following holds [CNP02]:

**Assumption 3.6.** *Lipschitz continuous second-order derivatives of the equations* f za, f zb , h za *, and* h zb *exist.*

**Assumption 3.7.** *The Jacobian matrix of the equality constraints of* (3.33)*, precisely* - (∇h za) <sup>⊤</sup>,(∇h zb) ⊤ ⊤ *provides full row rank.*

**Assumption 3.8.** *For* (3.33)*, the sufficient second-order optimality conditions are fulfilled.*

Further, for every iterate of Newton's method ν, the approximated KKT matrix KKT<sup>ν</sup> has to fulfill the condition below:

**Condition 3.1:** *All matrices* KKT<sup>ν</sup> *of the sequence* KKT<sup>ν</sup> <sup>→</sup> KKT<sup>∗</sup> *are non singular.* Thereby, KKT<sup>∗</sup> describes the approximated KKT matrix at the optimal solution. Last but not least, the condition for convergence given below needs to hold at y ∗ :

\*\*Condition 3.2\*\*: 
$$\rho^{\text{ocd},\*} = \rho \left( I - \left( \overline{\mathbf{KKT}}^\* \right)^{-1} \mathbf{KKT}^\* \right) < 1,\tag{3.40}$$

with ρ(□) defining the spectral radius. Further, KKT<sup>∗</sup> represents the KKT matrix at the optimal solution. If Assumptions 3.6 to 3.8 are fulfilled, and Condition 3.1 and 3.2 are fulfilled as well, then iteratively solving (3.37) and (3.38) will converge towards y <sup>∗</sup> with at least linear rate ρ ocd,∗<sup>93</sup> for all starting points y 0 sufficiently close to y ∗ . The literature often refers to ρ ocd,∗ as the coupling factor. As can be understood from equation (3.40), the coupling factor is smaller for decompositions possessing less coupling, thus less non zero entries on the secondary diagonals of the KKT block matrix KKTza,zb and KKTzb,za. In the context of optimal dispatch of energy systems this refers to less tie lines connecting the decoupled operational zones [Arn11]. In this sense, a high degree of sparsity of the nodal admittance matrix, see Remark 2.2, is a salient property of an EPN, as it increases the probability of finding a very appropriate decomposition.

Further properties of the OCD approach are given in Table 3.4.

Within the following remarks further important aspects of the OCD approach are described.

### **Remark 3.14:**

*The OCD approach, which was presented here for the simple case of an optimization problem with complicating constraints, can be simply expanded to the case of additional non complicating equality and inequality constraints, which only include variables of the respective operational zone. Also complicating inequality constraints, as e.g. flow limits over border edges, can be readily included in the same manner as complicating equality constraints [NPC03].*

### **Remark 3.15:**

*There are indications that symmetrically decomposed problems are more likely to fulfill Condition 3.2. Symmetrical decomposition means, that a complicating constraint in both operational zones is present, which has an identical part and incorporates the same (parameterized) variables. The first indication is, that the majority of the published applications of OCD to energy system dispatch problems decompose the central problems in a symmetrical form. For example in OPF problems, the power flow over a tie line is part of the power flow constraints, see equation* (2.15)*, of both border nodes in the two adjacent operational zones. This power flow is dependent on the voltage amplitude and phase of the bordering nodes, which are thus part of both complicating*

<sup>93</sup> Note, that it is important to distinguish between the result of the spectral radius of the matrix defined in Condition 3.2 ρ ocd and the AL tuning parameter ρ al used in the ADMM algorithms. The identical symbols are used here to stay in line with the prevailing amount of literature on both approaches. However, distinguishing superscripts al and ocd are used for clarification.

<sup>94</sup> Strictly regarded, this approach decouples the CEPDHN over EPN tie lines, which are connected to energy converters as EBs and CHPs.


**Table 3.4:** Properties of the OCD algorithm.

*constraints. The second indication is, that in [Ham20] it is shown, that in case of unsymmetrical decomposition of a convex optimization problem, certain parameter constellations of the objective function do not fulfill Condition 3.2<sup>95</sup> .*

### **Remark 3.16:**

*Slight model reformulations can have a large impact on the coupling of the operational zones, and thus, as well on the coupling factor* ρ ocd,∗ *but also on the amount of necessary information exchange. A simple example demonstrating a reduction of information exchange is given below in Example 3.2. Also, see Section 3.3.2 for an example on decrease of coupling, in the context of DHN operation. Hence, possible model reformulations should always be checked before decomposing a problem into subproblems for the OCD approach.*

<sup>95</sup> Also it appears reasonable, that the distributed search directions ∆dist will most likely be closer to the central search direction ∆cent if all operational zones take information of the other (bordering) operational zones into account, while calculating ∆dist .

### **Example 3.2:**

*Using the power flow equations of the border buses in the form stated in equations* (2.15)*, all bus voltages and phases from Buses* i2*,* i3*, and* i<sup>4</sup> *need to be send to the Zone a to apply the OCD algorithm. This would entail, that not only bordering operational zones exchange information but also operational Zones a and c would have to exchange information. In order to prevent this the power flow equation* (2.15) *of e.g. bus* i<sup>2</sup> *can be defined as:*

$$P\_{i\_2,k} = \sum\_{i \in \mathbb{S}\_i^{\rm open}} P\_{i,i\_2,k}^{\rm flow}, \quad \forall \ k \in \mathbb{S}\_k \tag{3.41}$$

$$P\_{i,i\_2,k}^{\rm flow} = V\_{i,k} V\_{i\_2,k} [B\_{i,i\_2}^{\rm bus} \sin(\delta\_{i,k} - \delta\_{i\_2,k}) + G\_{i,i\_2}^{\rm bus} \cos(\delta\_{i,k} - \delta\_{i\_2,k})],$$

$$\forall \ i \in \mathbb{S}\_i^{\rm open}, \ k \in \mathbb{S}\_k \tag{3.42}$$

*where the flows between buses is defined as* P flow*. Using this alternative model will prevent operational Zone c to communicate information to Zone a, during the solution process. Explicitly in this case, only Zone b will communicate the flows* P flow <sup>i</sup>2,i2,k*,* P flow <sup>i</sup>2,i4,k*, and* P flow <sup>i</sup>2,i3,k*, as well as* Vi2,k *and* θi2,k *to Zone a. Note, that these considerations can be similarly applied to the reactive power flow equation* (2.16)*.*

i

**Figure 3.9:** Example showing inadequate modeling can lead to more information exchange.

In the following Remark 3.17 a possibility to prevent possible singularity of the approximated KKT matrix KKT is provided.

### **Remark 3.17:**

*If not all variables occurring in the optimization problem are included in the objective function* f(x)*, which is the case in the objective* (3.5) *this can result in a rank deficiency of the Hessian of* *the Lagrangian of the central problem* ∇<sup>2</sup> <sup>x</sup>,xL*. The same considerations are valid regarding the distributed subproblems of the OCD approach. Thus, also* ∇<sup>2</sup> <sup>x</sup>za,xzaL *and* ∇<sup>2</sup> <sup>x</sup>zb,xzb L *can be rank deficient. This entails that the approximated KKT matrix* KKT<sup>ν</sup> *could become singular for certain Newton iterations* ν*, and thus Condition 3.1 would be violated. In this case, the convergence of the OCD approach towards the central solution is not be guaranteed. To guard against singularity in this case, the Hessian of the Lagrangian is slightly modifiable to* ∇<sup>2</sup> <sup>x</sup>,xL + δI*, where* δ *represents a sufficiently small parameter and* I *the identity matrix [NW06, p. 574]. In doing so, the result of the solution is only slightly altered, while singularity of the modified Hessian of the Lagrangian* ∇<sup>2</sup> <sup>x</sup>,xL + δI *can be prevented. This measure is equivalent to extending the central objective* f(x) *to:*

$$f^{\text{new}}(x) = f(x) + f^{\delta}(x) \tag{3.43}$$

*where the newly added extension* f δ (x) *is given by* f δ (x) = δx <sup>⊤</sup>Ix*. Note, that also the new central objective* f new(x)*is intuitively decomposed into the objectives of the respective operational zones, as* f δ (x) *can be directly decomposed for the subproblems into:*

$$f^{\delta}(x) = f^{\delta, \text{za}}(x) + f^{\delta, \text{xb}}(x) = \delta x^{\text{za}} \, ^\top I x^{\text{za}} + \delta x^{\text{xb}} \, ^\top I x^{\text{xb}} \tag{3.44}$$

### **Remark 3.18:**

*OCD is known to reduce computation time for increasing problem sizes with adequate decompositions [CNP02, NPC03, GHT16]. Applied to small optimization problems OCD tends to increase the computation time [CNP02, GHT16]. This comes from the fact that OCD usually increases the amount of necessary Newton iterations due to the performed approximation of the KKT matrix by the approach. Nevertheless, the single iterations are usually performed faster with increasing reduction for rising problem sizes. This speed up results for example from the smaller sizes of the KKT matrices of the subproblems, which reduces the necessary computation time for matrix inversions or the solution of linear systems of equations [CNP02].*

**Optimality Condition Decomposition with Preconditioned Conjugate Gradient** In case Condition 3.2 is not fulfilled, a Preconditioned Conjugate Gradient Method (PCGM) [CNP02] can be applied, to alter the search direction ∆dist in a form that reduces its deviation from ∆cent. This can be achieved by modifying equation (3.39) with an appropriate preconditioner Π as stated below [Arn11]:

$$\mathbf{II}^{-1}\overline{\mathbf{K}}\overline{\mathbf{K}}\overline{\mathbf{T}}\Delta^{\text{dist,new}} = -\mathbf{II}^{-1}\nabla\mathcal{L} \tag{3.45}$$

Then (3.45) is solved approximately for every iteration of the OCD approach using a Generalized Minimal Residual (GMRES) procedure. The central challenge of this approach is to find a good preconditioner Π [CNP02]. Desired features of Π are [Arn11, CNP02]:


Thus, a straightforward choice for the preconditioner is the KKT matrix of the central optimization problem as Π = KKT [Arn11]. However, the main disadvantage of this selection is the fact, that the necessity to calculate the inversion KKT, which needs to be done by a central coordinator, will inhibit the desired benefits of the OCD approach, as distributed/parallel optimization without the need for a central coordinator. Also the calculation of KKT<sup>−</sup><sup>1</sup> will become computationally expensive for large scale problems. Thus, other generally applicable preconditioners for nonlinear optimization problems need to be found first, in order to apply this approach effectively [CNP02]. Table 3.5 summarizes the rest of the relevant properties of this approach. Also note that strictly regarded the special OCD algorithm presented here is no fully distributed approach following Definition 1.1, due to the calculations of the coordinator.

**Comparison and Selection** As stated in [MDS+17] for the EPN only case: "Further empirical work is needed to better characterize the practical performance of distributed optimization algorithms and the selection of appropriate tuning parameters for various power system optimization problems." As the optimization problem derived in this work, regarding the CEPDHN case, with partly new component models, broad empirical studies are not provided by current literature, and thus the decision for one of the given approaches is based on the methodological properties of the four approaches presented in the four previous sections. Therefore, it is assumed, that the assumptions and conditions presented with the respective approaches hold.

The basic ADMM algorithm presented in Section 3.3.2 has several disadvantages over the distributed ADMM , as defined in Section 3.3.2. These are, first, the more sequential character of the calculation, leaving out options of parallelization. Second, the central coordinator needs to calculate the updates of the Lagrange multipliers λ in every iteration, leading to additional information exchange.

Similarly OCD with PCGM has the qualitative disadvantages over OCD <sup>98</sup> to need additional calculations by the coordinator, including the inversion of a potentially large matrix, the preconditioner Π.

<sup>96</sup> Choosing Π = KKT leads to trivial calculation of ∆dist,new in (3.45).

<sup>97</sup> The term additional is used here, to distinguish between the basic role of the coordinator, as synchronizing calculations and checking the stopping criterion, as defined in Section 3.3.2.

<sup>98</sup> If OCD itself fulfills Condition 3.2.


**Table 3.5:** Properties of the OCD with PCGM algorithm.

Thus the most promising approaches for the application here are OCD and the distributed ADMM approaches. Both algorithms enable mostly parallel calculations and a very low amount of information exchange. Still, OCD has two qualitative advantages over ADMM :


Further, the necessity of the OCD approach to fulfill Condition 3.2 does not decisively need to be understood as a limitation of the approach. As a central question in the design of distributed optimal dispatch approaches is always on how the operational zones should be chosen, which is closely related to how the decomposition should be performed. This is of high relevance as it has direct impact on the convergence speed of the distributed optimization approach [GHT15]. Therefore, Condition 3.2 directly serves as an additional quantitative criterion for optimal cell dimensioning, as shown in [GHT15, GHT16].

Based on the above reasons, the OCD approach will be used in this work to implement the distributed ISOEMSs.

However, so far no literature exists, that has shown the effective application of the OCD approach to optimal dispatch problems in DHNs. Thus, a new approach is developed here with the aim of bridging that gap, to enable a decomposition of the overall optimal CEPDHNs dispatch problem.

<sup>99</sup> Thus, possibly impeding LMPAs.

### **Distributed ISOEMS Design**

In this Section the design of the distributed ISOEMS is presented. In general it is very similar to the design of the central ISOEMS. The main difference is, that the calculation of the optimal control values, based on solving the operational NLP problem (3.4), is performed in a distributed form. Note, that this is the second step during run time shown in the Nassi-Shneidermann diagram in Figure 3.7. In the distributed case, a coordinator, as introduced in Definition 3.2, will synchronize the distributed optimization, performed in parallel by the different ISOEMSs. Also the coordinator will end the distributed calculation as soon as a predefined stopping criterion is fulfilled.

As discussed in Section 3.3.2, the OCD approach is selected to perform the distributed optimization within this work. The OCD algorithm has already been used to decompose EPNs into different zones, and to divide CEPDHNs into EPNs and DHNs, which are then optimized in a parallel form, see Table 3.4. A decomposition of DHNs, has been contributed within this work [MIJSH22], and is presented in the following.

**Distributed Optimal Operation of District Heating Networks based on Optimality Condition Decomposition** The following shows how optimal operation problems for DHNs , can be solved in parallel, applying the OCD approach to the central optimization problem of an ISOEMS (3.4). Parts of this section have been published in [MIJSH22, pp. 1- 18]. Note, that (3.4) describes the NLP solved by a central ISOEMS to optimally operate an entire CEPDHN. In this Section however, the description is restricted to the case where an ISOEMS runs a DHN and thus all parts of the objective function f, the equality constraints h, or the inequality constraints g are left aside. When referring to (3.4) within this Section, only the parts of the problem which are part of a DHN optimal operation problem are meant. As will be shown in this section, applying OCD to DHNs comes along with several difficulties, which do not occur when the distributed optimization approach is used to parallelize the solution procedure of EPNs. A first difficulty is to find a form of decomposition that leaves enough degrees of freedom within the system of equations, of every subproblem. This is demonstrated in the introducing Example 3.3. Due to the strong interdependence of flows and pressure drops of the symmetric supply and return network, and due to the presence of hydraulic node and loop equations, it is non trivial to consider the main hydraulic equations, while finding a form of decomposition that leaves enough degrees of freedom. This is a central difference to applying OCD to the OPF for optimal dispatch of EPNs, where the subproblems always have sufficient degrees of freedom, see Example 3.4.

### **Example 3.3:**

*We consider the stationary hydraulic model, of the network shown in Figure 3.10, to demonstrate the challenge arising from applying OCD to DHNs. A general optimization problem* (3.46) *is assumed here, where the objective of the central problem* (3.46a) *is represented as the sum of the objectives the two subproblems* f za *and* f zb*. The equations* (3.46b) *and* (3.46b) *represent the hydraulic node and loop models which have been introduced in Chapter 2 in* (2.23) *and* (2.24)*100. Besides* f hydr *in* (3.46d) *represents the nonlinear relation between mass flow* m˙ *and differential pressure* ∆p *on an edge* e*.*

$$\min f^{\text{za}} + f^{\text{xb}} \tag{3.46a}$$

*w.r.t.*

$$\sum\_{e \in \mathbb{S}\_e^{\text{dhn}}} A\_{i,e} \dot{m}\_e \qquad = 0, \quad \forall \, i \in \mathbb{S}\_i^{\text{dhn}} \tag{3.46b}$$

$$\sum\_{e \in \mathbb{S}\_e^{\text{dhn}}} B\_{l,e} \Delta p\_e \quad = 0, \quad \forall \, l \in \mathbb{S}\_l^{\text{dhn}} \tag{3.46c}$$

$$
\Delta p\_e - f^{\text{hydr}}(\dot{m}\_e) = 0, \quad \forall \, e \in \mathbb{S}\_e^{\text{dhn}} \tag{3.46d}
$$

**Figure 3.10:** Example DHN decomposed into Zone a and Zone b.

*A straightforward form of decomposition based on OCD can be performed by decoupling between node* i<sup>2</sup> *and edge* e<sup>1</sup> *and between node* i<sup>4</sup> *and edge* e3*, as delineated in Figure 3.10. By assigning the border loop<sup>101</sup> equation of* l<sup>2</sup> *to Zone b, the complicating constraints, see Definition 3.3, of Zone b are given by:*

$$
\begin{aligned}
\overline{\dot{m}}\_1 - \dot{m}\_2 + \dot{m}\_6 \\
&\quad \qquad \qquad \qquad \qquad \qquad \qquad = 0
\end{aligned}
\tag{3.47}
$$

$$
\dot{m}\_2 - \overline{\dot{m}}\_3 - \dot{m}\_6 \tag{3.48}
$$

$$
\Delta \overline{p\_1} + \Delta p\_2 + \overline{\Delta p\_3} - \overline{\Delta p\_4} \tag{3.49}
$$

*The value of* ∆p<sup>2</sup> *is determined through equation* (3.49)*. Based on* (3.46d) *the mass flow* m˙ <sup>2</sup> *is also determined in this case, e.g. assuming that Edge* e<sup>2</sup> *represents a valve with a fixed valve flow factor* K*, and the constant component coefficient* µ<sup>2</sup> *for Edge* e<sup>2</sup> *is obtained from aggregation as described in Remark 3.19 below. Also the other variables of edge* e6*, precisely* ∆p<sup>6</sup> *and* m˙ <sup>6</sup>*, are known in this scenario through the respective equations in* (3.46)*. Thus, in* *this instance, the solution of the optimization problem of Zone b has zero degrees of freedom, and will in this case by defined by the fixed variable values* □ *obtained from Zone a. In this case, the distributed convergence properties will most likely be negatively affected as the calculations of Zone b only have a limited effect, providing the new variables* x zb *and Lagrange multipliers* λ zb *used in the soft constraints of Zone a, see* (3.37a)*. Intuitively speaking, Zone b cannot actively affect the overall search direction of both zones but provide information to Zone a, how the search direction calculated by Zone a will affect the objective of Zone b in every Newton iteration* ν*. If both zones have zero degree of freedom, see Appendix B for an example, the distributed solution of the OCD approach will definitively not equal the solution of the central problem* (3.46)*, except for the trivial case, where the problem is initialized at the optimal solution.*

*In summary, this example shows, that it is not always reasonable to apply OCD, due to a lack of degrees of freedom within the system of equations, of the equality constraints of the subproblems. However, it is still possible to do so in the aforementioned case, but either the convergence speed may reduced if one subproblem has zero degrees of freedom or the solution of the OCD approach will be identical to the initial values of the optimization variables* x0*, if both zones have zero degrees of freedom.*

### **Example 3.4:**

*In contrast to DHNs, applying the OCD approach to the optimal dispatch of EPNs cannot reduce the degrees of freedom of the subproblems to zero. This can be seen with regard to the simple meshed example EPN shown in Figure 3.11. The resulting complicating constraint for Bus* i<sup>1</sup> *in Zone a results from* (2.15) *and is given by:*

$$\begin{split} P\_{i\_1} &= \quad V\_{i\_1} V\_{i\_2} [B\_{i\_1, i\_2}^{\text{bus}} \sin(\delta\_{i\_1} - \delta\_{i\_2}) + G\_{i\_1, i\_2}^{\text{bus}} \cos(\delta\_{i\_1} - \delta\_{i\_2})] \\ &+ \, V\_{i\_1} \overline{V}\_{i\_3} [B\_{i\_1, i\_3}^{\text{bus}} \sin(\delta\_{i\_1} - \overline{\delta}\_{i\_3}) + G\_{i\_1, i\_3}^{\text{bus}} \cos(\delta\_{i\_1} - \overline{\delta}\_{i\_3})] \\ &+ \, V\_{i\_1}^2 G\_{i\_1, i\_1} \end{split} \tag{3.50}$$

*As can be seen from* (3.50) *also within the complicating constraints the bus voltage amplitude and angle, here* V<sup>i</sup><sup>1</sup> *and* δ<sup>i</sup><sup>1</sup> *of Bus* i<sup>1</sup> *remain variable, including the power flow over* e<sup>1</sup> *<sup>102</sup>. As the same applies to* V<sup>i</sup><sup>2</sup> *and* δ<sup>i</sup><sup>2</sup> *in the complicating constraint for Bus* i<sup>2</sup> *this shows, that the subproblem of Zone a also has sufficient degrees of freedom when applying the OCD approach.*

**Figure 3.11:** Example EPN decomposed into Zone a and Zone b.

The presented Examples 3.3 and 3.4 demonstrated, that applying OCD to DHNs can simply lead to a system of equations of the subproblems with insufficient degrees of freedom, while this problem does not arise, when OCD is used for distributed optimization of EPNs.

### **Remark 3.19:**

*The model equations and the therein used variables of multiple network components can be aggregated into a single network component to reduce the amount of optimization variables and the implementation burden to test new approaches for small DHNs as in Example 3.3, see also [Ill20]. For example the pressure drop over Edge* e<sup>5</sup> *between Nodes* i<sup>1</sup> *and* i<sup>3</sup> *can be written as:*

$$
\Delta p\_5 = p\_3 - p\_1 = \beta\_5 - \mu\_5 (\dot{m}\_5)^2 \tag{3.51}
$$

*where the variable component coefficients* β<sup>5</sup> *and* µ<sup>5</sup> *each represent a sum of the respective component coefficients. Thus for example* β<sup>5</sup> *can be written as the sum of the component coefficient of the valve* β vlv 5 *, the pump* β pump 5 *and the heat exchanger* β exch 5 *resulting in* β<sup>5</sup> = β vlv <sup>5</sup> +β pump <sup>5</sup> +β exch 5 *. This is based on the formulas for* β *and* µ *of different model components in Section 2.3.2. An analogous formula can be set up for* µ5*. Note, that taking into account, that the same differential pressure* ∆p<sup>5</sup> *can occur for different valve and pump set points, this degree of freedom can be used to further aggregate* (3.51) *into* ∆p<sup>5</sup> = p<sup>3</sup> − p<sup>1</sup> = β<sup>5</sup> *eliminating the degree of freedom. Note, that also the thermal component models of heat exchangers, valves, and pumps in edges* e2*,* e4*,* e5*, and* e<sup>6</sup> *can simply be aggregated, as for pumps and valves the output temperature is equivalent to the input temperature, see Section 2.3.3.*

Besides, the need to find a form of decomposition that leaves enough degrees of freedom within the subproblems, also Condition 3.2 is easily violated when OCD is applied to DHNs. This comes from the fact, that decomposing the hydraulic optimization problem (3.46) of a DHN as shown in Figure 3.10 into two similarly sized<sup>103</sup> subproblems directly results in three constraints that represent complicating constraints. Two of these arise from the hydraulic border node equations, stemming from (2.23), which are (3.47) and (3.48) in the provided Example 3.3. The third complicating constraint originates from the border loop equation, coming from (2.24) which is (3.49) in the given Example 3.3. Note, that three complicating constraints of this form also arise if one of the other three possible forms of decomposition is used, see Appendix B.

These special constraints comprehend variables coming from a different subproblem, which are thus treated as parameters during the Netwon iterations of the respective subproblem, see Definition 3.3. If the central optimization problem is extended to a thermal model, as within this application, an additional complicating constraint stems from the thermal node equation (2.47)<sup>104</sup>. In general it is known, that a stronger coupling of the subproblems, which is increased by every complicating constraint, leads to higher values of ρ ocd,∗ [Arn11], see the paragraph on OCD in Section 3.3.2. Thus, the more complicating constraints exist, the more likely it is,

<sup>103</sup> Note, that a similar size of the subproblems is a desired property as this increases the probability, that both subproblems need a similar calculation time for every Newton iteration ν.

<sup>104</sup> Based on the model presented in Chapter 2 the pipeline model equation (2.66) would also have to be taken into account as a complicating constraint. However, this can either be prevented by using the elimination of variables technique [NW06, p. 426] or through Assumption 3.10, which enables to replace the thermal pipeline model by an identity function mapping the input temperature to the output temperature.

that Condition 3.2 is not met. In contrast to DHNs, applying OCD to EPNs only leads to a single complicating constraint for every border node.

Also Example 3.3 does not enable a symmetric form of decomposition, which can be advantageous as described above, see Remark 3.15. This example shows, that the characteristics of DHNs, including symmetric return and supply networks, need caution while applying the OCD approach in order to enable a symmetric solution, enough degrees of freedom and a low form of coupling between the subproblems.

The approach presented here, to overcome these challenges is based on three key aspects, which are outlined here and presented in detail below:


In summary these three measures enable to decompose the new central optimization problem in a symmetrical form while fulfilling Condition 3.2, as it will be demonstrated in Section 4.5.

An exact description of the three aspects is given in the following, starting with the equivalent reformulation of the optimization problem (3.4) solved by a central ISOEMS as described in Section 3.3.1. Therefore, in the following all necessary changes performed, leading to modeling deviations from the central problem (3.4) are stated. To ease the understanding, these model changes and there outplay are described by using the simple DHN shown in Figure 4.22. This DHN is very similar to the one shown in Example 3.3, also taking into account the aggregated model description discussed in Remark 3.19. In order to reduce the coupling of the resulting subproblems two measures are performed: First, the hydraulic differential pressures ∆p<sup>e</sup> over edges e are replace by pressure potentials p<sup>i</sup> at network nodes i by using (2.22). Note, that this relation can be given for the entire DHN as −A dhn⊤ p = ∆p [MCS20]. Inserting this into (2.24), written as B∆p = 0 for the total network, leads to −B(A dhn⊤ p) = 0 [Des69]. As BAdhn<sup>⊤</sup> = 0 in all cases, the hydraulic loop equation (2.24) can be neglected in the following. Additionally, the hydraulic node equations (2.23) of the border nodes in the return network, i<sup>3</sup> and i<sup>4</sup> in Figure 4.22, are omitted. This measure strongly reduces the coupling of the subproblems, as two complicating constraints of the form (3.54) introduced and explained later on, are eliminated. However, by neglecting the hydraulic loop equations and the hydraulic border nodes of the return networks the model becomes incomplete, as the relation between mass flows and differential pressure of supply and return network on the border edges is no more incorporated in the model. This gap is bridged by explicitly introducing the equality ∆p<sup>1</sup> = ∆p<sup>3</sup> for Example 3.3 which can be notated as p<sup>1</sup> − p<sup>2</sup> = p<sup>4</sup> − p<sup>3</sup> or sorted by zones as p<sup>1</sup> + p<sup>3</sup> = p<sup>4</sup> + p<sup>2</sup> into the model. Note, that this also implies m˙ <sup>1</sup> = ˙m3, based on (2.34). In general this can be notated as:

$$= \left( \sum\_{e \in \mathbb{S}\_e^{\text{dh}, \text{an}}, e \notin \mathbb{S}\_e^{\text{dh}, \text{bn}, \text{an}}} \sum\_{i \in \mathbb{S}\_i^{\text{dh}, \text{nb}, \text{an}}} |B\_{l,e}||A\_{i,e}^{\text{dh}\mathbf{n}} |p\_{i,k}\right)$$

$$= \left( \sum\_{e \in \mathbb{S}\_e^{\text{dh}, \text{nb}}, e \notin \mathbb{S}\_e^{\text{dh}, \text{bn}, \text{ab}}} \sum\_{i \in \mathbb{S}\_i^{\text{dh}, \text{nb}, \text{ab}}} |B\_{l,e}||A\_{i,e}^{\text{dh}\mathbf{n}} |p\_{i,k}\right),$$

$$\forall \ l \in \mathbb{S}\_l^{\text{dh}, \text{bl}}, k \in \mathbb{S}\_k \tag{3.52}$$

where the border loops are given in S dhn,bl l and the border edges of Zone a S dhn,be,za e represent a subset of the edges of Zone a given in S dhn,za e , and the same notation is used for edges of Zone b equivalently. If more then four nodes are found in the regarded border loop l, the relevant border nodes are found through |Bl,e||Adhn i,e | = 1 by checking this condition for all border nodes i ∈ S dhn,bi i and edges e which are no border edges<sup>105</sup> e ∈ S dhn e , e /∈ S dhn,be <sup>e</sup> of the respective zone<sup>106</sup> .

Based on the aforementioned, the second key aspect of the approach, a different form of decomposing the central problem, is introduced. This means, the decomposition is applied over edges/pipelines and thus between two nodes, as shown in Figure 4.22, instead of decomposing between network components as performed in Example 3.3.

The third key aspect represents the extension of the optimization problem (3.4), by replacing the equality constraint (3.52), obtained from the model reformulation, by two new ones. This extension is used to enable a symmetrical form of decomposition in the following. Applying OCD to (3.46) incorporating the suggested changes stated above, the complicating constraint arising from equation (3.52) is assigned either to Zone a or Zone b, thus leading to an unsymmetrical decomposition. Also, representing the exact same equation (3.52) twice in the central problem would lead to an undesired rank deficiency of the KKT matrix. This can be overcome by replacing (3.52) through the following two equations:

$$\begin{pmatrix} \sum\_{e \in \mathbb{S}\_{\epsilon}^{\text{dh,n,m}}, e \notin \mathbb{S}\_{\epsilon}^{\text{dh,n,b,m}}} \sum\_{i \in \mathbb{S}\_{i}^{\text{dh,n,b}}} |B\_{l,e}| |A\_{i,e}^{\text{dh}\text{h}}| p\_{i,k} \end{pmatrix} = p^{\text{pre}},$$

$$\left( \sum\_{e \in \mathbb{S}\_{\epsilon}^{\text{dh,n,b}}, e \notin \mathbb{S}\_{\epsilon}^{\text{dh,n,b,m}}} \sum\_{i \in \mathbb{S}\_{i}^{\text{dh,n,b,m}}} |B\_{l,e}| |A\_{i,e}^{\text{dh}\text{h}}| p\_{i,k} \right) = p^{\text{pre}},$$

$$\forall l \in \mathbb{S}\_{l}^{\text{dh,n,b}}, k \in \mathbb{S}\_{k} \quad \text{(3.53)}$$

A comparison of these equations (3.53) with the initial form (3.52) shows that thereby the pressure potentials p<sup>i</sup> of the nodes in the bordering zone have been replaced by the constant

<sup>105</sup> All border edges are given in e ∈ S dhn,be <sup>e</sup> .

<sup>106</sup> Note, that e.g. the left side of (3.52) can be simplified to P i∈S dhn,bi,za i pi,k if only one point of coupling/border edge (in the return and supply network) to another zone, exists as in Example 3.3.

predefined pressure value p pre. As p pre is equal in both equations of (3.53), every solution fulfilling (3.53), will also satisfy equation (3.52), as (3.53) is a special case of (3.52). The benefits of this new formulation are that the two equations in (3.53) are naturally assigned to their respective zones, without creating further complicating constraints and thus reducing the coupling of the subproblems. Additionally, this procedure yields symmetrically decomposed subproblems. A further form which can be used to explain the derivation of (3.53) is given in the Appendix in Section C. Besides, the directions of the border edges are slightly varied as explained in the following remark.

### **Remark 3.20:**

*The decomposition only becomes fully symmetrical in the resulting border node equations* (3.54)*,* (3.59)*,* (3.62)*, and* (3.64) *outlayed below, by changing the edge directions of the border edges. As shown in Figure 4.22, edge* e<sup>1</sup> *is directed away from node* i<sup>1</sup> *and* i2*, leading to* Adhn <sup>i</sup>1,e<sup>1</sup> = −1 *and* Adhn <sup>i</sup>2,e<sup>1</sup> = −1*. Analogously,* e<sup>3</sup> *is directed towards* i<sup>3</sup> *and* i4*. Visually speaking, every zone calculates its solution with its own border edge directions, where the supply network border edge is directed away from the border node of the respective zone and the return network edge is directed to the proper border node of this zone. This is a deviation from the standard notation of the directed graph spanning up the DHN, where every edge is directed away from the start node and towards the end node. Still, the resulting system of equations is equivalent, as the differential pressure over the border edges* ∆p<sup>e</sup> *is defined using absolute values of* Adhn i,e *, see* (3.56)*.*

The following paragraphs now first introduce and discuss used assumptions, before the complicating constraints and the objective of the OCD approach are explicitly stated one after the other.

The presented approach is based on the following assumptions, used for simplicity reasons:

**Assumption 3.9.** *Pipelines with VMFDs are the only component types for which edges can become border edges. These pipelines are not part of a mesh in the return or supply network. Also, no control paths reach across zone borders.*

These assumptions limit the necessity to list possibly resulting complicating constraints for different component types. For example pumps, that can be operated in both flow directions, would also represent appropriate component models for a decomposition based on the pump models, presented in Section 2.3<sup>107</sup>. Besides, pipelines are the most common components in DHNs, thus the limitations in finding possible decompositions for this assumption are manageable. And as discussed after the upcoming assumption, the edges over which the approach decomposes the DHN can also be virtual pipelines.

**Assumption 3.10.** *The pipelines, representing the border edges, are regarded as negligibly short, and thus transmission delay, temperature losses, and pressure potential differences due to height differences* ∆h *are neglected here, as* ∆h = 0 *is assumed.*

<sup>107</sup> Note, that this would imply that a pump is installed in the return and the supply network accordingly.

If this assumption would lead to unwanted deviations, due to a non negligible length of the pipeline, two artificial nodes and pipelines, one in the return and one in the supply network, could be introduced into the model in one of the zones at the end of the current border edge. Then, all parameters of the old border edge pipelines are kept the same, and the newly inserted pipelines, which are set as the new border edges, have the same parameters except the pipeline length L which is chosen as negligently short.

For simplicity and without loss of generality the approach is presented for the case of two zones here. Further, for notational brevity only the optimization problem of Zone a is fully stated, while the NLP of Zone b is directly evolvable thereof. All equations except the ones replaced above, the complicating constraints and the new objectives stated here, stay the same as given in (3.4) for every area.

The new hydraulic node equation, replacing (2.23) for supply network border nodes in Zone a, is given as108:

$$h\_{i,k}^{\text{dhn},\text{hydr},\text{sn},\text{bi},\text{za}} = \sum\_{e \in \mathbb{S}\_e^{\text{dhn}}, e \notin \mathbb{S}\_e^{\text{dhn}}} A\_{i,e}^{\text{dhn}} \dot{m}\_{e,k} + \sum\_{e \in \mathbb{S}\_e^{\text{dhn},\text{ba}}} A\_{i,e}^{\text{dhn}} \dot{m}\_{e,k} = 0,$$

$$\forall \ i \in \mathbb{S}\_i^{\text{dhn},\text{sn},\text{bi},\text{za}}, k \in \mathbb{S}\_k \tag{3.54}$$

The main difference here to (2.23) is that border edges e ∈ S dhn,be e and "normal" edges e ∈ S dhn e , e /∈ S dhn,be e are distinguished. Border edge mass flows can then be expressed in dependence of pressure potentials p as stated below. Thereby, taking into account Assumption 3.10, which entails ∆h = 0 and thus βe,k = 0 in equation (2.34):

$$\begin{split} \dot{m}\_{e,k} &\approx \text{sgn}\_{\Delta\varepsilon}(\Delta p\_{e,k}) \sqrt{\frac{|\Delta p\_{e,k}|\_{\Delta\varepsilon}}{\mu\_{e,k}(\dot{m}\_{e,k})}} \\ &= \frac{1}{\sqrt{\mu\_{e,k}(\dot{m}\_{e,k})}} \frac{\Delta p\_{e,k}}{\sqrt{|\Delta p\_{e,k}|\_{\Delta\varepsilon}}}, \qquad \forall \, e \in \mathbb{S}\_{e}^{\text{dhn},be,za}, k \in \mathbb{S}\_{k} \end{split} \tag{3.55}$$

The dependency of the pressure coefficient on the border edge mass flow µe,k( ˙me,k) is eliminated by utilizing a precalculated pressure coefficient µ pre e,k , based on the border edge mass flow of the previous optimization, thus using a similar procedure as effectively applied for the thermal pipeline model, recalculating model parameters when applying the rolling horizon, see Step 6 of Figure 3.7. Further, the differential pressure ∆pe,k over the considered border edge e can be replaced by the difference of the pressure potential of the two connected border nodes i, from which one is in Zone a and the other in Zone b. Thus, the differential pressure over the border edge connected to a border node i of Zone a can be written as:

$$\Delta p\_{e,k} = \sum\_{i \in \mathbb{S}\_i^{\text{dhn},\text{bi},\text{za}}} \left( |A\_{i,e}^{\text{dhn}}| p\_{i,k} - \sum\_{i' \neq i, i' \in \mathbb{S}\_i^{\text{dhn}}} |A\_{i',e}^{\text{dhn}}| \overline{p\_{i',k}} \right),$$

$$\forall \, e \in \mathbb{S}\_e^{\text{dhn},\text{be},\text{za}}, k \in \mathbb{S}\_k \tag{3.56}$$

<sup>108</sup> The extensive superscripts of h stand for: district heating network, hydraulic, supply network, border node, and Zone a.

By inserting (3.56) in (3.55) and exchanging the variable µe,k( ˙me,k) by the parameter µ pre e,k , the mass flow on the border edge e itself is given as:

$$\dot{m}\_{e,k} \approx \frac{1}{\sqrt{\mu\_{e,k}^{\text{pre}}}} \frac{\sum\_{i \in \mathbb{S}\_{i}^{\text{dh},\text{bi},\text{an}}} \left( |A\_{i,e}^{\text{dh}}| p\_{i,k} - \sum\_{i' \neq i, i' \in \mathbb{S}\_{i}^{\text{dh}}} |A\_{i',e}^{\text{dh}}| \overline{p\_{i',k}} \right)}{\sqrt{\left| \sum\_{i \in \mathbb{S}\_{i}^{\text{dh},\text{bi},\text{an}}} \left( |A\_{i,e}^{\text{dh}}| p\_{i,k} - \sum\_{i' \neq i, i' \in \mathbb{S}\_{i}^{\text{dh}}} |A\_{i',e}^{\text{dh}}| \overline{p\_{i',k}} \right) \right|\_{\Delta\_{\mathcal{E}}}},$$
 
$$\forall e \in \mathbb{S}\_{e}^{\text{dh},\text{be,za}}, k \in \mathbb{S}\_{k} \tag{3.57}$$

Exemplary, for the network shown in Figure 4.22, equation (3.56) is given by ∆pe1,k = pi1,k − pi2,k for Edge e<sup>1</sup> in Zone a. Based on this, the border edge mass flow m˙ <sup>e</sup>1,k for Zone a stemming from equation (3.57) results in:

$$\dot{m}\_{e\_1,k} \approx \frac{1}{\sqrt{\mu\_{e\_1,k}^{\rm pre}}} \frac{p\_{i\_1,k} - p\_{i\_2,k}}{\sqrt{|p\_{i\_1,k} - p\_{i\_2,k}|}\_{\Delta \varepsilon}}, \quad \forall \ k \in \mathbb{S}\_k \tag{3.58}$$

The thermal node equation, replacing (2.47) for border nodes, is formulated as follows:

h dhn,therm,bi,za i,k = <sup>X</sup> e∈S dhn,za <sup>e</sup> ,e /∈S dhn,za,be e A dhn,− i,e max m˙ e,k, 0 + X e∈S dhn,za <sup>e</sup> ,e /∈S dhn,za,be e A dhn,+ i,e max − m˙ e,k, 0 + X e∈S dhn,za,be e A dhn,− i,e max m˙ e,k, 0 + X e∈S dhn,za,be e A dhn,+ i,e max − m˙ e,k, 0 Ti,k − <sup>X</sup> e∈S dhn,za <sup>e</sup> ,e /∈S dhn,za,be e A dhn,+ i,e max m˙ e,k, 0 T out e,k + X e∈S dhn,za <sup>e</sup> ,e /∈S dhn,za,be e A dhn,− i,e max − m˙ e,k, 0 T in e,k + X e∈S dhn,za,be e <sup>A</sup> dhn,+ i,e max m˙ e,k, 0 + A dhn,− i,e max − m˙ e,k, 0 X i ′̸=i,i′∈S dhn i |A dhn i,e ||A dhn i ′ ,e |T<sup>i</sup> ′ ,k = 0, ∀ i ∈ S dhn,bi,za i , k ∈ S<sup>k</sup> (3.59)

Note, that similarly as in (3.54) the border mass flows are also defined by (3.57) in (3.59) above. With Assumption 3.10, supposing negligibly short pipelines between zones, the thermal pipeline model reduces to an identity function mapping the input temperature to the output temperature, here Ti,k = T<sup>i</sup> ′ ,k <sup>109</sup>. For Node i<sup>1</sup> in Zone a in the DHN in Figure 4.22 equation (3.59) is written as:

$$\begin{aligned} & \left[ \max \left( \dot{m}\_{e\_1,k}, 0 \right) + \max \left( \dot{m}\_{e\_4,k}, 0 \right) + \max \left( -\dot{m}\_{e\_5,k}, 0 \right) \right] T\_{i\_1,k} \\ & - \left[ \max \left( -\dot{m}\_{e\_4,k}, 0 \right) T\_{e\_4,k}^{\text{in}} + \max \left( \dot{m}\_{e\_5,k}, 0 \right) T\_{e\_5,k}^{\text{out}} + \max \left( -\dot{m}\_{e\_1,k}, 0 \right) \overline{T\_{i\_2,k}} \right] = 0, \\ & \forall \ k \in \mathbb{S}\_k \end{aligned} \tag{3.60}$$

The resulting objective function for Zone a f dhn,za, is defined as given below:

$$\begin{split} f^{\text{dhn,za}} &= f^{\text{dhn,rest,za}} + \sum\_{k \in \mathbb{S}\_k} \left[ \sum\_{i \in \mathbb{S}\_i^{\text{dhn,sun,bi,z}}} \left( \lambda\_{i,k}^{\text{dhn,yd,s,ni,zb}} h\_{i,k}^{\text{obj,dln,zb,zb,zb}} h\_{i,k}^{\text{obj,dln,zb,zb,zb}} \right) \right] \\ &+ \sum\_{i \in \mathbb{S}\_i^{\text{dhn,bi,zb}}} \left( \lambda\_{i,k}^{\text{dhn,other,bi,zb}} h\_{i,k}^{\text{obj,dln,other,bi,zb}} \right) \end{split} \tag{3.61}$$

This objective function f dhn,za is composed of two parts. The first describes the decomposed objective of a central ISOEMS f(x) explained in Remark 3.17, which is defined here as f dhn,rest,za for Zone a. Note, that applying the approach described in Remark 3.17 helps to guard against singularity of the approximated KKT matrix KKT, while simultaneously pursuing the general objective of an ISOEMS, as stated in Section 3.3.1. The second part is constituted by the sum of the products of the Lagrange multipliers λ and the complicating constraints h coming from Zone b. As indicated by the superscripts the Lagrange multipliers come from Zone b of the last OCD iteration from the complicating constraints h dhn,hydr,sn,bi,zb i,k and h dhn,therm,bi,zb i,k of the respective border nodes. The complicating constraints itself are utilized in the slight modified form given below in (3.62) - (3.64) with the additional obj superscript. In comparison to (3.55), (3.57), and (3.59) all variables become OCD parameters and vice versa. Also all sets which have been based on Zone a now become dependent on Zone b and the other way around. This leads to the following definitions:

$$h\_{i,k}^{\text{obj, dhn, hydr, sn, bi, zb}} = \sum\_{e \in \mathbb{S}\_e^{\text{dhn}}, e \notin \mathbb{S}\_e^{\text{dhn, ba}}} A\_{i,e}^{\text{dhn}} \overline{m}\_{e,k} + \sum\_{e \in \mathbb{S}\_e^{\text{dhn, ba}}} A\_{i,e}^{\text{dhn}} \dot{m}\_{e,k} = 0,$$

$$\forall \ i \in \mathbb{S}\_i^{\text{dhn, sn, bi, z}}, k \in \mathbb{S}\_k \tag{3.62}$$

<sup>109</sup> However, in theory more detailed models as e.g. a static pipeline model similar to (2.71) or a symmetric dynamic thermal pipeline model could also be considered in the thermal node equation (3.59).

where the border edge mass flow is defined similarly as in (3.57) by:

$$\dot{m}\_{e,k} \approx \frac{1}{\sqrt{\mu\_{e,k}^{\text{pre}}}} \frac{\sum\_{i \in \mathbb{S}\_i^{\text{dh},\text{bi},\text{nb}}} \left( |A\_{i,e}^{\text{dh}}| \overline{p}\_{i,k} - \sum\_{i' \neq i \in \mathbb{S}\_i^{\text{dh}}} |A\_{i',e}^{\text{dh}}| p\_{i',k} \right)}{\sqrt{\left| \sum\_{i \in \mathbb{S}\_i^{\text{dh},\text{bi},\text{nb}}} \left( |A\_{i,e}^{\text{dh}}| \overline{p}\_{i,k} - \sum\_{i' \neq i \in \mathbb{S}\_i^{\text{dh}}} |A\_{i',e}^{\text{dh}}| p\_{i',k} \right) \right|\_{\Delta\_{\mathcal{E}}}},$$
 
$$\forall \ e \in \mathbb{S}\_e^{\text{dh},\text{be},\text{xb}}, k \in \mathbb{S}\_k \tag{3.63}$$

The thermal node equation is formulated as follows for border nodes:

$$\begin{split} & \int\_{c}^{\text{h-b}} \sum\_{e \in \mathbb{S}^{\text{h-m},e}, e \in \mathbb{S}^{\text{h-m},e,\text{h-b}}} A\_{i,e}^{\text{h-n}} - \max\left(\overline{m}\_{e,k}, 0\right) \\ & + \sum\_{e \in \mathbb{S}^{\text{h-m},e}, e \in \mathbb{S}^{\text{sh-m},e,\text{h-b}}} A\_{i,e}^{\text{h-n}} + \max\left(-\overline{m}\_{e,k}, 0\right) \\ & + \sum\_{e \in \mathbb{S}^{\text{h-m},e,\text{h-b}}} A\_{i,e}^{\text{h-n}} - \max\left(\bar{m}\_{e,k}, 0\right) \\ & + \sum\_{e \in \mathbb{S}^{\text{h-m},\text{h-b}}} A\_{i,e}^{\text{h-n}} - \max\left(\bar{m}\_{e,k}, 0\right) \Big| \overline{T}\_{i,k} \\ & - \left[ \sum\_{e \in \mathbb{S}^{\text{h-m},k}, e \in \mathbb{S}^{\text{sh-m},e,\text{h-b}}} A\_{i,e}^{\text{h-n}} + \max\left(\overline{m}\_{e,k}, 0\right) \overline{T}\_{e,k}^{\text{v}} \right. \\ & + \left. + \sum\_{e \in \mathbb{S}^{\text{h-m},k}, e \notin \mathbb{S}^{\text{sh-m},\text{h-b}}} A\_{i,e}^{\text{h-n}} - \max\left(-\overline{m}\_{e,k}, 0\right) \overline{T}\_{e,k}^{\text{h}} \right. \\ & + \sum\_{e \in \mathbb{S}^{\text{sh-m},k}, e \notin \mathbb{S}^{\text{sh-m},\text{h-b}}} \left( \left( A\_{i,e$$

Note, that therein the border mass flows are defined by (3.63).

In summary, the approach is fully outlined. Simulational results will show the limited range of applicability of the presented methodology in Section 4.5.

# **3.4 Summary and Discussion**

The design of a new TCS for CEPDHNs was presented within this chapter. This system is based on the coordinated interaction of multiple EMSSAs, each bidding for a single FNP, and the ISOEMSs, coordinating the FNPs within their operational zone. For this system, relevant market and control mechanisms which are at the core of the TCS have been outlaid and discussed in this chapter. The used control mechanism is a distributed rolling horizon approach, where the distributed optimization problems are to be solved in every time step based on the OCD algorithm. The model-based control approach uses the contributed CEPDHN model presented in Chapter 2. The social welfare is used as the allocation objective for electricity and heat markets, which are cleared in a coordinated form by the TCS, thereby maximizing the welfare of the overall system. Market clearing prices are determined by the HPA, which combines the uniform marginal price obtained from dispatch<sup>110</sup> with paid-as-bid and pay-as-bid for a fraction of the bids. The exact procedure taking place during transactive control of the regarded CEPDHNs is provided in Figure 3.7 for the central case with one ISOEMS. In the case of multiple distributed ISOEMSs, the second step is solved by the OCD approach in a distributed parallelized form. The TCS is designed to achieve welfare maximization, technical efficiency and secure<sup>8</sup> CEPDHN operation and forms Contribution 1 of this work.

In this context, it was shown how important it is to design market and control mechanisms in a joint manner, due to their strong interdependence. These interrelations of the mechanisms can on the one side limit the applicability of certain approaches, and on the other side increase the performance of the TCS if adequately employed. Examples for limiting aspects in the mechanism designs are the disadvantages arising from the use of the LMPA and ADMM in a joint form, or the fact that the LMPA brings along two different LMPs for every FNP in the DHN models used within the rolling horizon approach. These show, that designing market and control mechanisms independently can have serious consequences, as for example imprecise<sup>111</sup> LMPs or slow convergence [GHT17]. This would entail the inability of the TCS to calculate new control values in real time. For credit postings, the interconnected design of market and control mechanisms greatly play out within the ISOEMSs design. For that matter, the bids are provided for the entire prediction horizon, and merged with further data as e.g. predictions on power supply and demand. Additionally, network models and operational constraints of the CEPDHNs are applied within a (distributed) rolling horizon control approach to maximize the welfare of all FNPs. In this sense, allocation and control value determination becomes a single procedure. Also, the simultaneous market clearing of the heat and electric energy markets by the distributed controllers, the ISOEMSs, enables to enhance the overall welfare. Besides, the coordinated design of market and control mechanisms even goes down to far more technical aspects. For example, the definition of optimal operation points of pumps and valves has a direct impact on the social welfare. In this regard, it is very important to mention, that the current literature on comparable approaches usually uses strongly simplified network models, as stated in the Research Gap 1 a) and b) in Section 1.2.5. However, when using a model-based control approach, it is clear that modeling decisions will directly impact the control values and thereby the market outcome. For example predefining the flow direction in the edges of

<sup>110</sup> Defined, as the intersection of the dispatched consumer and producer bid and offer curves.

<sup>111</sup> The lack of accuracy of the LMPs originates from the need of additional iterations, which are very time consuming, while the primal variables are already at or near to the exact values in this case, see Table 3.3 and [GHT17].

a DHN model will have a large impact on the obtainable welfare. Similarly, neglecting the possibilities of pipeline storage or TESS application will directly impact the obtained welfare. Besides the aforementioned, salient technical features of the proposed approach are that the rolling horizon approach will always try to minimize temperatures in the DHNs as fast, and as far as possible in order to minimize losses and thus maximize the welfare. The collection of these examples shows the importance of the joint design of market and control mechanisms for CEPDHNs.

However, achieving welfare maximization, technical efficiency and secure<sup>8</sup> CEPDHN operation does not only rely on the joint design of market and control mechanisms. Two further aspects need to be taken into account here. The first is the fact that the coordinated operation of EPNs and DHNs or MES in general leads to a better overall system performance regarding technical and economic indexes [ZWW+21, WYJ+16, LSF14, DLS+19]. The second aspect is the ability of the presented TCS to merge all possible information on future power supply and demand as well as the respective bid and offer prices, in order to predictively optimally dispatch all FNPs connected to the CEPDHNs.

To the best of the authors knowledge for the distributed rolling horizon approach used in this work, which could be classified as a *nonlinear distributed economic time-variant hybrid discrete model predictive control approach* with varying amount of system states, see Section 3.3 no methodological concept for the proof of Lyapunov or bounded input bounded output stability of the closed-loop case is provided in the literature so far. However, these forms of stability are not perused by transactive control approaches in real-world applications. Much more, desired system behavior is understood as fulfilling operational constraints in order to enable trade, meeting contract commitments of power supply, without causing system damage or unnecessary fatigue.

Note that, the presented TCS enables privacy [KW16] preserving information sharing to the FNPs, as only the bids and offers are communicated to the ISOEMS and no further information<sup>112</sup> needs to be shared, see [LLJZ20], [KW16]. Further, considering information sharing, the following should be noted. In Germany, today the DSO by itself, operates the electric power, gas, water, and district heating systems. For jurisdictions, where there are multiple entities responsible for utility services of electricity and heat, there has to be information sharing agreements between the entities in order to implement the proposed TCS. This will require some coordination and policy formation at the regulatory/municipal governmental levels.

The developed HPA used in the TCS prevents uplift costs due to redispatch. Basing the pricing procedure on uniform marginal pricing achieves incentive compatibly if no FNP can take advantage of its market power and if no network constraint limits the solution set. The later necessitates to price some bids and offers by pay-as-bid or paid-as-bid analogously, as described in Section 3.2.3. This leads to a reduction of the overall system welfare. Still, the optimizer inherently minimizes the additional costs arising within the HPA, in order to maximize the social welfare. This is a central advantage of the HPA in comparison with a standard uniform marginal pricing approach, as the only theoretical limitation of possible uplift costs within the UMPA arises from the amount and size of the bids and offers provided. Besides these aspects, avoiding the necessary command and control actions, to organize the redispatch, arising from

<sup>112</sup> As for example room temperatures, SOCs of battery storages in electrical vehicles or available devices.

a UMPA [MSC03] enhances the security of the network operation, as unforeseen complicated operation conditions are less likely.

The TCS can enable scalability in large scale CEPDHNs through the utilization of the OCD approach, which is reported to reduce calculation times of central optimization problems effectively for EPNs [NPC03]. Hence, enabling parallel computation of smaller subproblems of the large scale nonlinear central operational optimization problem (3.4), as it can be decomposed into subproblems between tie lines of the EPN. Thereby, the conditions stated with the OCD approach always need to be fulfilled. This especially applies for the coupling condition. As simulation results provided in Section 4.5 will show, so far the contributed OCD approach for DHNs does not enable to decompose the overall CEPDHN network graph within DHNs. Earlier relevant work in this field using OCD for electricity and gas networks is provided in [Arn11]. However, therein the design of appropriate market mechanisms were not regarded.

The overall operational optimization problem (3.4) which is solved by the central ISOEMS or the distributed ISOEMSs in the TCS is a nonlinear non-convex optimization problem. Thus, convergence properties can only be evaluated through simulations, as performed in the following Chapter 4. Still, nonlinear non-convex models and thus optimization problems are used in relevant real world applications, due to the absence of reasonable alternatives, as for example in the OPF problem [MDS+17] which is strongly related to (3.4).

Note, that within this chapter it is depicted how the combination of Contributions 2, and 3 jointly bring up the main Contribution 1 of this work, the TCS for CEPDHNs, see Figure 1.2. This is achieved, by outlaying the integration of the detailed CEPDHN model, Contribution 2, into the TCS. Further, the HPA for simultaneous market clearing of interconnected DHN and EPN markets is described, representing Contribution 3 of this work. Additionally, an approach for the distributed optimal dispatch of DHNs, constituting Contribution 4 was developed.

# **4 Results**

Simulation results from five CEPDHNs are presented and discussed within this section to show and evaluate different functionalities, properties, advantages and limitations of the TCS designed in Chapter 3. The main topics elaborated in the following case studies and sections are ordered in the same form as the approaches are introduced in Chapter 3. Therefore, Case Study I will discuss the hybrid pricing approach, Case Study II presents the implementation of a centralized ISOEMS, Case Study III highlights DHN operation with VMFDs and thermal energy storage systems, Case Study IV investigates calculation times in large real world CEPDHNs, and finally Case Study V demonstrates the application of the distributed DHN optimization based on OCD. Parts of this chapter have been published in [MGR+21], [MTK+22], and [MIJSH22].

# **4.1 Case Study I: Hybrid Pricing Approach**

The application of the HPA is demonstrated within this case study. After a description of the regarded CEPDHN and the bids and offers of the FNPs, the results are presented. Note, that parts of this Case Study have been initially presented in [MGR+21, pp. 9-11].

### **4.1.1 Description**

To validate the approach, a version of the case study of the Barry Island from [Liu13, LWJB16] is implemented, as displayed in Figure 4.1. Parameters not stated here are given in [Liu13]. The used network model consists of 32 DHN nodes and eight EPN buses at 11.5 kV. For simplicity and without loss of generality, the underlying radial 0.433 kV power networks are neglected and their loads are aggregated into the flexible loads at the Buses I, III, IV, V, and VI. Also, a stationary heat propagation model within the pipelines is used. Further, a single time step is optimized, see [MGR+21] for the exact used model. None of the simplifications listed above change the functionality of the approach; much more this helps to ease understanding. Bus II of the EPN is modeled as the reference bus with fixed voltage angle and magnitude. The reactive power consumption of all consumers is modeled by a typical value of cos(φ) = 0.95. The impedance values of the transmission lines are scaled up in order to show the integration of the transmission losses. The bids and offer of all FNPs are listed in Table 4.1. Further, this Table also displays the nodes and buses to which an FNP is connected. Hereby, it has to be noted, that the cardinality of the network participants is kept low, for simplicity reasons. Still, it is assumed that no market participant is able to take advantage of his market power. Prices are defined as general monetary units, as they vary strongly in time and different regions depending on developments as regulations, renewable energy sources, fuel prices and CO2 certificate prices [Kel13].

The COP of the CHP and the HP are modeled with 1.3 and 3.5, see (2.17)<sup>113</sup>, as in [Liu13]. It is assumed that no MP takes advantage of his potential market power.

The resulting network topology is displayed in Figure 4.1.

**Figure 4.1:** Modified Barry Island case study [LWJB16]<sup>114</sup> .

Typical voltage magnitude limits of V min = 0.9 p.u. and V max = 1.1 p.u. are used. The apparent power flows are limited by S min = 0 p.u. and S max = √ 5S base with S base = 1 kVA, as given in [MGR+21]. The reactive power limits Qmin <sup>n</sup> = −50 p.u. and Qmax <sup>n</sup> = 50 p.u. are set for the producers. The node temperature limits are defined by T min <sup>i</sup> = 40 °C and T max <sup>i</sup> = 60 °C. Additionally, the consumer and producer mass flow limits are set to m˙ min = 0 kg/s and m˙ max = 5 kg/s. The output temperatures of all heat consumers are assumed to be T out = 30 °C, following typical connecting conditions for 4th generation DHNs to assure low losses [LSG+17]. For simplicity reasons, the return network is assumed to be lossless due to the low temperature gap of 5 °C between the ambient temperature T <sup>a</sup> = 25 °C and the output

<sup>113</sup> For the CHP /HP the exact values are <sup>a</sup>nepn,ndhn,<sup>1</sup> = 1.3/anepn,ndhn,<sup>1</sup> = 3.<sup>5</sup> and <sup>a</sup>nepn,ndhn,m = 0 for all m ̸= 1.

<sup>114</sup> Credit for this Figure goes to Armin Golla.


**Table 4.1:** Relevant parameters of all used network participants. The bid and offer costs are stated in general cost units ¤ per unit produced or consumed.

temperature of the consumers. The parameter for the approximation of the maximum and absolute value function (2.20) is set to ∆ε = 1e − 5. The marginal costs of the losses in both networks are determined by the UMP , as explained in Remark 3.5. The respective values are c loss,epn = 2.2 ¤/p.u. and c loss,dhn = 3 ¤/p.u., see Figure 4.2 and Figure 4.3.

The case study is implemented in GAMS using the IPOPT solver [NW06]. Thereby, an interiorpoint method is used to solve the resulting nonlinear programming problem. The solution is calculated in 1.49 s with an Intel i7-6600U CPU @ 2.60 GHz.

### **4.1.2 Results and Analysis**

The aim of this case study is to present the functionality of the approach. The main results are found in Figure 4.2 and Figure 4.3. The submitted and dispatched offers and bids of the producers and consumers are sorted by merit order and separated for the EPN and the DHN. As mentioned in earlier in Remark 3.6, this enables to determine the UMPDs of both networks separately, as they represent two different price zones, which is helpful when the price levels in the different networks deviate strongly. In the depicted scenario, the UMPD in the EPN is c umpd,epn = 1.9 ¤/p.u. while the UMPD in the DHN reaches c umpd,dhn = 3 ¤/p.u..

**Figure 4.2:** Submitted and dispatched offers and bids of electric producers and consumers sorted by merit order and the resulting UMPD for the EPN.

**Figure 4.3:** Submitted and dispatched offers and bids of heat producers and consumers sorted by merit order and the resulting UMPD for the DHN.

Figure 4.2 and 4.3 show that the approach functions as expected. The solution of the optimization problem shows that the bids of the consumers who are willing to pay the most and the offers of the producers which are willing to produce for the lowest prices are dispatched both in the heat and the electricity network. The power of the electric power plant, which has marginal costs of 2.5 ¤/p.u., as described in Table 4.1, is additionally dispatched. This does not happen if the EPN is optimized on its own. By doing so, parts of the total electric power produced by the power plant, the CHP unit and the photovoltaic plant can be used to fully operate the heat pump (costs of 1.9 ¤/p.u.). Based on this, additional welfare is created in the DHN due to the high COP of the HP of 3.5, which enables the HP operator to offer low price heat power to the DHN consumers. The cost of the respective offer is 1.0 ¤/p.u., see Table 4.1. The resulting uniform price for the EPN c umpd,epn = 1.9 ¤/p.u. is defined by the intersection of the marginal cost curves of the dispatched supply and demand. The real power losses of the EPN add up to P loss,epn = 1.5 p.u. and are also depicted in Figure 4.2. Note that these are plotted as part of the dispatched solution but obviously not part of the plotted submitted bids, as the losses are determined during runtime of the optimization and not known in advance. As the costs of network losses are shared by all grid participants through a grid fee, they can be seen as a part of the welfare. In this understanding, the costs of the network losses have been added to the bids of the consumers in advance. Hereby it is assumed, that producers would directly pass through these grid fee costs to the consumers by raising their offer prices respectively. Then, the entire welfare created in the EPN sums up to Wepn = β wf,epn − ω wf,epn = 173.03 ¤.

The heat losses which add up to Φ loss,dhn = 10.29 p.u. are priced with c loss,dhn = 3.0 ¤/p.u. which is equal to the resulting UMPD of the DHN c umpd,dhn, see Figure 4.3. All heat producers are fully dispatched. The consumers with the least priced bids, more exactly heat consumers 1-6, see Table 4.1, are barely dispatched. Based on this, the welfare of the DHN of Wdhn = 486.56 ¤ is created. The total welfare created throughout both networks is equal to Wtot = Wepn + Wdhn = 659.59 ¤.

All network and operational constraints are fulfilled by the solution of the optimization problem. Therefore, redispatch becomes unnecessary, as requested. Still, some operational constraints are at the provided bounds, as e.g. the node temperatures of the DHN T<sup>i</sup> , which vary between T<sup>1</sup> = 59.99 °C and T<sup>9</sup> = 40.00 °C close and on the bounds defined earlier.

The case study shows that social welfare maximization is provided while secure<sup>8</sup> network operation can be granted for a real network. Also it demonstrates, that the solution of the optimization problem provides small negative welfare areas ω while providing high accumulated total welfare Wtot, close to the potential maximum of the unconstrained network case.

# **4.2 Case Study II: Transactive Control System with Central ISOEMS**

The performance of the proposed TC approach is studied considering two scenarios, which represent diverse functionalities of the presented TCS. These results have been previously published in [MTK+22]. The first scenario highlights how flexibility is included in CEPDHN operation by utilizing a BESS, demand side management of consumers in both networks, and the heat storage capabilities of the DHN. The second scenario examines how the operation of a CEPDHN changes for a very cold winter day with high infeed of RESs, thereby demonstrating how the coupled operation improves overall system operation in contrast to independent operation of the networks by a TCS, as reported in [LLJZ20]. The application of price signals based on the HPA or the LMPA for the EPN and the DHN are also discussed.

### **4.2.1 Scenario 1: DHN Flexibility Provision for the EPN**

### **Description**

**Electric Power Network** The 11 kV distribution network from the case study in [Liu13] is used here as part of the test system, and is shown in Figure 4.4. The EPN comprises ten buses and nine radial feeder sections. The flexible consumers, including the heat pumps, are located at Buses 2, 3, 4, 5, 7, 8, and 9. The producers and energy converters are chosen to clearly illustrate the energy flows in a future energy network. The CHP plant represents a flexible producer whereas, the WPP is modeled as an inflexible producer, which aligns with the German regulation for maximum infeed of RESs. The distribution grid is assumed to have

**Figure 4.4:** Schematic diagram of the EPN (shown in blue) and the supply network of the DHN (drawn in red color); the symmetric DHN return network shown in Figure 4.5 is omitted here for simplicity.

no power exchange with the transmission system; this is facilitated by placing a BESS at the reference bus, which can be considered as a challenging EPN operating condition. The heat pumps are modeled as flexible consumers in the EPN and flexible producers in the DHN.

**District Heating Network** The DHN supplies all consumers with heat, injected by the HPs and the CHP, as shown in Figure 4.5. The FNP at Node 13 is a large-scale consumer (e.g. a secondary network) while the other FNPs are small-scale consumers. This DHN has a meshed structure due to the presence of the supply and return network; the flow directions are determined in advance through the operational states of the pumps and the set point ranges of the valves. The effects of check valves in consumer and producer facilities prevent flow reversals, which are taken into account in (3.14). The used pipeline model is a special case of the model presented in Section 2.3.3, as VMFDs can be neglected, see [MTK+22] for details. The pumps are located next to the producer facilities, i.e., between Nodes 2 and 3, and the DPRs are found in the consumer lines, such as the one between Nodes 7 and 8, which ensures that the pressure difference between Nodes 8 and 34 remains constant by varying the differential pressure between Nodes 7 and 8. The temperature limits which ensure secure<sup>8</sup> and reliable operation of the supply network are set to 80 °C and 130 °C, as in [NTJK18], and the minimum output temperature of all producers is assumed to be 95 °C, for efficiency reasons. An ambient temperature of 10 °C is considered, as this is a typical autumn temperature in Germany. The hydraulic network parameters, such as the roughness, diameters, and lengths of the pipelines, are taken from [Liu13]. The hydraulic model variables β and µ in (2.21) are modeled as parameters based initial mass flow values, see [MTK+22].

**Grid Participants** The system base power profile and associated peak demands are defined by assuming that consumers in the power system and DHN are not participating in the TCS auction market. It is further assumed that consumers are capable of reducing their power consumption up to 30 % at any point in time. This allows to properly demonstrate the performance of the proposed framework and the models; in practice, this flexibility would be

**Figure 4.5:** Schematic diagram of the meshed district heating network with supply and return network.


**Table 4.2:** Cost and benefit parameters of flexible grid participants in general monetary units ¤ for Scenario 1.

determined by their EMSSAs by first calculating the predicted minimum power demand for the next hours and the expected usable amount of energy, as outlaid in Section 3.1. The power profiles of consumers are based on the electric load profiles of [Gmb18], and the heat load profiles of [YS05a], scaling, time-shifting, and overlaying them with a noise profile to represent different consumers. The power profile of the WPP was taken from [Bun19a], and was scaled down and shifted. The coupling factor of the CHP was set to 1.42, and the coupling factors of the heat pumps were set to 4, based on [NTJK18].

The cost and benefit parameters c<sup>i</sup> of producers and consumers are given in Table 4.2. The same values for c<sup>i</sup> are used here for all time steps k in order to facilitate the analysis of the simulation outcome; however, results with varying cost parameters are also tested and discussed in [MTK+22]. It is important to mention that the power injection as well as power consumption of the reference bus/BESS results in income for the battery in the form of an ancillary service, which can be interpreted as an incentive for storage systems.

**Figure 4.6:** Injected power by all EPN participants for Scenario 1.

### **Results and Analysis**

The prediction horizon of the ISOEMS is set to 16 time steps, of 15 min each, which is the interval used in the German intraday market, and the total simulation horizon is 24 h. Several forms can be considered using the proposed approach to provide additional flexibility to the power system. In particular and as demonstrated next, one option is to use DSM of electric and heat consumers to bridge a period with high power price. This leads to a cost advantage for the consumers, allowing to minimize the power injected by more expensive nonrenewable energy sources. Another option is the use of HPs during a period of high penetration with RESs to transfer energy to the DHN.

The electric power injected by EPN participants, calculated using the proposed approach, is shown in Figure 4.6, where the power injected by consumers is shown in aggregated form. A more detailed view of the consumer power is illustrated in Figure 4.7 where the maximum and actual aggregated power of all electrical and heat consumers is shown. To understand the temporal progression of the electric consumer power, a comparison with the power of the reference bus and the WPP of Figure 4.6 is helpful. Thus, during a period with a large ratio between the infeed of the WPP and the aggregated demand, the power of the electrical consumers is maximized in order to minimize the power transferred by the reference bus; this is the case between 0 h and 5.25 h as well as between 9.00 h and 16.75 h. The rest of the time, the consumed power is reduced to its assumed minimum of 30 % of the maximum power demand. This allows minimizing the power injected by the reference bus and the CHP in the periods where the injection of the WPP cannot provide the entire power demand. To illustrate

**Figure 4.7:** Aggregated electric and heat power demand of all consumers for Scenario 1.

the behavior of the HPs, the output temperatures at Node 1, 4, and 23, in Figure 4.8 can be used in addition to Figure 4.6. In contrast to the consumers, the power of a HP is coupled with the output temperature through the temperature ramping constraint (3.25); this causes a strong correlation to the current mass flow flowing through the HP, as per (2.59). Thus, during the period between 8.75 h and 15.5 h, the HPs consume their maximum power; a further increase of the heat power output is not feasible due to the nodal temperature constraints (3.16), as depicted in Figure 4.8. During the periods between 7.75 h and 8.75 h and 22.25 h and 23.5 h, the power consumption of the HPs is at its minimum. The sharp changes in the temperature are due to the varying wind power infeed, as may be noted in Figure 4.6, and the varying electric and heat power demand, as shown in Figure 4.7.

The effective flexibility provision by the DHN can be illustrated in Figure 4.9, where the balance between the aggregated power injection and consumption in the DHN can be observed. The average node temperature and the power infeed of the WPP is also shown to highlight the correlation to the heat power balance. This Figure illustrates the energy that can be stored in the DHN; thus, the DHN provides flexibility to the EPN because excess power from it can be transferred to the DHN, supplying heat consumers with heat power. In Figure 4.9, it can also be observed, that the TCS achieves a very efficient form of DHN operation with low losses, as temperatures in the DHN are continually reduced, during periods when low cost power infeed of the WPP is sparely available. The described effect is observed from the profile of the WPP power infeed and the decreasing average node temperature, with a maximum decline of 30 °C, between 17.5 h and 24 h. This is particularly relevant, as reducing the temperatures has the largest impact on reducing heat losses in a DHN [ÇYÇ04].

**Figure 4.8:** Node temperatures in the DHN for Scenario 1.

**Figure 4.9:** Power balance and average node temperature in the DHN and injected power of the WPP in the EPN for Scenario 1.

By design, the TCS inherently minimizes the losses in the CEPDHN, which results from two important aspects. The first is that the prediction horizon of the underlying NMPC control mechanism is limited; thereby, the ISOEMS is continually incentivized to reduce the temperatures in the DHN to the lower operational limits toward the end of the prediction horizon, in order to maximize the welfare in (3.5) by reducing the allocated power infeed into the DHN. Therefore, the TCS always uses the stored energy in the DHN pipelines as soon as possible, for welfare maximization. The second is the simple fact that lower network losses in the entire CEPDHN need less power infeed, which also inherently incentivizes the ISOEMS to reduce losses to maximize (3.5). These aspects show how market and control mechanisms of the proposed TC approach optimally collaborate to achieve technical efficiency and economic optimality.

The optimization was implemented in GAMS using the IPOPT solver [NW06]. After the initialization, each simulated time step, which includes the 16 prediction horizon time steps, took less than 2 min 28.97 s of CPU time. The entire simulation of all 96 time steps for this scenario took 76 min 35.20 s on the same hardware as Case Study I, see Section 4.1.1. This enables computation in real time even without exploiting the possibilities of distributed parallel optimization or faster workstations.

### **4.2.2 Scenario 2: Price Signals and Independent versus Coupled Operation of EPN and DHN**

### **Description**

The second scenario depicts a cold winter day with an ambient temperature of T<sup>a</sup> of −10 °C. The BESS at the reference bus in Figure 4.4 is replaced by a Photovoltaic (PV) plant, and the profile of the WPP corresponds to data for the simulated day; both RES profiles where taken from [Bun19a] and scaled down to match the demand profiles. Furthermore, RESs are treated as all other flexible producers and can thus be curtailed, which results in all auction bids coming from fully flexible FNPs, that can reduce their demand and supply by 100 %. Inflexible demand, from INPs, is assumed to be allocated in earlier cleared markets or long-term contracts. To show the operation for different hydraulic conditions, the operating points of pumps can be set variably by the TCS in this scenario. Thereby, the TCS receives additional degrees of freedom. Finally, the assumed bid and offer prices are shown in Table 4.3.

### **Results and Analysis - Price Signals**

The resulting heat and power injection and demand, are shown in Figure 4.10, where it can be seen that HPs are preferred over other flexible electric consumers by the TCS. This is particularly obvious between 5.5 h and 8.5 h when the heat demand is large, and the RESs infeed is not sufficient to meet the entire electricity demand. Furthermore, note that the TCS utilizes HP 3 the most, as it is the highest contributor to the social welfare, while the most expensive producer, the CHP, is only run between 5.25 h and 8.5 h to supply the peak demand.

**Table 4.3:** Cost and benefit parameters of FNPs in general monetary units ¤ for Scenario 2.

**Figure 4.10:** Injected power by all EPN participants and all DHN consumers for Scenario 2. The power injection of the CHP plant and the HPs corresponds to electric power.

The LMPs for this scenario are calculated from the optimization model, and the UMPDs are based on the HPA, described in Section 3.2.3. The UMPDs of the EPN and the DHN are calculated separately, based on the intersection of the dispatched offer and bid curves, which are established by sorting the dispatched bids and offers by their respective prices, as outlaid in Section 3.2.3. The resulting LMPs and UMPDs<sup>115</sup> are shown in Figure 4.11, respectively. Note, that in Figure 4.11 the LMPs show large variations, which may be attributed to some extent to the dynamics of temperature propagation throughout the network and the coupling component between the EPN and the DHN [DLS+19].

The UMPD of the DHN in Figure 4.12 shows a strong correlation with the heat power demand of the DHN, which is a logical result of the power sources accessed by the Merit Order. Also, a correlation between the RESs infeed, the total of the WPP and the PV power supply, and the UMPD of the EPN can be seen. Thereby, showing lower mean UMPDs towards the mid of the day during the time of high power supply, of low price offers of the RESs. A comparison of the UMPDs with the marginal bids and offers prices in Table 4.3 yields that the marginal units in the EPN price zone are the WPP, the HP 2 and 3, as well as the PV plant. In contrary, all FNPs in the DHN except the two consumers at Node 10 and 18, with the highest benefits determine the UMPDs at a certain time step. Despite the well known advantages of LMPs in the context of market-based EPN operation such a pricing approach does not seem to work in this case since two different LMPs are obtained for one FNP, as described in Section 3.2.3. Therefore, the UMPD-based pricing seems more appropriate for the application in the presented TCS. This pricing approach incentivizes the FNPs to bid with their true marginal costs in the absence of network congestions [MGR+21].

### **Results and Analysis - Independent versus Coupled Operation of EPN and DHN**

In order to examine the performance of independent operation of the EPN and the DHN, in contrast to their coupled operation, five different operating cases were considered as illustrated in Table 4.4. For Case 3 and 4 one network was optimized first, fixing the obtained power of the energy converters to optimize the second network sequentially. These resemble the operation where either the heat or the electric power market would be cleared first, without any information exchange between the markets. In both cases, the optimization of the second network failed to converge in several time steps, as noted in Table 4.4. Precisely, for Case 3, the DHN optimization problem is terminated by the solver in the first optimization due to the set iteration limit at 8000 iterations of the IPOPT solver. The calculation time needed therefore is beyond 27 min. However, still multiple constraint violations exist, including the equality constraints fixating the heat power infeed of the energy converters to the values obtained from the EPN optimization<sup>116</sup>. In Case 4, the EPN optimization fails the first time during the optimization performed for the 2 h time step. Thereby the infeasibility occurs at the real power flow constraint (2.15) of Bus 2 for the 16 time step, which is the last on the prediction horizon and represents the time step at 6 h. Note, that this is the time step with the maximum heat

<sup>115</sup> The loss costs are set to 0 ¤/MW for the EPN and the DHN.

<sup>116</sup> For comparison, running the identical DHN optimization without the equality constraints, fixating the heat power infeed of the energy converters to the values obtained from the EPN optimization, leads to conversion within 226 iterations.

**Figure 4.12:** UMPDs of EPN and DHN for Scenario 2.


**Table 4.4:** Accumulated 24 h social welfare in various cases.

power demand, see Figure 4.10. In this case, the first dispatched heat demand is so high, that the resulting EPN load created by the HPs can no longer be provided by the EPN sources. Thus, the optimization fails. Thus, a secure<sup>8</sup> network operation can not be provided in both energy networks in either Case 3 or Case 4.

A comparison of the Cases 1, 2 and 5 for their 24 h social welfare, given in Table 4.4, shows that the joint optimization of the EPN and DHN yields the highest social welfare, whereas, if the EPN or the DHN are optimized independently, without considering the presence of the other network, the social welfare is significantly reduced. It should be noted, that the welfare obtained from the DHN is larger as the same accumulated from the EPN operation, as the heat demand is respectively higher, see Figure 4.10<sup>117</sup> .

# **4.3 Case Study III: DHN Operation with Variable Mass Flow Directions and Thermal Energy Storage Systems**

Within this case study optimal market-based DHN operation of the TCS is performed, presenting the effects of VMFDs and the functioning of a large TESS.

### **4.3.1 Description**

The regarded DHN is similar to the network used in Case Study II which is extended here by the TESS, including respective edges for the storage valve and pump, see Figure 4.13. The large scale TESS is directly connected to the DHN and run by the network operator, as described in Remark 3.10. The TESS has a maximum storage capacity of 20 MWh and is initialized almost empty, with 0.1 MWh. The losses of the TESS are assumed to be constant with a value of l = 1 kWh. Further, VMFDs are enabled through adapted valve and pump set point ranges. Based on this, variable mass flow directions can occur on the depicted edges, see Figure 4.13. The marginal bid and offer prices of all FNPs are given in Table 4.5. Note, that these vary over time as stated. The bids and offers of the TESS are set to cn,k = 0 for all time steps k, thereby operating it in a way that serves the good of all other market participants. Further, the

<sup>117</sup> The dashed red and blue lines show the maximum heat and power demand.

**Figure 4.13:** DHN with supply and return network with occurring VMFDs and TESS connected.

factors defining the approximated rectangular function (3.7), used to bounds the mass flows away from zero, are set to w rect,w e,k = 1<sup>e</sup> −2 and w rect,h e,k = 5<sup>e</sup> −2 . The prediction horizon was set to 10 time steps. The optimization of all simulation time steps were calculated within no more then 89 s.

### **4.3.2 Results and Analysis**

The aggregated heat consumption of all consumers and the heat power injection of all producers and the TESS are shown in Figure 4.14. By comparing the power infeed of the different producers and the offer costs in Table 4.5 it can be observed that after the initialization the aggregated consumed power of all consumers stays fairly constant. Besides the ISOEMS maximizes the welfare by prioritizing the producers offering heat at lower costs. These are HP 3 and the CHP toward the beginning and the end of the simulation and HP 1 and HP 2 between simulation time steps k<sup>16</sup> and k26. This leads to VMFDs in the DHN which are exemplary discussed here for the pipeline on Edge 7, marked as e<sup>7</sup> in Figure 4.13. The respective mass flow is plotted in Figure 4.15. As HP 3 and the CHP are the cheapest energy sources at the beginning and the end of the simulation during these time steps heated water flows from these producers over Edge 7 towards the consumer connected at Node 13. In contrast, for k<sup>13</sup> < k < k<sup>28</sup> the flow direction is reversed as the producers on the left side of the DHN provide the main power demand. Note, that the storage is strongly charged during the time interval between simulation time steps k<sup>12</sup> and k14, when the ISOEMS anticipates, that heat power will become more expensive in the next time steps, based on the offer prices. Similarly, the storage is strongly discharged in the following period until k<sup>27</sup> when the offer prices for the upcoming time steps, sent to the ISOEMS show falling offer prices in the next future. Thereby the adapted TESS operation enlarges the overall welfare.


**Table 4.5:** Cost and benefit parameters of FNPs in general monetary units ¤ for different simulation time steps k.

**Figure 4.14:** Injected power by all DHN participants for multiple simulation time steps.

**Figure 4.15:** Mass flows on Edge 7 for multiple simulation time steps.

**Figure 4.16:** State of charge of the TESS over for multiple simulation time steps and calculated SOCs by the ISOEMS over the prediction horizon at these simulation time steps.

**Figure 4.17:** Social welfare obtained in the uniform and VMFDs case for multiple simulation time steps.

In order to compare the VMFD case with a form of network operation with fixed flow directions, the same Scenario was also simulated with fixed (positive) flow directions on all edges, except the edges of the TESS between Node 3 and Node 35, see Figure 4.13. The resulting social welfare for both cases, with and without VMFDs, is depicted in Figure 4.17. Therefrom it can be seen, that after the initialization, the difference in the social welfare increases, with increasing offer price deviation between the producers on the left and right side of the DHN. As can be seen in Table 4.5 these offer price deviations are maximal between k<sup>16</sup> ≤ k < k<sup>27</sup> with up to 18 ¤/MW and remain high with 8 ¤/MW for the rest of the simulated time steps k<sup>27</sup> ≤ k. This demonstrates, how changing the flow directions in the respective edges, enables the ISOEMS to provide the consumers with energy from the heat sources with lower offer prices. The accumulated social welfare over the regarded 40 simulation time steps adds up to 863.5 ¤ in the uniform flow direction case and up to 1042.4 ¤ in the case of VMFDs. This shows that using a form of operation enabling VMFDs raises the social welfare by 20.72 % in the provided scenario.

**Figure 4.18:** Main network of DHN based on raw data.

# **4.4 Case Study IV: Calculation Times in Large Coupled Electric Power and District Heating Networks**

The aim of the following case study was to test the calculational burden of the rolling horizon approach based on the CEPDHN model of a large scale network. As the computational burden of the DHN represents the central challenge, the approach was tested on one of the fifteen biggest out of 1169 DHNs in Germany [SS12], the network of the municipal utilities of a city in northern Germany.

### **4.4.1 Description**

### **District Heating Network**

The main network of this DHN consists of 2864 nodes and 2894 edges and is shown in Figure 4.18.

In order to reduce the amount of optimization variables for the optimal operation approach the network model was aggregated first [BHK+02]. For that matter, serial pipelines are merged into a single component, if they are the only components connected to the respective DHN node in between. This procedure reduces the network graph to 300 nodes and 367 edges. Further, possible future producers in the year 2030 were determined based on a design problem minimizing operation costs taking into account the fees stemming from CO<sup>2</sup> emissions. The results of these calculations proposed the installation of 11 additional HPs with 4 MW thermal each. The used connection of these HPs to the supply network is indicated in Figure 4.19.

**Figure 4.19:** Aggregated supply network of the DHN with connected HPs marked in black.

The thermal resistance, roughness, length, and diameters of the pipelines were set to typical values of 0.3 m K/W ≤ Rtherm ≤ 0.6 m K/W, r = 0.01 mm, L = 50 m118, and d = 300 mm, as given in [NTJK20, p. 64], [Liu13, p. 144]. The amount of positions reserved within a pipeline to model water masses |S<sup>ζ</sup> | was set to 20. The producers supplying heat to the DHN are CHPs, EBs, HPs, heating plants and a waste incineration plant. The maximal total heat demand is around 350 MW. The 100 biggest consumers account for 33 % of the heat demand [MB17]. It is assumed, that these largest consumers are used for DSM with the ability to time shift their demand by 3 h.

### **Electric Power Network**

The graph of the 110 kV EPN is shown in Figure 4.20. All assumptions on the present producers and consumers<sup>119</sup>, including values of variable power demand at every bus, are documented in [Vie19]. Electric power supply comes from the super ordinate 220 kV network connected at Bus 8 and 9, CHPs and a waste incineration plant. The power demand includes the electric demand of the EB and the newly installed HPs which are connected at the Buses 1, 2, 4 and 5. The volume of electric energy sold by the municipal utilities per year is around 733 GWh [Sta].

<sup>118</sup> The set value is understood as a mean value stemming from aggregated pipeline lengths. Therefore, the lengths of the new pipelines are calculated by the sum of the aggregated serial pipes [BHK+02].

<sup>119</sup> Except the HPs.

**Figure 4.20:** Topology of the 110 kV electric power network [Vie19].

### **Implementation**

The pre-processing of the raw data was implemented in MATLAB. The optimization problems solved for the rolling horizon approach were implemented in GAMS. The used optimization problem was slightly altered to fit more into existing network operation forms of network operators. The parameters defining the soft constraints f soft within the objective function (3.5), bounding the mass flows away from zero, are set to w rect,w e,k = 1<sup>e</sup> −3 and w rect,h e,k = 2.5<sup>e</sup> −1 . Further, the economic objective f eco in (3.5) was set to minimize the operation cost of the DSO within the network, including resulting costs for the network operator when applying DSM. Thus, the idea behind this approach is the design of an EMS for a DSO which is not unbundled, in order to minimize its operation costs. Note, that even though the objective function is therefore slightly altered, the basic functionality of the approach described in Figure 3.7 stays identical, except that the cost parameters needed in f eco are set and known by the DSO and Step 3 is omitted. Thus, also the calculation time needed to solve the optimization problem in Step 2, is in a similar range as for a central ISOEMS developed within this work, as it uses the same CEPDHN model given in Chapter 2 and operational constraints outlaid in Section 3.3.1.

### **4.4.2 Results and Analysis**

The obtained calculation times for different prediction horizons are shown in Figure 4.21 for three subsequent optimizations on the prediction horizon each. Note, that for a prediction horizon of five time steps n ck = |Sk| = 5, the solver has returned an error message in the first<sup>120</sup> and second<sup>121</sup> optimizations, thus these calculation times are not provided in the graph. Here, the solver tries to allocate more memory multiple times before in the first optimization before aborting the solution procedure. The results show, that real time capability of the approach on standard working stations with of the shelf solvers is not given for large DHNs . This is depicted in the 4.21, through the surpassing of the time step interval ∆k = 15 min used between two optimizations by multiple calculation times of different optimizations. It should also be taken into account, that larger prediction horizons are desired to enable the energy management system to better anticipate future operation conditions, in order to minimize losses and minimize operation costs, in the application shown within this case study. Note, that for a 1 h prediction horizon, in certain low flow conditions the supply of the critical consumer will not be represented within the DHN model used by the EMS. This shows, that larger prediction horizons would be favored. Note, that even though real time capability is not reached here, the necessary reduction of computation times seams possible with more resources, as necessary reduction factors are assumed to be in the single digit range even for larger prediction horizons. Thus in order to enable real time capability, further measures need to be taken. These could comprise faster work stations, better initial values x <sup>0</sup> obtained from precalculations with simplified models [Trö99], and the elimination of variables [NW06, p. 426]. Besides the aforementioned, using parallelization techniques, as the OCD approach,

<sup>120</sup> IPOPT message: Problem with integer stack size.

<sup>121</sup> IPOPT message: Restoration failed.

**Figure 4.21:** Calculation times needed for different prediction horizons in subsequent optimizations on the rolling horizon.

**Figure 4.22:** Regarded DHN with two producers and consumers each decomposed by the orange marked operational border into Zone a and Zone b.

could help to reduce the calculation times. In this context, the basic principle of applying OCD to a DHN is demonstrated in the following Case Study V.

# **4.5 Case Study V: Optimality Condition Decomposition for Operation of District Heating Networks**

Within this case study the applicability range of distributed optimal operation of DHNs based on OCD is analyzed. The approach was tested on two DHNs presented below.

### **4.5.1 Description**

### **Four Node Network**

The regarded DHN is shown in Figure 4.22. Note that, this DHN has already been discussed extensively in Section 3.3.2, where the approach has been presented. The case study was implemented using the aggregated component model form described in Remark 3.19. In doing so, the network can be described with only four network nodes i and six network edges e. As explained in Remark 3.20 the border edge directions are set to direct away from the border nodes i in the supply network and towards both border nodes in the return network, within the regarded DHN node edge incidence matrix A dhn. The optimization is initialized with a flat start, thus setting x = 0. Mass flows have been limited to 0 kg/s ≤ m˙ <sup>e</sup> ≤ 2 kg/s, permissible outlet, inlet and nodal temperatures are defined as 70 °C ≤ T ≤ 100 °C. The box constraints of the injected power infeed of the producers on Edges e<sup>5</sup> and e<sup>7</sup> are 0 kW ≤ Φ ≤ 40 kW, while consumers on Edges e<sup>2</sup> and e<sup>4</sup> are limited to −40 kW ≤ Φ ≤ 0 kW. The predefined pressure coefficient µ pre e,k of the pipelines was set to <sup>1</sup> and the predefined pressure value <sup>p</sup> pre used in (3.53) was set to 0.2. The marginal bid prices c<sup>n</sup> of the FNPs n1, n2, n3, and n<sup>4</sup> on Edges e5, e4, e<sup>2</sup> and e<sup>7</sup> are set to 1, 10, 20, and 20. Note, that n<sup>1</sup> and n<sup>4</sup> are producers while n<sup>2</sup> and n<sup>3</sup> are consumers, as can be seen from Figure 4.22. The approach to guard against singularity of the approximated KKT matrix was used, as explained in Remark 3.17, with the parameter δ = 1e −6 .

### **Eight Node Network**

A second network was tested, which represents an extension of the Four Node Network described in the previous Section. In this network a pipeline is added before and after the two producers shown in Figure 4.22. In order to connect these newly inserted pipelines with the producers, also a node is added between each pipeline and every producer. Thus, in total the network shown in Figure 4.22 is extended by four pipes and four nodes. The entire set of parameters used is provided in [MIJSH22].

### **4.5.2 Results and Analysis**

### **Four Node Network**

The results obtained from the approach presented in Section 3.3.2 for two ISOEMSs is compared here against the results obtained from a single central ISOEMS. The solution of the central ISOEMS case is shown in dashed lines within the plots of Figure 4.23. As can be observed from these graphs the mass flows, the nodal pressures, the node temperatures and the power infeed or demand of the FNPs converges to the same values for the distributed ISOEMS case<sup>122</sup> . The maximum deviation of the plotted values between the central and the distributed solution is obtained for the node temperature at Node i<sup>3</sup> with −0.157 mK. The central solution, implemented in GAMS with the IPOPT solver needs 29 iterations to converge to the standard solver tolerances, while the distributed approach achieves this accuracy after 100 iterations. This need for more iterations is expected, as the search direction is calculated less accurate in the distributed case as in the central implementation, which leads to a need of additional iterations. This finding accords with the results in [CNP02, NPC03]. As the calculation times of the single iterations could be reduced in the distributed case, for lager networks and thus optimization problems, the distributed case may reduce the calculation times as demonstrated in [CNP02] for EPNs, also see Remark 3.18. The primal infeasibility<sup>123</sup> ∥h(x)∥<sup>∞</sup> of the subproblems per iteration ν is shown in Figure 4.24 on a logarithmic scale. Therefrom it can be seen, that both subproblems fulfill the set constraints with a maximum constraint violation below 1.1e −4 after 100 iterations. Note, that similar results were also obtained for different sets of parameters within this network, see [MIJSH22].

<sup>122</sup> Note, that the mass flows of Edge 1 and 2 are nearly the same m˙ <sup>1</sup> ≈ m˙ <sup>2</sup>, as the flow through Edge 7 is m˙ <sup>6</sup> ≈ 0, also T<sup>1</sup> ≈ T2, thus these values are hard to distinguish.

<sup>123</sup> Based on the IPOPT NLP problem formulation [Wäc09, p. 7].

**Figure 4.23:** Four most relevant variables plotted for the performed OCD iterations. The dashed lines show the solution of the central optimization.

**Figure 4.24:** Primal infeasibility for current iteration ν. Note, that the infeasibility is not plotted if it drops below 10−<sup>4</sup> .

### **Eight Node Network**

The Eight Node Network did not show the expected convergence properties, see [MIJSH22]. In contrast to the Four Node Network, where convergence of the distributed solution was seen for a majority of the tested parameter sets, in the regarded Eight Node Network only a minority of the regarded parameter sets showed a convergence of the OCD approach toward the central solution. A potential explanation for this result is that in the Eight Node Network case, which in contrast to the Four Node Network includes the thermal pipeline models, Condition 3.2 might be regularly violated.

# **4.6 Summary and Discussion**

This section summarizes and discusses the main findings of the performed simulations, demonstrating the applicability and limitations of the proposed TCS for CEPDHNs.

The application of the HPA in Case Study I showed how the uniform marginal prices obtained from the dispatch solution are calculated for a CEPDHN. Case Study II and III show how the ISOEMS fully utilizes the different flexibilities of the CEPDHN in a predictive manner, to maximize the welfare and thereby minimizing curtailment of RESs, and the losses occurring in the CEPDHN. The used flexibility originates from storage systems, thermal inertia of the DHN pipeline, as well as from demand side management of consumers in the EPN and the DHNs. Also, comparisons of the coordinated operation of the EPN with the DHN with a separated form of dispatch show the superiority of the coupled operation. Further, different price signals have been provided obtained from the TCS operation. The results of Case Study IV highlight that the proposed transactive control approach for CEPDHNs can also be used for further applications as operation cost minimization of a network operator by adapting the objective of the ISOEMS and the information exchange between the engaged entities. Further, these simulations show, that for large CEPDHNs, the approach, based on the detailed CEPDHN model presented in Chapter 2 leads to a high computational burden. This limits the real time capability of a central ISOEMS on a standard work station with of the shelf solvers. Case Study V demonstrated the application of the distributed rolling horizon approach based on OCD. The results showed expected convergence properties for a majority of the tested parameter sets for a small example DHN but the distributed solution does not converge toward the central results for the second tested Eight Node Network. In summary, these results presented different aspects of the CEPDHN operation performed by the TCS.

The application of the HPA in Case Study I showed the effectiveness of this pricing approach, in case that no market participant is able to exploit his market power. However in the case of large market power of single market participants further measures as regulation or grid reinforcements would be necessary to limit profits of respective actors.

The comparisons performed in Case Study II between the coordinated operation of the EPN and the DHN with a separated form of dispatch shows the superiority of the coupled operation, which is in line with the state of the art [ZWW+21, WYJ+16, LSF14]. Similar results provided in the literature showing the benefits of joint operation of CEPDHNs with flexible demand enhancing social welfare up to 16.6 % are provided in [SDWS17]. Also simulational results in [LWW+19] show that an optimal joint operation of CEPDHNs leads to a 17.19 % RESs curtailment reduction. Note, that the superiority of joint CEPDHN operation not only stems from higher overall welfare but also from the absence of insecure network operation conditions<sup>8</sup> . This can be seen from the simulations provided in Case Study II, where a naive sequential dispatch of the EPN and the DHN led to failure of convergence of the optimization.

The simulational results provided in Case Study III show how important it is to take VMFDs into account when dispatching DHNs. Precisely, enabling VMFDs in the regarded scenario raises the accumulated social welfare by 20.72 %, as this allows to supply consumers with the lowest priced offers. To the best of the authors knowledge this aspect has so far not been sufficiently researched in the context of market-based DHN operation.

The findings from Case Study IV, demonstrating the high computational burden of the high detail DHN model, surpassing the 15 min time step intervalls for small prediction horizons below 6 time steps, align with statements on computational effort from [ZWW+21]. In this context, the interest in possibilities to speed up computations by parallelization techniques is straightforward. Regarding the results of the proposed OCD approach for DHNs, the increase in iterations ν needed to obtain the distributed solution compared to the central solution for the Four Node Network is in line with findings from [CNP02, NPC03]. These sources show, that the amount of iterations needed by the OCD approach are typically larger, as the search direction is calculated in an approximated form. Still, the single iterations will take less computation time for large scale problems, which is the basis for the calculational time reduction obtained from OCD. However, the limited convergence properties of the larger DHN solved by OCD in Case Study V showed, that the approach cannot be applied to general DHNs, in its current form.

Based on the aforementioned, the scalability of the overall TCS approach is clearly limited to DHNs with medium size, within the CEPDHNs , as the DHN optimization model comes along with a high computational burden. Based on the calculation times obtained from Case Study III and IV the possible maximum DHN size lies between 39 and 300 nodes on a standard work station with of the shelf solvers. On the other hand, the approach is expected to scale over large EPNs as calculation time reduction by distributed parallel optimization of EPNs based on OCD has been reported by multiple sources [NPC03, GHT16]. Thereby, it is important that the coupling condition has to be fulfilled for the respective decompositions.

All in all, the presented simulation results show the applicability of the presented TCS, to operate CEPDHNs in a technical secure<sup>8</sup> and efficient as well as welfare maximizing form.

# **5 Conclusion**

The need for a carbon dioxide free and at the same time affordable energy supply creates a demand for new forms of network operation in EPNs and DHNs. As motivated in Chapter 1 desired properties of future CEPDHN operation approaches are the ability to coordinate a vast number of flexible network participants while achieving technical efficiency, economic optimality and secure<sup>8</sup> network operation. For that aim, existing economic and technical inefficiencies are to be reduced by designing market and control mechanisms in a joint form and by operating the physically coupled EPNs and DHNs in a coordinated form. Therefore, the objective and central contribution of this thesis are the design of a transactive control system for CEPDHNs. The TCS was designed with two hierarchy levels, comprising the EMSSAs on the first level and the ISOEMSs on the second level. Every EMSSA, representing an FNP, sends its bids or offers to the ISOEMS of its proper operational zone. As no further information besides the bids or offers is shared by the EMSSAs the approach enables a high level of privacy [KW16], while enabling end user participation [LLJZ20]. The ISOEMSs also obtain further power demand and supply forecasts and operational values as e.g. pump operation set points of their operational zone. Using all the provided information together with the contributed detailed CEPDHN model and the given operational limits, the ISOEMSs determine the optimal control values for the CEPDHNs. Thereby, the ISOEMSs achieve economic optimality by maximizing the social welfare, technical efficiency through the detailed CEPDHN model and secure<sup>8</sup> network operation by taking into account the operational limits. The overall approach represents a distributed rolling horizon procedure.

In contrast to the state of the art, the detailed network model considers all relevant physical effects of CEPDHN operation. These are variable mass flows with VMFDs, an exact representation of the pipeline friction factors, storage effects of pipelines, DPRs, pumps, and their respective control paths, thermal energy storage systems and lossy meshed AC EPNs. The comparatively high modeling detail of the presented CEPDHN model brings along two important features. First, it enables a technically efficient form of CEPDHN operation with low losses. Second, this modeling is the basis for enabling welfare maximization. In summary, the detailed CEPDHN model forms Contribution 2 of this work, bridging the Research Gap 1 a) b) stated in Section 1.2.5, see Figure 5.1.

As demonstrated in the results in Chapter 4, the detailed CEPDHN model brings along a high computational burden. Therefore, counteractive measures are taken in order to reduce the necessary computation times. First, the thermal pipeline models within the CEPDHN model are directly embedded into the rolling horizon approach. This is achieved by using precalculated mass flow parameters in the thermal pipeline model which avoid the need for integer variables, which would necessitate to solve a badly scaling MINLP problem at runtime. The presented approach precalculates the mass flow parameters after every optimization following the rolling horizon implementation, as explained in Section 3.3.1. Second, a distributed

**Figure 5.1:** Relation between research gaps and contributions of this work.

rolling horizon approach is utilized which enables to parallelize the computations by multiple ISOEMSs. Therefore, different distributed optimization approaches have been compared. The optimality condition decomposition approach was selected due to the low amount of necessary information exchange between the ISOEMSs, the absence of tuning parameters, and its successful application within distributed optimization of EPNs and CEPDHNs. Building upon the aforementioned, it is expected, that large scale CEPDHNs and their respective network graphs can be decomposed into multiple subproblems by decomposing the CEPDHNs into multiple operational zones among electric tie lines. Every operational zone is controlled by its proper ISOEMS. When decomposing the initial central optimization problem into the small scale subproblems it is important to fulfill the conditions of the OCD approach, described in Section 3.3.2. At the same time, the coupling condition can be used as a quantitative criterion to compare different decompositions among each other. Visually speaking, stronger coupled subproblems, e.g. operational zones connected by more tie lines, will converge slower than weakly coupled subproblems. In certain cases, when the OCD conditions are not fulfilled, a distinct decomposition can lead to divergence or deviations to the central solution in general. So far the OCD approach has not been applied to DHNs, and distributed dispatch of DHNs in general represents Research Gap 2. Due to the strong coupling of the subproblems, originating from the decomposition of optimal dispatch problems of DHNs a specially fitted reformulation of the DHN model was necessary. This enabled to apply the OCD approach to a small scale DHN, which represents Contribution 4 of this thesis. However, the expected scalability of this approach is not provided for DHNs, as shown in Chapter 4.

Within Section 3.2.3 different pricing approaches have been outlaid and compared. The most efficient form of pricing, the locational marginal pricing approach can not be simply applied to DHNs as two LMPs are obtained for every FNP. Also, this work is contextualized within the German and thereby European energy market, where uniform marginal pricing is mostly applied<sup>124</sup>. Therefore, the novel hybrid pricing approach for CEPDHNs has been developed, which enables uniform marginal pricing in the case of uncongested network operation. Thereby, incentive compatibility is achieved in this scenario. When operational limits are reached, cases may occur, were some bids and offers are paid-as-bid and pay-as-bid vice versa. The necessary sum needed to pay these bids and offers is collected through a grid fee. As the approach inherently minimizes this sum, by maximizing the welfare the expected value

<sup>124</sup> Within every price zone.

of this grid fee is low. At the same time theoretically unbounded grid fees arising via uplift costs from redispatch are omitted, as operational limits of the network are considered during market clearing. Thereby, the hybrid pricing mechanism uses a price zone for the EPN and every DHN in order to account for different price levels of electric energy and heat. The presented novel pricing mechanism constitutes Contribution 3 of this work and represents an important part of in the transactive control system design, which yields Contribution 1. The interplay of, Contribution 1 and Contribution 3 help to fill Research Gap 1, which describes the missing coordination of market and control mechanisms within CEPDHN operation.

Figure 5.1 summarizes how the contributions of this work help to bridge the depicted research gap. The later comprises the insufficient coordination of market and control mechanisms for CEPDHN operation, the absence of detailed CEPDHN models needed for technical efficiency and welfare maximization, as well as the lack of approaches for distributed optimization of DHNs. The designed TCS, based on the novel CEPDHN model, enables secure<sup>8</sup> , technically efficient and welfare maximizing operation of CEPDHNs. The simulational results presented in Chapter 4 illustrate benefits as loss reduction and flexibility provision. The later is achieved through storage capacities of DHN pipelines, thermal energy storage systems, battery storages, as well as demand side management in the DHN and the EPN. The highly coordinated operation of the EPN and the DHN leads to very low curtailment of RESs. Further, the case studys indicate the following three aspects: First, in line with the large amount of literature in this field, the results show, that coupled operation of the EPN and DHNs leads to the overall achievable welfare maximum. Second, a naive sequential market clearing of the electricity and the heat markets will lead to severe challenges in the network of the second cleared market. In the regarded scenarios no secure network operation condition could be provided in this case. Third, technical efficient and welfare maximizing operation of CEPDHNs is not possible with prevalent model simplifications found in current literature on optimal operation of CEPDHNs. Performed simulations showed that providing the possibility of mass flow direction changes in the network model led to a 20.72 % raise of the accumulated welfare. Also, variable mass flows are the basis for demand-side management and lowering heat losses in DHNs.

Several interesting aspects may be explored further by future work. These comprise the extension of the approach to further energy domains as for example gas networks. As gases are much more compressible than water, and this compressibility is actively used by gas network operators to store more or less energy within their networks this adds a further dimension to the regarded approach. Also the heating value of the transported gas changes in location and time, especially when different gases as natural gas, green gas and hydrogen are mixed.

Besides the approach could potentially be modified in order to enable a locational marginal pricing approach. However, this represents a nontrivial challenge as applying this pricing mechanism to DHNs brings along multiple difficulties as described in Section 3.2.3.

The development and implementation of transactive control approaches for multi-energy systems can reduce the costs of a future sustainable energy supply. This arises from the fact that these approaches can help to prevent grid reinforcements, lower operational costs through technical efficiency or the absence of uplift costs, and enable to achieve welfare maximizing operation.

# **A Determination of the Nodal Admittance Matrix**

This section describes how the nodal admittance matrix Y bus is calculated based on the πequivalent impedance Z π e and admittance Y π e , shown in Figure 2.3, for all transmission lines e, as well as the shunt admittance vector of all buses Y sh .

Based on the aforementioned, the transmission line admittance matrix Y trl <sup>e</sup> of network edge e can be calculated as [ZMS11]125:

$$\underline{\mathbf{Y}}\_{e}^{\mathrm{trl}} = \begin{bmatrix} \frac{\underline{I}^{t}}{\underline{V}^{t}\_{e}} \Big|\_{\underline{V}^{t}\_{e} = 0} & \frac{\underline{I}^{t}}{\underline{V}^{t}\_{e}} \Big|\_{\underline{V}^{t}\_{e} = 0} \\\\ \frac{\underline{I}^{t}}{\underline{V}^{t}\_{e}} \Big|\_{\underline{V}^{t}\_{e} = 0} & \frac{\underline{I}^{t}}{\underline{V}^{t}\_{e}} \Big|\_{\underline{V}^{t}\_{e} = 0} \end{bmatrix} = \begin{bmatrix} \underline{Y}^{\mathrm{ff}}\_{e} & \underline{Y}^{\mathrm{ff}}\_{e} \\\\ \underline{Y}^{\mathrm{tf}}\_{e} & \underline{Y}^{\mathrm{tf}}\_{e} \end{bmatrix} \tag{A.1}$$

$$= \begin{bmatrix} \frac{1}{\underline{Z}^{\pi}\_{e}} + \frac{\underline{Y}^{\pi}\_{e}}{2} & -\frac{1}{\underline{Z}^{\pi}\_{e}} \\ -\frac{1}{\underline{Z}^{\pi}\_{e}} & \frac{1}{\underline{Z}^{\pi}\_{e}} + \frac{\underline{Y}^{\pi}}{2} \end{bmatrix}, \qquad \forall \ e \in \mathbb{S}\_{e}^{\text{epn}} \tag{A.2}$$

where the superscripts ff, ft,tf, and ff of the admittances Y represent a sequence of the f and t superscripts identifying the respective currents and voltages at the *from* or *to* end of the transmission line, see Figure 2.3. The auxiliary admittance column vectors Y ff , Y ft , Y tf, and Y tt are set up as:

$$\underline{\mathbf{Y}^{\text{ff}}} = \underline{\mathbf{Y}^{\text{tt}}} = \begin{bmatrix} \underline{Y}\_1^{\text{ff}}, \dots, \underline{Y}\_e^{\text{ff}}, \dots, \underline{Y}\_{\text{n}^{\text{ev}}}^{\text{ff}} \end{bmatrix} \tag{A.3}$$

$$\underline{\mathbf{Y}^{\text{ft}}} = \underline{\mathbf{Y}^{\text{tf}}} = \begin{bmatrix} \underline{Y}^{\text{ft}}\_1, \dots, \underline{Y}^{\text{ft}}\_e, \dots, \underline{Y}^{\text{ft}}\_{\text{n}^{\text{cu}}} \end{bmatrix} \tag{A.4}$$

with the cardinality of the EPN edges n ce = |S epn e |.

The nodal admittance matrix Y bus of the entire EPN is then calculated by [ZMS11]:

$$\underline{\mathbf{Y}^{\text{f}}} = \text{diag}\left(\underline{\mathbf{Y}^{\text{ff}}}\right)\left(\underline{\mathbf{A}}^{\text{exp},-}\right)^{\top}\_{+} + \text{diag}\left(\underline{\mathbf{Y}^{\text{ft}}}\right)\left(\underline{\mathbf{A}}^{\text{exp},+}\right)^{\top}\_{-}\tag{A.5}$$

$$\underline{\mathbf{Y}}^{\mathrm{t}} = \operatorname{diag} (\underline{\mathbf{Y}}^{\mathrm{t}\mathrm{f}}) \left( \underline{\mathbf{A}}^{\mathrm{epn}, -} \right)^{\top} + \operatorname{diag} (\underline{\mathbf{Y}}^{\mathrm{tt}}) \left( \underline{\mathbf{A}}^{\mathrm{epn}, +} \right)^{\top} \tag{A.6}$$

$$\underline{\mathbf{Y}}^{\text{bus}} = \underline{\mathbf{A}}^{\text{epn},-} \underline{\mathbf{Y}}^{\text{f}} + \underline{\mathbf{A}}^{\text{epn},+} \underline{\mathbf{Y}}^{\text{t}} \text{diag}(\underline{\mathbf{Y}}^{\text{sh}}) \tag{A.7}$$

where the matrices A epn,<sup>+</sup> and A epn,<sup>−</sup> are given in (2.14).

<sup>125</sup> The negative sign of the admittances on the secondary diagonals originates from the opposed directions of flow and potential difference, see Figure 2.3.

# **B Possible Forms of Decompositions**

The aim of the following explanations is to show that insufficient degrees of freedom for at least one zone can arise, when applying different forms of decomposition. Different possible forms of decomposing a DHN into similarly sized subproblems as provided initially in Figure 3.10 in the Example 3.3 are provided in the following. Four different zone partitioning possibilities are shown in Figure B.1 by the different Borders 1 to 4 used to decompose the small DHN into the two subproblems, Zone a and Zone b. Note, that for every border shown in Figure B.1 the complicating constraint arising from the border loop, exemplary stated in (B.2), can be either assigned to Zone a or Zone b. Thus eight possible forms to decompose the original problem can be distinguished in total in this case. Since an example based on the decomposition by Border 2 has already been provided in Example 3.3, which is similar to the decomposition by Border 1, we will first demonstrate the effects of a decomposition by Border 4, which is again analog to the procedure using Border 3. The complicating constraints arising from applying the decomposition defined by Border 4 in Zone b are given by:

$$
\begin{aligned}
\overline{\dot{m}}\_1 - \dot{m}\_2 + \dot{m}\_6 \\
&\quad \qquad \qquad \qquad \qquad \qquad = 0
\end{aligned} \tag{\text{B.1}}
$$

$$
\overline{\Delta p}\_1 + \Delta p\_2 + \Delta p\_3 - \overline{\Delta p}\_4 \qquad\qquad\qquad = 0\tag{\text{B.2}}
$$

Thereby, the complication loop equation (B.2) was assigned to Zone b. The second hydraulic node equation is:

$$
\dot{m}\_2 - \dot{m}\_3 - \dot{m}\_6 = 0 \tag{8.3}
$$

Note, that from (B.1) and (B.3) it is apparent, that m˙ <sup>1</sup> = ˙m3. Based on this from (3.46d) for e<sup>3</sup> it can be seen, that also ∆p<sup>3</sup> is defined in this case. Using this information, from (B.2) it can be seen, that also the value of ∆p<sup>2</sup> is determined, and with (3.46d) for e<sup>2</sup> this also incorporates m˙ <sup>2</sup>. Since thereby, m˙ <sup>6</sup> is also known from (B.1), the system of equations once more has zero degrees of freedom<sup>126</sup> .

Note, that if the network operation would limit only one further degree of freedom, e.g. through a set operation point of a pump, e.g. defining ∆p2, then the both subproblems would have zero degrees of freedom in this case.

However, for completeness it should also be noted, that using a decomposition based on Border 2, assigning the complicating constraint of the border loop equation to Zone a would not fully predefine the flows and pressures in either of the zones. However, in contrast to OCD applied to EPNs, see Example 3.4, Zone b would have no possibility to change the flows to Zone a, as they are predefined in the complicating constraints originating from the hydraulic node equations (3.46b) of Node 2 and Node 4.

<sup>126</sup> Note, that the same occurs with the systems of equations of Zone a if the complicating constraint of the border loop equation, here (B.2), would have been assigned to Zone a.

**Figure B.1:** Example DHN decomposed into Zone a and Zone b by four possible forms (Border 1 to Border 4) to obtain similarly sized subproblems.

In summary, the provided forms of decomposition showed that in most cases using OCD to the example DHN showed in Figure B.1, the system of equations of one zone had zero degrees of freedom. If only a single degree of freedom of the system of hydraulic model equations, is reduced by the form of network operation, both zones can have zero degrees of freedom within their system of equations. This shows, that applying OCD to DHNs can be challenging. These aspects are not relevant when applying OCD to EPNs, see Example 3.4.

# **C The Border Loop Equation**

This appendix provides further insight on the pressure drop loop equation, which is replaced by the model reformulation. The pressure drop loop equation (2.24) is replaced by the following equations (C.1) for border loops in the approach presented in Section 3.3.2:

$$\left(\sum\_{e \in \mathbb{S}\_e^{\text{dh}, \text{an}}, e \notin \mathbb{S}\_e^{\text{dh}, \text{ba}, \text{an}}} \sum\_{i \in \mathbb{S}\_i^{\text{dh}, \text{bi}, \text{an}}} |B\_{l,e}| |A\_{i,e}^{\text{dh}}| p\_{i,k} \right) = \Delta p^{\text{pre}}, \qquad \forall \, l \in \mathbb{S}\_l^{\text{dh}, \text{b}, \text{ra}}, k \in \mathbb{S}\_k \tag{C.1}$$

with the set ob all border loops in Zone a stated in S dhn,bl,za l . In order to guarantee, that the pressure difference aligns with the physical flow direction, an additional inequality (C.2) is used, as stated below:

$$\begin{pmatrix} \sum\_{e \in \mathbb{S}\_e^{\text{dh}, \text{xa}}, e \notin \mathbb{S}\_e^{\text{dh}, \text{ba}, \text{xa}}} \sum\_{i \in \mathbb{S}\_i^{\text{dh}, \text{xa}, \text{bi}, \text{xa}}} |B\_{l,e}| |A\_{i,e}^{\text{dh}}| p\_{i,k} \end{pmatrix}$$

$$\geq \left( \sum\_{e \in \mathbb{S}\_e^{\text{dh}, \text{xa}}, e \notin \mathbb{S}\_e^{\text{dh}, \text{ba}, \text{xa}}} \sum\_{i \in \mathbb{S}\_i^{\text{dh}, \text{xa}, \text{ba}, \text{xa}}} |B\_{l,e}| |A\_{i,e}^{\text{dh}}| p\_{i,k} \right), \forall \ l \in \mathbb{S}\_l^{\text{dh}, \text{ab}, \text{xa}}, k \in \mathbb{S}\_k \qquad \text{(C.2)}$$

### **Remark C.1:**

*This formulation is equivalent to considering the differential pressure loop equation* (2.24) *of the central optimization problem, in both zones of the decomposed OCD form, for each border loop. This can be formulated as follows:*

X e∈S dhn e Bl,e∆pe,k = 0 (C.3a) = X e∈S dhn,za <sup>e</sup> ,e /∈S dhn,be,za e Bl,e∆pe,k + X e∈S dhn,zb <sup>e</sup> ,e /∈S dhn,be,zb e Bl,e∆pe,k + X e∈S dhn,be,za <sup>e</sup> ,e∈S dhn,be,zb e Bl,e∆pe,k (C.3b) = X e∈S dhn,za <sup>e</sup> ,e /∈S dhn,be,za e Bl,e∆pe,k + X e∈S dhn,zb <sup>e</sup> ,e /∈S dhn,be,zb e Bl,e∆pe,k + 2 X e∈S dhn,sn,be,za <sup>e</sup> ,e∈S dhn,sn,be,zb e Bl,e∆pe,k (C.3c) = <sup>X</sup> e∈S dhn,za <sup>e</sup> ,e /∈S dhn,be,za e X i∈S dhn,bi,za i |Bl,e||A dhn i,e <sup>|</sup>pi,k + <sup>X</sup> e∈S dhn,zb <sup>e</sup> ,e /∈S dhn,be,zb e X i∈S dhn,bi,zb i |Bl,e||A dhn i,e <sup>|</sup>pi,k (C.3d) ∀ l ∈ S dhn,bl,za l , k ∈ S<sup>k</sup>

*The above is equal to equation* (C.1) *as the constant differential pressure* ∆p pre *in equation* (C.1) *is defined as follows for a given border loop* l *of zone a:*

$$\Delta p^{\rm pre} = \left( \sum\_{e \in \mathbb{S}\_e^{\rm dhn, xb}, e \notin \mathbb{S}\_e^{\rm dhn, ba, xb}} \sum\_{i \in \mathbb{S}\_i^{\rm dhn, bh, xb}} |B\_{l,e}| |A\_{i,e}^{\rm dhn}| p\_{i,k} \right), \quad l \in \mathbb{S}\_l^{\rm dhn, bh, xa}, k \in \mathbb{S}\_k \tag{C.4}$$

Strictly regarded, the replacement of the pressure drop border loop equation (2.24) by the above does not yet resemble a decomposition of the original central problem into decomposed smaller problems, as usually performed by OCD, as no complicating constraints are introduced here. Much more, this approach enables the pressure potentials to remain variable while using the OCD method, as stated in Section 3.3.2.

# **References**

# **Public References**










(2016), S. 336–345





# **Own Publications and Conference Proceedings**


# **Supervised Theses**


### **Karlsruher Beiträge zur Regelungs- und Steuerungstechnik (ISSN 2511-6312) Institut für Regelungs- und Steuerungssysteme**



# INSTITUT FÜR REGELUNGS- UND STEUERUNGSSYSTEME

The aim to decarbonize the energy supply represents a major technical and social challenge. The design of approaches for future energy network operation faces the technical challenge of needing to coordinate a vast number of new network participants spatially and temporally, in order to balance energy supply and demand, while achieving secure network operation. At the same time these approaches should ideally provide economic optimal solutions. In order to meet this challenge, the research field of *transactive control* emerged, which is based on an appropriate interaction of market and control mechanisms. These approaches have been extensively studied for electric power networks. In order to account for the strong differences between the operation of electric power networks and other energy networks, new approaches need to be developed. Therefore, within this work a new transactive control approach for Coupled Electric Power and District Heating Networks (CEPDHNs) is presented. As this is built upon a model-based control approach, a suitable model is designed first, which enables to operate coupled electric power and district heating networks as efficient as possible. Also, for the transactive control approach a new fitted procedure is developed to determine market clearing prices in the multi-energy system. Further, a distributed form of district heating network operation is designed in this context. The effectiveness of the presented approach is analyzed in multiple simulations, based on real world networks.

Transactive Control of Coupled Electric Power and District Heating Networks

ISSN 2511-6312 ISBN 978-3-7315-1276-9