## Abstract

Excessive pressure in water distribution networks (WDNs) may lead to undesirable effects, such as increased pipe failure rate and leakages. Pressure management (PM) techniques are indeed attractive to address these issues, reducing energy and water losses. Among the most recent PM techniques, pumps working as turbines (PATs) can be employed to both control pressure and recover energy. However, finding the best location, setting, and number of PATs to maximize both leakage reduction and energy production within a WDN is particularly challenging due to the severe nonlinearity of the problem and the large number of decision variables. To address the setting problem, a promising derivative-free nonlinear programming method is herein presented. The proposed method, modified to account for bound-type constraints, is capable of finding the optimal setting of a chosen number of PATs, given their position, direction, and machine type (characteristic curve), accounting for both energy and saved water volumes costs. In addition, this method is also able to establish whether the installed PATs must be bypassed or not. The proposed method capabilities are tested on a hypothetical complex WDN taken from the literature.

## INTRODUCTION

Water distribution networks (WDNs) can be defined as low-efficiency systems because a considerable amount of energy is required to satisfy user's water demands. Indeed, WDNs represent one of the most energy-demanding infrastructures in the world. In the UK, delivering water through the piped infrastructure is estimated to be the fourth most energy-consuming activity (Ainger *et al.* 2009), while the operation and maintenance of WDNs cost about 4 billion dollars/year in the USA (Zilberman *et al.* 2008).

As water leakages always occur within WDNs, a large amount of energy used for pumping water is lost. Leakages may cause inefficient energy distribution through the network, low pressures, and a massive financial loss for managing authorities. Therefore, leakage reduction and pressure management (PM) techniques have attracted the interest of many researchers and practitioners.

Several works have been devoted to leakage reduction through PM techniques based on the optimal location of pressure-reducing devices (Covelli *et al.* 2016a, 2016b), such as pressure-reducing valves (PRVs). Even though these devices are effective, their use entails that the excess of energy through the WDN is simply wasted. In response to this issue, generating energy by exploiting the excess of pressure within WDNs has become attractive in recent years. Several researches focused their attention on the use of PATs as an alternative to PRVs to reduce the pressure excess and transform the dissipated energy into electric energy at the same time (Lima & Luvizotto 2017; Lima *et al.* 2017a, 2017b). The use of PATs in place of turbines has become very attractive, as these are cheaper and produced in a larger scale. In addition, PATs also proved to be less prone to mechanical failures (Chapallaz *et al.* 1992; Binama *et al.* 2017), as these are basically pumps working in the inverse mode, a proven technology with mechanical schemes simpler than turbines. In addition, PATs are cheaper (although less efficient) than classical turbines. Furthermore, several scientific works are currently available to determine the corresponding characteristic curves in the inverse mode (Derakhshan & Nourbakhsh 2008; Yang *et al.* 2012; Pugliese *et al.* 2016; Tan & Engeda 2016; Lima *et al.* 2018).

As pointed out in Fecarotta & McNabola (2017), the problem of the optimal location of a hydropower device within a WDN has been investigated by few authors only. Indeed, the optimal placement of PATs within WDNs is a challenging task, and the complexity of the problem is strictly case dependent, as it is related to the WDN configuration. As the governing equations of water motion are highly nonlinear, the occurrence of a concentrated head loss after the PAT placement can significantly influence the flow rate distribution among the surrounding pipes as well as the available power, especially in a WDN characterized by several loops. Finally, the number of decision variables involved can be very large depending on the WDN dimension.

