In water distribution network calibration of quality models, bulk and wall decay coefficients are considered to be the adjustable parameters. The bulk decay coefficient is usually gained by using a laboratory bottle test method, but the wall decay coefficient is calibrated with field data of residual chlorine at nodes. This paper aims to present a method to adjust the wall decay coefficients of pipes. A metamodelling approach is developed by the combination of an Ant Colony Optimization (ACO) algorithm and an artificial neural network (ANN) with the EPANET simulator. The proposed method is applied on a two-loop test example and real water distribution network. Results showed that the proposed method can increase the speed of solution 58 times more rapidly than the simple method in the two-loop network. In the real network, the classification based on the average flow velocity produced the best results among all categories, and the classification based on material, diameter, and age of pipes produced the best results among the physical criteria. Also, comparison of results between the measured and calculated data for testing data showed an average error of 3.85% and the calibration model gave good performance.

## INTRODUCTION

By population growth and the development of cities, urban water distribution networks (WDNs) have become highly important. Regarding the complexity of WDNs, the need for computerized modelling of WDNs is felt more than ever for understanding the hydraulic and quality behaviour of these systems. One of the most important issues in modelling is to adjust the results of modelling with the real status of the system. To achieve this aim it is necessary to calibrate the model by observed data. The adjustable parameters in the quality model calibration of WDN mainly include bulk decay (BD) and wall decay (WD) coefficients. The BD coefficient depends on the nature of the source water and can usually be estimated by using a laboratory bottle test method (Lansey & Boulos 2006). But the WD coefficient varies for different pipes and it should be calculated from quality calibration of WDNs in which the purpose is to minimize the difference between the measured and calculated chlorine residual at nodes.

Most studies have focused on hydraulic calibration of WDNs (Kang & Lansey 2011; Tabesh *et al.* 2011; Sabbaghpour *et al.* 2012; Al-Zahrani 2014; Sanz & Perez 2015), however, there has been less attention towards water quality model calibration of WDNs. Previously, the trial-and-error method (Clark *et al.* 1995) was used as a water quality model calibration of WDN. Zeirolf *et al.* (1998) were the first to apply the optimization method to estimate the first-order wall reaction parameter of chlorine transport. Al-Omari & Chaudhry (2001) used finite difference procedures for the determination of overall first-order chlorine decay coefficient(s). Meanwhile, in some studies the WD coefficient was considered to be a function of roughness coefficients and the BD coefficient was calibrated by the optimization process (Shihu 2011). But in most studies the WD coefficient has been considered to be the calibration parameter (Munavalli & Kumar 2005; Wu 2006; Jonkergouw *et al.* 2008; Pasha & Lansey 2009; Wang & Guo 2010). In several studies, a test example network was used to evaluate the accuracy and performance of the model but only some of them used a real WDN (Nejjari *et al.* 2014).

In general there are three broad methods to increase the computational efficiency of optimization methods: metamodelling, parallel computing and heuristics (Maier *et al.* 2014). Each method has been shown to be effective; however, this paper focuses on the use of metamodels to improve the computational efficiency of optimization of WDNs. Metamodels have proven to be useful tools for speeding up optimization in a range of water-resource applications, including model calibration (Behzadian *et al.* 2009; Afshar & Kazemi 2012), distribution system design (Ghajarnia *et al.* 2011; Bi & Dandy 2013; Broad *et al.* 2015) and groundwater model calibration (Bozorg Haddad *et al.* 2013).

The aim of this research is to perform water quality model calibration of real WDNs with consideration of different criteria such as material, diameter, age and average flow velocity of pipes. For this purpose, a new metamodelling approach is developed based on the Ant Colony Optimization (ACO) algorithm combined with an artificial neural network (ANN) in which a hydraulic and quality model simulator (EPANET) is used to adjust the WD coefficients of a WDN in an extended period simulation. The proposed metamodel is applied on a real WDN to calibrate the quality model. It is clear that in real WDN calibration models, there are a large number of adjustable parameters and computational steps in the simulation models. By considering the high runtime of water quality models compared with hydraulic models, the runtime of the calibration model is very high and in some cases, the optimization program cannot be implemented. In this paper, by the classification of adjustable parameters, the search space of the optimization problem and, by using the proposed metamodel, the runtime of the calibration model are decreased.

## METHODS

*et al.*1996). Here, to carry out a quality model calibration of a WDN, a combination of EPANET simulator and ANN with an ACO algorithm is used in programming in MATLAB software in the form of a metamodelling approach. The objective function of the model is as Equation (1): where

*N*is the number of observation locations,

*T*is the number of times that field data has been collected,

*qO*is the observed residual chlorine,

_{tj}*qS*is the calculated residual chlorine at node

_{tj}*j*during time

*t*,

*K*

_{w}is the decision variable vector that is related to the WD coefficients of the network pipes,

*K*w

_{l}and

*K*w

_{u}are the low and high limits of the WD coefficients and

*F*(

*K*

_{w}) is the objective function to be minimized (Pasha & Lansey 2009).

*et al.*2006) is as Equation (2): where is the probability of the

*k*th ant situated at node

*j*at stage

*t*choosing an outgoing edge

*i*, is the pheromone intensity present on edge

*i*at node

*j*and stage

*t*, is the desirability factor present on edge

*i*at node

*j*and stage

