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 Assistant Professor, Department of Civil Engineering, Faculty of Engineering, University of Birjand, Birjand, Iran

2 Ph.D. Candidate 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