1 Introduction

Water quality models simulate the spatial and temporal variations of the concentrations of chemical substances in a water distribution network by combining the reaction kinetics with the underlying hydraulics of the distribution network. The models have many applications e.g. designing sampling and monitoring programmes and optimizing the disinfection process. They can improve the calibration of hydraulic simulation models and assist in predicting the deterioration of water quality (Clark 2015).

EPANET-MSX (multi-species extension) (Shang et al. 2008a, b) is a model that analyses water quality in distribution networks using the dynamic link library of EPANET 2, a hydraulic simulation model (Rossman 2000). It analyses multiple chemical substances simultaneously (Sun et al. 1999), accounts for any differences in the quality of water from different sources and provides a framework that permits the simulation of any chemical or biological constituent. Multi-species water quality models have many applications that address real-world water quality problems that are generally complex. Examples include the reactions of chlorine in distribution networks, chloramine decay and predictions of the reactivity of water supplied from various points (Shang et al. 2008a).

Though undesirable, pressure deficiency can occur due to selective mains closure for maintenance and repair purposes, pipe bursts, pump breakdowns, power failures and large unanticipated demands for fire fighting. Conventional demand-driven hydraulic models for water distribution systems presume demands are fully satisfied even if a network is in a pressure-deficient condition. This assumption is true only when the network operates under normal pressure conditions. Additionally, low-pressure conditions can facilitate the entry of pathogenic microorganisms through pathways such as cracks and leaks (Besner et al. 2011; Nygard et al. 2007; Hunter et al. 2005). Thus, it is essential to have an integrated model that can simulate both pressure deficiency and water quality realistically and seamlessly.

There have been many endeavours to develop realistic pressure-driven analysis methods for more than three decades, and the models have been utilised to address a range of issues including reliability evaluation, parameter calibration, reliability-based design, placement of isolation valves and leakage management (Gupta and Bhave 1996; Giustolisi et al. 2008; Tsakiris and Spiliotis 2014; Elhay et al. 2015). Recently, significantly improved solutions to some benchmark optimization problems were achieved using pressure-driven analysis (Siew et al. 2014, 2016). However, the models have not been considered in water quality studies concerned with issues such as loss of disinfection residual and intrusion of contaminants under low-pressure conditions (Rathi and Gupta 2015; Rathi et al. 2016).

The most efficient approach for pressure-driven analysis involves embedding the relationship between the flow and pressure at a demand node in the system of hydraulic equations (Ciaponi et al. 2015; Elhay et al. 2015; Kovalenko et al. 2014). The source code of EPANET 2 was modified recently to provide a pressure-driven model called EPANET-PDX (pressure-dependent extension) (Seyoum and Tanyimboh 2016) by incorporating a logistic pressure-driven demand function (Tanyimboh and Templeman 2010) in the global gradient algorithm (Todini and Pilati 1988). It can simulate water quality under both normal and low-pressure conditions with only one chemical reaction at a time (Seyoum and Tanyimboh 2014).

However, the single-species approach is inefficient and somewhat unrealistic. Different chemical substances may co-exist in water distribution systems, and it can be time consuming, for example, to simulate chlorine and various disinfection by-products one by one. Effectively, it can render evolutionary optimization algorithms that address water quality concerns impracticable, as the number of simulations required would be excessively large.

EPANET-MSX is a water quality model based on EPANET 2. While EPANET-MSX can simulate multiple species simultaneously, it is not suitable for operating conditions with insufficient pressure. To address these gaps this paper proposes an integrated network analysis model called EPANET-PMX (pressure-dependent multi-species extension) for steady state and extended-period analysis, single- and multi-species simulation plus demand- and pressure-driven analysis.

2 Water Quality Modelling

Water quality models often assume advective-reactive transport and consider the reactions in the bulk flow and at the pipe wall; an approach that includes both advection and dispersion is available in Tzatchkov et al. (2002). The governing equations address the conservation of mass and reaction kinetics and often assume complete and instantaneous mixing of water at the nodes and junctions, and storage facilities (Rossman and Boulos 1996; Rossman 2000; Clark and Grayman 1998; Monteiro et al. 2015).

2.1 Constitutive Equations

The mass conservation equations for pipes, junctions and storage facilities may be summarised briefly as follows.

The mass conservation equation for pipes is (Rossman 2000)