*t*, and are the parameters controlling the relative importance of pheromone intensity and desirability for each ant's decision. If then the algorithm will make decisions mainly based on the learned information, as represented by the pheromone, and if the algorithm will act as a heuristic selecting mainly the shortest or cheapest edges, disregarding the impact of these decisions on the final solution quality. The pheromone intensity function is as Equation (3) (Zecchin

*et al.*2006): where

*ρ*is the pheromone persistence factor representing the pheromone decay (evaporation) rate (0 <

*ρ*< 1), is the pheromone addition on edge

*i*at node

*j*and stage

*t*(the decay of the pheromone levels enables the colony to forget poor edges and increases the probability of good edges being selected), and is the pheromone intensity on edge

*i*at node

*j*and stage . In the proposed method,

*N*

_{ant}is the number of ants in every internal cycle of the algorithm,

*N*

_{cyc}is the number of cycles in each iteration and

*N*

_{uph}is the number of best answers selected among

*N*

_{cyc}answers in every iteration which is used to update the pheromone matrix.

*W*

_{1}is the weight matrix connected from the input layer to the hidden layer,

*B*

_{1}is the vector connected with neurons of the hidden layer,

*W*

_{2}is the bias vector connected from the hidden layer to the output layer,

*B*

_{2}is the bias vector connected to the neurons of the output layer;

*q*is the vector for the input variables of the network and

*F*is the vector for the output variables of the network.

In the first step, an initial quality model for WDNs is constructed. Every parameter of the WDS and ACO algorithm is defined. Also, the hourly observed residual chlorine at the nodes is defined. In the second step, the initial data for training the ANN is produced by the EPANET simulator.

In the third step, the training data is applied to the ANN. Then the weights of the ANN are adjusted and the ANN is trained. In steps 4 and 5, the *N*_{ant} set of WD coefficients is generated and this set is applied to the ANN model. Then the best answer for the WD coefficients is chosen and this is repeated as many as *N*_{cyc} times.

In steps 6 and 7, the *N*_{cyc} number of best answers of the previous step is applied to the WDN model. Then the objective function is evaluated to obtain the real answers. These answers are added to the other training data, and the data which are needed to train the ANN are constructed. In steps 8–10, respectively the *N*_{uph} best answers from the *N*_{cyc} best answers are selected. Then these answers are used to update the pheromone matrix. Finally the top best answer of the iteration is selected and the model is repeated for a certain number of iterations.

## RESULTS AND DISCUSSION

### Case study # 1

To describe the results of the proposed method, first, a two-loop pipe network is used. This network has been used previously to test different optimal design models in the literature (e.g., Alperovits & Shamir 1977; Banos *et al.* 2010; Seifollahi-Aghmiuni *et al.* 2013). Pipe network data are shown in Table 1 and peaking factor coefficients are presented in Table 2.

. | Pipe characteristics . | ||||||
---|---|---|---|---|---|---|---|

Node characteristics . | No. . | L (m) . | D (mm) . | Roughness . | WD (m/day) . | ||

No. | E(m) | BD(l/s) | 1 | 1,000 | 450 | 130 | −0.1 |

1 | 210 | 0 | 2 | 1,000 | 350 | 80 | −0.6 |

2 | 150 | 27.8 | 3 | 1,000 | 350 | 130 | −0.1 |

3 | 160 | 27.8 | 4 | 1,000 | 150 | 70 | −0.7 |

4 | 155 | 33.4 | 5 | 1,000 | 350 | 100 | −0.4 |

5 | 150 | 75 | 6 | 1,000 | 100 | 80 | −0.6 |

6 | 165 | 91.7 | 7 | 1,000 | 350 | 100 | −0.4 |

7 | 160 | 55.6 | 8 | 1,000 | 250 | 70 | −0.7 |

. | Pipe characteristics . | ||||||
---|---|---|---|---|---|---|---|

Node characteristics . | No. . | L (m) . | D (mm) . | Roughness . | WD (m/day) . | ||

No. | E(m) | BD(l/s) | 1 | 1,000 | 450 | 130 | −0.1 |

1 | 210 | 0 | 2 | 1,000 | 350 | 80 | −0.6 |

2 | 150 | 27.8 | 3 | 1,000 | 350 | 130 | −0.1 |

3 | 160 | 27.8 | 4 | 1,000 | 150 | 70 | −0.7 |

4 | 155 | 33.4 | 5 | 1,000 | 350 | 100 | −0.4 |

5 | 150 | 75 | 6 | 1,000 | 100 | 80 | −0.6 |

6 | 165 | 91.7 | 7 | 1,000 | 350 | 100 | −0.4 |

7 | 160 | 55.6 | 8 | 1,000 | 250 | 70 | −0.7 |

E: Elevation.

Time (hour) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Coefficient (%) | 0.96 | 0.92 | 0.88 | 0.84 | 0.8 | 0.86 | 0.90 | 1.06 | 1.00 | 1.01 | 1.02 | 1.03 |

Time (hour) | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |

Coefficient (%) | 1.04 | 1.05 | 1.06 | 1.07 | 1.08 | 1.09 | 1.08 | 1.07 | 1.06 | 1.05 | 1.00 | 0.98 |

Time (hour) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Coefficient (%) | 0.96 | 0.92 | 0.88 | 0.84 | 0.8 | 0.86 | 0.90 | 1.06 | 1.00 | 1.01 | 1.02 | 1.03 |

