Optimal Pressure Management in Water Distribution Systems Using an Accurate Pressure Reducing Valve Model Based Complementarity Constraints

Water loss according to water leakages in water distribution systems (WDSs) is a challenging problem worldwide. An inappropriate operation of the WDS leads to unnecessarily high pressure distribution in the WDS and thus a large amount of water leakage exists. For this reason, optimal pressure management in WDSs through regulating operations of pressure reducing valves (PRVs) is priority for water utilities. The pressure management can be accomplished in a hierarchical control scheme with high level and low level controllers. While the high level controller is responsible for calculating pressure set points for critical nodes, the task of a low level controller is to regulate the pressures at the critical nodes to the set points. The optimal pressure management in the high level controller can be casted into a nonlinear programing problem (NLP) where PRV models are crucial and determine proper operation of the WDS and quality of overall pressure control. PRV models having been used until now either describe two operating modes (active and open modes) or three operating modes (active, open and check valve modes) with parameter dependence. Such models make the formulated NLP unsuitable for the case PRVs work in check valve modes or resulted in inaccurate NLP solution with unexpected operation modes of PRVs, respectively. Therefore, this paper proposes an accurate PRV model based on complementarity constraints. The new PRV model is parameter-less dependence and is capable of describing complete operation modes of PRVs in practice. As a result, the formulated NLP is general and provides accurate NLP solution. The efficiency of our new PRV model is demonstrated on numerous case studies for optimal pressure management of WDSs.


