Mutual-benefit of district heating market and network operation for prosumers integration

ABSTRACT Integration of prosumers in district heating networks brings new challenges to the market and the network operation since they can change the thermal flow and increase competition. Thus, it is mandatory to develop new market structures and network management mechanisms. In this scope, this work proposes the implementation of a coordination methodology based on a peer-to-peer market without a supervising entity. The goal is to achieve higher revenue by coping with the requirements of each agent. Furthermore, the model is validated through network nodal analysis inspired by the power sector. The results in a Nordic network point out that the coordination methodology can provide compromise solutions between market negotiation and network operation. This methodology succeeded in providing reliable network solutions, fixing 99.88% of network burdens just after one iteration, and encouraging prosumers’ integration. This increases market competition which lowers the energy costs for consumers while avoiding the network’s operating burdens.


Motivation and background
Over the last few years, district heating markets have been in a process of deregulation and liberalization, opening the doors to the inclusion of new players in district heating systems (DHS).These new players are known as prosumers (consumers that can both consume and produce heating energy), which are supported by the recent technological advances in waste heat recovery.They can reuse surplus thermal energy and even inject it into the district heating network (DHN) (Marinova et al. 2008).This is the case with supermarkets (Karampour and Sawalha 2014), data centers (Wahlroos et al. 2017), and paper mills (Marinova et al. 2008) among other industries (Dominković et al. 2018;Nielsen et al. 2020) equipped with waste heat recovery units, heat pumps and renewable heating plants, which can consume and produce heat at different periods of the day, becoming prosumers (Brand et al. 2014).End-users in small buildings can also behave as prosumers if equipped with excess heat recovery systems (Brange, Englund, and Lauenburg 2016).
The integration of these players in the current DHS brings new challenges to the market and DHN's operation.More precisely, the prosumer will change DHS's current operating and management practices as it can change the thermal flow in the DHN, simultaneously increasing competition in the district heating market.

Literature review
Some recent works focus on legislation and the setbacks dragging the development process of DHSs.The authors in (Mengting, Rindt, and Smeulders 2022) provide a state-of-the-art review of DHSs.The main goal is to engage low-tier district heating countries.The article looks at demand prediction and the integration of sustainable resources in DHS.The work of (Wesche et al. 2021) brings a comprehensive analysis of innovation systems and what has been stopping the widespread of nonurban DHSs.The authors conduct interviews with experts in Germany to understand how policies are working and suggest methods to engage district heating in non-urban areas.Among these methods are the thriving of renewable sources, educating the population about new technologies and their benefits and ensuring the demand is always met.
At the DHN operating level, several studies have been addressing the advantages and problems that prosumers bring to the system.More precisely, prosumers can introduce operational problems related to the bidirectional flow in the DHN, differential pressure and velocity in the pipes, which may require analyzing pipe dimensions before introducing prosumers in the DHN (Dominković et al. 2018).At the market level, prosumers will enforce the complete deregulation of the market, adding competitiveness to the system.More precisely, the marginal price of prosumers is often lower than the conventional sources, thereby, improving market performance, i.e., increasing the system's social welfare (Syri et al. 2015).
Some studies are addressing how prosumers can be integrated into the market, proposing market models and frameworks to allow the exchange of excess heat recovery.Some studies have been addressing the value that one-side and two-side auctions can bring to increase the competitiveness in DHS, yet ignoring prosumer integration and DHN potential operation problems (Hailong et al. 2015;Pažėraitė and Krakauskas 2013).Another work optimizes the district heating supply in a market environment with changing conditions, while considering the stochastic behavior of the electricity market, fuel prices and weather conditions.Yet this work does not also consider the DHN operation (Moshkin and Sauhats 2016).The Open District Heating project ("Open District Heating®" n.d.) uses the pool market design based on the uniform system price to encourage industrial excess heat units (prosumers) to exchange in the market.However, the market and system operator roles are performed by the same entity.In contrast, a local thermal energy market is addressed in (Valeriy and Dmytro 2019), which accounts for the different roles of producers, consumers, market and system operators, similar to current electricity markets.The market operator is responsible for establishing the pool market, while the system operator is responsible for operating the DHN, and establishing setpoints for producers and prosumers, according to the market results and system operating requirements.In addition, reference (Frölke, Sousa, and Pinson 2022) proposes a network-aware mechanism to determine the optimal dispatch and marginal prices, minimizing production cost and considering the cost of heat losses.On the other hand, the work in (Dorotic et al. 2022) assesses the potential use of waste heat in existing networks.The authors defined an hourly model based on pinch analysis to optimize the different pipe diameters and costs based on the distances between the sources and the DHN.The methodology was tested on a supermarket and power station located in Zagreb, accounting with sensitivity analysis focused on technical and economic conditions.The main achievements pinpoint the need to reduce temperature regimes in the network to unlock new agents' entrances.In reference (Youn and Yong-Hoon 2022), a fifth-generation district heating model, where prosumers are integrated is proposed.The method's feasibility was assessed through a pilot system with fuel cell and heat pump technologies, on an hourly basis profiles of the existing network structure.The results point to a 30% energy savings rate.
Consumer-centric market models for increasing prosumers proliferation in district heating are proposed in (Faria et al. 2022) and simultaneously including real networks in Greece and Denmark (Faria et al. 2023;Sérgio Faria, Soares, and Frölke 2023), respectively (Faria et al. 2022).proposes and compares different market designs (namely, pool, peer-to-peer (P2P) and community) for district heating considering the role of the prosumer.The DHN operation is disregarded, yet providing suggestions to include it in the market operation through a product differentiation mechanism.The authors in (Penkovskii et al. 2018) model an oligopoly heating market through Cournot equilibrium, accounting for technical characteristics of the DHN, but do not consider the role and impact that prosumers can have on the market.
Table 1 summarizes the literature review over the different targets of each work.

