The Optimization of Energy Recovery Device Sizes and Locations in Municipal Water Distribution Systems during Extended-Period Simulation

Excess pressure within water distribution systems not only increases the risk for water losses through leakages but provides the potential for harnessing excess energy through the installation of energy recovery devices, such as turbines or pump-as-turbines. The effect of pressure management on leakage reduction in a system has been well documented, and the potential for pressure management through energy recovery devices has seen a growth in popularity over the past decade. Over the past 2 years, the effect of energy recovery on leakage reduction has started to enter the conversation. With the theoretical potential known, researchers have started to focus on the location of energy recovery devices within water supply and distribution systems and the optimization thereof in terms of specific installation objectives. Due to the instrumental role that both the operating pressure and flow rate plays on both leakage and potential energy, daily variation and fluctuations of these parameters have great influence on the potential energy recovery and subsequent leakage reduction within a water distribution system. This paper presents an enhanced optimization procedure, which incorporates user-defined weighted importance of specific objectives and extended-period simulations into a genetic algorithm, to identify the optimum size and location of potential installations for energy recovery and leakage reduction. The proposed procedure proved to be effective in identifying more cost-effective and realistic solutions when compared to the procedure proposed in the literature.


Introduction
Two of the main concerns in water industry, including municipal water supply systems, are the reduction of water leakages and the reduction of energy consumption within the system. Besides being an environmental and sustainability issue, water leakage in a pipeline is also an economic and energy efficiency issue [1].
Sustainable development in general and more specifically within the field of water supply has been widely discussed and researched. It gained popularity and interest within the setting of the United Nations Sustainability Goals in 2015. Among others, the results of sustainable development in water systems are related to the improvement and the use of new technologies to maximize efficiency in water management [2].
Bonthuys et al. [19] firstly followed a conservative approach in analyzing the average operating pressure in the system and applying the developed GA procedure to the time step or steady state with the lowest average operating pressure. The rationale behind this approach was that the excess energy available at the time step with the lowest average operating pressure will always be available and the energy recovery devices can be sized according to this value. Secondly, Bonthuys et al. [19] applied the GA to the time step with the highest average operating pressure and theoretically the highest potential for leakage reduction but then possibly the lowest potential for energy recovery. The rationale followed by Bonthuys et al. [19] is conservative as it does not optimize the energy recovery and leakage reduction potential within the system fully in the dynamic condition. However, the dynamic variation of the network demand has an impact on the level of service, and it should be considered in an optimization procedure.
This paper took into account the time-dependent and demand-driven nature of flow and pressure and developed a procedure for the optimization of energy recovery and leakage reduction in municipal water distribution systems over an extended-period simulation. Extended-period simulation (EPS) is a series of steady-state runs performed for multiple time steps. The EPS rationale was incorporated into the development of an update for the PERRL for the optimization of energy recovery and leakage reduction through the implementation of hydro-turbines, as energy recovery devices.

Hydraulics of Networks and Extended-Period Simulation for Municipal Water Distribution Systems
The most important consideration for the successful operation of water distribution networks is planning to ensure adequate levels of service at all consumptive nodes within the system under varying conditions of loading. There are various criteria to determine the level of service, of which the maintaining of prescribed residual pressures is a critical one. From an operations point of view, the impact of varying the networks demands on the level of service needs to be known. Such knowledge assists in the development of system control to maintain the level of service [21], e.g., pressure management through PRVs or energy recovery devices, such as hydro-turbines.
The hydraulics of a water supply/distribution system required to model the relationship between flow and pressure within the system are non-linear. The distribution of flow depends on the known inputs and consumptions at all consumptive nodes, the geometry of the pipes, and the topography of the network [22]. For a stable state of flow within a network, both the laws on conservation of mass and conservation of energy must be satisfied. In theory, a network will have an infinite number of flow distributions that satisfy the conservation of mass but only one that satisfies the conservation of energy at any given time for all closed loops within the pipe network [22]. To model this type of network, three methods are mainly used: Hardy Cross (loop method), nodal method, or Newton-Raphson.
The Hardy Cross method uses the linear relation between the increment of flow and the increment of pressure for a given quantity of flow. For large increments, a possibility of error exists within this linear relation. Hardy Cross is an iterative method, which makes use of successive corrections until the error is insignificantly small or reaches a predefined value determined by the user.
The nodal method was first introduced by Cornish [23] and comprises of a set of headloss equations only. It is applied to loop networks where the external heads are known and the heads within the networks are required. The nodal method, similar to Hardy Cross, is an iterative method where heads at the junctions within the looped network are assumed. Flows are subsequently calculated from the headloss equations. A correction factor is applied to the assumed heads until the error of the sum of flows within the looped network is zero or insignificantly small [24].
Irrespective of whether the loop or node equations are set up for a specific network, the problem remains in the necessity of solving the resulting system of simultaneous nonlinear equations [21]. The Newton-Raphson or Newton methods are fixed-point iteration methods based on linear approximation, which incorporates the idea that a continuous differentiable function can be approximated by a straight line tangential to it. If a solution of a non-linear function fx, such as the equations of conservation of mass and conservation of energy, is estimated as xn, then Newton's method indicates that the better approximation, xn + 1, is equal to the estimated xn minus the ratio of the function (fx) to the first derivative of the function (f'x). This process is repeated until the desired accuracy of the solution is achieved [25].
The EPANET water distribution system modelling software package is used in this study to model the hydraulics within the water distribution networks under question. EPANET uses a hybrid node-loop approach to hydraulically balance, or to solve the flow continuity (conservation of mass) and headloss (conservation of energy) equations of the network at a given point in time. This approach can be related to the gradient algorithm employed by Todini and Pilati [26] and Salgado et al. [27,28]. For the water distribution system modelling process, the reservoir levels, junction demands, and tank levels are set for a specific point in time. The flow and headloss in the system are then calculated through the gradient algorithm and the flow solution for that specific point in time is then used to update the tank levels while the reservoir levels and junction demands are updated according to a prescribed time pattern. These new parameters are used to hydraulically balance the model for this subsequent time step using the gradient algorithm [28]. The simulation therefore uses the solutions for several subsequent "steady states" within a prescribed demand/time pattern to perform an extended-period simulation on the water distribution system. In the initial paper by Rao and Bree [21], EPS was defined as a sequence of static solutions that are performed at prespecified intervals with the dynamics of reservoir storage and schedules of pump and valve settings used to update the inputs to the static solutions in every time interval similar to the discussed EPANET approach.
Rao and Bree [21] indicated a range of applications and benefits of EPS in operations and planning evaluation: Evaluation of the level of service and storage conditions during emergency situations in which certain changes in demand patterns take preference in flow, e.g., fires or pipe leakages.

