Optimal Placement and Operation of Chlorine Booster Stations: A Multi-Level Optimization Approach

: Chlorine demand as a disinfectant for water utility impacts on unintended energy consumption from electrolysis manufacture; thus, diminishing the chlorine consumption also reduces the environmental impact and energy consumption. Problems of disinfectant distribution and uniformity in Water Distribution Networks (WDN) are associated with the exponential urban growth and the physical and biochemical difﬁculties within the network. This study optimizes Chlorine Booster Stations (CBS) location on a network with two main objectives; (1) to deliver minimal Free Residual Chlorine (FRC) throughout all demand nodes according to country regulations, and (2) to reduce day chlorine mass concentration supplied in the system by applying an hour time pattern in CBS, consequently associated economic, energy and environmental impacts complying with regulatory standards. The application is demonstrated on a real-world WDN modeled from Guanajuato, Mexico. The resulting optimal location and disinfectant dosage schedule in CBS provided insights on maintaining disinfectant residuals throughout all the WDN to prevent health issues and diminishing chlorine consumption.


Introduction
Water utilities properly treat water for common usage and in some cases for drinking. The practices of most water utilities in developing countries are to disinfect water with chlorine, due to the low cost and easy production [1][2][3][4][5]. Chlorination is the method at which water is disinfected from viruses and bacteria. This process occurs in the Drinking Water Treatment Plant (DWTP) and guarantees safe water until the last consumer node. The problem derived from chlorine decay over time due to WDN conditions which many of them does not count with Chlorine Booster Stations (CBS) a way of redistributing doses of disinfectant. Water utilities to supply the minimum Free Residual Chlorine (FRC) at the end of the WDN, add elevated doses of disinfectant at the exit of the DWTP [6]. Reducing chlorine demand from water utilities derives less chlorine manufacture and energy consumption, and a better perception from consumers in tap water safety improves

Materials and Methods
This paper describes reliable solutions for decision makers, finding the optimal location for CBS and correspondent scheduling applying Genetic Algorithms (GA) and Particle Swarm Optimization (PSO) techniques on Net Example 2 from EPANET, modified by Boccelli et al. (1998) to obtain a statistical result from optimization performance. This would represent an improvement in the water quality for customers due to a better distribution of disinfectant. Chlorine scheduling injection per hour is expected to reduce the total of chlorine mass injection in WDN. The objectives of Fitness Function (FF) are to (a) use the minimal number of CBS, (b) guarantee the minimal FRC in all consumer nodes, and (c) reduce the chlorine mass injection per day.

Bioinspired Algorithms
Nowadays, the evolution in technologies allows computers to respond with optimal solutions for emerging problems. The optimization problems try to choose the best solutions from a set of possible ones considering the point of view of programmer criteria and satisfying specific conditions and limitations [41]. Two different optimization models are used in this paper: GA and PSO as metaheuristics techniques most used in hydraulic issues [42][43][44][45][46][47]. Like many water utilities, CBS construction and infrastructure depends on economic restrictions for building or improving WDS; therefore, a few CBS are selected that can be built as an objective of the FF to supply the optimal distribution of Chlorine in all WDN and maintain safe drinking water. Optimization in WDS models has been developed with GA as partitioning WDS, in order to minimize the contamination impact [48] and scheduling of valves closure during contamination incidents [49], allowing a major understanding in the program process.

Genetic Algorithms (GA)
John Holland and collaborators developed GA at the Michigan University during 60's and 70's decades, representing possible solutions as individuals in binary strings [50][51][52]. Selective breeding begins with an empty population pool filled with random solutions in the range of possible values. GA selects (selection process) two parents from the population pool; these individuals are qualified (evaluation process) to solve the problem by FF. The better elements selected from the pool are copied for breeding. The breeding occurs while crossing them over dividing the individual strings at certain points and switching (crossover process), generating a pool of new individuals which could mutate an element of the individual string (mutation process). These form two children, which are added to the child population. This process is repeated until the child population is filled and in each generation selects the best individual to be reproduced with the FF [51,53]. GA represents a feasible model since it explores the problem without needing a complete mathematical model. GA's has been deeply studied in hydraulic issues [43][44][45][46] even nowadays, as well as the optimal use of chlorine applying CBS [54].

Particle Swarm Optimization (PSO)
The PSO belongs to bioinspired techniques of Artificial Intelligence; the optimization process is not modeled after evolution but after swarming and flocking behaviors in animals. PSO maintains a single static population whose members are tweaked in response to new discoveries about the space [53,55]. All the particles in the search space are rated, then the highest rated particle is selected; while the maximum iteration number or the error criteria is not attained for each particle, its velocity by Equation (1) and position by Equation (2) would be updated, until one of the conditions was accomplished [56]. PSO has been used in calibration, in water quality models searching the minimal errors applying diverse decay coefficients suggested by PSO [57], and in the energy optimization of water pumping systems [58]. V i (t + 1) = V i (t) + C 1 ×r 1 (P best − n i (b)) + C 2 ×r 2 g best − x i (t) (1)  where: Vi = Velocity of the particle C 1,2 = leaning factors g best = Global best position for the particle P best = Personal best r 1,2 = random values between [0, 1) where: t = time step.

