1 Introduction

Gradually, with the urban population growth and development of cities, water distribution systems (WDSs) gain significant importance. Given the complexity of WDSs and large-scale decision making in analysis, design, operation and maintenance of WDSs, the need for computerized modelling of WDSs is felt more than ever to understand the behavior of these systems. The major important problem with simulation modelling of WDSs is consistency between the calculated and measured data. To achieve this aim, calibration of the model via measured data is necessary. Model parameters include pipe roughness such as Hazen-Williams coefficients in the pipes, base demand and demand pattern coefficients at the nodes. The Hazen-Williams formula is the most commonly used head loss formula in the WDSs and pipe roughness in this formula is introduced as Hazen-Williams (HW) coefficient. Also to make the WDSs more realistic for analyzing an extended period of operation, time pattern will be considered that makes demands at the nodes vary in a periodic way during a day. On the other hands, Demand Pattern (DP) coefficient is a collection of multipliers that can be applied to a quantity to allow it to vary over time. The measured data mainly include pressure head at nodes, tank levels, and flow in pipes, that can be considered either in a steady state or in an extended period condition.

Several objective functions have been proposed for hydraulic calibration of WDSs, such as minimizing the difference between the measured and calculated data of nodal pressures (Ormsbee and Wood 1986), nodal pressures and pipe flows (Borzi et al. 2005; Wu and Clark 2009), nodal pressures, pipe flows and tank levels (Yu et al. 2009), and also nodal pressures, nodal outflows and pipe flows (Kumar et al. 2010).

Most of researches have carried out the steady state conditions, in which, sampling has been implemented under one or multiple loading states such as minimum, normal, maximum and fire flow demand conditions (Reddy et al. 1996; Greco and Del-Giudice 1999; Kapelan et al. 2003; Jamasb et al. 2009). Few researches were used extended period simulation that sampling has been used in 24 h a day (Ormsbee 1989; Lansey et al. 2001).

Considering hydraulic simulation of WDSs, almost all the researches have focussed on demand-driven simulation method (DDSM) and just few ones have used head-driven simulation method (HDSM). Tabesh et al. (2011) used HDSM and DDSM based analyses and defined critical conditions to compare these two hydraulic analysis methods. They found out that HDSM performed better in simulating what happens in the WDSs than the DDSM. For selecting the calibration parameters in WDSs, most researches have taken pipe roughness coefficients and nodal base demand as a decision variable (Vassiljev et al. 2005; Kapelan et al. 2005; Behzadian et al. 2008; Weiping and Zhiguo 2011; Kang and Lansey 2011). Few studies have defined demand pattern coefficients as calibration parameter. Asadzadeh et al. (2011) performed calibration of pipe roughness and demand pattern coefficients of C-Town WDSs to measure hourly tank levels, pump flows and fire flow test data during 1-week operation.

In this paper, a new method is developed for simultaneous calibration of Demand Pattern (DP) and Hazen-Williams (HW) coefficients in WDSs. Ant Colony Optimization (ACO) algorithms are combined with static and dynamic models of WDS under EPANET software using a MATLAB code. In real case studies which measurement of flow in especial pipes is not possible, DP coefficients are not accurately calculated and these coefficients should be determined by an optimization procedure. With unknown HW coefficients, the problem is complicated. Considering both coefficients as variables in the calibration model expands the problem further and getting the answer becomes more difficult. In the new proposed method, both DP and HW coefficients are taken as decision variables of the optimization algorithms and in a shortcut method, DP coefficients are adjusted in the calibration of HW coefficients. This method helps the problem to be converged to a final answer quickly.

2 Methodology

In this paper the ACO algorithm is used for coefficient optimization. This algorithm is the first in the series of ACO algorithms developed by Dorigo et al. (1996). Here, to carry out a hydraulic calibration of WDSs, a combination of EPANET simulator and ACO algorithms has been used by programming in MATLAB software. The probability function of the ACO algorithms (Zecchin et al. 2006) is as Eq. (1):

$$ {P}_{\mathrm{ij}}\left(\mathrm{k},\mathrm{t}\right)=\frac{{\left[{T}_{\mathrm{ij}}\left(\mathrm{t}\right)\right]}^{\alpha }{\left[{U}_{\mathrm{ij}}\left(\mathrm{t}\right)\right]}^{\beta }}{{{\displaystyle {\sum}_{\mathrm{j}=1}^{\mathrm{J}}{\left[{T}_{\mathrm{ij}}\left(\mathrm{t}\right)\right]}^{\alpha}\left[{U}_{\mathrm{ij}}\left(\mathrm{t}\right)\right]}}^{\beta }} $$
(1)