The optimal location of hydropower devices is usually tackled by means of optimization techniques. To optimize pressure reduction and power output potential, Giugni *et al.* (2014) used a genetic algorithm (GA) to find the optimal location of a fixed number of turbines with two different objective functions. Corcoran *et al.* (2015) used a mixed-integer optimization algorithm to perform a two-step optimization: in the first step, the optimal location of a fixed number of turbines maximizing the power production was found under steady average conditions, while in the second step, turbines were regulated according to the daily demand. The governing hydraulic equations were written as equality constraints of the optimization problem. In both the above-mentioned works, turbines were simulated as simple head losses. Conversely, Samora *et al.* (2016) used the affinity law equations to simulate the behavior of real turbines within the Lausanne network. The simulated annealing algorithm was then used to return the best location of a fixed number of turbines to optimize the energy production. The size of the turbine in each branch was assigned *a priori*, while the presence of the turbine resulted by the optimization. Then, the produced power was calculated with reference to the yearly variability of the monthly averaged daily pattern. In Tricarico *et al.* (2018), optimal selection and position of PATs were found with a multi-objective GA accounting for PAT characteristic curves. The optimization process was carried out considering pump optimal scheduling, pressure excess minimization, and maximum PAT income as three distinct objective functions. However, PAT behavior was considered at constant rotational speed; therefore, no optimal setting was performed. To maximize the power output and reduce leakages, Fecarotta & McNabola (2017) used a mixed-integer nonlinear programming algorithm to find the optimal location, setting, and number of PATs to be installed within a WDN. However, here PATs were modeled as concentrated head losses, and no affinity law was employed. Apart from this last work, the scientific literature lacks studies where the problem of the optimal position, setting, and number of PATs is performed simultaneously. Moreover, PATs are usually not modeled with realistic characteristic curves.

Flexibility, ease of use, and ability to find excellent solutions contributed to the broad success of GAs. However, the problem of leakage minimization through the optimal setting, positioning, and selection of PATs implies the presence of a large number of decision variables. The specific literature on evolutionary programming methods warns about this (Baeck *et al.* 2000a, 2000b), showing that a large number of decision variables induces an increase in the searching space dimension, making the search for the global optimum a harder task. In this case, hybrid methods, such as hybrid GAs, can improve the GA performance (Baeck *et al.* 2000a, 2000b), as a big portion of the searching space (usually continuous decision variables, such as the pump speed) is left to the internal optimizer, which is usually a deterministic optimization algorithm.

A step toward the construction of a hybrid GA capable of optimizing the position, direction, selection, and setting of PATs was made in Cimorelli *et al.* (2018), where a derivative-free method for optimal PATs’ setting was presented. This method is able to maximize the energy production for a given number, position, and orientation of PATs accounting for characteristic curves and situations where the PAT must be bypassed. The idea beyond the cited work lies in the fact that the optimal setting of a PAT within a WDN can be treated as Deterministic Polynomial Time problem (P), while positioning, directing, and selecting the most suitable PAT can be treated as a Deterministic Non-Polynomial Hard problem (NP-Hard). With this in mind, a hybrid GA can be developed. The task of finding the best number, position, direction, and type of PAT is given to the GA, while the optimal setting in terms of rotational speed is left to an inner nonlinear programming algorithm. However, leakages were not considered at this stage.

In the present work, the algorithm proposed by Cimorelli *et al.* (2018) was modified and extended to account for leakages, in order to maximize both energy production and water volumes saved through pressure reduction. To show its capabilities as an internal optimizer for a hybrid GA, the proposed algorithm alone was tested with a WDN taken from the literature.

## THE PROPOSED OPTIMIZER

The proposed optimization algorithm was preliminarily presented by Cimorelli *et al.* (2018), with energy production maximization as the only objective function (OF). Herein, the method has been extended to consider both leakage reduction and energy production. The optimizer is based on Powell's direction set method (PDSM), which allows us to find conjugate directions without resorting to gradient calculations of the OF. Therefore, it has several advantages over the classical nonlinear programming algorithms, namely (i) the OF and its first derivative do not need to be continuous; (ii) it does not necessarily require a convex OF, as it only requires functions to be univariate (i.e., the function has only one maximum or minimum); (iii) it has quadratic convergence; (iv) constraints can be treated as penalty functions; (v) it is not too sensitive to noisy functions (i.e., the algorithm is able to find the optimal point even though the function may exhibit several small local spikes). In Cimorelli *et al.* (2018), the method proved to be able to deal with the energy maximization of a different number of PATs used within the same WDN. In addition, the method was also able to bypass the PAT when it was not adequate to the WDN hydraulic conditions or in cases of reverse flow. In the following, the methodology is extended to the case of simultaneous leakage minimization and energy maximization.

### The Powell direction set method

The PDSM works on the basic principle that to find a minimum/maximum of an *n*-dimensional function, *n*-one-dimensional minimizations can be executed along *n* directions. The recursive algorithm works as follows:

initialize a set of directions (where are the unitary vector basis of the

*n*-dimensional space) and select a starting point ;for move to a minimum along the direction and set ;

for set ;

set ;

move to the minimum along the direction, then set equal to this new point;

repeat from step 2 until the convergence criterion is met.

The above-described procedure tends to create linearly dependent directions. To avoid this, the technique of discarding the direction of the largest decrease (Press *et al.* 1996) was employed.

For each line minimization, the golden-section search (Kiefer 1953) is first employed to bracket the point of minimum with a sufficient small interval. Then, the sequential parabolic approximation (Brent 1973) is used approximate the point of minimum with the desired precision.

However, the above-described algorithm works with unconstrained problems only. To account for bound-type constraints, we modified the original algorithm by scaling the descent direction components when bound constraints are violated (Figure 1).

### PAT characterization

In order to simulate realistic conditions, PAT characteristic curves are required. Pumps’ manufacturers do not usually provide these curves, as PATs are basically pumps working in the inverse mode. Therefore, a combination of the experimental formulas provided by Derakhshan & Nourbakhsh (2008), Yang *et al.* (2012), Pugliese *et al.* (2016), and Tan & Engeda (2016) was used to fully characterize the chosen PATs.

*et al.*(2012) formulas are first used to derive discharge and head at the BEP in the inverse mode:

*Q*at different pump speeds: where

*V*is the relative speed, defined as the ratio between the chosen speed

*N*(RPM) and the PAT characteristic speed

*N*(RPM), while

_{c}*Q*is the flow rate at the characteristic speed. For the head-flow characteristic curve, the experimental formula provided by Derakhshan & Nourbakhsh (2008) is used: where is the head jump, while the formula provided by Pugliese

_{c}*et al.*(2016) is used as a flow-efficiency curve: where is the efficiency at the characteristic speed as a function of

*Q*.

_{c}*V*= 0 was allowed. When this occurs, Equation (7) is modified by substituting and setting . In this way, any flow rate can be conveyed without concentrated head loss, as no PAT is present.

The EPANET 2.0 DLL (Rossman 2000) was used as the hydraulic solver. General purpose valves (GPVs) were used to simulate the presence of PATs, and their characteristic curves were modeled by assigning a head loss curve (derived with the formulas previously reported) to each GPV.

### The objective function

*N*

_{PAT}dimensional vector containing the PAT relative speed at the

*k*th time interval, while

*N*is the number of time intervals in which the day has been divided; is the power produced by the PATs during the

_{k}*k*th time interval; is the water volume saved from leakage due to pressure reduction during the

*k*th time interval; is the penalty function value at the

*k*th time interval, while

*c*and

_{e}*c*are the unitary energy and water tariff, respectively. The power produced by the PATs and the volume of saved water are given by: where is the volume of water leaked from the WDN joints during the

_{w}*j*th time interval of length when no PAT is present within the network. The leakage discharge at the

*j*th node during the

*k*th time interval when one or more PATs is present within the WDN is modeled as follows: where is the pressure at the

*j*th during the

*k*th time interval node, is a leakage coefficient, and is the leakage exponent which depends on the pipe material and orifice shape. Equation (13) can be easily incorporated within the hydraulic solver EPANET 2.0 by assigning an emitter coefficient at each node of the WDN.

*V*

_{min}is the minimum relative speed at which the PAT can work; is a penalty function used to penalize settings

