1 Introduction

Population growth and urbanization have increased water demand significantly. As a result, the proper design of water distribution networks is of paramount importance to maintain the water supply cost at reasonable levels and to reduce the significant greenhouse gas emissions that are produced during energy demanding water treatment and pumping operations (e.g., Fecarotta and McNabola 2017). As water distribution networks grow in size and complexity, maintaining the pressure in the network within certain limits becomes challenging. Pressure needs to be high enough to satisfy customer needs but should not exceed an upper limit to avoid excessive leakages and infrastructure damage. Water distribution networks are notoriously inefficient, as leakage and friction losses dissipate a large portion of the energy that is utilized for water distribution.

Since water demand is not uniformly distributed throughout a day and a water distribution network is designed to be able to provide water uninterruptedly during peak hours, an excessive pressure will be inevitably observed during parts of a day. A widely applied solution to lower the pressure of the system and maintain it to acceptable levels is the usage of pressure reducing valves (PRVs) that dissipate energy. Another option is to use micro-turbines and exploit this pressure redundancy to harness energy from the system. Particularly, pumps as turbines (PATs) (Jain and Patel 2014) offer a relatively low cost and easy to implement solution for such purposes (Garcia et al. 2019) Given that the adverse environmental impacts of dams pose limitations on the construction of new hydropower plants, small-scale hydropower such as those that can be installed within a water distribution network may offer a more ecofriendly alternative (Kougias et al. 2019). Perez-Sanchez et al. (2018) demonstrated the economic viability of including PATs in water distribution networks, while Muhammetoglu et al. (2018)reported a successful installation and operation of a PAT system in an actual city water distribution network. The power production potential of PATs can be further exploited with effective design of suitable water energy storage and proper management of the excess energy (Pasha et al. 2020).

The most efficient placement of turbines and the maximum energy that can be extracted from a water distribution network constitute a complicated optimization problem, which has recently drawn a lot of attention. The goal is to harness the maximum available excess energy from the water distribution network and simultaneously maintain a minimum pressure within the network, within other hydraulic constraints. Giugni et al. (2014) and Lima et al. (2017) showed that the optimal locations of PATs for maximum energy production in a synthetic water distribution network do not necessarily correspond to the optimal locations of PRVs for maximum pressure reduction. Nonetheless, PATs are able to additionally reduce the network pressure significantly and almost as much as the PRVs (Giugni et al. 2014). Several optimization studies have focused on the efficient placement of turbines in a water distribution network, based on different criteria and constraints. To satisfy the requirement for a minimum pressure at the nodes of the network, Giugni et al. (2014) used genetic algorithms and added a penalty term in the objective function for the maximization of PAT generated power. Nguyen et al. (2020) introduced constraints in mixed-integer nonlinear programming to ensure a minimum power production by PATs and avoid low energy production and discontinuous operation. Corcoran et al. (2016) observed that mixed integer nonlinear programming performed better than genetic algorithms in terms of maximizing energy generation, while Fecarotta and McNabola (2017) presented an optimization model with an objective function that included the turbine installation costs, the savings due to leakage mitigation, and the production of energy from PATs. Morani et al. (2021) included both PRVs and PATs in a network and optimized their positioning with mixed integer non-linear programming to maximize the energy production and water savings. Samora et al. (2016) developed an optimization model based on simulated annealing that was able to determine the location of a given number of turbines in a sub-grid of the water supply network of Lausanne, Switzerland, with respect to hourly flow variation and its effect on turbine efficiency. Sambito et al. (2021) used Bayesian Monte-Carlo multi-objective optimization to determine the optimal positioning of PATs in a water distribution network with respect to pressure, produced energy and plant costs. Similarly, Lima et al. (2017) used another stochastic optimization algorithm, particle swarm optimization, for the selection and proper placement of PATs in a water supply network. Based on a parallelized evolutionary algorithm, Tricarico et al. (2018) considered the optimal placement of PATs in a water distribution network by maximizing the income related to power generation and minimizing the excess pressure in the network and the operational pumping costs. Coelho and Andrade-Campos (2018) added a financial feasibility analysis after the optimal placement of PATs with respect to maximum energy production. They showed that the return period of such an investment depends on the type of the turbines and the network characteristics.

