You are on page 1of 19

Water Resources Management (2024) 38:323–341

https://doi.org/10.1007/s11269-023-03672-0

Enhancing the EPANET Hydraulic Model through Genetic


Algorithm Optimization of Pipe Roughness Coefficients

Chia‑Cheng Shiu1 · Chih‑Chung Chung2 · Tzuping Chiang3

Received: 26 June 2023 / Accepted: 14 November 2023 / Published online: 23 November 2023
© The Author(s), under exclusive licence to Springer Nature B.V. 2023

Abstract
Calibrating hydraulic models for water distribution systems (WDS) is crucial during
model-building, particularly in determining the roughness coefficients of pipes. However,
using a single roughness coefficient based solely on pipe material can lead to significant
variations in frictional head losses. To address this issue and enhance computational effi-
ciency, a genetic algorithm (GA) for optimizing roughness coefficients is presented With
the Environmental Protection Agency Network Evaluation Tool (EPANET) hydraulic
model. EPANET-GA further considers the spatial characteristics of pipes. We incorporated
an automated calibration process and a user graphic interface to analyze the water head
pressures of WDS nodes for the Zhonghe-Yonghe Division. The results reveal that the opti-
mized roughness coefficient produces a high correlation coefficient (0.90) with the meas-
ured data in a time slot. In addition, a low standard error (8.93%) was achieved for 24-hour
predictions. Furthermore, in the Shelin-Beitou Division, spatial characteristics were incor-
porated as constraints during the calibration process. The EPANET-GA has the potential to
serve as an excellent tool for designing, operating, and optimizing water supply networks.
It can become an advanced operational solution for administrations, aiding in tasks such as
leakage detection and pump energy optimization.

Keywords Water distribution systems · Genetic algorithm · Hydraulic model · Roughness


coefficient

* Chih‑Chung Chung
ccchung@ncu.edu.tw
Chia‑Cheng Shiu
110382004@cc.ncu.edu.tw
Tzuping Chiang
ziping@nqu.edu.tw
1
Department of Civil Engineering, National Central University, No. 300, Zhongda Rd.,
Taoyuan City 320317, Taiwan, Taiwan
2
Department of Civil Engineering/Research Center for Hazard Mitigation and Prevention, National
Central University, No. 300, Zhongda Rd., Taoyuan City 320317, Taiwan, Taiwan
3
Department of Civil Engineering and Engineering Management, National Quemoy University, No.
1, University Rd., Kinmen County 892009, Taiwan, Taiwan

13
Vol.:(0123456789)
324 C.-C. Shiu et al.

1 Introduction

Currently, hydraulic simulation models have become widely utilized for analyzing the
behavior of water distribution systems (WDS), as noted by Zanfei et al. (2020), Sitzenfrei
et al. (2020) and Kowalska et al. (2022). Hydraulic simulation models are computer-based
tools used to simulate and analyze the behavior of hydraulic systems, particularly in the
context of fluid flow, pressure, and related phenomena Figueiredo et al. (2021). The cali-
bration of water distribution models involves adjusting network parameters, such as pipe
roughness and nodal demand Savic et al. (2009) to minimize the disparities between the
simulated results and actual measurements. Over the last thirty years, calibration has been
a popular research topic among WDS analysts. Savic et al. (2009) conducted a compre-
hensive review of the calibration of water distribution network models and classified the
calibration methods into three categories.
The first category involves iterative procedure models, where unknown parameters are
updated at each iteration by solving the steady-state mass balance and energy equations
utilizing obtained water heads and flows at nodes Bhave (1988). However, Bhave (1988)
concluded that the approach tends to have a slow convergence rate and is suitable for only
small-scale problems.
The second category includes explicit models, also known as hydraulic simulation
models, which rely on solving an extended set of steady-state equations that include initial
and additional equations derived from available measurements by Zanfei et al. (2020). An
objective function or cost function is typically applied to minimize the disparities between
measured and model-predicted variables by Savic et al. (2009). However, this method
requires a large quantity of observation data to accurately estimate calibration parameters
by Walski (2000).
The third category of calibration methods involves implicit models generally based on
optimization techniques. The calibration variables for these models encompass a broad
range of parameters, such as nodal demand and pipe roughness by Zhang et al. (2018), or
valve status and leak parameters by Huang et al. (2020). A variety of optimization methods
have been employed to address the relevant calibration problem, including the linear and
nonlinear programming by Greco and Del Giudice (1999), the Kalman filtering method
by Butera et al. (2021), and the simulated annealing method by Tucciarelli et al. (1999).
However, there are trade-offs and no general guidance exists regarding which optimization
technique is preferable for a specific calibration problem.
Various optimization techniques have been proposed for model calibration that utilize
genetic algorithms (GAs) by Zhao et al. (2022) and Zanfei et al. (2020). GAs have been
shown to be efficient in assessing sensitivities, in managing extensive calibrations, and in
integrating additional calibration parameter types and constraints into the optimization pro-
cess. Recently, researchers have explored the use of evolutionary computer techniques to
calibrate hydraulic models, with a focus on leakage estimation by Di Nardo et al. (2014),
Covelli et al. (2015) and Lee and Yoo (2021) and water demand by Dini and Tabesh (2014).
However, Jamil (2019) , Niazkar et al. (2019) and Hashemi et al. (2020) proposed that
the roughness coefficient is a primary parameter that contributes to uncertainty in model
outputs, and different equations may yield vastly different estimates of frictional head
losses, depending on the pipe size and water flow rate Qingzhou et al. (2018). The Dar-
win Calibrator in the commercial WaterGEMs has been developed utilizing GA to enable
the adjustment of model parameters and modification of the roughness of pipe groups and
junction demand during the calibration process by Wu et al. (2004). WaterGEMs, being a

13
Enhancing the EPANET Hydraulic Model through Genetic Algorithm… 325

commercial software tool, lacks the functionality to modify parameters and only allows the
utilization of default values. Consequently, the ability to ascertain the reasonableness of
calibration becomes unattainable.
Regarding the previous requirements and limitations, in this study we propose an
enhanced method that employs GA to optimize the roughness coefficient. Notably, the
Environmental Protection Agency Network Evaluation Tool (EPANET) is a freely avail-
able software that models the water quality and hydraulic behavior of water distribution
piping systems. As part of the calibration process in the EPANET hydraulic model, we
further introduced spatial factors as constraints alongside the actual junction demand data.
This comprehensive approach allowed for a more accurate representation of the real-world
conditions and dynamics within the water supply system due to regional constrains and
elevation differences.
In Taipei City, the hydraulic models vary between urban and nonurban areas. In urban
areas, water is primarily conveyed through pump stations. In nonurban areas, particularly
in hilly regions, the water undergoes pressurization at multiple stages before reaching the
distribution tanks. Alongside pressurized water supply, gravity water supply is also uti-
lized to assist in distributing water to households. The Zhonghe-Yonghe case was first car-
ried out to illustrate how the proposed technique can enhance the operational effectiveness
by minimizing the difference between the simulated and observed values. The proposed
method was also compared to WaterGEMs. Furthermore, the consideration of spatial char-
acteristics was incorporated as constraints during the calibration process in the Shelin-Bei-
tou Division. The improved outcomes provide a reliable reference for the design and rout-
ing scenario of WDS.

2 Materials and Methods

2.1 Overall Concept

The significance of calibration in modeling is the ability to adjust parameters, such as the
roughness coefficient (C) of pipes, to align with the actual situation, thus ensuring that
the model accurately reflects real-world systems Niazkar et al. (2019). Following calibra-
tion, the model becomes a reliable tool for real-time simulation and prediction. The model
parameters consist of the length of the pipe, the pipe roughness coefficient, the pipe diam-
eter, and the water demand. The length of the pipe and pipe diameter are directly obtained
from the spatial database as true values, and the water demand is derived from tap water
usage data. However, the pipe roughness coefficient is determined through a numeric con-
version based on the material category. Through iterative adjustments with the GA algo-
rithm (computer-based), calibration refines parameter values, such as roughness coeffi-
cients, to ensure that the simulation from the model aligns with actual system behavior.
We use EPANET-based hydraulic model algorithm, which is a valuable and accessible
tool for users to build automated processes and to handle critical system parameters, such
as nodes, links, demand, properties, pumps, reservoirs, and roughness. In the study, we
present a modified approach for calibrating the roughness coefficient in a hydraulic model
by using GA. The GA approach is applied to reduce the difference between the observed
and predicted values; it can be used as a valuable reference for future water supply deploy-
ment in emergencies or for adjusting water supply at monitoring centers. Moreover, the
hydraulic simulation models can identify leaking pipe sections in the network Sophocleous

13
326 C.-C. Shiu et al.

et al. (2017), thereby improving the maintenance efficiency of the pipe network for the
administration.
GAs are biologically motivated adaptive computer techniques based on natural selec-
tion and genetic operators as Ding et al. (2022), Shirajuddin et al. (2023), and Guan et al.
(2023). These algorithms are often suggested to solve complex optimization problems
by Zanfei et al. (2020), Meirelles et al. (2017), Do et al. (2016), and Mambretti and Orsi
(2016). The computing framework in this study begins with data preprocessing, transform-
ing the spatial database of the study area into the initial model, which includes a set of ini-
tial roughness coefficients denoted as C. These coefficients are estimated by using a theo-
retical or empirical formula, such as the Hazen-Williams equation shown in Eq. (1) as Mu
et al. (2021), which is an empirical relationship between the flow of water in a pipe and the
physical properties of the pipe, as well as the pressure drop caused by friction:

10.66 L Q1.85
hf = (1)
C1.83 D4.87
where hf is the head loss in meters over the length of the pipe (in m for SI units), L is the
length of the pipe (in m for SI units), Q is the volumetric flow rate (in m3 ∕s for SI units),
C is the pipe roughness coefficient and D is the pipe diameter (in m for SI units). In the
Hazen-Williams equation, the parameters L, C, and D are considered true values, except
for the roughness coefficient (C), which is determined through a numeric conversion based
on the material category. The relationship between the pipe roughness coefficient (C) and
head loss (hf) is inversely proportional, indicating that as C increases, hf decreases. In the
real system, the head loss can be measured to back-calculate the pipe roughness coefficient
Kuok et al. (2020). Thus, through the comprehensive calibration of the pipe roughness
coefficients of overall WDS, we can ensure that the hydraulic simulation model align with
the actual system behavior, leading to accurate real-time estimation and possible scenarios.
The roughness coefficient C of a pipe is a dimensionless number that depends on the
pipe material, and in this study, the pipe roughness is categorized based on the fabrication
material, including cast iron, plastic, and stainless steel. The process of calibration involves
adjusting the roughness coefficient value C through EPANET and optimization techniques
to minimize the difference between predicted pressures P and measured pressures, result-
ing in the creation of a corrected input file (.inp) for EPANET. Equation (2) represents the
objective function used for GA correction:
n