*V*not compatible with the discharge flowing through the pipes (i.e., when the external hydraulic solver pumps water into the system to balance the equations of motion); is the penalty function related to the violation of the minimum head at the

_{j}*i*th demand node of the network, where

*H*is the head at the

_{i}*i*th demand node,

*H*is the minimum head required to fully satisfy the user demand, and

_{i,min}*N*is the number of demand nodes within the network.

_{d}In Equations (15)–(19), the coefficients , , , , and are penalty coefficients, set as , , , and , respectively. Equations (15)–(19) were conceived to make the OF as much univariate as possible. In particular, the value of 10^{6} was chosen for constraints (15) and (18), while 10^{5} for Equation (19) as these are usually violated when *V* is considerably high; therefore, a high slope is required in the penalty function to force the optimizer to set *V* to a lower acceptable value. Conversely, smaller penalties were assigned to constraints (16) and (17), as these are usually violated when *V* is small, and high values of the penalty coefficient may create a local minimum if the actual one lies within a right neighbor of *V*_{min}. In this last scenario, the OF is clearly noisy in the lower portion of the *V* interval. In addition, unlike Cimorelli *et al.* (2018), leakages have been added to both the OF and the hydraulic solver. Therefore, the more the energy is dissipated by the PATs, the less flow is circulating through the network, contributing to make the OF noisier. Nevertheless, the PDSM is proved to be well suited for these types of function. It is worth noting that Equation (16) was modified with respect to Cimorelli *et al.* (2018). Herein, a minimum efficiency value (0.1) was taken into account to avoid too low efficiency values of the PATs, usually corresponding to the working condition occurring outside the actual PAT working range (implying a high probability of PAT failure). Moreover, *V*_{min} was set to 0.1 because the flow-efficiency curve taken from Pugliese *et al.* (2016) was derived in the experimental range 0.1–1 (below this range, the experimental formula in Equation (8) would not be physically consistent).

### The WDN case study

To further test the methodology first presented in Cimorelli *et al.* (2018) and herein extended, a more challenging WDN was considered (Figure 2). The chosen WDN was already used by Jowitt & Xu (1990) for optimal valve positioning and by Fecarotta & McNabola (2017) for optimal PAT's selection, positioning, and setting.

The network (Figure 2) has 22 nodes and 36 links, and it is supplied by three reservoirs. Following the related literature, user's demands (Figure 3) and leakages were concentrated at the network joints, and a value of (Equation (13)) equal to 1.18 was considered (Araujo *et al.* 2006). More details regarding the WDN can be found in the supplementary material provided by Fecarotta & McNabola (2017).

Three different pumps (Xylem-Lowara catalog) were considered to test the optimizer, and their characteristics at the BEP in the direct mode are reported in Table 1.

. | η_{bp}
. | Q (m_{bp}^{3}/s)
. | H (m)
. _{bp} | Characteristic speed (rpm) . |
---|---|---|---|---|

PAT-Type 1 | 0.81 | 44.03 | 33.6 | 3,000 |

PAT-Type 2 | 0.787 | 50.55 | 25.9 | 3,000 |

PAT-Type 3 | 0.755 | 71 | 31.5 | 3,000 |

. | η_{bp}
. | Q (m_{bp}^{3}/s)
. | H (m)
. _{bp} | Characteristic speed (rpm) . |
---|---|---|---|---|

PAT-Type 1 | 0.81 | 44.03 | 33.6 | 3,000 |

PAT-Type 2 | 0.787 | 50.55 | 25.9 | 3,000 |

PAT-Type 3 | 0.755 | 71 | 31.5 | 3,000 |

Hereinafter, the three types of pumps will be labeled as PAT-Type 1, PAT-Type 2, and PAT-Type 3. These three pumps working in the inverse mode were selected in order to cover the whole *H*–*Q* range of the four selected links. For the sake of clarity, the number of PAT used will be indicated before this label (e.g., 3 PATs when three PATs are employed, followed by the ‘type’ if required). Finally, energy and water tariffs were set to 0.22 €/kWh and 0.30 €/m^{3} (Fecarotta & McNabola 2017), respectively.

