Stochastic Approach for Optimal Positioning of Pumps As Turbines (PATs)

: A generic water system consists of a series of works that allow the collection, conveyance, storage and ﬁnally the distribution of water in quantities and qualities such as to satisfy the needs of end users. In places characterized by high altitude differences between the intake works and inhabited centres, the potential energy of the water is very high. This energy is attributable to high pressures, which could compromise the functionality of the pipelines; it is therefore necessary to dissipate part of this energy. A common alternative to dissipation is the possibility of exploiting this energy by inserting a hydraulic turbine. The present study aims to evaluate the results obtained from a stochastic approach for the solution of the multi-objective optimization problem of PATs (Pumps As Turbines) in water systems. To this end, the Bayesian Monte Carlo optimisation method was chosen for the optimization of three objective functions relating to pressure, energy produced and plant costs. The case study chosen is the Net 3 literature network available in the EPANET software manual. The same problem was addressed using the NSGA-III (Nondominated Sorting Genetic Algorithm) to allow comparison of the results, since the latter is more commonly used. The two methods have different peculiarities and therefore perform better in different contexts.


Introduction
In the last decades, awareness of the scarcity of energy sources and the impact of anthropogenic activities on the environment has increased. Water systems involve a complex infrastructure that constantly faces the challenge of providing a high quality but economically sustainable service. In recent decades, efforts have been made to this end, as interest in adopting a sustainable perspective is growing in this field. However, due to the changing elevation of the land, energy consumption, mainly in the supply phases, assumes a critical role among the cost items. In fact, it is estimated that only 30-60% of the energy used is utilized for supply to end users; the remaining portion, 60-40%, is lost due to head losses [1].
In the literature, there are numerous studies that propose analyses and solutions to improve energy efficiency [2][3][4] and the environmental impact in terms of CO 2 produced [5][6][7]. Moazeni et al., 2021 [8], proposed solutions for reducing the energy needs and consumption of water systems, one of which consists of energy recovery through the inclusion of PATs. To this end, two optimization models were used: the first aims to optimize the number and position of the PATs, and the other aims to optimize the water demand by minimizing the electrical and water loads. Creaco et al., 2020 [9], proposed a bi-objective optimization for the installation of PATs to find optimal solutions between installation costs and generated hydropower by means of a genetic algorithm and an inner optimization sub-algorithm that provides for the regulation of PAT settings. Water losses are another sore point for water distribution systems (WDS), and a common solution is to use PRVs (Pressure Reducing Valves) to manage and minimize pressures. However, the dissipation generated by the valves can also be used to generate hydroelectric power. Giugni et al., 2014 [10], proposed a study in which the insertion of PATs was foreseen to exploit the excess pressures and produce energy; to this end, it used an algorithm, with two distinct objective functions, for optimal positioning in order to, in one case, minimize losses while maintaining the PRVs and, in the other, to maximize energy production by replacing them with the PATs, comparing the results. Tricarico et al., 2018 [11], proposed an optimization-based methodology for minimizing the surplus pressure at network nodes and the operational pumping costs and maximizing the income generated through energy recovery. Mitrovic et al., 2021 [12], presented a methodology using the classical hydraulic regulation scheme with the Nedler-Mead simplex direct search algorithm to search for the optimal solution with regard to the available centrifugal PATs on the market.
Other authors [13,14] provided for the inclusion of PATs instead of PRVs, also integrating a cost-benefit analysis, in which the installation and management costs of the turbine were compared with the economic savings due to the production of energy and the reduction of water losses.
In order to creating a sustainable water system, capable of producing and recovering hydroelectric energy and at the same time helping to reduce greenhouse gas emissions, this study presents a new optimization model to strategically position PATs (Pumps As Turbines) to obtain the best yields and therefore the greatest gains from hydroelectric power generation; it also includes an economic evaluation. The multi-objective problem has the purpose of optimizing three functions: the first relates to the management of pressures in the pipeline, the second relates to the energy production of the installed turbines and the third relates to the system costs incurred. As discussed above, previous studies in the literature have employed only genetic algorithms for the solution of the PAT position optimization problem. This study aims to investigate the applicability of stochastic methods, specifically, the Bayesian Monte Carlo simulation method, and evaluate their performance. Subsequently, a genetic algorithm, NSGA-III, was used to compare the results and evaluate the performance of both approaches in the different scenarios proposed.
The model was applied to a synthetic network of literature, namely Network 3, one of the water distribution networks present in the EPANET open-source software manual [15].
This study is an important tool for those who intend to approach this topic for the first time in an effort to understand which approach is more efficient for individual case studies.