Problem Formulation and Simulation Conditions
To achieve the objectives, the problem formulation is divided into two parts: 1.
Finding the most important CBS locations for guaranteeing supply safe water in all nodes with at least the minimal FRC of 0.2 mg/L in compliance with regulations.

2.
To determine the schedule pattern dosing to reduce the amount of chlorine per day, for reducing economic and environmental impact.
Both formulations consider safe water distribution with FRC upper 0.2 mg/L and lower than 4 mg/L. Two optimizing algorithms provided by the Matlab tool extensions are applied. The simulations are run in Matlab version R2017b for 64 bits systems and linked to the Toolkit of EPANET for Matlab [59]. The extension tools used for GA [60] and PSO [61] were run with default settings from Matlab and adapted boundaries to the setting problem of minimum and maximum chlorine concentrations. An FF proposition would be developed for both metaheuristics optimization techniques. The first hours of model simulation water distribution are not completed in the WDN because it takes time until the water arrives from the distribution point until the last node. Due to consumer patterns and incomplete mixing in Water Tanks, only the last 24 h of the complete simulation are considered to analyze FRC for all nodes.

Fitness Function (FF) Formulation
The first objective of the FF should be locating the CBS. The CBS set in EPANET Matlab Toolkit are assigned as Setpoint Booster Stations. GA and PSO would range in the floating rate of zero or maximum concentration, where zero represents a non-station and the maximum concentration represents a CBS with a fixed dosage. This is made to reduce computational efforts by diminishing solution variables, limiting whether the CBS benefits chlorine distribution in the WDS. It is intended to guarantee as many consumer nodes as possible with the minimal FRC, with the location of the new CBS.
The GA and PSO techniques require an evaluation where each scenario is qualified according to the objective. This grading could be any real number defined by the limits of the function.
The penalty in the Fitness Function for achieving the minimal FRC in all consumer nodes contemplates the sum of lags out Chlorine concentration allowed by regulation, i.e., if concentration (C) in the node (i) at the time (t) is lower than minimal FRC (0.2 mg/L), then is applied in Equation (3).
where: C (i,t) = concentration in the node (i) at the time (t) within last 24 h of simulation, Nn = number of nodes, t = simulation time step, T = last hour of simulation established, C min = minimal concentration by regulation presented in this study (0.2 mg/L), DEL (i,t) = matrix with the difference of concentration out of the regulation in each node on the last 24 h.
where: C max = maximal concentration by regulation presented in this paper (4.0 mg/L). Thus, if C min ≤ C (i,t) ≤ Cmax then DEL (i,t) = 0. Then, one obtains Finally, DEL represents the total sum of all values out of range in mg/L. Thus, a higher value in DEL represents the worst scenario in chlorine distribution. Additionally, the number of CBS are counted as (NE), initializing NE = 0 and then for all insteps if at the node i exist setpoint booster then NE = NE + 1, and FF1 is given by Equation (6) where: FF1 = Fitness Function, NE = Number of CBS estimated for each individual. Firstly, individuals for each optimization model are classified with parameters DEL and NE, so the best individual is that one that minimizes the number of CBS while guaranteeing the minimal FRC in all nodes. Secondly, once the locations of CBS is established, it is proposed that dosage injection of disinfectant would be reduced through a time pattern injection assignation. It is expected that significant reduction of chlorine consumption during the water treatment when applying hourly patterns in chlorine injection optimizes the distribution of FRC around all the WDS. GA and PSO are applied for obtaining the best hourly dosages. FF scheduling evaluates represented by DEL from the FF1 in Equation (6), supplied by the CBS, then with FF2 from Equation (8) the chlorine supply is assured with the least mass injected.
where TMI = sum of all chlorine mass injected on the WDN and converted to kg/day, Q CBS i = flow passing thru CBS in the node i at time t. CI CBS i = disinfectant mass added at disinfection location i at time t. Then: where FF2 = fitness function that seeks to reduce the chlorine mass injection but still guaranteeing FRC in the consumer nodes, TMI = total mass injected by CBS, it is obtained with the toolkit of EPANET for MATLAB and is properly adapted with flow units. The Same FF1 and FF2 are used for both GA and PSO optimization. Finally, the FF is an alternative way of a multi-objective optimization problem, where arbitrary multipliers between 0 and 1 are assigned as a percentage relevance for each objective in the multi-objective naive function. Additionally, the code is treated as a minimization problem, considering it is more relevant to comply with the FF1 than FF2.

Application of the Methodology
The previous methodology for optimizing the water quality with GA and PSO algorithms, considers distributing minimal required Free Residual Chlorine (FRC) throughout all consumer nodes, by using a CBS dosage hourly pattern. The Net Example 2 from EPANET (Case Study 1) is selected to obtain a statistical reference for taking a decision and in a real WDN from Mexico (Case Study 2) the selected algorithm will be implemented. The Case Study 1 applies the methodology presented for the Net Example 2 ( Figure 1) provided by the EPANET toolkit [62]. This is an existing network in the USA from the Cherry Hill-Brushy Plains and modified by [32]; while adding nodes (A-F), the WDN includes one water storage tank (node 26), one pumping station (node 1), 41 consumption nodes, and 46 pipes. For comparison with previous works, quality and hydraulic models like consumer and demand multipliers are considered as reported by [32], there are two pipeline diameters; 8 and 12 inches. The total length of WDN conforms 10.92 kms of pipelines. The bulk chlorine decay constant rate equals 0.5 d −1 while wall chlorine decay is zero as in previous studies. Additionally, for comparison the values of Minimal Chlorine Concentration of 0.2 mg/L and Maximal Chlorine Concentration of 4 mg/L according to the WDN regulations in the USA are used, the time simulation is 72 h, with 5 min for water quality time step, and 1 h for hydraulic time step [32].