F(x) = min (P − ΔP)2 (2)
i=1

The objective function, F(x), is defined as the minimized sum of the water pressure dif-
ference squared, where P represents the actual measured value and ΔP represents the model
predicted value. The model predicted value is obtained by adjusting the C value of each
pipeline and substituted into the Dynamic Link Library for hydraulic analysis(EPANET.
dll) for calculation.

2.2 The Modified GA Operation Process

This research developed a modified GA operation, which consists of three stages as


depicted in Fig. 1: data preparation, GA analysis, and data output. These stages are further
explained as follows.

13
Enhancing the EPANET Hydraulic Model through Genetic Algorithm… 327

Fig. 1  The proposed calibration procedures with GA and EPANET

2.2.1 Data Preparation

The first stage involves reading the config.ini file to retrieve the initial settings, followed by
inputting the WDS initialized model (input.inp) and water pressure measurements (obser-
vation.csv) data for the calculation process. The data are checked for accuracy before pro-
ceeding to the next step. If an error is detected, the calculation process is terminated.

2.2.2 GA Analysis

The GA is initialized, and the roughness coefficient (C) of the pipeline in the input file(.inp)
is automatically imported to the Dynamic Link Library for hydraulic analysis (EPANET.
dll) to perform the analysis. The percentage of pressure difference is then calculated. If
new entities are presented, the process calculates fitness, performs selection, crossover,
mutation, creates a new generation, and stores the optimized solution in the input file(.inp).
The results include three types: reports in TXT format, fitting curves in PNG format, and
statistical charts in PNG format, as depicted in Fig. 1.
To enhance the efficiency and ease of use of the calibration software, a graphic user
interface (GUI) was developed by using a GA, called WaterCali in this study. We introduce

13
328 C.-C. Shiu et al.

four group methods implemented in WaterCali: not grouped, automatic grouping, group by
user, and spatial grouping. Among these methods, spatial grouping is emphasized as a crit-
ical contribution and in WaterCali involves grouping pipes based on their spatial charac-
teristics within the water distribution network. In Taipei, for example, the elevation ranges
from 0 to 1177 meters. The user can input a GeoJSON file that contains area geometry to
restrict the roughness coefficient (C).

3 Validation Cases

3.1 Introduction of Zhonghe‑Yonghe Division

The case study in this research was conducted at two divisions of the Taipei Water Depart-
ment: Zhonghe-Yonghe Division and Shelin-Beitou Division. The Zhonghe Booster Sta-
tion serves as the primary water supply facility for the Zhonghe-Yonghe Division, as
depicted in Fig. 2 of the study. The pipeline has a length of approximately 399 kilometers,
and the Taipei Water Department’s Zhonghe-Yonghe Division includes one pump station
and ten monitoring points.

Fig. 2  Distribution of measurement points in the Zhonghe-Yonghe Division

13
Enhancing the EPANET Hydraulic Model through Genetic Algorithm… 329

3.1.1 Model Establishment

The Water Intelligent System of Enterprise (WISE) platform of the Taipei Water
Department is currently in use, which allows users to select an area on the map and
choose the water demand distribution model, then export the model for further analysis
by Shiu et al. (2022). The resulting model can be opened in EPANET for analysis. The
input file(.inp) for the Zhonghe-Yonghe division was used to compare the collected sta-
tion and equipment data.

3.1.2 SCADA Data for Preprocessing

After 48 hours of data collection at measurement points, the initial step involves data
validation to ensure that it has not been affected by valve operations. Subsequently, the
data pattern is compared with supervisory control and data acquisition(SCADA) data
to verify its consistency and appropriateness. This rigorous process is essential to con-
firm the accuracy of the obtained data. Hydraulic model calibration is needed to process
a large amount of SCADA data, including pressure and flow measurements from field
pump stations. The SCADA procedures in this study were organized as follows:

1. Collecting pump station data: determining the time at which the maximum supply vol-
ume occurs during the measurement period and collecting pump station data manually
according to the target area for the calibration. To facilitate subsequent data selection
and organization, the recommended data collection interval is once per minute.
2. The actual water requirement of the pipe network was calculated by balancing the supply
and demand within the WDS and by using Microsoft Excel (Microsoft, Redmond, WA,
USA) for data calculation and organization.
3. Determine the time slot of the maximum water requirement: using the maximum water
requirement for calibration can provide a more accurate estimation of the pipeline
roughness coefficient (C). When the flow rate is increased, the water loss becomes
more significant, and the sensitivity of parameter C is heightened. From the previous
calculation results, the maximum value of the water amount is identified, and then, the
corresponding time slot is used for the EPANET single-period simulation.
4. Obtaining the data of all pump stations and monitoring points of the corresponding time
slot is a fundamental parameter in the hydraulic model and is essential for prediction
comparisons. The basis for single period simulation has been identified, and the data of
all pump stations can be established in the EPANET, including the inflows and outflows,
and pressures. Thus, the pressure values of the monitoring points at the corresponding
time slot are listed for comparison and model modification.