2.
Evaluation of the effects of fluctuating demands extending beyond 24 h, e.g., seasonal variance or succession of high-consumption days as an effect of emergency demands.

3.
Evaluation of heuristic control schemes for the network.

4.
The simulation procedure is useful in assisting to understand the effect of network reinforcements on the piezometric surface of the network over an extended period.

5.
Reservoir-level prediction through EPS can be used to prevent "swings" in the production rate of the network by scheduling supply from different supply reservoirs to maintain prescribed reservoir levels in the network.
Most of the benefits or applications as described by Rao and Bree [21] are applicable to the evaluation and identification of energy recovery locations within a water distribution network. This emphasizes the need for EPS in the evaluation of a network for energy recovery and the subsequent benefits of leakage reduction.
EPS is a well-known procedure for the modelling of dynamic conditions within water networks, and has been employed comprehensively for different applications, including developing methodologies for the control approach [29], PRV characterization and strategy management [30], simulation of pressure-driven demands [31], etc. Tata and Howard [32] used EPS to model the water distribution system for the Town of Avon, Massachusetts to estimate the water age in the system under winter and summer demand conditions as an indicator of water quality and to evaluate the Town's existing system operations in terms of tanks and pumps to maintain a residual pressure of 24 m throughout the system.
The following paragraph discusses how EPS was integrated into the development of an updated PERRL process to improve the optimization of the size and location of proposed hydro-turbines for energy recovery within water distribution networks. [33] developed a methodology, which investigated the installation of control valves for pressure management in district metered areas (DMAs). The methodology by Creaco and Haidar [33] proposed a hybrid algorithm that attempts to find an optimal solution based on the total installation cost, daily leakage volume, and demand uniformity across the DMAs. PERRL is a similar procedure, with the difference of focus being on energy recovery and the subsequent benefits of leakage reduction, rather than pressure management through control valves.