Time (hour) | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |

Coefficient (%) | 1.04 | 1.05 | 1.06 | 1.07 | 1.08 | 1.09 | 1.08 | 1.07 | 1.06 | 1.05 | 1.00 | 0.98 |

The adjusted parameters of the calibration model and the proposed algorithm include *T*_{0}, , , , *NM*, *N*_{ant}, *N*_{cyc} and *N*_{uph}. These parameters were adjusted by sensitivity analysis on the two-loop network. So that it assumes the pressure in the network is known, model parameters are adjusted in a way that the calibration model calculates the final solution in the least possible time and with high precision. The results of the sensitivity analysis are given in Table 3.

Parameter . | U
. _{0} | ß
. | T_{0}
. | α
. | ρ
. | ΔT_{ij}(t)
. | N_{cyc}
. | N_{ant}
. | N_{uph}
. |
---|---|---|---|---|---|---|---|---|---|

Adjusted value | 1 | 1 | 80 | 1 | 0.98 | 1 | 20 | 300 | 10 |

Parameter . | U
. _{0} | ß
. | T_{0}
. | α
. | ρ
. | ΔT_{ij}(t)
. | N_{cyc}
. | N_{ant}
. | N_{uph}
. |
---|---|---|---|---|---|---|---|---|---|

Adjusted value | 1 | 1 | 80 | 1 | 0.98 | 1 | 20 | 300 | 10 |

Regarding the slow distribution of the residual chlorine from the reservoir to the final nodes of the network, the least time needed for quality analysis of network modelling was considered to be 72 hours. The hourly residual chlorine at nodes in last 24 hours (48 to 72) was taken into consideration as the observed values in the evaluation of the proposed metamodel. Chlorine was injected only in the reservoir and its initial concentration was equal to 0.8 mg/l.

After preparation of the data, the water quality model calibration of WDS was carried out with sampling at nodes 3–7. First calibration was done by using the simple model that used the ACO algorithm coupled with EPANET2 in MATLAB code. In the simple model, the number of ants (*N*_{ant}) and the number of cycles (*N*_{cyc}) were 25 and 10, respectively.

In this research, an Intel (R) Core (TM) i3-2100CPU @ 3.10 GHz was used. Also, the interval change of the WD coefficients in the uncategorized and categorized modes of coefficients was considered to be 0.1 and 0.05, respectively. The results of the simple model are shown in Table 4, which includes the number of objective function evaluations and time to achieve the real answer.

No. . | 1 . | 2 . | 3 . | 4 . | 5 . | 6 . | 7 . | 8 . | 9 . | 10 . | Ave . |
---|---|---|---|---|---|---|---|---|---|---|---|

Uncategorized mode of WD coefficients | |||||||||||

EN*10 | 2,375 | 2,975 | 2,825 | 2,900 | 1,725 | 2,850 | 2,675 | 1,800 | 2,125 | 2,625 | 2487.5 |

T (min) | 119.4 | 148.3 | 142.6 | 144.7 | 85.2 | 143.4 | 132.9 | 90.1 | 105.8 | 131.5 | 124.4 |

Categorized mode of WD coefficients | |||||||||||

EN*10 | 1,375 | 150 | 1,300 | 525 | 475 | 1,425 | 875 | 450 | 1,125 | 120 | 890 |

T (min) | 68.7 | 7.5 | 65.0 | 26.2 | 23.7 | 71.2 | 43.7 | 22.3 | 56.0 | 60.0 | 44.4 |

No. . | 1 . | 2 . | 3 . | 4 . | 5 . | 6 . | 7 . | 8 . | 9 . | 10 . | Ave . |
---|---|---|---|---|---|---|---|---|---|---|---|

Uncategorized mode of WD coefficients | |||||||||||

EN*10 | 2,375 | 2,975 | 2,825 | 2,900 | 1,725 | 2,850 | 2,675 | 1,800 | 2,125 | 2,625 | 2487.5 |

T (min) | 119.4 | 148.3 | 142.6 | 144.7 | 85.2 | 143.4 | 132.9 | 90.1 | 105.8 | 131.5 | 124.4 |

Categorized mode of WD coefficients | |||||||||||

EN*10 | 1,375 | 150 | 1,300 | 525 | 475 | 1,425 | 875 | 450 | 1,125 | 120 | 890 |

T (min) | 68.7 | 7.5 | 65.0 | 26.2 | 23.7 | 71.2 | 43.7 | 22.3 | 56.0 | 60.0 | 44.4 |

Ave: Average; EN: Evaluation number; T: Time (min).

