Abstract
Water Distribution Networks (WDNs) are vital for public health and economic activity, and early contamination detection and source-region prioritization are essential for timely response. Although Internet-of-things sensors and machine learning enable online monitoring, water quality sensors are costly and prone to faults, which can distort measurements and lead to false alarms or missed contamination events. Existing contamination localization methods typically assume reliable, fault-free measurements, an assumption often violated in real-world deployments. Here, we propose a unified data-driven framework that explicitly accounts for sensor unreliability while supporting contamination source-region prioritization. In this study, we focus on the monitoring of chlorine-reactive pollutants such as arsenite as a primary application scenario to evaluate the framework’s performance. The framework jointly integrates sensor fault detection, localization, isolation, faulty signal reconstruction, and contamination source-region prioritization within a single monitoring pipeline. A convolutional autoencoder detects and reconstructs corrupted measurements to recover the underlying clean signal, while a CNN–LSTM model performs fault isolation and supports downstream contamination analysis. An explicit fault–contamination differentiation mechanism is further introduced to distinguish sensor-induced deviations from genuine contamination signatures. Comprehensive evaluations are conducted on three realistic WDNs under tested network layouts, synthetic chlorine-reactive contamination scenarios, and evaluated fault models. The results demonstrate that while pinpointing the exact single node is challenging under sparse sensor coverage, the framework can narrow down likely candidate source regions, achieving up to approximately 80% Top-10 source-region prioritization accuracy. These findings highlight that jointly modeling sensor faults and contamination processes is useful for fault-aware contamination source-region prioritization under degraded sensing conditions.
Subject terms: Engineering, Mathematics and computing
Introduction
Water Distribution Networks (WDNs) are vital for public health and economic development by providing clean water to customers and industry. Early detection of contamination and prioritization of likely source regions are crucial, as illustrated by major incidents: the Milwaukee Cryptosporidium outbreak affected over 400,000 residents1; in November 2007, a human error in Nokia, Finland led to the injection of 450 m3 of wastewater into the drinking water distribution system, causing a large gastroenteritis outbreak. Thousands were infected, hundreds hospitalized, and a 12-week total water-use ban was imposed2; and the 2007 Taihu Cyanobacteria Bloom3 in Jiangsu Province, China, resulted from severe eutrophication, contaminating Wuxi’s tap water and triggering widespread water shortages and public panic. In such cases, while contamination detection in WDNs is essential, narrowing down likely contamination source regions is critical to support timely and effective mitigation.
Ensuring fault-aware water quality monitoring in WDNs is particularly challenging due to the vulnerability of sensor measurements to faults. Sensors may experience communication failures, hardware degradation, calibration drift, or environmental interference4,5. Such faults can distort measurements, leading to inaccurate contamination detection, false alarms, or even missed contamination events. If sensor unreliability is not properly addressed, monitoring systems may produce misleading decisions, undermining public safety and operational stability. To mitigate these risks, effective mechanisms for handling sensor faults are essential. Dealing with sensor faults typically involves three key steps. First, the presence of a fault must be detected (Fault detection). Second, the specific faulty sensor should be identified (Fault localization). Third, the underlying cause of the fault should be determined (Fault isolation), enabling targeted corrective actions such as recalibration or maintenance. However, because maintenance intervals can span several months, monitoring systems must remain operational despite missing or corrupted inputs. Online monitoring of WDNs relies heavily on accurate sensor measurements; however, sensor faults and data corruption can compromise monitoring performance6. In this work, we propose a novel method for faulty signal reconstruction which helps recover the underlying clean signal, thus preserving data continuity and supporting fault-aware downstream monitoring.
Existing research has addressed sensor fault diagnosis and contamination localization largely as separate problems. On one hand, a wide range of approaches have been explored for monitoring sensing reliability in WDNs, including model-based, knowledge-based, and data-driven methods7. While model-based techniques depend on accurate hydraulic models or expert knowledge, such requirements are often difficult to satisfy in real-world deployments, where models may be inaccurate, and network topology is only partially known. Under these conditions, data-driven approaches offer a more flexible and scalable alternative by learning system behavior directly from sensor observations. Earlier work has applied tools such as Hidden Markov Models8, Gaussian processes9, local PCA10, and regression-based techniques11 for fault detection and localization. However, many of these approaches operate offline and cannot isolate fault types. In addition, broader research on sensing systems has explored aspects such as sensor deployment and fault-tolerant architectures to enhance monitoring reliability. For example,12 investigates learning-based strategies for optimizing mobile sensor placement, while13 proposes a fault-tolerant UAV-assisted sensing framework. These studies focus on system-level design rather than data-driven fault diagnosis.
On the other hand, a parallel body of work investigates contamination detection and localization. Model-based strategies incorporate hydraulic behavior, water quality dynamics, and reaction mechanisms14–16, but their reliance on detailed system models limits their applicability. Data-driven methods can alleviate these challenges by exploiting patterns available in sensor observations, thereby reducing the reliance on detailed physical models, particularly when meaningful correlations exist among the monitored variables; an updated overview is provided in ref. 17. Recent advances include methods that integrate anomaly detection, classification, and probabilistic modeling. For instance, Li et al.18 integrated individual and aggregated features with adaptive thresholds for alarm generation; however, their approach is restricted to contamination detection and lacks localization capabilities. Similarly, while Grbvcic et al.19 employed neural networks and random forests alongside Monte Carlo simulations to estimate source characteristics, their method requires extensive contamination scenarios for offline training. Bayesian formulations with mobile sensing platforms enable online intrusion probability updates20, and hydraulic-structure-based methods trace contamination via early detections and flow directions21. More recently, an online decentralized framework22 leverages an LSTM-based variational autoencoder with drift-aware thresholds for online detection. Despite these advances, most approaches assume reliable sensing and do not account for the possibility that faulty measurements may disguise or mimic contamination, leaving contamination localization vulnerable under real-world operational uncertainties.
As a result, current WDN monitoring frameworks exhibit a fragmentation gap: they either manage sensor unreliability or perform contamination localization, but rarely consider their interaction. This separation can limit the reliability of online monitoring decisions in realistic operational settings where sensor faults and contamination may coexist.
In response to these limitations, we propose a unified and data-driven machine-learning framework for comprehensive WDN monitoring. Since sparse sensor coverage makes it difficult to uniquely identify the true source node, in this study, we perform contamination source-region prioritization rather than exact contamination source localization. Therefore, the objective is to rank or narrow down likely candidate source regions to support subsequent investigation and response. The main contributions of this work are:
We introduce a unified monitoring paradigm that jointly addresses sensor fault management and contamination source-region prioritization within a single pipeline, eliminating the common assumption of fault-free measurements and explicitly handling their coexistence in the tested operational scenarios.
We develop a two-component architecture comprising: (i) a CAE for sensor fault detection, localization, and faulty signal reconstruction, and (ii) a CNN–LSTM network for sensor fault isolation and contamination source candidate ranking. The framework incorporates an explicit fault–contamination differentiation mechanism that prevents fault-induced deviations from being misinterpreted as contamination, thereby supporting fault-aware prioritization of candidate contamination source regions under sensor unreliability. To facilitate reproducibility of our results, we make our code and data publicly available to the community.
We conduct extensive experiments on three realistic WDNs, including ablation studies on complex scenarios with simultaneous faults and fault-contamination coexistence. The results demonstrate the method’s effectiveness under the tested synthetic chlorine-reactive contamination scenarios, network layouts, and evaluated sensor fault models.
Results
Before presenting the experimental results, we briefly summarize the problem setting, framework workflow, and evaluation context to guide interpretation. We consider WDN monitoring under two interacting anomalies: sensor faults and water contamination. Specifically, sensor fault detection determines whether a sensor fault occurs, fault localization identifies which sensor is faulty, fault isolation classifies the fault type, and faulty signal reconstruction recovers the underlying clean measurement. Contamination source-region prioritization then aims to rank or narrow down likely candidate source regions, rather than necessarily identifying a unique source node, especially under sparse sensor coverage. To address these tasks, the proposed framework integrates CAE-based sensor fault detection, fault localization, and faulty signal reconstruction; CNN–LSTM-based fault isolation; and rule-based fault–contamination differentiation for candidate contamination source-region ranking. The framework is evaluated on three realistic WDNs of different scales, including Hanoi, ZJ, and L-Town, under four representative sensor faults: Missing, Bias, Spiky, and Drift. Here, Missing represents data loss, Bias represents systematic measurement offset, Spiky represents transient abnormal peaks, and Drift represents gradual sensor degradation. Full methodological and experimental details, including the formal problem formulation, network descriptions, fault generation, evaluation metrics, and algorithmic procedure, are provided in the Methods section.
Comparative evaluation against baseline methods
We first evaluate the reconstruction module by comparing the proposed CAE with neural reconstruction baselines. The faulty signal reconstruction capability of the proposed CAE is first assessed, as reconstruction quality underpins subsequent tasks, including fault detection, localization, and isolation. The CAE is compared against commonly used neural reconstruction models, including Deep-RNN23, LSTM-RNN24, and LSTM-VAE25. Experiments are conducted on the Hanoi network using an 80%–20% train-test split. Table 1 shows that the CAE achieves the lowest reconstruction error among all baselines. The performance gains stem from its ability to capture dominant local patterns and short-term dependencies, which are characteristic of chlorine dynamics in WDNs. In contrast, more complex sequence models, such as LSTM-RNN and LSTM-VAE, do not offer additional benefits and, in some cases, lead to higher reconstruction errors due to increased model complexity and optimization difficulty.
Table 1.
Comparison of reconstruction loss (in %)
| Deep RNN | LSTM-RNN | LSTM-VAE | CAE (ours) | |
|---|---|---|---|---|
| Training loss | 0.029(0.009) | 0.648(0.123) | 9.870(5.404) | 0.011(0.002) |
| Testing loss | 0.030(0.009) | 0.657(0.126) | 9.873(5.526) | 0.011(0.002) |
Results are reported as mean (standard deviation).
We then evaluate the fault isolation module by comparing CNN–LSTM with representative classifier baselines. As shown in Table 2, CNN-LSTM achieves the best performance (86%) with low variance, outperforming CNN (79%), MLP (78%), and LSTM (45%). This improvement is attributed to its ability to jointly capture local features and temporal dependencies, which are essential for fault patterns in sensor data. In contrast, MLP lacks temporal modeling capability, while standalone LSTM shows limited effectiveness in extracting discriminative features from noisy inputs. These results justify the selection of CNN-LSTM for fault isolation.
Table 2.
Comparison with other classifiers (in %)
| Algorithm | MLP | CNN | LSTM | CNN-LSTM |
|---|---|---|---|---|
| Accuracy | 78(0.172) | 79(0.027) | 45(0.325) | 86(0.023) |
Results are reported as mean (standard deviation).
Finally, we evaluate the end-to-end contamination source-region prioritization performance against existing methods and ablated variants. While previous experiments evaluated individual modules, this section assesses the end-to-end candidate contamination source-region ranking performance of the proposed framework. We benchmark against state-of-the-art methods21,22 and perform an ablation study by removing the Signal Reconstruction and Differentiation Rules components to quantify their contributions under sensor fault interference. The evaluation is conducted on 20 randomized scenarios with varying arsenite injection locations and random single-sensor faults (injected in two batches) across the Hanoi and ZJ networks, under sparse sensor coverage (19% and 9%, respectively).
As shown in Table 3, the Full Pipeline consistently achieves the best Top-k candidate-ranking performance and the lowest false alarm rate. The ablation study highlights two key findings: (1) Signal Reconstruction is essential for preserving data integrity, as faulty measurements otherwise propagate through the latent space and degrade candidate source ranking; (2) Differentiation Rules act as a critical filter to prevent sensor faults from being misclassified as contamination, and their removal leads to a marked increase in false alarms. In comparison,21 relies on hydraulic backtracking without accounting for sensor faults, limiting its ability to handle fault-contamination coexistence, while22 adopts a decentralized scheme but similarly lacks fault-awareness, resulting in excessive false alarms and degraded candidate ranking under overlapping events. Despite these constraints, the proposed framework maintains useful Top-k source-region narrowing performance, including 80% Top-10 accuracy on the sparsely monitored ZJ network. This indicates that the framework can help narrow down candidate contamination source regions for further investigation, rather than uniquely identifying the source under sparse sensor coverage, which may be unrealistic in practice.
Table 3.
Comparison of contamination source-region prioritization performance with baseline methods
| Network | Algorithm | Top-1 | Top-3 | Top-10 | # false alarms |
|---|---|---|---|---|---|
| Full pipeline (ours) | 17 (3.214) | 67 (4.873) | 83 (3.956) | 1.010 (0.012) | |
| Without reconstruction | 12 (3.487) | 50 (5.921) | 70 (5.214) | 1.300 (0.015) | |
| Without differentiation rule | 14 (3.362) | 52 (5.784) | 72 (5.103) | 2.730 (0.021) | |
| Ref. 21 | 15 (3.105) | 56 (5.102) | 78 (4.287) | 1.852 (0.017) | |
| Hanoi | Ref. 22 | 14 (3.256) | 54 (5.238) | 74 (4.912) | 2.232 (0.019) |
| Full pipeline (ours) | 5 (2.148) | 20 (4.237) | 80 (5.103) | 1.370 (0.024) | |
| Without reconstruction | 2 (1.982) | 12 (4.521) | 68 (5.784) | 1.533 (0.023) | |
| Without differentiation rule | 3 (2.103) | 14 (4.387) | 72 (5.642) | 3.245 (0.045) | |
| Ref. 21 | 4 (2.214) | 15 (4.198) | 75 (5.214) | 2.155 (0.038) | |
| ZJ | Ref. 22 | 4 (2.187) | 14 (4.265) | 72 (5.603) | 2.860 (0.041) |
Results are reported as mean (standard deviation).
Computational efficiency study
To empirically validate the online performance of our framework, deployment benchmarks were conducted on an Intel Core i7-8665U (1.90 GHz) processor. The evaluation was performed upon each new signal arrival to simulate a continuous online monitoring scenario, and results were averaged over 50 independent runs to ensure statistical stability. As reported in Table 4, the proposed method achieves millisecond-level inference latency (approximately 27–30 ms for both detection and isolation), while maintaining a low computational footprint (<11 MFLOPs and <800 KB memory). These results demonstrate that the framework satisfies online response requirements for practical SCADA systems.
Table 4.
Computational complexity and online performance benchmarks across three WDNs
| Network | Features | Det_FLOP (M) | Det_Latency (ms) | Iso_FLOP (M) | Iso_Latency (ms) | #Params | Memory (KB) |
|---|---|---|---|---|---|---|---|
| Hanoi | 6 | 8.902 | 27.403 (2.268) | 0.55 | 29.785 (14.121) | 188234 | 735.291 |
| ZJ | 10 | 9.2044 | 27.663 (2.151) | 0.55 | 27.882 (2.130) | 189134 | 738.820 |
| L-Town | 33 | 10.9432 | 28.141 (2.726) | 0.55 | 28.805 (4.907) | 194309 | 759.020 |
Results are reported as mean (standard deviation).
Sensor fault severity sensitivity analysis
To evaluate the operational boundaries of the proposed framework, we conducted a sensitivity analysis on fault severity across the four representative fault types using the Hanoi network as the experimental benchmark. This analysis aims to quantify the impact of fault magnitude on detection sensitivity, isolation accuracy, and localization performance. Fault magnitudes were categorized into three decreasing intensity levels: Obvious (baseline), Moderate (1/2 of baseline), and Subtle (1/4 of baseline). Except for the Missing fault, the parameters of all other fault types were scaled accordingly. For Bias, the offset ranges were set to [0.05, 0.1] (Obvious), [0.025, 0.05] (Moderate), and [0.0125, 0.025] (Subtle). For Spiky readings, the noise mean and standard deviation were reduced from (0.1, 0.05) to (0.05, 0.025) and (0.025, 0.0125). For Drift, the incremental rates per step were defined as [0.0005, 0.001], [0.00025, 0.0005], and [0.000125, 0.00025], respectively.
Table 5 summarizes the impact of fault severity on detection, isolation, and localization. Results are averaged over 20 independent scenarios and reported as the mean with standard deviation for statistical reliability. As severity decreases from Obvious to Subtle, fault isolation accuracy degrades, particularly for Bias and Spiky faults, whose subtle deviations are more easily confused with Drift. This also leads to increased FNR in some cases (e.g., Spiky), reflecting reduced detectability under low signal-to-noise conditions. In contrast, detection and fault-localization metrics remain relatively consistent with consistently high HitRate@P% and generally low FNR and FPR across most settings. Overall, while smaller fault magnitudes impair isolation performance, the framework maintains consistent detection and fault-localization performance under the tested fault severity settings.
Table 5.
Sensitivity analysis of sensor fault severity on the Hanoi network across multiple diagnostic metrics (in %)
| Network | Fault type | Sensor fault severity | FNR | FPR | Accuracy | HitRate@P% |
|---|---|---|---|---|---|---|
| Subtle | 0(0.000) | 0.367(0.014) | 0(0.000) | 10(0.000) | ||
| Moderate | 0(0.000) | 0.333(0.006) | 20(0.400) | 100(0.000) | ||
| Bias | Obvious | 0(0.000) | 0.367(0.008) | 95(0.218) | 100(0.000) | |
| Subtle | 25(0.433) | 0(0.000) | 0(0.000) | 75(0.433) | ||
| Moderate | 0(0.000) | 0(0.000) | 10(0.300) | 100(0.000) | ||
| Spiky | Obvious | 0(0.000) | 0(0.000) | 100(0.000) | 100(0.000) | |
| Subtle | 0(0.000) | 0.008(0.012) | 100(0.000) | 100(0.000) | ||
| Moderate | 0(0.000) | 0.009(0.012) | 100(0.000) | 100(0.000) | ||
| Hanoi | Drift | Obvious | 0(0.000) | 0.009(0.013) | 100(0.000) | 100(0.000) |
Results are reported as mean (standard deviation).
Furthermore, although an increased FPR could potentially activate the differentiation rule and lead to false contamination alarms by introducing false alarms in other dimensions, our empirical results show that the FPR remains consistently low and stable across all severity levels. This indicates that variations in fault severity have a limited impact on contamination detection performance.
Concurrent sensor fault scenarios
We further evaluate the framework under concurrent sensor fault scenarios, including faults of the same type and faults of different types. These experiments assess whether the proposed framework can maintain consistent fault localization, isolation, and reconstruction performance when multiple sensors are faulty simultaneously.
First, we consider concurrent sensor faults of the same type. We first examine the model’s behavior under single-sensor faults in the Hanoi network, with the fault injected at node 18, corresponding to the third feature in Fig. 1. The results for the four fault types are shown in Fig. 1. The original signal (blue), reconstructed signal (yellow dashed), and the expected normal signal (red), approximated from the preceding normal batch, reveal two key observations. The large deviation between the original and reconstructed signals at the fault onset indicates the occurrence of a fault and supports fault localization. At the same time, the reconstructed signal closely follows the expected normal signal, demonstrating that the framework can effectively reconstruct the faulty measurement and recover the underlying normal behavior.
Fig. 1. Detection, localization, and reconstruction results for different sensor faults in the Hanoi water distribution network.

A fault is indicated by a deviation between the original sensor signal (blue) and the reconstructed signal (yellow dashed), enabling fault detection and localization. The reconstructed signal closely follows the expected normal signal (red), demonstrating effective reconstruction of faulty measurements. a Missing fault, where sensor readings are unavailable or lost. b Bias fault, where the measurement is shifted by a systematic offset. c Spiky fault, where transient abnormal peaks occur in the signal. d Drift fault, where the measurement gradually deviates from the normal signal over time.
To assess performance under more challenging conditions, we evaluate scenarios where 1-4 sensors experience faults of the same type simultaneously (Table 6). While reconstruction error (MSE) increases with fault cardinality, HitRate@P% remains at 100% across all settings, indicating that the true faulty sensors are consistently ranked among the selected anomalous dimensions under these concurrent-fault settings. However, isolation accuracy exhibits a noticeable decline in extreme cases, particularly for four-sensor concurrent Drift faults, dropping to 68% in ZJ and 80% in L-Town. This performance dip highlights a limitation: when multiple sensors exhibit simultaneous, subtle drifts that mimic natural water quality fluctuations, the CAE’s global reconstruction can become distorted, thereby challenging the downstream CNN-LSTM classifier. While sensor-specific CAEs could mitigate this, the current approach strikes a practical balance between diagnostic depth and computational scalability for large-scale WDNs.
Table 6.
Sensor fault isolation, localization, and faulty signal reconstruction performance for single-type fault combinations on ZJ and L-Town (in %)
| ZJ | L-Town | |||||
|---|---|---|---|---|---|---|
| Fault combination | Accuracy | MSE | HitRate@P% | Accuracy | MSE | HitRate@P% |
| M #1 | 100(0.000) | 0.033(0.014) | 100(0.000) | 100(0.000) | 0.068(0.026) | 100(0.000) |
| M #2 | 100(0.000) | 0.027(0.003) | 100(0.000) | 100(0.000) | 0.057(0.004) | 100(0.000) |
| M #3 | 100(0.000) | 0.025(0.060) | 100(0.000) | 100(0.000) | 0.111(0.013) | 100(0.000) |
| M #4 | 100(0.000) | 0.025(0.039) | 100(0.000) | 100(0.000) | 0.115(0.018) | 100(0.000) |
| B #1 | 100(0.000) | 0.029(0.004) | 100(0.000) | 100(0.000) | 0.068(0.020) | 100(0.000) |
| B #2 | 100(0.000) | 0.034(0.001) | 100(0.000) | 100(0.000) | 0.060(0.008) | 100(0.000) |
| B #3 | 100(0.000) | 0.037(0.007) | 100(0.000) | 100(0.000) | 0.064(0.014) | 100(0.000) |
| B #4 | 100(0.000) | 0.026(0.007) | 100(0.000) | 100(0.000) | 0.101(0.014) | 100(0.000) |
| S #1 | 100(0.000) | 0.028(0.004) | 100(0.000) | 100(0.000) | 0.068(0.029) | 100(0.000) |
| S #2 | 100(0.000) | 0.049(0.010) | 100(0.000) | 100(0.000) | 0.064(0.007) | 100(0.000) |
| S #3 | 100(0.000) | 0.059(0.007) | 100(0.000) | 100(0.000) | 0.071(0.015) | 100(0.000) |
| S #4 | 90(20.000) | 0.068(0.012) | 100(0.000) | 98(5.000) | 0.104(0.012) | 100(0.000) |
| D #1 | 100(0.000) | 0.028(0.010) | 100(0.000) | 100(0.000) | 0.069(0.017) | 100(0.000) |
| D #2 | 100(0.000) | 0.036(0.009) | 100(0.000) | 100(0.000) | 0.061(0.015) | 100(0.000) |
| D #3 | 80(12.000) | 0.040(0.007) | 100(0.000) | 100(0.000) | 0.065(0.017) | 100(0.000) |
| D #4 | 68(10.000) | 0.047(0.027) | 100(0.000) | 80(12.000) | 0.102(0.011) | 100(0.000) |
Results are reported as mean (standard deviation). M, B, S, and D denote Missing, Bias, Spiky, and Drift, respectively.
Next, we evaluate concurrent sensor faults of different types. In real-world scenarios, multiple sensors may exhibit different fault types. However, since concurrent faults of different types are relatively rare, we limit our analysis to cases where two sensors each have a distinct fault type. This experiment is conducted on the ZJ and L-Town networks. The results of each network are summarized in Table 7. As shown in both tables, isolation accuracy remains high across all sensor fault combinations in both networks, suggesting that, in the tested two-fault settings, heterogeneous fault types have a limited impact on fault isolation. This is expected, as the isolation step, shown in Fig. 2, is processed independently for each sensor fault, ensuring that concurrent faults do not interfere with each other during isolation. For faulty signal reconstruction, consistent with earlier findings, the MSE for L-Town is higher than that for ZJ. This is attributed to the larger number of sensors in L-Town, which increases the complexity of the learning task.
Table 7.
Sensor fault isolation, localization, and faulty signal reconstruction performance for different-type fault combinations on ZJ and L-Town (in %)
| Fault | ZJ | L-Town | ||||
|---|---|---|---|---|---|---|
| Combination | Accuracy | MSE | HitRate@P% | Accuracy | MSE | HitRate@P% |
| S&D | 100(0.000) | 0.046(0.020) | 100(0.000) | 100(0.000) | 0.056(0.009) | 100(0.000) |
| S&M | 100(0.000) | 0.027(0.019) | 100(0.000) | 100(0.000) | 0.060(0.010) | 100(0.000) |
| B&D | 100(0.000) | 0.032(0.009) | 100(0.000) | 100(0.000) | 0.061(0.010) | 100(0.000) |
| B&M | 100(0.000) | 0.027(0.008) | 100(0.000) | 100(0.000) | 0.059(0.009) | 100(0.000) |
| D&M | 100(0.000) | 0.081(0.009) | 100(0.000) | 100(0.000) | 0.066(0.009) | 100(0.000) |
| B&S | 100(0.000) | 0.030(0.010) | 100(0.000) | 100(0.000) | 0.067(0.010) | 100(0.000) |
Results are reported as mean (standard deviation). (M, B, S, and D denote Missing, Bias, Spiky, and Drift, respectively).
Fig. 2. Framework for online sensor fault diagnosis and contamination source-region prioritization in water distribution networks.

