Optimization of Water Distribution Network Design Using WaterGEMS and Sequential Quadratic Programming Algorithm: A Case Study of Birjand Zaferanieh Network

Document Type : Complete scientific research article

Authors

1 Corresponding Author, Assistant Prof., Dept. of Civil Engineering, Faculty of Engineering, University of Birjand, Birjand, Iran

2 Ph.D. Student in Water Resources Engineering and Management, University of Birjand, Birjand, Iran.

Abstract

Background and Objective: Urban water distribution networks (WDNs) account for over 80 % of total water-supply costs in semi-arid regions such as Birjand, Iran. In the Zafaraniyeh residential district, anticipated increases in water demand through the planning horizon of 1433 necessitate a cost-effective and hydraulically reliable network design. This study introduces an integrated methodology—referred to as SQP–WDN—that concurrently leverages detailed hydraulic simulation in Bentley WaterGEMS and constrained nonlinear optimization via the Sequential Quadratic Programming (SQP) algorithm in MATLAB. The main objective of this method is to determine the optimal pipe diameters that minimize total network investment while ensuring all hydraulic constraints, including minimum node pressures and allowable flow velocities, are rigorously satisfied.
Materials and Methods: The target network comprises 21 demand nodes and 27 pipeline segments, modeled in WaterGEMS using high-resolution topographic maps and nodal elevation data ranging from 1485 to 1565 m above mean sea level. Hourly water demand at each node; varying from approximately 1.06 m³/h to 17.67 m³/h; was estimated by averaging results obtained from three demand-estimation techniques (geometric, arithmetic, and Fire’s method). All pipes were assigned a Hazen–William’s roughness coefficient of C = 130. Hydraulic constraints imposed on the system included a maximum allowable flow velocity of 2.0 m/s, a minimum permissible velocity of 0.3 m/s. Additionally, the minimum required pressure at all nodes was defined as 30 meters of water head. In the initial network configuration, the principal reservoir (Node R-1) was fixed at an elevation of 1565 m and supplied flow at a steady rate of 37.9 L/s through pipe segment 27 to Node J-20 (elevation 1521.8 m). WaterGEMS was used to perform steady-state hydraulic simulations, applying the Hazen–Williams’s formulation to calculate head losses. Critical sections, where simulated nodal pressures dropped below the defined minimum under peak-demand conditions, were identified, indicating the necessity of an optimization procedure to ensure sufficient pressure throughout the network. To address the pipe-sizing problem, the SQP algorithm was implemented in MATLAB. The objective function was formulated to minimize the total cost of all pipeline segments, with each segment’s cost determined by a cost–diameter polynomial calibrated to prevailing market prices. A velocity-penalty term was incorporated into the objective so that, if a candidate pipe diameter resulted in flow velocity exceeding 2.0 m/s or falling below 0.3 m/s, the objective value increased substantially, rendering that diameter choice suboptimal. The primary design constraints included mass-balance at each node (net inflows equal net outflows) and maintenance of nodal pressures within the allowable range. To automate the iterative coupling between WaterGEMS and MATLAB, a VBA script was developed in WaterGEMS to export simulation outputs (nodal pressures, pipe flows, lengths, and nominal diameters) into an Excel workbook after each simulation. MATLAB then ingested these data, evaluated the objective function and constraints, and updated pipe diameters accordingly. In the subsequent iteration, MATLAB recorded the revised diameters back into the Excel file, and WaterGEMS reran the hydraulic simulation. This bidirectional data exchange continued until convergence criteria were met—specifically, when successive changes in the total cost and pipe diameters fell below predefined tolerances. Prior to applying SQP–WDN to the Zafaraniyeh network, the methodology was validated on the benchmark two‐loop network introduced by Alperovitz and Shamir. This validation network comprised seven nodes and eight identical 1000 m pipelines (Hazen–Williams C = 130) supplied by a reservoir at 210 m elevation, with a fixed minimum head requirement of 30 m at each node. After performing SQP optimization on this benchmark, the resulting pipe diameters, nodal pressures, and total network cost were compared against established results from widely cited studies. The total cost achieved was approximately USD 420 000, which closely matched published values. This agreement confirmed the accuracy and reliability of the hydraulic model in WaterGEMS and the SQP-based optimization routine in MATLAB.
Results: Following successful validation, SQP–WDN was deployed on the Zafaraniyeh network. For each of the 27 pipeline segments, the “theoretical” diameter output by SQP was compared to the nearest commercially available nominal size that was equal to or larger than the computed diameter. In eight segments (Nos. 1, 4, 5, 6, 7, 13, 14, and 27), the computed diameters exactly matched standard market sizes. For example, in Segment 27—which serves as the main feed from the reservoir (Node R-1) to the network—SQP recommended a 250 mm pipe, corresponding precisely to a commercially stocked 250 mm diameter. This choice ensured that terminal node pressures remained above 60.15 m of head, thereby satisfying all minimum pressure requirements. The remaining 19 segments were each assigned the next larger standard diameter to introduce a hydraulic safety margin and reduce head losses in critical branches. For instance, Segment 2’s SQP‐computed diameter was approximately 79.49 mm, but the nearest available size was 90 mm; adopting 90 mm-maintained Node J-2’s minimum pressure above 66.14 m under peak‐demand conditions. Overall, selecting slightly larger commercial sizes for susceptible segments reduced head loss in critical pipelines, enhanced pressure stability, and mitigated the risk of substandard performance due to construction tolerances or future demand fluctuations. After reconciling computed diameters with market-available sizes, the total capital cost of the Zafaraniyeh distribution network was estimated at 21 623 954 000 IRR (approximately USD 485 000 at the 2025 exchange rate). Although this figure is marginally higher than the theoretical cost if exact diameters (that may not exist commercially) were used, it represents a practical and cost-effective solution given market constraints. Steady-state simulations of the final network configuration confirmed that, under both normal and peak‐demand scenarios, all nodal pressures exceeded their respective minimum thresholds and all flow velocities remained within the allowable range of 0.3–2.0 m/s. Graphical outputs further illustrated that branches where velocities were previously near the upper limit achieved a significant reduction in flow velocity after adopting the larger commercial diameters; head losses in these branches decreased accordingly, leading to improved overall hydraulic performance.
Conclusion: The combined SQP–WDN framework successfully reduced the investment cost of the Zafaraniyeh WDN while guaranteeing satisfactory hydraulic performance under all operating conditions. By integrating detailed hydraulic modeling in WaterGEMS with a robust SQP optimizer in MATLAB and automating the data exchange via VBA scripting, the method efficiently determined optimal pipe diameters and translated them into practical, commercially available sizes. The resulting network design—totaling approximately 21.624 billion IRR—meets or exceeds all hydraulic constraints, including minimum node pressures and velocity limits. This integrated approach provides a reliable blueprint for designing small to mid‐sized distribution networks in water‐scarce regions. Future research should explore hybrid optimization strategies that combine SQP with heuristic or metaheuristic algorithms, develop multi‐objective formulations (e.g., minimizing cost, energy use, and water age), and implement robust optimization techniques to address uncertainties in demand projections and network parameters.

