scieee AI-readable full text Open interactive document viewer

Anomaly Detection using Machine Learning Models in Water Supply Systems

Cruz de Sousa, Ana Luís; Rocha, Eugénio; Andrade-Campos, António

Full text

TEchMA 2025 New Frontiers in Mechanical Engineering recuperarportugal.gov.pt Fig 1 / Statistics about water loss in water supply systems. Tab 1 / Results of the proposed methodology concerning the regressor metrics. Anomaly Detection using Machine Learning Models in Water Supply Systems Abstract Water loss remains a critical global concern, particularly in the context of increasing water scarcity. Water supply systems (WSS) face significant challenges due to leakage, which can persist undetected for long periods and severely impact system efficiency. The occurrence of water leakage in these systems can range from 3% to over 50% depending on the level of system network maintenance performed, since it happens in pipe and/or junctions by uncontrolled actions [1]. Moreover, and according to the Portuguese regulator ERSAR in the RASARP 2024 [2], actual water leakage in Portugal in 2023 was 5.5 m3/(km day) for the bulk side, which corresponds to a loss of more than 21 billion m3/year. On the other hand, on the distribution side the value was 2.4 m3/(km day) representing 4.6 billion m3/year. Addressing this issue requires effective detection and localization techniques, where Machine Learning (ML) and digital twin technologies offer promising solutions for automated data analysis and hydraulic simulation. This work presents a novel ML-based subframework for detecting anomalies in pressure time series, where minor discrepancies may indicate potential leakage scenarios in the water system. This approach is implemented on a benchmark dataset, the BattLeDIM network [3], in which different MLbased models, such as Neural Networks, Convolutional Neural Networks, and Gated Recurrent Units, were evaluated and then compared with prior baseline results. Where DLbased methods achieved an improvement of 40% in classification performance. Introduction Water leakage is a problem in WSS, which can be caused by infrastructure conditions as pipe material, age-related conditions, inadequate fittings, etc [4] and/or mechanical damage such as pipe loading, system pressure, pipe defects, among others [5]. Results The ML-based model tested for the regressor module were: Neural Network (NN), Convolution Neural Network (CNN) and Gated Recurrent Neural Network (GRU) Results from the proposed methodology: •GRU regressor tends to overfit (best RMSE in train -> worst in test) •NN and CNN very similar •All classifiers with high TPR and low FPR Fig 2 / Proposed methodology: pre-detection leak alarm model. Fig 3 / BattLeDIM benchmark network configuration. Ana Luís Sousa, Eugénio Rocha and António Andrade-Campos Methodology A pre-detection leak alarm framework is proposed, where ML-based techniques are applied to detect anomalies in pressure time series. Pre-processing module: •Create daily sequences and samples of the day 𝑡𝑡𝑑𝑑with pressure and flow values for day (𝑃𝑃𝑡𝑡𝑑𝑑, 𝑄𝑄𝑡𝑡𝑑𝑑); previous day (𝑃𝑃𝑡𝑡𝑑𝑑−1, 𝑄𝑄𝑡𝑡𝑑𝑑−1); previous weekday (𝑃𝑃𝑡𝑡𝑑𝑑−7, 𝑄𝑄𝑡𝑡𝑑𝑑−7); and status (‘ok’ or ‘leak’) Regressor (sensor forecaster): •ML-based model with input: 𝑃𝑃𝑡𝑡𝑑𝑑−1, 𝑃𝑃𝑡𝑡𝑑𝑑−7, 𝑄𝑄𝑡𝑡𝑑𝑑, 𝑄𝑄𝑡𝑡𝑑𝑑−1, 𝑄𝑄𝑡𝑡𝑑𝑑−7 and output: 𝑃𝑃𝑡𝑡𝑑𝑑 •Loss calculation with RMSE Classifier data (anomaly detection): •Mathematical approach of an anomaly condition: threshold of the maximum train RMSE, with a weight value (calibrated with ‘ok’ and ‘leak’ data) •Test performance metrics: f1 score; mcc and confusion matrix This methodology was applied to a case study benchmark “Battle of Leakage Detection and Isolation Methods (BattLeDIM)” [5]. The network has: •3 DMA •data from 2018 and 2019 •pressure and flow time series (values for each 5min) •leak information (for day:hour and pipe location) DMA B DMA C DMA A Reservoir flows Tank level + Pump flow Demands DMA C Pressure sensors (no. 33) Leaks in 2018 (no. 10) Leaks in 2019 (no. 19) Leaks between 2018-2019 (no. 4) Results from BattLeDIM (Leakbusters team): •Linear regression applied for the 5min sampling •Results adapted for 1day sample to have comparable results Fig 4 / Confusion matrix regarding the anomaly detection using the different models for the proposed methodology. Conclusions *comparable results Balanced results Despite different regression errors, all classifiers present similar good results (high F1, MCC and TPR and low FPR) MCC improvement of 40% DL-based methodology is better when considering 1day sample analysis Linear regression with high FPR The linear regression with 1day samples, applied by the Leakbusters, has a very high FPR –leading to many “false alarms” References [1] R. Puust, Z. Kapelan, D. A. Savic, and T. Koppel. A review of methods for leakage management in pipe networks. Urban Water Journal, 7(1): 25–45, February 2010. Doi: 10.1080/15730621003610878. [2] ERSAR. Edições anuais do RASARP –Vol 1, 2024. https://www.ersar.pt/informacao-relevante-setor/. [3] Vrachimis, S. G., Eliades, D. G., Taormina, R., Kapelan, Z., Ostfeld, A., Liu, S., Kyriakou, M., Pavlou, P., Qiu, M., and Polycarpou, M. M. (2022). “Battle of the leakage detection and isolation methods.” Journal of Water Resources Planning and Management, 148(12), 04022068. Doi: 10.1061/(ASCE)WR.1943-5452.0001601. [4] Zaman, D., Tiwari, M. K., Gupta, A. K., and Sen, D. (2020). “A review of leakage detection strategies for pressurised pipeline in steady-state.” Engineering Failure Analysis, 109, 104264. Doi: 10.1016/j.engfailanal.2019.104264. [5] Lopez, L. L., Van Zyl, J. E., and Kelly, P. A. (2025). “Conceptual Framework for Leak Development in Water Distribution Systems.” Journal of Water Resources Planning and Management, 151(6),118204025011. Doi: 10.1061/JWRMD5.WRENG-6673. in a maintained system in poorly maintained systems and undeveloped countries Amount of water loss [1]: According to ERSAR’s report, in the year 2023 [2]: for the bulk side m3/(km day) billion m3/year for the distribution side m3/(km day) billion m3/year Start Data preprocessing Data collection Classifier data (anomaly detection) Error𝑡𝑡𝑑𝑑 Test > w × Errormax no Anomaly detected No anomaly detected Anomaly detection module: Error𝑡𝑡𝑑𝑑=� 𝑖𝑖=1 𝑛𝑛win 𝑦𝑦𝑡𝑡𝑑𝑑,𝑖𝑖− �𝑦𝑦𝑡𝑡𝑑𝑑,𝑖𝑖2 𝑛𝑛win 𝑡𝑡𝑑𝑑=1,…,𝑛𝑛days 𝑖𝑖=1,…,𝑛𝑛win 𝑛𝑛win:no.of points in each time window End yes 𝑛𝑛days:no.of days w: threshold weight Predictive module: 𝐲𝐲𝑡𝑡𝑑𝑑−7 ML model 𝐲𝐲𝑡𝑡𝑑𝑑−1 � 𝐲𝐲𝑡𝑡𝑑𝑑 𝑡𝑡𝑑𝑑= 1, … , 𝑛𝑛days 𝑦𝑦= sensor info �𝑦𝑦 =predicted sensor info Perfect system trained Regressor (sensor forecaster) Pre-processing module Acknowledgement This work is supported by the doctoral grant (Ref. 2023.02917.BDANA https://doi.org/10.54499/2023.02917.BD ANA) financed by the Portuguese Foundation for Science and Technology (FCT), and under the project/support UID/00481 –Centre for Mechanical Technology and Automation (TEMA). And through the FEDER and Regional Operational Program of the Center Region (CENTRO2030) within project I-ReTiSLeaksD&Op nº 17304 (CENTRO2030FEDER-01177300) and through the Portuguese Foundation for Science and Technology (FCT), supported by the Recovery and Resilience Plan (PRR), within project I-ReTiS-Leaks (2024.07270.IACDC). Model Average RMSE train data A verage RMSE classifier data Average RMSE test data NN 0.3979 0.6696 0.6683 CNN 0.2962 0.6668 0.6699 GRU 0.2944 0.9468 0.9369 Tab 2 / Results of the proposed methodology regarding the test metrics. Model Threshold weight F1 score MCC score True Positive Rate (TP/anomalies) False Positive Rate (FP/n-anomalies) NN 0.737 0.919 0.778 88.5% (85/96) 8.3% (4/48) CNN 0.834 0.910 0.754 86.0% (86/100) 6.7% (3/45) GRU 0.640 0.911 0.747 87.0% (87/100) 8.9% (4/45) Tab 3 / Results of the Leakbuster team from the BattLeDIM benchmark. Model Threshold weight Sample sequence F1 score MCC score True Positive Rate (TP/anomalies) False Positive Rate (FP/n -anomalies) Linear regression 51 day 0.627* 0.560* 99.1% (325/328) 56.8% (21/37) 5 min 0.944 0.686 89.5% (83956/93851) 0.6% (67/11269) NN CNN GRU