## Abstract

Water quality simulation is affected by uncertain parameters such as pipe roughness coefficients, chlorine bulk decay coefficients, and chlorine wall decay coefficients, which are usually considered to be fuzzy variables. The minimum and maximum nodal chlorine concentrations and water ages at each α-cut level were obtained by the genetic algorithm (GA) based on EPANET hydraulic and water quality simulation toolkit. The fuzziness of nodal chlorine concentrations and water ages were measured using the fuzziness measure (FM) proposed in this paper. The method was applied to four networks to analyze the fuzziness of nodal chlorine concentrations and water ages. The results indicated that the distribution of nodal chlorine concentrations does not follow typical trapezoid distribution, while the distribution of nodal water ages follows typical trapezoid distribution. In addition, the chlorine concentration and water ages of nodes farther from the source are affected by uncertain parameters to a greater extent. The greater demands of nodes lead to less effects of uncertain parameters on chlorine concentration, and greater effects of uncertain parameters on water ages. This study would help in analyzing the fuzziness of hydraulic and water quality simulation results in WDS under uncertain conditions.

## HIGHLIGHTS

Consider the uncertainties of pipe roughness, chlorine bulk decay coefficients, and chlorine wall decay coefficients to be trapezoid distribution.

Define the fuzziness measure based on trapezoid distribution.

Nodal chlorine concentration and water age were analyzed under trapezoid distribution.

Genetic algorithm applied to obtain maximum/minimum chlorine concentration and water age.

### Graphical Abstract

## INTRODUCTION

Water distribution systems (WDSs) are designed to supply high quality water to customers. By performing hydraulic and water quality simulation, pipe flows, nodal pressures, and nodal chlorine concentrations can be obtained to measure whether system requirements can be satisfied or not under a given condition. Compared with hydraulic simulation, water quality represented by chlorine concentration is more important since it has a close relationship with people's health (Duan *et al.* 2020; Jia *et al.* 2020). However, water quality simulation is affected by uncertain parameters of nodal demands, pipe roughness coefficients, pipe diameters, chorine decay coefficients, etc. To deal with the uncertainty in WDS, many researchers have applied uncertainty quantification technologies in hydraulic and water quality simulation of WDS (Lansey *et al.* 1989; Hart *et al.* 2019). The Monte Carlo simulation (MCS) method was applied widely to examine the uncertainty of WDS (Giustolisi *et al.* 2009; Haghighi & Asl 2014; Fan *et al.* 2021). The MCS method produces the distributions of output variables by completing more than tens of thousands of recalculations based on the probability density functions of the inputs. The disadvantages of MCS include: (1) Extensive data for input parameters are required to estimate a reliable probability distribution for parameters. (2) The method requires a significant computational time. As such, the first-order reliability method (FORM) based on the Taylor series was proposed to reduce the computational burden (Xu & Goulter 1998). However, the FORM is only suitable for simulating linear systems. To describe the uncertain hydraulic variables, fuzzy set theory and fuzzy logic were introduced as an alternative method for the uncertainty analysis (Bargiela & Hainsworth 1989; Revelli & Ridolfi 2002; Bhave & Gupta 2007). In addition, α-cut sets of the fuzzy parameters were applied to facilitate the interpretation of the fuzziness in WDS instead of the membership function of the fuzzy variables (Revelli & Ridolfi 2002; Branisavljevic & Ivetic 2006; Haghighi & Asl 2014; Moosavian & Lence 2018). Based on α-cut set theory, the WDS was optimized with sequential quadratic programming (SQP; Revelli & Ridolfi 2002). The fuzziness of the nodal demands, pipe roughness coefficients, and wave speeds were considered as fuzzy input parameters in the transient analysis of WDS and solved by the simulated annealing method (Pasha & Lansey 2010). The effects of uncertain reactions and pipe diameters on water quality analysis were examined. The uncertain water demand, bulk decay coefficients, and contaminant injection locations were considered to determine the locations for drinking water sampling and applied to two WDS (Hart *et al.* 2019). To optimize valve management, robust programming with consideration of uncertain demand was proposed to minimize the water age and number of valve closures to improve water quality (Marquez Calvo *et al.* 2019). To deal with water quality reliability, the Shannon entropy and improved Tsalli entropy were applied to analyze the water quality in WDS (Wang & Zhu 2021a; Wang *et al.* 2022). However, uncertain parameters were not considered.