$$ \frac{\partial {C}_i}{\partial t}=-{u}_i\frac{\partial {C}_i}{\partial x}+{r}_i;\kern1em \forall i $$
(1)

where C i  ≡ C(i, x, t) is the reactant concentration in pipe i at location x at time t; u i  ≡ u(i, t) is the mean flow velocity in pipe i at time t; and r i  ≡ r(C i ) is the rate of reaction. The equation assumes that longitudinal dispersion in the pipes is negligible.

The mass balance equation for node n is

$$ \left(\sum_{j\in {I}_n}{Qp}_j+{Q}_e\right)C{\left(i,x,t\right)}_{x=0}=\sum_{j\in {I}_n}\left({Qp}_jC{\left(j,x,t\right)}_{x={L}_j}\right)+{Q}_e{C}_e;\kern1em \forall i\in {O}_n,\kern1em \forall n $$
(2)

where j and i respectively denote pipes with flow entering and leaving node n. I n and O n respectively denote the sets of pipes with flow entering and leaving node n; L j is the length of pipe j; Qp j is the volume flow rate in pipe j; Q e and C e are, respectively, the volume flow rate and reactant concentration for any external flow entering node n.

The mass balance equation for the s th storage facility (tank or service reservoir) is

$$ \frac{\partial \left({V}_s{C}_s\right)}{\partial t}=\sum_{i\in {I}_s}\left({Qp}_iC{\left(i,x,t\right)}_{x={L}_i}\right)-\sum_{j\in {O}_s}{Qp}_j{C}_s+{r}_s;\kern1em \forall s $$
(3)

where V s  ≡ V(s,t) and C s  ≡ C(s,t) are, respectively, the volume in storage and reactant concentration at time t; I s denotes the set of links supplying the storage facility with flow; O s denotes the set of links receiving flow from the facility; and r s  ≡ r(C s ) is the rate of reaction.

Besides the reactions in the bulk flow, there may be reactions with biofilm, corrosion and other materials at the pipe walls. The reaction rate coefficient employed in EPANET 2 for the reactions at the pipe wall is (Rossman et al. 1994; Powell et al. 2004: 11-12)

$$ {k}_{w\ast }=\frac{k_w{k}_f}{R\left({k}_w+{k}_f\right)} $$
(4)

where k w* is the wall reaction rate coefficient (1/time); k w is the wall reactivity coefficient (length/time); k f is the radial mass transfer coefficient (length/time); and R is the hydraulic radius. The value of k f depends on the molecular diffusivity of the reactive species and the turbulence of the flow.

Several kinetic models that are included in this article to demonstrate the effectiveness of the proposed framework for low-pressure conditions and multiple concurrent reactions are described briefly here. Both the single-species (Eqs. 5 and 7) and two-species models with fast- and slow-reacting components (Eqs. 6, 8 and 9) (Helbling and Van Briesen 2009; Sohn et al. 2004; Amy et al. 1998) were considered for the disinfectant, chlorine, and predominant disinfection by-products, trihalomethanes and haloacetic acids (Nieuwenhuijsen et al. 2000).

An inadequate chlorine residual in a distribution system may lead to bacterial regrowth (Clark and Haught 2005) and, consequently, water-borne diseases. Disinfection by-products result from the reactions of chlorine with natural organic compounds in water (Rodriguez et al. 2004; Ghebremichael et al. 2008) and are associated with adverse health effects (Nieuwenhuijsen et al. 2000; Richardson et al. 2002; Nieuwenhuijsen 2005; Hebert et al. 2010).

The first-order (Rossman 2000) and parallel first-order (Helbling and Van Briesen 2009) kinetic models for chlorine decay are, respectively,

$$ r\left({C}_C\right)\equiv \frac{\partial {C}_C}{\partial t}=-{kC}_C $$
(5)
$$ {C}_C(t)={C}_{C0}\left[\rho \exp \left(-{k}_1t\right)+\left(1-\rho \right) \exp \left(-{k}_2t\right)\right] $$
(6)

Recalling that the reactant concentrations vary with space and time as in Eqs. 1 to 3, C C  ≡ C C (t) is the time-varying chlorine concentration at a demand node or junction; and C C0 is the initial chlorine concentration at the node or junction in question. It is worth repeating that the water quality results relate to the fully developed operational cycle (typically 24 h). C C0 is thus the chlorine concentration at the node at time t = 0. k is the reaction rate constant, k 1 and k 2 are the fast and slow chlorine decay coefficients, respectively, and ρ represents the fraction of chlorine that reacts rapidly.

