Real-Time Detection of River Contaminants Using Neural Networks: A Case Study of the Ebro River
Abstract
1. Introduction
2. Methodology
2.1. Foundations and Structure of the MMF Methodology
2.2. Methodological Framework of the IE Algorithms
2.2.1. LMS Algorithm and SWMM Simulation
- (a)
- Flow Governing Equations
- (b)
- Transport Governing Equations
2.2.2. Learning Database
- (A)
- Training and Test Data
- (B)
- Regression and Classification algorithms
3. Results
3.1. Site Description and Testing Methodology
3.2. Regression Algorithm Test Case I
3.3. Performance of the Classification Model for Test Case I
4. Analysis and Discussion
4.1. MMF: Robustness and Accuracy
4.2. MMF Prediction for Real Time
5. Conclusions
Supplementary Materials
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviations
| ANN | Artificial Neural Network |
| CHE | Ebro River Basin Authority |
| COD | Chemical Oxygen Demand |
| DEM | Digital Elevation Model |
| EPA | Environmental Protection Agency |
| GIS | Geographic Information System |
| HECRAS | Hydrologic Engineering Center River Analysis System |
| IE | Inverse Estimation algorithm |
| Keras | Python-based deep learning framework |
| LD | Learning Database |
| LMS | Launching Multiple Scenarios |
| MAE | Mean Absolute Error |
| MARE | Mean Absolute Relative Error |
| MSE | Mean Squared Error |
| MSRE | Mean Square Relative Error |
| MMF | Monitoring and Mitigation Framework |
| MITECO | Ministry for the Ecological Transition and the Demographic Challenge of Spain |
| ML | Machine Learning |
| QGIS | Quantum Geographic Information System |
| RAS | River Analysis System |
| Randomized Search | Randomized search technique for hyperparameter tuning |
| ReLU | Rectified Linear Unit |
| Scikit-learn | Python library for machine learning |
| Sklearn | (Alias commonly used for Scikit-learn) |
| SVM | Support Vector Machines |
| SWMM | Storm Water Management Model |
| TensorFlow | Deep learning framework developed by Google |
| UNESCO | United Nations Educational, Scientific and Cultural Organization |
References
- Wei, H.; Sun, J.; Shan, W.; Xiao, W.; Wang, B.; Ma, X.; Hu, W.; Wang, X.; Xia, Y. Environmental chemical exposure dynamics and machine learning-based prediction of diabetes mellitus. Sci. Total Environ. 2022, 806, 150674. [Google Scholar] [CrossRef]
- Hasan, F.; Kabashi, N.; Saleh, T.; Alam, M.; Wahab, M. Water quality monitoring using machine learning and IoT: A review. Chem. Nat. Resour. Eng. J. 2024, 8, 32–54. [Google Scholar] [CrossRef]
- Nguyen, G. Evaluating current water quality monitoring system on Hau River. Appl. Environ. Res. 2020, 42, 14–25. [Google Scholar] [CrossRef]
- Liu, M.; Li, J.; Li, Y.; Gao, W.; Lu, J. Data-driven identification of pollution sources and water quality prediction using Apriori and LSTM models: A case study in the Hanjiang River basin. J. Contam. Hydrol. 2025, 272, 104570. [Google Scholar] [CrossRef] [PubMed]
- Islam, F.; Saha, A.; Shultana, S.; Khan, R.A. Pollution and treatment of industrial wastewater. Int. J. Sch. Res. Eng. Technol. 2023, 2, 001–012. [Google Scholar] [CrossRef]
- Zhang, S.; Wang, S.; Li, F.; Liu, S.; You, Y.; Liu, C. Enhanced assessment of water quality and pollutant source apportionment using APCS-MLR and PMF models in the upper reaches of the Tarim River. Water 2024, 16, 3061. [Google Scholar] [CrossRef]
- Bixler, T.S.; Collins, M.R.; Mo, W. Risk-based public health impact assessment for drinking water contamination emergencies. Sci. Total Environ. 2024, 931, 172966. [Google Scholar] [CrossRef]
- Jin, T.; Cai, S.; Jiang, D.; Liu, J. A data-driven model for real-time water quality prediction and early warning by an integration method. Environ. Sci. Pollut. Res. 2019, 26, 30374–30385. [Google Scholar] [CrossRef]
- Nhapi, I.; Dalu, J.; Ndamba, J.; Siebel, M.A.; Gijzen, H.J. Evaluation of duckweed-based pond systems in Zimbabwe. Water Sci. Technol. 2003, 48, 323–330. [Google Scholar] [CrossRef]
- Fan, L.; Zhang, X.; Li, Q.; Liu, Y.; Wang, H.; Zang, S. Removal of nitrogen and phosphorus in low-polluted wastewater by aquatic plants. Water 2024, 16, 2002. [Google Scholar] [CrossRef]
- Uddin, G.; Sajjad, W.; Haq, A.; Song, J.; Li, P.; Fan, Q. Pollution status and remediation strategies for potentially toxic elements in Baiyin, Northwest China: Lesson from a typical resource-exhausted mining area. Curr. Pollut. Rep. 2025, 12, 1. [Google Scholar] [CrossRef]
- Whelton, A.J.; McMillan, L.; Novy, C.L.-R.; White, K.D.; Huang, X. The crude MCHM chemical spill investigation. Environ. Sci. Water Res. Technol. 2017, 3, 312–332. [Google Scholar] [CrossRef]
- Sánchez-Fortún, M.; Ouled-Cheikh, J.; Jover, C.; García-Tarrasón, M.; Carrasco, J.L.; Sanpera, C. Mercury pollution in the Ebro Delta. Environ. Pollut. 2020, 266, 115232. [Google Scholar] [CrossRef] [PubMed]
- Liang, Y.Y.; Li, M. Unsteady-State Dynamics and AI in Membrane Desalination: Challenges and Emerging Opportunities. Desalination 2026, 618, 119507. [Google Scholar] [CrossRef]
- Cabezas, A.; Comín, F.A.; Walling, D.E. Changing patterns of organic carbon and nitrogen accretion on the Middle Ebro floodplain (NE Spain). Ecol. Eng. 2009, 35, 1547–1558. [Google Scholar] [CrossRef]
- Bonet, E.; Yubero, M.T.; Sanmiquel, L.; Bascompta, M. Monitoring and mitigation framework for contaminant spills in a river. Model. Earth Syst. Environ. 2025, 11, 213. [Google Scholar] [CrossRef]
- Confederación Hidrográfica del Ebro (CHE). Hydrological Data and Operational Flow Regimes of the Ebro River Basin; CHE: Zaragoza, Spain, 2024; Available online: https://www.chebro.es (accessed on 5 March 2024).
- Torrecilla, N.J.; Galve, J.P.; Zaera, L.G.; Retamar, J.F.; Álvarez, A.N.A. Nutrient sources and dynamics in the Ebro River. J. Hydrol. 2005, 304, 166–182. [Google Scholar] [CrossRef]
- Confederación Hidrográfica del Ebro (CHE). Monitoring of the Status of Water Bodies; CHE: Zaragoza, Spain, 2023; Available online: https://www.chebro.es (accessed on 5 March 2024).
- DGA-UZ. Clasificación de Las Aguas Superficiales en la Cuenca del Ebro, Anexo 11; CHE: Zaragoza, Spain, 1996; Available online: https://www.chebro.es/documents/20121/287514/MEMORIA.pdf (accessed on 25 May 2024).
- Ibáñez, C.; Prat, N.; Canicio, A. Changes in hydrology and sediment transport by dams in the Ebro River and its estuary. Regul. Rivers Res. Manag. 1996, 12, 51–62. [Google Scholar] [CrossRef]
- Sabater, S.; Artigas, J.; Gaudes, A.; Muñoz, I.; Urrea, G.; Romaní, A.M. Long-term nutrient inputs enhance autotrophy. Freshw. Biol. 2011, 56, 1266–1280. [Google Scholar] [CrossRef]
- Bonet, E.; Yubero, M.T.; Sanmiquel, L.; Bascompta, M. Algorithms for source location source location and chemical oxygen demand concentration over time along the river. Environ. Technol. Innov. 2025, 39, 104230. [Google Scholar] [CrossRef]
- U.S. Environmental Protection Agency. SWMM 5.1 User Manual; EPA: Washington, DC, USA, 2015. Available online: https://www.epa.gov (accessed on 25 May 2024).
- Henderson, F.M. Open Channel Flow; MacMillan: New York, NY, USA, 1996. [Google Scholar]
- Martin, J.L.; McCutcheon, S.C. Hydrodynamics and Transport for Water Quality Modeling; Lewis Publishers: Boca Raton, FL, USA, 1999. [Google Scholar]
- Beltrán, A.P.; Iniesta, J.; Gras, L.; Gallud, F.; Montiel, V.; Aldaz, A.; Canals, A. Development of a fully automated microwave-assisted chemical oxygen demand measurement device. Instrum. Sci. Technol. 2003, 31, 249–259. [Google Scholar] [CrossRef]
- Bonet, E.; Yubero, M.T.; Sanmiquel, L.; Bascompte, M. Neural network approaches for leakage flow quantification in masonry dam. J. Innov. Infrastruct. Solut. 2024, 9, 426. [Google Scholar] [CrossRef]
- Kuhn, M.; Johnson, K. Applied Predictive Modeling; Springer: New York, NY, USA, 2018. [Google Scholar] [CrossRef]
- Buitinck, L.; Louppe, G.; Blondel, M.; Pedregosa, F.; Mueller, A.; Grisel, O.; Niculae, V.; Prettenhofer, P.; Gramfort, A.; Grobler, J.; et al. API design for machine learning software: Experiences from the scikit-learn project. arXiv 2013, arXiv:1309.0238. [Google Scholar] [CrossRef]
- Agrawal, A.; Modi, A.N.; Passos, A.; Lavoie, A.; Agarwal, A.; Shankar, A.; Ganichev, I.; Levenberg, J.; Hong, M.; Monga, R.; et al. TensorFlow Eager: A multi-stage, Python-embedded DSL for machine learning. arXiv 2019, arXiv:1903.01855. [Google Scholar]
- Barati Moghaddam, M.; Mazaheri, M.; Mohammad Vali Samani, J. An innovative framework for real-time monitoring of pollutant point sources in river networks. Stoch. Environ. Res. Risk Assess. 2022, 36, 1791–1818. [Google Scholar] [CrossRef]
- Yang, H.; Li, J.; Liu, B.; Chen, L. Source identification of hazardous chemical leakage in water. Environ. Sci. Pollut. Res. 2021, 28, 67292–67309. [Google Scholar] [CrossRef]
- Lu, W.Z.; Fan, H.Y.; Leung, A.Y.T.; Wong, J.C.K. Pollutant levels in Hong Kong using neural network with PSO. Environ. Monit. Assess. 2002, 79, 217–230. [Google Scholar] [CrossRef]
- Norouzi, H.; Bazargan, J. Investigation of river pollution using Muskingum and PSO. Appl. Water Sci. 2024, 14, 68. [Google Scholar] [CrossRef]
- Hu, C.; Xiao, X.; Shen, D.; Cao, B.; Wen, X. Study of water pollution early warning framework based on Internet of Things. Int. Arch. Photogramm. Remote Sens. Spat. Inf. Sci. 2016, XLI-B8, 335–338. [Google Scholar] [CrossRef]
- Essamlali, I.; Nhaila, H.; El Khaili, M. Advances in machine learning and IoT for water quality monitoring: A comprehensive review. Heliyon 2024, 10, e27920. [Google Scholar] [CrossRef]
- Sit, M.; Demiray, B.Z.; Xiang, Z.; Ewing, G.J.; Sermet, Y.; Demir, I. Review of deep learning in hydrology. Water Sci. Technol. 2020, 82, 2635–2670. [Google Scholar] [CrossRef]
- Thelen, A.; Zhang, X.; Fink, O.; Lu, Y.; Ghosh, S.; Youn, B.D.; Todd, M.D.; Mahadevan, S.; Hu, C.; Hu, Z. A comprehensive review of digital twin—Part 1. arXiv 2022, arXiv:2208.14197. [Google Scholar]
- Dysarz, T. Application of Python scripting techniques for control and automation of HEC-RAS simulations. Water 2018, 10, 1382. [Google Scholar] [CrossRef]
- Huang, W.; Jiang, J.; Liu, X. Online non-convex learning for river pollution source identification. arXiv 2022, arXiv:2005.11065. [Google Scholar] [CrossRef]
- Víctoriano, J.P.; Manzano, J.A.; Aguilar, J.G.A.; Mariano, T.P. Water quality classification using random forest. arXiv 2022, arXiv:2202.06066. [Google Scholar]
- Zhang, Y.; Zhou, X.; Wang, C. Deep Learning for Water Quality Prediction—A Case Study of the Huangyang Reservoir. Appl. Sci. 2024, 14, 8755. [Google Scholar] [CrossRef]





Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Bonet, E.; Yubero, M.T.; Llado, J.; Sanmiquel, L. Real-Time Detection of River Contaminants Using Neural Networks: A Case Study of the Ebro River. Water 2026, 18, 403. https://doi.org/10.3390/w18030403
Bonet E, Yubero MT, Llado J, Sanmiquel L. Real-Time Detection of River Contaminants Using Neural Networks: A Case Study of the Ebro River. Water. 2026; 18(3):403. https://doi.org/10.3390/w18030403
Chicago/Turabian StyleBonet, Enrique, Maria Teresa Yubero, Jordi Llado, and Lluis Sanmiquel. 2026. "Real-Time Detection of River Contaminants Using Neural Networks: A Case Study of the Ebro River" Water 18, no. 3: 403. https://doi.org/10.3390/w18030403
APA StyleBonet, E., Yubero, M. T., Llado, J., & Sanmiquel, L. (2026). Real-Time Detection of River Contaminants Using Neural Networks: A Case Study of the Ebro River. Water, 18(3), 403. https://doi.org/10.3390/w18030403