The placement of a PAT or a PRV in a water distribution network leads to discharge redistribution within the network (Walski 2017) that can be beneficial to other turbines (Morani et al. 2021) for energy production as long as they are properly located in the network. By taking into account the effects of PATs on discharge redistribution, we are able to reduce significantly the number of configurations to be tested based on a deterministic approach, since the redistributed discharge will not increase the energy production of every turbine in the network. This study considers these discharge redistribution effects as an integral component of maximizing power generation and presents a new heuristic methodology for the determination of the number and locations of PATs in water distribution networks based on nonlinear programming. Another objective of this paper is to investigate the effect of the prescribed minimum pressure value of the water distribution network on power generation. Most studies so far have chosen just one prescribed minimum pressure head, \({H}_{\mathrm{min}}\), that usually corresponds to local regulations and ignored its effect on power generation.

2 Methods

2.1 Hydraulic Model and Optimization

The flow in the considered hydraulic networks is modelled using a mass balance equation at each node and a steady-state Bernoulli equation for each pipe. Frictional head losses are taken into account, as well as the head that is exploited by each PAT. A complete description of the hydraulic model is provided in Supplementary material 1, while Supplementary material 2 details the computations of the heads that are exploited by PATs and the corresponding power.

Since manufacturers tend to provide little information about the efficiency of pumps when they are used in reverse mode as turbines, the discharge Qbt and head difference Hbt at best efficiency point (BEP) of PATs were deduced from the characteristics of pumps at BEP (Yang et al. 2012). In a given pipe of the network, the relative turbined discharge, qt, is defined as the ratio of the turbined discharge, Qt, to the discharge Qbt at the BEP of the considered PAT. In line with Barbarelli et al. (2017), the ratio of the head difference at the operating point to the head difference at the BEP and the ratio of the generated power at the operating point to the generated power at the BEP were estimated by polynomial equations as functions of qt. The equations used are detailed in Supplementary material 2.

For a given number of turbines in the network, the maximal energy extracted from the network is obtained by minimizing the following objective function F:

$$F=-\sum_{k=1}^{{N}_{t}}{P}_{{t}_{k}},$$
(1)

where Nt is the considered number of turbines in the network.

The constraints of the optimization problem include the mass balance and Bernoulli equations, prescribed for each node and each pipe, respectively. Moreover, the head Hi at each node i of the network must remain greater than a minimum head, Hmin, to provide sufficient water pressure to recipients, and lower than a maximum head, Hmax, to avoid extensive leakages and pipe damaging, according to Hmin ≤ Hi ≤ Hmax.

The optimization variables are Qbt and κ, (see Supplementary Material) for each considered PAT, as well as the pipe discharges and the head at each node.

The optimization was carried out with nonlinear programming with an interior-point filter line-search algorithm in the IPOPT open software (Wächter and Biegler 2006) and CasADi as an interface for the computation of the Jacobian matrices of the constraints (Andersson et al. 2019).

2.2 Examined Networks and Boundary Conditions

2.2.1 Synthetic Network

The synthetic network of Jowitt and Xu (1990) is considered in this study for developing and testing the suggested methodology. This network has served as a benchmark for optimization studies on leakage reduction (Araujo et al. 2006) and energy production from micro-turbines (Giugni et al. 2014; Fecarotta et al. 2015; Corcoran et al. 2016; Fecarotta and McNabola 2017; Morani et al. 2021). The synthetic network is depicted in Fig. 1 and consists of 25 nodes, three of which are reservoirs. Each node has a specific water demand. Each reservoir head is set at 56 m. The network includes 37 pipes of various lengths and diameters, with uniform cross-section throughout their lengths.

Fig. 1
figure 1

Sketch of the synthetic network, adapted from Jowitt and Xu (1990), with node and pipe numbering

Despite the fact that this network has been extensively used in the past, there is only a limited number of solutions available in the literature. To be able to compare the results of the suggested methodology (Sect. 4), a systematic analysis is firstly executed to generate a reference dataset (Sect. 3). This analysis is carried out for a broad range of prescribed minimum heads and number of PATs in the network. The examined prescribed minimum heads range from 10 to 28 m, with increments of 2 m, and the number of PATs installed in the network varies from one to five. For each case, i.e., for a specific minimum head and a certain number of PATs in the network, the reported reference is the case with the placement of PAT(s) that generates the greatest power.

