# Efficient Integration of Machine Learning into District Heating Predictive Models

^{*}

## Abstract

**:**

^{4}times faster than its complex equivalent while preserving essentially the same accuracy. This approach has great potential to enhance the development of fast predictive models not just for district heating. Only open-source software was used, while OpenModelica, Python, and FEniCS were predominantly used.

## 1. Introduction

## 2. Materials and Methods

^{−1}) is a thermal mass of the node, T (K) is a temperature of a node, t (s) is time, and ${\stackrel{\xb7}{Q}}_{in}$ (W) and ${\stackrel{\xb7}{Q}}_{out}$ (W) are incoming and outgoing heat flow, respectively. The initial condition associated with this ODE is simply an initial value (unlike the complex model, the simple model cannot be initialized to a steady-state solution prior to the training process). The other component is the thermal conductor (or resistor, if preferred). It has a parameter, K, that represents its thermal conductance. The following equation describes its behavior:

^{−1}) is a thermal conductance, and T

_{1}(K) and T

_{2}(K) are temperatures of the adjacent points 1 and 2, respectively. Along with these two components, there are also models representing the boundary conditions (for supply pipe, return pipe, and ground-level surface). These boundary models look up the corresponding data from the data package generated during the data-mining process. They also evaluate absolute errors between temperature and heat flow at the boundary interfaces. The total loss for training is the weighted sum of those errors from all instances of these boundary models accumulated over time.

_{data_medium}(K) is a driving temperature of the media (one of T

_{ws}, T

_{wr}or T

_{a}), which is the only input to the simplified model, and T

_{model_surface}(K) is the average temperature also evaluated inside the simplified model.

_{1}and w

_{2}are dimensionless weights, T

_{data_surface}(K) and T

_{model_surface}(K) are temperatures of a corresponding surface, and Q

_{data_surface}(K) and Q

_{model_surface}(K) are heat flow through the corresponding surface evaluated by complex and simplified model, respectively.

## 3. Results

^{−9}.

## 4. Discussion and Conclusions

## Author Contributions

## Funding

## Conflicts of Interest

## Appendix A

#### Appendix A.1. Generating a Second-Order Advection Scheme for a Given Context

_{i}is the value of advected property y in node i, t is time, u is drift velocity, Δx is the distance of two adjacent nodes, and c

_{1}, c

_{2}, and c

_{3}are the optimized coefficients. The one-dimensional domain with normalized length was discretized into 100 elements.

**Figure A1.**Progress of optimization in matching the value of the advected property at the outlet: y

_{true}is the correct analytic solution and y

_{sol}is the numerical solution.

#### Appendix A.2. Heat Transfer Inversion

**Figure A2.**Progress in matching temperature on the opposite side of the wall, where orange is the desired temperature response and blue is the simulated response of optimized heat flux input.

#### Appendix A.3. Neural Ordinary Differential System—Lotka-Volterra System

_{i}are neural weights in a matrix form, b

_{i}are neural biases in a vector form, and x, y are the state values of the system. The weights and the biases are initialized with a value of 0.1.

**Figure A3.**Progress of OPLES in training the neural ordinary differential equation (ODE) system: Blue and orange represent the true ODE system, while green and red represent the behavior of the optimized neural ODE system.

## References