However, almost all the approaches deal with the uncertainty of hydraulic parameters with the triangular distribution membership functions (Wang & Zhu 2021b). In this paper, trapezoid distribution membership functions were applied for parameters of pipe roughness coefficients, chlorine bulk decay coefficients, and chlorine wall decay coefficients to analyze the uncertainties of nodal chlorine concentrations and water ages in WDS. In addition, the fuzziness of nodal chlorine concentrations and water ages should be quantified to analyze the effects of uncertain parameters.

In this paper, firstly, the fuzziness of pipe roughness coefficients, chlorine bulk decay coefficients, and chlorine wall decay coefficients were expressed by trapezoid distribution membership function based on α-cut sets. The hydraulic and water quality simulation were performed using the EPANET toolkit in a MATLAB environment. Secondly, the genetic algorithm (GA) method was applied to calculate the extreme values of nodal chlorine concentrations and water ages at each α-cut level of fuzzy variables. Thirdly, the method was applied to four networks to analyze the effects of the fuzzy variables on chlorine concentrations and water ages. Finally, the conclusion was drawn.

## METHODOLOGY

### Fuzzy set theory

*x*is in the set

*X*, refers to the membership degree function of variable

*x*to the fuzzy set

*A*, which is termed as a set of ordered pairs . The α-cuts of a fuzzy set

*A*are the variables with membership degrees greater than or equal to

*α*(). In this paper, the trapezoidal distribution membership function was applied for fuzzy parameters, which is expressed as (, , , ) (shown in Figure 1(a)). The subscripts of

*x*in Figure 1(a) are related to five α-cuts of 0.2, 0.4, 0.6, 0.8, and 1.0.

*x*, refers to the maximum value of variable

*x*. After normalization, the variable

*x*is defined in the interval of [0.0, 1.0].

*FM*refers to fuzziness measure,

*S*

_{1}and

*S*

_{2}refer to the area of the trapezoid and rectangle shown in Figure 1(b), and refer to the normalized values of and with values of 0.0 and 1.0, respectively, and (

*i*= 1, 2,…, 5) refer to the normalized values of and , respectively. In Equation (2),

*S*

_{1}is calculated by taking the trapezoid area as the summing up of six rectangle areas. Among the six rectangles, one rectangle has a length of and a height of 0.1, the other four rectangles have the length of , , , , respectively, and the height of 0.2, and the last rectangle has the length of and the height of 0.1. Since in Figure 1(b), the values are normalized variables, they are dimensionless. In Equation (2),

*S*

_{2}is calculated as the rectangle area with a length of and a height of 1.0. When the area of the trapezoid is close to the rectangle, the area represented by

*S*

_{1}is close to the area represented by

*S*

_{2}, and the fuzziness gets greater. When the area of the trapezoid is close to the rectangle, the fuzziness gets greater. The greatest fuzziness occurs when the value of

*FM*is equal to 1.0, and the lowest fuzziness occurs when the value of

*FM*is equal to 0.0.

### Genetic algorithm

Based on principles of natural genetics and natural selection, the best solutions can be searched out by GA. Different from traditional optimization methods, the GA method searches for the solution from an entire population of decision variable sets, which can be applied for solving discrete, non-convex, discontinuous problems. In addition, GA uses a probabilistic search method instead of a deterministic rule, which makes it more advantageous in preventing being trapped into local optima. In the GA method, three basic operators of selection, crossover, and mutation are applied (shown in Table 1). Firstly, a solution represented by values of a set of parameters is described by an individual in a population. The solutions are encoded into character strings formed by a binary alphabet (characters of 0 and 1), which are analogous to chromosomes found in DNA. A set of solutions are created randomly within a computer in terms of a population. For example, a solution consisting of two parameters is described by an eight-bit binary chromosome: 1001 0011 (i.e., four bits per parameter, *x*_{1} = 1001, *x*_{2} = 0011). Secondly, a fitness function is obtained to measure the fitness of chromosomes with respect to the objective function for selecting processes. For each chromosome, the binary strings are decoded into parameter values to calculate the objective function values. Thirdly, based on the fitness function values the individuals are selected from the population and recombined to comprise a new generation through crossover and mutation processes. For example, if two chromosomes are and , the two offspring produced through crossover process may be and . In addition, if the original chromosome is , the chromosome through the mutation process may become . The offspring produced are the next population to be evaluated.

Genetic algorithm performing detail . | Value/method . |
---|---|

Population type | Double vector |

Population size | 20 |

Generations | 30 |

Crossover | Single point |

Crossover fraction | 0.8 |

Mutator | Gaussian |

Mutation rate | 0.03 |

Selector | Tournament |

Fitness scaling function | Rank |

Genetic algorithm performing detail . | Value/method . |
---|---|

Population type | Double vector |

Population size | 20 |

Generations | 30 |

Crossover | Single point |

Crossover fraction | 0.8 |

Mutator | Gaussian |

Mutation rate | 0.03 |

Selector | Tournament |

Fitness scaling function | Rank |

The GA method is universal and does not need to simplify the original problem or transfer to various solution spaces, which is more advantageous than the nonlinear programming technique.

### Integration of fuzzy set theory and GA method

The chlorine concentration and water age under uncertain hydraulic and water quality parameters were determined by the application of the fuzzy set theory. The membership functions of chlorine concentration and water age were obtained by incorporating the GA optimization method. The method integrating fuzzy set theory and GA method was developed by linking EPANET toolkit function in MATLAB environment. The hydraulic and water quality parameters including pipe roughness coefficients, chlorine bulk decay coefficients, and chlorine wall decay coefficients were considered to be fuzzy parameters with the trapezoidal distribution. The interval ranges of parameters corresponding to *α* = 0 are the widest, and the interval range of parameters corresponding to *α* = 1 is the narrowest.

The chlorine concentration and water age under fuzzy hydraulic and water quality parameters were determined by the optimization model, which is expressed by Equation (3) as follows.

*i*th node for a certain α-cut level, respectively, and refer to the minimum and maximum pipe roughness coefficients for a certain α-cut level, respectively, and refer to the minimum and maximum chlorine bulk decay coefficients, respectively, and as well as refer to the minimum and maximum chlorine wall decay coefficients, respectively. For each α-cut level, i.e., 0.0, 0.2, 0.4, 0.6, 0.8, and 1.0, the interval range of pipe roughness coefficients, chlorine bulk decay coefficients, and chlorine wall decay coefficients for each α-cut level is shown in Table 2, is flow to node

*i*, is flow out of node

*i*, and is nodal demand at node

*i*, is the algebraic sum of pressure loss in loop

*l*. Equations (3d) and (3f) can be satisfied by performing EPANET hydraulic simulation.

α
. | Roughness coefficients . | Chlorine bulk decay coefficients . | Chlorine wall decay coefficients . | |||
---|---|---|---|---|---|---|

0 | 110 | 130 | 0.60 | 2.00 | 0.10 | 0.90 |

0.2 | 111.6 | 128.4 | 0.68 | 1.90 | 0.17 | 0.83 |

0.4 | 113.2 | 126.8 | 0.76 | 1.80 | 0.24 | 0.76 |

0.6 | 114.8 | 125.2 | 0.84 | 1.70 | 0.31 | 0.69 |

0.8 | 116.4 | 123.6 | 0.92 | 1.60 | 0.38 | 0.62 |

1.0 | 118 | 122 | 1.00 | 1.50 | 0.45 | 0.55 |

α
. | Roughness coefficients . | Chlorine bulk decay coefficients . | Chlorine wall decay coefficients . | |||
---|---|---|---|---|---|---|

0 | 110 | 130 | 0.60 | 2.00 | 0.10 | 0.90 |

0.2 | 111.6 | 128.4 | 0.68 | 1.90 | 0.17 | 0.83 |

0.4 | 113.2 | 126.8 | 0.76 | 1.80 | 0.24 | 0.76 |

0.6 | 114.8 | 125.2 | 0.84 | 1.70 | 0.31 | 0.69 |

0.8 | 116.4 | 123.6 | 0.92 | 1.60 | 0.38 | 0.62 |

1.0 | 118 | 122 | 1.00 | 1.50 | 0.45 | 0.55 |

The minimum and maximum values of nodal chlorine concentration and water age can be obtained through EPANET toolkit functions in the MATLAB environment for each -cut level. As such, the trapezoidal distribution membership function of nodal chlorine concentration and water age can be plotted for each -cut level.