2.2.2 Real-World Network

The suggested method is also applied to a more complex case, inspired by a real-world water distribution distribution system. The considered layout of pipes is a skeletonization (Huang et al. 2019) of the water distribution network of Jockgrim, a municipality in south-west Germany. It consists of more than 400 pipes, whereas the synthetic case of Jowitt and Xu (1990) contains only 37 pipes. Figure S3 (in Supplement) shows the skeletonized network, with the pipes modelled explicitly displayed in red. The demand along the smaller pipes (in blue in Figure S3) is lumped into the water demand terms Qd prescribed at the nodes of the skeletonized network. The roughness of each pipe was determined based on the corresponding material.

Our modelling of the network takes into account three reservoirs (water towers) and a booster system that provides an outflow boundary condition. Hourly data of stored volume in the reservoirs, water production volumes and outflow at the booster system are available from 02/01/2019 to 12/03/2020. In the modelling, the water volume in each of the three reservoirs was prescribed equal to the corresponding mean water volume extracted from the available time series. The total volume of water available to fulfil the demand is also based on the available time series and is estimated at an hourly resolution from a mass balance analysis of the whole system.

The spatial distribution of the demand was not available; but the positions of consumers could be estimated from known positions of water meters. The demand per meter is taken equal to the mean volume of available water divided by the number of water meters in the network (16,646).

A detailed explanation of the modelling of the PATs is provided in Sect. 2 of the Supplementary Material. Hmin is set at 10 m, which is a standard lower bound for minimum service pressure for the users.

3 Systematic Analysis of the Synthetic Network

Before introducing the new heuristic methodology for the positioning of turbines and its application to the synthetic water distribution network described in Sect. 2.2.1, a systematic analysis of this network is carried out to estimate the generated power for every possible combination of positioning of PATs. The examined combinations include the placement of one to five PATs anywhere in the water distribution network, with the only restriction being the installation of not more than one PAT per pipe, with minimum power production of 0.05 kW. This systematic analysis is repeated for several prescribed minimum pressure heads, Hmin, ranging from 10 to 28 m at intervals of 2 m. The maximum generated power for each number of PATs and minimum pressure head in the network is obtained and stored to form a reference dataset. Subsequently, this dataset will be used to evaluate the efficiency of the suggested heuristic methodology (Sect. 5).

Figure 2 shows the variation of maximum power generation with respect to the minimum pressure value that needs to be maintained within the water distribution network and the number and placement of turbines. When only one turbine is installed in the network, the maximum power generation remains fairly constant, close to 5 kW, regardless of the minimum pressure value. For two to five turbines installed in the network there is a common trend, with the power generation exhibiting a plateau for low prescribed minimum pressure heads and after approximately 20 m getting significantly reduced with a steep gradient. The plateau implies that more energy can be harnessed from the network for the lower prescribed pressure values at the nodes. The differences in the power that is generated by the different number of turbines are much greater for low prescribed minimum pressure values as compared to the highest values where the power generation is reduced. Notably, the optimal placement of turbines changes with the variation of the minimum pressure value that needs to be maintained in the network, besides the case for one turbine. For two and three turbines placed in the network, the configurations remain the same except for the highest prescribed minimum pressure values, while for four and five turbines in the network there is a third configuration for the lowest heads.

Fig. 2
figure 2

Influence of prescribed minimum pressure head on the total power production for different PAT configurations. Legend shows the pipes in Fig. 1 where the PATs are installed

This wide variability in the turbines locations for maximal power generation (Fig. 2). This highlights that the placement of a PAT in a pipe of the network and the head losses that it induces affect the flow in other pipes of the network, increasing or decreasing the discharge accordingly. As the number of turbines in the network increases, the induced redistribution effects become more complicated and an increasing number of different turbine combinations is obtained. These redistribution effects have been discussed by Walski (2017) and will be further analyzed here.