Creaco and Haidar
PERRL employs a genetic algorithm (GA) to identify and optimize the location and sizes of hydro-turbine installations or conduit hydropower installations for energy recovery. PERRL optimizes the installations based on either energy recovered or leakage reduction as a subsequent effect of energy recovery, or a user-defined combination of both. Creaco et al. [34] utilized a similar bi-objective approach for the optimization of pump-as-turbine (PAT) installations in transmission mains. The approach by Creaco et al. [34], however, only considered the trade-off between installation costs and generated hydropower, which were to be minimized and maximized, respectively, whereas the initial PERRL procedure considered the energy recovery (generated hydropower), leakage reduction, and total installation cost.
In the study by Bonthuys et al. [19], PERRL was used to run steady-state analyses to identify possible locations and iteratively optimize locations through the GA. Optimized sites were used in the EPS simulations outside of the PERRL procedure to check the validity of the results.
In this study, a new PERRL procedure (PERRL 2.0) was utilized; the previous approach was enhanced by including the EPS within the optimization procedure in order to reduce the need to validate the results externally. The main effects of this modification was a renewed role of the computational time step and a modification of the output of the model. Indeed, in the previous procedure, the demand patterns of the flow data were used to evaluate the time steps to identify the upper and lower bounds in terms of flow and pressure within the system. These bounds were used in the PERRL procedure to optimize hydro-turbine locations for either predominantly night operations or predominantly day operations depending on the importance assigned to either energy recovery or leakage reduction.
As discussed, the PERRL procedure was based on a steady state within the water distribution network and therefore a single power rating per proposed installation was calculated. The energy recovery could therefore be said to be "independent" by computational timesteps and calculated a theoretical unit capacity for each installation. This power rating was used to calculate the yearly generating capacity and subsequently the revenue for the said installation. The output of the initial procedure in terms of energy recovery was the yearly energy generation (kWh/annum). The potential yearly revenue along with the current annual real losses (CARL) of the system and the nominal cost of water were used within the PERRL procedure to calculate a weighted score to rank the PERRL solutions.
On the other hand, the introduction of the EPS within the procedure in PERRL 2.0 also implied the inclusion of daily demand patterns and hence the need for modification of the computational time step used in the procedure from an "independent" state to an hourly timestep. As a consequence, the output of the system was also changed to an hourly interval summed to a daily energy recovery value in kWh/day. Figure 1 shows a single analysis example of the daily output, in hourly intervals, of the average operating pressure within the system before and after the implementation of energy recovery using PERRL 2.0. The computational change from an "independent" state to an hourly timestep within the PERRL 2.0 procedure effectively changed the weighted score to the following equation: where WER = energy recovery weight; CE = energy cost (ZAR/kW); ERi = energy recovery per hourly timestep (kW); Pensolution = solution penalty; CARL = current annual real losses (kL); WLR = leakage reduction weight; CW = water cost (ZAR/kL); LRi = leakage reduction per hourly timestep (%); and ERmax = energy recovery installation capacity (kW). The leakage reduction term, LRi, is calculated by calculating the difference in the solution average link pressure and the status quo average link pressure (proportioned to account for variability in link lengths). The ratio of this calculated difference against the status quo average link pressure is averaged over the 24-h timestep to account for the total average leakage reduction in the system.
The introduction of the weights in Equation (1) was mainly driven by the need of a fair comparison between solutions favoring the leakage reduction and solutions favoring the energy recovery increase. Different to the energy recovery, the FAVAD equation [13], governing the leakage reduction calculations, is only affected by the reduction in operating pressure and not by the flow rate within the system at the specific point. Because of this, in a system or region characterized by a significant CARL and by high water costs, solutions targeted on a significant leakage reduction would have achieved better ranks than solutions aimed at increasing the energy recovery.
The ER weight and LR weight in Equation (1) provides the PERRL 2.0 user with the opportunity to influence the skewness of the results based on the relative importance of either one of the parameters. However, the higher the CARL and the larger the relative difference between the energy and water supply cost, the larger the difference in the ER and LR weights become. For this reason, the PERRL 2.0 procedure was also amended to include an alternative score for ranking solutions with the GA.
The alternative ranking score within the PERRL 2.0 procedure ranks solutions based on the most cost-effective combination of energy recovery (based on total daily energy recovered) and leakage reduction (average percentage leakage reduction) according to the following equation: The computational change from an "independent" state to an hourly timestep within the PERRL 2.0 procedure effectively changed the weighted score to the following equation: where W ER = energy recovery weight; C E = energy cost (ZAR/kW); ER i = energy recovery per hourly timestep (kW); Pen solution = solution penalty; CARL = current annual real losses (kL); W LR = leakage reduction weight; C W = water cost (ZAR/kL); LR i = leakage reduction per hourly timestep (%); and ER max = energy recovery installation capacity (kW). The leakage reduction term, LR i , is calculated by calculating the difference in the solution average link pressure and the status quo average link pressure (proportioned to account for variability in link lengths). The ratio of this calculated difference against the status quo average link pressure is averaged over the 24-h timestep to account for the total average leakage reduction in the system.
The introduction of the weights in Equation (1) was mainly driven by the need of a fair comparison between solutions favoring the leakage reduction and solutions favoring the energy recovery increase. Different to the energy recovery, the FAVAD equation [13], governing the leakage reduction calculations, is only affected by the reduction in operating pressure and not by the flow rate within the system at the specific point. Because of this, in a system or region characterized by a significant CARL and by high water costs, solutions targeted on a significant leakage reduction would have achieved better ranks than solutions aimed at increasing the energy recovery.
The ER weight and LR weight in Equation (1) provides the PERRL 2.0 user with the opportunity to influence the skewness of the results based on the relative importance of either one of the parameters. However, the higher the CARL and the larger the relative difference between the energy and water supply cost, the larger the difference in the ER and LR weights become. For this reason, the PERRL 2.0 procedure was also amended to include an alternative score for ranking solutions with the GA. The alternative ranking score within the PERRL 2.0 procedure ranks solutions based on the most cost-effective combination of energy recovery (based on total daily energy recovered) and leakage reduction (average percentage leakage reduction) according to the following equation: where ER i = energy recovery per hourly timestep (kW); Pen solution = solution penalty; LR i = leakage reduction per hourly timestep (%); and ER max = energy recovery installation capacity (kW). The penalty function for the PERRL 2.0 procedure, Equation (4), was kept similar to the function developed for PERRL, Equation (3), but only applied to the hourly timestep. This hourly penalty was then used within Equations (1) or (2) to calculate the weighted score or alternative score. For the basis of comparison, the hourly penalty results were summed and divided by 24 to obtain a theoretical average daily penalty: where Pen Node (PERRL) = node penalty for PERRL procedure; Pen Node (PERRL 2.0) = node penalty for PERRL 2.0 procedure; H = node operating pressure (m); and H r = minimum residual pressure (m). Another modification in comparison with the original PERRL procedure was also conducted on the calculation of the average leakage reduction in the system as a subsequent benefit of energy recovery. Since the leakage within the system is assumed to be predominantly background leakages and the exact locations of these leaks are unknown, the current annual real losses (CARL), as calculated through the asset custodians water balance calculations, are assumed equally distributed over the entire system. The PERRL procedure previously proposed [19] implemented the FAVAD equation using the average node pressure as a basis of comparison. However, utilizing the average node pressure does not consider the variability of the link length within the model. Disregarding the link lengths effectively models equal leakage through a 1-m link and a 10-km link in the model, which is not representative of our initial assumption that the CARL should be divided equally over the entire system due to the various unknowns. In a very small network or a network with a constant link length resolution, the difference between modelling the leakage reduction on average node pressures or average link pressures is negligibly small. However, in a mayor network with high variability in link lengths, the effect becomes significant. For the PERRL 2.0 procedure, the leakage reduction was calculated using the average link pressures with the CARL proportioned over the total network links according to the individual link lengths to account for the variability in link lengths within the model.
Last, the PERRL 2.0 procedure includes existing control valves in the analysis. The main reason of this approach is that, although energy recovery installations recover potential energy otherwise dissipated by conventional pressure control valves, these installations are not widely accepted by water utilities since they represent the replacement of past investments [35]. To make the optimal solution easier to be accepted by water utilities, the hydraulic model considers the existing infrastructure.
Similar to the range of applications identified by Rao and Bree [21], incorporating EPS into the development of a PERRL 2.0 procedure has the following advantages: 1.
Hourly energy recovery results (i.e., device sizes) assists in the understanding of the ER device efficiency during variable operation and provides a better platform for selecting or designing an ER that will function at its best efficiency point for the optimal duration of the day.