Case Study 1
The Case Study 1 applies the methodology presented for the Net Example 2 ( Figure  1) provided by the EPANET toolkit [62]. This is an existing network in the USA from the Cherry Hill-Brushy Plains and modified by [32]; while adding nodes (A-F), the WDN includes one water storage tank (node 26), one pumping station (node 1), 41 consumption nodes, and 46 pipes. For comparison with previous works, quality and hydraulic models like consumer and demand multipliers are considered as reported by [32], there are two pipeline diameters; 8 and 12 inches. The total length of WDN conforms 10.92 kms of pipelines. The bulk chlorine decay constant rate equals 0.5 d −1 while wall chlorine decay is zero as in previous studies. Additionally, for comparison the values of Minimal Chlorine Concentration of 0.2 mg/L and Maximal Chlorine Concentration of 4 mg/L according to the WDN regulations in the USA are used, the time simulation is 72 h, with 5 min for water quality time step, and 1 h for hydraulic time step [32].

Case Study 2
The second WDN is from a location in Guanajuato, Mexico; this network supplies around 34 thousand people, with a mean water consumption of 33.88 L/s, and includes one tank of water distribution with minimum volume of 136 m 3 which is continuously filled (Figure 2). The distribution work by gravity flowing out from the DWTP (node RDTOT29) in the north-east of the city and ending at the south-west. The local Water Utility Plant provided the model. The pipelines material is mainly PVC and iron, the main pipeline has diameters between 6 to 24 inches, and the rest of pipes are between ¾ and 4 inches, the Hazen-Williams coefficient roughness is from 110 to 140 and the total length

Case Study 2
The second WDN is from a location in Guanajuato, Mexico; this network supplies around 34 thousand people, with a mean water consumption of 33.88 L/s, and includes one tank of water distribution with minimum volume of 136 m 3 which is continuously filled (Figure 2). The distribution work by gravity flowing out from the DWTP (node RDTOT29) in the north-east of the city and ending at the south-west. The local Water Utility Plant provided the model. The pipelines material is mainly PVC and iron, the main pipeline has diameters between 6 to 24 inches, and the rest of pipes are between 3 4 and 4 inches, the Hazen-Williams coefficient roughness is from 110 to 140 and the total length pipes is  30.84 kms. The water is supplied from a dam upstream of the city and the DWTP is located near the city, where the disinfection process uses gas chlorine as pre-and post-treatment.
Energies 2021, 14, x FOR PEER REVIEW 7 of 24 pipes is 30.84 kms. The water is supplied from a dam upstream of the city and the DWTP is located near the city, where the disinfection process uses gas chlorine as pre-and posttreatment. The water demand in the tank (north-east) is identified by the pattern shown in (Figure 3). It is observed that consumption starts to decrease after 22 h, arriving to the lower demand at 4 in the morning; at 6 am it starts to increase and demand over the mean consumption starts at 7 am until 23 pm with the highest demand at midday.  The water demand in the tank (north-east) is identified by the pattern shown in (Figure 3). It is observed that consumption starts to decrease after 22 h, arriving to the lower demand at 4 in the morning; at 6 am it starts to increase and demand over the mean consumption starts at 7 am until 23 pm with the highest demand at midday. pipes is 30.84 kms. The water is supplied from a dam upstream of the city and the DWTP is located near the city, where the disinfection process uses gas chlorine as pre-and posttreatment. The water demand in the tank (north-east) is identified by the pattern shown in (Figure 3). It is observed that consumption starts to decrease after 22 h, arriving to the lower demand at 4 in the morning; at 6 am it starts to increase and demand over the mean consumption starts at 7 am until 23 pm with the highest demand at midday.   Originally, it applied an average chlorine concentration of 1.2 mg/L on the node RDTOT29, considered a CBS for modelling purposes. The viability of locating more CBS throughout the network will be studied, which would help distribute the chlorine uniformly according to the local and international organizations recommendations to reduce the total dosage per day.
The WDN provided was hydraulically calibrated by a previous simulation to obtain the quality parameters, such as Bulk Decay and Wall Decay coefficients; studies points out the variability in TTHM'S production associated with season changes such as temperature and organic and inorganic materials present from the source [63,64]. Thus, the quality model was simulated by 288 h to stabilize the mixing conditions at the tank and obtain steady state conditions for the quality parameters. The calibrated model shows high dose chlorine injection in the DWTP and how chlorine behaves along with the network (Figure 4). Chlorine might cause organoleptic discomfort to the population near this point because of the smell and the taste; according to a study from Bangladesh, the chlorine taste in tap water was acceptable up to 1.25 mg/L FRC and they were willing to drink because of the safety perception under 2.0 mg/L FRC [65,66]. Initial conditions have a mean deviation for FRC in the last 24 h of 0.042 mg/L and a DEL = 340.29 mg/L, using CBS after the node RDTOT29 with a dosage of 14,462 g/d. The Bulk Decay Coefficient is set with 2.04 d −1 and it has different values of Wall Decay Coefficient with a minimal and maximal of 0.02 and 1.5 m/d, respectively. Originally, it applied an average chlorine concentration of 1.2 mg/L on the node RDTOT29, considered a CBS for modelling purposes. The viability of locating more CBS throughout the network will be studied, which would help distribute the chlorine uniformly according to the local and international organizations recommendations to reduce the total dosage per day.
The WDN provided was hydraulically calibrated by a previous simulation to obtain the quality parameters, such as Bulk Decay and Wall Decay coefficients; studies points out the variability in TTHM'S production associated with season changes such as temperature and organic and inorganic materials present from the source [63,64]. Thus, the quality model was simulated by 288 h to stabilize the mixing conditions at the tank and obtain steady state conditions for the quality parameters. The calibrated model shows high dose chlorine injection in the DWTP and how chlorine behaves along with the network ( Figure  4). Chlorine might cause organoleptic discomfort to the population near this point because of the smell and the taste; according to a study from Bangladesh, the chlorine taste in tap water was acceptable up to 1.25 mg/L FRC and they were willing to drink because of the safety perception under 2.0 mg/L FRC [65,66]. Initial conditions have a mean deviation for