Case Study: Network 3
Network 3 is one of the water distribution networks present in the EPANET freeware package. The original version of the net is made up of 117 tubes of different diameters and 92 junctions, 2 reservoirs, and 3 storage tanks, through 2 pumping stations subject to a flow rate of 24 h. Furthermore, the units of measurement refer to the US Unit System.
In the present case, the SI Unit System and a modified version of the network were used, where eight network nodes are configured as 4-way junctions. This modification was implemented for the first time by   [16,17] to study the mixing phenomena within the water network, introducing special joints such as two crossings, two double tees, one joint of type YU and three joints of type YN [18]. To ensure that only pipes of the same size entered and exited the special joints, the mesh was provided with extra knots around each joint, along with a short length of added pipe.
Furthermore, in this new configuration, the two pumping stations were eliminated by elevating the two reservoirs (putting the water level 20 m higher than the original), to be able to evaluate the optimization of PATs. Figure 1 shows the scheme of the network implemented within the standard EPANET version.

Method
Numerous types of micro-turbines able to be used in water supply networks have been presented in the technical literature, each with advantages and disadvantages, not only for plant engineering but also for economic and management aspects [19,20].
The use of PATs that use the engine as an electric current generator can be advantageous for various reasons, both from an economic point of view, as the market offers lower prices for pumps than hydraulic turbines, and from a plant management point of view, since the pumps have simpler mechanics and require less maintenance. The use of this system in the simulation results in a lower cost to be incurred, with the possibility of obtaining a greater profit; on the other hand, the determination of the PAT yield curves is very onerous, with results that may not provide the advantages discussed above. Furthermore, despite the PAT adapting to plant requirements, the use of these turbo machines often does not guarantee the health conditions of the water flowing in the pipeline, since the outlet into the atmosphere, leaving the turbine, can lead to an increased risk of contamination.
However, the considerable economic convenience of PATs in the production of hydroelectric energy has made them highly applicable.
The PATs can be inserted both along the inlets that carry water from the sources to the inhabited centres to cope with topographical differences in height, as well as within the water networks, replacing the regulation and pressure reduction valves. In the first case, the head-flow couple is rather constant over time, because the flow circulating in the external aqueducts is constant. In the second case, however, the variability of hydraulic conditions is much more extensive; furthermore, due to the link between flow rate and pressure drops, the curve describing the head available for energy reconversion as a function of the flow rate is monotonous and decreasing.
In the present study, the turbines were positioned both inside the water distribution network and externally in the supply system. The following sections present the proposed optimization model, a description of the case study, the results obtained, and the conclusions drawn.

Bayesian Monte Carlo Method
The optimization problem was solved using the Bayesian Monte Carlo (BMC) optimisation method, which is based on probabilistic procedures and allows solving problems that present analytical difficulties that are not otherwise difficult to overcome [21].
Conceptually, the method is a stochastic modification of the classical unsupervised Monte Carlo random sampling. The BMC is based on the possibility of performing a sampling of an assigned probability distribution (prior probability), F(X), which is the representation of the initial beliefs of the operator with respect to the maximisation or minimisation of objective functions. Instead of using a unique sample of events drawn at random in the prior distribution, the total number of simulations is divided into stages based on a well-determined iterative process in which posterior distributions (after the completion of the stage) are updated from prior ones based on Bayes' theorem likelihood estimation; the posterior distribution is then adopted. In a multi-objective optimisation, the likelihood estimation is based on the extended domination (EI) rule, by which the posterior distribution is updated based on the ability of individuals of each stage to update the Pareto front [21].
The BMC method returns reliable answers in the study of complex and computationally demanding systems, although the solution obtained is never exact in a statistical sense, as it is subject to uncertainty, which decreases as the size of the statistical sample increases.
In the present case, the BMC method was used to solve the optimization problem for the positioning of up to eight PATs within the literature network, namely Network 3.
The BMC simulation was performed on a total of 10,000 function evaluations (divided in 10 stages of 1000 evaluations), optimizing three objective functions concerning the total management and operating costs of the water network (TC), the management of the pressures in the pipeline and the power produced by the turbines (PWI) and therefore the gains from total energy production (TE) [22]. Starting from a Gaussian prior distribution, at each stage, posterior distribution was mediated from the prior one by means of Bayes' law and estimating likelihood as the EI criterion.
It is important to note that the decision variables are not binary but positive constrained real numbers, as PAT power has been optimized, making the initial hypothesis that each pipe can, in principle, be used for energy production. Furthermore, from a hydraulic point of view, PATs are not substituted for pipes, so the network maintains the same hydraulic behaviour and performance, except for the introduction of local hydraulic energy losses due to the presence of the PAT, which is introduced at the pipe middle point.