The results show that in the uncategorized mode of WD coefficients, the average time to achieve the real answer for ten consecutive runs is 124.4 min and during this time the objective function is evaluated 24,875 times on average. In the categorized mode of WD coefficients, as can be seen in Table 1, the WD coefficients are −0.1 (in pipes 1 and 3), −0.6 (in pipes 2 and 6), −0.7 (in pipes 4 and 8) and −0.4 (in pipes 5 and 7). Thus, these pipes can be categorized in a similar category. In this mode, the average time to achieve the real answer for ten consecutive runs is 44.4 min and during this time the objective function is evaluated 8,900 times on average. Also the results show that by classifying the WD coefficients, the number of objective function evaluations and the time to achieve real answers will decrease a lot. But in both, the time to achieve the real answer is very high; especially it can be considered that the two-loop network is a very small network. Therefore, in a real network in which the search space is too large, it is necessary to do more evaluations to achieve the final answer and this lowers the speed of achieving the final answer tremendously. To remove this problem, a proposed metamodelling approach, shown in Figure 1, was used. Results of the proposed metamodel are shown in Table 5. In the uncategorized mode of coefficients, the average time to achieve the real answer for ten consecutive runs is 118 sec and during this time the objective function is evaluated 108,600 times on average. Also in the categorized mode of coefficients, the average time to achieve the real answer for ten consecutive runs is 54.2 sec and during this time the objective function is evaluated 33,600 times on average.

No. . | 1 . | 2 . | 3 . | 4 . | 5 . | 6 . | 7 . | 8 . | 9 . | 10 . | Ave . |
---|---|---|---|---|---|---|---|---|---|---|---|

Uncategorized mode of WD coefficients | |||||||||||

EN*1000 | 114 | 72 | 120 | 66 | 108 | 114 | 78 | 90 | 162 | 162 | 108.6 |

T (s) | 126.4 | 80.2 | 127.6 | 74.5 | 115.9 | 123.4 | 86.7 | 99.4 | 172.7 | 173.4 | 118 |

Categorized mode of WD coefficients | |||||||||||

EN*1000 | 30 | 12 | 18 | 60 | 24 | 12 | 48 | 72 | 36 | 24 | 33.6 |

T (s) | 46.8 | 22.3 | 29.0 | 103.3 | 40.6 | 23.7 | 75.0 | 104.8 | 55.3 | 41.2 | 54.2 |

No. . | 1 . | 2 . | 3 . | 4 . | 5 . | 6 . | 7 . | 8 . | 9 . | 10 . | Ave . |
---|---|---|---|---|---|---|---|---|---|---|---|

Uncategorized mode of WD coefficients | |||||||||||

EN*1000 | 114 | 72 | 120 | 66 | 108 | 114 | 78 | 90 | 162 | 162 | 108.6 |

T (s) | 126.4 | 80.2 | 127.6 | 74.5 | 115.9 | 123.4 | 86.7 | 99.4 | 172.7 | 173.4 | 118 |

Categorized mode of WD coefficients | |||||||||||

EN*1000 | 30 | 12 | 18 | 60 | 24 | 12 | 48 | 72 | 36 | 24 | 33.6 |

T (s) | 46.8 | 22.3 | 29.0 | 103.3 | 40.6 | 23.7 | 75.0 | 104.8 | 55.3 | 41.2 | 54.2 |

### Case study # 2

_{1}denotes the reservoir in the water treatment plant with a capacity of 5,000 m

^{3}as the only source of water. T

_{1}to T

_{5}denote water tanks. Q

_{1}to Q

_{3}denote pipe-flow measurement locations that are measured by ultrasonic flow sensors (FLUXUS F401). S

_{1}to S

_{27}denote pressure head and residual chlorine measurement locations that are measured by the Radcom LoLog450 pressure sensor and the M142 chlorimeter. The precision of all pressure, flow and chlorimeter sensors is 0.01 m, 0.01 m/s and 0.01 mg/l, respectively. Due to the limited amount of measurement equipment, the measurement process was implemented from 25 December 2011 to 8 February 2012.

In this case study, if the WD coefficients of the pipes were not categorized, the number of decision variables would be 192. To make the problem easier, the WD coefficients of the pipes are classified into limited categories based on the data collected from the network including material, diameter, and age of pipes. In Table 6, the type of classification of WD coefficients is shown in the form of seven categories.

No . | (C1) . | (C2) . | (C3) . | (C4) . | (C5) . | (C6) . | (C7) . | ||||
---|---|---|---|---|---|---|---|---|---|---|---|

M . | D . | A . | M,D . | M,A . | . | D,A . | M,D,A . | ||||

1 | DI | 20 | 0–10 | D,M1 | A,M1 | A2,D1 | A3,D4 | A2,D6 | A,D,M1 | A2,D4,M4 | A5,D5,M4 |

2 | GA | 75–90 | 10_20 | D1,M2 | A2,M2 | A1,D2 | A4,D4 | A4,D6 | A2,D1,M2 | A3,D4,M4 | A2,D6,M4 |

3 | PE | 100 | 20–30 | D2,M3 | A1,M3 | A2,D3 | A5,D4 | A5,D6 | A1,D2,M3 | A4,D4,M4 | A4,D6,M4 |

4 | AC | 150 | 30–40 | D3,M4 | A2,M4 | A3,D3 | A2,D5 | – | A2,D3,M4 | A5,D4,M4 | A5,D6,M4 |

5 | 200 | 50–60 | D4,M4 | A3,M4 | A4,D3 | A3,D5 | – | A3,D3,M4 | A2,D5,M4 | – | |

6 | 300 | D5,M4 | A4,M4 | A5,D3 | A4,D5 | – | A4,D3,M4 | A3,D5,M4 | – | ||

7 | D6,M4 | A5,M4 | A2,D4 | A5,D5 | – | A5,D3,M4 | A4,D5,M4 | – |

No . | (C1) . | (C2) . | (C3) . | (C4) . | (C5) . | (C6) . | (C7) . | ||||
---|---|---|---|---|---|---|---|---|---|---|---|