## APPLICATION OF THE PROPOSED METHODOLOGY

According to Fecarotta & McNabola's (2017) optimization of the tested WDN, the optimal number of PATs is 4, while the best locations to install the PATs are links 2, 18, 20, and 30 (as expected, all the water delivered to users and lost as leakage must necessarily flow through these links). In order to extend the results to a broader context, we also considered a lower number of PATs. However, we did not consider all possible combinations of PATs and related positions to avoid redundancy. Indeed, the proposed algorithm deals with the optimal setting only, when PAT's number, location, and type are assigned. Therefore, the identification of the best machine type as well as the related optimal position are well beyond the scope of the present work. Indeed, the scope of this work is different, as we aim to investigate how the proposed method works and if it might be suitable to be used as an internal optimizer within a more general hybrid GA. Therefore, for each PAT, the optimizer was tested and applied to four different cases (links 18; 18 and 2; 18, 2, and 20; 18, 2, 20, and 30). Simulations were performed using a 64 bits 3.1 GHz Intel Core i5-4440 CPU with 4 GB of RAM, and each simulation took about 1.3 s. Moreover, all these cases were tested maximizing energy and saved water costs (referred to as *E* + *W*) and energy costs alone (referred to as *E*). Results are reported in Table 2. To better understand the results, the cost of the water saved from leakage *C*_{w} and the cost of the produced energy *C*_{E} are calculated separately and indicated as *C*_{w}_*E* and *C*_{E}_*E* when only energy is considered within the OF, and as *C*_{w}_*E* + *W* and *C*_{E}_*E* + *W* when both energy and saved water are considered within the OF.

. | . | . | PAT-Type 1 . | PAT-Type 2 . | PAT-Type 3 . |
---|---|---|---|---|---|

1 PAT | E + W | Volume (m^{3}) | 965.52 | 961.86 | 958.28 |

Energy (kWh) | 0.63 | 0.57 | 0.35 | ||

Total cost (€) | 289.79 | 288.68 | 287.56 | ||

E | Volume (m^{3}) | 957.75 | 952.18 | 946.39 | |

Energy (kWh) | 2.01 | 2.18 | 2.36 | ||

Total cost (€) | 287.77 | 286.13 | 284.44 | ||

2 PAT | E + W | Volume (m^{3}) | 1,078.44 | 1,053.48 | 1,024.97 |

Energy (kWh) | 3.54 | 1.65 | 0.96 | ||

Total cost (€) | 324.31 | 316.41 | 307.70 | ||

E | Volume (m^{3}) | 1,036.76 | 1,007.17 | 986.91 | |

Energy (kWh) | 7.07 | 5.66 | 5.01 | ||

Total cost (€) | 312.58 | 303.40 | 297.18 | ||

3 PAT | E + W | Volume (m^{3}) | 1,186.07 | 1,242.22 | 1,307.64 |

Energy (kWh) | 9.3 | 5.39 | 18.92 | ||

Total cost (€) | 357.87 | 373.85 | 396.45 | ||

E | Volume (m^{3}) | 992.04 | 1,039.08 | 1,195.5 | |

Energy (kWh) | 5.79 | 8.87 | 20.85 | ||

Total cost (€) | 298.89 | 313.68 | 363.24 | ||

4 PAT | E + W | Volume (m^{3}) | 1,139.91 | 1,300.73 | 1,368.68 |

Energy (kWh) | 12.93 | 27.58 | 39.07 | ||

Total cost (€) | 344.82 | 396.29 | 419.20 | ||

E | Volume (m^{3}) | 1,310.49 | 1,167.24 | 1,342.55 | |

Energy (kWh) | 38.04 | 29.09 | 53.2 | ||

Total cost (€) | 401.52 | 356.57 | 414.47 |

. | . | . | PAT-Type 1 . | PAT-Type 2 . | PAT-Type 3 . |
---|---|---|---|---|---|