2.
Applying the leakage reduction equation at an hourly timestep gives a more realistic model of how the ER installation effects the losses from the system through background leakage. Incorporating the effect of valve closures into the PERRL procedure could in the future further optimize the system. 3.
EPS and the inclusion of the demand pattern in PERRL 2.0 allows the user to compare the installation of a possibly smaller ER device, which will only function for a portion of the day but at its best efficiency, to an ER device designed on a daily extreme head or flow, which will only function at best efficiency for a fraction of its operating time. Figure 2 shows the updated flow diagram for the PERRL 2.0 procedure. The updated PERRL 2.0 procedure and incorporated GA depicted in Figure 2 follows 21 steps that can be explained as follows: • Step 1: A hydraulic model incorporating the geometrical data and flow demand patterns of the system under analysis is entered directly into the EPANET hydraulic modelling software, whilst the minimum residual pressure (H r ) is set in the PERRL 2.0 procedure. The procedure uses Hr to calculate the excess node pressures (H ai ) in step 7.

•
Step 2: The different optimization parameters are set in the procedure and stay constant throughout the analyses.

•
Step 3: The characteristics of the initial population are defined. The size (n) of the initial population refers to the number of unique ER and LR solutions that the procedure will retain as output.
The number of ER locations (m) defines the number of network links, within each unique solution, that will be simulated to contain an energy recovery device.

•
Step 4: Following the definition of the required input data and parameters in steps 1 to 3, the hydraulic model simulation is run in EPANET.

•
Step 5: If the simulation run was for the status quo, i.e., no ER locations were added to the model and the initial population of solutions was not generated, then the procedure continues to step 6. If, however, the initial population of solutions was generated and the hydraulic simulation using the parameters of the m-number ER locations for the different unique solutions was done, the procedure continues to step 9.

•
Step 6: For each hydraulic simulation, including the status quo, EPANET will run an EPS incorporating the 24-h demand pattern input in step 1. EPANET will run the hydraulic simulation for each of the 24 time-steps with the procedure essentially repeating steps 5 to 6 until the time-step (i) exceeds 24. The procedure then continues to step 7.

•
Step 7: The PERRL 2.0 procedure utilizes a dynamic link library (DLL) of functions incorporated into an application written in Visual Basic, to extract the following data from the EPANET results file: • Node and link IDs; Node excess pressures (H ai ); and • Link flow and velocity.

•
Step 8: The initial population of solutions are generated as follows: • m-number of random link locations are selected.

•
The minor loss coefficients for the selected m-number of links are set to a random value equivalent to a headloss between 0 and the node excess pressures of the individual link end nodes for selected links.

•
The minor loss coefficients and associated headloss mimics the effect of energy recovery devices in the system.

•
This process is repeated until n-number of unique solutions are obtained as the initial population of solutions.

•
A unique solution resulting in negative pressures at the nodes is eliminated from the process.
Water 2020, 12, 2447 9 of 20 • Incorporating the DLL discussed in step 7, the procedure exports an EPANET input file containing the network links modified in terms of minor loss coefficients.