3.1.3 Water Pressure Measurements

The number of measurement sites is determined based on factors such as the water sup-
ply zone area, the pipeline length, and the measurement cost Jun et al. (2022). It is
important to note that, according to the rule of thumb, setting measurement points too
densely does not necessarily lead to improved results.The total number of measured

13
330 C.-C. Shiu et al.

points (ΔN ) in this study is set to 140 to satisfy the measured quantity which is at least
30% of the model length (km) as shown in Eq. (3):
Pipe Length(km) of the Model ∗ 0.3 ⩽ Measured Points(ΔN) (3)
In addition, the 140 measured points should be uniformly located in the water sup-
ply zone to capture the distribution of the water supply pressure. To prevent the meas-
urement error by unexpected valve closing, the measured points were randomly sepa-
rated into two groups, red and green triangles as shown in Fig. 2. Each point was then
installed with a pressure sensor to retrieve data for more than 48 hours, and the fre-
quency of pressure measurement data was recorded once per minute.

Fig. 3  Water supply and group pipeline distribution of the Shelin-Beitou Division

13
Enhancing the EPANET Hydraulic Model through Genetic Algorithm… 331

3.2 Introduction of Shelin‑Beitou Division

To comprehensively evaluate GA optimization with spatial characteristics, the Shelin-Bei-


tou Division was further used as a reference. In the Shelin-Beitou Division, there are sev-
eral pump stations, and the elevation change is significant, as depicted in Fig. 3. The figure
also highlights the water distribution routes and major water supply pipes within the area.
The pipeline has a length of approximately 459 kilometers, and the Taipei Water Depart-
ment’s Shelin-Beitou Division includes four pump stations and nineteen monitoring points.
The input file(.inp) generated by WISE, represents the Shelin-Beitou water supply zone
as a valuable resource for conducting EPANET-GA simulations and analyses, as shown in
Fig. 3. In this study, the Shelin-Beitou water supply division was divided into four distinct
spatial supply zones based on the pump station service areas.

3.3 Parametric Results for GA

The validated parameters in the GA are categorized into three types, as shown in Fig. 4
below. For the first type, the generation was set as 100 and the roughness coefficient C was
between 35 and 300 for testing the water head loss being reduced and reflected in C. In the
second type, the generation was 50 and was between 50 and 150 for testing the GA per-
formance. In the third type, the generation is set to 50 and C between 70 and 150 to limit
the value of C to obtain better results. Types I and II were used to compare the generation
and GA performance, and Types II and III were used for a C comparison. This reflects that
imiting the value of C can not obtain better results. Similarly, comparing Type II and III
indicates that the range of C values between 50 and 150 yields better results.
Figure 4 shows that Type I is fit in 45 generations and the mean error rate is approxi-
mately 11.759%. For Type II, the fitness is shown in 20 generations and the mean error rate
is approximately 11.765%. In Type III, the result is also fit in 20 generations and the mean
error rate is approximately 11.844%. The qualified point in Type I with 113, Type II with
114, and Type III with 110. After comparison with Type I and II, 50 generations are suf-
ficient for use. Compared with Type II and III C between 50 and 150 is better.

Fig. 4  Fitting Curve With Different GA Types

13
332 C.-C. Shiu et al.

4 Results

4.1 Validation Results of the Zhonghe‑Yonghe Division

4.1.1 Simulation Results before GA Roughness Optimization

According to the statistical results shown in Table 1, out of the 140 water pressure meas-
urement points in the Zhonghe-Yonghe Division, 64 points have a pressure difference of
less than 0.1 kg∕cm2, 44 points have a difference between 0.1-0.2 kg∕cm2, 18 points are
between 0.2-0.3 kg∕cm2, 8 points are between 0.3-0.4 kg∕cm2, and 6 points have a differ-
ence more significant than 0.4 kg∕cm2.
In steady-state calibration, the criteria must satisfy a 0.2 kg∕cm2 pressure difference in
practice as WRC (1989). In the study area, the average pressure is approximately 1 kg∕cm2.
Therefore, a pressure error within ±20% is a criterion that needs to be achieved. Out of the
total, 108 points have a pressure error within ±20% which accounts for 77.1% of the total,
as shown in Fig. 5(A).

4.1.2 Simulation Results after GA Roughness Optimization

Table 1 displays the simulation results of roughness optimization. Among the 140 water
pressure measurement points, 75 points have a pressure difference of less than 0.1 kg∕cm2,
39 points are between 0.1-0.2 kg∕cm2, 18 points are between 0.2-0.3 kg∕cm2, 1 point is
between 0.3-0.4 kg∕cm2, and 7 points are above 0.4 kg∕cm2.
An error within 20% is observed in 114 points, accounting for 81.4% of the total, and
an error of less than 10% increases from 51 points to 70 points improving 37.3%, which
suggests a significant improvement in the overall pressure difference, as shown in Table 1.
The calculated correlation coefficient between the mean value observed and the simulated
pressure was 0.9, which is considered reasonable compared to the research by Kepa (2021).

Table 1  Comparison of pressure difference with EPANET-GA calibration