Introduction
According to significant population growth, cities are stressed worldwide predominantly. About 1500 million people in global population have increased in the last 20 years, requiring the increase in the demand of cleaning water supply. Moreover, impacts of climate change and drought had led to some water resources to be exhaustedly exploited and thus an increase in the responsibility to adopt more sustainable management of urban water resources [1], where the problem water leakage control systems is vital [1]. Water losses in water distribution systems (WDSs) comprise real losses and apparent losses. The real losses are mainly caused by leakages at network fittings, pipe joints, breaks and/or bursts in pipes while the apparent losses are due to inaccurate meters and/or unauthorized consumption [2][3][4][5]. Over excessive water losses can lead to service interruption, energy losses and may cause contaminant intrusion due to low or even negative pressure conditions [3,4]. It is due to the fact that reducing all water loss components to zero is impossible both in technical and economically viability [5]. Therefore, water loss components should be accurately assessed and prioritized for a reduction [5,6]. To deal with the water loss problem, many strategies have been proposed such as: detection of pipe bursts and locations of seepages, annual rehabilitation and pressure management [2]. Among them, optimal pressure management (control) is one of the most efficient strategies significantly contributing to the decrease of the water leakage amount [6,7]. It is generally accepted that proper management of pressure in WDSs can lead to more reliable operation [8][9][10][11]. The pressure in WDSs is normally adjusted by control devices (i.e., pressure control valves, pressure reducing valves and variable speed pumps) [11][12][13] in kinds of open loop control or closed-loop control schemes. In open-loop control scheme, pressures at outlets of valves (pressure reducing valves-PRVs) are fixed to constant values or changed according to either time schedule (i.e., time modulation method) or their flows (i.e., flow modulation method) [7,13]. On the contrary, in the closed-loop control scheme, pressures at critical nodes are regulated to desired pressure set points by using proportional (P) or proportional-integral (PI) algorithms [14][15][16].
For improving the efficiency of pressure control strategy, pressure control should be accomplished through a hierarchical control scheme with two control layers as seen in Figure 1. The first control layer is considered as a high level controller where optimal pressure management of WDSs can be formulated as a NLP and it is solved by NLP solvers to determine hourly optimal pressure settings for PRVs (or pressures at critical nodes). Since the WDS is complex and is characterized by largely random variations of water demands. Such the optimal pressures are passed to the second control layer (or a low level controller) as pressure set points where the real time control (RTC) scheme with P or PI algorithms can be performed efficiently in a very high sampling rate (i.e., a control time step can be reduced to about 1 s) to regulate the pressures at the critical nodes (or outlet of valves) to the set points [13][14][15][16][17][18][19][20][21]. One of the effective RTC algorithms was discussed in [16,17] where the predicted head deviation (control error) is eliminated instead of the one at the current time. impossible both in technical and economically viability [5]. Therefore, water loss components should be accurately assessed and prioritized for a reduction [5,6]. To deal with the water loss problem, many strategies have been proposed such as: detection of pipe bursts and locations of seepages, annual rehabilitation and pressure management [2]. Among them, optimal pressure management (control) is one of the most efficient strategies significantly contributing to the decrease of the water leakage amount [6,7]. It is generally accepted that proper management of pressure in WDSs can lead to more reliable operation [8][9][10][11]. The pressure in WDSs is normally adjusted by control devices (i.e., pressure control valves, pressure reducing valves and variable speed pumps) [11][12][13] in kinds of open loop control or closed-loop control schemes. In open-loop control scheme, pressures at outlets of valves (pressure reducing valves-PRVs) are fixed to constant values or changed according to either time schedule (i.e., time modulation method) or their flows (i.e., flow modulation method) [7,13]. On the contrary, in the closed-loop control scheme, pressures at critical nodes are regulated to desired pressure set points by using proportional (P) or proportional-integral (PI) algorithms [14][15][16].
For improving the efficiency of pressure control strategy, pressure control should be accomplished through a hierarchical control scheme with two control layers as seen in Figure 1. The first control layer is considered as a high level controller where optimal pressure management of WDSs can be formulated as a NLP and it is solved by NLP solvers to determine hourly optimal pressure settings for PRVs (or pressures at critical nodes). Since the WDS is complex and is characterized by largely random variations of water demands. Such the optimal pressures are passed to the second control layer (or a low level controller) as pressure set points where the real time control (RTC) scheme with P or PI algorithms can be performed efficiently in a very high sampling rate (i.e., a control time step can be reduced to about 1 s) to regulate the pressures at the critical nodes (or outlet of valves) to the set points [13][14][15][16][17][18][19][20][21]. One of the effective RTC algorithms was discussed in [16,17] where the predicted head deviation (control error) is eliminated instead of the one at the current time. This paper focuses on formulating and solving the NLP for determination of optimal pressure valve settings (or desired pressure set points at critical) in the high level controller [13,22]. Many solution approaches having been proposed for modeling and solving the NLP. Genetic algorithms (GAs) combined with a hydraulic simulator, EPANET 2 [23],  This paper focuses on formulating and solving the NLP for determination of optimal pressure valve settings (or desired pressure set points at critical) in the high level controller [13,22]. Many solution approaches having been proposed for modeling and solving the NLP. Genetic algorithms (GAs) combined with a hydraulic simulator, EPANET 2 [23], were also used to determine optimal pressure settings of PRVs or on/off working states of valves for optimal pressure regulations in WDSs [24][25][26][27]. Scatter search algorithm, suitable for solving the optimization problem with a limited number of optimization variables, was applied to determine optimal pressure settings for PRVs in [28]. Using this algorithm, a short computation time for solving the optimization problem can be achieved. Creaco and Pezzinga [29] employed a hybrid algorithm combining GA and linear programming (LP) for optimal valve placements and pressure settings where the computation time (i.e., solving the LP instead of the NLP) was significantly reduced. De Paola et al. [30,31] proposed new methodologies, namely harmony search and music-inspired algorithms, to optimize simultaneously localization of PRVs and their pressure settings. Their performances have been demonstrated better than GA. Particle swarm optimization (PSO) [32] and differential evolution (DE) [33] algorithms were also employed to address the optimal valve setting problems, but for small scale WDSs. Although the heuristic solution approaches can solve complex optimization problems, they normally require a huge computation time, especially for large scale WDSs, hence they are appropriate for off-line control.
Besides heuristic algorithms, optimization based gradient methods were also applied to solve the NLP for identifying optimal pressure settings. Such the methods are suitable for near real time control implementation due to less computation time requirement. Early, the method of successive linear programming (LP) proposed in [34][35][36] was applied to solve the NLP where nonlinear constraints representing head loss equations of pipes and valves are iteratively linearized. The LP is then solved by simplex algorithm. The main shortcomings of this approach are due to a burden computation time and low accuracy of the optimal solution. Vairavamoorthy and Lumbers [37] formulated a NLP for optimal pressure regulation to minimize the leakage flow in WDSs, where the sequential quadratic programming (SQP) approach was used to solve the NLP. To enhance the quality of NLP solution, the method of sequential convex programming (SCP) was applied for determination of optimal pressure settings for PRVs for regulating pressures in DMAs [38]. The idea of this method lies in the fact that the nonlinear and non-convex equality constraints are linearized and the resulting convex optimization problem was solved iteratively until convergent condition is reached. Ulanicki et al. [12,13] optimized operations of both boundary and internal PRVs for 24 h to minimize the leakage flows in the DMAs in UK. As a result, the control flow modulation curves for the PRVs relating between the flows and the pressure settings were deduced. Ghaddar et al. [39] formulated the NLP with quadratic constraints (i.e., nonlinear head loss equations of pipes are approximated by quadratic functions). This NLP is then transformed into a polynomial form, which can be efficiently solved by using hierarchy of semidefinite (SDP) relaxations. In the above mentioned optimization approaches, the model of a PRV placed in a pipe has been commonly described by the Hazen-Williams equation [11][12][13]37], which only describes two (i.e., active and open mode) among three operation modes (i.e., active, open and closed (check valve) mode) of PRVs in practice. Therefore this model cannot be used for represent PRV model in the WDS as it operates in the check valve mode. Recently, the formulated NLP in [38] employed an accurate PRV model but with the assumption that PRV only works either in the active or open mode.
It is well-known that an improper operation of PRVs and PCVs may result in instability events and endanger the overall WDS operation [20,21]. For this reason, in the RTC scheme, Galuppini et al. [20] proposed a gain scheduling approach to account and compensate for the nonlinearities (which causes instabilities) in the system while preserving stability and robustness of the closed-loop in a wide operating region. Recently, the same authors presented an efficient control scheme where the PI algorithm is enhanced with a lowfilter and a smith predictor to significantly improve the robustness of the control scheme, while, at the same time, help reducing the cost of control. In the high level controller, in order to avoid unexpected operations of PRVs (and thus WDS operation) and low control performance, the mathematical model of PRVs used for formulation of the NLP must be accurate and describe any circumstances of PRV operations occurring in practice. Although Dai  the openings of PRVs cannot be set to a very small value (i.e., 1 × 10 −20 ), which again contributes to low accuracy of the NLP solution.
In this paper, we propose an accurate PRV model for formulation of the NLP, which overcomes the shortcomings of existing PRV models. In fact, the new PRV model also uses a non-smooth function for describing the three operating modes of PRVs, but instead of using the interior point method [40] for smoothing the non-smooth term, the approximated function is expressed as a solution of a quadratic program (QP). The resulting Karush-Kuhn-Tucker (KKT) conditions of the QP are constraints including complementarity ones, which will be used for formulation of the NLP. Such the approximation avoids the introduction of parameter (as in the interior point method) and therefore it gains the highest accuracy. The remainder of this paper is organized as follows. In Section 2, the existing PRV models are presented. Based on analyzing the shortcomings of these models, the new PRV model is proposed in this section. The formulation of the NLP with the newly proposed PRV model for optimal pressure management is given in Section 3. Three case studies are carried out in Section 4 and conclusions are presented in Section 5.