Main contributions
None of the studies above directly addresses the interdependencies between the market and DHN operators considering the prosumer integration in the system.To overcome this gap, new models to coordinate the market and DHN problems under prosumers integration are essential.
In this scope, this work proposes a coordination methodology able to integrate market solutions in the DHN operation, ensuring a compromising solution to the whole system.This coordinative approach is inspired by the power sector (Orlandini et al. 2019).More precisely, the market framework is built upon the P2P market considering the product differentiation mechanism, i.e., producers and consumers can choose to whom they want to exchange thermal energy.Then, the market solution is validated at the DHN based on a simplified thermal flow algorithm capable of validating the setpoints of producers and consumers at the DHN.In the case of occurring DHN operating issues, the trades that create technical issues are updated in the market with a penalty based on the network distance between the peers, through the product differentiation mechanism.This iterative and coordinated process is performed until there are no issues in the DHN operation.The main contributions of the present work are threefold:  (Faria et al. 2022) Pool, Peer-to-peer and community (Penkovskii et al. 2018) Cournot equilibrium Pipe heat flow model Proposed Model Peer-to-peer Nodal flow methodology • To explore a mutual-benefit approach of the P2P market applied to DHS, considering DHN operation.By applying a decentralized market structure, it considers the product differentiation mechanism to leverage the best social welfare outcome.• To validate the network solution provided by the decentralized market structure.This is performed by an iterative process where the area of the pipe is compared with the area required to cope with the market.• To test and validate the methodology through a typical Nordic network on a one-year horizon basis with hourly demand and supply profiles.Also considering the presence of one prosumer.

Paper structure
The rest of the paper is organized as follows.Section 2 shows the iterative coordination methodology, accounting for the P2P market and DHN operation.Section 3 presents the case example based on a Nordic DHS considering multiple producers, consumers and prosumers.The proposed approach is compared with a benchmark approach.Section 4 gathers the most important conclusions of the present work.