where P ij(k, t): is the probability of the k-th ant situated at node j at stage t, to choose an outgoing edge i, T ij(t): is the pheromone intensity, U ij(t) is the desirability factor and α, β: are the parameters controlling the relative importance of pheromone intensity and desirability for each ant’s decision. The pheromone intensity function is as Eq. (2):

$$ {T}_{\mathrm{i}\mathrm{j}}\left(\mathrm{t}+1\right)=\rho {T}_{\mathrm{i},\mathrm{j}}\left(\mathrm{t}\right)+\varDelta {T}_{\mathrm{i},\mathrm{j}}\left(\mathrm{t}\right) $$
(2)

where ρ: is the pheromone persistence factor representing the pheromone decay rate; Δ Tij(t): is the additional pheromone; Tij(t + 1): is the pheromone intensity at stage (t + 1).

In general, in WDSs where reservoirs are connected together, determination of DP coefficients is not so simple. Besides, since the results of the WDS model, including pressure heads at nodes and flow in pipes are dependent on values of HW and DP coefficients and also these two coefficients are interdependent, determining of the coefficients would be difficult without considering their relationship. Also with supposing values of the coefficients such as HW, determining values of the other coefficients would not be possible. A solution to this problem might be to enter both coefficients in an optimization model as decision variables. Given the large number of pipes (HW coefficients) in the real case study and 24 coefficients of DP at the nodes, the problem becomes greater and difficult. In the present study, a new method is developed, which is a combination of ACO algorithm and EPANET simulator, and with a shortcut approauch, demand pattern coefficients are adjusted in the calibration of Hazen-Williams coefficients. The flowchart in Fig. 1 outlines the process for all methods in eight distinct steps. Each step is subsequently described in detail.

Fig. 1
figure 1

Flowchart of the new method algorithm

In the first step, an initial dynamic and the static WDS model is constructed. Every variable of WDS such as length and diameter of pipes, nodal base demand, maximum and minimum tank levels, tank diameter and pump characteristic curves are defined. Then hourly observed pressure heads at nodes and flow in pipes are defined.

In the second step, ACO algorithm parameters, usually obtained by the sensitivity analysis, are defined. In this step maximum and minimum values of DP and HW coefficients are also determined. For example, DP coefficients vary between intervals 0 and 2.

In the third step, the Nant (number of ants) set of HW coefficients is generated and this set is applied to the dynamic model. Then their objective function is separately evaluated and the best answer of HW coefficients is chosen. The objective function is written as Eq. (3) (Borzi et al. 2005).

$$ \mathrm{OFV}={\displaystyle \sum_{j=1}^N{\displaystyle \sum_{t=1}^T\left({\left(P{O}_{tj}-P{S}_{tj}\right)}^2+{\left(Q{O}_{tj}-Q{S}_{tj}\right)}^2\right)}} $$
(3)

where N: is the number of observation locations; T: is the number of times that field data has been collected; POtj: is the observed pressure head; and PStj: is the calculated pressure head at node j during time t; QOtj: is the observed and QStj: is the calculated flow in pipe j during time t and OFV: is the objective function value to be minimized.

In steps 4–6, a shortcut solution is developed using the static WDS model to determine DP coefficients. First, the initial static model is reconstructed with the best answer of HW coefficients of the previous step. In the next step, NM (number of intervals) set of DP coefficients is generated and applied in the static model every hour. Then the objective function is evaluated to obtain the best answer in a given hour. Then the best 24 h DP coefficients of the network are selected.

In the seventh step, the best answer of DP coefficients of the previous step is applied to the dynamic model for reconstructing it. Then this process from the third through the seventh steps is repeated as many as Ncyc (the number of cycles in each step).

In the final step, the best answers of DP and HW coefficients of Ncyc are selected and dynamic and static models are reconstructed again. This process is repeated by the specified number of steps or till getting to the real answer.

3 Results and Discussion

3.1 Case Study # 1

To evaluate the proposed method, first, a two-loop pipe network is considered. This network has been used previously to test different optimal designing models in the literatures (Alperovits and Shamir 1977; Banos et al 2010). Pipe network data and DP coefficients at nodes are shown in Table 1.

Table 1 Two-loop pipe network data

In the final calibration model, the measured certain data of nodal pressure and pipe flow at different hours of a day are simulated by EPANET2. Uncertain data are calculated by adding normally distributed random values to all certain data. The normal distribution with mean of zero and standard deviation of 0.5 are used (Pasha and Lansey 2009). Then random values are added to certain data, such as pressure head and base demand at nodes, and flow in pipes, and values with uncertainty have been generated. For example, in certain modes, pressure head and base demand at node 7 and flow in pipe 8 at 9 a.m. were 10.3 (m), 55.6 and 49.58 (l/s), respectively; while in uncertain mode, the same values were 9.96 (m), 55.96 and 48.96 (l/s). In other words, according to a normal distribution, if the probability of distribution takes 99.9 %, values within −1.55 and +1.55 will be generated, and by adding these values to the certain values, uncertain values are generated.