1 PAT | E + W | Volume (m^{3}) | 965.52 | 961.86 | 958.28 |

Energy (kWh) | 0.63 | 0.57 | 0.35 | ||

Total cost (€) | 289.79 | 288.68 | 287.56 | ||

E | Volume (m^{3}) | 957.75 | 952.18 | 946.39 | |

Energy (kWh) | 2.01 | 2.18 | 2.36 | ||

Total cost (€) | 287.77 | 286.13 | 284.44 | ||

2 PAT | E + W | Volume (m^{3}) | 1,078.44 | 1,053.48 | 1,024.97 |

Energy (kWh) | 3.54 | 1.65 | 0.96 | ||

Total cost (€) | 324.31 | 316.41 | 307.70 | ||

E | Volume (m^{3}) | 1,036.76 | 1,007.17 | 986.91 | |

Energy (kWh) | 7.07 | 5.66 | 5.01 | ||

Total cost (€) | 312.58 | 303.40 | 297.18 | ||

3 PAT | E + W | Volume (m^{3}) | 1,186.07 | 1,242.22 | 1,307.64 |

Energy (kWh) | 9.3 | 5.39 | 18.92 | ||

Total cost (€) | 357.87 | 373.85 | 396.45 | ||

E | Volume (m^{3}) | 992.04 | 1,039.08 | 1,195.5 | |

Energy (kWh) | 5.79 | 8.87 | 20.85 | ||

Total cost (€) | 298.89 | 313.68 | 363.24 | ||

4 PAT | E + W | Volume (m^{3}) | 1,139.91 | 1,300.73 | 1,368.68 |

Energy (kWh) | 12.93 | 27.58 | 39.07 | ||

Total cost (€) | 344.82 | 396.29 | 419.20 | ||

E | Volume (m^{3}) | 1,310.49 | 1,167.24 | 1,342.55 | |

Energy (kWh) | 38.04 | 29.09 | 53.2 | ||

Total cost (€) | 401.52 | 356.57 | 414.47 |

When the optimization of the produced energy is considered alone (*E*), the energy production is higher than in the case of the maximization of both energy and saved water costs (*E* + *W*). Indeed, water costs are higher than energy costs, and the optimizer tends to set the PATs to working conditions where priority is given to pressure reduction rather than energy production (which, in turn, depends on the PAT efficiency at the specific working condition). It is interesting how the saved water difference (*C*_{w}) between cases (*E*) and (*E* + *W*) does not show a specific trend, as the number of PATs increases. Furthermore, the difference between the costs of saved water volumes (*C*_{w}) is indeed small if compared to the difference between the energy produced. As the costs of water (*C*_{w}) are higher than those of the energy alone (*C*_{E}), the optimizer tends to maximize leakage reduction, while in the *E* cases, even though the optimizer is only aiming at the maximization of the produced energy, water savings (*C*_{w}) are still considerably high and not negligible at all.

When only 1 or 2 PATs are employed, energy production is low, as the flow rate reduces due to the presence of the PATs along the links and redistributes among the links where PATs are not installed. Indeed, there is an appreciable difference between the energy produced (*C*_{E}) between the cases with 1 and 2 PATs and the cases with 3 and 4 PATs. In the last two cases, most of the water is forced to flow through the PATs, thus producing more energy.

The inspection of Table 2 further highlights another important aspect: the choice of the machine highly influences the optimal result. Therefore, the PAT selection is as important as its setting.

The best solution was obtained employing 4 PAT-Type 3 at links 18, 2, 20, and 30. In Figure 3, the hourly costs of energy and saved water are depicted for both *E* and *E* + *W* cases. The optimization performed considering both energy and saved water costs is actually able to capture the maximum of the cost of saved water (*C*_{w}_*E* + *W*) in every time interval, except for those where the demand coefficient is equal to 0.8 and 1.4. Here, maxima obtained considering both energy and saved water costs are slightly lower than the ones computed by maximizing the energy production alone (*C*_{w}_*E*). On the other hand, the energy cost obtained by the maximization of both energy and water costs (*C*_{E}_*E* + *W*) is always lower than when maximizing energy alone (*C*_{E}_*E*). This occurs because the presence of leakages and the flow redistribution through the WDN links (caused by the concentrated head losses through the PATs) make the OF very noisy when both energy and saved water costs are maximized. Conversely, the OF is less noisy when energy maximization only is considered.