P2P market considering product differentiation mechanism
The P2P market structure defines bilateral trades between several market participants/players (namely, producers, consumers and prosumers), to increase agents' engagement in the market.The market structure is based on a purely decentralized model, allowing each player to exchange energy with any other player in the market without any supervising entity (Sousa et al. 2019).The main purpose is to meet the requirements of agents and maximize revenue.The full P2P market design can be changed by applying product differentiation, namely, adding a benefit or penalty to each bilateral trade according to the preferred preference, such as geographical distance or heat losses.More precisely, the product differentiation mechanism allows consumers to set preferences with whom they want to exchange energy based on economic, environmental, technical or even social specificities.For instance, consumers may give priority to trading energy with their neighbors through geographical distance preference.The full mathematical formulation of the P2P market model considering product differentiation is presented as follows: where Equation (1) represents the objective function composed of the energy exchange and product differentiation mechanism, respectively.The aim is to maximize social welfare, which can also be represented by minimizing operating costs in the market.Equation (2) states that the total heat traded by an agent n at time step t in the market must be equal to the sum of the heat traded by this agent with all the other agents m 2 Ω n .Equation (3) establishes the upper and lower heat boundaries traded by agent n at time step t.Equation ( 4) sets the reciprocity of the model, meaning the trade from agent n to agent m is symmetrical to the one of agent m to agent n, for each time step t.Equations ( 5) and ( 6) define a negative or positive heat power at each time step t, whether an agent n is a consumer or a producer, respectively.Note that the prosumer behaves either as a producer or as a consumer in the market, but not at the same time step t.For each time step t, the expected net balance (generation -consumption) of the prosumer n is settled before participating in the market, thereby the prosumer knows if it needs to sell or buy heat in the market.
The product differentiation mechanism, present in the objective function, works as a benefit or penalty linked to a heat trade between two agents.Product differentiation can be addressed by different means, such as geographical distance, heat losses or CO 2 emissions (Faria et al. 2022).Within the scope of this work, geographic distance has been adopted as a consumer preference.Thus, a trade between agents n and m is penalized according to the distance and the higher the distance between them, the higher the penalty will be.The penalty factor c t;n;m , often translated as a cost, can be defined as: where D n;m is the geographical distance between agents n and m and TotalDistance is the total network distance.

District heating network operation and management
This section intends to expose the network operation and management methodology applied throughout this work.In this section, it is presented a nodal method to verify and validate the DHN operation (inspired by the power sector), once the market solution is known, instead of using a conventional optimal thermal control method.Note that this is a simplified method that does not take thermal losses into account.First of all, after the market settlement, it is necessary to determine the heat flowing in each pipeline for each time step (H t;i;j ).To do so, we assume that the B matrix is defined according to: where B is symmetric and singular.D i;k represents the geographical distance between nodes i and j.In the next step, a node is selected to be the reference one and its row and column are removed from the B matrix, defining the B' matrix.Generally, the node with the highest injected power is selected.In this case of the DHN, the node referring to the combined heat and power (CHP) unit.By inverting the B' matrix, the Z matrix is set.
Then, a row and a column of zeros are added to the Z matrix at the reference node position.After that, the angle of each node is calculated through: where P t;n represents the total heat traded/scheduled by agent n in the market, in time frame t.Whether the node linked to an agent n is a heat producer or a consumer, P n will be positive or negative, respectively.Finally, the heat in a pipeline for each time frame t can be determined as: Therefore, since DHN management is based on the heat transfer laws and the flow velocity, the volumetric flow rate in a pipe (Q t;i;j ) is given by: where C ρ is the specific heat capacity of the fluid circulating in the pipes (we assume water in the case of DHN).ρ is the density of the fluid and ΔT is the difference between the supply and return temperatures.Afterwards, it is determined the area of each pipeline A t;i;j in the DHN based on the expected flow of the fluid, represented by the Equation ( 13).If the required/calculated area is lower than the pipelines' area specifications, the market solution is feasible in terms of DHN operation.