Figure 2 shows only the cumulative increase of the generated power and it does not emphasize how the power production is distributed in the network. With the installation of additional PATs to the system, the pipes that already have PATs installed may no longer be the optimal ones (Walski 2017) and possible new combinations should be explored. Figure 3 illustrates this process by showing an example from the systematic analysis of how the discharges at specific pipes change with the addition of more PATs in other pipes. The specific example of Fig. 3 is for 4 PATs and Hmin = 12 m. For clarity, only the discharges in pipes with turbines are depicted. As shown in Fig. 3, when there are no PATs installed in the network, the greatest discharge is observed at pipe 20. The installation of a PAT in pipe 20 reduces the discharge in this pipe and redistributes the flow in the network. Following the placement of the turbine in pipe 20, the change in discharge in pipe 20 becomes negatively correlated with the change in discharge in pipes 2, 18, and 30, i.e., the discharge in these pipes increases. The second PAT is installed in pipe 18 because the discharge in this pipe increases substantially after the installation of the first PAT in pipe 20 and offers the highest potential for power production. Subsequently, the discharge reduction in pipe 18 leads again to discharge increase in every other pipe, which means that the discharge variations in these pipes are again negatively correlated with the discharge variation in the pipe where a PAT has just been installed (i.e., in this case pipe 18). The third PAT is installed in pipe 2, which has higher discharge than pipe 30 after the installation of the second PAT. The discharge decrease in pipe 2 after the installation of the third PAT is accompanied by a discharge increase in every other pipe, and, similarly, the discharge decrease in pipe 30 when the fourth PAT is installed leads to discharge increase in the rest of the pipes.

Fig. 3
figure 3

Distribution of pipe discharges for each step in the systematic analysis of the placement of four PATs in the network. The PATs are installed sequentially in pipes 20-18-2-30

4 Suggested Heuristic Methodology Based on Negatively Correlated Pipe Discharges

The systematic analysis presented in Sect. 3 revealed a pattern worth being further explored. The maximum power generation is attained from a combination of turbines that get sequentially installed in pipes that have negatively correlated discharges (Fig. 3). In other words, when a PAT is installed in a pipe, it creates a head difference and a decrease of the discharge in this pipe, which subsequently induces an increase of discharge in other pipes. This leads to favorable conditions for power extraction in the pipes with increased discharge. Such a pattern may assist the decision making process for the optimal placement of the turbines in the network. Based on these favorable discharge redistribution effects, a heuristic process is suggested. It is physics-based and deterministic.

The reciprocal feedbacks among turbines and their effects on head losses can become so complicated that considering at each step only the maximum discharge that is negatively correlated with the discharge at the pipe where the last turbine was installed may not provide the optimal solution. In fact, it was observed that selecting always the pipe with the maximal discharge (this procedure is referred to hereafter as the “main branch” of the solution), could lead to suboptimal results. This becomes more evident with increasing prescribed minimum pressure in the network. Thus, the suggested methodology is generalized by excluding every pipe which had at some step positively correlated discharge with a pipe where a turbine had just been installed. This means that the remaining pipes, i.e., those with negatively correlated discharge, are potential candidates for a turbine. As a result, pipes that were not initially considered ideal to install a turbine due to their low discharge may eventually become potential candidates because after the installation of turbines in other pipes they may end up generating more power or because their positioning in the network may redirect the flow and enhance the power production in other pipes. These combinations will be known hereafter as “secondary branches”. On the other hand, pipes that at some point exhibited high discharge may become less attractive candidates following the flow redistribution from the installation of turbines in other pipes.

An example of a secondary branch is illustrated in the second row of Fig. 4 with 1 or 2 PATs for Hmin = 10 m. In this case, following the placement of the first turbine in the pipe with the highest discharge, i.e., pipe 20, the second turbine is installed in pipe 14 despite the fact that the discharge in pipe 18 is the highest after the discharge redistribution from the placement of the first turbine in pipe 20 (Fig. 4). Evidently, after the installation of the second turbine, the discharge pattern of the network for this secondary branch (Fig. 4e) is radically different compared to the main branch at the same stage (Fig. 4c). Overall, the implementation of this heuristic approach can significantly reduce the number of potential optimal combinations to a degree where the remaining combinations can be simply examined individually. It needs to be noted that a discharge redistribution that enhances the flow in pipes with PATs, and thus the power production, can also be induced by placing PRVs at appropriate locations in the network.

