1 Introduction

By the growth and development of human societies, the need for drinking water has been increased more than ever. The control of water leakage in WDNs is important for saving drinking water consumption. Pressure management is one of the solutions that directly affected the water leakage in WDNs. The theoretical and actual leakage from WDNs depends on the nodal pressure and as it is clear high pressure can lead to a pipe breaking and higher leakage, whereas low pressure can result in reliability reduction. However, it is necessary to preserve sufficient pressure throughout the network to ensure that consumer demands are fully provided at all nodes in a day. Pressure management is one of the effective and cheapest activities for leakage reduction in WDNs. The most common methods of pressure management include water level control in storage tanks (Nazif et al. 2010), application of Pumps operating As Turbines (PATs) or variable speed pumps (Tricarico et al. 2014; Page et al. 2017), throttle control valves (TCVs) scheduling (Gencoglua and Merzib 2017; Nhu et al. 2018), Pressure Reducing Valves (PRVs) scheduling (Nicolini and Zovatto 2009; Wright et al. 2015; De Paola et al. 2017; Samir et al. 2017) and Simultaneous valves and pumps planning (Darvini and Soldini 2015; Gupta and Kulat 2018). Water level variations in a storage tank are limited to 1-2 m, therefore it cannot be used for a varied topography. Application of variable speed pumps and TCVs is appropriate for a flat area, while, utilization of PATs is not suitable for a flat topography, however, using PRVs is one of the most common and effective methods and is suitable for each topography.

Various adjustment modes are considered to manage network pressure and leakage by applying PRVs in the researches, which include optimizing the location of valves (Savic and Walters 1995; Reis et al. 1997; Ali 2015; Samir et al. 2017), the location and setting of valves (De Paola et al. 2017) and also the number, location and setting of valves (Araujo et al. 2006; Nicolini and Zovatto 2009). This is done by using a single objective optimization algorithm (Nhu et al. 2018) or a multi-objective optimization algorithm (Nicolini et al. 2011; Gupta and Kulat 2018) with the aim of minimizing the average nodal pressure (Wright et al. 2015; Gupta and Kulat 2018), the number of valves (Araujo et al. 2006), the leakage rate (Gupta and Kulat 2018) and the cost or energy dissipation (Darvini and Soldini 2015). These researches lead to average nodal pressure and leakage reduction, energy-saving on WDNs as well as time improvement and search space of the optimization problem significantly. However, there are still weaknesses in the methodology, which are considering the Boolean logic for the pressure value and the lack of a suitable index for selecting valve location.

In some researches (Araujo et al. 2006; De Paola et al. 2017) the objective consisted in the minimization of the pressure, avoiding values lesser than 30 m in any node of the WDN. Considering of the Boolean logic for pressure values is not reasonable, because, the difference between 29.5 m and 30 m is very small in the WDN, while the value of 30 is allowable and the value of 29.5 m is not allowable. So, it is necessary to use a methodology that possesses reasonable variation for pressure values which is possible by considering the fuzzy logic for pressure values in the WDN. For this purpose, the network pressure reliability index (NPRI) proposed by Dini and Tabesh (2017) is used. On the other hand, in the valve locations problem, all pipes in the WDN can be potential locations for the valves. However, many of these locations can be ignored and hence will not be selected in the final solution. To solve this problem, it is necessary to use a valve selection process to select the best ones. For this purpose, a new Valve Selection Index (VSI) has been introduced. This paper presents a new step by step methodology to find optimal location and setting of PRVs by maximizing the NPRI index of the WDN with applying VSI index. It is developed in the MATLAB code that the PSO algorithm is used to set optimization problem and hydraulic model of the WDN is implemented in the EPANET software. The methodology is applied to a sample network and real large-scale WDN.

2 Methodology

2.1 Hydraulic Model

The hydraulic simulation of the network is performed through the EPANET software (Rossman 2000). Head loss of valves that are used to control nodal pressure and pipe flow rate in the WDN, is given by Eq. (1).

$$ {h}_k=\frac{K{Q}^2}{12.1{D}^4} $$
(1)