The first-order (Rossman 2000) and parallel first-order (Sohn et al. 2004) models for trihalomethanes, and the parallel first-order model for haloacetic acids (Sohn et al. 2004) are, respectively,

$$ r\left({C}_{TTHM}\right)\equiv \frac{\partial {C}_{TTHM}}{\partial t}=k\left({C}_L-{C}_{TTHM}\right) $$
(7)
$$ {C}_{TTHM}={C}_{C0}\left[\alpha \left(1- \exp \left(-{k}_1t\right)\right)+\beta \left(1- \exp \left(-{k}_2t\right)\right)\right] $$
(8)
$$ {C}_{HAA6}={C}_{C0}\left[\gamma \left(1- \exp \left(-{k}_1t\right)\right)+\delta \left(1- \exp \left(-{k}_2t\right)\right)\right] $$
(9)

where C TTHM refers to the time-varying total concentration of trihalomethanes (TTHM) while C L is the ultimate concentration (Rossman 2000). C HAA6 refers to the time-varying concentration of haloacetic acids (HAA6) (i.e. six species), k is the reaction rate constant and C C0 is the initial chlorine concentration (as in Eq. 6). k 1 and k 2 are the fast and slow chlorine decay coefficients, respectively, while α, β, γ and δ are empirical coefficients.

2.2 Brief Overview of the Computational Solution Methods

Eulerian and Lagrangian approaches are commonly used together with a hydraulic simulation model to solve the water quality equations computationally. The discrete volume method is an Eulerian approach that Grayman et al. (1988) suggested. Each pipe is divided into equal segments with completely mixed volumes. At each successive water quality time step, the concentration within each segment is determined and transferred to the adjacent downstream segment. At nodes, the concentration is updated using a flow-weighted average of the inflows (Eq. 2). The resulting concentration is then transferred to all adjacent downstream segments. This process is repeated for each water quality time step until a different hydraulic condition occurs. When a new hydraulic condition occurs, the pipes are divided again and the process continues.

Liou and Kroon (1987) suggested a Lagrangian method that divides the pipes into segments similarly. Unlike Eulerian methods, the water parcels in the pipes are tracked and, at each time step, the length of the farthest upstream parcel in each pipe increases as water enters the pipe while the farthest downstream parcel shortens as water leaves the pipe. The concentration at every node is updated by a flow-weighted average of the inflows (Eq. 2). If the resulting nodal concentration is significantly different from the concentration of an adjacent downstream parcel, a new parcel is created at the upstream end of each link that receives flow from the node. The process repeats for each water quality time step until a different hydraulic condition occurs and the procedure begins again.

Lagrangian methods can be either time- or event-driven. Time-driven methods update the conditions using a fixed time step whereas event-driven methods do so when the water quality at the source changes or the front end of a parcel reaches a node. A comparison by Rossman and Boulos (1996) indicated that the time-driven Lagrangian method was the most efficient. EPANET 2 and EPANET-MSX employ a time-driven Lagrangian approach (Rossman 2000; Shang et al. 2008b).

3 Integrated Network Analysis Model

It is worth recalling that EPANET-MSX is not a free-standing network analysis model in the sense that it has no hydraulic modelling capabilities. Instead, it uses the standard EPANET dynamic link library for the requisite hydraulic analyses the results of which are not accessible. Also, given the weaknesses of demand-driven analysis, a model for water quality analysis that provides realistic solutions for both normal and low pressure conditions is clearly necessary (Liserra et al. 2014).

An integrated model called EPANET-PMX (pressure-driven multi-species extension) was developed. It provides the full modelling functionality under both normal and pressure-deficient operating conditions in a way that is seamless. In other words, EPANET-PMX combines the modelling capabilities of EPANET 2, EPANET-MSX and EPANET-PDX. EPANET-PDX is an extension of EPANET 2. It includes a logistic pressure-driven nodal flow function (Tanyimboh and Templeman 2010) that was incorporated in the system of equations in the global gradient algorithm (Todini and Pilati 1988). The computational solution procedure developed (Seyoum 2015, Seyoum and Tanyimboh 2016) includes a line minimization algorithm (Dennis and Schnabel 1996; Press et al. 2007) that improves convergence by optimizing the Newton steps in the global gradient algorithm.

EPANET-PMX was developed by incorporating the pressure-driven analysis algorithm in the framework for the reaction kinetics in EPANET-MSX (Shang et al. 2008a, b). The appendix includes an outline of the program. The convergence criteria were taken as a maximum change in the nodal heads of at most 0.001 ft. (3.048 × 10−4 m) and a maximum change in the pipe flow rates of at most 0.001 cfs (2.832 × 10−5m3s−1) between successive iterations (Seyoum and Tanyimboh 2016). The criterion used in EPANET 2 requires the ratio of the sum of the absolute values of changes in the pipe flow rates to the sum of the pipe flow rates in successive iterations to be less than 10−3.

The data required to execute EPANET-PMX are as follows. (a) The standard EPANET 2 input file that describes the properties of the pipes and nodes. (b) The standard EPANET-MSX input file that specifies the water quality species and their reaction kinetics. (c) A data input file that specifies the residual heads above which the nodal demands are satisfied in full, with the same format as EPANET 2.

4 Results and Discussion

Selected results are shown here for water age, chlorine residual and disinfection by-products to illustrate and verify the capabilities of the proposed model. The verification was effected by comparing EPANET 2 and the MSX, PDX and PMX extensions. Various scenarios were considered for two networks. The first was a simple hypothetical network from the literature (Network 1 in Fig. 1) (Fujiwara and Ganesharajah 1993). The second was a real network in the UK (Network 2 in Figure 2) (Seyoum and Tanyimboh 2014).

Fig. 1
figure 1

Chlorine and TTHM concentrations in Network 1 under normal and low pressure conditions. DSR (demand satisfaction ratio) is available flow divided by demand

Fig. 2
figure 2

Topology and demand categories of Network 2

Reasonably complete results could be presented here for Network 1, as it is quite small and this network was selected in part for this reason. On the other hand, Network 2 is much larger and, aiming to reflect the entire network, representative results were included. The network was used previously to assess water quality simulation models and was selected in part for this reason (Seyoum and Tanyimboh 2014).

All the simulations were carried out with an Intel Core 2 Duo personal computer (CPU of 3.2 GHz and RAM of 3.21 GB). In general, hydraulic and water quality models require extensive calibration for operational use. However, the various investigations and procedures involved are outside the scope of this article. The effectiveness of the proposed integrated model must be demonstrated first, followed by fieldwork and any additional validation steps.

A constant chlorine concentration of 1 mg/L was assumed at each supply node, aiming to achieve a chlorine residual of at least 0.2 mg/L (WHO 2008) at the remote points in the networks (Seyoum and Tanyimboh 2014). A maximum TTHM concentration of 100 μg/L was assumed in accordance with the Water Supply (Water Quality) Regulations (2010) in England and Wales, and was taken as the value of C L , i.e. the limiting concentration in Eq. 7. The water quality time step was 5 min. Steady state conditions were assumed for Network 1 while the hydraulic time step for Network 2 was one hour.

Helbling and Van Briesen (2009) developed general-purpose empirical relationships between the initial concentration of chlorine and each parameter of the parallel first-order chlorine decay model. Accordingly, the values adopted here were ρ = 0.87, k 1  = 0.31/h and k 2  = 0.02/h. Similarly, Sohn et al. (2004) developed empirical equations for the coefficients of the parallel first-order kinetic models for trihalomethanes and haloacetic acids. Accordingly, the values adopted here were α = 16, β = 34.7, γ = 14.5 and δ = 10.3. Finally, both k b and k were taken as 1.0/day (Carrico and Singer 2009; Helbling and Van Briesen 2009; Seyoum and Tanyimboh 2014). The wall reactivity coefficient k w requires calibration in practice and would require field data to bring about a significant qualitative improvement in the results. This research is in progress; the pipe wall reaction was not considered explicitly.

4.1 Network 1

Network 1 has one source node, six demand nodes and eight pipes of length 1000 m and Hazen-Williams roughness coefficient of 140. The required residual head was 15 m for all the demand nodes and the residual head below which there would be no flow was taken as zero. Steady state conditions were assumed. Source heads of 90 m, 65 m and 60 m were considered with respective demand satisfaction ratio (DSR) values of 100%, 70% and 56%. The demand satisfaction ratio is the available flow divided by the demand, i.e. the fraction of the demand that is satisfied.

Network 1 was analysed using both EPANET-MSX and EPANET-PMX. The results are shown in Figure 1. When pressure was sufficient, both EPANET-MSX and EPANET-PMX provided essentially identical results. The expected trends of decreasing chlorine residual and increasing TTHM concentrations with the distance from the source are self-evident. The results confirmed also that the chlorine residual and TTHM concentrations at the supply nodes were always 1.0 and zero, respectively, for all the pressure and DSR conditions. Both models analysed the fast- and slow-reacting components of chlorine and TTHM simultaneously in a single execution.

Furthermore, EPANET-PMX provided the concentrations of chlorine and TTHM that reflected the actual pressure conditions. The deficiencies in pressure influenced the overall performance of the system significantly. As the pressure decreased, the available flow at the demand nodes decreased. The flow velocities decreased while travel times increased as a result. The simulated results reflected these effects. Reductions in the DSR increased the travel times and TTHM concentrations but decreased the choline residual concentrations. It was revealed that the concentration of chlorine at node 6 would be less than the minimum requirement of 0.2 mg/l for a network DSR of 56%.

4.2 Network 2

Network 2 (Fig. 2) comprises 416 pipes, 380 demand nodes and four supply nodes (R1 to R4). Supply nodes R2 to R4 had a constant water level of 133 m. R1 is a variable-head supply node whose average water level was 133 m. The pipe sizes range from 50 mm to 500 mm and the total length of the pipes is 164 km. The demand categories considered were domestic demand, losses or unaccounted for water, and 10-h and 16-h commercial demands for an operating cycle of 24 hours, as shown in Fig. 9 in the (online) supplementary data.

Scenarios corresponding to supply node water levels ranging from 90 m to 133 m were considered, in steps of 4 m, i.e. 12 cases for each model. The head below which the nodal flow would be zero was taken as the nodal elevation while the prescribed residual head for full demand satisfaction was taken as 20 m. An operational period of 10 days was simulated, to avoid the inconsistent results at the beginning of the simulations. Water age, chlorine residual, trihalomethanes and haloacetic acids were considered. The hydraulic and water quality time steps were one hour and five minutes, respectively. Table 1 shows the accuracy of the results and CPU times of the various simulation models.

Table 1 Accuracy and computational properties for a network with 416 pipes (Network 2)

It is evident in Table 1 that EPANET 2 and EPANET-PDX were faster than EPANET-MSX and EPANET-PMX when simulating one reactant in isolation. It should be clarified that EPANET-MSX has ‘command line’ and ‘toolkit’ variants while EPANET-PMX is based on the toolkit. While the command line variant of EPANET-MSX is faster, the toolkit provides more flexibility. For example, it enables programmers to customise the software. EPANET-MSX (toolkit variant) and EPANET-PMX required averages of 856 and 996 s, respectively, to analyse water age, chlorine residual, trihalomethanes and haloacetic acids concurrently. EPANET-MSX (command line variant) required 66 s. Besides the extra computational demands of pressure-driven analysis, the differences in the simulation times are mainly attributable to the toolkit.

4.2.1 Normal Pressure Conditions

The heads at all the supply nodes were fixed at 133 m to satisfy all the demands in full. Figure 3 and Table 1 show that EPANET-PMX and EPANET-MSX provided essentially identical results except for several minor discrepancies in the water age. It is worth repeating that EPANET-PDX and EPANET-PMX do not use the same convergence criteria as EPANET 2 and EPANET-MSX (Seyoum and Tanyimboh 2016). Consequently, the occasional minor difference may be considered reasonable. It was revealed that the residual chlorine concentration was less than 0.2 mg/L at a few demand nodes, based on the modelling parameters used (Figure 3b). This would be indicative of a need for further investigations.

Fig. 3
figure 3

Water quality in Network 2 at 24:00 h under normal pressure conditions. TTHM and HAA6 denote total trihalomethanes and six species of haloacetic acids, respectively. This scenario revealed some nodes with chlorine residuals of less than 0.2 mg/L.

4.2.2 Low Pressure Conditions

Supply node heads of 112 m, 107 m, 102 m and 97 m that correspond to demand satisfaction ratios of 90%, 75%, 50% and 30%, respectively, were investigated. Results for selected nodes are shown in Figs. 4 to 7. A reduction in the nodal flow rates due to low pressure leads to a reduction in the pipe flow rates that causes the water age to increase. Consequently, the concentration of chlorine decreases while the concentrations of the disinfection by-products increase.

Fig. 4
figure 4

Water age variations in Network 2 under low-pressure conditions. The demand satisfaction ratios (DSRs) were 30%, 50%, 75% and 90%

The water age at node 6 was the lowest among the six selected nodes (Figure 4). Node 6 has an advantageous relatively central location (Fig. 2) with respect to the supply nodes and nodes 1 to 5. By contrast, the water age at node 5 was relatively high; Figure 2 shows that node 5 has a remote location relative to the four supply nodes. The chlorine, TTHM and HAA6 concentrations in Figs. 5, 6, 7 and 8 depend on the water age. In turn, the water age depends on the location within the network and the properties of the flow supply paths in addition to pressure. For example, Figs. 5 and 8 show that the concentration of chlorine at some nodes would be less than 0.2 mg/L for the abnormal operating conditions shown.

Fig. 5
figure 5

Chlorine residuals in Network 2 under low pressure conditions. The demand satisfaction ratios (DSRs) were 30%, 50%, 75% and 90%

Fig. 6
figure 6

Concentrations of trihalomethanes in Network 2 under low pressure conditions. The demand satisfaction ratios (DSRs) were 30%, 50%, 75% and 90%. TTHM denotes total trihalomethanes

Fig. 7
figure 7

Concentrations of haloacetic acids in Network 2 under low pressure conditions. The demand satisfaction ratios (DSRs) were 30%, 50%, 75% and 90%. HAA6 denotes six species of haloacetic acids

Fig. 8
figure 8

Water quality in Network 2 with only one supply node R2 available. R2 was available while R1, R3 and R4 were unavailable. TTHM and HAA6 denote total trihalomethanes and six species of haloacetic acids, respectively. These results from one extended period simulation illustrate the seamless integration of pressure-driven and multi-species network modelling

The effects of closing the supply mains were investigated by closing all the supply nodes except for R2 the head at which was set at 133 m. Figure 8 depicts the EPANET-PMX results. This scenario illustrates simulations that might be performed for contingency and planning purposes. In this scenario, node 3 is closest to the supply node R2 while nodes 1 and 4 are relatively far. It can be seen that node 3 had the lowest water age and the highest residual chlorine concentration. Conversely, nodes 1 and 4 had higher water ages and lower residual chlorine concentrations.

4.3 Reliability and Quality of the Network Modelling Results

The EPANET-PDX algorithm is notable in that it retains the modelling capabilities of EPANET 2 in full (Seyoum and Tanyimboh 2014). Kovalenko et al. (2014) and Elhay et al. (2015), for example, excluded key elements e.g. tanks, pumps and control devices. Control devices such as pressure regulating valves make the equations for water distribution systems more difficult to solve (Kovalenko et al. 2014; Elhay et al. 2015). The accuracy and reliability of the EPANET-PDX results were verified previously (Seyoum and Tanyimboh 2014).

Herein, the accuracy of the EPANET-PMX results for Network 2 was verified with EPANET 2, EPANET-MSX and EPANET-PDX for normal pressure conditions. In addition, EPANET-PDX was used for a low pressure condition with a demand satisfaction ratio of 50%. The comparisons were based on the first-order reaction models in Eqs. 5 and 7 to ensure the results would be equitable. Consistently good results were achieved as shown in Table 1 and Fig. 3. Consistently good results were achieved for Network 1 also Figure 1.

5 Conclusions

Demand-driven models for water distribution networks provide unrealistic results under pressure-deficient conditions, which could lead to inappropriate investment and operational decisions. A pressure-driven, multi-species extension to the EPANET 2 simulation model was developed and demonstrated. The model can be applied to any network with different combinations of chemical reactions and reaction kinetics for all operating conditions from zero flow to fully satisfactory flow and pressure. The accuracy of the results was checked and consistently good results were achieved. Model calibration was not addressed in this article. More research is desirable, for example, to increase the speed of execution.