a Offline training: a convolutional autoencoder (CAE) learns to reconstruct normal sensor measurements, while a convolutional neural network-long short-term memory (CNN-LSTM) model is trained using the reconstruction residuals between faulty signals and its CAE-reconstructed signals. b Online prediction: incoming signals are reconstructed by the CAE, and deviations measured by a loss function L(.) are used for fault detection. Detected faults are then isolated and classified by the CNN-LSTM model, followed by rule-based logic for contamination identification and source-region prioritization.
Centralized vs. decentralized performance comparison
To justify our architectural choice, we compare the centralized framework with a decentralized alternative (sensor-specific CAEs). Since isolation accuracy drops in both the ZJ and L-Town networks under four concurrent drift faults (Table 6), we focus on this case to examine the trade-off between accuracy and computational cost. The results are shown in Table 8. The decentralized scheme achieves 100% isolation, but at a much higher cost. In the L-Town network (N = 33), its latency reaches 1474.977 ms—about 52 × higher than the centralized model (28.141 ms), and its memory usage (~816 MB) is three orders of magnitude larger than the centralized approach (759 KB). In contrast, the centralized model keeps low latency and memory while still achieving 100% HitRate@P. These results suggest that, although sensor-specific CAEs can offer stronger performance, the centralized design is a more practical choice for large-scale WDNs when computational cost is taken into account.
Table 8.
Quantitative comparison of centralized vs. decentralized architectures under four-sensor concurrent drift faults
| Network | Architecture | Accuracy(%) | HitRate@P | Det_Latency(ms) | #Params | Memory(KB) |
|---|---|---|---|---|---|---|
| Centralized (ours) | 68(10.000) | 100(0.000) | 27.663 (2.151) | 189134 | 738.820 | |
| ZJ | Decentralized | 100(0.000) | 100(0.000) | 399.122(52.149) | 389254 | 472189.500 |
| Centralized (ours) | 80(12.000) | 100(0.000) | 28.141 (2.726) | 194309 | 759.020 | |
| L-town | Decentralized | 100(0.000) | 100(0.000) | 1474.977 (27.234) | 1231429 | 816392.03 |
Results are reported as mean (standard deviation).
Contamination in the presence of sensor faults
To evaluate the framework’s candidate source-region narrowing performance under sensor faults, a sensitivity analysis was performed on the ZJ network across various sensor coverage rates. For each configuration, 20 randomized scenarios involving diverse injection points and single sensor faults of random types were tested. As shown in Table 9, Top-1 and Top-3 accuracies are strongly constrained by physical topology in highly sparse networks. Under the 9% coverage setting adopted in this study, the framework achieves 5% Top-1 accuracy, 20% Top-3 accuracy, and 80% Top-10 accuracy, together with a 0% FNR. These results indicate that, under sparse sensing, the framework should be interpreted as narrowing down a set of likely candidate source regions rather than uniquely identifying the contamination source. Notably, as coverage increases to 50%, Top-1 and Top-3 accuracies significantly improve to 70% and 80%, respectively. This trend suggests that denser sensor coverage improves the ability to prioritize more precise candidate source regions, while sparse coverage mainly supports search-area reduction for further investigation.
Table 9.
Contamination source-region prioritization and sensor fault detection/localization performance under different sensor coverage rates on the ZJ network (in %)
| Network | Sensor cov. | Top-1 | Top-3 | Top-10 | FNR | FPR | HitRate@P% |
|---|---|---|---|---|---|---|---|
| 9 | 5 (2.148) | 20 (4.237) | 80 (5.103) | ||||
| 20 | 20 (3.842) | 40 (5.214) | 90 (4.378) | ||||
| ZJ | 50 | 70 (4.105) | 80 (3.256) | 95 (2.148) | 0 (0.000) | 4.44 (0.002) | 100 (0.000) |
Results are reported as mean (standard deviation).
We next provide three cases to examine contamination source-region narrowing in the presence of sensor faults. Experiments are conducted on the Hanoi, ZJ, and L-Town networks, with faults injected at nodes 7, 43, and 679, respectively. The contamination injection locations are marked as blue stars in Fig. 3. In all cases, sensor faults occur prior to and persist throughout the contamination event.
Fig. 3. Network topology with sensor placement and contamination source locations of Hanoi, ZJ and L-Town water distribution networks.

a Hanoi network topology and flow direction. b ZJ network topology and flow direction. c L-Town network topology and flow direction. (Placed sensors are shown as red dots and contamination sources as blue stars).
Figure 4 illustrates the sensor fault localization and isolation results before applying the differentiation rules under two scenarios. At node N7, a sensor fault (windows 2–3) and contamination (windows 3–4) overlap in the third window. If only sensor faults are considered, the contamination period would be misclassified as a Missing fault, as shown in Fig. 4. Conversely, under the fault-free assumption where only contamination is modeled, the sensor fault in the second window would be incorrectly identified as contamination. By jointly considering sensor faults and contamination and introducing an explicit differentiation mechanism, the proposed framework correctly identifies both sensor faults and the true contamination period, as shown in Fig. 4.
Fig. 4. Sensor fault localization and isolation in the Hanoi water distribution network under contamination.

Without explicit handling, contaminated measurements are misclassified as Missing faults.
The candidate source-region narrowing results are summarized in Table 10. The first row lists the nodes where contamination is detected, while the second row indicates the true contamination source node. The third row reports the number of potential contamination source nodes inferred by the proposed source-region narrowing method. As shown in the last row, the true source is included among the ten inferred candidates, resulting in a Top-10 accuracy of 100% for these specific instances. It should be emphasized, however, that these results represent individual illustrative cases; they are intended to demonstrate the framework’s workflow and do not constitute a comprehensive statistical basis for universal performance claims. The spatial candidate-region narrowing process and corresponding results for the Hanoi network are illustrated in Fig. 5. This example will be revisited in the Methods section to further explain the proposed contamination source-region narrowing procedure and its mathematical formulation.
Table 10.
Contamination source-region prioritization performance in the presence of sensor faults
| Metric | Hanoi | ZJ | L-Town | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| M | B | S | D | M | B | S | D | M | B | S | D | |
| Node IDs (detected) | 11, 7 | 11, 26, 38 | 726, 740, 722, 752, 644, 679, 296 | |||||||||
| Node IDs (actual) | 5 | 33 | 739 | |||||||||
| #Candidate source nodes | 4 | 2 | 9 | |||||||||
| Top-10 accuracy (%) | 100 | 100 | 100 | |||||||||
(M, B, S, and D denote Missing, Bias, Spiky, and Drift).
Fig. 5.

Contamination source-region prioritization in the water distribution network of Hanoi.
Discussion
Water Distribution Networks are fundamental to public health and wellbeing, as well as economic stability, yet their safe operation is increasingly challenged by the concurrent presence of contamination events and unreliable sensor measurements. In real-world deployments, sensor degradation can obscure contamination signals, thereby undermining monitoring decisions. Achieving fault-aware water quality monitoring, therefore, requires integrated solutions that explicitly account for sensor faults while preserving contamination detection and source-region prioritization capability. In this study, we introduce a unified two-phase deep learning framework that jointly addresses sensor fault diagnosis and contamination source candidate ranking within a single unified architecture. By coupling sensor fault detection, localization, isolation, and faulty signal reconstruction with contamination source-region narrowing, the framework prevents corrupted sensor measurements from propagating errors into downstream contamination analysis. Validation across three realistic WDNs demonstrates that the proposed approach maintains high diagnostic accuracy and improves Top-k candidate source-region narrowing performance under the tested synthetic chlorine-reactive contamination scenarios, network layouts, and sensor fault models.
Intuitively, the improved monitoring performance stems from explicitly accounting for sensor unreliability within the monitoring pipeline. Unlike conventional contamination-localization workflows that implicitly assume fault-free measurements, the proposed framework first performs sensor fault diagnosis (detection, localization, and isolation) and then differentiates sensor faults from contamination events using dedicated decision rules. This design prevents fault-induced deviations from being misinterpreted as contamination signatures, thereby reducing false alarms and improving contamination source candidate ranking when faults and contamination coexist. As a result, contamination detection and source-region narrowing remain useful for decision support under the tested degraded sensing conditions.
Despite these contributions, this study identifies specific limitations that open avenues for future research. From an algorithmic perspective, while the framework maintains high accuracy across most tested sensor fault diagnosis scenarios, its isolation performance exhibits a noticeable decline under extreme cases such as four concurrent Drift faults. Furthermore, the current differentiation and localization mechanisms are established based on chlorine reactivity, with arsenite serving as a representative pollutant; therefore, the results may not be directly generalizable to non-reactive contaminants or systems without chlorine residuals. Future work will therefore focus on developing more robust diagnostic algorithms specifically designed for extreme sensing uncertainties, such as exploring attention-based mechanisms or disentangled representation learning to enhance isolation sensitivity under high-cardinality concurrent faults. Additionally, we aim to extend the framework to incorporate a broader range of water quality signals and diverse contamination types, thereby enhancing the generalization and fault-aware decision-support capability of the monitoring system across more complex, real-world scenarios.
The proposed framework offers several key advantages for fault-aware water-quality monitoring. First, it establishes a unified monitoring paradigm that explicitly accounts for sensor unreliability, eliminating the common assumption of fault-free measurements in contamination analysis. By jointly integrating sensor fault detection, localization, isolation, faulty signal reconstruction, and contamination source candidate ranking within a single pipeline, the framework enhances diagnostic coverage and reduces fault-induced interference under concurrent fault–contamination scenarios. Second, the framework improves Top-k candidate source-region narrowing even when sensor faults and contamination events overlap, demonstrating its potential for decision support under degraded sensing conditions. This capability is particularly important in operational WDNs, where sensor degradation is inevitable. Third, by combining a lightweight CAE with a CNN–LSTM classifier, the framework enables localized, online anomaly interpretation at low computational cost. Our computational analysis (see “Methods”) confirms that the approach remains efficient even in resource-constrained deployments. Finally, the centralized deployment design simplifies real-world implementation. By hosting computation at a single processing unit, the framework reduces communication overhead and synchronization complexity, while avoiding the need for sensor-level processing hardware. This architecture facilitates scalability and cost-effective maintenance in practical WDN settings.
However, the proposed framework has a few limitations. First, the differentiation between contamination events and sensor faults relies on two predefined hydraulic-temporal rules, which are sensitive to network scale and sensing density. In sparse sensing configurations, Rule 1 may encounter identification challenges. This is because the absence of a downstream response, which serves as a key indicator of a local sensor fault, could simply result from insufficient sensor coverage rather than a lack of physical propagation. Furthermore, Rule 2 may be constrained in small-scale networks where the hydraulic transit time between nodes is shorter than the sensor sampling interval. Under these conditions, the sequential propagation pattern along the flow direction becomes difficult to distinguish, as the contaminant can traverse multiple monitoring points within a single sampling step. Consequently, the method is most effective when the sensing frequency is aligned with the network’s hydraulic dynamics and the WDN maintains reasonable sensing coverage.
By improving fault-aware contamination monitoring under sensor degradation, the proposed framework contributes to the resilience and sustainability of water distribution systems. Differentiating sensor faults from genuine contamination events reduces false alarms and unnecessary chemical interventions, while enabling timely and targeted mitigation strategies. In this way, the framework supports proactive water quality management and strengthens infrastructure preparedness against operational uncertainty and environmental stressors.
These findings underscore the necessity of moving beyond fault-free sensing assumptions in WDN monitoring. Designing monitoring systems that explicitly account for sensor unreliability is essential for achieving fault-aware online decision support. This paradigm is particularly relevant for critical infrastructures, where sensing imperfections are inevitable, and system resilience depends on integrated data-driven strategies.
From an implementation perspective, many critical infrastructure (CI) operators have already deployed IoT sensors for routine monitoring. Consequently, adopting the proposed framework primarily involves integrating the proposed intelligent analytics layer into existing SCADA/IoT infrastructures rather than investing in additional hardware. The computational analysis confirms its feasibility. Such integration aligns with ongoing CI digitalization efforts.
Algorithm 1
High-level online procedure for sensor fault diagnosis, faulty signal reconstruction, and contamination source-region inference
1: Input:
2: X = (x1, …, xk): signals for all sensors
D: labeled data for pre-training, including normal data and sensor faults
Init:
3: CNN_LSTM. train(D), CAE. train(D) ⊳ Pre-train models
4: θ1, …, θk ← set thresholds ⊳ Eq.
(2) Start:
5: for each batch in X do
6:
7: for each sensor j ∈ {1, …, k} do
8: if then ⊳ Sensor fault detection, localization, and reconstruction
9: if Count(j) > 1 and contamination check is True then ⊳ More than one sensor fault
10: Infer candidate contamination source region ⊳ Eq. (4)
11: else
12: ⊳ Sensor fault isolation
13: Send command: replace with
14: else
15: ⊳ Classified as normal
Methods
Problem formulation
WDNs are modeled as graphs, where nodes represent junctions and undirected edges represent pipes26. A graph G = (V, E) consists of node set V and edge set E, with each edge ei,j = (vi, vj) ∈ E, i ≠ j. The sensors are installed on the nodes; as full sensor coverage is impractical, only k ≪ ∣V∣ sensors are installed. The input signals from all sensorsS = {s1,…,sk} are represented as X ∈ Rk×T = {x1,…,xk}, where xj ∈ RT corresponds to the measurements from sensor sj and j = {1, …, k}. represents the i-th batch of signals collected from all k sensors. T and d denote the total signal length and batch length, respectively. In this study, contamination is detected through chlorine measurements, as chlorine is a widely used disinfectant and sensitive indicator of water quality due to its reaction with many contaminants27,28. However, chlorine sensors themselves are prone to faults. Therefore, we jointly consider sensor fault diagnosis for chlorine sensors and contamination monitoring.
We consider two main types of anomalies in WDNs: sensor faults and water contamination. Consider the i-th batch , where . Fault detection () determines whether any sensor fault exists in bi (0 for no fault, 1 for fault detected). Fault localization () identifies which sensors are faulty, assigning 0 for normal and 1 for faulty to each sj. Fault isolation () classifies the fault type of each detected faulty sensor. Contamination source-region prioritization () aims to infer a candidate contamination source region from binary sensor detections, rather than necessarily identifying a unique source node under sparse sensor coverage.
Experimental setup
The proposed framework is evaluated with three realistic WDNs: the Hanoi network in Vietnam29, the Zhi Jiang (ZJ) network in China30, and the widely used benchmark L-Town31. Their topologies and sensor placements, optimized via a multi-objective evolutionary algorithm to minimize affected population32, are illustrated in Fig. 3. Table 11 summarizes these networks and their sensor counts. They vary in size from the small Hanoi network to the large L-Town network.
Table 11.
WDN descriptions
| Network | #Nodes | #Sensors | #Pipes | #Reservoirs | #Tanks | #Pumps |
|---|---|---|---|---|---|---|
| Hanoi | 32 | 6 | 34 | 1 | 0 | 0 |
| ZJ | 113 | 10 | 164 | 1 | 0 | 0 |
| L-Town | 784 | 33 | 905 | 2 | 1 | 1 |
This study focuses on four representative sensor fault types commonly encountered in sensor networks: Missing (M), Bias (B), Spiky (S), and Drift (D). These fault types capture distinct and fundamental failure mechanisms, including data loss (Missing), systematic offset (Bias), transient anomalies (Spiky), and gradual temporal degradation (Drift), and are widely adopted in the literature4,33. Their generation in our experiments follows the approach in ref. 34. While this set does not exhaust all possible fault behaviors, it provides a principled basis for evaluating fault diagnosis performance, as more complex or application-specific faults can often be interpreted as variations or combinations of these basic patterns. Accordingly, we use these four types to assess the effectiveness of the proposed framework, while noting that the methodology is not inherently restricted to this specific set. Detailed descriptions and corresponding illustrations are provided in Fig. 6. To further assess reliability beyond isolated fault types, we evaluate concurrent fault scenarios across multiple sensors, including both same-type and heterogeneous combinations (see Tables 6 and 7), providing additional evidence of consistent fault-diagnosis performance under more complex conditions.
Fig. 6. Examples of four typical sensor fault types in water quality monitoring data.