Keywords

Main Subjects


  1. 1.Shamshirgaran, R., Malakooti, R., & Akbarpour, A. (2024). A review of technologies for purification of groundwater including heavy metals based on nanotechnology. Journal of Aquifer and Qanat, 4(2), 1-34. [In Persian]

    2.Tosan, M., Khashei-Siuki, A., Maroosi, A., & Gharib, M. R. (2024). A review of smart water management for sustainable agriculture based on the internet of things. Water Management in Agriculture, 11(1), 145-166. [In Persian]

    3.Yu, X., Wu, Y., Meng, F., Zhou, X., Liu, S., Huang, Y., & Wu, X. (2024). A review of graph and complex network theory in water distribution networks: Mathematical foundation, application and prospects. Water Research, 253, 121238.

    4.Taiwo, R., Yussif, A. M., & Zayed, T. (2025). Making waves: Generative artificial intelligence in water distribution networks: Opportunities and challenges. Water Research X, 28, 100316.

    5.Baazm, Z., Naseri, M., Akbarpour, A., & Zahiri, S. H. (2019). Minimization of Pumping Costs of Unconfined Aquifer under Simulation-Optimization Model Using the Inclined Planes system Optimization Algorithm. Iranian Journal of Irrigation & Drainage, 13(4), 1087-110. [In Persian]

    6.Tosan, M., Shamshirgaran, R., & Falaki, M. (2025). A Review of Participatory Management's Role in Reducing Vulnerability and Enhancing Resilience to Climate Change and Drought (2006-2024). Journal of Drought and Climate change Research. [In Persian]

    7.Tosan, M., Nourani, V., Kisi, O., & Dastourani, M. (2025). Evolution of ensemble machine learning approaches in water resources management: a review. Earth Science Informatics, 18(2), 416.

    8.Cross, H. (1936). Analysis of flow in networks of conduits or conductors. University of Illinois. Engineering Experiment Station. Bulletin; no. 286.

    1. Wang, Y., Zhang, Y., Wang, W., Liu, Z., Yu, X., Li, H., Wang, W., & Hu, X. (2023). A review of optimal design for large-scale micro-irrigation pipe network systems. Agronomy, 13(12), 2966.
    2. Doğan, B. S., & Sag, T. (2021). Solution of Water Distribution Networks Design with Evolutionary Optimization Techniques. Avrupa Bilim ve Teknoloji Dergisi. 28, 638-642.
    3. Pant, M., & Snasel, V. (2021). Design optimization of water distribution networks through a novel differential evolution. Ieee Access, 9, 16133-16151.
    4. Kim, D. H., & Jang, D. W. (2024). Optimization of Water Distribution Network Demand Patterns Using Real-Coded Genetic Algorithms. Water, 16(20), 2971.
    5. Jandaghi, H., Haghgoo, A., & Tavakoli Moghadam, M. (2024). Optimization of water distribution networks using simulated annealing (SA) with variable neighbourhood search (VNS): a case study in the city of Malard. Water Practice & Technology, 19(12), 4958-4986.
    6. Batmaz, V., & Ugur, I. B. (2025). Circulatory system-based optimization algorithm with dynamic penalty function for optimum design of large-scale water distribution networks. Engineering Optimization, 57(2), 427-458.
    7. Nguyen, Q., Onur, M., & Alpak, F. O. (2023). Nonlinearly constrained life-cycle production optimization using sequential quadratic programming (SQP) with stochastic simplex approximated gradients (StoSAG). SPE Reservoir Simulation Conference.
    8. Hasan, M. S., Chowdhury, M. M. U. T., & Kamalasadan, S. (2024). Sequential quadratic programming (SQP) based optimal power flow methodologies for electric distribution system with high penetration of DERs. IEEE Transactions on Industry Applications.
    9. Zhang, Y., Takyi, S. A., Xin, Y., Sheng, Z., Si, M., & Tontiwachwuthikuld, P. (2025). A novel economy analysis for advancing CO2 capture efficiency of post combustion using sequential quadratic programming (SQP) optimization methodology. Energy, 315, 134287.
    10. Lin, X., Wang, Z., Zeng, S., Huang, W., & Li, X. (2021). Real-time optimization strategy by using sequence quadratic programming with multivariate nonlinear regression for a fuel cell electric vehicle. International Journal of Hydrogen Energy, 46(24), 13240-13251.
    11. Alamdari, M. S., Fatemi, M., & Ghaffari, A. (2023). A modified sequential quadratic programming method for sparse signal recovery problems. Signal Processing, 207, 108955.
    12. Shoaib, M., Kainat, S., Raja, M. A. Z., & Nisar, K. S. (2022). Design of artificial neural networks optimized through genetic algorithms and sequential quadratic programming for tuberculosis model. Waves in random and complex media, 1-24.
    13. Nourani, V., Tosan, M., Huang, J. J., Gebremichael, M., Kantoush, S. A., & Dastourani, M. (2025). Advances in multi-source data fusion for precipitation estimation: remote sensing and machine learning perspectives. Earth-Science Reviews, 270, 105253.
    14. Tosan, M., Gharib, M. R., Attar, N. F., & Maroosi, A. (2025). Enhancing Evapotranspiration Estimation: A Bibliometric and Systematic Review of Hybrid Neural Networks in Water Resource Management. Computer Modeling in Engineering & Sciences (CMES), 142(2).
    15. Dai, P. D. (2023). A real time optimization based sequential convex program for pressure management in water distribution systems. Water Resources Management, 37(12), 4751-4768.
    16. Zarei, N., Azari, A., & Heidari, M. M. (2022). Multi-objective optimization of urban water distribution networks using PESA-II and SPEA-II metaheuristic algorithms. Irrigation and Water Engineering, 12(4), 65-83. [In Persian]
    17. Kotwal, M., Pati, S., & Patil, J. (2024). Review on AI and IOT based integrated smart water management and distribution system. Educ. Adm. Theory Pract, 30(4), 594-605.
    18. Caballero, J. A., & Ravagnani, M. A. (2019). Water distribution networks optimization considering unknown flow directions and pipe diameters. Computers & Chemical Engineering, 127, 41-48.
    19. Taheri, N., & Pishvaee, M. S. (2024). A regret-based robust optimization model for municipal water distribution network redesign under disruption risks. Computers & Chemical Engineering, 185, 108676. [In Persian]
    20. Mitrovic, D., Morillo, J. G., Rodríguez Díaz, J. A., & Mc Nabola, A. (2021). Optimization-based methodology for selection of pump-as-turbine in water distribution networks: Effects of different objectives and machine operation limits on best efficiency point. Journal of Water Resources Planning and Management, 147(5), 04021019.
    21. Dini, M., Hemmati, M., & Hashemi, S. (2022). Optimal operational scheduling of pumps to improve the performance of water distribution networks. Water Resources Management, 1-16. [In Persian]
    22. Taha, A. F., Wang, S., Guo, Y., Summers, T. H., Gatsis, N., Giacomoni, M. H., & Abokifa, A. A. (2021). Revisiting the water quality sensor placement problem: Optimizing network observability and state estimation metrics. Journal of Water Resources Planning and Management, 147(7), 04021040.
    23. Brahmamiah, B., Surendra, K., & Vani, P. (2024). A comprehensive analysis of the water distribution network by using waterGEMS software. IOP Conference Series: Earth and Environmental Science.
    24. Awad, R., Wittmanová, R., Stanko, Š., Barloková, D., & Hrudka, J. (2025). Modeling and simulation of a water distribution network using watergems. Pollack Periodica, 20(1), 46-52.
    25. Navin, U., & Dohare, D. (2022). A Critical Review on Design and Analysis of Water Distribution Network Using WaterGEMS and EPANET Softwares. SAMRIDDHI: A Journal of Physical Sciences, Engineering and Technology, 14(03), 381-385.
    26. Adhav, N., Zerikunthe, V., Sasane, A., & Deshmukh, A. (2022). Analysis and redesign of 24/7 water distribution network using water GEMS software. Int J Res Appl Sci Eng Technol (IJRASET). ISSN, 2321-9653.
    27. KS, B., AA, C., SG, L., CVSR, P., & HM, A. (2024). Water distribution network leakage analysis using watergems: a case study from westmooring, trinidad and tobago. Larhyss Journal (59).
    28. Beker, B. A., & Kansal, M. L. (2021). Use of WaterGEMS for hydraulic performance assessment of water distribution network: a case study of Dire Dawa City, Ethiopia. Advances in Energy and Environment: Select Proceedings of TRACE 2020.
    29. Mohseni, U., Pathan, A. I., Agnihotri, P. G., Patidar, N., Zareer, S. A., Saran, V., & Rana, V. (2022). Design and analysis of water distribution network using WaterGEMS–A case study of Narangi Village. Intelligent Computing & Optimization: Proceedings of the 4th International Conference on Intelligent Computing and Optimization 2021 (ICO2021) 3.
    30. Desai, S., & Rajapara, G. (2021). Leakage optimization of water distribution network using artificial intelligence. In Advanced Modelling and Innovations in Water Resources Engineering: Select Proceedings of AMIWRE 2021 (pp. 265-284). Springer.
    31. Awe, O., Okolie, S., & Fayomi, O. (2019). Review of water distribution systems modelling and performance analysis softwares. Journal of physics: conference series.
    32. Sutharsan, M. (2023). Optimizing the water distribution network of community water supply using different computer simulation techniques. Journal of Science of the University of Kelaniya.
    33. Ebrahimi, M., & Mohammadi, M. (2021). Numerical simulation of quantitative and qualitative parameters in water supply networks by WaterGEMS. Iranian Water Researches Journal, 15(1), 45-53. [In Persian]
    34. Bazaraa, M. S., Sherali, H. D., & Shetty, C. M. (2006). Nonlinear programming: theory and algorithms: John wiley & sons.
    35. Tosan, M., Shamshirgaran, R., & Dastourani, M. (2025). Application of the Combination of Remote Sensing and Machine Learning Approaches in Predicting Hydrological Parameters:
      A Bibliometric Analysis. Iranian Journal of Soil and Water Research, 56(3), 825-850. [In Persian]
    36. Song, X., Wang, J., Wang, J.,
      Sun, L., Feng, Y., & Li, Z. (2023). Sequential quadratic programming-based non-cooperative target distributed hybrid processing optimization method. Journal of Systems Engineering and Electronics, 34(1), 129-140.
    37. Ferrarese, G., Medoukali, D., Mirauda, D., & Malavasi, S. (2024). Review of Metaheuristic Methodologies for Leakage Reduction and Energy Saving in Water Distribution Networks. Water Resources Management, 38(11), 3973-4001.
    38. Alperovits, E., & Shamir, U. (1977). Design of optimal water distribution systems. Water resources research, 13(6), 885-900.