Benchmark Study
Bonthuys et al. [19] used the Jowitt and Xu [36] water distribution network ( Figure 3) as a benchmark network to evaluate how the PERRL procedure compares to methods and results from Following the conclusion of step 8, the procedure returns to step 4 and a hydraulic simulation is run in EPANET with the amended link parameters.
Step 5 again checks if the hydraulic simulation is for the status quo, and when it is found that the initial population of solutions was generated, the procedure continues to step 9.
Depending on the number of iterations used in the procedure, the number of the current iteration, steps 9 to 14 are either of the initial population of solutions or on the new population of solutions discussed in step 20.

•
Step 9: The PERRL 2.0 procedure utilizes the DDL discussed in step 7 to extract data from the EPANET results file following the hydraulic simulation of the population of solutions.
The following data is extracted: • Node and link IDs; Link flow (Q i ); and • Link-induced headloss.

•
Step 10: The hydraulic simulation is run in EPANET and the data in step 9 extracted for all 24 steps of the EPS for all population solutions before the procedure continues to step 11.

•
Step 11: ER and LR results are calculated for all the population solutions, using the equations defined in Figure 2.

•
Step 12: A weighted penalty function is applied to penalized and potentially eliminated solutions that result in residual node pressures lower than the prescribed minimum in step 1. The weighted penalty function favors solutions that result in residual node pressures as close as possible to the prescribed minimum in step 1.

•
Step 13: Each solution in the population is assigned a weighted score based either on the weighted score defined in the original PERRL procedure or an alternative weighted score function shown in Figure 2.

•
Step 14: Individual solutions are ranked based on the weighted score in step 13.

•
Step 15: The ranked solutions are added to the database of solutions for the specific system under investigation. The database of solutions is also ranked in terms of the weighted score and a pre-defined number of the top ranked solutions are retained in the database.

•
Step 16: Based on several factors, such as the number of iterations, ER and LR results. or simulation time, the procedure can be terminated by continuing to step 21 and stopping the analysis. Otherwise, the procedure continues to step 17: Step 17 to step 20 incorporate the GA into the PERRL 2.0 procedure. The PERRL 2.0 procedure incorporates a simple genetic algorithm consisting out of reproduction, cross over, and mutation. The reproduction in the case of the PERRL 2.0 procedure is done utilizing an Elitism approach.

•
Step 17: Before cross over and mutation of the population solutions, the procedure applies an Elitism approach by substituting a portion of the lowest ranking solutions by a portion of the top-ranking solutions (per the ranking in step 15). The portion to be substituted is defined by a pre-defined percentage. This is done to ensure better retention of the top solutions in the current population.

•
Step 18: A single-point cross over is incorporated, swapping ER locations between the population of solutions to obtain new solutions carrying the "genetic" information of the elite solutions in step 17.

•
Step 19: Following both Elitism and cross over, the PERRL 2.0 procedure mutates a pre-defined percentage of solutions. The mutation is done by selecting random link locations in the solutions population after cross over and setting a new minor loss coefficient for the selected links. The minor loss coefficients are set according to step 8.

•
Step 20: Steps 17 to 19 alter the solutions population and result in a new population of solutions, which is exported to an EPANET input file using the DLL discussed in step 7. A hydraulic analysis is run in EPANET using the new population of solutions and steps 4 to 16 are repeated.

•
Step 21: The procedure is terminated and the analysis is stopped.

