District heating networks (DHNs) are crucial for sustainable urban heating. Optimising their management enhances energy efficiency and reduces environmental impact by utilising advanced monitoring technologies for real-time data collection and machine learning algorithms to predict heat demand and fine-tune system parameters. This paper presents the design and initial results of an optimisation algorithm aimed at improving district heating operations.
This study proposes a hybrid approach that combines simulation, machine learning and decision-making tools to optimise DHN operations. A grey-box methodology, which integrates both physics-based and data-driven models, is employed. The approach leverages monitoring data and contextual information to enrich decision-making processes and improve operational efficiency.
Initial results suggest that supply temperatures in the generation systems can be reduced by 3°C–5°C while maintaining a 21°C comfort set-point in the buildings. This temperature reduction translates into energy savings of approximately 5% for the entire DHN.
The primary limitation is the availability of data, particularly regarding the characterisation of the DHN. Accurate thermal properties of the distribution system are essential for modeling its behavior, but these characteristics are not always well-documented by operators.
The proposed design demonstrates improved accuracy over current district heating optimisation trends due to the integration of contextual data. This allows for more precise fine-tuning of operational parameters, resulting in enhanced energy generation and distribution efficiency.
Introduction
District heating networks (DHNs) play a crucial role in providing efficient and sustainable heating solutions for urban areas. These systems centralise heat generation for multiple users, but their high infrastructure costs make optimisation essential. Effective management of DHNs maximises energy efficiency, reduces environmental impact and ensures a reliable heat supply. Advanced monitoring and control systems enable operators to continuously collect data on temperature, flow rates and pressure throughout the network. This real time data allows for the quick identification of issues such as heat losses or inefficiencies, enabling prompt corrective action.
Efforts to optimise DHNs typically focus on refining parameters such as supply temperatures, flow rates and pressure levels. Advanced control systems and algorithms, including machine learning models and nonlinear optimisation techniques, are used to accurately predict demand and adjust operations dynamically in real time (Jiang et al., 2014).
In recent years, the literature has explored a variety of approaches to improve the design and operation of DHNs. Studies have proposed optimisation methods ranging from deterministic and heuristic techniques (Dorfner and Hamacher, 2014; Sarbu et al., 2019) to machine learning-based heat demand forecasting (Jiang et al., 2014; Reynolds et al., 2018). Techniques such as neural networks, support vector machines and ensemble methods have demonstrated effectiveness in this area. Furthermore, artificial intelligence algorithms such as genetic algorithms and particle swarm optimisation have shown promise in improving cost-effectiveness and thermal storage utilisation (Wierzbiński, 2021; Schindler et al., 2023). The study by Reynolds et al. (2018) reported significant cost savings compared to rule-based methods, with increased thermal storage capacity. Specifically, optimisation using load percentage control resulted in 12.7% savings compared to rule-based controllers, and incorporating 1000 kWh of thermal storage raised the savings to 22.6%. Nevertheless, these studies typically focus on either the demand side (buildings) or the generation side (boilers), often neglecting the role of the distribution network itself. This optimisation approach is being implemented in one of VEOLIA's DHNs, specifically in the FASA district of Valladolid, Spain (Serroni et al., 2023). The network serves 20 buildings, each connected to its own substation and is powered by three boilers – two biomass and one gas-fired for peak demand support.
Moreover, while advanced mathematical models and control systems (e.g. Krug et al. (2021), Schindler et al. (2023)) have demonstrated improved operational performance, they frequently lack the integration of contextual information, such as building-specific features and district-level characteristics, which are essential for more accurate predictions and decision-making. This gap has been highlighted in a recent review by (Hernández et al., 2024), indicating the need to combine physics-based and data-driven models to fully leverage operational and contextual data for DHN optimisation.
The integration of smart sensors and the Internet of Things (IoT) allows artificial intelligence to analyse operational data, leading to more informed decision-making in system management (Baicu and Voican, 2023). Research into dynamic pricing models and demand response strategies has encouraged consumers to adjust heating patterns based on real-time energy availability and pricing, promoting more efficient energy use (Muzik and Vostracky, 2020). IoT technologies, such as weather forecasting and demand response systems, enable dynamic load balancing based on real-time data. By adjusting supply temperatures and other operational parameters in response to fluctuating demand and external conditions, energy waste can be minimised. Studies have shown that optimised control systems can reduce energy consumption by up to 17% (Schindler et al., 2023; Krug et al., 2021).
This paper presents a novel hybrid (grey-box) optimisation approach that explicitly integrates both physics-based simulation models and data-driven demand forecasting to improve the operational efficiency of DHNs. Unlike most previous studies that focused solely on the generation or demand side of DHNs, this work extends the analysis to the often-overlooked distribution network, capturing thermal losses and leveraging contextual building data to refine operational parameters, enabling a more comprehensive analysis of the DHN operation. The application to a real-world network in Valladolid, Spain (Serroni et al., 2023), further highlights the practical relevance of the methodology. Moreover, by incorporating actual monitoring data (Supervisory Control and Data Acquisition (SCADA)) and enriching these data with static building information (CityGML), the approach not only provides more accurate operational insights but also enhances replicability and adaptability to other networks. These features represent a significant advancement over early works in the field and demonstrate the potential for broader application in European district heating systems aiming to meet climate-neutral targets.
Compared to existing grey-box and digital twin approaches, the proposed framework explicitly integrates the distribution network within the optimisation process, which is often neglected in previous studies that focus primarily on generation or demand sides. While many existing works rely either on purely data-driven models or detailed physics-based simulations, the proposed approach combines both perspectives while incorporating contextual building information (e.g. CityGML), enabling a more flexible and scalable solution.
Despite the gaps discussed by the authors Hernández et al. (2024), the present paper extends these observations by focusing on the operational implementation of such a grey-box model that not only overcomes these gaps conceptually but also demonstrates preliminary quantitative results in a real application context. Thus, the contribution of this work is twofold: (1) it provides a methodological advancement through the integration of contextual data and physics-based models and (2) it validates this approach through initial performance data in an operational DHN system.
The remainder of this paper is structured as follows: first, we provide a detailed explanation of the methods and tools used to design the optimisation algorithm. Next, we describe the conceptual approach, outlining the components and modules that form the basis of the system. Finally, we present the preliminary results, including a detailed description of the use case and discuss the conclusions and future directions.
Methods and tools
The work is developed within the European (EU) project DigiBUILD (DigiBUILD, 2022), whose objective is to transform traditional, siloed approaches to building management into a unified, digital and smart building ecosystem. By merging diverse data sources and placing stakeholders at the core, the project aims to create an inclusive environment for knowledge exchange, co-design user-oriented services and develop an open, interoperable and cloud-based toolbox. This toolbox enhances decision-making, performance monitoring, planning, policy-making and investment strategies.
Following the project approach, the methodology has consisted of a set of steps as depicted in Figure 1, which are also explained below:
The flowchart illustrates the methodology of a district heating optimization system. The process begins with the characterization of the district heating (DH) system, which includes buildings, topology, thermal features, and a CityGML model. This information is fed into a simulation engine that calculates thermal losses, pressure losses, DH behavior, and allows for user customization. The outputs from the simulation engine are then used in a data-driven algorithm that considers building features, clustering, and demand prediction. The final step is optimization, which focuses on cost minimization, CO2 emissions avoided, and optimal management of boilers. The flowchart shows a sequential process with arrows indicating the flow from one step to the next, and each step is represented by a labeled box.District heating optimisation system methodology
The flowchart illustrates the methodology of a district heating optimization system. The process begins with the characterization of the district heating (DH) system, which includes buildings, topology, thermal features, and a CityGML model. This information is fed into a simulation engine that calculates thermal losses, pressure losses, DH behavior, and allows for user customization. The outputs from the simulation engine are then used in a data-driven algorithm that considers building features, clustering, and demand prediction. The final step is optimization, which focuses on cost minimization, CO2 emissions avoided, and optimal management of boilers. The flowchart shows a sequential process with arrows indicating the flow from one step to the next, and each step is represented by a labeled box.District heating optimisation system methodology
Preparing the audit and data inventory of the case study. In this initial phase of the project, the user requirements were collected, resulting in a set of use cases to be deployed. One of them is the purpose of this work, i.e. providing a decision-making tool to optimally manage the district heating resources. Therefore, the key elements (i.e. buildings, boilers, substations…) were compiled to understand how the network and its topology, including the thermal characteristics of the network and the available data (both operational information and contextual data).
Modelling the network in CityGML (Geography Markup Language) (Open Geospatial Consortium, 2024) to represent and integrate the different thermal features for each one of the elements of the network.
Designing the solution based on the simulation and optimisation modules. Firstly, a CityGML model is used to simulate the behavior of the network under different conditions, determining the thermal and pressure losses that are produced in the distribution network. They are mainly due to thermal insulation of pipes and losses in the valves and heat exchangers. The simulation engine was built upon the DHNx Python library (DHNx, 2024), which provides a framework for modeling and optimising district heating and cooling networks. Secondly, the data-driven algorithm is able to obtain the optimal operational parameters. Here, the buildings are classified according to static properties, such as orientation, shadowing façades, window thermal characteristics or heated area, among others. Based on the clustering, the thermal demand of the buildings is easily determined to run the optimisation to cover the energy needs (demand plus thermal losses). This demand forecasting has been developed under machine learning models such as linear regression and clustering techniques by using scikit-learn.
Optimising the energy supply by the boilers to ensure the aforementioned energy needs are complied. Three main objectives are followed by the algorithm: (1) Minimize the cost of the energy, (2) Reduce CO2 emissions by maximising the renewable contribution and (3) Provide better-informed management strategies to the boilers' operator with the aim of increasing the life cycle (i.e. through load balancing). The optimisation module was also developed in Python, leveraging nonlinear solvers available in SciPy and Pyomo.
The proposed methodology is implemented with the objective of being adaptable and replicable. While the specific implementation in this paper focuses on a DHN in Valladolid, Spain, the methodology is designed to be generalisable to other DHNs or heating/cooling systems. It leverages modular tools that can be adapted to different generation systems (e.g. waste heat, combined heat and power plants) and renewable energy sources (e.g. geothermal, solar thermal) beyond the photovoltaics (PV) integration described here. The data-driven and simulation-based components rely on widely adopted, open-source libraries and can be extended to include different generation and distribution scenarios.
The main advantage of this approach is the ability to integrate real operational data with contextual information, providing a more accurate and site-specific optimisation compared to purely data-driven or purely physics-based models. In addition, it allows customisation, which was performed by extending the DHNx components and integrating additional data pipelines for contextual and operational data based on the district heating topology. The use of open-source libraries ensures flexibility and encourages replicability, while custom modules were developed to incorporate contextual features (e.g. building geometry, thermal envelope characteristics). However, the approach depends on the availability and quality of operational and static data, which might limit its application in cases where detailed building or network data are not accessible. Another limitation is that the current forecasting approach relies on relatively simple machine learning techniques (e.g. linear regression), which may need to be expanded in future work to more complex models like random forests or gradient boosting for enhanced accuracy.
In terms of input data, Table 1 summarises requirements to operate the digital twin and its associated services, showing the data source and purpose.
Summary of input data for the digital twin and associated services
| Data | Source | Use in the digital twin |
|---|---|---|
| Building static data | CityGML model | Geometric and thermal representation |
| Operational data (SCADA) | Network operator | Real-time monitoring, historical trends |
| Weather data (forecasted HDD) | External meteorological services | Demand forecasting and optimisation inputs |
| Generation system parameters | Boiler-PV specs | Modeling heat generation and distribution |
| Thermal losses | Derived from DHNx | Simulation of pipe and substation losses |
| Data | Source | Use in the digital twin |
|---|---|---|
| Building static data | CityGML model | Geometric and thermal representation |
| Operational data (SCADA) | Network operator | Real-time monitoring, historical trends |
| Weather data (forecasted HDD) | External meteorological services | Demand forecasting and optimisation inputs |
| Generation system parameters | Boiler-PV specs | Modeling heat generation and distribution |
| Thermal losses | Derived from DHNx | Simulation of pipe and substation losses |
To apply this methodology, a digital twin is employed, defined as a virtual representation of an object or system that reflects the physical object accurately and is updated in real time. It leverages simulation, machine learning and reasoning to support decision-making, with flexibility to accommodate different levels of detail (Ji-Soo et al., 2021). The benefits are evaluated from the perspective of the network operator, focusing on minimising overall system operational costs and ensuring reliable supply while meeting end-user comfort requirements. Future work may extend this framework to include more detailed analyses of end-user economic impacts.
District heating network optimisation approach
The methodology outlined above culminates in the solution presented in Figure 2, which is composed of several key components. Two main elements are distinguished: the district digital twin and the services. While the digital twin simulates the behavior of the network, it primarily represents the physical aspect of the system – the “white” side of the grey-box approach. In contrast, the services provide data-driven intelligence to the digital twin, representing the “black” side of the approach. Together, these components form a comprehensive system for optimising district heating operations. Finally, the user of the digital twin refers to the DHN operator, who can adjust input parameters in the digital twin, such as inlet temperature set-point or energy prices, among other, to simulate different scenarios (although this part is out of the scope of the work presented here).
The diagram illustrates the district heating optimisation algorithm concept. It is divided into two main sections: District Digital Twin and Services. The District Digital Twin section includes DHIM, SCADA, Data mart, and DHNx. DHIM, which stands for District Heating Information Model - CityGML, provides network topology. SCADA, which stands for Operation data, provides real-time operation parameters. These parameters are fed into the Data mart, which then provides data to DHNx, the District Heating Performance Simulation, for predicting heat and pressure losses. The Services section includes Production Forecast and Performance Optimisation. Production Forecast uses demand profiles and PV production prediction to provide data for services. Performance Optimisation uses this data to recommend operation parameters. User-edited operation parameters are fed back into DHNx, completing the loop.District heating optimisation algorithm concept
The diagram illustrates the district heating optimisation algorithm concept. It is divided into two main sections: District Digital Twin and Services. The District Digital Twin section includes DHIM, SCADA, Data mart, and DHNx. DHIM, which stands for District Heating Information Model - CityGML, provides network topology. SCADA, which stands for Operation data, provides real-time operation parameters. These parameters are fed into the Data mart, which then provides data to DHNx, the District Heating Performance Simulation, for predicting heat and pressure losses. The Services section includes Production Forecast and Performance Optimisation. Production Forecast uses demand profiles and PV production prediction to provide data for services. Performance Optimisation uses this data to recommend operation parameters. User-edited operation parameters are fed back into DHNx, completing the loop.District heating optimisation algorithm concept
The district digital twin represents the operation and behavior of the DHN and consists of two key datasets: (1) static data and (2) operational data. The static data, also known as the District Heating Information Model, is built on a CityGML model to enhance the operational data (time series). This model captures the network topology using elements from the DHNx Python library (DHNx, 2024). This library is a toolbox for optimising and simulating district heating and cooling systems. It helps answer key questions such as how heat losses depend on inlet and return pipe temperatures, ambient temperature, the energy required by pumps to overcome pressure losses and how these factors behave when supply temperatures are adjusted. The topology includes: Producer (heat producers such as boilers), Consumer (heat consumers such as buildings), Fork (nodes where multiple pipes meet) and Pipe (double pipes for feed and return that connect nodes).
Additionally, the model incorporates thermal characteristics such as mass flow, inlet temperatures, temperature drops at substations and the length and diameter of pipes, among other details. Figure 3 illustrates the CityGML model created to represent the DHN topology depicted in Figure 4, and further details about the buildings and circuits will be provided in section titled Use case description.
An illustration of a 3D model representing a district heating network. The model consists of various blocks connected by lines, symbolizing the buildings and pipes (pathways through which heat is transferred) for the distribution network, as well as the different components and connections (forks) within the network. This model is used to visualize and manage the district heating network, ensuring efficient distribution and maintenance.CityGML model for the district heating network
An illustration of a 3D model representing a district heating network. The model consists of various blocks connected by lines, symbolizing the buildings and pipes (pathways through which heat is transferred) for the distribution network, as well as the different components and connections (forks) within the network. This model is used to visualize and manage the district heating network, ensuring efficient distribution and maintenance.CityGML model for the district heating network
The diagram illustrates a district heating network topology with three circuits branching from a central thermal generation source. Circuit 1 includes nodes labeled B1 through B7, Circuit 2 includes nodes labeled B8 through B11, and Circuit 3 includes nodes labeled B12 through B20. Each circuit is a linear sequence of nodes connected by lines, indicating the flow of heat from the thermal generation source to the end nodes. Additionally, a PV generation source connects to node B20, indicating an integration of photovoltaic generation into the network.District heating network topology
The diagram illustrates a district heating network topology with three circuits branching from a central thermal generation source. Circuit 1 includes nodes labeled B1 through B7, Circuit 2 includes nodes labeled B8 through B11, and Circuit 3 includes nodes labeled B12 through B20. Each circuit is a linear sequence of nodes connected by lines, indicating the flow of heat from the thermal generation source to the end nodes. Additionally, a PV generation source connects to node B20, indicating an integration of photovoltaic generation into the network.District heating network topology
The second dataset is the dynamic data, also known as operational parameters, or SCADA. SCADA is the network operator's monitoring system, which provides real-time information on the working conditions of the network elements (pumps, valves, boilers, etc.). It also stores historical data in a persistent database, allowing for the analysis of past operational parameters.
Both static and dynamic datasets are combined in a data mart, creating an enriched time series dataset. This dataset not only records time-based information but also includes contextual data to provide deeper insights. The data mart serves as the source for the simulation engine, referred to as the District Heating Performance Simulation, which is implemented using the DHNx Python library (DHNx, 2024). The simulation results provide insights into thermal losses across the distribution network based on its size.
On the services side, two main blocks are integrated. The first focuses on predictive services, while the second is dedicated to resource optimisation. In terms of forecasting, the goals are twofold: (1) to predict the thermal demand of the buildings and (2) to forecast the contribution of PV to the thermal network (power-to-heat). Both objectives use data-driven approaches, with machine learning techniques applied to develop energy models. For buildings, the thermal needs over a 24-hour horizon are estimated, while the second approach predicts the renewable energy contribution to the network over the same period. In both cases, regression methods have been implemented. On the one hand, random forest is envisaged for PV forecasting (out of the goals of this paper), while linear regression is applied in the case of building demand estimation.
The second block is the optimiser, which determines the optimal temperatures to minimise energy consumption from the boilers and prolong their lifecycle through load-balancing mechanisms. This module takes as input the real demand of the network, calculated as the sum of the buildings' energy demand, distribution losses and the renewable energy contribution.
Finally, user interaction is crucial – not only for any digital twin concept but especially in this user-centric approach. Network operators can modify key DHNx attributes, such as the temperature delta at the consumers' end or the supply temperature from the boilers. This re-parametrisation allows operators to assess thermal and pressure losses under various conditions or scenarios and generate recommendations for energy savings.
Preliminary results in the application use case
Even though the approach explained before is general, it has been defined within one use case in the DigiBUILD EU project (DigiBUILD, 2022). Next sections describe the specific use case, as well as the preliminary results.
Use case description
A DHN located in Valladolid, Spain, has been selected as a pilot for the validation of the digital twin. The climate in Valladolid is continental, where the summers are short, warm, dry and mostly clear, while the winters are very cold and partly cloudy. Over the course of the year, the temperature typically varies from 0°C to 30°C.
Figure 4 shows the network topology. It is composed of twenty buildings that accounts for 22,382 heated square meters distributed in three circuits. Buildings were built from 60's with the same height (4 floors), with the exception of the tower (B20) that is 14 floors high. The average energy demand is about 134.98 kWh/m2. Seven buildings are connected to the first circuit, four to the second and nine to the third and last circuit. The tower is also equipped with BIPV (Building Integrated PV).
Figure 5 shows the energy systems interconnection. Three boilers (two biomass and one gas-fired) are the generation systems to cover the energy demand of the buildings (i.e. space heating and domestic hot water needs). Apart from this, the PV systems is heating a resistance to boil water and contribute to the DHN. Additionally, this PV system is used for electricity needs, such as pumps, valves, etc., although connection to the grid is also made. Finally, monitoring equipment is available and connected to a remote building monitoring and operation system (the aforementioned SCADA).
A diagram of a district heating network system. The diagram illustrates the components and flow of a district heating network. On the left, biomass and gas-fired boilers are depicted, which are connected to a district heating network. This network supplies thermal storage, which is centrally located in the diagram. The thermal storage is connected to a building, which is monitored and operated remotely using a laptop. The building is also connected to electrical panels and the grid. Solar panels (PV) are shown above the building, indicating a source of renewable energy. Arrows indicate the flow of energy and information between these components, showing how the system integrates various energy sources and manages building operations.District heating network systems
A diagram of a district heating network system. The diagram illustrates the components and flow of a district heating network. On the left, biomass and gas-fired boilers are depicted, which are connected to a district heating network. This network supplies thermal storage, which is centrally located in the diagram. The thermal storage is connected to a building, which is monitored and operated remotely using a laptop. The building is also connected to electrical panels and the grid. Solar panels (PV) are shown above the building, indicating a source of renewable energy. Arrows indicate the flow of energy and information between these components, showing how the system integrates various energy sources and manages building operations.District heating network systems
Numeric results
This section provides the preliminary results of the study. The presented digital twin is an initial implementation and its results should be interpreted as indicative trends rather than definitive values. The problem formulation and solving approach is described first, and then, the quantitative results obtained after the implementation are explained.
Problem formulation and solving approach
The objective of this work is to minimise the inlet (supply) temperature, Tin, of district heating generation boilers. Operating at unnecessarily high temperatures leads to increased thermal losses due to heat dissipation in the network. Thus, reducing Tin improves fuel utilisation, lowers operational costs and decreases environmental impact by reducing energy waste and emissions.
The thermal energy supplied to the system, ES, is given by (Bergman, 2011):
where Flow is the water flow rate, Cp is the specific heat capacity, and Tret is the return temperature.
To ensure proper operation, the supplied energy must satisfy the demand ED and compensate for thermal losses Qp:
Thermal losses are modelled as:
where k is the heat loss coefficient and Tground is the ground temperature. This equation highlights that reducing Tin directly decreases thermal losses by lowering the temperature gradient.
Combining (1)–(3) yields:
Solving for Tin:
Additionally, Tin must satisfy operational bounds:
where and define the allowable operating range of the inlet temperature.
In order to minimise the value of Tin during dynamic operation, an estimate of the energy demand is required. The predicted demand is denoted by and is obtained using a model based on the Heating Degree Days (HDD) parameter. HDD is defined as:
where Tbase is the base temperature (18°C in this study), and the mean outdoor temperature is:
As an initial approach, a linear regression model has been used to estimate the demand:
The parameters w0 and w1 of the linear model are obtained by minimising the mean squared error over N training samples from a dataset containing pairs of observed HDD values at day i (HDD(i)) and the corresponding energy demand on that day :
Finally, the inlet temperature is computed as:
The overall procedure is summarised in Algorithm 1.
Computation of optimised Tin
Input: , , Tbase, Tret, Flow
Output: Tin ; HDD ← max(0, Tbase − Tmean); ; ;
return Tin
Results and discussion
Figure 6 illustrates the relationship between demanded energy and HDD considering two full years. In grey, it shows the aggregated energy use for each day of the month across all months. That is, the sum of the energy use from the 1st day of January, February, etc. The graph then provides a representative daily trend for the entire year, with particular attention to the heating season (approximately from September to April). In blue, the graph presents the aggregated HDD values for each day throughout the same period. This dual-axis representation facilitates the observation of day-to-day correlations between outdoor climate conditions and heating energy demand.
The bar graph illustrates the correlation between the used energy for space heating in kilowatt-hours (kWh) and heating degree days (HDD) per day of the month, aggregated over the years 2018-2019. The x-axis represents the days of the month, ranging from 1 to 31. The y-axis on the left measures the used energy for space heating in kWh, ranging from 0 to 70,000 kWh. The y-axis on the right measures the HDD, ranging from 60 to 110. The graph features two data series: one represented by gray bars indicating the used energy for space heating and another represented by a blue line indicating the HDD. The gray bars show fluctuations in energy usage throughout the month, with notable peaks around the 10th, 20th, and 30th days. The blue line shows a general trend of higher HDD values in the middle of the month, peaking around the 20th day, and then declining towards the end of the month. All values are approximated.Correlation between the aggregated energy demand (used energy for space heating) and aggregated HDD
The bar graph illustrates the correlation between the used energy for space heating in kilowatt-hours (kWh) and heating degree days (HDD) per day of the month, aggregated over the years 2018-2019. The x-axis represents the days of the month, ranging from 1 to 31. The y-axis on the left measures the used energy for space heating in kWh, ranging from 0 to 70,000 kWh. The y-axis on the right measures the HDD, ranging from 60 to 110. The graph features two data series: one represented by gray bars indicating the used energy for space heating and another represented by a blue line indicating the HDD. The gray bars show fluctuations in energy usage throughout the month, with notable peaks around the 10th, 20th, and 30th days. The blue line shows a general trend of higher HDD values in the middle of the month, peaking around the 20th day, and then declining towards the end of the month. All values are approximated.Correlation between the aggregated energy demand (used energy for space heating) and aggregated HDD
The use of HDD in this way allows capturing seasonal and short-term variations in heating demand while accounting for temporal patterns, providing valuable input for data-driven optimisation approaches described in the study. According to the graph, it can be extracted relationship between energy and HDD is definitely derived. It is true that there exist some outliers, such as day 11 of the month. Low energy values are contrasting against the high HDD (i.e. high energy demand in terms of space heating). As well, day 20 is showing the same conclusion. For the rest of the days, there is a correlation between energy and HDD.
Cross-validation has been applied, where two years of data have been used. Real data measured by the district heating operator include the demanded energy and external temperature at a 15-minute frequency. A time series split has been then implemented in 5 folds, with 80%–20% data split for training and testing. When the optimisation problem of equation (10) was solved, equation (12) was obtained, which reflects how HDD was found to have a significant effect on energy demand during the heating season, with a t-statistic of 93.081 and a p-value less than 0.001, indicating that the slope of the regression line is significantly different from zero at the α = 0.05 level.
Thermal losses are directly calculated based on the simulations with DHNx. This simulation is performed using the digital twin described before.
It should be highlighted that the current set-point (baseline) for the supply temperature (i.e. Tin) is fixed around 87°C. Additionally, as boundary conditions, the minimum temperature cannot be less than 65°C. The assumption of a constant return temperature is based on the current operational settings of the network during the heating season. While this simplifies the energy balance, it is a realistic operational constraint in this network and allows for a practical first-order estimation of potential savings. Future versions of the digital twin will incorporate dynamic return temperature variations as time series data to enhance accuracy.
The initial results show how the temperature is usually overestimated (on the production side) to ensure the energy covers the total demand, so it requires extra power from the boilers. On average, the inlet temperature (when using the proposed Algorithm 1) could be reduced by 5.27°C, with an average inlet temperature during the validation period of 81.43°C.
To allow a comparative and quantitative result in terms of total energy use, a benchmarking against a baseline operational strategy has been incorporated. The baseline corresponds to the current rule-based operation of the DHN, where fixed supply temperature set-points are applied to ensure comfort conditions under varying demand scenarios. Table 2 presents this comparison between the baseline energy use, derived from historical SCADA data and the results obtained from the proposed optimisation framework through simulation. In both cases, energy use includes the thermal losses. The results show a consistent reduction in energy consumption across all circuits, with avoided energy values ranging from approximately 15 MWh to 43 MWh when the proposed method is used. In relative terms, this corresponds to savings of around 5%, which is aligned with the expected impact of reducing supply temperature levels while maintaining user comfort conditions (21°C).
Results for the avoided energy per circuit of the district heating network
| Circuit | Used energy (baseline) | Used energy (optimised strategy) | Avoided energy (savings) |
|---|---|---|---|
| Circuit 1 | 566707.63 kWh | 536291.36 kWh | 30416.27 kWh |
| Circuit 2 | 283353.82 kWh | 268145.69 kWh | 15208.13 kWh |
| Circuit 3 | 806468.55 kWh | 763183.86 kWh | 43284.69 kWh |
| Circuit | Used energy (baseline) | Used energy (optimised strategy) | Avoided energy (savings) |
|---|---|---|---|
| Circuit 1 | 566707.63 kWh | 536291.36 kWh | 30416.27 kWh |
| Circuit 2 | 283353.82 kWh | 268145.69 kWh | 15208.13 kWh |
| Circuit 3 | 806468.55 kWh | 763183.86 kWh | 43284.69 kWh |
This comparison provides a first-order benchmark that allows quantifying the added value of the proposed method over current operational practices. Although the analysis is based on a specific case study and simplified assumptions (e.g. constant return temperature), the consistency of the results across the three circuits suggests that the approach is robust to variations in network topology and demand distribution.
The validation of these preliminary findings was conducted by comparing the simulated energy use and inlet temperature adjustments against historical operational data from the network's SCADA system. Outlier days (e.g. day 11 and day 20) were analysed separately to ensure that deviations did not arise from modeling errors but rather from external operational factors (e.g. unusual occupancy patterns or maintenance activities). Furthermore, at this stage of implementation, the preliminary results presented here specifically address the first two optimisation objectives introduced in the section titled Methods and tools: (1) minimising energy costs by reducing inlet temperatures and (2) reducing CO2 emissions by better leveraging renewable contributions from PV. These objectives are achieved through the digital twin's recommendation of lower inlet temperatures while still ensuring user comfort (21°C) and system reliability. The third objective, load balancing to extend boiler life, will be implemented in subsequent stages of the digital twin development.
Regarding the data-driven component, relatively simple machine learning models have been adopted in this first implementation, such as linear regression for demand and PV forecasting. This choice is motivated by several factors.
First, the availability and quality of data in real operational environments are often limited, particularly in early stages of digital twin deployment. In this context, simpler models provide greater robustness and reduce the risk of overfitting, while still capturing the main relationships between climatic variables (e.g. HDD) and energy demand.
Second, the use of interpretable models facilitates understanding of the system behavior by domain experts, which is particularly relevant in operational environments where transparency and trust in the decision-support tool are essential.
Finally, the selected models allow for fast computation and easy integration within the optimisation framework, which is a key requirement for scalable and real-time applications.
Conclusions and future lines
DHNs are an important energy generation system in Europe to provide mostly heating, but also cooling. Therefore, their performance is critical to ensure the energy transition. Usually, these energy systems produce more energy than real needed in order to guarantee that the users' demand and comfortable values are ensured. This means the associated thermal losses are increased with more waste energy. Many works have moved in this direction, but always keeping an eye on the generation or demand side, neglecting the distribution part. That is why, within this work, the three elements are considered to minimise the thermal losses and, thus, reduce the energy needs. To that end, a grey-box approach has been conceptualised, where a hybrid method is defined. On the one hand, the physical model provides insights into the network topology. On the other hand, the data-driven part allows the application of intelligent algorithms.
The preliminary results have shown promising conclusions. First of all, temperature set-points for inlet water could be reduced by around 5.2°C, which also means decreasing the energy use. Approximately 5% of the energy could be avoided, which means high absolute values in terms of kWh. The use of machine-learning models allows the correlation of energy and climate conditions to forecast the real energy needs and, thus, anticipate the energy requirements.
Despite the promising results, the practical deployment of the proposed approach may face challenges related to data availability, model calibration and integration with existing operational systems. In particular, the reliance on simplified assumptions and limited datasets may affect performance in more complex or larger-scale networks. Therefore, further validation in diverse operational contexts is required before large-scale implementation.
As future work, as explained before, this is a preliminary version of the digital twin and the optimisation algorithm. First of all, the integration of the forecasting service and the load balancing algorithm should be done. Moreover, the inlet temperature has been considered as constant, while in future releases, the dynamic variation of this temperature will be included as time series data. Additionally, the machine-learning model has been based on linear regression, while future developments will consider other techniques like Random Forest, Gradient Boosting or other ensemble methods to improve prediction accuracy. These approaches will be evaluated in terms of their trade-off between accuracy, interpretability and computational cost.
Further validation under different operating conditions and extended time periods will be required to fully assess the robustness and generalisation of the method. Future work will also include the comparison with alternative control strategies and the integration of more advanced forecasting models to improve accuracy.
The authors of this paper would like to thank the DigiBUILD consortium for the support in the development. Also, the authors would like to thank the European Commission for funding the project under GA #101069658 of the Horizon Europe programme.