The adjusted parameters of the developed calibration model and the proposed algorithm include U 0, β, T0, α, ρ, Δ T i,j(t), NM, Nant and Ncyc. These parameters were adjusted by sensitivity analysis in a two-loop network where sampling (such as pressure heads at nodes) was done in three nodes of 5, 6 and 7. In other words, with assuming the pressure heads in nodes, model parameters are adjusted in a way that the calibration model calculates the final solution at the least possible time and with high precision. The results of the sensitivity analysis are given in Table 2 which is used as adjusting parameter values in the final calibration model.

Table 2 Adjusted values of calibration model parameters

In the calibration process, it is assumed that sampling is carried out hourly. The pressure head values at four nodes (4, 5, 6 and 7) and flow in six pipes (3, 4, 5, 6, 7 and 8) are used as measured data. The purpose of the calibration model is to determine DP and HW coefficients in the network simultaneously. In uncategorized mode, the problem includes eight decision variables for HW coefficients and 24 decision variables for DP coefficients. In the categorized mode, since HW coefficient value in pipes 1 and 3 is 130, in pipes 2 and 6 is 80, in pipes 4 and 8 is 70, and in pipes 5 and 7 is 100; these pipes are placed in the same category. Thus, calibration problem in this mode will have four decision variables for HW coefficients and 24 decision variables for DP coefficients. In this problem, the minimum and maximum values of HW coefficients are 70 and 130, respectively. The minimum and maximum values of the DP coefficients are 0.01 and 2, respectively.

To examine the impact of measurement errors on calibration results, calibration problem was performed separately in two models with certain and uncertain input data. By certain data, the results indicated that the calibration model can find real answers easily in the both categorized and uncategorized modes of HW coefficients. Table 3 gives the number of evaluations of the objective function and time for finding real answers for five consecutive runs. To run the calibration model, Intel (R) Core (TM) i3-2100CPU @ 3.10 GHz was used.

Table 3 Evaluation number of objective functions and run time for calibration model with the certain input data

As it is obvious, the model finds a real answer in an average of 32,050 evaluations and 31.12 min in the uncategorized mode of HW coefficients and, in the categorized mode of HW, this value is 10,200 evaluations and 9.70 min.

With uncertain data, in the categorized mode of HW coefficients, the calibration model finds the real answer in all two runs. But in the uncategorized mode of HW coefficients, it finds the best answers that are limited to the real answer. The results are shown in Table 4 for two consecutive runs.

Table 4 Results of the calibration model with the uncertain input data and uncategorized mode of HW coefficients

A comparison of results indicates that the calibration model has been successful in finding best or real answers at most times. In general, it should be noted that the problem of calibration of WDSs is not a single-answer problem, and there is a large series of answers, which would generate similar answers in terms of evaluating objective function. So, the calibration model generates a series of similar answers that has acceptable performance in generating final answer and solving the problem. When HW coefficients are categorized, the model would calculate the real answer more conveniently. However, the categorization of coefficient decreases number of possible answers that satisfied the objective function. Therefore the model finds the real answer more conveniently. Figure 2 shows the convergence of the calibration model to the real answer in a categorized mode of HW coefficients with uncertain input data (96 steps with 24,000 evaluations).

Fig. 2
figure 2

Convergence of the calibration model to real answer with uncertain input data

Overall, an evaluation of the proposed calibration model on the two-loop test example network in different modes with certain and uncertain input data showed that the model was capable of finding the HW and DP coefficients. Also, considering convergence curve of the proposed method in Fig. 2 indicates that the model has suitable convergence. If the DP and HW coefficients are assumed as decision variables in an optimization model, given the interval of 0.01 for DP and 5 for HW coefficients, the model search space in the uncategorized mode will be (24200*813) which is reduced to 813 in the proposed method. Then the new model can find the real answer in very small part of this space. For example, in certain input data, the model finds the real answer in an average of 32,050 evaluations (5.8*10−6 percent of the model search space).

3.2 Case Study # 2

For more examination of the performance of the proposed model, the calibration model is tested on a real network in this case study. Ahar city is located in East Azerbaijan Province, 90 (km) north east of Tabriz, Iran. Figure 3 shows the Ahar water distribution network, that has been skeletonised by excluding dispensable pipes. The simplified network includes 192 pipes, 169 nodes, one reservoir, 5 tanks and 3 pumping stations. R1 represents the reservoir as the only source of water. T1 to T5 represent water storage tanks. Q1 to Q3 represent pipe flow measurement locations that are measured by the ultrasonic flow meter. S1 to S27 notes pressure head measurement locations in the network that were measured by MultiLog digital barometer, which was made by the British RADCOM company.