Benchmark Study
Bonthuys et al. [19] used the Jowitt and Xu [36] water distribution network ( Figure 3) as a benchmark network to evaluate how the PERRL procedure compares to methods and results from previous studies applied to the same water distribution network. This benchmark network is composed of 3 reservoirs, 25 nodes, and 37 pipes. The network has a total pipe length of 44.26 km, with diameters ranging between 152 and 475 mm and Hazen-Williams roughness coefficients between 6 and 140. All network nodes classified as consumptive have a total base demand of 150 /s. A complete description of the benchmark network is available in Jowitt and Xu [36]. It was found that the PERRL procedure results compared well with previous research when employing a steady-state analysis only.
Water 2020, 12, x FOR PEER REVIEW 11 of 20 previous studies applied to the same water distribution network. This benchmark network is composed of 3 reservoirs, 25 nodes, and 37 pipes. The network has a total pipe length of 44.26 km, with diameters ranging between 152 and 475 mm and Hazen-Williams roughness coefficients between 6 and 140. All network nodes classified as consumptive have a total base demand of 150 ℓ/s. A complete description of the benchmark network is available in Jowitt and Xu [36]. It was found that the PERRL procedure results compared well with previous research when employing a steadystate analysis only. The PERRL 2.0 procedure also used the Jowitt and Xu [36] network as a benchmark network to compare results. A comparison with results from the literature could only be drawn between the proposed ER/PRV locations and estimated leakage reduction since most of the previous studies did not include an analysis on energy recovery. Figure 3 shows a comparison on the ER locations identified using the PERRL procedure and the PERRL 2.0 procedure as well as the PRV locations as proposed by Jowitt and Xu [36]. Both the PERRL 2.0 procedure and the study by Jowitt and Xu [36] incorporated the demand patterns of the consumptive nodes in the analyses, whereas the study by Bonthuys et al. [19] only focused on the timestep with the lowest available head within the network. To understand the differences in results, consideration must be given to the demand patterns of the consumptive nodes. Figure 4 shows a comparison between the flow within link 20 and 21 and the pressure at node 15 and 22 within the benchmark network for the status quo. The initial PERRL process only focused on the average operating pressure reduction within the network at the timestep with the lowest available head, which would rationalize the placement of the ERT at a higher elevation (node 15) to reduce all subsequent heads at consumptive nodes at lower elevations (node 22) (within permissible limits). When considering the time varying flow and head (Figure 4), it can be observed that node 22 has a higher operating pressure than node 15 throughout the entire day, which is to be expected due to the topography and hydraulics of the system. However due to the varying demand within the system, the incremental difference in the pressure head and the subsequent head available for pressure management (or energy recovery) varies substantially during the day, which in a small network such as this could make the "downstream" installation at node 22 (PERRL 2.0) more The PERRL 2.0 procedure also used the Jowitt and Xu [36] network as a benchmark network to compare results. A comparison with results from the literature could only be drawn between the proposed ER/PRV locations and estimated leakage reduction since most of the previous studies did not include an analysis on energy recovery. Figure 3 shows a comparison on the ER locations identified using the PERRL procedure and the PERRL 2.0 procedure as well as the PRV locations as proposed by Jowitt and Xu [36].
Both the PERRL 2.0 procedure and the study by Jowitt and Xu [36] incorporated the demand patterns of the consumptive nodes in the analyses, whereas the study by Bonthuys et al. [19] only focused on the timestep with the lowest available head within the network. To understand the differences in results, consideration must be given to the demand patterns of the consumptive nodes. Figure 4 shows a comparison between the flow within link 20 and 21 and the pressure at node 15 and 22 within the benchmark network for the status quo. The initial PERRL process only focused on the average operating pressure reduction within the network at the timestep with the lowest available head, which would rationalize the placement of the ERT at a higher elevation (node 15) to reduce all subsequent heads at consumptive nodes at lower elevations (node 22) (within permissible limits). When considering the time varying flow and head (Figure 4), it can be observed that node 22 has a higher operating pressure than node 15 throughout the entire day, which is to be expected due to the topography and hydraulics of the system. However due to the varying demand within the system, the incremental difference in the pressure head and the subsequent head available for pressure management (or energy recovery) varies substantially during the day, which in a small network such as this could make the "downstream" installation at node 22 (PERRL 2.0) more attractive than the installation at node 15 [19]. This situation, however, changes entirely when energy recovery is also considered and the combination of head available and the flow present in the system governs the decision.
Water 2020, 12, x FOR PEER REVIEW 12 of 20 attractive than the installation at node 15 [19]. This situation, however, changes entirely when energy recovery is also considered and the combination of head available and the flow present in the system governs the decision. When only considering leakage reduction within the benchmark network, two clear zones of pressure management can be seen throughout the literature and previous studies on the Jowitt and Xu [36] network. Both results from Jowitt and Xu [36] and the initial PERRL process effectively reduce pressure in region A and region B (Figure 3). The installations in link 28 from the initial PERRL process and in link 29 from Jowitt and Xu [36] respectively both reduce pressure at node 22. The PERRL 2.0 process also identified a potential installation in link 29, as well as an additional PRV/ERT in link 20 that would further reduce the pressure at node 22. The PERRL 2.0 process omits the Xu [36] network. Both results from Jowitt and Xu [36] and the initial PERRL process effectively reduce pressure in region A and region B (Figure 3). The installations in link 28 from the initial PERRL process and in link 29 from Jowitt and Xu [36] respectively both reduce pressure at node 22. The PERRL 2.0 process also identified a potential installation in link 29, as well as an additional PRV/ERT in link 20 that would further reduce the pressure at node 22. The PERRL 2.0 process omits the PRV/ERT in link 21 (compared to Jowitt and Xu [36] and Bonthuys et al. [19]), which increases the pressure at node 15 in comparison to the results by Jowitt and Xu [36] and Bonthuys et al. [19]. Any pressure reduction at the higher elevation in the system (node 15) effectively reduces the operating pressure at the lower elevation (node 22). The installation of PRVs/ERTs in link 21 and link 29 from Jowitt and Xu [36], the installation of PRVs/ERTs in link 21 and link 28 from the initial PERRL procedure, and the installation of PRVs/ERTs in link 20 and link 29 from the PERRL 2.0 procedure all effectively reduce the pressure at node 22. All three results are similar and seen as comparable in the context of leakage reduction.