- 1.
Select a network and prepare the input file for the program code by calling EPANET toolkit.

- 2.
Define the lower and upper boundary values of pipe roughness coefficients, chlorine bulk decay coefficients, and chlorine wall decay coefficients for each -cut level.

- 3.
Run the hydraulic and water quality simulation by EPANET, and collect the simulation results through EPANET toolkit.

- 4.
Acquire the extreme values of output parameters by GA for each -cut level.

- 5.
Plot the distribution function of nodal chlorine concentration and nodal water ages, and compare the nodal fuzziness of chlorine concentrations and water ages.

## RESULTS AND DISCUSSION

The proposed method was applied to four WDSs, termed as Cases 1, 2, 3, and 4. Among them, Cases 1 and 2 are WDSs with a single source, and Cases 3 and 4 are WDSs with multiple sources, which are applied to illustrate the application of the method proposed in this paper.

### Case 1

The genetic algorithm parameters are taken in Table 1. The uncertain parameters of pipe roughness coefficients, chlorine bulk decay coefficients, and chlorine wall decay coefficients for each -cut level were set according to Table 2. By performing the GA method with a combination of fuzzy set analysis described in Section 2.3, the optimized nodal chlorine concentrations and nodal water ages were obtained at each α-cut level, and the *FM* values calculated by Equation (2) can also be obtained.

*α*, while the minimum values of nodal chlorine concentration have no linear relationship with values of

*α*, which is different from the relationship between pipe pressure/flow and values of

*α*(Wang & Zhu 2021b). The reason is that the relationship between nodal chlorine concentration and bulk decay coefficients as well as wall decay coefficients is an exponent relationship, not linear relationship, which leads to the variation regulation of nodal residual chlorine different from the variation regulation of uncertain parameters, especially for the minimum values of nodal chlorine concentration.

The normalized maximum and minimum values of chlorine concentration for nodes 8, 17, 22, and 29 at each -cut level are shown in Figure 4(c). The *FM* values for nodes 8, 17, 22, and 29 are 0.473, 0.501, 0.483, and 0.531, respectively, which indicates that the fuzziness of nodal chlorine concentrations decreased in the order of node 29 > node 17 > node 22 > node 8. The fuzziness of chlorine concentration has relationship with not only the distance between the source and the node, but also the demand of the node. For example, the base demand for node 8 and node 22 are 152.78 and 134.72 L/s, respectively. Although the distance between the source and node 8 is greater than the distance between the source and node 22, the base demand of node 8 is greater than node 22, which leads to the fuzziness of node 22 greater than node 8. The effect magnitudes of uncertain parameters increased with the distance between the source and the node, and decrease with the base demand of the node. As such, for nodes near source with shorter distance to the source and greater demands, the fuzziness of nodal chlorine concentration decreased, and for nodes at the far ends of WDS with longer distance to the source and less demands, the fuzziness of nodal chlorine concentration increased. The reason is that with the increase of the distance from the source to the node and the decrease of nodal demands, the residual time of chlorine became longer, and chlorine concentration decreased with the decay process in WDS. As such, the effects of uncertain parameters on chlorine concentration are more significant when chlorine concentration decreased.

The extreme values of water ages for nodes 8, 17, 22, and 29 at each α-cut level are shown in Figure 4(b). The nodal water ages at node 8, node 17, node 22, and node 29 remain at the same values of 0.583, 0.417, 0.417, and 0.500 h, respectively. The normalized maximum and minimum values of water ages for nodes 8, 17, 22, and 29 at each -cut level are shown in Figure 4(d). The *FM* values for nodes 8, 17, 22, and 29 are all 0.000, which indicated that water ages for nodes 8, 17, 22, and 29 have no fuzziness. The flows in Case 1 range from 134 to 1,200 L/s, which is relatively large and leads to the water ages remaining unchanged. The results indicated that the water ages in the pipe with larger flows are not affected by the fuzziness of roughness coefficients.

### Case 2

*et al.*1994) (shown in Figure 5).