The ratio between the hourly efficiency of the PATs obtained in cases *E* + *W* and *E* for the corresponding PATs of the two best solutions is reported in Figure 4, while the efficiency values for the two optimization cases are reported separately in Figure 5.

From the inspection of Figure 4, the ratio between the efficiencies is less than unity 67 out of 94 times, meaning that, in general, the solution obtained by maximizing energy alone tends to set the PATs to higher efficiency values. Indeed, water costs prevail when energy and saved water are both maximized (case *E* + *W*); therefore, the optimizer tends to dissipate as much energy as possible to reduce leakages, setting the PATs to a working condition with lower efficiency (Figure 5). Indeed, efficiencies obtained in the *E* case are, in general, higher than those of *E* + *W*. Furthermore, the PATs with higher efficiency change between the two cases (Figure 5). For example, PAT 1 (link 18) and PAT 2 (link 2) are those with lower efficiency in the *E* + *W* case, while in the *E* case, they exhibit higher efficiency than PAT 3 (link 20) and PAT 4 (link 30) most of the time (Figure 5). This further highlights the complex flow redistribution within the WDN occurring when changing PAT's setting.

Finally, it is worth nothing that in the *E* + *W* case, the PAT in link 30 is bypassed at hours 9, 10, 11, and 12, while in the *E* case, PATs are never bypassed. This occurs as water demands are higher in these hours. This implies a higher energy dissipation, as more water is flowing through the pipes, thus inducing an overall pressure reduction in the WDN, resulting in leakage reduction. Therefore, the optimizer tends to bypass one of the PATs, forcing the flow to pass through link 30, increasing energy dissipation within this link. As *C*_{w} is higher than *C*_{E}, the optimizer tends to give priority to the saved water rather than to energy production by bypassing the PAT in link 30. Conversely, all PATs are working continuously in case *E* because produced energy is the only objective to maximize.

These results show how complex the flow redistribution could be when leakages are introduced within the OF, making the optimization of both energy and saved water costs a harder task than the energy maximization problem alone. However, the proposed algorithm proved to be robust, efficient, and capable of providing good quality solutions. For its promising capabilities and ease of implementation, the presented method showed to be suitable for hybrid optimization algorithms (e.g., GAs combined with the present model) capable of optimizing position, machine selection, and setting at the same time.

## CONCLUSIONS

In this work, a nonlinear programming algorithm for the optimal setting of PATs within WDNs was extended to the case of leakage reduction. The results highlighted that the presence of leakages makes the OF noisier than the case where no leakages are considered, making this optimization problem particularly challenging for future developments. However, given the direction, position, and type of a prescribed number of PATs, the proposed method showed to be capable of maximizing the sum of energy and saved water volumes costs. Furthermore, the tests performed showed that the selection of the PAT has a remarkable influence on the optimization results; therefore, this problem should be considered as important as the setting problem.

The proposed algorithm showed promising capabilities, and it is well suited for utilization in hybrid GAs aiming at providing the optimal number, position, direction, type, and setting of PATs within a WDN to simultaneously maximize energy production and minimize leakages.

## ACKNOWLEDGEMENT

The work of the second author (A.D.) was financially supported by the fund ‘PON Ricerca e Innovazione 2014-2020, Asse I, Investimenti in Capitale Umano, Avviso AIM – Attrazione e Mobilità Internazionale, Linea 1’ (CUP E61G18000530007).

## REFERENCES

*EPANET 2 Users' Manual*. U.S. Environmental Protection Agency, Cincinnati