a Missing fault, where consecutive readings drop to zero; b Bias fault, where measurements are consistently shifted from the normal range; c Spiky fault, characterized by intermittent abnormal spikes; d Drift fault, showing a gradual deviation over time. The blue solid line represents normal sensor readings, and the orange dashed line indicates faulty measurements.
Regarding the performance metrics, we use Top-K Accuracy for fault isolation and contamination source-region prioritization, MSE35 for faulty signal reconstruction, and HitRate@P%36 for fault localization.
Data generation
In this study, scenario data are generated using EPyT-Flow37 based on realistic seasonal water demand patterns derived from historical consumption data reported by water utilities38 at 30-minute resolution. Hydraulic and water-quality dynamics are simulated using EPANET and EPANET-MSX, which model contaminant transport and reaction processes within the network39. Gaussian noise N(0, 0.01) is added to all sensors, and chlorine is injected at 0.7 mg/L at the reservoir. The offline dataset comprises six months of normal operation and one month of synthetic fault data for each fault type, while the online dataset contains six months of mixed scenarios with injected faults and contamination events. Fault simulations follow four common types33: missing data (value set to zero), bias (offset of 0.05-0.1), spiky readings (noise with mean 0.1, std 0.05), and drift (increase of 0.0005–0.001 per step). Contamination scenarios are generated by injecting arsenite (0.8–1 mg/L) at a random node, specifically N5, N33, and N739 in Hanoi, ZJ, and L-Town, respectively.
Proposed framework
We propose a two-phase data-driven framework designed for integrated sensor fault detection, localization, isolation, faulty signal reconstruction, and contamination source-region inference. As illustrated in Fig. 2, the architecture comprises an offline training phase and an online prediction phase, with the complete operational procedure detailed in Algorithm 1.
Centrally, the framework employs a Convolutional Autoencoder (CAE) to detect and localize faults while performing faulty signal reconstruction (). Specifically, for a detected faulty signal (measurement of sensor sj in batch bi), the CAE restores it to a reconstructed signal , which approximates the underlying fault-free measurement. To better capture spatial features, the CAE utilizes convolutional layers instead of dense layers40, while a hybrid 1D CNN-LSTM model is integrated to perform fault isolation and support downstream analysis.
The nomenclature for this framework is summarized in Table 12. Key hyper-parameters for the CAE and the 1D CNN-LSTM are provided in Table 13 and Fig. 7, respectively. The selection of these parameters is informed by both the physical characteristics of water distribution networks and empirical validation. Specifically, the window size for the CAE is set to Tcae = 336 (one week) to capture a complete cycle of weekly water consumption and chlorine concentration patterns, which is essential for learning baseline behavior. For the CNN-LSTM, a window size of Tlstm = 48 (one day) is utilized to ensure sufficient temporal context for fault isolation while maintaining low computational latency for online deployment. Furthermore, we set α = 1.25 to derive sensor-specific thresholds as defined in Eq. (2); this value was selected to achieve an optimal balance between the True Positive Rate and the False Positive Rate across various fault magnitudes. All experiments in this study are repeated 20 times, and the results are reported as mean values with their corresponding standard deviations.
Table 12.
Nomenclature
| Variable | Description |
|---|---|
| Data | |
| D | Historical data, including Dn (normal) and Df (faulty); dimension: , where k is number of sensors and Toff the number of timesteps. |
| Historical normal data of sensor j in batch i, ; dimension: Rd. | |
| Historical faulty data of sensor j in batch i, ; dimension: Rd. | |
| X | Unlabeled arriving data, X = {x1,…,xk}; dimension: Rk×T, where T is number of timesteps. |
| Arriving data of sensor j in batch i; dimension: Rd. | |
| bi | Arriving batch i, ; dimension: Rk×d. |
| Reconstruction and prediction | |
| Reconstruction of bi, ; dimension: Rk×d. | |
| Reconstruction of ; dimension: Rd. | |
| Prediction of ; dimension: Rd. | |
| Model parameters | |
| CAE | CAE model. |
| CNN_LSTM | CNN-LSTM model. |
| LCAE | Loss function of CAE. |
| LCNN−LSTM | Loss function of CNN-LSTM. |
| θj | Anomaly threshold of sensor j. |
| α | Threshold adjustment parameter. |
| Tcae | Batch size of CAE input. |
| Tlstm | Batch size of CNN-LSTM input. |
Table 13.
Detail of different layers of CAE
| Layer | Type | Filters | Window size | Stride | Padding |
|---|---|---|---|---|---|
| 1 | Conv | 32 | 3 | 1 | Same |
| 2 | Pool(Max) | - | 2 | 1 | Same |
| 3 | Conv | 64 | 3 | 1 | Same |
| 4 | Pool(Max) | - | 2 | 1 | Same |
| 5 | Conv | 128 | 3 | 1 | Same |
| 6 | Pool(Max) | - | 2 | 1 | Same |
| 7 | TransConv | 128 | 3 | 1 | Same |
| 8 | UpSampling | - | 2 | - | - |
| 9 | TransConv | 64 | 3 | 1 | Same |
| 10 | UpSampling | - | 2 | - | - |
| 11 | TransConv | 32 | 3 | 1 | Same |
| 12 | UpSampling | - | 2 | - | - |
| 13 | Conv | Original Features | 3 | 1 | Same |
Fig. 7. Architecture of the integrated 1D CNN-LSTM model, where one-dimensional convolutional neural networks (CNN) extract local features and long short-term memory (LSTM) layers capture temporal patterns.