Case Study
The PERRL 2.0 procedure was therefore also applied to a case study considering the effects of ERT installations on both energy recovery and leakage reduction. To enable a comparison between PERRL and PERRL 2.0, these procedures were applied to the Polokwane Central DMA within the City of Polokwane (CoP) Local Municipality in Limpopo, South Africa.
The Polokwane Central DMA was isolated from 7 operational clusters consisting of 14 regional water schemes that comprises of approximately 6000 km to form the CoP water asset portfolio. The Polokwane Central DMA was isolated for hydraulic modelling in prior research and does not currently reflect the operational configuration of the network [12].
Several parameters required as input to the PERRL 2.0 were kept the same as the development of the initial PERRL procedure: The energy recovery (ER) weight and leakage reduction (LR) weight, which assign importance to the different objectives within the GA, were kept at 70% and 30%, respectively; in accordance with the development of the original PERRL procedure. The PERRL 2.0 procedure was, however, run using the alternative score function due to the influence of the high CARL in the Polokwane Central DMA and due to the high relative difference between the energy and water cost within the Polokwane Central DMA.
Due to a lack of historical flow data within the Polokwane Central DMA, the end user average annual daily demand (AADD) was estimated by classifying the users per land-use, size, and level of service contained in the customer profile of the Polokwane Local Municipality Water and Sanitation Asset Management Plan. The study by Bonthuys et al. [12] aligned the asset management classification of the Polokwane Central DMA end users to the classification of water demand for developed areas in South Africa as defined by the Guidelines for Human Settlement Planning and Design in South African municipalities [37]. A standard demand pattern was then applied to the AADD for either residential or industrial end users ( Figure 5). service contained in the customer profile of the Polokwane Local Municipality Water and Sanitation Asset Management Plan. The study by Bonthuys et al. [12] aligned the asset management classification of the Polokwane Central DMA end users to the classification of water demand for developed areas in South Africa as defined by the Guidelines for Human Settlement Planning and Design in South African municipalities [37]. A standard demand pattern was then applied to the AADD for either residential or industrial end users ( Figure 5).