where hk: is head loss, K: is a head loss coefficient, Q: is flow rate and D: is a diameter of the valve. Roughness coefficient of pipes is calculated by Hazen and Williams’s equation (Williams and Hazen 1933) (Eq. (2)).

$$ {h}_f=\frac{10.68L{Q}^{1.852}}{C_{HW}^{1.852}{D}^{4.87}} $$
(2)

where Q: is flow rate, CHW: is a roughness coefficient, D and L: are diameter and length of pipe. The hydraulic simulation of the network is done in two different methods. The first one is the Demand-Driven Simulation Method (DDSM) that is assumed nodal outflows are fixed and always available at the nodes. The second one is the Head-Driven Simulation Method (HDSM) that is assumed, there is a relationship between nodal outflows and nodal pressures. In this paper, the DDSM and HDSM method is used to simulate nodal demand and nodal leakage of the network respectively.

2.2 Leakage Rate

The leakage in each node of the network is calculated by the function of flow through an orifice (Araujo et al. 2006). They are presented in Eqs. (3) and (4).

$$ {q}_j={k}_f{p}_j^{\beta } $$
(3)
$$ {k}_f=c\times \sum \limits_{j=1}^M0.5\times {L}_{ij} $$
(4)

where qj: is the leakage flow at node j, pj: is the service pressure at node j, Kf: is a fixed leakage coefficient for the node, c: is the discharge coefficient of the orifice which depends on the shape and the diameter, Lij: is the pipe length between nodes i and j, M: is the number of pipe connected to the node j and β: is the nodal pressure exponent (β = 1.18).

2.3 Valve Selection Index

The formulation of the VSI index that is proposed firstly in this research is given by Eq. (5).

$$ \mathrm{VSI}=\frac{1}{\mathrm{T}}\kern.2em {\sum}_{\mathrm{t}=1}^{\mathrm{T}}\mid \frac{{\mathrm{Q}}_{\mathrm{k}}^{\mathrm{t}}\ast \varDelta {\mathrm{P}}_{\mathrm{ij}}^{\mathrm{t}}}{{\mathrm{CHW}}_{\mathrm{k}}^{\mathrm{t}}}\mid $$
(5)

where \( {Q}_k^t \): is the flow of pipe k at time t, ∆Ptij: is the difference between pressure head in node i and j at time t, \( {CHW}_k^t \): is the roughness coefficient of pipe k at time t and T: is the duration time of the model.

2.4 Network Reliability

In this section, The Nodal Pressure Reliability Index (NPRI), proposed by Dini and Tabesh (2017) is used to evaluate the reliability of WDNs. This index is defined by considering the operational and design criteria of WDNs in the form of controlling maximum, minimum and optimal pressure in the Iranian urban water supply system. Also, it is defined as nodal and network reliability indices. In Eqs. (6) and (7), the utility function of the index is presented for each node and network.