NSGA-III
In order to be able to evaluate the performance of the previously presented method, the optimization problem was subsequently solved using the genetic algorithm NSGA-III [23]. The latter differs from the genetic algorithm NSGA-II with respect to the selection operator, in that diversity among members of the population is ensured by the provision and adaptive updating of a number of well-known reference points [24].
The algorithm was applied to both the above networks, optimizing the three objective functions as explained in the following section.
This was done by running 100 generations, each having a population of 100 individuals and a 20% crossover and mutation rate (so in the end having the maximum number of function evaluations of the BMC method). In addition, a condition was set such that if the target function for each generation is less than 0.1%, the simulation is aborted.

Objective Function
The objective function TC is a function to be minimized and is calculated as reported in Equation (1), where N t corresponds to the number of installed turbines, C Kt is the cost of the single j-th turbine, and C Kinv is the cost of the k-th inverter.
The latter can be determined as in Equation (1) and Equation (2), in which, respectively, the effective power of the turbine P kW is multiplied by the cost factor of the turbine K c and the useful hydraulic load exploited by the turbines H 0 , and by the cost factor of the inverter K inv . According to Leyland, 2014 [25], for Banki turbines and in the presence of small plants, with energy production below 100 kW, the cost factor is equal to 3 × 10 6 , while that of the inverter is equal to 1.8 × 10 5 .
The objective function PWI (pressure weighted indicator), to be maximized, concerns the management of the pressures in the network; in particular, the difference between the pressure at the i-th node and the minimum allowed in the pipeline must be as low as possible in order to guarantee a regime of almost constant pressure capable of guaranteeing the highest possible load to the turbines and ensuring the users continuous water availability with adequate pressure. For the calculation of this function, an indicator parameter of the pressures P r is introduced, representative of the pressure value recorded on each i-th node of the network in each single time interval, normalized by the value of the basic demand on each i-th node of network BD i in Equation (4).
The pressure penalty indicator P r can be determined as in Equation (5), where P i,t is the pressure of the i-th node at the considered time t, subtracted from the minimum sufficient quantity P 0 = 200 kPa. This parameter can assume values between 0 and 1 (as shown in Figure 2), which can be determined by means of the relations of Equation (6), Equation (7) and Equation (8). The latter represents the optimal value of the pressure indicator parameter that occurs at a minimum pressure in the pipeline of 200 kPa, a minimum value sufficient to guarantee water supply to the users. Considering that each simulation is made by 24 timesteps and the network is provided with 59 internal nodes (in which the base demand assumes a value other than zero), the maximum theoretical value of the indicator is equal to 1416.
The objective function TE to be maximized, relating to the power produced by the turbines Equation (9) is calculated for all the time intervals of the simulation T, considering the number of installed turbines N t , the power produced by the single j-th turbine (kW/h) J j , the tariff of sale of the energy of the j-th turbine (€/kW/h) c j and the operating time t f equal to 1 h.
The power produced by the individual turbines was calculated as the product of the specific weight of the water γ at 20 • , equal to 998.2 (kg/m 3 ), the delivered flow rate (m 3 /s) Q, the head losses/useful head of the turbine (m) ∆H, turbine efficiency η t and gravity acceleration g (m/s 2 ) in Equation (10).