M . | D . | A . | M,D . | M,A . | . | D,A . | M,D,A . | ||||

1 | DI | 20 | 0–10 | D,M1 | A,M1 | A2,D1 | A3,D4 | A2,D6 | A,D,M1 | A2,D4,M4 | A5,D5,M4 |

2 | GA | 75–90 | 10_20 | D1,M2 | A2,M2 | A1,D2 | A4,D4 | A4,D6 | A2,D1,M2 | A3,D4,M4 | A2,D6,M4 |

3 | PE | 100 | 20–30 | D2,M3 | A1,M3 | A2,D3 | A5,D4 | A5,D6 | A1,D2,M3 | A4,D4,M4 | A4,D6,M4 |

4 | AC | 150 | 30–40 | D3,M4 | A2,M4 | A3,D3 | A2,D5 | – | A2,D3,M4 | A5,D4,M4 | A5,D6,M4 |

5 | 200 | 50–60 | D4,M4 | A3,M4 | A4,D3 | A3,D5 | – | A3,D3,M4 | A2,D5,M4 | – | |

6 | 300 | D5,M4 | A4,M4 | A5,D3 | A4,D5 | – | A4,D3,M4 | A3,D5,M4 | – | ||

7 | D6,M4 | A5,M4 | A2,D4 | A5,D5 | – | A5,D3,M4 | A4,D5,M4 | – |

C: Category; M: Material; D: Diameter (mm); A: Age (year); DI: Ductile iron; PE: Polyethylene; GA: Galvanized steel; AC: Asbestos cement.

In this part, hydraulic calibration of the WDN is carried out before water quality model calibration of the WDN (Dini & Tabesh 2015). One of the best hydraulic calibrations was achieved in category 3 where the classification criterion was the age of the pipes. The peaking factor and roughness coefficients of category C3 are presented in Table 7. After hydraulic calibration of the WDN, the average flow velocity in the pipes was calculated and another classification was carried out for WD coefficients based on the average flow velocity in the pipes, which is presented in Table 8. In the Ahar WDN, the chlorine is injected into the water in the reservoir R_{1}. The measurements carried out on this site showed that the average concentration of residual chlorine was 1 mg/l.

T (hr) . | DP . | T (hr) . | DP . | T (hr) . | DP . | Category C3 . | |
---|---|---|---|---|---|---|---|

1 | 0.64 | 9 | 1.40 | 17 | 1.24 | ||

2 | 0.42 | 10 | 1.50 | 18 | 1.25 | ||

3 | 0.19 | 11 | 1.54 | 19 | 1.22 | ||

4 | 0.15 | 12 | 1.54 | 20 | 1.13 | A1 | 57 |

5 | 0.15 | 13 | 1.49 | 21 | 1.08 | A2 | 109 |

6 | 0.35 | 14 | 1.41 | 22 | 1.00 | A3 | 85 |

7 | 0.83 | 15 | 1.34 | 23 | 0.87 | A4 | 87 |

8 | 1.22 | 16 | 1.30 | 24 | 0.74 | A5 | 82 |

T (hr) . | DP . | T (hr) . | DP . | T (hr) . | DP . | Category C3 . | |
---|---|---|---|---|---|---|---|

1 | 0.64 | 9 | 1.40 | 17 | 1.24 | ||

2 | 0.42 | 10 | 1.50 | 18 | 1.25 | ||

3 | 0.19 | 11 | 1.54 | 19 | 1.22 | ||

4 | 0.15 | 12 | 1.54 | 20 | 1.13 | A1 | 57 |

5 | 0.15 | 13 | 1.49 | 21 | 1.08 | A2 | 109 |

6 | 0.35 | 14 | 1.41 | 22 | 1.00 | A3 | 85 |

7 | 0.83 | 15 | 1.34 | 23 | 0.87 | A4 | 87 |

8 | 1.22 | 16 | 1.30 | 24 | 0.74 | A5 | 82 |

Subcategory | 1 | 2 | 3 | 4 | 5 | 6 |

Velocity (m/s) | V < 0.1 | 0.2–0.3 | 0.2–0.3 | 0.3–0.4 | 0.4–0.5 | 0.5–0.6 |

Subcategory | 7 | 8 | 9 | 10 | 11 | 12 |

Velocity (m/s) | 0.6–0.7 | 0.7–0.8 | 0.8–0.9 | 0.9–1.0 | 1.0–1.5 | 1.5 < V |

Subcategory | 1 | 2 | 3 | 4 | 5 | 6 |

Velocity (m/s) | V < 0.1 | 0.2–0.3 | 0.2–0.3 | 0.3–0.4 | 0.4–0.5 | 0.5–0.6 |

Subcategory | 7 | 8 | 9 | 10 | 11 | 12 |

Velocity (m/s) | 0.6–0.7 | 0.7–0.8 | 0.8–0.9 | 0.9–1.0 | 1.0–1.5 | 1.5 < V |

In this case study, a total of 19 data sets were available, from which 15 data sets (79%) were used for training and four data sets (21%) were used for testing. The water quality model calibration was carried out for eight categories (Tables 6 and 8) separately based on the training data in 400 iterations. The best answer selection criterion was derived based on the best testing data.