Results
The evaluations for robustness validation in Case Study 1 were made using PSO and GA with the number of CBS that water utilities can build, considered to be two. Evaluation performances are shown in statistical analysis within 100 simulations. CBS represents the number of boosters stations proposed by the algorithm. CBS simulation reached represents the number of times which that number of CBS was proposed during the 100 simulations. Finally, CBS ID represents the name associated with the node where CBS is proposed.

Statistical Results from GA Location for Case Study 1
For robustness validation of the optimization process, 100 GA simulations were performed. The results showed that 49% of 100 simulations made by GA guaranteed the minimal FRC in all nodes. The best locations for CBS are presented in Table 1. It is considered that the most important CBS is located at node 1 with 100% of the simulations proposing a CBS in that node. The second node, proposed by GA to establish a CBS, was the water supply tank in node 26, with 72% of frequency. Other nodes appeared and a result from

Results
The evaluations for robustness validation in Case Study 1 were made using PSO and GA with the number of CBS that water utilities can build, considered to be two. Evaluation performances are shown in statistical analysis within 100 simulations. CBS represents the number of boosters stations proposed by the algorithm. CBS simulation reached represents the number of times which that number of CBS was proposed during the 100 simulations. Finally, CBS ID represents the name associated with the node where CBS is proposed.

Statistical Results from GA Location for Case Study 1
For robustness validation of the optimization process, 100 GA simulations were performed. The results showed that 49% of 100 simulations made by GA guaranteed the minimal FRC in all nodes. The best locations for CBS are presented in Table 1. It is considered that the most important CBS is located at node 1 with 100% of the simulations proposing a CBS in that node. The second node, proposed by GA to establish a CBS, was the water supply tank in node 26, with 72% of frequency. Other nodes appeared and a result from the usage of 3 or more CBS associated with nodes 14 and 29 and the remaining nodes were dismissed because of their low frequency.

Statistical Results from PSO location for the Case Study 1
From PSO simulation was obtained 100 simulations to obtain the best locations for CBS ( Table 2). Results have shown higher frequency at the pump station, corresponding to node 1 and the tank, and the others were dismissed due to their low frequency ( Figure 5).

Statistical Results from PSO location for the Case Study 1
From PSO simulation was obtained 100 simulations to obtain the best locatio CBS ( Table 2). Results have shown higher frequency at the pump station, correspo to node 1 and the tank, and the others were dismissed due to their low frequency (F 5).   Then, the best and worst individuals are reported by the frequency of CBS ID. It is considered the best individual from the 100 simulations with no penalty in the FF and FRC higher than 0.2 mg/L for all consumer nodes. Thus, the best individual has the FF nearer to the value of one. The individuals with the lower penalty reported CBS location in node 1 (proposed by 100% of simulations) and Water Distribution Tank (proposed by 67% of the simulations). As the main objective was to find the best location for guaranteeing the minimal FRC above all the consumer nodes concentrations, zero or one were selected for representing whether there is chlorine injection in the node or not during the string coding in GA. The optimization algorithm in default settings that worked better on these 100 simulations was PSO.

Scheduling in CBS Results from GA and PSO
The best location was obtained previously for CBS in Net Example 2. This step aims to determine the schedule pattern dosing to reduce the amount of chlorine per day, thus reducing the economic and environmental impact from water utilities applying the FF2. The optimization consisted in adding hourly multipliers in patterns assigned to the CBS previously selected or presented in the WDN. The patterns are considered by 24 h and if the simulation is larger, then the cycle is repeated. The initial concentration of CBS is considered to be 1 mg/L, so the multiplier would range between regulation values until maintaining the FRC in all consumer nodes and reducing the total dosage of chlorine per day. Thus, those patterns with the lowest dosage per day and the minimal penalty for the tank in Figure 6. The upper boundary is considered as the maximum chlorine allowed of 4 mg/L and a minimal of 0.2 mg/L, inducing multipliers between those values.
Energies 2021, 14, x FOR PEER REVIEW 10 of 24 FRC higher than 0.2 mg/L for all consumer nodes. Thus, the best individual has the FF nearer to the value of one. The individuals with the lower penalty reported CBS location in node 1 (proposed by 100% of simulations) and Water Distribution Tank (proposed by 67% of the simulations). As the main objective was to find the best location for guaranteeing the minimal FRC above all the consumer nodes concentrations, zero or one were selected for representing whether there is chlorine injection in the node or not during the string coding in GA. The optimization algorithm in default settings that worked better on these 100 simulations was PSO.