*FM*values for nodes 3, 6, and 8 are 0.304, 0.441, and 0.465, respectively, which indicates that the fuzziness of chlorine concentration for node 8 is the most significant compared with nodes 3 and 6. The distances between the sources to nodes increase in the order of node 6 = node 8 > node 3, and the base demands of node 6 and node 8 are 10 and 6.5 L/s. The results indicated that the effect magnitudes of uncertain parameters increase with the distance between the source and the node and decrease with the base demand of the node. The reason is the same with Case 1.

The extreme values of water ages for nodes 3, 6, and 8 at each -cut level are shown in Figure 6(b). The nodal water ages at nodes 3, node 6, and node 8 vary to a maximum of 0.015, 0.035, and 0.023 h from the left end of the flat line for the α-cut level of 1.0, respectively, and vary to a maximum of 0.010, 0.016, and 0.015 h from the right end of the flat line, respectively. The variations of nodal water ages for nodes 3, 6, and 8 are 0.032, 0.065, and 0.046 h which indicated that the fuzziness of nodal water ages for node 6 is the most significant compared with node 3 and node 8. The maximum values of water ages have a negative correlation with values of *α*, while the minimum values of water ages have a positive correlation with values of *α*. The normalized maximum and minimum values of water ages for nodes 3, 6, and 8 at each -cut level are shown in Figure 6(d). The *FM* values for node 3, node 6, and node 8 are 0.054, 0.107, and 0.068, respectively, which also indicated that water ages at node 6 are fuzzier than at node 3 and node 8. Compared with Case 1, the fuzziness of nodal chlorine concentrations has no relationship with the fuzziness of nodal water ages. The reason is that the nodal chlorine concentrations and water ages are affected by two sources of the reservoir as well as tank. The effect magnitudes of uncertain parameters on water ages increase with the distance between the source and the node and increase with the base demand of the node. The reason is that with the increase of nodal demand and distance between the source and the node, the nodal water age is lengthened, which leads to the increase of fuzziness. Different from Case 1, the nodal water ages have trapezoid distributions under the effects of uncertain parameters. The reason is the nodal flow in Case 2 is less than that in Case 1. The results indicated that the nodal water age was affected by uncertain parameters in case of less flow.

### Case 3

*et al.*1987; Jung

*et al.*2014).

*FM*values for nodes 55, 70, 140, and 150 are 0.484, 0.153, 0.431, and 0.362, respectively, which indicates that the fuzziness of chlorine concentration for node 55 is the most significant compared with nodes 70, 140, and 150. The fuzziness of chlorine concentrations decreased in the order of node 55 > node 140 > node 150 > node 70. The results also indicated that the effect magnitudes of uncertain parameters on chlorine concentrations increase with the distance between the source and the node.

The extreme values of water ages for nodes 55, 70, 140, and 150 at each -cut level are shown in Figure 8(b). The water ages at nodes 55, 70, 140, and 150 vary to a maximum of 0.001, 0.000, 0.002, and 0.002 h from the left end of the flat line for α-cut level of 1.0, respectively, and vary to a maximum of 0.002, 0.000, 0.003, and 0.003 h from the right end of the flat line, respectively. The variations of water ages for nodes 55, 70, 140, and 150 are 0.005, 0.000, 0.005, and 0.005 h, which is difficult to compare the fuzziness of nodal water ages. Similar to Cases 1 and 2, the maximum values of water ages have a negative correlation with values of *α*, while the minimum values of water ages have a positive correlation with values of *α*. The normalized maximum and minimum values of water ages for nodes 55, 70, 140, and 150 at each -cut level are shown in Figure 8(d). The *FM* values for nodes 55, 70, 140, and 150 are 0.017, 0.000, 0.016, and 0.013, respectively, which indicated that the water ages at node 55 are fuzzier than node 140 and node 150, and the water age of node 70 has no fuzziness. The fuzziness of water ages decreased in the order of node 55 > node 140 > node 150 > node 70, which is the same order with the fuzziness of nodal chlorine concentrations. The results also indicated that the effect magnitudes of uncertain parameters on water ages increase with the distance between the source and the node, which is the same with the results obtained in Case 2.

### Case 4

*et al.*2018).

*α*is equal to 1 and when

*α*is equal to 0 are 18, 10, and 10 μg/L, respectively and vary to a maximum value of 208, 244, and 256 μg/L from the right end of the flat line, respectively. The variations of chlorine concentration for nodes 7, 45, and 48 are 25, 36, and 23 μg/L, which seems to indicate that the fuzziness of nodes decreased in the order of node 45 > node 7 > node 48. The normalized maximum and minimum values of chlorine concentration for nodes 7, 45, and 48 at each -cut level are shown in Figure 10(c). The