Existing Model of Pressure Reducing Valves
In practice, a PRV has three operating modes, which are active (i.e., the PRV maintains the downstream pressure at the preset value), open (i.e., when the downstream pressure is lower than the pressure setting) and check valve modes (i.e., when upstream pressure is lower than the downstream pressure) [1,10,33]. Consider a PRV placed on link ij, we denote H i,k as the nodal upstream head and H j,k as the nodal downstream head. Several models of PRVs have been used so far for formulation of the NLP [10,12,[37][38][39]. One of them is the PRV model proposed in [10] describing three operation modes of PRVs in practice, which is where R i,j is the resistance of the PRV and K i,j = 10 is the head loss coefficient of the PRV when it operates at the fully opened mode [10]; D i,j is the diameter of the PRV; g is the gravity constant and 0 < v i,j ≤ 1 represents the opening of the PRV. To employ the non-smooth Equation (1) for formulation of the NLP, the interior-point approximation method proposed in [40] is applied to smoothen the left hand side of Equation (1). To the end, the model equation representing the PRV is [10] The introduction of a small-positive parameter τ is necessary in order to guarantee that derivative values of the left hand side of Equation (3) with respective to H i and H j exists at a kink (i.e., H i = H j ). Since the model in Equation (3) depends on the value of parameter τ, solving the formulated NLP may result in inaccurate NLP solution and may lead PRVs to be operated in unexpected operation modes. As an example, when H i ≤ H j occurs, flow Q i,j can be non-zero (i.e., PRVs operate in active mode), while in practice, it must be zero (PRVs operate in closed mode). Additionally, according to numerical experiments, the lower bound of v i,j cannot be set to a very small value (i.e., 1 × 10 − × ), which once again lowers the accuracy of the NLP solution.
Another PRV model in Equation (4) used in [38] describes two among three operating modes of PRVs.
where δ ij ≥ 0 is the additional head loss absorbed by PRV and is considered as the optimization variable; R i,j is the resistance of the PRV expressed as in Equation (2). This model equation exactly describes operations of PRV in either active or open modes. Therefore, it cannot be used to represent the PRV model in the formulation of the NLP as PRVs are worked in the check valve mode for preventing reverse flows. However, the advantage of this model is that the upper bound of δ ij can be set to a very large value without causing numerical difficulties for NLP solvers. In our case studies, the upper bound value of δ ij was set to 1 × 10 20 .

An Accurate PRV Model Based Complementarity Constraints
Motivated from the shortcomings of existing PRV models, in this section, we propose a new and accurate PRV model using complementarity constraints. In particular, the new PRV model is given in Equation (5) Now, our aim was to approximate the non-smooth term max 0, H i,k − H j,k exactly by complementarity constraints. For the sake of simplicity, we omitted index k and we approximated the non-smooth term β = max(0, ∆H) with ∆H = H i − H j by smooth ones. The approximation is derived basing on lemma 1 in (7). This lemma has been applied in the optimal control of dynamic hybrid systems [41] and optimal mixing in gas networks [42], but until now it has not been used for developing the PRV model. To approximate the non-smooth term, we considered the following function This function is continuous, convex and piecewise affine (PWA) [42]. The general idea is to express this PWA function as a solution of an appropriate parametric optimization problem. This can be accomplished exactly and leads to mild constraints [41,42].

Lemma 1 ([41], Lemma 9
). Consider f i : R m → R n be a continuous piecewise affine function (PWA) such that every component for any positive definite n × n diagonal matrix Q and any affine function f : The proof of this lemma is presented in [41] (p. 9). Now, we applied lemma 1 to the PWA function in (6) with m = 2 and n = 1. Choosing diagonal value Q = 1; z = (z 1 , To solve the quadratic program (QP), by ignoring constant term 1 2 (β + η) 2 in the cost function in (7), the QP becomes Water 2021, 13, 825 The unique solution of the QP is characterized by its Karush-Kuhn-Tucker (KKT) conditions Using that f (z) = 0 provides ξ = 0, we obtained another complementarity constraint where λ 1 and λ 2 are internal multipliers. It is well-known that solving such the equality constraints is difficult, therefore we equivalently replaced them by the following inequality ones To the end, the new PRV model based complementarity constraints is As compared with PRV model in (3), our proposed PRV model equation is parameter less and polynomial, which is beneficial for NLP solvers. In addition, we use a decision variable δ i,j like in [38] (instead of v i,j ) for representing additional head absorbed by PRVs that the NLP solver can handle easily. It can be concluded that with our new PRV model, we expect that the optimal solution will be accurate and unexpected operations of PRVs can be avoided. For numerical experiments, the lower bound value of arbitrary variable η i,j,k is chosen as 1 × 10 −3 .

Problem Formulation for Optimal Pressure Management
The aim of this section was to formulate the NLP with our newly proposed PRV model where the total excessive pressure was minimized while model equality and inequality constraints describing the WDS model and operational constraints were satisfied. Besides, we also formulated the optimization problem with existing PRV models for purposes of comparisons.

Objective Function
The objective function to be minimized is defined as the excessive pressure at all nodes in the WDS in the optimization time horizon T [10,35].
where N J is the total number of nodes and T = 24 h is the time horizon. We considered a WDS with NP pipes, N J junction nodes, NR reservoirs and NPRV pressure reducing valves (PRVs); H i,k is head at node i, at time interval k and H L i,k is the minimum allowable head at node i.

The Continuity Equation at Node
The leakage amount, l i,k , associated to node i [8].
where p i,k and E i are the pressure and elevation of node i, respectively; L i,j is the length of the pipe connecting node i to node j; Q j,i,k is the flow rate from node j to node i at time interval k; d i,k is the demand at node i, at time interval k; L t,i is the total length of links connected to node i; p i,k = H i,k − E i and H i,k is the static pressure and total head at node i, respectively and γ = 1.18 is the leakage exponent, C L is the discharge coefficient of the orifice and has the unit of l/ s.m 1+γ .

The Energy Equation for the Pipe Connecting
where H i,k is the head at node i; ∆H i,j is the head loss, which can be computed by the Hazen-Williams equation In Equations (6) and (7) L i,j , D i,j and C i,j are the length, diameter and the Hazen-Williams coefficient of the pipe ij, respectively.

Model Constraints for PRVs
In Section 2, the model of PRV is represented by

Bound Constraints for Flows and Heads
In the above NLP, optimization variables are flow rates (Q i,j,k ), nodal heads (H i,k ), additional head loss absorbed by PRVs (δ i,j,k ) and internal multipliers (δ i,j,k , λ 1i,j,k , λ 2i,j,k , η i,j,k ). Among them, the decision variable is δ i,j,k and the rest are state variables.
To efficiently solve such an NLP, the computational framework for solving the mathematical program with complementarity constraints (MPCCs) was applied; in fact, com- gradually decreased values of ρ; in particular ρ = 1.0; ρ = 0.01; ρ = 0.001; ρ = 0 was used. As a result, a sequence of the NLPs regularized with these values of ρ was solved. The initial guest of the current NLP was taken from the solution of the previous one. This solution approach ensures that a better solution is found and that the exact PRV model equation is satisfied at a stationary point (i.e., solution of the NLP with ρ = 0).

Case Study 1: Optimal Pressure Management for an Illustrative Water Distribution System with Multi Reservoirs
In this case study, we considered an illustrative WDS consisting of 14 pipes, 4 PRVs, 16 nodes and 3 reservoirs as seen in Figure 2. The purpose of considering this simple WDS is to evaluate the performance of our proposed PRV model, which can completely describe behaviors of PRVs in practice while providing a fair NLP solution. All pipes had the Hazen-William coefficient of 100.0 and all junction nodes had their elevations of 20.0 m. This WDS was simple, but PRVs were connected in a complicated configuration. The data of links and nodes are given in Table 1. The 24 demand patterns were assumed as the same as in [8] and are given in Table 2. The NLP was formulated to minimize excessive pressure in the WDS while ensuring that the required minimum pressures at all demand nodes were 30.0 m. The resulting NLP model had 1296 continuous variables and 1200 nonlinear constraints.
Water 2021, 13, x FOR PEER REVIEW 9 of 22 data of links and nodes are given in Table 1. The 24 demand patterns were assumed as the same as in [8] and are given in Table 2. The NLP was formulated to minimize excessive pressure in the WDS while ensuring that the required minimum pressures at all demand nodes were 30.0 m. The resulting NLP model had 1296 continuous variables and 1200 nonlinear constraints.     [43], was employed to solve the NLP for optimal pressure management. Additionally, CONOPT4 solver (http://www.conopt.com/, accessed on 24 February 2021) [44] in the General algebraic modeling system (GAMS) [45] was also used to solve the NLP to ensure a good solution is found. All computation experiments are accomplished on computer desktop CPU-Intel (R) Core (TM) i5 3.2 GH, 8 GB RAM. To compare the performance of our new PRV model with the existing ones, we also solved the NLPs formulated with existing PRV models in [10,38].
For solving the optimization problem formulated with our new PRV model, IPOPT took about 12.0 s and the resulting objective function value was 8693.65 m. For optimal operations of PRVs, PRV 7 was set to be closed in the whole time horizon while PRV 4, 13 and 17 were operated in either active or fully closed modes. The pressure settings were given in Table 3 for these PRVs, respectively. It is seen in the table that, at low demand pattern values, the pressure settings were set to the minimum value of 30.00 m, while they were a bit higher at larger demand pattern values (i.e., time intervals 9 and 10 with PRV 13 and PRV 17). Moreover, to evaluate the accuracy of our proposed PRV model, the optimal pressure settings of PRVs were passed to EPANET 2 (https://www.epa.gov/water-research/epanet, accessed on 24 February 2021) [23] for carrying out simulation of the WDS. The comparisons of PRV flows, i.e., between ones obtained from solving the NLP and ones from simulation of the WDS using EPANET 2, were accomplished and shown from Figure 3a to Figure 3c. It can be seen in these figures that by using our PRV model very high accuracy was achieved. Moreover, the very small discrepancy between the optimized objective function value (8693.65 m) and the simulated one (8694.83 m) indicating that very high accuracy of nodal heads was also attained. At optimal solution, PRV 17 was operated in check valve modes from 1:00 to 8:00 and from 13:00 to 24:00 (i.e., H i < H j ). Now, we employed the existing PRV model [38] in the formulation of the NLP. According to numerical experiments, we found that in this case, IPOPT failed to solve the NLP, while CONOPT4 in GAMS could solve it but converged to a very bad local solution with the objective function value of 10118.95 m as seen in Table 4.  Now, we employed the existing PRV model [38] in the formulation of the NLP. According to numerical experiments, we found that in this case, IPOPT failed to solve the NLP, while CONOPT4 in GAMS could solve it but converged to a very bad local solution with the objective function value of 10118.95 m as seen in Table 4. For the PRV model in [10], although IPOPT can solve the formulated NLP, it results in lower accuracy of the solution. In particular, the resulting objective function value was

PRV 7
New PRV model PRV model in [10]  For the PRV model in [10], although IPOPT can solve the formulated NLP, it results in lower accuracy of the solution. In particular, the resulting objective function value was 8705.48 m larger than the one found by using our new PRV model, which was 8693.65 m. In addition, if we set the lower bound of v i,j to a very small value, namely less than 1 × 10 −8 , due to numerical implementation, IPOPT failed to solve the formulated NLP. The same result is observed by CONOPT 4. More importantly, for the case the optimal solution was found (i.e., lower bound of v i,j was larger than 1 × 10 −7 ), due to the inaccurate solution, PRV 7 was set to work in the active mode, while, in fact, it was set to be fully closed due to optimal solution resulted by using our new PRV model. The comparisons of optimal solutions with different lower bound values of v i,j are given in Table 4. The inaccurate flows through PRV 7 are shown in Figure 3d. The comparisons of cumulative pressure distributions are given in Figure 4. It is seen that the solution of the NLP formulated with the PRV model in [38] had the worst quality. tion, PRV 7 was set to work in the active mode, while, in fact, it was set to be fully closed due to optimal solution resulted by using our new PRV model. The comparisons of optimal solutions with different lower bound values of , i j v are given in Table 4. The inaccurate flows through PRV 7 are shown in Figure 3d. The comparisons of cumulative pressure distributions are given in Figure 4. It is seen that the solution of the NLP formulated with the PRV model in [38] had the worst quality.

Optimal Pressure Management for a Benchmark Water Distribution System
To verify the accuracy and efficiency of our new PRV model, we considered a benchmark WDS comprising of 32 links, 5 PRVs, 22 nodes and 3 reservoirs as shown in Figure  5. This WDS was also studied in [8,10,34,35] for optimal valve setting problems and studied in [45] for optimal pumps as turbines localization. Note that directions for placing PRVs were from node 23 to node 1 for PRV 1; from node 13 to node 12 for PRV 11; from node 12 to node 15 for PRV 21; from node 22 to node 15 for PRV 20 and from node 22 to node 21 for PRV 29.
The data of links and nodes are given in [8]. In addition, the discharge coefficient L C was −5 10 and the leakage exponent parameter γ was 1.18 as used in [8]. The minimum allowable pressures at nodes were maintained at 30.00 m. In this paper, optimal pressure settings of PRVs were determined for 24 demand patterns and reservoir heads. The reservoir heads for 24 h were taken in [8,10] while the 24 demand patterns are given in Table  1. The resulting NLP model had 2280 variables and 2160 constraints. Similarly, IPOPT was used to solve such the sequence of NLPs and it took about 1.82 s. The results of optimal pressure settings of PRV 1, PRV 11 and PRV 21 are demonstrated in Figure 6a while the PRV 20 and PRV 29 were fully closed in the whole time horizon.

Optimal Pressure Management for a Benchmark Water Distribution System
To verify the accuracy and efficiency of our new PRV model, we considered a benchmark WDS comprising of 32 links, 5 PRVs, 22 nodes and 3 reservoirs as shown in Figure 5. This WDS was also studied in [8,10,34,35] for optimal valve setting problems and studied in [45] for optimal pumps as turbines localization. Note that directions for placing PRVs were from node 23 to node 1 for PRV 1; from node 13 to node 12 for PRV 11; from node 12 to node 15 for PRV 21; from node 22 to node 15 for PRV 20 and from node 22 to node 21 for PRV 29. The data of links and nodes are given in [8]. In addition, the discharge coefficient C L was 10 −5 and the leakage exponent parameter γ was 1.18 as used in [8]. The minimum allowable pressures at nodes were maintained at 30.00 m. In this paper, optimal pressure settings of PRVs were determined for 24 demand patterns and reservoir heads. The reservoir heads for 24 h were taken in [8,10] while the 24 demand patterns are given in Table 1. The resulting NLP model had 2280 variables and 2160 constraints. Similarly, IPOPT was used to solve such the sequence of NLPs and it took about 1.82 s. The results of optimal pressure settings of PRV 1, PRV 11 and PRV 21 are demonstrated in Figure 6a while the PRV 20 and PRV 29 were fully closed in the whole time horizon.  Similarly, in order to evaluate the accuracy of our proposed PRV model, the optimal pressure settings of PRVs were passed to the EPANET 2 [23] as control input for carrying out simulation of the WDS again. The results of simulated PRV flows were compared with the optimized ones (i.e., obtained by solving the NLP) and they are shown in Figures 6b  and 7a,b for three PRV 1, PRV 11 and PRV 21, respectively. It can be seen in these figures that our new PRV model was indeed accurate. The high accuracy of the NLP solution comes from the fact that our PRV model did not require a parameter τ as in [10], and in addition, the problem of a very small lower bound value of , Similarly, in order to evaluate the accuracy of our proposed PRV model, the optimal pressure settings of PRVs were passed to the EPANET 2 [23] as control input for carrying out simulation of the WDS again. The results of simulated PRV flows were compared with the optimized ones (i.e., obtained by solving the NLP) and they are shown in Figures 6b and 7a,b for three PRV 1, PRV 11 and PRV 21, respectively. It can be seen in these figures that our new PRV model was indeed accurate. The high accuracy of the NLP solution comes from the fact that our PRV model did not require a parameter τ as in [10], and in addition, the problem of a very small lower bound value of v i,j was avoided.
With our new PRV model, the resulting objective function value was 830.91 m, while the simulated one (i.e., obtained by simulation using EPANET 2) was 830.99. This demonstrated fair accuracy of nodal heads. It is also seen in Figure 6a that, at low values of demand patterns, the optimized pressure settings of PRVs were small to restrict the pressures at downstream nodes and thus regulated the system pressure. This is reasonable because at the low demand patterns, the high pressure will be appeared in the system if PRVs are not installed. On the contrary, at high values of demand patterns, the system pressure, i.e., in case of no PRVs, tended to be decreased as compared with the case of the low demand pattern values, therefore the optimized pressure settings of PRVs obtained higher values to ensure that minimum pressure at all demand nodes were at least of 30.0 m.
The water leakage flows for 24 h are shown in Figure 8a. It can be seen that much more water leakage flow was decreased as pressure settings of PRVs were optimized. More specifically, with 5 PRVs to be installed, the total water leakage flow reduced from 56,282.00 to 44,461.00 m 3 /day. This means that we saved an amount of 11,821.00 m 3 /day as PRVs were installed and operated at appropriate pressures. The decrease of excessive pressure is represented in the cumulative pressure distribution as demonstrated in Figure 8b, as seen, with 5 PRVs, nearly all demand nodes had their pressures lower than 35.0 m, while only about 10 percent of nodes had such pressure when no pressure control (i.e., no PRV was installed) was made. With our new PRV model, the resulting objective function value was 830.91 m, while the simulated one (i.e., obtained by simulation using EPANET 2) was 830.99. This demonstrated fair accuracy of nodal heads. It is also seen in Figure 6a that, at low values of demand patterns, the optimized pressure settings of PRVs were small to restrict the pressures at downstream nodes and thus regulated the system pressure. This is reasonable because at the low demand patterns, the high pressure will be appeared in the system if PRVs are not installed. On the contrary, at high values of demand patterns, the system pressure, i.e., in case of no PRVs, tended to be decreased as compared with the case of the low demand pattern values, therefore the optimized pressure settings of PRVs obtained higher values to ensure that minimum pressure at all demand nodes were at least of 30.0 m.
The water leakage flows for 24 h are shown in Figure 8a. It can be seen that much more water leakage flow was decreased as pressure settings of PRVs were optimized. More specifically, with 5 PRVs to be installed, the total water leakage flow reduced from 56,282.00 to 44,461.00 m 3 /day. This means that we saved an amount of 11,821.00 m 3 /day as PRVs were installed and operated at appropriate pressures. The decrease of excessive pressure is represented in the cumulative pressure distribution as demonstrated in Figure  8b, as seen, with 5 PRVs, nearly all demand nodes had their pressures lower than 35.0 m, while only about 10 percent of nodes had such pressure when no pressure control (i.e., no PRV was installed) was made.
Now, the PRV model in [10,38] were used for formulation of the NLP. IPOPT was also used to solve these NLPs. The comparisons of optimal solutions are given in Table 5. It is seen in the table that our new PRV model results the same solution as the PRV model in [38] while it slightly outperformed the one in [10]. Similarly to case study 1, CONOPT4 in GAMs also failed to solve the NLP formulated with the lower bound values of ,

Optimal Pressure Management for a Large Scale Water Distribution System in Vietnam
In order to demonstrate the efficiency of our new PRV model, we applied it for optimal pressure management of a large scale and real-world WDS in Thainguyen City in Vietnam as shown in Figure 9. This WDS, considered in [46] for study of optimal pumps as turbines localization, consists of 110 pipes, 6 PRVs, 99 nodes and 4 reservoirs. The constant heads of four reservoirs 150, 151, 152 and 153 were 111.74 m, 75.21 m, 69.57 m and 69.46 m, respectively while the 24 demand pattern factors are given in Table 6 [46]. The EPANET file of this WDS is given in the supplementary part. The optimization problem aims to determine optimal pressure settings of PRVs so as to decrease excessive pressure in the system while ensuring that the minimum allowable pressures at demand nodes are maintained at 17.00 m. The resulting NLP model had 6072 continuous variables and 5928 nonlinear constraints, respectively. Now, the PRV model in [10,38] were used for formulation of the NLP. IPOPT was also used to solve these NLPs. The comparisons of optimal solutions are given in Table 5. It is seen in the table that our new PRV model results the same solution as the PRV model in [38] while it slightly outperformed the one in [10]. Similarly to case study 1, CONOPT4 in GAMs also failed to solve the NLP formulated with the lower bound values of v i,j less than 1 × 10 −8 .

Optimal Pressure Management for a Large Scale Water Distribution System in Vietnam
In order to demonstrate the efficiency of our new PRV model, we applied it for optimal pressure management of a large scale and real-world WDS in Thainguyen City in Vietnam as shown in Figure 9. This WDS, considered in [46] for study of optimal pumps as turbines localization, consists of 110 pipes, 6 PRVs, 99 nodes and 4 reservoirs. The constant heads of four reservoirs 150, 151, 152 and 153 were 111.74 m, 75.21 m, 69.57 m and 69.46 m, respectively while the 24 demand pattern factors are given in Table 6 [46]. The EPANET file of this WDS is given in the supplementary part. The optimization problem aims to determine optimal pressure settings of PRVs so as to decrease excessive pressure in the system while ensuring that the minimum allowable pressures at demand nodes are maintained at 17.00 m. The resulting NLP model had 6072 continuous variables and 5928 nonlinear constraints, respectively.  IPOPT [43] was used to solve the NLP and it took about 12.3 s to solve the sequence of NLPs. The resulting objective function value was 21,071.18 m, while the simulated one by EPANET 2 was 20,656.02 m. Such a small difference revealed that a high accuracy of nodal head was attained. The results of optimal pressure settings are shown in Figure  10a,b for 6 PRVs, respectively.  IPOPT [43] was used to solve the NLP and it took about 12.3 s to solve the sequence of NLPs. The resulting objective function value was 21,071.18 m, while the simulated one by EPANET 2 was 20,656.02 m. Such a small difference revealed that a high accuracy of nodal head was attained. The results of optimal pressure settings are shown in Figure 10a It is observed in these figures that the optimal pressure settings of PRVs changed according to the daily changes of water demand patterns. In general, at low demand pattern values, the pressure settings of PRVs were usually small while they were higher at high demand pattern values. Similarly, to verify the accuracy of the proposed PRV model, we compared the optimized PRV flows (i.e., obtained from the solving the NLP) with the ones obtained by simulation of the WDS using EPANET 2 where the optimized pressure settings of PRVs were used as control input. The comparisons are shown in Figures 11-13 for 6 PRVs, respectively. Once again, it is seen that both optimized flows and simulated flows through PRVs were almost the same demonstrating high accuracy of the proposed PRV model. It is observed in these figures that the optimal pressure settings of PRVs changed according to the daily changes of water demand patterns. In general, at low demand pattern values, the pressure settings of PRVs were usually small while they were higher at high demand pattern values. Similarly, to verify the accuracy of the proposed PRV model, we compared the optimized PRV flows (i.e., obtained from the solving the NLP) with the ones obtained by simulation of the WDS using EPANET 2 where the optimized pressure settings of PRVs were used as control input. The comparisons are shown in Figures 11-13 for 6 PRVs, respectively. Once again, it is seen that both optimized flows and simulated flows through PRVs were almost the same demonstrating high accuracy of the proposed PRV model. It is observed in these figures that the optimal pressure settings of PRVs changed according to the daily changes of water demand patterns. In general, at low demand pattern values, the pressure settings of PRVs were usually small while they were higher at high demand pattern values. Similarly, to verify the accuracy of the proposed PRV model, we compared the optimized PRV flows (i.e., obtained from the solving the NLP) with the ones obtained by simulation of the WDS using EPANET 2 where the optimized pressure settings of PRVs were used as control input. The comparisons are shown in Figures 11-13 for 6 PRVs, respectively. Once again, it is seen that both optimized flows and simulated flows through PRVs were almost the same demonstrating high accuracy of the proposed PRV model.  To demonstrate the decrease of excessive pressure, the cumulative distributions of pressures of all nodes over 24 h for three PRV models are given in Figure 14, respectively. It is seen that by setting pressures of PRVs to appropriate values, a significant excessive pressure amount was reduced. In particular, with 6 PRVs installed and their operations were optimized, nearly 80% of nodes had pressures lower than 30.0 m comparing with about only 10% of nodes had such a pressure value when no PRV was installed. This means that optimal pressure management through regulating operations of PRVs was indeed efficient. The nice performance of our proposed PRV model was also demonstrated in the figure where the cumulative pressure distribution with the range of dominated pressures from 20.00 to 40.00 m had a slightly larger percent than those resulting from other PRV models.  To demonstrate the decrease of excessive pressure, the cumulative distributions of pressures of all nodes over 24 h for three PRV models are given in Figure 14, respectively. It is seen that by setting pressures of PRVs to appropriate values, a significant excessive pressure amount was reduced. In particular, with 6 PRVs installed and their operations were optimized, nearly 80% of nodes had pressures lower than 30.0 m comparing with about only 10% of nodes had such a pressure value when no PRV was installed. This means that optimal pressure management through regulating operations of PRVs was indeed efficient. The nice performance of our proposed PRV model was also demonstrated in the figure where the cumulative pressure distribution with the range of dominated pressures from 20.00 to 40.00 m had a slightly larger percent than those resulting from other PRV models. To demonstrate the decrease of excessive pressure, the cumulative distributions of pressures of all nodes over 24 h for three PRV models are given in Figure 14, respectively. It is seen that by setting pressures of PRVs to appropriate values, a significant excessive pressure amount was reduced. In particular, with 6 PRVs installed and their operations were optimized, nearly 80% of nodes had pressures lower than 30.0 m comparing with about only 10% of nodes had such a pressure value when no PRV was installed. This means that optimal pressure management through regulating operations of PRVs was indeed efficient. The nice performance of our proposed PRV model was also demonstrated in the figure where the cumulative pressure distribution with the range of dominated pressures from 20.00 to 40.00 m had a slightly larger percent than those resulting from other PRV models. For comparisons with existing PRV models, we employed the PRV model in [10] and the one in [38] for optimal pressure management; the results of both optimal solutions were compared with the one found by our new PRV model and given in Table 7. It can be seen in the table that using our new PRV model, a better solution with a lower objective function value was achieved.

Conclusions
Pressure control can be efficiently accomplished in a hierarchical control scheme with high and low level controllers. In a high level controller, this paper proposed a new mathematical model for PRVs, which is not only capable of describing complete operation modes of PRVs but also provides accurate solution for optimal pressure managing problem. In fact, the non-smooth term in the new PRV model is expressed as a unique solution of a quadratic program. The KKT conditions of the quadratic program, which are constraints consisting of complementarity ones, will be used for formulation of the PRV model and for formulation of the NLP. The important aspect of the new PRV model lies in the fact that its model constraints were in polynomial kinds, which are beneficial for NLP solvers. In addition, it provides an accurate solution and thus avoids unexpected operations of PRVs. Numerical experiments were verified on three case studies revealing that better solutions could be achieved with our new PRV model. In particular, for an illustrative WDS, although PRVs were connected in a complicated configuration, solving the NLP formulated with our new PRV still gave a better solution as compared with the solution of the existing ones. For a benchmark WDS, by optimizing operations of PRVs, it is possible to save an amount of 11821.0 m 3 water per day. Finally, for a large scale and real-world WDS, once again, solving the NLP with our new PRV model results in a better solution and a significant excessive pressure reduction was reached. New PRV model PRV model in [10] PRV model in [38] Without PRV For comparisons with existing PRV models, we employed the PRV model in [10] and the one in [38] for optimal pressure management; the results of both optimal solutions were compared with the one found by our new PRV model and given in Table 7. It can be seen in the table that using our new PRV model, a better solution with a lower objective function value was achieved.

Conclusions
Pressure control can be efficiently accomplished in a hierarchical control scheme with high and low level controllers. In a high level controller, this paper proposed a new mathematical model for PRVs, which is not only capable of describing complete operation modes of PRVs but also provides accurate solution for optimal pressure managing problem. In fact, the non-smooth term in the new PRV model is expressed as a unique solution of a quadratic program. The KKT conditions of the quadratic program, which are constraints consisting of complementarity ones, will be used for formulation of the PRV model and for formulation of the NLP. The important aspect of the new PRV model lies in the fact that its model constraints were in polynomial kinds, which are beneficial for NLP solvers. In addition, it provides an accurate solution and thus avoids unexpected operations of PRVs. Numerical experiments were verified on three case studies revealing that better solutions could be achieved with our new PRV model. In particular, for an illustrative WDS, although PRVs were connected in a complicated configuration, solving the NLP formulated with our new PRV still gave a better solution as compared with the solution of the existing ones. For a benchmark WDS, by optimizing operations of PRVs, it is possible to save an amount of 11821.0 m 3 water per day. Finally, for a large scale and real-world WDS, once again, solving the NLP with our new PRV model results in a better solution and a significant excessive pressure reduction was reached.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.

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

Abbreviations
The following symbols are used in this paper: