ABSTRACT
This work outlines the performance of three variants of deep neural networks for leak detection in water distribution networks, namely – autoencoders (AEs), variational autoencoders (VAEs), and long short-term memory autoencoders (LSTM-AEs). The multivariate pressure signals reconstructed from these models are analysed for leakage identification. The leak onset time is estimated using a fast approximation sliding window technique, which computes statistical discrepancies in prediction errors. The performance of all three variants is validated using the widely studied L-Town benchmark network. Furthermore, their feasibility for real-world application is studied by applying them to a real-world case study representing the data availability and network design often found in smaller- and medium-sized utilities in Norway. The results for the benchmark network showed that AE and LSTM-AE showed comparable detection performance for abrupt leaks with VAE performing the least. For incipient leaks, the LSTM-AE showed better detection performance with few false-positives. For the real-world dataset, the performance was significantly lower due to the quantity and quality of data available, and the contradiction of inherent requirements of data-driven models. In addition, the analysis revealed that the positioning of pressure sensors in the network is critical for the leak detection performance of these models.
HIGHLIGHTS
Three variants of encoder–decoder neural networks are modelled for data-driven leak detection.
The models were validated on a benchmark dataset and applied to a real-world WDN in Norway.
The sequence learning capability of the long short-term memory autoencoder (LSTM-AE) showed better detection performance.
The lower performance in real-world applications revealed limitations due to the positioning of sensors and data availability.
ABBREVIATIONS
- AE
autoencoder
- ANN
artificial neural network
- CNN
convolutional neural network
- CUMSUM
cumulative sum
- KL
Kullback–Leibler
- LILA
Leak Identification and Localisation Algorithm
- LSTM-AE
long short-term memory autoencoder
- MAE
mean absolute error
- MAPE
mean absolute percentage error
- MSE
mean squared error
- PMA
pressure measurement area
- RNN
recurrent neural network
- SPC
statistical process control
- SWM
smart water meter
- VAE
variational autoencoder
- WDN
water distribution network
- WNTR
Water Network Tool for Resilience
INTRODUCTION
Detection and localisation of leaks in water distribution networks (WDNs) remain one of the main challenges for many water utilities across the world. Globally, around 126 billion m3 of potable water is lost during supply (Liemberger & Wyatt 2019) with a leakage rate of, on average, about 30% in Norway (Statistics Norway 2021). As WDNs are complex networked pipeline systems spanning several hundred kilometres in a wide geographical area, fast detection, localisation, and isolation of leaks becomes a complex task. Furthermore, due to the rapid urbanisation and deterioration due to aging of WDNs, continuous monitoring for rapid leak detection and isolation becomes even more challenging owing to changes in network structure and parameters. In addition to the increasing water stress, estimation of leakage levels and associated costs are also not trivial (Molinos-Senante et al. 2016). Apart from the loss of precious water and revenue, leaks also cause significant pressure drops in the network thereby causing a high potential for pathogen intrusion and associated health risks (Odhiambo et al. 2023). From a utilisation perspective, there have been several changes and stringent requirements made by governments for reducing water leakage in recent years. In consequence, leak detection and localisation have been an active area of research for several decades due to these factors. Most of the methods available in the literature (Hu et al. 2021; Wan et al. 2022) can be broadly classified into three categories – model-based methods, hybrid methods that combine process knowledge from both first principles and measurement data and the recently evolving data-driven methods (Romero-Ben et al. 2023).
Model-based methods aim to detect and localise leaks based on the underlying hydraulic estimates. These models can be either a transient based model or a steady state model based on extended period analysis. The transient model determines the magnitude and location of leaks by observing changes in the pressure and flow signals due to the presence of leaks in the network (Colombo et al. 2009; Che et al. 2022). Transient models, while predicting the location and magnitude of leaks with high accuracy, are often constrained to smaller networks due to modelling complexities and scalabilities. Steady state approaches, on the other hand, are based on inverse transient analysis for determining leak magnitude and location (Pudar & Liggett 1992; Kapelan et al. 2003). Though these classes of model-based methods were able to detect leaks accurately, even for larger networks, they require complete information on the network hydraulics and continuous calibration which is seldom available for smaller utilities.
In recent years, due to the advancements in measuring systems and increasing computational power, many water utilities are moving towards digital solutions for real-time monitoring and control of WDNs (Cominola et al. 2015; Mounce 2021), monitoring pressures, flows and the performance and settings of pumps and valves. The often-observed decision of utilities to focus on pressure sensors is mostly based on the fact that they are more cost efficient and easier to install compared to flow meters which are usually expensive and require intensive installation procedures.
With the emergence of digitalisation of the water sector, there has been a widespread interest in developing purely data-driven models for leak detection and localisation in recent years to avoid the need for a fully calibrated model and the costs associated. Some researchers have reviewed broad classes of data-driven models that are applied for leak detection tasks (Wu & Liu 2017; Hu et al. 2021; Wan et al. 2022).
Statistical Process Control (SPC) Methods have been widely used for process monitoring applications. They are based on the setting of control limits for the measured variables and the detection of unusual patterns when those control limits are exceeded. Limits can be, for example, computed based on the cumulative sum of total flow rate in a network (Misiunas et al. 2006), or based on principle components (Gertler et al. 2010). Although these methods are highly efficient, they are, however, based on the assumptions that the errors are not correlated and that they are Gaussian and stationary variables.
Classification-based approaches were also widely used for leakage detection in the last decade (Cody et al. 2017; Soldevila et al. 2017; Romero et al. 2021, 2022). These methods are based on Support Vector Machines (e.g., Cody et al. 2017), Bayesian classification (e.g., Soldevila et al. 2017), K-Nearest Neighbour clustering (e.g., Soldevila et al. 2016) and many other similar strategies. These methods assume that correctly labelled leak events are available during the model training process. However, in practice, it is difficult to obtain such labelled data for all types of possible leak events in WDNs. Hence, the predictive performance for these models is limited to leak events that are similar to labelled historical events.
The third sub-class of data-driven methods, namely, prediction methods is the most widely used for leakage detection. A prediction model is trained based on no-leak data to predict the expected values for no-leak scenarios. If a leak event occurs, there will be deviations between model predictions and the measured values. The prediction errors are then attributed to leak events or sensor faults based on the obtained residuals. The residual error analysis is then carried out based on different evaluation metrics such as mean squared error (MSE), mean absolute error (MAE), and mean absolute percentage error (MAPE) for determining the model performance and onset of leak events (Wan et al. 2022). Prediction-based artificial neural network (ANN) models have been used widely for leak detection in WDNs (Mounce et al. 2010, 2014; Cody et al. 2020; Spandonidis et al. 2022; Tornyeviadzi & Seidu 2023). Since these models do not have a composite classification approach for determining thresholds on residuals to flag leak onset, the final task of anomaly detection is done by additional algorithms (e.g., CUMSUM, residual error analysis, Hotelling's T2, etc.).
In this study, we focus on pressure measurement-based encoder–decoder models and evaluate their leak detection performance. For the data-driven methods using pressure measurements, the following assumptions must be (implicitly) met for implementation:
There are a sufficient number of pressure sensors available in the network and they are placed at different (if possible optimal or nearly optimal) locations for efficient leak detection.
Measurements are available for nominal system states that represent no-leak scenarios over a sufficient period of time. If they are not available, pressure estimates at the corresponding sensor locations are available from a calibrated hydraulic model.
Data quality for the measurements is high enough to allow for training and application of the algorithms, or at least for adequate data preprocessing.
The main objective of the study is to evaluate the applicability of data-driven methods under these widely used assumptions on a real-world case study network in Norway. We highlight that the number and location of the pressure sensors and data quality play an important role in realising these methods in everyday scenarios.
In this study, three data-driven prediction models are trained using only pressure signals, and their leak detection performance is compared using a widely studied leak detection benchmark, which fulfils the aforementioned assumptions. The three deep neural network models – autoencoders (AEs), variational autoencoders (VAEs), and long short-term memory autoencoders (LSTM-AEs) – are trained in semi-supervised fashion using only pressure measurements. To explore their applicability in practice, the models were also trained and evaluated using measurements from a representative real-world WDN in Norway. First, a brief background on the deep learning models and methods for data preprocessing used is reported in the methodology section. The results and discussion on the detection performance of the three models used and practical limitations are then provided. Finally, the conclusions and future directions of the study are presented.
METHODOLOGY
Three class of encoder–decoder model used for leak detection: (a) AE, (b) LSTM-AE, and (c) VAE.
Three class of encoder–decoder model used for leak detection: (a) AE, (b) LSTM-AE, and (c) VAE.
Autoencoder
AEs are a kind of unsupervised neural network that is used for efficient learning of higher dimensional features without the need for explicit data labelling (Baldi 2012). A typical AE architecture consists of two parts: an encoder (E) and a decoder (D), each containing one or more hidden layers of neurons, as shown in Figure 2(a). The encoding network (E) takes in the input x € Rm and transforms it into a lower-dimensional space z € Rn, where n<m through linear combinations of non-linear activations at hidden layers. The compressed data at latent layer z capture the most relevant features of the original data. The decoding network (D) then takes the compressed data z as input and transforms it back to the original space Rm, by increasing the dimensionality at each of the hidden layers. The output of AE can be represented as
where
.
During training, AEs aim to minimise the difference between the input data (x) and the reconstructed data . MSE as a loss function, is used to train the AE model. By minimising this error, the AE learns a compressed representation that captures the most salient features of the input data. Hence, any considerable deviations in the reconstruction errors can be attributed to the onset of anomalous events.
AEs have been widely used in classification and regression tasks across several domains. For example, AEs have been used for monitoring pipeline leakage (Wang et al. 2020) and for monitoring spacecraft sensor data (Sakurada & Yairi 2014). In this study, a simple AE is trained in semi-supervised fashion for the leak detection task.
Long short-term memory autoencoder
LSTM are a type of recurrent neural networks (RNNs) that are used for learning patterns in the data. LSTMs have been widely popular and are building blocks of advanced sequence learning architectures. They are widely used for language translation, timeseries forecasting and many for many other sequential data. LSTM units are composed of four sub-units namely, a cell state, an input gate, an output gate and forget gate. While the cell state recalls values at arbitrary time intervals, the other three gates selectively enable or disable the flow of information through the LSTM unit. This results in effectively learning the underlying patterns for the given sequence of input data. Readers are referred to (Hochreiter & Schmidhuber 1997) for further information on the workings of LSTM units. LSTM-AE are a class of composite encoder–decoder models, wherein, the LSTM units are coupled in a conventional AE fashion. Hence, LSTM-AE captures not only the higher dimensional features but also the underlying temporal patterns in the given input timeseries.
The encoder LSTM layers transform the input sequence into a lower-dimensional representation in the latent space. The decoder in an LSTM-AEr reconstructs the sequential data from the compressed representation. Figure 2(b) shows an illustrative LSTM-AE architecture. It uses LSTM layers that process the latent representation in reverse order, effectively generating a sequence of outputs. Similar to traditional AEs, LSTM-AEs aim to minimise the difference between the input sequence and the reconstructed sequence. The training process involves propagating the reconstruction error backwards through the LSTM layers and adjusting the model's weights to improve the reconstruction accuracy.
Like AE, LSTM-AE were also widely popular across multiple domains. They were initially illustrated for video representation learning (Srivastava et al. 2015), and air quality monitoring (Wei et al. 2022) and found applications in oil and gas pipeline leakage monitoring (Spandonidis et al. 2022).
Variational autoencoder
VAEs introduce probabilistic modelling into the AE framework, enabling the generation of new data samples based on learned probability distributions. VAE replace reconstruction errors with reconstruction probability through Bayesian inference during the training process (Kingma & Welling 2014). Like AE, VAE constitutes encoder (E) and decoder (D) but varies by inferential learning at the latent space z. Specifically, the latent vector learns two lower-dimensional vectors: mean (μ) and variance (σ) vectors that parameterise a multivariate normal distribution (refer Figure 2(c)). These are used for inferential learning of the encoder and decoder parameters. The model prediction is done through a reparameterisation trick, where the compressed information at latent space z is sampled via inferential learning and fed to the decoder. The decoder then reconstructs the sampled information at latent space to the original dimension of input data x. VAEs aim to minimise the reconstruction error, similar to other AEs. Additionally, they also optimise the Kullback–Leibler (KL) divergence between the learned distribution and the standard normal distribution (prior), ensuring that the latent space distribution remains close to a unit Gaussian.
With the inferential learning abilities, VAEs can also be used as a generative model. For example, to generate synthetic data that resembles real sensor measurements, which is beneficial for enhancing the generalisation capabilities of predictive models in WDNs. VAEs have also been used for anomaly detection for different applications (Yao et al. 2019; Huang et al. 2022). One of the earliest application of leakage detection with VAEs on acoustic spectrograms were reported by (Cody et al. 2020). In this study, VAE will be trained on timeseries measurements for detecting leaks.
The three models are implemented using standard Python packages for data processing and Pytorch (Paszke et al. 2017) for neural network implementation. For AE and VAE, the MSE between the input data (x) and predictions is used as an objective function for training the models. For VAE, the loss function is a combination of MSE loss and KL divergence loss as described above. The architecture used for each of the three models can be referred to in Supplementary material, Appendix 1.
Change point analysis for leak detection
After training the encoder–decoder models, the reconstruction error of the predictions is given by the error timeseries . In a no-leak scenario,
is centred around zero with minor variations due to prediction error and sensor noise. Hence, any change in the error timeseries can be attributed to the onset of the leak. Therefore, the problem of detecting a leak can be tackled as the problem of identifying change points in the error analysis.
To determine the onset of the leak, a sliding window technique based on tracking the statistical discrepancy between two sub-sequences of the error timeseries is utilised (Truong et al. 2020). The sliding window change point detection method is an alternative and approximation to optimal change point methods such as the Pruned Exact Linear Time (PELT) method discussed in Killick et al. (2012). The advantage of the approximate method over the optimal method is that the computation time is of the order of sampling points O(nw) where n is the number of samples and w is the number of search windows. Hence, it is considerably faster than other optimal methods at the cost of accuracy.
Given an error series and window length spanning from time instant a to b (where a and b < total time length T), the discrepancy measure M is calculated for two adjacent windows using some arbitrary cost function (for e.g., two-sampled test). If there is a discrepancy between windows, then M reaches large values. This process is repeated until M is calculated for the whole time period [1, T]. The peak values are then determined by their indices and are attributed as change points.
DESCRIPTION OF THE DATASET
Case study 1: L-Town Benchmark
L-Town BattleDIM network showing the locations of pressure sensors and leaks.
Dataset generation
As described earlier, the study builds on semi-supervised learning wherein, measurements from leak-free scenarios are used for identifying new leaks without explicitly using historical leaks as labels for training encoder–decoder models. In the first step, the nominal hydraulic model without leaks is simulated using the Water Network Tool for Resilience (WNTR) Python toolkit (Klise et al. 2017), and the pressures at all junctions with sensors is stored for the years 2018 and 2019. The pressure measurements are then split into train-validation datasets in an 80–20 ratio. The training and validation data are z-standardised for zero mean and unit variance to enable efficient model training. The dataset is also divided into sample sequences, with a sequence length set to 144 measurements. This corresponds to 12 h of measurement data for each sequence.
The models are then evaluated for two different types of leak scenarios – abrupt bursts and incipient leaks that emulate slow-increasing and background leaks. As test scenarios, 33 different datasets are generated for each different single leak scenario. The leak locations, their magnitudes, start times and end times are, however, the same as in the original BattLeDIM competition. To emulate a leak in a pipe, the leak is assumed to occur in the centre of the pipe, following the approach of Basnet et al. (2023), and modelled as an additional demand using the morph package of WNTR toolkit in Python. Hence, for evaluation, 33 different pressure measurements, each spanning two years 2018 and 2019 are simulated and stored.
Case study 2: a real-world Norwegian WDN
Overview of the different pressure zones, pumping stations, measurement and control devices in a real-world WDN in Norway with highlighted zones of interest.
Overview of the different pressure zones, pumping stations, measurement and control devices in a real-world WDN in Norway with highlighted zones of interest.
Description of real-world dataset
Raw (left panel) and pre-processed (right panel) data from the real-world WDN.
In addition to the pressure measurements, the water utility also provided leak timestamps, repair dates and their approximate locations. However, the real-world dataset is not devoid of missing network information, history leaks that are either missing or lacking true start and end times, typographical errors in database management (for e.g., spurious leak events, errors in timestamps, sensor-model object mismatch), as well as missing sensor measurements and can therefore not be trusted completely. Therefore, within the available period between March 2022 and September 2022, only a week from 23rd to 30th March 2022 could identified to be devoid of leaks and, therefore, chosen for model training purposes. In contrast to the artificial benchmark, this scenario is in stark contrast with respect to the amount of available data for training the models without making additional extensive assumptions on the leaks and data quality. In addition, as the dataset also contained noise and missing values, data imputation and filtering were carried out using linear interpolations followed by Savtizky-Golay filtering (Schafer 2011) process. The filtering is achieved as a result of convolution between a subset of sequence with a lower degree polynomial using the least squares method. The convolution method to obtain a smoothed signal is popularly used in several digital filtering applications because of its simplicity.
This was done in a bid to reduce the effect of missing values and measurement noise in the signals. Following the data cleansing and preprocessing steps, the encoder–decoder models were trained in the same way the analysis was carried out for the L-Town network. The architecture of the encoder–decoder models used for evaluation is described in Supplementary material, Appendix 1.
RESULTS AND DISCUSSION
Case 1: L-Town WDN
Sudden and gradual changes in reconstruction errors for abrupt leak p142 (Top) and incipient leak p653 (bottom) for L-Town.
Sudden and gradual changes in reconstruction errors for abrupt leak p142 (Top) and incipient leak p653 (bottom) for L-Town.
Detection times for abrupt leaks in L-Town WDN (see Figure 3). Labelled numbers represent detection times less than 50 h.
Detection times for abrupt leaks in L-Town WDN (see Figure 3). Labelled numbers represent detection times less than 50 h.
Case 2: a real-world WDN
Reconstruction error expressed as difference between measurement and predictions for pressure sensors in zones z27 (top), zone 30 (bottom left), and zone 2 (bottom right) in the real-world WDN shown in Figure 4.
Reconstruction error expressed as difference between measurement and predictions for pressure sensors in zones z27 (top), zone 30 (bottom left), and zone 2 (bottom right) in the real-world WDN shown in Figure 4.
For sensor 669, the detected change point was approximately the same for all three models. Only the reconstruction error from VAE showed a change point for sensor 42,191. For sensor 11,079, AE detected a change point close to a true leak event. VAE had false-positives and LSTM-AE detected a change point after one week. It should also be noted that during this period between the true leak event on 2 May 2022 and the detected change points around 9 May 2022, no other leaks were reported by the utility. For sensor 43,045, only VAE was able to show deviations in reconstructions with respect to other sensors.
While the true leak is in the proximity of sensor 669 (approximately 197 m) in zone z27 (refer to Figure 4), another faulty sensor in the same zone 42,191 exhibited spurious noise during the leak event that was not observed. Additionally, a sharp increase in the reconstruction errors of sensors 11,079 and 43,045 situated in zones Z26 and Z01 away from the leak location was observed. Therefore, for the same leak event, multiple sensors in different pressure zones signalled leak alarms, contributing to difficulties in identifying the leak locations. On further analysis, we observed that many sensors are placed in pumping stations for safe monitoring and operations. Moreover, in this scenario, the pumping operation in zone z26 was governed by the pressure signal 11,079 and the level in the storage basin close to sensor 669 in zone z27. This highlights that unless the pumping operations and their correlation with respect to corresponding pressure signals are considered, leak detection is not likely to be accurate in such systems.
In addition to the difficulty in identifying whether there exists a single leak or multiple leaks from the signal as explained above, it was also unclear whether these are sensor faults or abnormal consumption behaviour (unless known a priori with certainty) in the system. This limitation highlights that leak detection algorithms relying on pressure signals are unlikely to provide useful results unless the pumping schedules are accounted for and included in the models or with the placement of pressure sensors conforming to observable conditions (Tornyeviadzi & Seidu 2023). Furthermore, since the water may also be supplied in bulk across different zones, pressures across the network are also likely to be affected due to pump operations compensating for the pressure lost due to leaks. This was observed in the sensor errors in 43,045 in zone z1 far away (approximately 3.3 km) from the true leak zone z27.
As a brief overview, the proposed method together with a selection of different data-driven techniques used for leak detection in WDNs using a variety of sensors and methods is shown in Table 1.
Different data-driven techniques for leak detection in WDNs
Reference . | Network type . | Data . | Model . | Leak type . |
---|---|---|---|---|
Mounce et al. (2010) | Real-world data | Flow | ANN | Burst/Leaks |
Soldevila et al. (2019) | Real-world and Simulated data | Pressure | Spatial interpolation | Burst/Leaks |
Cody et al. (2020) | Laboratory test bed | Acoustic | VAE | Burst |
Romero et al. (2021) | Real-world data | Pressures and topology | Graph interpolation | Burst/Leaks |
Spandonidis et al. (2022) | Water pipeline | Vibration | CNN and LSTM-AE | Burst |
Kammoun et al. (2022) | Simulated data | Flow and Pressure | LSTM-AE | Burst/Leaks |
Weyns et al. (2023) | Real-world data | Pressure | Graph Convolution Network | Burst/Leaks |
Tornyeviadzi & Seidu (2023) | Simulated data | Pressure | 1D-CNN | Burst/Leaks |
Proposed method | Simulated data and real-world data | Pressure | AE, VAE, LSTM-AE | Burst/Leaks |
Reference . | Network type . | Data . | Model . | Leak type . |
---|---|---|---|---|
Mounce et al. (2010) | Real-world data | Flow | ANN | Burst/Leaks |
Soldevila et al. (2019) | Real-world and Simulated data | Pressure | Spatial interpolation | Burst/Leaks |
Cody et al. (2020) | Laboratory test bed | Acoustic | VAE | Burst |
Romero et al. (2021) | Real-world data | Pressures and topology | Graph interpolation | Burst/Leaks |
Spandonidis et al. (2022) | Water pipeline | Vibration | CNN and LSTM-AE | Burst |
Kammoun et al. (2022) | Simulated data | Flow and Pressure | LSTM-AE | Burst/Leaks |
Weyns et al. (2023) | Real-world data | Pressure | Graph Convolution Network | Burst/Leaks |
Tornyeviadzi & Seidu (2023) | Simulated data | Pressure | 1D-CNN | Burst/Leaks |
Proposed method | Simulated data and real-world data | Pressure | AE, VAE, LSTM-AE | Burst/Leaks |
CONCLUSION
In this paper, we presented three classes of encoder–decoder neural network models of different complexity for the leak detection task. A simple AE model, a composite LSTM-AE for learning underlying patterns and a VAE that learns the underlying data distribution by inferential learning were chosen. The reconstruction errors were then subsequently fed to a change point detection algorithm to predict the time of leak onset. For the best-case scenario, where there is availability of sufficient data quality (i.e., L-Town), the proposed models performed on par with the existing methods reported in the literature. They were able to detect abrupt leaks almost instantaneously for the artificial network and incipient leaks took several hours before they were detected at the cost of minimising the false-positive rates. The models were also evaluated for a real-world system in Norway for their real-time applicability. It was determined that the performance of the models was significantly impacted by two main factors. First, the data availability and quality of data need to be checked. Data management is still in its infancy for many WDNs due to financial and operating challenges. This limits the analysis and real-time implementation of data-driven leak detection algorithms that are aimed at fast and efficient leak detection capabilities in comparison to the ‘best-case’ data quality as assumed in the L-Town benchmark network. This has also been highlighted in other studies (Hu et al. 2021; Wan et al. 2022). Secondly, the placement of sensors impacts the performance of data-driven models. Upon further investigations, we observed that many sensors were placed close to pumping stations. Hence, composite models that include pumping information during the training phase similar to those (Sousa et al. 2023) could be developed in the future.
Ensuring the availability of quality data and composite modelling strategies could therefore facilitate real-time applications. Furthermore, the encoder–decoder modelling approach using pressure measurements could also be extended to Smart Water Meters (SWMs) at household levels that measure nodal flows and pressures. As many water utilities are transitioning towards digital water services, SWMs will play a crucial role in assisting water audits, demand forecasting and billing. Hence, the data quality is likely to be of high quality in comparison to district meters.
ACKNOWLEDGEMENT
We thank Jon Røstum from Volue for providing the real-world data and the support. This work has been funded by the European Union's Horizon 2020, under grant agreement No. 869171 (B-WaterSmart).
DATA AVAILABILITY STATEMENT
Data cannot be made publicly available; readers should contact the corresponding author for details.
CONFLICT OF INTEREST
The authors declare there is no conflict.