*FM*values for nodes 7, 45, and 48 are 0.451, 0.388, and 0.363 respectively, which indicates that the fuzziness of nodal chlorine concentrations decreased in the order of node 7 > node 45 > node 48. The fuzziness of chlorine concentration has relationship with not only the distance between the source and the node, but also the demand of the node. For example, the base demand for node 7 and node 45 are 1.86 and 3 L/s, respectively. Although the distance between the source and node 45 is greater than the distance between the source and node 7, the base demand of node 45 is greater than node 7, which leads to the fuzziness of node 7 greater than node 45. The effect magnitudes of uncertain parameters increased with the distance between the source and the node, and decrease with the base demand of the node.

The extreme values of water ages for nodes 7, 45, and 48 at each α-cut level are shown in Figure 10(b). The nodal water ages at nodes 7, node 45, and node 48 vary to a maximum of 0.876, 0.025, and 0.045 h from the left end of the flat line for α-cut level of 1.0, respectively, and vary to a maximum of 0.076, 0.096, and 0.010 h from the right end of the flat line, respectively. The normalized maximum and minimum values of water ages for nodes 7, 45, and 48 at each -cut level are shown in Figure 10(d). The *FM* values for node 7, node 45, and node 48 are 0.363, 0.441, and 0.443, respectively, which indicates that the fuzziness of nodal water ages decreased in the order of node 7 > node 45 > node 48, which is the same order with the fuzziness of nodal chlorine concentrations. The results also indicated that the effect magnitudes of uncertain parameters on water ages increase with the distance between the source and the node, which is the same as the results obtained in Case 2 and Case 3.

## CONCLUSION

In this paper, the method for analyzing the fuzziness of water quality indicators was proposed and applied to four WDSs with one or more sources. The nodal chlorine concentrations as well as water ages based on fuzzy roughness coefficients, chlorine bulk decay coefficients, and chlorine wall decay coefficients were analyzed. The fuzziness of nodal chlorine concentrations and water ages based on water quality simulation was analyzed by the *FM* values proposed. Generally, the maximum chlorine concentrations have negative relationships with *α* values, while the minimum chlorine concentrations have no positive relationship with *α* value, which indicated that the distribution of nodal chlorine concentration is not typical trapezoidal distribution as input parameters, i.e., the variation of the input parameters and chlorine concentration is not monotonous. However, the water ages follow trapezoidal distribution in most cases, i.e., the relationship between the input parameters and water ages is almost monotonous. In addition, for three sources in Case 3 and one source in Case 4, the chlorine concentrations decrease with the increase of water ages, and the nodal fuzziness order of chlorine concentrations is in accordance with the fuzziness order of nodal water ages. The chlorine concentration is mainly affected by bulk decay coefficients and wall decay coefficients, and water age is mainly affected by roughness coefficients. The effect magnitudes of uncertain parameters on chlorine concentration and water age increase with the distance between the source and the node. The effect magnitudes of uncertain parameters on chlorine concentration decrease with the nodal demands, while the effect magnitudes of uncertain parameters on water age increase with the nodal demands. The method proposed can be applied to analyze the fuzziness of nodal chlorine concentration and water age under uncertain input parameters. However, uncertain factors such as nodal demands, pipe diameters, etc., are not considered in this paper, while they do exist in real-life networks, which increases the complexity of analysis. In addition, the proposed fuzzy measure method should be applied to larger WDS with more pipes and nodes to verify its usefulness. Moreover, the dynamic variation of nodal chlorine and water age should be investigated in future research. The assumption of the trapezoidal distribution membership function can help managers to analyze the network under complex uncertainty conditions.

## ACKNOWLEDGEMENTS

This work was funded by the Natural Science Foundation of Jiangsu Province (Grant No. BK20191147). We also acknowledge the U.S. Environmental Protection Agency for supplying EPANET software freely downloaded on the website.

## DATA AVAILABILITY STATEMENT

All relevant data are included in the paper or its Supplementary Information.

## CONFLICT OF INTEREST

The authors declare there is no conflict.