Iterative coordination approach
The iterative process intends to find a compromising solution between the market optimization and the DHN operation, as depicted in Figure 1.The idea is to solve the market problem and verify its solution in terms of DHN operation feasibility, iteratively.
Step 1: The iterative coordination approach, starts with the market problem without the product differentiation mechanism, i.e., C n;m ¼ 0. The outcomes of the market are bilateral trades (P k� n;m ), the power setpoint of each player n (P k� n ) and the clearing price for each trade (λ k� n;m ).
Step 2: The market solution is tested and verified on the DHN operating model, checking for feasibility issues.In case the market solution is unfeasible in the DHN operation, all trades (P k� n;m ) causing the unfeasibility are selected and penalized (Step 3).Otherwise, the market solution is technically feasible and therefore the iterative process is finished (Step 5).
Step 3: In case of DHN unfeasibility, all trades causing the network issue are selected and a penalty is generated in line with the geographical distance between those agents (C kþ1 n;m ).In case the number of iterations is lower than 5, the iterative approach continues by calling step 1 to run the P2P market considering new penalties (C k n;m ).In case the grid congestion remains after 5 iterations, it is assumed that there are convergence issues and, therefore, Step 4 is activated.
Step 4: Once the penalty per transaction is insufficient to modify the market solution and find a compromising solution, it means that load consumption is higher than the DHN distribution capabilities.In this case, the only way to obtain a DHN-feasible solution is to enforce load shedding.The consumers that are causing the unfeasibility of the DHN are selected, and their scheduled heating demand in the market from the last iteration is updated by reducing it by 1%.
Afterwards, the market (Step 1) is run again with updated heating demand limits.The process is repeated by adding a new load curtailment of 1% until the DHN operation is feasible.
Step 5: The market solution is technically feasible, as it can be operated in the DHN, and the heat dispatched by the agent (P k� n ), the bilateral trades (P k� n;m ) and the market clearing price per bilateral trade (λ k� n;m ) is settled.

Case example
This section assesses the proposed model through an illustrative example of a Nordic DHN.All the input data and results of this study, including demand and supplier offers, as well as the DHN energy flow dispatch for an entire year, are available at Mendeley Data (Faria et al. 2022).

Data description
The data used in this work is based on a Nordic DHS test case available in (Faria et al. 2022), considering minor adjustments.One year of generating, consumption and pricing profiles were taken from (Faria et al. 2022), while nine row houses with the same consumption and pricing patterns were added to this test case.Note that the supermarket is a prosumer, which means it can behave as a source or sink at different time steps.That is, there are periods when the supermarket is offering heat and other periods when it is purchasing heat in the market, but never both at the same time step.The schematic diagram of the DHS is depicted in Figure 2.
Other input data required to run the P2P market model via product differentiation, were retrieved based on the THERMOS project tool ("THERMOS: Home" n.d.).This tool can provide the distance (Table 2) between agents and the pipelines' diameter (Table 3) based on the supply and return temperatures, and on the maximum heat flow in the pipelines.ENERGY SOURCES, PART B: ECONOMICS, PLANNING, AND POLICY

General results
To properly validate and compare the performance of the proposed method, we use a benchmark method.The benchmark consists of the market simulation disregarding product differentiation, i.e., the benchmark solution refers to the first step of the proposed method, corresponding to the single P2P market simulation.Afterwards, the iterative process starts.Figure 3 shows the number of hours that the DHN is congested for both the benchmark and proposed iterative methods.One can see that, in the worst case of congestion, 38 iterations are necessary to reach a feasible network operation, where no pipelines are congested.When considering the benchmark, there are 166 hours with network burdens in at least one pipeline, since no penalty based on the distance is applied and the market is settled in a standardized way.Once the iterative model is placed and product differentiation is applied (Iteration 1), the number of hours with network congestion drops to just 11, which means that 93.37% of congested hours are solved in a single iteration.In iteration 5, load curtailment is applied and another hour is cleared.After that, the iterative process from Figure 1 continues and the last pipeline to get a feasible result is the one connecting the CHP to node D at hour 5962.
Table 4 gathers the overall revenue and energy dispatch results for both methods, accounting for iterations 1 and 38.Looking at the results from the benchmark and iteration 1, one can see that CHP is the most affected agent in the iterative process since the dispatched heat decreases by about 8%.In regards to other agents, the opposite effect is shown, the dispatched heat increases, as these are the closest peers to the consumers.This is expected since distance preference is used in the product differentiation mechanism.The total load also decreases as expected and the 70% threshold is met in iteration 1 for time frames in which network management is unreliable.From then until iteration 4, there are no substantial differences in results, because the penalty from product differentiation is not enough to achieve feasible results.
From iteration 5 onwards, load shedding is mandatory to tackle network issues.All agents are getting the same revenue and dispatched heat from iterations 1 to 39, except the CHP, pointing out that the major management burdens are caused by the pipelines used by this agent.A revenue decrease of less than 0.07% is stated when analyzing the load revenue after the first iteration, enhancing the good performance of the method while accomplishing network feasibility.
In order to conduct a rigorous comparison and validation of the model, the methodology employed in this study was juxtaposed against a more conventional approach, namely (Frölke, Sousa, and Pinson 2022).As onde can see (Table 5), the results present a high degree of simililarity, which provides a validation for the methodology herein.