Results and Discussion
The PERRL 2.0 procedure was applied to the Polokwane Central DMA to enable a comparison with the results from the original PERRL procedure, as discussed in Section 3. The study by Bonthuys et al. [19] conducted an EPS on the results obtained for proposed ERT installations as per the PERRL analysis but did not incorporate an EPS within the PERRL analysis and for this reason reported the energy recovery potential at the optimum locations as power (kW) installations. These power installations were converted to hourly generating capacities (kWh) in order to allow a comparison with the PERRL 2.0 procedure, which reports energy recovery results in hourly power generating capacity (kWh). The conversion of power capacity from PERRL to hourly generating capacities was done by incorporating the demand patterns shown in Figure 5. Table 1 shows the topped ranked solution from the Bonthuys et al. [19] study in daily generating capacity. Within the PERRL process, 10 separate independent simulation runs, with an initial population (n) of 100 and an energy-recovery location number (m) set to 3, were done. A similar analysis was done using the PERRL 2.0 process in order to enable the comparison of results between the original and updated process. For each separate independent simulation run, the step-by-step process of the PERRL 2.0 procedure outlined in Section 2 was followed using a population solutions size of 100 and incorporating 3 energy recovery locations within each population solution. The increase in network equations to be solved by the GA due to the decrease in the computational timestep from daily to hourly increased the typical simulation time and computational memory usage of the process and can possibly reduce the number viable iterations to be run depending on the hardware specifications. Table 2 shows the top ranked solutions for the 10 simulation runs, with Table 3 showing the globally top ranked solution for the analysis, indicating the three individual ERT locations. The globally top ranked solution for the PERRL 2.0 analyses of the Polokwane Central DMA foresees the installation of turbines of a maximum generating capacity of 30, 14, and 9 kW, at the three locations as indicated in Table 3 and graphically depicted in Figure 6.    As can be seen from Figure 6, across all three studies on the Polokwane DMA, the proposed potential ER locations are mainly clustered around two locations, with the third location only correlating for two of the three historic analyses. The first area to the south of the DMA is a 600-mm supply line from a cluster of reservoirs distributing bulk supply to the suburbs and villages to the south and east of the Polokwane DMA. The second location is within the center of the Polokwane Central DMA, with demands from residential, commercial, and industrial end-users requiring an almost constant supply to this area, as can be seen from Figure 7. Figure 7 depicts the time distribution of flow within link 6281 (#1 of the PERRL 2.0 global optimum solutions- Figure 6), where a hydroturbine is suggested, through a 24-h cycle. Figure 8 shows the operating pressure at the end node of  Figure 6 shows the optimum locations of ERTs for the following different studies on the Polokwane Central DMA:

•
Initial study by Bonthuys et al. [12]-only the energy recovery considered in the optimization of the location of turbines, and no consideration was given to the effect of energy recovery on leakage within the system. • PERRL procedure analysis by Bonthuys et al. [19]-utilizes GA to optimize multiple objective functions and identify ERT locations based on several technical and non-technical (monetary) criteria. EPS ran on PERRL proposed ERT locations. • PERRL 2.0 procedure-EPS analysis embedded in GA.
As can be seen from Figure 6, across all three studies on the Polokwane DMA, the proposed potential ER locations are mainly clustered around two locations, with the third location only correlating for two of the three historic analyses. The first area to the south of the DMA is a 600-mm supply line from a cluster of reservoirs distributing bulk supply to the suburbs and villages to the south and east of the Polokwane DMA. The second location is within the center of the Polokwane Central DMA, with demands from residential, commercial, and industrial end-users requiring an almost constant supply to this area, as can be seen from Figure 7. Figure 7 depicts the time distribution of flow within link 6281 (#1 of the PERRL 2.0 global optimum solutions- Figure 6), where a hydro-turbine is suggested, through a 24-h cycle. Figure 8 shows the operating pressure at the end node of link 6281 for both before and after the installation of the proposed energy recovery device.
Similar to the study by Bonthuys et al. [19], the larger installation of the globally top ranked solution is situated within the central area of the Polokwane Central DMA as shown in Figure 6. This area as mentioned above (as can be seen in Figure 7) only has a 0.5% variation in flow during the course of a day, making it possible to operate closer to the ER device's best efficiency point for extended periods, and therefore making the installation more efficient and more cost effective. Figure 9 indicates the fluctuation in the daily energy recovery trend for the globally top ranked solution in Table 3.     Similar to the study by Bonthuys et al. [19], the larger installation of the globally top ranked solution is situated within the central area of the Polokwane Central DMA as shown in Figure 6. This area as mentioned above (as can be seen in Figure 7) only has a 0.5% variation in flow during the course of a day, making it possible to operate closer to the ER device's best efficiency point for extended periods, and therefore making the installation more efficient and more cost effective. Figure  9 indicates the fluctuation in the daily energy recovery trend for the globally top ranked solution in Table 3.

Conclusions
This paper presents the optimization procedure PERRL 2.0 of the energy recovery and leakage reduction in a municipal water distribution system.
The innovative aspects of the proposed procedure are:


The introduction within the optimization process of an extended period simulation allows consideration of the influence of the variation of the network demand on the proposed solution of the optimization process in terms of pressure management and conduit hydropower installation.  The amendment of the weights in the scoring of the proposed solutions allows proper balance between the two expected goals: energy recovery and leakage reduction.  The improvement of the calculation of the average leakage reduction allows consideration of the influence of the link length.
In applying the PERRL 2.0 procedure to the benchmark network first proposed by Jowitt and Xu [36], and comparing the results to previous studies, it was found that the results were comparable in terms of leakage reduction potential for 3 ER or pressure management devices installed. There was only a slight difference in the proposed locations of installations, which could be ascribed to the EPS component of the PERRL 2.0 procedure, which gives preference to locations with more stable and

Conclusions
This paper presents the optimization procedure PERRL 2.0 of the energy recovery and leakage reduction in a municipal water distribution system.
The innovative aspects of the proposed procedure are: • The introduction within the optimization process of an extended period simulation allows consideration of the influence of the variation of the network demand on the proposed solution of the optimization process in terms of pressure management and conduit hydropower installation.

•
The amendment of the weights in the scoring of the proposed solutions allows proper balance between the two expected goals: energy recovery and leakage reduction.

•
The improvement of the calculation of the average leakage reduction allows consideration of the influence of the link length.
In applying the PERRL 2.0 procedure to the benchmark network first proposed by Jowitt and Xu [36], and comparing the results to previous studies, it was found that the results were comparable in terms of leakage reduction potential for 3 ER or pressure management devices installed. There was only a slight difference in the proposed locations of installations, which could be ascribed to the EPS component of the PERRL 2.0 procedure, which gives preference to locations with more stable and constant operating conditions. The PERRL 2.0 process was also applied to an analysis of the Polokwane Central DMA. Whereas the analyses of the benchmark network only focused on the impact on pressure management and leakage reduction, the analyses of the Polokwane Central DMA involved both the leakage reduction potential as well as the energy recovery potential of the installations weighted against the cost of such installations. The results from the initial PERRL procedure by Bonthuys et al. [19] ranked simulations based on a weighted score and applied the EPS on the top ranked solutions. The results in this study included the EPS as part of the PERRL 2.0 procedure and subsequently ranked results on an alternative weighted score, essentially incorporating the EPS into the solutions ranking criteria.
This method increases the level of confidence in the results by eliminating solutions that would have high ER potential with large flows during peak times or high leakage reduction potential during off-peak times with high average operation pressures in the system. In comparison to the alternative solutions, the PERRL 2.0 procedure, by concurrently employing both EPS and the GA, identifies the best alternative solutions based on the selected scoring criteria, i.e., the weighted score or alternative score is provided.
Similar to what was observed for the benchmark network, the inclusion of the EPS within the algorithm of the PERRL 2.0 process and the amended weighted score function evolved the analysis results such that the links with more constant flow patterns and installations with a larger maximum capacity are preferred above highly varying flow locations or a combination of installations with smaller capacities.
Although the PERRL procedure succeeded in identifying preliminary potential installations of ER recovery devices, which resulted in subsequent leakage reduction within the system, the PERRL 2.0 procedure refined the process by introduction of the EPS into the optimization procedure. Therefore, the PERRL 2.0 process was proved to identify more cost-efficient installations in more realistic simulations.

Disclaimer
The output of the research conducted in this article is generated from developed hydraulic models of the City of Polokwane's Water Supply Infrastructure. These models incorporate assumptions informed by demand modelling and have not been calibrated to any specific time, date, or scenario of measured data from the City of Polokwane's Water Supply Networks. This research does not reflect or constitute the views of the Polokwane LM or any individuals affiliated with the Polokwane LM.