$$ \mathrm{NPRI}\left(\mathrm{j},\mathrm{t}\right)=\left\{\begin{array}{c}0\kern22em \mathrm{P}<10\mathrm{m}\\ {}\frac{1}{32}\left(\mathrm{P}-10\right)\kern13.75em 10\mathrm{m}<\mathrm{P}<26\mathrm{m}\\ {}\frac{1}{10}\left(\mathrm{P}-26\right)+0.5\kern11em 26\mathrm{m}<\mathrm{P}<31\mathrm{m}\\ {}1\kern22.75em \mathrm{P}=31\mathrm{m}\\ {}-\frac{1}{38}\left(\mathrm{P}-31\right)+1.0\kern10.25em 31\mathrm{m}<\mathrm{P}<50\mathrm{m}\\ {}-\frac{1}{40}\left(\mathrm{P}-50\right)+0.5\kern10.5em 50\mathrm{m}<\mathrm{P}<60\mathrm{m}\\ {}0.25\kern21.5em 60\mathrm{m}<\mathrm{P}\\ {}\end{array}\right. $$
(6)
$$ \mathrm{NPRI}=\frac{\sum_{\mathrm{j}=1}^{\mathrm{NN}}{\mathrm{Q}}_{\mathrm{j},\mathrm{t}}^{\mathrm{req}}\left(\mathrm{NPRI}\left(\mathrm{j},\mathrm{t}\right)\right)}{\sum_{\mathrm{j}=1}^{\mathrm{NN}}{\mathrm{Q}}_{\mathrm{j},\mathrm{t}}^{\mathrm{req}}} $$
(7)

where NPRI(j, t): is the nodal pressure reliability of node j at time t, P: is the nodal pressure, NPRI:is the nodal pressure reliability of the network, NN: is the number of nodes and \( {\mathrm{Q}}_{\mathrm{j},\mathrm{t}}^{\mathrm{req}}: \) is the required nodal demand of node j at time t.

2.5 Optimization Algorithm

PSO algorithm originally developed by Eberhart and Kennedy (1995). PSO is a computational method that optimizes a problem by having a population of candidate solution and moving these particles around the search space according to simple formulae over the particles position and velocity. The movement of each particle is influenced by its personal best position and the global best position in the search space. The position and velocity of each particle are updated by the Eqs. (8) and (9):

$$ {x}_i\left(t+1\right)={x}_i(t)+{V}_i\left(t+1\right) $$
(8)
$$ {V}_i\left(t+1\right)={V}_i(t)+{C}_1\left({P}_i-{x}_i(t)\right){R}_1+{C}_2\left(g-{x}_i(t)\right){R}_2 $$
(9)

where xi(t) and xi(t + 1): is the position of each particle at time step t and t + 1, Vi(t) and Vi(t + 1): is the velocity of each particle at time step t and t + 1, Pi: is the personal best position of each particle, g: is the global best position of all particles in the search space, C1: is the acceleration coefficients that give the importance of personal best value and C2: is the acceleration coefficients that give the importance of social best value. R1, R2: are random numbers generated from a uniform distribution in [0, 1].

2.6 Overview

The flowchart of the methodology is shown in Fig. 1. There are six steps in this flowchart that demonstrate the overview of the methodology. In the first step, all parameters of the WDN and optimization algorithm are defined. In the second and third steps, all pipes of the network are evaluated by VSI index and some pipes with the VSI value higher than limited value are selected. In step four, the value of CHW coefficient is adjusted by maximizing the NPRI index in the form of the calibration model. In step five, selected pipes of the network are evaluated by VSI index and then it is used to find the optimal valve location in each category. In step six, the valve setting is done by maximizing the NPRI index.

Fig. 1
figure 1

Flowchart of the methodology

2.7 Case Study

The first case study has been introduced by Jowitt and Xu (1990). This network has about 37 pipes, 26 nodes, and three reservoirs. PRV1 to PRV4 displays the location of valves in the network that is changed by De Paola et al. (2017) (Fig. 2). The second case study is Ahar (A city, located in East Azerbaijan Province, Iran) WDN (Fig. 3). The simplified network includes 192 pipes, 169 nodes, one reservoir, five tanks, and three pumping stations. PRV1 to PRV4 displays the location of the optimal valves and P3 and P4 are the selected pumps for the setting. Also, R1 displays the reservoir as the only source of water and T1 to T5 display water storage tanks in the network.

Fig. 2
figure 2

Example network’s layout (De Paola et al. 2017)

Fig. 3
figure 3

Layout of Ahar water distribution network

3 Results and Discussions

3.1 Verification of the First Case Study

In this section, the proposed method will be verified to the first case study (Jowitt and Xu 1990) that was used to find the optimal location and setting of valves by De Paola et al. (2017) and Araujo et al. (2006). To compare the results of this study with previous studies, the minimization of the pressure by avoiding values lesser than 30 m in any node of the WDN is defined as an objective function that was used in previous studies. Figure 4 shows the optimal valves setting for 24 h in a day. It is clear that the range of nodal pressure variation is about 30–34 m for PRV1, PRV2, and PRV3 valves which are installed on pipes 1, 25 and 28 respectively and it is about 30–38 m for the valve PRV4 which is installed on pipe 31. These results are close to the results of De Paola et al. (2017) that prove the accuracy of the model in valves setting. Also, Fig. 5 shows the leakage rate in the network with and without optimized PRVs. In the case with optimized PRVs, the setting of the valve is the same as Fig. 4. A comparison of the results for the two cases shows that the case with optimized PRVs reduced the leakage rate significantly (about 19%). Also, a comparison of the results of this study to the paper of Araujo et al. (2006) in the case with optimized PRVs shows that their charts are very close together which prove the accuracy of the proposed model in the reduction of leakage rate.

Fig. 4
figure 4

Optimal setting of valves in the case with PRVs

Fig. 5
figure 5

Leakage rate with and without PRVs

3.2 Correction of the First Case Study

The roughness coefficient for each pipe with each diameter is usually between 40 and 140 in WDNs (Lamont, 1981). All roughness coefficient less than 40 is not reasonable, because it acts instead of a valve and controls the flow rate and pressure by changing total head loss in a pipe. In the first case study, there are two pipes (3 and 27) with the roughness coefficient of 10 and 6 that is very lower than the above range. Therefore, the roughness coefficient of pipes 3 and 27 are changed to the real value that is about 100.

3.3 Result of the First Case Study

In this section, first, the VSI calculation is used to select the pipes with the VSI value higher than limited value. It helps to reduce the search space of the calibration model. In Fig. 6 the value of the VSI index is shown for each pipe in the form of a bar chart. Pipes 1, 3, 15, 18, 21, 22, 23, 24, 25, 26, 27, 29 and 31 are selected as a case to install valves in the network. Then, the PSO algorithm is used to find the roughness coefficient of the selected pipes by maximizing the NPRI index in the form of the calibration model and the VSI index is calculated again. It is clear from the Fig. 6 that pipes 1, 15, 25 and 27 have the highest VSI index and they are selected as a case to install the valves. With this selected pipes, three scenarios of the pipes including (1, 15, 27), (1, 25, 27) and (1, 15, 25, 27) considered to install valves.

Fig. 6
figure 6

Bar Chart of VSI for example network

The result of the three scenarios is shown in Table 1. It is clear that the average NPRI index is about 0.741 for the network without PRVs and it increased for the network with optimized PRVs. So, for the first scenario with three valves on the pipes (1, 15, 27), it increased to 0.851 and for the second scenario with three valves on the pipes (1, 25, 27), it increased to 0.934 and also for the third scenario with four valves on the pipes (1, 15, 25, 27), it increased to 0.936. The average reduction of leakage for three scenarios is about 3.67, 6.36 and 6.49 respectively. Therefore, the third scenario has the highest NPRI index and the greatest reduction of leakage rate and it is the best combination of valves installation, which increased the reliability of the network more than 26.2% and reduced average leakage of the network more than 21.2% in comparison to the network without PRVs. The difference between the best scenario and De Paola et al. (2017) network is that the roughness coefficient of pipes 3 and 27 was corrected to the normal one and the location of the valve PRV4 was changed from pipe 31 to pipe 15 and valve PRV3 was changed from pipe 28 to pipe 27. But, the NPRI reliability index and the average leakage reduction of the best scenario are higher than the De Paola et al. (2017) network. Figures 7 and 8 show the variation of valves setting and the leakage rate and the NPRI index for the third scenario at each time in a day. The results show that the range of nodal pressure variation was 30–32.5 m for PRV1, PRV2 and PRV3 valves that are installed on pipes 1, 25 and 27. And it is about 32–37 m for the valve PRV4 that is installed on pipe 15. It is clear from this scenario, the adjusted pressure in the PRVs is limited in a smaller range than the De Paola et al. (2017) network. The leakage rate of the network with and without PRVs in the third scenario is about 23.0 and 29.2 l/s (Fig. 8) respectively that is more than the leakage rate of Araujo et al. (2006) network with the value of 22.3 and 27.6 l/s (Fig. 5), because in the Araujo et al. (2006) network, there are two pipes (3 and 27) with the low roughness coefficient that can act instead of a valve. It decreased the leakage rate in Araujo et al. (2006) network. While in this study, the roughness coefficient of that pipes are corrected to real value and the leakage rate of the network is higher than the Araujo et al. (2006) network. But in general, the leakage reduction of this study is about 21.2% that is little more than the leakage reduction of Araujo et al. (2006) network with the value of 19.8%. Also, according to the Fig. 8, for the case without PRVs the NPRI index is about 74.1% that increased to 93.6% for the case with the optimized PRVs. It shows that the performance of the network increased about 26.2% for the case with the optimized PRVs.

Table 1 Average leakage reduction and NPRI reliability index of network
Fig. 7
figure 7

Optimal setting of PRVs for the third scenario

Fig. 8
figure 8

Leakage rate and NPRI index with and without PRVs for the third scenario

3.4 Application to Ahar WDN

In this case study, first, the VSI index is calculated to the pipes. 65 pipes with the highest VSI index are nominated for calibration of the network. Then, the PSO algorithm is used to find the roughness coefficient of the selected pipes by maximizing the NPRI reliability index and VSI index is recalculated for them. The five pipes with the relatively higher VSI index (pipes 21, 48, 76, 88, 121) are selected for installation of valves in each category of pipes. Table 2 shows the result of VSI index for some selected pipes from 192 pipes of the network in the case without and with optimized PRVs and their categories. Optimized location of the valves is shown in Fig. 3. Four valves of the five valves are used in this case study and instead of the valve is located in the pipe leading to pumps 3 and 4, the pumps are used. In each category that is shown in Table 2, the pipes are connected sequentially and installation a valve on one of them controls all of the paths, therefore the valve is installed on the pipe with the relatively higher VSI index.

Table 2 VSI index for some selected pipes with and without PRVs

In the next step, the setting of valves and pump control modes is optimized by maximizing the NPRI reliability index. Figures 9 shows the chart of optimal valves settings and pump control modes. As it is known, the pumps 3 and 4 are open at 8 to 19 o’clock and closed in other hours. Comparison of the behavior of valves and pumps showed that the valve PRV4 has a similar behavior to pumps 3 and 4. So, when the pumps are opened, this valve adjusts the upper head and when the pumps are closed, this valve adjusts the lower head. But the valves PRV1, PRV2, and PRV3 act oppositely. The reason of this type of behavior of the valves against the pumps is that when the pumps 3 and 4 are opened, a higher head is created in the network, at this time the valves PRV1, PRV2, and PRV3 adjust the lower head, but when the pumps are closed, the head of the network goes down and the valves adjust the higher head.

Fig. 9
figure 9

Optimal setting of PRVs and pump modes for Ahar WDN

Figure 10 shows the variation of NPRI and leakage rate without PRVs and with optimized PRVs in Ahar WDN. For the case without PRVs, the average NPRI reliability index and the average leakage rate are 54.8% and 29.9 l/s respectively. After optimization, they change to 68.4% and 24.4 l/s respectively. It is clear that by optimizing the location of PRVs and optimal setting of valves and pumps in Ahar WDN, the average NPRI reliability index increased about 24.8% and the average leakage rate decreased about 15% in comparison to the network without PRVs.

Fig. 10
figure 10

Variation of NPRI and Leakage rate with and without PRVs for Ahar WDN

4 Conclusions

This paper presented a new step by step method to determine the optimal location and setting of PRVs by using a new VSI index and maximizing the NPRI index in the WDN. The methodology was based on PSO algorithm that is written in the MATLAB code. Hydraulic conditions were simulated with EPANET 2.0 software. For verifying the proposed method, the sample network (Jowitt and Xu 1990 network) and a real large-scale WDN were applied. Comparison of the results to the paper of Araujo et al. (2006) and De Paola et al. (2017) showed that the proposed method had a good performance in the term of the adjusted pressure in the PRVs and leakage reduction for the sample network that was confirmed the new proposed methodology.

Comparison of the results in the corrected sample network showed that pipes 1, 15, 25 and 27 had the highest VSI index and they were selected as the best location of PRVs that was different from the Araujo et al. (2006) and De Paola et al. (2017) paper. For the best scenario of valves location, the adjusted pressure in the PRVs varied in a smaller range than the De Paola et al. (2017) paper and also the reliability of the network increased more than 26.2% and the average leakage rate decreased more than 21.2% in comparison to the network without PRVs that was better than Araujo et al. (2006) paper. In the real WDN, The five pipes with the relatively higher VSI index in its category were selected for installation of valves and pumps. After the optimal setting of PRVs and pump modes, the average NPRI reliability index increased about 24.8% and the average leakage rate decreased about 15% in comparison to the network without PRVs.