In water quality model calibration of WDNs, BD and WD coefficients are considered to be the adjustable parameters. The BD coefficient was determined by using a laboratory bottle test method, and in this case study the value obtained was −0.22. The WD coefficient was calculated by minimizing the objective function of the proposed calibration metamodel. The higher and lower bond limits of the WD coefficient were equal to 0 and −1, respectively and the interval change of the WD coefficients was supposed to be 0.01 (Pasha & Lansey 2009). In Table 9 the best answers of five runs of the calibration model for the WD coefficients and the training and testing data error for each category are presented*.*

Category . | C1 . | C2 . | C3 . | C4 . | C5 . | C6 . | C7 . | C8 . |
---|---|---|---|---|---|---|---|---|

Best answer | −0.31 | −0.31 | −0.13 | −0.27 | −0.31 | −0.27 | −0.43 | −0.15 |

−0.31 | −0.12 | −0.26 | −0.31 | −0.31 | −0.12 | −0.28 | −0.17 | |

−0.23 | −0.20 | −0.13 | −0.11 | −0.31 | −0.01 | −0.14 | −0.01 | |

−0.19 | −0.11 | −0.27 | −0.20 | −0.17 | −0.25 | −0.01 | −0.01 | |

−0.06 | −0.23 | −0.11 | −0.13 | −0.21 | −0.27 | −0.07 | ||

−0.29 | −0.02 | −0.30 | −0.21 | −0.16 | −0.61 | |||

−0.30 | −0.19 | −0.05 | −0.19 | −0.61 | ||||

−0.10 | −0.08 | −0.49 | ||||||

−0.07 | −0.09 | −0.34 | ||||||

−0.02 | −0.07 | −0.01 | ||||||

−0.01 | −0.05 | −0.27 | ||||||

−0.05 | −0.03 | −0.01 | ||||||

−0.16 | −0.25 | |||||||

−0.02 | −0.32 | |||||||

−0.37 | −0.25 | |||||||

−0.34 | −0.32 | |||||||

−0.26 | −0.49 | |||||||

−0.04 | ||||||||

Ec | 0.747 | 0.457 | 0.724 | 0.439 | 0.730 | 0.483 | 0.473 | 0.371 |

Et | 0.250 | 0.186 | 0.236 | 0.201 | 0.210 | 0.176 | 0.080 | 0.086 |

(Ec + Et) | 0.998 | 0.643 | 0.960 | 0.640 | 0.940 | 0.660 | 0.553 | 0.457 |

Category . | C1 . | C2 . | C3 . | C4 . | C5 . | C6 . | C7 . | C8 . |
---|---|---|---|---|---|---|---|---|

Best answer | −0.31 | −0.31 | −0.13 | −0.27 | −0.31 | −0.27 | −0.43 | −0.15 |

−0.31 | −0.12 | −0.26 | −0.31 | −0.31 | −0.12 | −0.28 | −0.17 | |

−0.23 | −0.20 | −0.13 | −0.11 | −0.31 | −0.01 | −0.14 | −0.01 | |

−0.19 | −0.11 | −0.27 | −0.20 | −0.17 | −0.25 | −0.01 | −0.01 | |

−0.06 | −0.23 | −0.11 | −0.13 | −0.21 | −0.27 | −0.07 | ||

−0.29 | −0.02 | −0.30 | −0.21 | −0.16 | −0.61 | |||

−0.30 | −0.19 | −0.05 | −0.19 | −0.61 | ||||

−0.10 | −0.08 | −0.49 | ||||||

−0.07 | −0.09 | −0.34 | ||||||

−0.02 | −0.07 | −0.01 | ||||||

−0.01 | −0.05 | −0.27 | ||||||

−0.05 | −0.03 | −0.01 | ||||||

−0.16 | −0.25 | |||||||

−0.02 | −0.32 | |||||||

−0.37 | −0.25 | |||||||

−0.34 | −0.32 | |||||||

−0.26 | −0.49 | |||||||

−0.04 | ||||||||

Ec | 0.747 | 0.457 | 0.724 | 0.439 | 0.730 | 0.483 | 0.473 | 0.371 |

Et | 0.250 | 0.186 | 0.236 | 0.201 | 0.210 | 0.176 | 0.080 | 0.086 |

(Ec + Et) | 0.998 | 0.643 | 0.960 | 0.640 | 0.940 | 0.660 | 0.553 | 0.457 |

Ec: Calibration data error; Et: Test data error.

Comparison of the results of eight categories based on the least testing data errors show that the highest amount of training and testing data error is related to category C1. The lowest amount of training data error is related to category C8 and the lowest amount of testing data error is related to category C7, and these are also considered to be the best water quality model calibration criteria.

In categories C1, C2 and C3, only one criterion such as material, diameter, and age of the pipe was considered in the classification of pipes. Category C2, which was classified with pipe diameter, achieved relatively good results. By increasing the classification criteria into two parameters, which happened in categories C4 (pipe material and diameter), C5 (material and age of the pipe) and C6 (diameter and age of the pipe), the results in categories C4 and C6 were better. Finally by considering the three criteria of material, diameter, and age of pipes concurrently and classifying the coefficients with them, the results were improved compared with the previous categories. On the whole, it can be inferred that category C7 with classification criteria of material, diameter and age of pipes is the best classification in consideration of physical characteristics.