Statistics of pressure difference before calibration
Pressure Difference Count Percentage(%) Error(%) Count Percentage(%)
(kg∕cm2)

< 0.1 64 45.7 < 10 51 36.4


0.1 − 0.2 44 31.4 10 − 20 57 40.7
0.2 − 0.3 18 12.9 > 20 32 22.9
0.3 − 0.4 8 5.7 - - -
More than 0.4 6 4.3 - - -
Statistics of pressure difference after calibration

< 0.1 75 53.6 < 10 70 50.0


0.1 − 0.2 39 27.9 10 − 20 44 31.4
0.2 − 0.3 18 12.8 > 20 26 18.6
0.3 − 0.4 1 0.7 - - -
More than 0.4 7 5.0 - - -

13
Enhancing the EPANET Hydraulic Model through Genetic Algorithm… 333

Fig. 5  Comparison of pressure difference distribution after roughness optimization

Based on the calibration, the developed EPANET-GA model was deemed acceptable, pro-
ducing a reliable representation of the tested water supply network.
After optimizing the roughness in the simulation, the number of points with errors less
than 10% increased from 51 to 70, showing a 37.3% improvement, and this number became
half of the measurement points. The points with larger errors are predominantly situated
at the end of the pipeline and experience lower pressure in the WDS. The absolute val-
ues of pressure differences and errors at these points are closer to the lower range (0-1
kg∕cm2). The area with the most significant deviation from the measured pressure is pri-
marily located at the terminus of the pipeline, as depicted in Fig. 5(B).

4.1.3 Comparison with WaterGEMs

To assess the reliability and effectiveness of the proposed method, this study used both the
EPANET-GA and WaterGEMs simulation results with those obtained from actual meas-
ured water pressures. WaterGEMs is a comprehensive and user-friendly decision-support
tool for water distribution networks provided by Bentley, and the developed Darwin cali-
bration algorithm has been validated through journal publications. Therefore, it is consid-
ered a suitable reference for comparing the calibration performance of WaterCali.
This commercial software is well known for improving the operational strategies of
decision makers, for enhancing the model-building process, and for effectively manag-
ing local models as in Wu et al. (2004). Table 2 shows the precise difference between

Table 2  Comparison of WaterGEMs EPANET-GA


prediction errors of WaterGEMs
and EPANET-GA Error(%) Count Percentage(%) Error(%) Count Percentage(%)

< 10 64 45.7 < 10 70 50.0


10-20 48 34.3 10 − 20 44 31.4
> 20 28 20.0 > 20 26 18.6

13
334 C.-C. Shiu et al.

EPANET-GA after calibration and WaterGEMs. The results indicate that 112 points
have an error within 20%, which accounts for 80% of the total, and 57 points have an
error less than 10%. EPANET-GA outperformed WaterGEMs in terms of accuracy.

4.1.4 Twenty‑Four‑Hour Predictions

Based on the previous analysis, we found that the areas with significant pressure differ-
ences before model calibration were mainly located at the end of the pipeline. When the
monitoring points are near the Pump Station, they tend to yield better simulation results
with an error rate of less than 10%, as shown in Fig. 6. To assess the reliability of the
EPANET-GA model for long-term simulation, the simulation results were compared
with the monitoring points when using 24-hour data, as shown in Fig. 7. The mean error
rate of the EPANET-GA model after calibration for all monitoring points in 24 hours
was 8.93%.

Fig. 6  Specific monitoring point locations

13
Enhancing the EPANET Hydraulic Model through Genetic Algorithm… 335

Fig. 7  Twenty-four-hour pressure comparison between monitoring points and simulations

4.2 GA Optimization with Spatial Characteristics

To conduct a comprehensive evaluation of GA optimization with spatial characteristics, the


Shelin-Beitou water supply zone was utilized as a reference in this study. The calibration
process involving GA optimization with spatial characteristics followed the same steps as

13
336 C.-C. Shiu et al.

previously mentioned, including model building, pressure measurement, and simulation.


In accordance with Eq. (3), we determined that setting the number of measurement sites to
140 was appropriate for the calibration process. This distribution of measurement sites is
depicted in Fig. 8 of the study. The proposed approach minimizes the challenges and com-
plexities associated with conducting on-site measurements and calibrating the model while
considering spatial characteristics.
Figure 8 illustrates the distribution of simulated water pressure achieved through the
implementation of GA optimization with spatial characteristics. This depiction effectively
reflects the spatial variation and distribution of water pressure within the system.

4.3 Comparison between the Different Classifications of Calibration

Table 3 presents the simulation results for roughness optimization considering spatial char-
acteristics. Prior to calibration, an error within 20% was observed in 111 points, accounting

Fig. 8  Simulated pressure distribution map with spatial characteristic optimization

13
Enhancing the EPANET Hydraulic Model through Genetic Algorithm… 337

Table 3  Comparison between the different classifications of calibration


No-Calibration EPANET-GA WaterGEMs EPANET-
GA+Spatial
Error(%) Count PCT(%) Count PCT(%) Count PCT(%) Count PCT(%)

< 10 69 49.3 77 55.0 82 58.6 81 57.9


10-20 42 30.0 36 25.7 31 22.1 34 24.2
> 20 29 20.7 27 19.3 27 19.3 25 17.9
< 20% 79.3 80.7 80.7 82.1