Fig. 4
figure 4

Examples of the selection process of the pipes where PATs should be installed based on the discharge in the pipes. The upper row shows the main branch and the lower row shows a secondary branch of the network in Fig. 1. Blue symbols denote pipes that are potential candidates, red and purple symbols denote pipes that are no longer candidates because their discharges were positively correlated with the discharge in the pipe where the first and second PAT was installed, respectively. Black symbols represent the pipes that are no longer candidates in the secondary branch for the installation of the second PAT because in the main branch their discharges were negatively correlated with the discharge in the pipe where the second PAT was installed

An alternative approach to select a pipe for the installation of a PAT could be based on the negative correlation of mean available power, \({P}_{mean}\), in the pipe, instead of discharge. The mean available power can be evaluated for any pipe p in the network, between two nodes k and l as given by the following Equation:

$${P}_{mean,p}={Q}_{p}[({H}_{k}-{z}_{k}+{H}_{l}-{z}_{l})/2-{H}_{\mathrm{min}}]$$
(2)

In this case, the objective is to evaluate the remaining power potential in the network based on the mean available pressure head and with respect to the prescribed Hmin.

This particular definition of “available power” was introduced here because the head difference between upstream and downstream of each pipe is not representative of the potential for extracting hydropower. Indeed, this head difference may simply reflect the frictional losses through the pipe, which are in no way available for hydropower production. Graphs similar to those of Fig. 4 but based on Eq. (2) are shown in Figure S4 (in Supplement). The trends in these two figures are same.

5 Results and Discussion for the Synthetic Network

The suggested heuristic methodology is able to predict satisfactorily the maximum power generation, as can be seen in Fig. 5, where it is compared to the maximum power generation obtained from the systematic analysis of the network. The suggested methodology based on negatively correlated pipe discharges generates identical solutions with the systematic analysis for two to four PATs in the network, with only some slight differences for two PATs with 28 m minimum pressure head and four PATs with 10 m minimum pressure head. The only notable differences between the two methodologies are for five PATs in the network for which there are differences that range from 3 to 13% for intermediate to low minimum heads. The obtained results from the heuristic methodology based on power are comparable to the results obtained based on pipe discharge, besides some cases with four and five PATs where the power-based heuristic methodology underestimates the maximum extracted power (Fig. 5). These underestimations correspond to the largest values of Hmin.

Fig. 5
figure 5

Comparison of maximum produced power, P, obtained from the heuristic methodology, based on discharge and power separately, and from the systematic analysis for every number of PATs and prescribed minimum pressure head in the network

For five PATs and relatively low values of Hmin, the results of our heuristic approach seem to reach a plateau, similar to the plateau observed in Fig. 2. This is because, under these conditions, the considered arrangement of PATs is not able to exploit the whole available head to generate more power. Therefore, when Hmin is very low, the heuristic approach cannot determine the PATs positioning that generate more power and this leads to suboptimal results. The systematic approach points at other combinations of four or five turbines, not captured by the heuristic approach, leading to a little higher generated power.

The suggested methodology reduces significantly the number of potential combinations for the optimal solution. In accordance with standard results in combinatorics, the total number of possible solutions, Ni, is:

$${N}_{i}=\frac{{N}_{p}!}{\left({N}_{p}-{N}_{t}\right)!{N}_{t}!}$$
(3)

where Nt is the number of installed turbines in the network while Np is the number of pipes that can have a PAT. In the considered example with the synthetic network, Np is equal to 36 (and not 37 because pipe 37 links two reservoirs of same head and has no flow). The number of solutions to be tested with our heuristic approach is up to almost four orders of magnitude smaller than the number of all possible solutions (Figure S5 in Supplement). For example, when five turbines are to be installed in the network, less than 100 combinations should be tested with the heuristic approach, whereas all possible combinations are almost 106.

The prescribed minimum pressure value does not affect the number of potential solutions for low to intermediate values; however, for high values of the prescribed minimum pressure, the number of potential solutions becomes smaller (Figure S6). This is due to the minimum power production threshold of 0.05 kW that is required for the installation of a turbine. The value of 0.05 kW was chosen as a compromise between obtaining high accuracy optimization and reducing significantly the number of combinations to be tested with the heuristic approach.