Scheduling in CBS Results from GA and PSO
The best location was obtained previously for CBS in Net Example 2. This step aims to determine the schedule pattern dosing to reduce the amount of chlorine per day, thus reducing the economic and environmental impact from water utilities applying the FF2. The optimization consisted in adding hourly multipliers in patterns assigned to the CBS previously selected or presented in the WDN. The patterns are considered by 24 h and if the simulation is larger, then the cycle is repeated. The initial concentration of CBS is considered to be 1 mg/L, so the multiplier would range between regulation values until maintaining the FRC in all consumer nodes and reducing the total dosage of chlorine per day. Thus, those patterns with the lowest dosage per day and the minimal penalty for the tank in Figure 6. The upper boundary is considered as the maximum chlorine allowed of 4 mg/L and a minimal of 0.2 mg/L, inducing multipliers between those values. The statistical analysis of scheduling the concentrations in the CBS from the GA shows an average DEL of 0.42 mg/L for 100 simulations and 73% of the simulations reduced the penalty to zero, and only 14% were greater than the average value of the penalty. The best values are obtained in simulation 32 with a zero-penalty value and the lower dosage per day of 1762.75 mg/L. As node 1 works as a pump station, a pattern is assigned (Figure 7), and the injection in WDN from 6 to 12 h and from 17 to 24 h are dismissed because the pump does not supply water in these hours thus chemical neither. The consideration is that at those hours water is distributed from the tank and not from the pump. The statistical analysis of scheduling the concentrations in the CBS from the GA shows an average DEL of 0.42 mg/L for 100 simulations and 73% of the simulations reduced the penalty to zero, and only 14% were greater than the average value of the penalty. The best values are obtained in simulation 32 with a zero-penalty value and the lower dosage per day of 1762.75 mg/L. As node 1 works as a pump station, a pattern is assigned (Figure 7), and the injection in WDN from 6 to 12 h and from 17 to 24 h are dismissed because the pump does not supply water in these hours thus chemical neither. The consideration is that at those hours water is distributed from the tank and not from the pump. Considering the same procedure, the scheduling in CBS results from PSO shows in the statistical analysis of 100 simulations for PSO that 100% of the simulations reduced the penalty to zero. Therefore, the best value focuses on such individuals that dose the minimal mass of chlorine per day, or with zero-penalty value, and the lower dosage of 1279 g/day was founded in the simulation number 27. As the node 1 works as a pump station, an hourly pattern was assigned and there is no chlorine injection to the WDN from 6 to 12 and from 18 to 24 h.
Both cases use two CBS obtained by solutions from GA and PSO, respectively. This condition guaranteed the minimal concentration of FRC in the scenario of the last 24 h. Figure 8 shows chlorine distribution at hour 72 of simulation, which is considered for dismissing initial water quality conditions and mixing tank effects [36]. Both results obtained a full coverage with at least 0.2 mg/L. It was observed that PSO proposes lower concentrations of chlorine (total injected chlorine at 1279.00 g/day while Considering the same procedure, the scheduling in CBS results from PSO shows in the statistical analysis of 100 simulations for PSO that 100% of the simulations reduced the penalty to zero. Therefore, the best value focuses on such individuals that dose the minimal mass of chlorine per day, or with zero-penalty value, and the lower dosage of 1279 g/day was founded in the simulation number 27. As the node 1 works as a pump station, an hourly pattern was assigned and there is no chlorine injection to the WDN from 6 to 12 and from 18 to 24 h.
Both cases use two CBS obtained by solutions from GA and PSO, respectively. This condition guaranteed the minimal concentration of FRC in the scenario of the last 24 h. Figure 8 shows chlorine distribution at hour 72 of simulation, which is considered for dismissing initial water quality conditions and mixing tank effects [36]. Considering the same procedure, the scheduling in CBS results from PSO shows in the statistical analysis of 100 simulations for PSO that 100% of the simulations reduced the penalty to zero. Therefore, the best value focuses on such individuals that dose the minimal mass of chlorine per day, or with zero-penalty value, and the lower dosage of 1279 g/day was founded in the simulation number 27. As the node 1 works as a pump station, an hourly pattern was assigned and there is no chlorine injection to the WDN from 6 to 12 and from 18 to 24 h.
Both cases use two CBS obtained by solutions from GA and PSO, respectively. This condition guaranteed the minimal concentration of FRC in the scenario of the last 24 h. Figure 8 shows chlorine distribution at hour 72 of simulation, which is considered for dismissing initial water quality conditions and mixing tank effects [36]. Both results obtained a full coverage with at least 0.2 mg/L. It was observed that PSO proposes lower concentrations of chlorine (total injected chlorine at 1279.00 g/day while Both results obtained a full coverage with at least 0.2 mg/L. It was observed that PSO proposes lower concentrations of chlorine (total injected chlorine at 1279.00 g/day while GA maintains higher concentrations (total injected chlorine at 1762.75 g/day. Additionally, while GA have the higher concentration of chlorine injection, this has the lower standard deviation of FRC among the network nodes (Table 3). The results of FRC for the last 24 h of simulation for each optimization program showed that GA for most parts of the day remained between the values of 0.25 and 0.8 mg/L (Figure 9a), while PSO obtained 75% of values equal or lower of 0.6 mg/L (Figure 9b), plot interpretation can be made with Figure 10. Therefore, PSO represents a minor concentration of FRC but still guarantees regulated values, which would help reduce corrosion in pipelines and reduce the TTHM's formations. Both algorithms can solve the problem through trial and error, however the current methodology does not allow parallel processing and as consequence needs more time and computational resources for getting the final solution.
Energies 2021, 14, x FOR PEER REVIEW 12 of 24 GA maintains higher concentrations (total injected chlorine at 1762.75 g/day. Additionally, while GA have the higher concentration of chlorine injection, this has the lower standard deviation of FRC among the network nodes (Table 3). The results of FRC for the last 24 h of simulation for each optimization program showed that GA for most parts of the day remained between the values of 0.25 and 0.8 mg/L (Figure 9a), while PSO obtained 75% of values equal or lower of 0.6 mg/L ( Figure  9b), plot interpretation can be made with Figure 10. Therefore, PSO represents a minor concentration of FRC but still guarantees regulated values, which would help reduce corrosion in pipelines and reduce the TTHM's formations. Both algorithms can solve the problem through trial and error, however the current methodology does not allow parallel processing and as consequence needs more time and computational resources for getting the final solution.
(a)  GA results show that even if the concentration injected per day is minimized, nodes; 30, 34 and 36 (Figures 1 and 9a), which are farther from the initial distribution point, reach the minimal FRC. In the same way, the FRC concentration in those nodes guarantees the minimal concentration obtained by the method PSO in the last 24 h of simulation ( Figure  9b). FRC analysis from nodes 30, 34 and 36 is presented in Figure 11a-c, respectively.  GA results show that even if the concentration injected p 30, 34 and 36 (Figures 1 and 9a), which are farther from the ini the minimal FRC. In the same way, the FRC concentration in  GA results show that even if the concentration injected per day is minimized, nodes; 30, 34 and 36 (Figures 1 and 9a), which are farther from the initial distribution point, reach the minimal FRC. In the same way, the FRC concentration in those nodes guarantees the minimal concentration obtained by the method PSO in the last 24 h of simulation (Figure 9b). FRC analysis from nodes 30, 34 and 36 is presented in Figure 11a-c, respectively.

CBS Location and Dosage Results for the Case 1
Multiple analyses were simulated through two different optimization models (GA, PSO). Solutions showed by the optimization models selected the best location for two CBS is near the principal water sources as the pump station in node 1 and node 26 (Water Supply Tank).
Finally, the total mass injected by the CBS obtained with GA and PSO is calculated and compared with those described in the literature review (Table 4). It can be observed that the total dosage of chlorine injected per day is 1279 g/day for PSO even if the injection patterns are higher at some hours. Additionally, PSO obtained a value of 66 g/day difference with the minimal dosage obtained from Hybrid optimization with solver Harmony Search. As the results of evaluations show that PSO obtained the significant number of feasible solutions in the optimization model for CBS location and scheduling pattern chlorine injection. Table 4. Comparison of the total mass injected by the CBS obtained with GA and PSO with those described in the literature review for Case 1.

Author and Year
Optimization Technique Selected Nodes

Mean Dosage (mg/L) Total Dosage (g/day)
This paper GA (Case study 1)

CBS Location and Dosage Results for the Case 1
Multiple analyses were simulated through two different optimization models (GA, PSO). Solutions showed by the optimization models selected the best location for two CBS is near the principal water sources as the pump station in node 1 and node 26 (Water Supply Tank).
Finally, the total mass injected by the CBS obtained with GA and PSO is calculated and compared with those described in the literature review (Table 4). It can be observed that the total dosage of chlorine injected per day is 1279 g/day for PSO even if the injection patterns are higher at some hours. Additionally, PSO obtained a value of 66 g/day difference with the minimal dosage obtained from Hybrid optimization with solver Harmony Search. As the results of evaluations show that PSO obtained the significant number of feasible solutions in the optimization model for CBS location and scheduling pattern chlorine injection. Table 4. Comparison of the total mass injected by the CBS obtained with GA and PSO with those described in the literature review for Case 1.

Author and Year
Optimization Technique

CBS Location Results for the WDN "SF812" in Case Study 2
The WDN "SF812" was evaluated with PSO since previous analysis showed it is more efficient with default settings in the Optimization Matlab Toolkit. It achieved 100% minimal FRC coverage and 71% achieved the goal of established a CBS number decision, which guarantee a reliable solution.
The optimization of chlorine concentration was made considering the CBS location after a time simulation of 232 h. Results proposed 4 CBS in the WDN: RDTOT4045, RD-TOT4046, RDTOT4051, RDTOT4052 and a CBS located after the DWTP, in node RDTOT29 ( Figure 12). The minimal distance between the nearer CBS is 9.45 m, meaning the more distant is 64.77 m from each other in this group of CBS. The concentration supplied by each node is the maximum allowed of 4 mg/L in each CBS, which could be due to the severe conditions of chlorine decay in the WDN. The CBS locations are in the southwest of the WDN, which represents more than half of the way until the last node supplied by the tank since the sector after this area has the higher quality problems in the WDN.

CBS Location Results for the WDN "SF812" in Case Study 2
The WDN "SF812" was evaluated with PSO since previous analysis showed it is more efficient with default settings in the Optimization Matlab Toolkit. It achieved 100% minimal FRC coverage and 71% achieved the goal of established a CBS number decision, which guarantee a reliable solution.
The optimization of chlorine concentration was made considering the CBS location after a time simulation of 232 h. Results proposed 4 CBS in the WDN: RDTOT4045, RDTOT4046, RDTOT4051, RDTOT4052 and a CBS located after the DWTP, in node RDTOT29 ( Figure 12). The minimal distance between the nearer CBS is 9.45 m, meaning the more distant is 64.77 m from each other in this group of CBS. The concentration supplied by each node is the maximum allowed of 4 mg/L in each CBS, which could be due to the severe conditions of chlorine decay in the WDN. The CBS locations are in the southwest of the WDN, which represents more than half of the way until the last node supplied by the tank since the sector after this area has the higher quality problems in the WDN.  Figure 13 shows the chlorine distribution at hour 288 of simulation, with non-scheduled CBS with 4.0 mg/L at each one, a coverage in all consumer nodes with minimal FRC, except (1) the source, which is before the chlorine station, and (2) node RDTOT51 which closes sector with a valve in that point.  Figure 13 shows the chlorine distribution at hour 288 of simulation, with non-scheduled CBS with 4.0 mg/L at each one, a coverage in all consumer nodes with minimal FRC, except (1) the source, which is before the chlorine station, and (2) node RDTOT51 which closes sector with a valve in that point. The proposal of scheduling with PSO ( Figure 14) received a penalty DEL = 5.33 mg/ and a total chlorine injection in the net of 21,912.82 g/day. This increment in the chlorin injection is because of the increment in the range of chlorine injection, and the objective o covering all consumer nodes with minimal FRC, the mean standard deviation is 0.04 mg/L, in the last 24 h for all nodes, and non-consumer nodes with base demand of zer were dismissed. As shown in Figure 14, node RDTOT29 distributes chlorine 24 h per da while auxiliary CBS focuses on distributing chlorine during the night period. This hap pens because during the night consumers are sleeping, and the water remains in the pip system, so the water is mainly taken from the pipelines rather than the tank.  The proposal of scheduling with PSO ( Figure 14) received a penalty DEL = 5.33 mg/L and a total chlorine injection in the net of 21,912.82 g/day. This increment in the chlorine injection is because of the increment in the range of chlorine injection, and the objective of covering all consumer nodes with minimal FRC, the mean standard deviation is 0.042 mg/L, in the last 24 h for all nodes, and non-consumer nodes with base demand of zero were dismissed. As shown in Figure 14, node RDTOT29 distributes chlorine 24 h per day while auxiliary CBS focuses on distributing chlorine during the night period. This happens because during the night consumers are sleeping, and the water remains in the pipe system, so the water is mainly taken from the pipelines rather than the tank. The proposal of scheduling with PSO ( Figure 14) received a penalty DEL = 5.33 mg/L and a total chlorine injection in the net of 21,912.82 g/day. This increment in the chlorine injection is because of the increment in the range of chlorine injection, and the objective of covering all consumer nodes with minimal FRC, the mean standard deviation is 0.042 mg/L, in the last 24 h for all nodes, and non-consumer nodes with base demand of zero were dismissed. As shown in Figure 14, node RDTOT29 distributes chlorine 24 h per day while auxiliary CBS focuses on distributing chlorine during the night period. This happens because during the night consumers are sleeping, and the water remains in the pipe system, so the water is mainly taken from the pipelines rather than the tank.  Then, to obey local regulations from Mexico [67], chlorine limit ranges are proposed between 0.2 and 1.5 mg/L for scheduling simulations in Figure 15. Thus, multipliers patterns are assigned to hourly distribution to the initial injection of 1 mg/L. Results show a dosage injection of 14.52 kg/day of chlorine mass, and DEL = 57.85 mg/L. In the chlorination pattern, it can be observed that the quantity of chlorine that can be injected most of the time in RDTOT29 was reduced, and auxiliary CBS works at the top amount of chlorine allowed. This is due to severe conditions in the network associated with chlorine decay coefficients. Then, to obey local regulations from Mexico [67], chlorine limit ranges are proposed between 0.2 and 1.5 mg/L for scheduling simulations in Figure 15. Thus, multipliers patterns are assigned to hourly distribution to the initial injection of 1 mg/L. Results show a dosage injection of 14.52 kg/day of chlorine mass, and DEL = 57.85 mg/L. In the chlorination pattern, it can be observed that the quantity of chlorine that can be injected most of the time in RDTOT29 was reduced, and auxiliary CBS works at the top amount of chlorine allowed. This is due to severe conditions in the network associated with chlorine decay coefficients.  Figure 16 shows the contour plot of time statistical mean FRC applied from the pattern in CBS, as shown in Figure 15. As the network remains between FRC Mexican regulations, some points at the end (south-east) of the network which do not comply with the minimum values. Thus, critical nodes are presented (Table 5) and evaluated. These nodes were selected due to their characteristics as elevation, position, and flow velocity from the nearest link.  Figure 16 shows the contour plot of time statistical mean FRC applied from the pattern in CBS, as shown in Figure 15. As the network remains between FRC Mexican regulations, some points at the end (south-east) of the network which do not comply with the minimum values. Thus, critical nodes are presented (Table 5) and evaluated. These nodes were selected due to their characteristics as elevation, position, and flow velocity from the nearest link. The obtained results from the pattern limit injection between 0.2 and 1.5 did not guarantee the minimum FRC required in the net due to severe conditions of the network as topography and initial water conditions. However, the application represents a significant improvement to the initial conditions of the network, maintaining a mean FRC of 0.71 mg/L, as well from the total simulation time guaranteed the nodes the FRC upper 0.2 mg/L in 95.85%, as we can see in statistical results (Table 6). From nodes DQ238 and QD106 where box and whiskers plot for critical nodes (Figure 17) minimal FRC could not be obtained; most problems are related to uneven surfaces and low demand, which translates into longtime water stagnation in pipes and CBS would not be a feasible solution. Implementation of CBS in the WDN improves the water quality with a better chlorine distribution and, as a collateral effect, diminishes the risk of disinfection by-product formation.  The obtained results from the pattern limit injection between 0.2 and 1.5 did not guarantee the minimum FRC required in the net due to severe conditions of the network as topography and initial water conditions. However, the application represents a significant improvement to the initial conditions of the network, maintaining a mean FRC of 0.71 mg/L, as well from the total simulation time guaranteed the nodes the FRC upper 0.2 mg/L in 95.85%, as we can see in statistical results (Table 6). From nodes DQ238 and QD106 where box and whiskers plot for critical nodes (Figure 17) minimal FRC could not be obtained; most problems are related to uneven surfaces and low demand, which translates into long-time water stagnation in pipes and CBS would not be a feasible solution. Implementation of CBS in the WDN improves the water quality with a better chlorine distribution and, as a collateral effect, diminishes the risk of disinfection by-product formation.

Discussion and Conclusions
Results of the optimization in case study 1 were compared amongst other literature reviews, thus validating the effectiveness of the fitness function implemented. A reduction of chlorine mass injection was observed. Therefore, the consumption of energy and environmental impact is also reduced as a consequence of a lower consumption and production of chlorine disinfectant. For Case study 2, due to the severe conditions associated with topography, consumer patterns from their floating population, and chlorine decay coefficients, it highlights the need for continuous monitoring points to have total certainty

Discussion and Conclusions
Results of the optimization in case study 1 were compared amongst other literature reviews, thus validating the effectiveness of the fitness function implemented. A reduction of chlorine mass injection was observed. Therefore, the consumption of energy and environmental impact is also reduced as a consequence of a lower consumption and production of chlorine disinfectant. For Case study 2, due to the severe conditions associated with topography, consumer patterns from their floating population, and chlorine decay coefficients, it highlights the need for continuous monitoring points to have total certainty of the model and the need of CBS for better chlorine distribution.
This investigation demonstrated that multi-objective formulation applied in GA and PSO can propose an efficient methodology for CBS locations to guarantee minimal FRC in all nodes (healthy objective) and the minimal number of CBS with the minimal chlorine dosage per day as well (economic and environmental objective). In this case, the trustworthy optimization model was the PSO, which reached coverture in all simulations and the objective of minimal FRC compared with GA, which only 49% of simulated results guaranteeing the minimal FRC in both case studies. Optimizing in two steps seems to be more efficient in the reduction of search space, and variables.
The CBS proposal in Case study 1 guaranteed the minimum FRC for all nodes. It is observed that the use of injection patterns by hour diminish the dosage occurring per day, therefore reducing the health and environmental impact associated with manufacturing and consumption. Chlorine injection patterns show peaks associated with hydraulic consumption patterns and still guaranteeing associated regulations.
The WDN called "Sector 8-12" in Mexico represents a challenge for the local water utility due to the high levels of bulk and wall chlorine decay coefficients. Thus, the algorithm proposes locations for CBS where the disinfectant can be distributed over all consumer nodes with the minimal Free Residual Chlorine. The use of Chlorine Boosters in the network helps to disinfect water over time and chlorine consumption, representing savings for the local water operator and reducing the risk of corrosion in metal pipes, as well as the formation of by-products. On the other hand, reduction of chlorine mass consumption was not achieved. The implementation of time series for chlorine booster stations represents a better solution within both algorithms used in the present work for better chlorine distribution.
Improving water quality on water distribution systems strengthens the confidence of consumers. Thus, the consumption of tap water increases while consumption of bottled water decreases, reducing the environmental impact.
Difficulties presented during the project were mainly caused because the lack of information in Case study 2, future related studies should point at the Internet of Things (IoT) as a tool for improving water distribution systems, and cost benefit analysis considering environmental impact on the use of Chlorine Boosters.