Results and Discussion
In this section, the results from the experiments described above are collected and processed. The case with three PATs in the network was considered, as it was the best compromise between PAT implementation costs and generated energy. The BMC simulation was performed on a total of 10,000 function evaluations, being able to provide results that were arranged on a Pareto front so as to be able to relate the different objective functions to each other.
The presence of two sources that feed both the three storage tanks and some of the users directly, the simultaneous operation of the two pumping stations, which involves a changing trend of the pressures in the network, and a water demand that is not constant in some nodes, makes the hydraulic behaviour of the case study particularly articulated.
The results of the BMC simulation were processed within the Pareto fronts representative of the tenth stage of the BMC approach (Figure 3). For reference, the Pareto front after the third and the sixth stage was drawn from the objective pressure-energy functions. The enhancement in the non-domination criterion is sensibly constant from one stage to the next, thus showing the potential of such a method when a small number of function evaluations are possible due to computational costs.  Figure 4 shows a similar graph for the GA optimisation after 30, 50 and 100 generations (to compare the methods with the same number of function evaluations). Initial improvement of the method with respect to the EI criterion is significantly better with GA with respect to the Bayesian approach, but after 10,000 evaluations, the two methods have approximately similar Pareto fronts, with very small differences. In the same way, by relating the objective pressure-cost functions, the results determine a scattered Pareto front ( Figure 5). In this comparison, NSGA-III provides a much more continuous investigation of the Pareto front, and this is in line with the principal peculiarities of the method (Figure 6). Once again, the two methods are characterised by similar results after 10,000 evaluations.  Finally, the graphics in the Figures 7 and 8 show the trend of PAT cost in relation to the energy production of the turbines installed on the network. The cost of installation and the generated energy growing in tandem on the Pareto front, and this is physically reasonable.  Contrary to genetic algorithms that exploit the potential of genetic evolution, the main feature of BMC simulation, to solve the optimization problem, is that the objective function evaluations are independent of each other, and their selection is based solely on prior belief of a good performance (provided that belief is updated at each stage). In this case, the best solutions are collected that optimize the individual functions analysed. The first solution is in reference to the minimisation of the system costs to be sustained; the second solution relates to maximizing the index of pressures in the network (the greater the sum of the pressure indices, the lower the pressures present in the network, with consequently less energy waste); the third solution relates to the highest energy production from turbines. Table 1 shows the results, and Figure 9 shows the respective positions of the PATs in the water network.  A further processing of the data obtained from the simulation concerns energy production and the related plant cost, comparing the relative position of the turbines (Table 2). From the results obtained, we can see that as the energy produced decreases, the related plant costs depend not only on energy production but also on the arrangement of the turbines. In fact, pipelines affect the expenditure to be incurred, and in some cases, even though the production is lower, the related costs are much higher. Furthermore, it can be noted that some pipelines allow greater energy production by configuring the hydraulic system of the network similar to a hydroelectric plant, i.e., with a more stable management of the pressures in the pipeline (see the case of pipeline number 233, always present with higher production values). In the case in question, the second solution proposed in the table is more efficient in terms of energy costs; this undoubtedly represents one of the privileges of using optimization methods: the analysis of the results in fact provides a solution to the decision-making problem that considers the cost-benefit concept and that is important in the creation of a work. The simulations have in fact recorded a maximum energy production of about 4.6 MWh, proof of the fact that energy recovery from water networks can guarantee good profit margins by the managing body.

Conclusions
This study was carried out to determine the optimal position of micro turbines to be installed within a city water network by carrying out a cost-benefit analysis in order to make the system more sustainable from an energy point of view. To this end, a new multiobjective turbine optimization approach was formulated using the Bayesian Monte Carlo random simulation method, a stochastic modification of the classical unsupervised Monte Carlo random sampling. The aim was also to evaluate whether a stochastic approach is well suited for solving this type of optimization problem, rather than genetic algorithms, as have already been used in other studies.
The multi-objective problem was characterized by the optimization of three functions relating to the management of pressures in the pipeline, the energy production of the installed turbines and the related system cost to be incurred.
The data collected by the BMC simulation highlighted an optimization of the objective functions in a random manner, obtaining excellent results every time, only for a single function. The simulation in fact returns the optimal positions of the hydraulic turbines; however, the optimization of a function corresponds to an uninteresting value of the other objective functions. The general use of genetic algorithms does not have these difficulties; however, the genetic algorithm shows difficulties in the stretches in which the pressures are not constant. This limit is overcome by the stochastic approach, which can therefore be considered more suitable for internal water distribution networks; on the contrary, the NSGA-III is suitable for external aqueducts in which there are no sudden changes in pressure.
The results obtained showed that the energy recovery process in the water networks is strongly characterized by the arrangement of the turbines; with the same energy, the costs to be incurred in the construction of the system take on very different values as determined by the location of the turbines at different points.
The possible developments of the research are, above all, the hydraulic complexity of the water networks, which, due to the high variability of flow rates required by the users, as well as to the presence of several pumping stations or storage tanks and the presence of any water leaks on the net, bring greater complications the more the network becomes articulated.

Conflicts of Interest:
The authors declare no conflict of interest.