In category C8, the classification criterion is the average flow velocity in the pipes for 24 hours in extended period conditions. Comparison of the results of this category with others shows that the total amount of training and testing data errors in this type of classification is the lowest (=0.457). Thus, the classification based on hydraulic criteria such as average flow velocity can be proposed as an appropriate alternative for classifying the WD coefficients of pipes.

Comparison of the number of subcategories of categories C1–C7 may create the image that increasing the number of classes is an important factor in improving the results. This is almost true in the first seven categories. In other words, by increasing the number of subcategories, the results have been improved, as can be seen in Table 9. Classification based on the average flow velocity in pipes shows that the classification criterion is a more important factor than the number of subcategories. Thus, better results can be obtained by selecting the appropriate criteria for classifying the coefficients with fewer subcategories. This is true regarding category C8 compared with categories C6 and C7.

. | S_{2}. | S_{16}. | S_{20}. | S_{27}. | ||||
---|---|---|---|---|---|---|---|---|

Time (hr) . | Me-Ch . | Ca-Ch . | Me-Ch . | Ca-Ch . | Me-Ch . | Ca-Ch . | Me-Ch . | Ca-Ch . |

1 | 0.42 | 0.46 | 0.6 | 0.58 | 0.63 | 0.67 | 0.6 | 0.63 |

2 | 0.43 | 0.47 | 0.58 | 0.57 | 0.64 | 0.67 | 0.61 | 0.62 |

3 | 0.43 | 0.45 | 0.58 | 0.55 | 0.65 | 0.65 | 0.6 | 0.59 |

4 | 0.44 | 0.44 | 0.58 | 0.55 | 0.65 | 0.62 | 0.57 | 0.60 |

5 | 0.46 | 0.44 | 0.59 | 0.55 | 0.63 | 0.61 | 0.57 | 0.61 |

6 | 0.44 | 0.46 | 0.58 | 0.52 | 0.62 | 0.61 | 0.57 | 0.58 |

7 | 0.41 | 0.47 | 0.55 | 0.51 | 0.63 | 0.64 | 0.59 | 0.59 |

8 | 0.41 | 0.45 | 0.6 | 0.57 | 0.61 | 0.68 | 0.6 | 0.65 |

9 | 0.41 | 0.42 | 0.58 | 0.57 | 0.63 | 0.63 | 0.6 | 0.62 |

10 | 0.43 | 0.42 | 0.61 | 0.59 | 0.64 | 0.62 | 0.61 | 0.61 |

11 | 0.4 | 0.42 | 0.6 | 0.59 | 0.63 | 0.61 | 0.62 | 0.61 |

12 | 0.43 | 0.41 | 0.61 | 0.59 | 0.63 | 0.61 | 0.61 | 0.61 |

13 | 0.4 | 0.41 | 0.62 | 0.59 | 0.63 | 0.62 | 0.62 | 0.61 |

14 | 0.43 | 0.41 | 0.62 | 0.59 | 0.62 | 0.62 | 0.61 | 0.61 |

15 | 0.42 | 0.42 | 0.61 | 0.59 | 0.65 | 0.62 | 0.6 | 0.61 |

16 | 0.4 | 0.42 | 0.6 | 0.58 | 0.63 | 0.62 | 0.61 | 0.61 |

17 | 0.42 | 0.42 | 0.59 | 0.58 | 0.64 | 0.63 | 0.62 | 0.61 |

18 | 0.43 | 0.42 | 0.6 | 0.58 | 0.65 | 0.63 | 0.62 | 0.61 |

19 | 0.42 | 0.45 | 0.6 | 0.62 | 0.65 | 0.67 | 0.58 | 0.66 |

20 | 0.43 | 0.45 | 0.61 | 0.62 | 0.62 | 0.68 | 0.63 | 0.66 |

21 | 0.43 | 0.45 | 0.62 | 0.62 | 0.63 | 0.68 | 0.63 | 0.66 |

22 | 0.42 | 0.45 | 0.61 | 0.61 | 0.66 | 0.68 | 0.63 | 0.65 |

23 | 0.43 | 0.45 | 0.61 | 0.60 | 0.67 | 0.68 | 0.62 | 0.65 |

24 | 0.42 | 0.46 | 0.6 | 0.60 | 0.63 | 0.68 | 0.62 | 0.64 |

Min Err | 0.003 | 0.001 | 0.001 | 0.002 | ||||

Ave Err | 0.023 | 0.022 | 0.022 | 0.019 | ||||

Max Err | 0.061 | 0.063 | 0.063 | 0.079 |

. | S_{2}. | S_{16}. | S_{20}. | S_{27}. | ||||
---|---|---|---|---|---|---|---|---|

Time (hr) . | Me-Ch . | Ca-Ch . | Me-Ch . | Ca-Ch . | Me-Ch . | Ca-Ch . | Me-Ch . | Ca-Ch . |

1 | 0.42 | 0.46 | 0.6 | 0.58 | 0.63 | 0.67 | 0.6 | 0.63 |

2 | 0.43 | 0.47 | 0.58 | 0.57 | 0.64 | 0.67 | 0.61 | 0.62 |

3 | 0.43 | 0.45 | 0.58 | 0.55 | 0.65 | 0.65 | 0.6 | 0.59 |

4 | 0.44 | 0.44 | 0.58 | 0.55 | 0.65 | 0.62 | 0.57 | 0.60 |