- Lund, H.; Werner, S.; Wiltshire, R.; Svendsen, S.; Thorsen, J.E.; Hvelplund, F.; Mathiesen, B.V. 4th Generation District Heating (4GDH). Integrating smart thermal grids into future sustainable energy systems. Energy
**2014**, 68, 1–11. [Google Scholar] [CrossRef] - Revesz, A.; Jones, P.; Dunham, C.; Davies, G.; Marques, C.; Matabuena, R.; Scott, J.; Maidment, G. Developing novel 5th generation district energy networks. Energy
**2020**, 201, 117389. [Google Scholar] [CrossRef] - Teleszewski, T.J.; Krawczyk, D.A.; Rodero, A. Reduction of Heat Losses Using Quadruple Heating Pre-Insulated Networks: A Case Study. Energies
**2019**, 12, 4699. [Google Scholar] [CrossRef][Green Version] - Krawczyk, D.A.; Teleszewski, T.J. Reduction of Heat Losses in a Pre-Insulated Network Located in Central Poland by Lowering the Operating Temperature of the Water and the Use of Egg-shaped Thermal Insulation: A Case Study. Energies
**2019**, 12, 2104. [Google Scholar] [CrossRef][Green Version] - Krawczyk, D.; Teleszewski, T. Optimization of Geometric Parameters of Thermal Insulation of Pre-Insulated Double Pipes. Energies
**2019**, 12, 1012. [Google Scholar] [CrossRef][Green Version] - Ocłoń, P.; Nowak-Ocłoń, M.; Vallati, A.; Quintino, A.; Corcione, M. Numerical determination of temperature distribution in heating network. Energy
**2019**, 183, 880–891. [Google Scholar] [CrossRef] - van der Heijde, B.; Aertgeerts, A.; Helsen, L. Modelling steady-state thermal behaviour of double thermal network pipes. Int. J. Therm. Sci.
**2017**, 117, 316–327. [Google Scholar] [CrossRef][Green Version] - Wallentén, P. Steady-State Heat Loss from Insulated Pipes. Master’s Thesis, Byggnadsfysik LTH, Lunds Tekniska Högskola, Lund, Sweden, 1991. [Google Scholar]
- Danielewicz, J.; Śniechowska, B.; Sayegh, M.A.; Fidorów, N.; Jouhara, H. Three-dimensional numerical model of heat losses from district heating network pre-insulated pipes buried in the ground. Energy
**2016**, 108, 172–184. [Google Scholar] [CrossRef][Green Version] - Sommer, T.; Sulzer, M.; Wetter, M.; Sotnikov, A.; Mennel, S.; Stettler, C. The reservoir network: A new network topology for district heating and cooling. Energy
**2020**, 199, 117418. [Google Scholar] [CrossRef] - Arabkoohsar, A.; Khosravi, M.; Alsagri, A.S. CFD analysis of triple-pipes for a district heating system with two simultaneous supply temperatures. Int. J. Heat Mass Transf.
**2019**, 141, 432–443. [Google Scholar] [CrossRef] - Groissböck, M. Are open source energy system optimization tools mature enough for serious use? Renew. Sustain. Energy Rev.
**2019**, 102, 234–248. [Google Scholar] [CrossRef] - GitHub—AIT-IES/DisHeatLib: Modelica Library for District Heating Network Modelling Using IBPSA Library as Core. Available online: https://github.com/AIT-IES/DisHeatLib (accessed on 11 November 2020).
- Alnaes, M.S.; Blechta, J.; Hake, J.; Johansson, A.; Kehlet, B.; Logg, A.; Richardson, C.; Ring, J.; Rognes, M.E.; Wells, G.N. The FEniCS Project Version 1.5. Arch. Numer. Softw.
**2015**, 3, 9–23. [Google Scholar] - Kudela, L.; Chylek, R.; Pospisil, J. Performant and Simple Numerical Modeling of District Heating Pipes with Heat Accumulation. Energies
**2019**, 12, 633. [Google Scholar] [CrossRef][Green Version]

**Figure 1.**Domain, mesh, and boundary conditions of the complex model, where $\stackrel{\xb7}{\mathrm{q}}$ is applied boundary heat flux, α are constant coefficients of heat transfer (α

_{s}= 600 W·K

^{−1}·m

^{−2}, α

_{r}= 600 W·K

^{−1}·m

^{−2}, α

_{a}= 20 W·K

^{−1}·m

^{−2}), T is the domain temperature, T

_{0}is a constant temperature of the Dirichlet boundary condition, and T

_{ws}, T

_{wr}, and T

_{a}are driving temperature of the adjacent media.

**Figure 2.**Driving temperatures used for training and the effect on temperature distribution inside the considered domain. The nominal values do not reflect real operational conditions, since relative values are important in inducing heat flows.

**Figure 5.**The convergence of the training process (using greedy random adaptation particle swarm optimizer (GRAPSO)).

**Figure 6.**Accuracy of the new model for the validation dataset. Indices s, r, and a correspond to interfaces of supply, return, and air, respectively. The top part shows predicted heat flows from the domain to the adjacent media; the bottom part shows the absolute difference in predicted heat flow.

Name | Description | Unit |
---|---|---|

time | simulation time | s |

dt | the time step used/chosen by the adaptation strategy | s |

T_ws | a driving boundary temperature of the water in the supply pipe | K |

T_wr | a driving boundary temperature of the water in the return pipe | K |

T_a | driving boundary temperature of the air | K |

T_avg_s | the average temperature of the inner surface of the supply pipe | K |

T_avg_r | the average temperature of the inner surface of the return pipe | K |

T_avg_a | the average temperature of the ground (top edge) | K |

Q_s | heat flow from the domain to water to the supply pipe | W/m |

Q_r | heat flow from the domain to water to the return pipe | W/m |

Q_a | heat flow from the domain to the air (through top edge) | W/m |

Q_dbcs | heat flow through locations with Dirichlet boundary conditions | W/m |

Error | error norm used for adaptation | W/m |

Dataset | Model | Execution Time on Singe Core | Execution Time Using 40 CPU Cores | Single-Core Speedup Ratio |
---|---|---|---|---|

Training | FEniCS | 1915 s | 125 s | 47,875 |

OpenModelica | 0.04 s | not performed | ||

Validation | FEniCS | 1180 s | 71 s | 51,305 |

OpenModelica | 0.023 s | not performed |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Kudela, L.; Chýlek, R.; Pospíšil, J. Efficient Integration of Machine Learning into District Heating Predictive Models. *Energies* **2020**, *13*, 6381.
https://doi.org/10.3390/en13236381

**AMA Style**

Kudela L, Chýlek R, Pospíšil J. Efficient Integration of Machine Learning into District Heating Predictive Models. *Energies*. 2020; 13(23):6381.
https://doi.org/10.3390/en13236381

**Chicago/Turabian Style**

Kudela, Libor, Radomír Chýlek, and Jiří Pospíšil. 2020. "Efficient Integration of Machine Learning into District Heating Predictive Models" *Energies* 13, no. 23: 6381.
https://doi.org/10.3390/en13236381