Fig. 3
figure 3

Ahar water distribution network’s layout

To simplify the calibration problem in Ahar WDSs, HW coefficients were classified into limited groups. Table 5 shows the classification of HW coefficients into seven groups. In this table, columns illustrate the number of HW coefficient groups based on the pipe material, diameter, and pipe age and rows illustrate the number of subcategories in each group. For example, there are 4 and 19 subcategories in group C1 and C7, respectively. For modelling the WDSs before calibration, the HW coefficients are determined for category C4 based on pipe material and diameter and DP coefficients are determined based on the measured pipes flow. Table 6 shows the two coefficients values.

Table 5 Classification of HW coefficients based on the materials, diameter, and pipe age
Table 6 HW and DP coefficients of network for category C4

In hydraulic calibration of the Ahar WDS, the measured data are divided into two sets. Among the measured data sets (25 sets), 20 sets were used for calibration and five sets for testing. The testing sets include nodes S2, S6, S20, and S27 and pipe Q3. In this part, the new calibration model was separately run for each category at 250 steps. Table 7 shows the results of calibration for five categories. In this case, the minimum value of HW coefficients was taken as 60 and its maximum value was 140, with an interval of 5 and the minimum and the maximum DP coefficient value of 0.01 and 2, with an interval of 0.01.

Table 7 Hw and DP coefficients for seven categories after calibration

Given the large area of Ahar WDS, and since each zone in the network may have different DP coefficients, the small differences in DP coefficients in seven categories can be explained by this reason. Since separating different zones of the network and defining independent DP coefficient for each zone is not possible, in this study a single DP coefficient is assumed. Figure 4 shows the minimum, average, maximum and selected DP bar chart during a day. The minimum objective function value was belonged to the category of C3 with a value of 3,017.

Fig. 4
figure 4

Demand pattern coefficient bar chart in a day

In order to control the results of the calibrated model, the network is modelled before and after calibration based on the best selected HW and DP coefficients. Table 8 shows the results for the test data. A comparison of results indicated that there is a significant difference between the measured and simulated data before calibration, but it is significantly close to the measured data after calibration. For example, the absolute average errors of the measured and simulated data before calibration were 9.26, 2.35, 5.78, 11.29, 5.31 with total average of 6.80. After calibration, this values decreased to 1.35, 2.16, 2.63, 2.55, 1.91 with total average of 2.12, respectively. Figures 5 and 6 show variation curves of the measured and simulated data for the test data. Comparison of the measured and simulated pressure values at node S2, and the measured and simulated flow in pipe Q3 after and before calibration indicate that how the results are improved after calibration.

Table 8 Comparison of the measured and simulated data before and after calibration
Fig. 5
figure 5

Comparison of the measured and simulated pressure curves in node S2 before and after calibration

Fig. 6
figure 6

Comparison of the measured and simulated flow curves in node Q3 before and after calibration

4 Conclusion

For water distribution systems, where flow in some pipes is not measured or storage tanks are connected together, calculation of DP coefficients will be difficult. Also, since HW coefficients are unknown as well, the problem becomes more complex. Moreover, considering both coefficients as decision variables in the calibration model makes the problem more difficult. The present study proposes a new method for simultaneous calibration of DP and HW coefficients in water distribution networks. In this regard, a combination of an EPANET simulator model and an ACO algorithm has been used in MATLAB software.

To evaluate the abilities of the new method, a two-loop network and a real water distribution network were applied. In the two-loop network, demand pattern and Hazen-Williams coefficients assumed to be available, then simulation was carried out and values for nodal pressure head and pipe flow were calculated. Then, this data were used as a measured data in the calibration model with certain data. To generate data with uncertainty, a normal distribution with mean of zero and standard deviation of 0.5 was used. By adding the normal distribution random values to the certain data, data with uncertainty were calculated. The calibration results for the two-loop network indicated that with certain data, the model finds the real answer with desirable convenience for both categorized and uncategorized modes of HW coefficients. In uncertainty conditions, and with uncategorized HW coefficients, the model can find answers better than a real answer in some runs and in some others close to real answer. In categorized mode, the model can find real answers in all runs.

In the Ahar water distribution network, pressure head at 22 nodes and flow rate in three pipes were measured hourly during a day. In the calibration process, the data of 4 nodes and 1 pipe were used as test data, and the others were used for training. To simplify the calibration model, network pipes were classified into seven categories based on pipe material, diameter, and pip age. Comparison of results before and after calibration indicated that the average error of the test data was improved from 6.80 to 2.12, which showed optimal performance of calibration model. Note that decreasing the search space and suitable convergence are the other advantages of the new proposed method. Hence, it can calibrate both DP and HW coefficients with high precision and accuracy.