5 | 0.46 | 0.44 | 0.59 | 0.55 | 0.63 | 0.61 | 0.57 | 0.61 |

6 | 0.44 | 0.46 | 0.58 | 0.52 | 0.62 | 0.61 | 0.57 | 0.58 |

7 | 0.41 | 0.47 | 0.55 | 0.51 | 0.63 | 0.64 | 0.59 | 0.59 |

8 | 0.41 | 0.45 | 0.6 | 0.57 | 0.61 | 0.68 | 0.6 | 0.65 |

9 | 0.41 | 0.42 | 0.58 | 0.57 | 0.63 | 0.63 | 0.6 | 0.62 |

10 | 0.43 | 0.42 | 0.61 | 0.59 | 0.64 | 0.62 | 0.61 | 0.61 |

11 | 0.4 | 0.42 | 0.6 | 0.59 | 0.63 | 0.61 | 0.62 | 0.61 |

12 | 0.43 | 0.41 | 0.61 | 0.59 | 0.63 | 0.61 | 0.61 | 0.61 |

13 | 0.4 | 0.41 | 0.62 | 0.59 | 0.63 | 0.62 | 0.62 | 0.61 |

14 | 0.43 | 0.41 | 0.62 | 0.59 | 0.62 | 0.62 | 0.61 | 0.61 |

15 | 0.42 | 0.42 | 0.61 | 0.59 | 0.65 | 0.62 | 0.6 | 0.61 |

16 | 0.4 | 0.42 | 0.6 | 0.58 | 0.63 | 0.62 | 0.61 | 0.61 |

17 | 0.42 | 0.42 | 0.59 | 0.58 | 0.64 | 0.63 | 0.62 | 0.61 |

18 | 0.43 | 0.42 | 0.6 | 0.58 | 0.65 | 0.63 | 0.62 | 0.61 |

19 | 0.42 | 0.45 | 0.6 | 0.62 | 0.65 | 0.67 | 0.58 | 0.66 |

20 | 0.43 | 0.45 | 0.61 | 0.62 | 0.62 | 0.68 | 0.63 | 0.66 |

21 | 0.43 | 0.45 | 0.62 | 0.62 | 0.63 | 0.68 | 0.63 | 0.66 |

22 | 0.42 | 0.45 | 0.61 | 0.61 | 0.66 | 0.68 | 0.63 | 0.65 |

23 | 0.43 | 0.45 | 0.61 | 0.60 | 0.67 | 0.68 | 0.62 | 0.65 |

24 | 0.42 | 0.46 | 0.6 | 0.60 | 0.63 | 0.68 | 0.62 | 0.64 |

Min Err | 0.003 | 0.001 | 0.001 | 0.002 | ||||

Ave Err | 0.023 | 0.022 | 0.022 | 0.019 | ||||

Max Err | 0.061 | 0.063 | 0.063 | 0.079 |

Me-Ch: Measured chlorine; Ca-Ch: Calculated chlorine; Min: Minimum; Ave: Average; Max: Maximum; Err: Absolute error between the measured and calculated data.

Comparison of the results in Table 10 shows that the average absolute error between the measured and calculated data in nodes S_{2}, S_{16}, S_{20} and S_{27} is equal to 0.023, 0.022, 0.022 and 0.019 mg/l, respectively. The average absolute error for all testing data is also equal to 0.022 mg/l. In other words, this error is equal to 3.85%, which indicates there is an acceptable adjustment between the two types of data and that the calibration model has given good performance.

## CONCLUSION

Generally the adjusted parameters of water quality model calibration of a WDN include BD and WD coefficients. The present research focused on the WD coefficient calibration. For this purpose, a new metamodelling approach was developed by the combination of ACO algorithms and an ANN with the EPANET simulator. To measure the correctness of the calibration model, this proposed metamodel was tested on a two-loop test example and was compared with the simple model. The results showed that the simple model carried out a low number of objective function evaluations in a long time. Thus it was not useful for the real WDNs, where there was a need to do more evaluations, while the proposed metamodel was able to carry out a lot of evaluations within a short time. For example, the simple model carried out 24,875 evaluations in 124.4 min to achieve the real answer in the uncategorized mode of coefficients, while the proposed metamodel carried out 108,600 evaluations during only 118 sec under the same conditions.

The purpose of the water quality model calibration of the WDN in Ahar City was to consider some different criteria such as material, diameter, age of pipes and the average flow velocity in pipes, in a way that the best classification criteria of pipes were chosen. For this purpose, seven categories based on physical characteristics such as material, diameter, and age of the pipes and another category based on the hydraulic characteristics including the average flow velocity in the pipes were designed and the quality calibration was carried out separately for each one by using the proposed metamodel. The results showed that between the physical characteristics of the classifications, category C7 with criteria of material, diameter, and age of pipes had the most desirable results while category C8 based on the average flow velocity in the pipes had the best results among all the classifications. The outputs also showed that the selection of suitable criteria was highly important in classification, in that the number of subcategories of C8 was less than the number of subcategories of C7, but C8 produced better results than C7. In other words, classification based on hydraulic criteria gave better performance than classification based on physical criteria. Furthermore it was observed that the average error between the measured and calculated data for the testing data was equal to 3.85%. Therefore the proposed metamodel used in this research had a good ability for water quality model calibration of a real WDN.