for 79.3% of the total points. Following calibration without spatial characteristics, an error
within 20% was observed in 113 points, representing 80.7% of the total points. Similarly,
in WaterGEMs, comparable error rates were observed. By incorporating group types based
on spatial characteristics in EPANET-GA, the error within 20% was further improved to
115 points, corresponding to 82.1% of the total points. Therefore, the proposed method not
only optimized the roughness coefficients based on pipe material but also considered the
spatial characteristics of the pipes, resulting in enhanced performance.
When the study area exhibits distinct water supply sources from pump stations and sub-
stantial elevation variations, utilizing EPANET-GA optimization with spatial characteris-
tics is a suitable approach for calibration. However, in cases where these factors are not as
significant, EPANET-GA alone is sufficient.

5 Discussion

This technical article covers three main topics. The first topic is the significance of adjust-
ing valve settings in the calibration process of the water distribution network model by
using EPANET-GA. This emphasizes the importance of aligning the valve settings with
the local conditions and measurement data obtained from SCADA systems. This initial
step is crucial to ensure accurate and optimal simulation results. The calibration process
becomes streamlined by matching the valve settings to real-world conditions. This helps
to minimize potential discrepancies or mismatches between simulated and observed out-
comes. We refrain from adjusting the valve settings appropriately to avoid challenges in
identifying simulation issues; it may require significant effort to rectify such discrepan-
cies. Therefore, carefully considering and changing valve settings based on SCADA data
is essential for achieving reliable and accurate simulation results in the calibration process.
The difference in the GA processes employed by WaterCali and WaterGEMs is that
WaterCali utilizes random crossover and mutation techniques within its GA process. These
techniques involve randomly selecting individuals from the population and performing
genetic operations such as a crossover (combining genetic information from two individ-
uals) and mutation (introducing random changes to an individual’s genetic information).
These random processes allow for exploring a wide range of solutions during the optimiza-
tion process. WaterGEMs implements a Fast Messy GA, which limits user control over the
random variable and employs a transformation process. This transformation helps refine
the search space and focuses the optimization process on promising regions. One notable
difference between WaterCali and WaterGEMs is that WaterCali incorporates the spatial

13
338 C.-C. Shiu et al.

factor into the calibration process. This means that WaterCali considers the spatial char-
acteristics of the water distribution network, such as pipe connectivity, topography, and
geographical factors, during calibration. This inclusion of spatial information enhances the
realism and applicability of the calibration process to real-world scenarios and simulations.
The third topic has two aspects: the selection of field measurement points and the
restriction of roughness modification during the calibration process of the water distribu-
tion network model. To ensure a representative field measurement, we recommend to ran-
domly select measurement points within the pipe network, following an average spatial
distribution. This approach considers the spatial distribution of pipes and their associated
hydraulic characteristics, providing a comprehensive understanding of the network behav-
ior. Furthermore, in the calibration process utilizing WaterCali, it is possible to restrict the
modification of roughness coefficients for specific pipes in certain areas based on informa-
tion from a GeoJSON file. This restriction ensures that recently installed or replaced pipes,
which typically have smoother interior surfaces, are not subjected to roughness modifica-
tion during the calibration. By preserving the original roughness coefficients of these pipes,
the model can better reflect their real-world conditions.
This research is subject to two primary limitations. First, the absence of automatic
reading meters (AMRs) throughout the entire study area results in nonreal-time data for
junction demand. Second, the calibration process does not account for the balancing and
neglect of leakage.

6 Conclusions

The proposed methodology involves combining the GA with the Dynamic Link Library
for hydraulic analysis (EPANET.dll) water analysis library to create EPANET-GA, which
enables the identification of the optimal solution that aligns with measured data. The
roughness coefficient is adjusted by the GA through iterations of selection, crossover, and
constant mutation. The preliminary analysis results of the hydraulic model indicate a rea-
sonable distribution of water pressure calculated by the Zhonghe-Yonghe Division model.
The results demonstrate a strong correlation coefficient of 0.9 between the simulated and
measured data, a mean error rate of only 8.93% compared to 24-hour monitoring data, and
superior performance compared to that of WaterGEMs. EPANET-GA can rapidly identify
various solutions, not just a single optimal solution.
The case of the water pressure calculated by EPANET-GA in the Zhonghe-Yonghe Divi-
sion model indicates that the analysis model can be used in future work programs, such as
the Taipei Water Department’s Shilin-Beitou Division, aiding engineers in decision-mak-
ing and providing cost-effective solutions. However, the traditional EPANET software cur-
rently lacks model calibration functions; a plug-in solver is needed for operation, which
is inconvenient for ordinary users. Given that commercial software can be expensive, we
provide the WaterCali plugin to share with interested parties requiring reliable water dis-
tribution network calibration. Users can refer to the proposed processes and procedures to
quickly construct a preliminary hydraulic analysis model and adjust parameters as needed
for future models. The improved outcomes observed in this study affirm that the EPANET-
GA approach serves as a reliable reference for WDS design and routing scenarios in practi-
cal applications.
EPANET-GA has the potential to serve as an excellent tool for designing, operat-
ing, and optimizing water supply networks. It can become an advanced operational

13
Enhancing the EPANET Hydraulic Model through Genetic Algorithm… 339