The key role of discharge redistribution on power generation is also highlighted by the presence in the optimal solutions of some PATs which do not generate much power themselves but do enhance the production of PATs in other branches of the network by increasing the corresponding discharges.

6 Application to Case Study Based on a Real-World Water Distribution Network

For the case study based on a real-world water distribution network (Jockgrim), we compared the results of the suggested heuristic optimization (based on discharge and on power) and of the systematic exploration for the placement of one to two PATs. For a higher number of PATs, the computational cost of the systematic approach (used for comparison) becomes particularly high. Nevertheless, the heuristic methodology is also implemented for the case of the installation of three PATs in the network.

The results for one to three PATs are shown in Fig. 6. The power production found with our heuristic method based on discharge is in perfect agreement with the outcome of the systematic exploration. In contrast, the alternate heuristic method based on power predicts lower power production when a single PAT is placed in the network.

Fig. 6
figure 6

Comparison of the generated power results of the systematic approach and the heuristic approach for the real water distribution network

To enable further analysis, we report in Table S4 (in Supplement) the IDs of the pipes corresponding to the optimal positioning of PATs according to the three methodologies and for the placement of one to three PATs. For the case of a single PAT, the pipe identified as optimal by the heuristic method based on power is different than the optimal pipe from the other two methods, which is consistent with the mismatch in computed powers shown in Fig. 6. In all other cases the different methods agree.

From the pipe IDs displayed in Table S4, the location of the corresponding pipes can be found in Figure S3. In several cases, the optimal positioning corresponds simply to pipes located at the outlet of reservoirs (F4, F6 and F7); but this configuration does not systematically match the optimal positioning (see pipes L3455 for a single PAT, and pipe L4507 for two PATs).

Table S5 compares the number of tested configurations. The relative difference of the number of configurations tested in the heuristic approaches and in the systematic analysis increases significantly with increasing number of PATs in the network. To a great extent, this results from numerous pipes being placed in series in the real-world network, and the need to test them individually. Nonetheless, the benefit of the heuristic methodology rises considerably when the number of considered PATs is increased.

7 Conclusions

Water distribution networks are notoriously inefficient and as they grow bigger due to increasing demand this problem gets exacerbated. The excess energy in the network can be harnessed with the installation of PATs; however, it is hard to determine the optimal combination of PATs for the maximization of power generation. To this end, the present study suggests a novel heuristic optimization method for the efficient placement of PATs in a water distribution network. The suggested method considers that the discharge redistribution in the network that is induced by the installation of a PAT in a pipe dictates to a large degree the subsequent selection of the pipes where the rest of the available PATs will be installed. According to the suggested methodology, the pipes where PATs can be installed should have discharges that are negatively correlated with the discharge in a pipe where a PAT is installed. In other words, the installation of a PAT in a pipe leads to reduction of discharge in this pipe and to a complex flow pattern in the network, from which only the pipes where the discharge increases are considered as candidates for the next PATs. This leads to a significant reduction in the number of potential combinations of pipes where PATs can be installed, which facilitates the detection of the optimal combination.

Results show that for up to four PATs installed in a synthetic network, the new method is able to detect combinations of pipes that generate power almost equal to the maximum power that can be possibly generated, for a wide range of prescribed minimum pressure values. For five PATs, the suggested methodology provided combinations that approached the maximal generated power for intermediate to high prescribed minimum pressure values, while for the lower prescribed minimum pressure values the derived combinations generated at least 87% of the maximum possible power. This methodology was also applied with power correlations instead of discharge correlations; however, the results were slightly worse. Finally, the suggested methodology was able to determine the maximal power production in a water distribution network in Jockgrim, Germany, demonstrating the potential of this method for successful applications in real world networks.

One limitation of the study relates to the use of pump data to derive the performance characteristics of PATs. Experimental research is needed to provide more insights into the actual performance of PATs. Future work should also focus on the inclusion of installation costs, maintenance costs, and revenues in the presented methodology for the development of a complete heuristic optimization tool that maximizes the net present value of micro-hydropower production in water distribution networks.