The diagram specifies hyper-parameters including kernel sizes, pooling factors, and the dropout rate (0.2) used to prevent overfitting prior to the final dense output layer.
During offline training, the multivariate time series data , where k is the number of sensors and Toff the number of time steps of D, is segmented into batches of length d. Let and denote the i-th batch from sensor j under normal and faulty conditions, respectively. Normal and faulty batches from D are organized into and , respectively, where j is the sensor index, i is the batch index and N is the number of batches.
The CAE is trained on normal data to reconstruct them, yielding . We did not opt for an edge or on-device design; while training separate CAEs per node or sensor may improve performance, it is costly and limits scalability. The reconstruction loss, computed using the Mean Squared Error (MSE), is used to set the fault detection threshold. For each training batch of size Tcae, the per-dimension batch loss for is defined as
| 1 |
and the corresponding threshold θj for each sensor j is determined by
| 2 |
where .
For CNN-LSTM training, the input is the residual between faulty signals and their corresponding CAE-reconstructed normal signals. As illustrated in Fig. 2, for each sensor j and batch i, the residual is used to emphasize fault-related deviations. This process is repeated for all batches and sensors. A smaller batch size Tlstm < Tcae is adopted in CNN-LSTM, since faults may occur within a batch. The CNN-LSTM is trained using the cross-entropy loss
| 3 |
where nc is the number of fault classes, y ∈ {1, …, nc} is the true label, and is the predicted probability for class c.
As shown in Fig. 2, the online module detects and reconstructs faulty sensor measurements, localizes sensor faults, classifies fault types, and infers candidate contamination source regions using expert knowledge (Rule 1 and Rule 2). The blue line represents the original signal, while the orange dashed line shows the CAE-reconstructed signal.
Step 1: Sensor fault detection and localization. A CAE is used in this step, with input dimension k corresponding to the number of sensors. The input data X ∈ Rk×T = {x1,…,xk} captures both normal behavior and potential faults, where T is time steps of arriving time. To model temporal patterns, the data is segmented into batches of size Tcae, where each batch bi consists of {}, and each represents consecutive readings from sensor j. The CAE outputs reconstructed signals {}, and computes the reconstruction loss per sensor. A fault at sensor sj is detected if the loss exceeds the offline-defined threshold θj.
Step 2: Faulty signal reconstruction. If is detected as faulty, its reconstruction is as the reconstructed signal. For the next batch, input is replaced with to limit fault impact on other sensors, given the multi-dimensional nature of the input. Leveraging signal periodicity (aligned with Tcae), approximates normal patterns and supports subsequent fault localization. Persistent or new faults can still be effectively detected in subsequent batches.
Step 3: Sensor fault isolation. Once sj is detected as faulty in bi, the difference is fed to the CNN-LSTM with batch size Tlstm, yielding a prediction . Classification uses majority voting. Each CAE batch of size Tcae yields Tcae/Tlstm predictions. In case of a tie, probabilities are evenly split. For instance, predictions [1, 2, 3, 3, 2, 2] yield class 2, while [1, 2, 1, 2, 2, 1] results in equal probabilities for classes 1 and 2.
Step 4: Contamination detection and candidate source-region inference. While multiple sensors may fail simultaneously, it is crucial to distinguish sensor faults from contamination events. This distinction is grounded in the hydraulic and reactive transport behavior of contaminants in WDNs. Under advective-dispersive transport, contaminant concentrations evolve gradually along the flow direction, resulting in spatially correlated anomalies that typically weaken downstream due to dilution and reaction kinetics. In contrast, common sensor faults (e.g., bias, drift, or missing readings) introduce localized measurement deviations without affecting the physical water quality state, and therefore do not exhibit downstream propagation patterns.
Based on these principles, we apply two differentiation rules:
Rule 1: A sudden and localized deviation in chlorine concentration at a node, without a corresponding downstream response, suggests a local sensor fault.
Rule 2: Anomalies that exhibit a downstream propagation pattern—i.e., consistent temporal onset along the flow direction and non-increasing magnitude until reaching a physical floor (e.g., zero chlorine)—indicate a contamination event.
These rules are theoretically consistent with mass conservation and contaminant transport dynamics in hydraulic networks. These rules are expected to be most informative when downstream spatial comparisons are available; their effectiveness may be limited in edge cases such as anomalies occurring at the downstream-most node, where spatial comparison is limited.
Once contamination is detected, candidate source-region inference is performed using spatial continuity. As in ref. 22, the contamination region is estimated by intersecting the upstream of sensors with detected anomalies () and the complement of the upstream of normal sensors (). Let and ; then the candidate contamination source region is inferred using
| 4 |
Consider the example in Fig. 5; according to Eq. (4), the contamination region is obtained by intersecting Upstream(N11, N7) with Upstream(N18, N20, N25, N30)c, resulting in a set of four nodes extending from N5 to N7 along the flow direction, which corresponds to the number of candidate source nodes reported in Table 10.
Computational analysis
External memory requirements: The proposed framework is lightweight in memory usage. At each online inference step, only a single batch of data needs to be stored, with dimensionality k × Tcae, where k is the number of sensors and Tcae is the CAE input length.
Model parameters: The total number of learnable parameters for our CAE and CNN-LSTM models is 193k + 111,040 and 35,940, respectively, where k is the sensor count. In the L-Town scenario, the CAE model occupies approximately 1 MB assuming 8 bytes per parameter; with INT8 quantization (1 byte per parameter), the size reduces to about 120 KB.
Training stage: During offline training, ∣Dn∣ historical normal signals are used to train the CAE, while ∣Df∣ historical faulty signals are used to train the CNN-LSTM. The total historical dataset is D = {Dn, Df}, with size k × Toff. Training is performed entirely offline.
Prediction stage: The system first performs a single forward propagation step of the batch with size k × Tcae through the CAE for reconstruction. Sensors with reconstruction losses exceeding their thresholds (i.e., fewer than k dimensions) are flagged as potentially faulty. Each flagged dimension then undergoes a single forward propagation step through the CNN-LSTM module to isolate the fault type. Finally, Rule 1 and Rule 2 are applied to distinguish sensor faults from contamination events. Suppose the average number of downstream sensors for each sensor is h. Then, the complexity of both rules is , where k is the number of sensors to check. Depending on the network topology, h is typically smaller than k and can be significantly smaller. If an event is identified as contamination, the system performs a single forward propagation step using the k prediction results in Eq. (4) to infer the candidate contamination source region. This design reduces computational overhead by applying the CNN-LSTM only to a small subset of dimensions, ensuring efficient online processing.
Evaluation metrics
Fault detection: False Positive Rate (FPR) and False Negative Rate (FNR) are used to quantify detection reliability. FPR represents the probability that the system triggers a false alarm during normal operation, while FNR measures the risk of missing a genuine fault. Additionally, Detection Latency (Det_Latency) is used to quantify the temporal responsiveness of the framework, which is critical in practice for timely intervention and mitigation of potential water quality risks.
Fault isolation & Contamination source-region prioritization: To evaluate fault isolation and contamination source-region prioritization, we adopt a Top-K Accuracy framework. For fault isolation, we report Top-1 Accuracy, reflecting the model’s ability to correctly identify the dominant fault type. For contamination source-region prioritization, we report Top-1, Top-3, and Top-10 Accuracy. While Top-1 represents exact source identification, Top-3 and Top-10 provide a more practical assessment in water distribution networks, where the inverse source identification problem is often ill-posed due to sparse sensor placement and complex hydraulic interactions. These metrics reflect the model’s ability to narrow down a set of likely candidate locations for further investigation. Importantly, Top-10 Accuracy should not be interpreted as exact source localization; instead, it measures whether the true source is included within a prioritized candidate set.
Faulty signal reconstruction: The Mean Squared Error (MSE)35 is used to quantify the accuracy of the reconstructed signals. By measuring the deviation between reconstructed outputs and ground-truth normal patterns, MSE provides an indication of how effectively the model removes fault-induced distortions while preserving the underlying system dynamics.
Fault Localization: We utilize HitRate@P%36 to evaluate anomaly localization in multivariate time series as it provides a more reliable assessment for high-dimensional sensor data compared to fixed-threshold precision metrics. Unlike traditional point-wise evaluations, this ranking-based metric accounts for the relative magnitude of reconstruction errors across all dimensions, which is particularly suitable for identifying faulty sensors when the absolute error magnitude may vary due to different sensor types. The metric is defined as the proportion of true faulty dimensions appearing among the top-ranked reconstruction-loss dimensions
| 5 |
where HitRate@P% measures the overlap between GT_i and the top ⌊P% × ∣GTi∣⌋ highest-loss dimensions in ASi, which represents the reconstruction loss ranking at batch i, ∣GTi∣ is the ground truth length, and P is set to 100 in this study to ensure all truly anomalous dimensions are theoretically reachable in the ranking.
Acknowledgements
This work was supported by the European Research Council (ERC) under grant agreement No. 951424 (Water-Futures), and the Republic of Cyprus through the Deputy Ministry of Research, Innovation, and Digital Policy.
Author contributions
J.L. conceived the study, developed the methodology, and prepared the original manuscript draft. K.M. contributed to manuscript improvement and provided experimental guidance. D.G.E. contributed to manuscript improvement. M.M.P. contributed to problem formulation, manuscript improvement, oversaw the research project, funding acquisition, and overall supervision. All authors reviewed the manuscript.
Data availability
The datasets generated and/or analyzed during the current study are available in the GitHub repository and can be accessed via the link: https://github.com/Jin000001/waterqualitymonitoring.
Code availability
The code used to generate the data and reproduce the results of this study are available in the GitHub repository and can be accessed via the link: https://github.com/Jin000001/waterqualitymonitoring.
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
References
- 1.Mac Kenzie, W. R. et al. A massive outbreak in Milwaukee of cryptosporidium infection transmitted through the public water supply. N. Engl. J. Med.331, 161–167 (1994). [DOI] [PubMed] [Google Scholar]
- 2.Lienemann, T. et al. Shiga toxin-producing Escherichia coli o100: H–: stx 2e in drinking water contaminated by waste water in Finland. Curr. Microbiol.62, 1239–1244 (2011). [DOI] [PubMed] [Google Scholar]
- 3.Xi, Z. & Yun, Z. Problems and countermeasures of controlling cyanobacteria bloom in Taihu Lake. J. Environ. Eng. Technol.9, 714–719 (2019). [Google Scholar]
- 4.Ni, K. et al. Sensor network data fault types. ACM Trans. Sens. Netw.5, 1–29 (2009). [Google Scholar]
- 5.García, D. et al. Prognosis of quality sensors in the Barcelona drinking water network. In Proc. 2016 3rd Conference on Control and Fault-Tolerant Systems (SysTol), 446–451 (IEEE, 2016).
- 6.Creaco, E. et al. Real time control of water distribution networks: a state-of-the-art review. Water Res.161, 517–530 (2019). [DOI] [PubMed] [Google Scholar]
- 7.Li, D., Wang, Y., Wang, J., Wang, C. & Duan, Y. Recent advances in sensor fault diagnosis: a review. Sens. Actuators A Phys.309, 111990 (2020). [Google Scholar]
- 8.Ntalampiras, S. Fault identification in distributed sensor networks based on universal probabilistic modeling. IEEE Trans. Neural Netw. Learn. Syst.26, 1939–1949 (2014). [DOI] [PubMed] [Google Scholar]
- 9.Kullaa, J. Detection, identification, and quantification of sensor fault in a sensor network. Mech. Syst. Signal Process.40, 208–221 (2013). [Google Scholar]
- 10.Bouzid, S. & Ramdani, M. Sensor fault detection and diagnosis in drinking water distribution networks. In Proc. 2013 8th International Workshop on Systems, Signal Processing and their Applications (WoSSPA), 378–383 (IEEE, 2013).
- 11.Vaquet, V., Artelt, A., Brinkrolf, J. & Hammer, B. Taking care of our drinking water: dealing with sensor faults in water distribution networks. In Proc. International Conference on Artificial Neural Networks, 682–693 (Springer, 2022).
- 12.Kim, M. & Kim, H. Movable wireless sensor-enabled waterway surveillance with enhanced coverage using multi-layer perceptron and reinforced learning. Electronics14, 3295 (2025). [Google Scholar]
- 13.Kim, H. & Ben-Othman, J. Famu: fault-tolerant mutual assisted virtual emotion barrier system using intelligent smart uavs. IEEE Trans. Veh. Technol.70, 10845–10852 (2021). [Google Scholar]
- 14.Laird, C. D., Biegler, L. T., van Bloemen Waanders, B. G. & Bartlett, R. A. Contamination source determination for water networks. J. Water Resour. Plan. Manag.131, 125–134 (2005). [Google Scholar]
- 15.Cristo, C. D. & Leopardi, A. Pollution source identification of accidental contamination in water distribution networks. J. Water Resour. Plan. Manag.134, 197–202 (2008). [Google Scholar]
- 16.Adedoja, O. S., Hamam, Y., Khalaf, B. & Sadiku, E. R. Development of an algorithm for the estimation of contamination sources in a water distribution network. IEEE Access8, 200412–200419 (2020). [Google Scholar]
- 17.Eliades, D. G., Vrachimis, S. G., Moghaddam, A., Tzortzis, I. & Polycarpou, M. M. Contamination event diagnosis in drinking water networks: a review. Annu. Rev. Control55, 420–441 (2023). [Google Scholar]
- 18.Li, Z., Liu, H., Zhang, C. & Fu, G. Generative adversarial networks for detecting contamination events in water distribution systems using multi-parameter, multi-site water quality monitoring. Environ. Sci. Ecotechnology14, 100231 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Grbčić, L., Lučin, I., Kranjčević, L. & Družeta, S. A machine learning-based algorithm for water network contamination source localization. Sensors20, 2613 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.Sankary, N. & Ostfeld, A. Bayesian localization of water distribution system contamination intrusion events using inline mobile sensor data. J. Water Resour. Plan. Manag.145, 04019029 (2019). [Google Scholar]
- 21.Costa, D., Melo, L. & Martins, F. Localization of contamination sources in drinking water distribution systems: a method based on successive positive readings of sensors. Water Resour. Manag.27, 4623–4635 (2013). [Google Scholar]
- 22.Li, J., Malialis, K., Vrachimis, S. G. & Polycarpou, M. M. Online detection of water contamination under concept drift. In Proc. 2025 IEEE Symposia on Computational Intelligence for Energy, Transport and Environmental Sustainability (CIETES Companion), 1–5 (IEEE, 2025).
- 23.Hermans, M. & Schrauwen, B. Training and analysing deep recurrent neural networks. Advances in Neural Information Processing Systems, Vol. 26. https://proceedings.neurips.cc/paper_files/paper/2013/file/1ff8a7b5dc7a7d1f0ed65aaa29c04b1e-Paper.pdf (2013).
- 24.Hochreiter, S. & Schmidhuber, J. Long short-term memory. Neural Comput.9, 1735–1780 (1997). [DOI] [PubMed] [Google Scholar]
- 25.Park, D., Hoshi, Y. & Kemp, C. C. A multimodal anomaly detector for robot-assisted feeding using an lstm-based variational autoencoder. IEEE Robot. Autom. Lett.3, 1544–1551 (2018). [Google Scholar]
- 26.Vrachimis, S. G., Timotheou, S., Eliades, D. G. & Polycarpou, M. M. Leakage detection and localization in water distribution systems: a model invalidation approach. Control Eng. Pract.110, 104755 (2021). [Google Scholar]
- 27.Constans, S., Brémond, B. & Morel, P. Simulation and control of chlorine levels in water distribution networks. J. Water Resour. Plan. Manag.129, 135–145 (2003). [Google Scholar]
- 28.Karamouz, M., Yousefi, A., Zahmatkesh, Z., Mahmoodzadeh, D. & Pirooz, M. D. Simulation of chlorine injection in water distribution networks in response to contaminations. Int. J. Environ. Res.16, 6 (2022). [Google Scholar]
- 29.Fujiwara, O. & Khang, D. B. A two-phase decomposition method for optimal design of looped water distribution networks. Water Resour. Res.26, 539–549 (1990). [Google Scholar]
- 30.Zheng, F., Simpson, A. R. & Zecchin, A. C. A combined NLP-differential evolution algorithm approach for the optimization of looped water distribution systems. Water Resour. Res. 47 (2011).
- 31.Vrachimis, S. G. et al. Battle of the leakage detection and isolation methods. J. Water Resour.148, 04022068 (2022). [Google Scholar]
- 32.Eliades, D., Kyriakou, M. & Polycarpou, M. M. Sensor placement in water distribution systems using the s-place toolkit. Procedia Eng.70, 602–611 (2014). [Google Scholar]
- 33.Sharma, S., Gupta, K., Gupta, D., Rani, S. & Dhiman, G. An insight survey on sensor errors and fault detection techniques in smart spaces. Comput. Model. Eng. Sci. 138, 2029–2059 (2024).
- 34.Artelt, A. et al. Epyt-flow: A toolkit for generating water distribution network data. J. Open Source Softw.9, 7104 (2024). [Google Scholar]
- 35.Schluchter, M. D. Mean square error. In Encyclopedia of Biostatistics, Vol. 5 10.1002/0470011815.b2a15087 (2005). [DOI]
- 36.Su, Y. et al. Robust anomaly detection for multivariate time series through stochastic recurrent neural network. In Proc. 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2828-2837. 10.1145/3292500.3330672 (2019). [DOI]
- 37.Artelt, A. et al. A toolbox for supporting research on AI in water distribution networks. In Proc. AI for Critical Infrastructure Workshop @ IJCAI-24https://openreview.net/forum?id=JREiu8ghNz (2024).
- 38.Vrachimis, S. G. et al. LeakDB: A benchmark dataset for leakage diagnosis in water distribution networks. In Proc. WDSA/CCWI Joint Conference, Vol. 1, 146 (2018).
- 39.Burkhardt, J. B., Szabo, J., Klosterman, S., Hall, J. & Murray, R. Modeling fate and transport of arsenic in a chlorinated distribution system. Environ. Model. Softw.93, 322–331 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 40.Zhang, Y. A better autoencoder for image: convolutional autoencoder. In ICONIP17-DCEC. Available online: http://users.cecs.anu.edu.au/Tom.Gedeon/conf/ABCs2018/paper/ABCs2018_paper_58.pdf (2018).
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The datasets generated and/or analyzed during the current study are available in the GitHub repository and can be accessed via the link: https://github.com/Jin000001/waterqualitymonitoring.
The code used to generate the data and reproduce the results of this study are available in the GitHub repository and can be accessed via the link: https://github.com/Jin000001/waterqualitymonitoring.