solution for administrations, aiding in tasks such as leakage detection and pump energy
optimization. A hydraulic model with calibration can be considered an enhanced and
more accurate representation of a water supply/distribution system as well as a digi-
tal twin for designing, operating, and optimizing a water supply network. This digital
twin replicates the physical water supply system within a virtual environment, enabling
engineers and operators to simulate and analyze the behavior of the network. Thus,
the hydraulic model is a valuable tool for assessing performance, identifying potential
issues, and making informed decisions to improve the water supply network efficiency
and reliability.
Acknowledgements This research was supported in part by the Taipei Water Department, Taiwan, ROC.
Contract No. 10937017S30.

Author Contributions Chia-Cheng Shiu developed the theoretical formalism, performed the analytic calcu-
lations and performed the numerical simulations. Chih-Chung Chung contributed to the design and imple-
mentation of the research, to the analysis of the results and to the writing of the manuscript. Tzuping Chiang
aided in interpreting the results and worked on the manuscript. All authors have discussed the results and
approved the final manuscript.

Funding This research was supported in part by the Taipei Water Department, Taiwan, ROC. Contract No.
10937017S30.

Availability of Data and Materials All data included in this study are available upon request by contact with
the first author.

Declarations
Ethics Approval Not applicable.

Consent to Participate Not applicable.

Consent for Publication Not applicable.

Conflict of Interest The authors have no competing interests to declare that are relevant to the content of this
article. The authors have no relevant financial or nonfinancial interests to disclose.

References
Bhave PR (1988) Calibrating water distribution network models. J Environ Eng 114(1):120–136. https://​doi.​
org/​10.​1061/​(ASCE)​0733-​9372(1988)​114:​1(120)
Butera I, Gómez-Hernández JJ, Nicotra S (2021) Contaminant-source detection in a water distribution sys-
tem using the ensemble kalman filter. J Water Resour Plan Manag 147(7):04021029. https://​doi.​org/​10.​
1061/​(ASCE)​WR.​1943-​5452.​00013​83
Covelli C, Cozzolino L, Cimorelli L et al (2015) A model to simulate leakage through joints in water distri-
bution systems. J Water Supply Res Technol AQUA 15(4):852–863. https://​doi.​org/​10.​2166/​ws.​2015.​
043
Di Nardo A, Di Natale M, Gisonni C et al (2014) A genetic algorithm for demand pattern and leakage esti-
mation in a water distribution network. J Water Supply Res Technol AQUA 64(1):35–46. https://​doi.​
org/​10.​2166/​aqua.​2014.​004
Ding K, Ni Y, Fan L et al (2022) Optimal design of water supply network based on adaptive penalty func-
tion and improved genetic algorithm. Math Probl Eng 2022. https://​doi.​org/​10.​1155/​2022/​82520​86
Dini M, Tabesh M (2014) A new method for simultaneous calibration of demand pattern and hazen-wil-
liams coefficients in water distribution systems. Water Resour Manage 28(7):2021–2034. https://​doi.​
org/​10.​1007/​s11269-​014-​0592-4

13
340 C.-C. Shiu et al.

Do N, Simpson A, Deuerlein J et al (2016) Calibration of water demand multipliers in water distribution


