Peak shaving, demand response, fast fault detection, emissions and costs reduction are some of the main objectives to meet in advanced district heating and cooling (DHC) systems. In order to enhance the operation of infrastructures, challenges such as supply temperature reduction and load uncertainty with the development of algorithms and technologies are growing. Therefore, traditional control strategies and diagnosis approaches cannot achieve these goals. Accordingly, to address these shortcomings, researchers have developed plenty of innovative methods based on their applications and features. The main purpose of this article is to review recent publications that include both hard and soft computing implementations such as model predictive control and machine learning algorithms with applications also on both fourth and ﬁfth generation district heating and cooling networks.
The world’s level of urbanization is expected to increase from about 55% in 2018 to 68% in 2050, and 90% of this increment is expected to take place in Asia and Africa, which were home to about 90% of the world’s rural population in 2018. In Europe, 74% of the population lives already in urban areas today, and this percentage is expected to grow up to 84% by 2050 . Furthermore, in urban areas where the heating and cooling demand exhibits the highest density and the largest load simultaneity, a huge amount of low-grade excess heat is wasted. Moreover, for historical reasons, cities and towns have been born along rivers, lakes, and seashores that are all ambient heat sources in which utilization is highly replicable, because it is accessible right where it is needed. Even, in some cases, such as in London, the total heat wasted from secondary sources has been estimated larger than the city’s total heat demand.
Six out of ten of the top European heatwaves between 1950 and 2014 have appeared in the latest 20 years. Extreme weather events, such as wind storms and flooding, have increased in number and intensity worldwide. Some scientists claim that climate change’s evolution and consequences have several similarities with the current pandemic crisis of COVID-19, but in slow motion. Nevertheless, in the latest years, several public entities recognized the climate crisis and are going to implement serious actions to mitigate global warming effects. As a result, 2019 has been defined the year of the “climate emergency” declaration. In this context, the European Union, which already demonstrated between 1990–2018 that it is possible to decouple gross domestic product (GDP) growth from greenhouse gas emissions, set a very ambitious target to achieve carbon neutrality by 2050.
Moreover, the EU admitted that this could not be accomplished with the current commitments under the Paris Agreement that foresee a total greenhouse gas emissions reduction by only 40% in 2030 with respect to 1990 levels. To boost the global warming fighting process, the new European Green Deal set a more ambitious target that corresponds to reach a greenhouse gas emissions reduction by at least 50% by 2030 compared with 1990 levels with dedicated strategies for the different sectors. In particular, to decarbonize the heating and cooling sector and to improve the air quality in urban areas, the European Green Deal Investment Plan will support the implementation of district heating and cooling (DHC) networks. This technology is the most promising to implement circular economy principles in the heat sector by harvesting and distributing local excess heat that otherwise will be wasted. Moreover, it allows boosting the share of modern renewables to cover the heat demand of buildings that was only equal to about 13.6% in 2017 at a worldwide level.
The digital roadmap for district heating and cooling (2019), which has been developed as part of the H2020 project STORM, carefully presents how digitalization and the concept of Industry 4.0 can push forward the efficiency and operation of DHC networks, empowering their role in an integrated smart energy system. The barriers identified that could hinder the rollout of digital technologies in DHC are not technical but are mainly related to limitations in acting on the building substation, absence of business models or dynamic tariffs to stimulate the flexibility that can be provided by buildings and regulations on private data protection.
It is evident that the exploitation of innovative DHC solutions requires the whole system to operate as efficiently as possible. However, several authors have proved that faults taking place during the operation of energy systems can normally be responsible for up to 40% of their total energy use. Several factors, such as compensation actions triggered by control algorithms or lack of proper maintenance practice, can make these faults remain undetected. Indeed, the manual identification of these faults gets very complicated even if the suboptimal operation of the system is known. This makes the tasks of human maintenance operators really costly, since they only take actions on the system when the indoor environmental thresholds are not met. In this context, automated fault detection and diagnosis (FDD) methods and tools play a key role to assist building and DHC system operators.
One typical operating problem in district heating systems indicated by Frederiksen and Werner (2014)  is the heat carrier loss through water leakage. Water losses occur for several reasons and the corresponding magnitudes of losses also vary. A review of FDD methods to address this problem is presented in Section 2.1. Other operating problems are higher temperature levels due to high return temperatures caused by typical malfunctions such as set-point errors in substations and customer heating systems or short-circuit flows in the thermal grid. Since the reduction in the supply temperature is the main objective of 4GDH and 5GDHC in order to exploit renewable and low-grade excess heat sources, assuring a low return temperature is a key aspect in these innovative DHC solutions .
In order to avoid malfunctions and faults, maintenance planning becomes crucial to achieve a good service for customers and maintain an economical retrofit for owners. The concept of maintenance includes the administration, control, implementation and quality of those activities, which will ensure that design availability levels and asset performance are achieved in a reasonable way to meet economical and functional objectives. Some definitions of classic maintenance strategies that can be applied are:
There is a huge range of different fault detection (FD) techniques as classified by Granderson et al. (2017). FD methods may be model-based or based purely on process history data, both of them are also called “internally based” methods. The model-based methods depend on knowledge of the basic physical processes and principles governing those system(s) being the target of the analysis. Quantitative model-based approaches are, currently, not frequently used in commercial tool offerings, however qualitative model-based approaches including rule-based fault detection, have been largely applied to industrial environments and provide intuitive representations of engineering principles. The process history-based, also referred as “data-driven FD” is an innovative approach that does not rely upon knowledge of first principles, but on the data from the system in operation from which they may leverage some degree of engineering knowledge. These include statistical regression models, artificial neural networks (ANN), etc. Anyway, a combination of both approaches can be also found in several FDD applications. Moreover, there also exist “externally based” or hardware methods, such as visual inspection, infrared image processing or cable methods that usually are not suitable to be included in an automatic fault detection system.
The following sections present a review of the state-of-the-art fault detection approaches and algorithms that are mainly applied in DHC systems, extracted from the review paper Advanced Control and Fault Detection Strategies for District Heating and Cooling Systems—A Review 
Failures on district heating pipes are often caused by water leaks due to corrosion, mechanical impacts and insufficient or deteriorated performance of the thermal insulation solutions, as indicated by Hallberg et al. (2012) . However, some degree of leakage is impossible to be avoided during extended operation, since pipeline performance degrades over time. Therefore, an anticipated diagnosis of leakage occurrence is highly necessary to improve efficiency, reduce operating costs and protect the environment. In comparison with DHC networks, both oil/gas and water distribution networks have a longer industrial history. Thus, many established leak detection research results and applications were first applied to such applications. Some representative techniques for pipelines developed for specific fluids (oil, gas or water), different layout patterns, several lengths of pipelines as well as for a certain range of different operating conditions, can be found in.
As mentioned above, those methods found in literature are usually divided as “internally-based” (or “software-based”) and “externally-based” (or “hardware-based”), as presented in the review of Zhou et al. (2018) for leakage detection in DH networks. Zaman et al. (2020) developed and compared “software-based” solutions, both model-based and data-driven, applied through a leakage detection algorithm, whereas a good example of a physical model-based algorithm can be found in Liu et al. (2019). The latter includes a dynamic monitoring module (DMM) and a static testing module (STM): the DMM can detect larger leakages analyzing pressure waves through amplitude propagation and attenuation models; the STM, based on the pressure loss model, can detect micro-leakages, thus being able to act as an effective compensation for the DMM.
As far as data-driven methods are concerned, an application can be found in Xue et al. (2020). It consists of training a decision-tree-based ensemble ML algorithm called XGBoost, using data generated by a simplified physical model and using it to detect leakage in pipes through the collected data from pressure and flow sensors present in the DHC network and substations. A potential obstacle to replicate this approach is the fact that pressure sensors are not always available in the system.
Two interesting proprietary “hardware-based” solutions deserve mentioning. One of them has been developed by the smart meter brand Kamstrup and consists of a leakage detection system based on the analysis of the signal coming from ultrasonic flowmeter installed in substations. The other one is based on the well-known impedance method using sensing cables. When a leak takes place, the cable gets saturated with fluid, thus altering its impedance. The advantages include high accuracy in determining leak location and easy configuration and maintenance. In contrast, the installation has very high costs and wiring requirements.
In the field of image processing, infrared (IR) sensors are able to capture variations in the heat flow caused by underground fluid leaks, and then show them as hot spots in the DHC system route. This process can be accomplished on the ground, but the availability of high thermal sensitivity and spatial resolution thermal imaging systems mounted on an aerial platform has become the most effective procedure. For instance, data collection can be conducted by an aircraft or drone, which flies over the target area with a camera mounted to the airframe and looking straight down to the ground. This way, thermography reveals sources of heat and the relative differences in temperature from one object to another, as presented in. In contrast, postprocessing of IR images may be computationally expensive, and their analysis could lead to false negatives because some color differences caused by a leakage could be almost inappreciable. Some authors such as Zhong et al. (2019) and Hossain et al. (2020)  have developed ML algorithms to improve postprocessing and satisfactorily make the difference between true leakages and other potential causes.
Nowadays, a current preconceived idea considers that most of the end-use substations in district heating systems work well. This means that it is taken for granted that the facilities deliver or use exactly the right amount of energy to cover customer’s needs. Gadd and Werner (2015) showed that this is not the case and almost three-quarters of the substations analyzed present faults or symptoms of faults, which could lead to higher return temperatures. This fact is unacceptable especially in 4GDH and 5GDHC, where it is important to achieve a very low return temperature.
In an analysis of the most common faults in DH substations performed as part of the H2020 project TEMPO, a survey-based study by Månsson et al. (2019) found that the largest fault category was leakages (33%), closely followed by faults in the customers’ internal heating systems (31%). This fact reveals that it might be difficult for the energy utilities to get access to all faults present in the customers’ facilities because the DH operators are only usually allowed to access to the substation and not to the internal heating system. Therefore, utilities must make important efforts to establish a good relationship with customers. Common practice to achieve this is to have maintenance contracts with the customers or to include free of charge inspections in the DH agreement. In addition, a proper fault detection system must include customer-sited substations as the main element to inspect. This can be done by analyzing the components of the substation individually, or/and looking at the customer heat load patterns. In the following sections, a literature review of FDD methods for different parts of customer-sited DHC stations is presented.
The heat load in a DH/DC system is the sum of individual heat loads from all customer-sited substations connected to the network and the distribution heat losses. DH/DC heat generation plants might be affected by malfunctions in customer substations and building HVAC systems, which are propagated through the network. The operation of the HVAC system varies depending on the building’s end use, so the resulting profile of the heating/cooling load will vary among the different types of buildings. Gadd and Werner made a study of 141 different buildings where they first defined two indicators (annual relative daily variation and annual relative seasonal variation) and then used them to detect failures in the DH substations based on high or low variations of these parameters depending on the type of building. Irregularities of the heat load pattern or no correlation between outdoor temperature and heat demand can also be used to detect that the substation is not working properly.
The main challenge related to heat load patterns-based methods is how to deal with such different profiles for various types of buildings or how to create reliable predictions of them. Concerning the first point, a data-driven algorithm enabling large-scale automatic analysis of district heating load patterns was developed by Calikus et al. (2019) using an initial dataset of 19.6 million hourly measurements. The algorithm applies clustering techniques to aggregate profiles of customers into different groups and extracts their representative behavioral patterns in terms of heat load. In this way, it is capable of detecting unusual customers whose profiles deviate significantly from the rest of their group. These outliers can be analyzed in depth in order to find problems in the corresponding substations or customer facilities. The application of the algorithm allowed to detect abnormal heat load profiles due to, for instance, a mismatch between the real and designed use of the buildings, problems in the HVAC system that resulted in sharp and irregular afternoon peaks, and summer loads higher than mid-seasons’ ones due to substation faults.
In the framework of the H2020 project RELaTED, two tools have been developed for automatic fault detection in DH substations based on ML algorithms: DH doctor and DH Autotune. The first one exploits clustering, and it is based on daily averaged readings. Anomalies can be detected by measuring the distance among the clusters and following the evolution of the centroids related to a particular variable over time. Moreover, it exploits an ensemble of decision tree (DT) algorithms to make predictions that allow assessing deviations of a monitored variable. The second tool is based on hourly averaged readings and allows the prediction of the load as mentioned in Section 2.3, but also a fast reaction is triggered if abnormal behavior occurs. Alarms are activated if some KPIs, such as MAPE, exceed a threshold. Further applications concerning the prediction of substation heat demand patterns through ML algorithms using the usual metering variables such as flows and temperatures can be found in.
When focusing on operational faults specifically related to heat exchangers, the literature shows that most of them commonly involve fouling formation. This can be described as the accumulation of deposits on heat transferring surfaces, which cause a higher thermal and hydraulic resistance in the heat exchanger. An automatic method using the usual metering variables such as volumetric flow and temperatures in the substation primary and secondary circuits has been developed by Guelpa and Verda (2020). It consists of the indirect calculation of the global heat transfer coefficient and monitoring its change during the fouling process. This method is easy to implement but involves important calibration challenges when it comes to different kinds of heat exchangers.
The actuator of the control valves or the valves themselves may wear and tear during operation or after large periods without use. This causes uncontrolled flows in the installation and instability of the flow rate. An analysis of frequency variation and stability of the flow in the primary circuit of the substation was performed by Fabre et al. (2020) leading to a simple and easy method to detect this kind of fault.
Heat pumps (HPs) at the customer-sited substations are used in 4GDH systems as booster stations for DHW production, whereas in 5GDHC systems, they are needed to supply both space heating/cooling and DHW loads at the right temperature for the distribution and emission system. Due to that, it is really important to assure an efficient operation detecting possible faults and to prevent them. A comprehensive study that analyzes the most important faults reported by both original equipment manufacturers (OEMs) and insurance companies in Sweden is presented in. The results state that the issues in control and electronics are one of the most common and costliest faults in all types of HPs. According to OEMs, the shuttle and shunt valves are the second most common faults that occurred in ground source and exhaust air HP systems, respectively. Unfortunately, there are not any investigations in the current literature about fault detection applied to these specific parts. Moreover, an additional impediment for the development and implementation of the HPs fault detection algorithm is the fact that the equipped software is often a closed system that can only be accessed by the manufacturer. However, there exist some studies leading to detect leaky check and reversing valves using their own test benches or modified commercial heating pumps to be able to measure internal temperatures and mass flow of the refrigerant.
It is proved that for HP systems, there is a maximum coefficient of performance (COP) at the optimal charge amount and refrigerant leakages cause performance degradation and a decrease in thermal comfort. However, several heat-pump-based units usually do not have an optimal amount of refrigerant. For this reason, it is important to detect these leakages in an early phase to be able to fix them without energy losses and to limit their contribution to global warming. Several studies have been developed in this direction. For instance, Eom et al. (2019) proposed a novel refrigerant charge fault detection strategy for HPs using convolutional neural networks trained using a real commercial HP system and the variables used for internal control provided by the manufacturer. Sun et al. (2020)  defined the sub-health operation concept of HP systems, which is used to define the intermediate state between normal and fault. Moreover, an online undercharge sub-health diagnosis method was proposed that analyses the theoretical behavior of the system facing a refrigerant leakage.
Even though it seems that every time more algorithms used for fault detection are based on neural networks and machine learning techniques, a recent study concludes that some of these approaches are not useful when working with real data series from heat pumps.
The digitalization of the DHC sector is becoming crucial. Moreover, in order to control efficiently the systems and to be able to detect malfunctions, the introduction of more and new sensors and actuators is necessary. However, these components may also fail, and it is important to be able to detect it. There are several simple complementary methods, which should be implemented in all sensors and actuators of the whole facility:
In the literature, some specific methods applied to heat pump (HP) sensors are investigated. Zhang et al. (2019)  propose a data-driven statistical model optimized and applied for sensor fault detection and diagnosis (FDD) using subtraction clustering and k-means clustering combined to identify and classify modelling measurements of unsteady operating conditions. Moreover, in order to calibrate the HP sensors, a method called virtual in situ calibration (VIC), based on the Bayesian inference and Markov Chain Monte Carlo (MCMC), was very effective in detecting and correcting the systematic and random errors of various sensors installed in a PVT/heat pump system . As the VIC method can effectively improve the measurement certainty, the sensors with relatively low accuracy can be used to achieve a higher precision, which is able to significantly reduce the cost of equipment. VIC uses a certain grade of modelling, and it seems not so hard to implement.
With the growth of the world’s population and an increase in urbanization, district heating and cooling (DHC) has been identiﬁed as a promising technology to cover the thermal energy demands in urban areas. Notwithstanding, DHC is evolving towards lower distribution temperatures, the exploitation of decentralized and non-programmable renewable sources and sector-coupling with other energy carriers. However, the lack of optimal control strategies and fault detection tools leads DHC systems to waste energy and resources. Moreover, new challenges such as demand-side management, weather uncertainty and environmental efﬁciency have emerged. Those have attracted more and more attention to the design of intelligent, robust control platforms as well as diagnostic methods. These advanced solutions, reviewed in this paper  with a focus on low-temperature DH studies and EU research projects, must be able to predict events, make real-time decisions and be integrated with SCADA systems in order to push the DHC sector forward in the digital transition.
In fault detection and diagnosis (FDD), two main approaches emerged: physical-based versus data-driven modelling. Models here are useful in software-based solutions to detect malfunctions from the deviation of the system from standard operation. Alarms can be activated when some calibrated thresholds are exceeded. The use of machine-learning-based FDD tools is growing in DHC, since they can handle complex systems with a large number of variables and have excellent performance in the behavior prediction of non-linear systems and in pattern recognition. However, these solutions have some drawbacks, since large datasets are needed for training over different operating conditions to avoid low performance in the extrapolation in real-time operation. Among hardware-based FDD approaches, infrared thermography found applications for leak detections in DHC pipeline and can be further boosted by means of automatic image recognition algorithms. Predictive control and fault detection sometimes share similar approaches and from the survey performed emerges that some companies developed innovative platforms based on artiﬁcial intelligence for both applications.