*2.1. Pipe Network Simulation*

EPANET is a widely used public software package for modeling hydraulic and water quality behavior in pressurized pipe systems. However, it needs an external functionality to model water leakage in a system in simulations [45]. Moreover, it is not easy to simulate the hydraulic behavior of

a pressurized pipe system with blockages or deterioration. In order to simulate steady-state water head distribution in a network with various faults, we therefore developed a heuristic optimization algorithm called a pipe network symbiotic organism search (PNSOS) based on the algorithm for pipe network simulated annealing (SA) introduced by Yeh and Lin [46]. The SOS was adopted here to replace the SA in order to deal with a complex network for the sake of computational efficiency. The PNSOS is an efficient tool in estimating the steady-state nodal head and flow rate for a given pipe network system with faults before a transient operation. The Hazen–Williams (H–W) equation is then used to express the relationship between the flow rate and head loss for each pipe [47,48]. The modified loss coefficient (*Kij*(*t*)) in the H–W equation for a pipe at used year *t* is defined as

$$K\_{ij}(t) = \frac{10.66667 \cdot L\_{ij}}{\mathbf{C}\_{ij}^{\text{HW}}(t)^{1.851852} \cdot D\_{ij}^{4.870370}}\tag{1}$$

where *ij* is defined from node *i* to node *j* for the variable, *Lij* is the length (m) of the pipe, and *Dij* is the internal pipe diameter (m). The modified H–W coefficient *CHW ij* (*t*) (for modeling the effect of pipe aging) is defined as [49]

$$C\_{ij}^{HW}(t) = 18 - 37.2 \log \left( \frac{e\_{0ij}(t) + t \times a\_{ij}(t)}{D\_{ij}} \right) \tag{2}$$

where *t* is the used year of the pipe, *e*0*ij*(*t*) is the initial roughness (mm) of the pipe, and *aij*(*t*) is the roughness growth rate (unique per year) in the pipe at year *t*. The following equations are used in the proposed approach to calculate the values of *e*0*ij* and *aij* [49]:

$$\log\left(e\_{0ij}(t)\right) = \frac{C\_{ij}^{HW}(t-1) - 18}{-37.2} + \log(D\_{ij}),\tag{3}$$

$$a\_{ij}(t) = \frac{10^{(\frac{0.5C\_{ij}^{\text{H\%}}}{ij}(t-1)-18}}{50} \times D\_{ij} - e\_{0ij}(t)}{50}.\tag{4}$$

For a new installed pipe (i.e., *t* = 0), the value of *CHW ij* (*t* − <sup>1</sup>) in Equation (3) is considered to be the initial value of the H–W coefficient at the time of pipe installation (i.e., *CHW ij* (0)). Thus, the modified H–W coefficient for each pipe could be iteratively obtained. On the basis of Equations (1)–(4), the flow rate *Qij*(*t*) (m3/s) in each pipe at year *t* could be expressed as

$$Q\_{ij}(t) = \left[\frac{\Delta H\_{ij}}{K\_{ij}(t)}\right]^{0.54},\tag{5}$$

where Δ*Hij* is the frictional head loss in a pipe. The equation of mass conservation at node *i* could be written as

$$\text{MC}\_{i}(t) = \sum\_{j=1}^{mn} Q\_{ij}(t) + QI\_{i}(t), \tag{6}$$

where *nn* is the number of total neighbor nodes to node *i*, and *QIi*(*t*) is the demand or the source at node *i*. The flow rate is positive for flow out of node *i* and negative for flow into node *i*, while *QIi* is positive for inflow and negative for outflow. The objective function used in the PNSOS is defined as

$$\text{Minimize} \sum\_{i} ^{nd} \left( \text{MC}\_{i}(t) \right)^{2} \text{ \tag{7}$$

where *nd* is the total number of nodes needed to estimate the nodal heads and flows in a network system.