systems using genetic algorithms. J Water Resour Plan Manag 142(11):04016044. https://​doi.​org/​10.​
1061/​(ASCE)​WR.​1943-​5452.​00006​91
Figueiredo I, Esteves P, Cabrita P (2021) Water wise - a digital water solution for smart cities and water
management entities. Procedia Comput Sci 181:897–904. https://​doi.​org/​10.​1016/j.​procs.​2021.​01.​245
Greco M, Del Giudice G (1999) New approach to water distribution network calibration. J Hydraul Eng
125(8):849–854. https://​doi.​org/​10.​1061/​(ASCE)​0733-​9429(1999)​125:​8(849)
Guan Y, Lv M, Dong S (2023) Pressure-driven background leakage models and their application for leak
localization using a multi-population genetic algorithm. Water Resour Manage 37(1):359–373. https://​
doi.​org/​10.​1007/​s11269-​022-​03377-w
Hashemi S, Filion Y, Speight V et al (2020) Effect of pipe size and location on water-main head loss in
water distribution systems. J Water Resour Plan Manag 146(6):06020006. https://​doi.​org/​10.​1061/​
(ASCE)​WR.​1943-​5452.​00012​22
Huang Y, Zheng F, Kapelan Z et al (2020) Efficient leak localization in water distribution sys-
tems using multistage optimal valve operations and smart demand metering. Water Resour Res
56(10):e2020WR028285. https://​doi.​org/​10.​1029/​2020W​R0282​85
Jamil R (2019) Frictional head loss relation between hazen-williams and darcy-weisbach equations for vari-
ous water supply pipe materials. Int J Water 13(4):333–347. https://​doi.​org/​10.​1504/​IJW.​2019.​10027​
784
Jun S, Arbesser-Rastburg G, Fuchs-Hanusch D et al (2022) Response surfaces for water distribution sys-
tem pipe roughness calibration. J Water Resour Plan Manag 148:04021105. https://​doi.​org/​10.​1061/​
(ASCE)​WR.​1943-​5452.​00015​18
Kepa U (2021) Use of the hydraulic model for the operational analysis of the water supply network: a case
study. Water 13(3):326. https://​doi.​org/​10.​3390/​w1303​0326
Kowalska B, Suchorab P, Kowalski D (2022) Division of district metered areas (dmas) in a part of water
supply network using watergems (bentley) software: a case study. Appl Water Sci 12(7):166. https://​
doi.​org/​10.​3390/​w1420​3276
Kuok K, Chiu P, Ting D (2020) Evaluation of c values to head loss and water pressure due to pipe aging:
Case study of uni-central sarawak. J Water Resour Prot 12(12):1077–1088. https://​doi.​org/​10.​4236/​
jwarp.​2020.​12120​64
Lee CW, Yoo DG (2021) Development of leakage detection model and its application for water distribution
networks using rnn-lstm. Sustainability 13(16):9262. https://​doi.​org/​10.​3390/​su131​69262
Mambretti S, Orsi E (2016) Optimizing pump operations in water supply networks through genetic algo-
rithms. J Am Water Works Assoc 108(2):E119–25. https://​doi.​org/​10.​5942/​jawwa.​2016.​108.​0025
Meirelles G, Manzi D, Brentan B et al (2017) Calibration model for water distribution network using pres-
sures estimated by artificial neural networks. Water Resour Manage 31:4339–4351. https://​doi.​org/​10.​
1007/​s11269-​017-​1750-2
Mu T, Li Y, Li Z et al (2021) Improved network reliability optimization model with head loss for water distri-
bution system. Water Resour Manage 35(7):2101–2114. https://​doi.​org/​10.​1007/​s11269-​021-​02811-9
Niazkar M, Talebbeydokhti N, Afzali SH (2019) Novel grain and form roughness estimator scheme incor-
porating artificial intelligence models. Water Resour Manage 33(2):757–773. https://​doi.​org/​10.​1007/​
s11269-​018-​2141-z
Qingzhou Z, Zheng F, Duan HF et al (2018) A new method for simultaneous calibration of demand pat-
tern and hazen-williams coefficients in water distribution systems. J Water Resour Plan Manag
144(7):04018063. https://​doi.​org/​10.​1061/​(ASCE)​WR.​1943-​5452.​00009​86
Savic DA, Kapelan ZS, Jonkergouw PMR (2009) Quo vadis water distribution model calibration? Urban
Water J 6:3–22. https://​doi.​org/​10.​1080/​15730​62080​26133​80
Shirajuddin TM, Muhammad NS, Abdullah J (2023) Optimization problems in water distribution systems
using non-dominated sorting genetic algorithm ii: An overview. Ain Shams Eng J 14(4). https://​doi.​
org/​10.​1016/j.​asej.​2022.​101932
Shiu CC, Chiang T, Chung CC (2022) A modified hydrologic model algorithm based on integrating graph
theory and gis database. Water 14(19):3000. https://​doi.​org/​10.​3390/​w1419​3000
Sitzenfrei R, Wang Q, Kapelan Z et al (2020) Using complex network analysis for optimization of water dis-
tribution networks. Water Resour Res 56:e2020WR027929. https://​doi.​org/​10.​1029/​2020W​R0279​29
Sophocleous S, Savić DA, Kapelan Z et al (2017) A two-stage calibration for detection of leakage hotspots
in a real water distribution network. Procedia Eng 186:168–176. https://​doi.​org/​10.​1016/j.​proeng.​2017.​
03.​223
Tucciarelli T, Criminisi A, Termini D (1999) Leak analysis in pipeline systems by means of optimal valve
regulation. J Hydraul Eng 125(3):277–285. https://​doi.​org/​10.​1061/​(ASCE)​0733-​9429(1999)​125:​
3(277)

13
Enhancing the EPANET Hydraulic Model through Genetic Algorithm… 341

Walski TM (2000) Model calibration data: the good, the bad, and the useless. J Am Water Works Ass
92(1):94–99. https://​doi.​org/​10.​1002/j.​1551-​8833.​2000.​tb087​91.x
WRC (1989) Network Analysis: A Code of Practice. Water Authorities Association, Swindon, England
Wu ZY, Arniella EF, Gianella E (2004) Darwin calibrator-improving project productivity and model quality
for large water systems. J Am Water Works Ass 146(10):27–34. https://​doi.​org/​10.​1002/j.​1551-​8833.​
2004.​tb107​15.x
Zanfei A, Menapace A, Santopietro S et al (2020) Calibration procedure for water distribution systems:
comparison among hydraulic models. Water 12(5):1421. https://​doi.​org/​10.​3390/​w1205​1421
Zhang Q, Zheng F, Duan HF et al (2018) Efficient numerical approach for simultaneous calibration of pipe
roughness coefficients and nodal demands for water distribution systems. J Water Resour Plan Manag
144(10):04018063. https://​doi.​org/​10.​1061/​(ASCE)​WR.​1943-​5452.​00009​86
Zhao Q, Wu W, Simpson AR et al (2022) Simpler is better-calibration of pipe roughness in water distribu-
tion systems. Water 14(20):3276. https://​doi.​org/​10.​3390/​w1420​3276

Publisher’s Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and
institutional affiliations.

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under
a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted
manuscript version of this article is solely governed by the terms of such publishing agreement and applicable
law.

13

You might also like