Individual hour assessment
By analyzing an individual hour like 2613, one can understand what is happening in each iteration and the effects of the iterative process on the market.The benchmark presents overload in 4 pipelines across the network.Looking at Figure 4, it can be seen that 3 of these lines manage to solve network congestion after the first iteration.After iteration 4, the pipeline CHP-D is still congested.From there on, the load shedding process starts and all heat consumers supplied by the CHP curtail the load to release congestion level in the pipeline CHP-D.The CHP, as a major heat producer, is supplying almost all consumers (except C32 to C36, the farthest ones), which forces a load decrease in all downstream pipelines, justifying the decrease in the level of load of pipelines that do not have any congestion problem.When network management is finished (Iteration 28), the market is settled and the iterative process is completed for this hour.

Congested pipeline diameter increase
A potential solution to solve congestion in pipelines is to increase its diameter instead of constraining the market, as we proposed in this study, although it is a very expensive solution.Thus, we have increased the diameter of the congested pipes (CHP-D, D-E, E-G to 40 mm from 32 mm, and G-M to 32 mm from 25 mm) to test whether this solution is sufficient to solve all the aforementioned congestion problems.
As expected, the problem reaches convergence faster, requiring only an iteration.The benchmark results are the same, as the network constraints have not yet been applied.When considering the entire year, only 6 hours have a network overload.The distance penalty is enough to manage the network congestion, therefore, the problem is solved in a single iteration.When considering the yearly revenue from the heat consumers, there is a decrease of about 0.09%, while for the initial diameters, there is a decrease of 1.62% in load revenue from the first iteration until the iterative method converges.Furthermore, this solution achieves a higher load demand (1.53%) than the initial one.This kind of trade-off solution must be addressed by network operators.

Key performance indicators
To properly understand the outcomes of the proposed methodology, some Key Performance Indicators (KPIs) have been computed and presented in Pipeline loading (%) the level of participation of each source in the market (whether or not one agent is participating in each time step) (Faria et al. 2022).
According to Table 6, one can see that no major differences are spotted in the ADG indicator while keeping the pipes' diameter, which is supported by the small differences in the dispatched heat when in the presence of network congestion.Conversely, when comparing with the diameter increase case, there are some gaps.For instance, the CHP's higher participation (since it is the larger heat producer and is not so constrained by the pipes' width) is supported by the higher ADG, whereas the supermarket, data center and heat pump experience a drop in this indicator due to CHP higher availability and prices competitiveness.Regarding the SPM (which indicates the market share -in percentage -of a source participating in the market), there are some fluctuations related to the fact that some sources are called upon to supply heat when the DHN is constrained.Through this indicator, one can perceive that CHP is always supplying in the same periods because it presents the same value over the simulated scenarios (45.38%).This implies that this agent is getting constrained by the DHN, but this limitation does not necessarily cut off its entire generation, it only partially cuts it off.
In addition, there are also other fairness indicators, which are directly linked to the allocation of resources in the market.The goal is to size the relationships amongst the different agents and if a fair market is getting established.The Quality-of-Service (QoS) indicator evaluates the fair heat distribution in the system, i.e., if all sources dispatch the same heat amount, this indicator would equal 100%.Min-Max indicator (MiM) states the difference between the minimum and maximum heat consumed by each agent in each time stamp.Quality of Experience (QoE) specifies consumer satisfaction concerning the heating price (Faria et al. 2022).These indicators are present in Table 7.
In general, the indicators do not swing much according to the scenarios, which is expected, since no major differences are disclosed regarding fairness.The low values denoted by the QoS, meaning an unbalanced market, are in particular linked to the higher capacity of the CHP when compared to other agents, collecting the largest share of supply.The same holds for the consumers' side, since the MiM also presents lower values, making it evident that consumers are not balanced as well.QoE points to the satisfaction of each agent regarding the perceived price and the price other agents are paying.For instance, when diameters are upgraded, there is slightly higher freedom for agents to select the peer to trade with, which increases the QoE for this scenario.

Computational performance
All the simulations were carried out using GUROBI solver ("GUROBI OPTIMIZATION," n.d.) on an Intel i7 2.10 GHz processor with 8 GB RAM.The model encompasses 2070 variables for each period, which means that for one year 18,133,200 variables are considered.One iteration, where every hour of the year is handled both by the market and the network, takes about 4 minutes to run.

Discussion
In general, this work is in line with those in the recent literature.The prosumer concept and the possibility of reusing excess heat and making a profit from it is attractive and can engage many industries in this type of system.That is, the focus of recent research studies in this area is to open the market to a decentralized structure by improving competition and allowing bilateral trading between the different agents.The work of (Frölke, Sousa, and Pinson 2022) also proposes a peer-to-peer strategy to promote local consumption, but the network management is devoted to reduce heat losses.In (Hailong et al. 2015) it is found several pricing mechanisms to be applied in decentralized structures where the shadow price method is in focus, matching this study.The DHN operation cannot be disregarded, since it plays a crucial factor in the district heating operation.Many studies are already addressing this topic with complex methods, however with a significant computational burden.These works prove that it is possible to couple these two subjects by gathering feasible results to aid the decision-makers in handling this type of complex system.In addition, this work also allows raising awareness for this issue, since there is still little research on this specific subject.

Conclusion
Given the evolution witnessed in recent years of district heating, this work also aims to contribute to this, presenting a methodology to face the inconveniences that a decentralized market may bring to the DHN operation.Through penalties on the trades that are causing congestion in the pipelines (product differentiation mechanism), a market dispatch reallocation can be performed to validate the market and assist the DHN operator.
The overall results indicate that the implemented solution is effective in finding and dealing with heat flow in the network.Only in 1.8% of the hours, network troubles are found and only in 0.12% of the hours, these problems are not fixed after applying product differentiation.These burdens are kept until iteration 5, meaning that there is only a partial load shedding in 11 hours of the entire year, which causes a minor impact on the earned revenue.Note that the proposed iterative method makes strategic decisions, cutting only the loads causing the flow congestion.A revenue decrease of 0.07% was noted on the load side, which is acceptable assuming the network burdens are solved for the entire year of operation.DHN with an improved pipeline diameter was also analyzed to test the performance of the algorithm, and a faster solution was found.This might be important, especially in investment planning to avoid future DHN problems.A significant conclusion is that the proposed iterative approach can be of great interest to the district heating market and network operators, as it can provide a trade-off solution between the market and network operation.Furthermore, this methodology presents a simple and effective computational solution to handle DHN operation and management.
Future work will focus on improving the developed method, considering a more complex and accurate DHN operating model.Other features will also be implemented, for instance, using CO2 signals or global heat losses as preferences in product differentiation.In addition, the proposed method will be tested and validated in a larger case example, aiming to assess the method's flexibility and scalability.

Figure 3 .
Figure3.The number of network congested hours for the benchmark and iterative method (over iterations).

Figure 4 .
Figure 4. Level of congestion in several pipelines at hour 2613.
of agents n Ω m Set of agents m Ω c Set of consumers Ω p Set of producers Ω pip Set of pipelines

Table 1 .
Synthesis of the studied works.

Table 2 .
Distance between agents.

Table 4 .
Total revenue and heat dispatched for each agent type.

Table 5 .
Comparison between the methodology and a conventional method.

Table 6 ,
namely, Average Dispatched Generation (ADG) and Successful Participation in the Market (SPM).ADG represents the average dispatched heat from each source, based on its available heat for each time step, while SPM indicates

Table 6 .
Results of ADG and SPM indicators.

Table 7 .
Results of fairness indicators.