Mathematical Models in WaterModels
Notation for Sets
A water distribution network is represented by a directed graph $\mathcal{G} := (\mathcal{N}, \mathcal{L})$, where $\mathcal{N}$ is the set of nodes and $\mathcal{L}$ is the set of arcs (conventionally "links," e.g., pipes and valves). Temporal evolution of the network is represented by a set $\mathcal{K}$, denoting the set of all time steps considered. In summary, the following sets are commonly used when defining a WaterModels problem formulation:
Notation | WaterModels Translation | Description |
---|---|---|
$\mathcal{N}$ | wm.ref[:nw][n][:node] | nodes (to which nodal-type components are attached) |
$\mathcal{K}$ | nw_ids(wm) | time indices (multinetwork indices labeled by n ) |
$\mathcal{J}$ | wm.ref[:nw][n][:junction] | junctions |
$\mathcal{R}$ | wm.ref[:nw][n][:reservoir] | reservoirs |
$\mathcal{T}$ | wm.ref[:nw][n][:tank] | tanks |
$\mathcal{A} \subset \mathcal{L}$ | wm.ref[:nw][n][:pipe] | pipes |
$\mathcal{C} \subset \mathcal{L}$ | wm.ref[:nw][n][:check_valve] | pipes with check valves |
$\mathcal{P} \subset \mathcal{L}$ | wm.ref[:nw][n][:pump] | pumps |
Physical Feasibility
Nodes
Junctions
Reservoirs
Tanks
Links
Pipes Without Check Valves
Pipes with Check Valves
Pipes with Shutoff Valves
Pressure Reducing Valves
Pumps
Satisfaction of Flow Bounds
For each arc $(i, j) \in \mathcal{L}$, a variable $q_{ij}$ is used to represent the volumetric flow of water across the arc (in $\textrm{m}^{3}/\textrm{s}$). When $q_{ij}$ is positive, flow on arc $(i, j)$ travels from node $i$ to node $j$. When $q_{ij}$ is negative, flow travels from node $j$ to node $i$. The absolute value of flow along the arc can be bounded by physical capacity, engineering judgment, or network analysis. Having tight bounds is crucial for optimization applications. For example, maximum flow speed and the diameter of the pipe can be used to bound $q_{ij}$ as per
where $D_{ij}$ is the diameter of pipe $(i, j)$ and $v^{\max}_{ij}$ is the maximum flow speed along the pipe.
Satisfaction of Head Bounds
Each node potential is denoted by $h_{i}$, $i \in \mathcal{N}$, and represents the hydraulic head in units of length ($\textrm{m}$). The hydraulic head assimilates the elevation and pressure heads at each node, while the velocity head can typically be neglected. For each reservoir $i \in \mathcal{R}$, the hydraulic head is assumed to be fixed at a value $h_{i}^{\textrm{src}}$, i.e.,
For each junction $i \in \mathcal{J}$, a minimum hydraulic head $\underline{h}_{i}$, determined a priori, must first be satisfied. In the interest of tightening the optimization formulation, upper bounds on hydraulic heads can also typically be implied from other network data, e.g.,
Conservation of Flow
Head Loss Relationships
In water distribution networks, flow along a pipe is induced by the difference in potential (head) between the two nodes that connect that pipe. The relationships that link flow and hydraulic head are commonly referred to as the "head loss equations" or "potential-flow constraints," and are generally of the form
where $\Phi_{ij} : \mathbb{R} \to \mathbb{R}$ is a strictly increasing function with rotational symmetry about the origin. Embedding the above equation in a mathematical program clearly introduces nonconvexity. (That is, the function $\Phi_{ij}(q_{ij})$ is nonconvex and the relationship must be satisfied with equality.) As such, different formulations primarily aim to effectively deal with these types of nonconvex constraints in an optimization setting.
Explicit forms of the head loss equation include the Darcy-Weisbach equation, i.e.,
and the Hazen-Williams equation, i.e.,
In these equations, $L_{ij}$ represents the length of pipe $(i, j) \in \mathcal{A}$, $\lambda_{ij}$ represents the friction factor, $g$ is the acceleration due to gravity, and $\kappa_{ij}$ is the roughness coefficient, which depends on the material of the pipe. In the Darcy-Weisbach formulation, $\lambda_{ij}$ depends on the Reynolds number (and thus the flow $q_{ij}$) in a nonlinear manner. In WaterModels.jl, the Swamee-Jain equation is used, which serves as an explicit approximation of the implicit Colebrook-White equation. The equation computes the friction factor $\lambda_{ij}$ for $(i, j) \in \mathcal{A}$ as
where $\epsilon_{ij}$ is the pipe's effective roughness and the Reynold's number $\textrm{Re}_{ij}$ is defined as
where $v_{ij}$ is the mean flow speed, $\rho$ is the density, and $\mu$ is the viscosity. Herein, to remove the source of nonlinearity in the Swamee-Jain equation, $v_{ij}$ is estimated a priori, making the overall resistance term fixed.
When all variables in a head loss equation except $q_{ij}$ are fixed (as in the relations described above), both the Darcy-Weisbach and Hazen-Williams formulations for head loss reduce to a convenient form, namely
Here, $r_{ij}$ represents the resistance per unit length, and $\alpha$ is the exponent required by the head loss relationship (i.e., one for Darcy-Weisbach and $0.852$ for Hazen-Williams). Thus, the Darcy-Weisbach resistance per unit length is
and the Hazen-Williams resistance per unit length is
Nonconvex Nonlinear Program
The full nonconvex formulation of the physical feasibility problem (NCNLP), which incorporates all requirements from Physical Feasibility, may be written as a system that satisfies the following constraints:
Here, Constraints $\eqref{eqn:ncnlp-head-loss}$ are head loss relationships, Constraints $\eqref{eqn:ncnlp-head-source}$ are head bounds at source nodes, Constraints $\eqref{eqn:ncnlp-flow-conservation}$ are flow conservation constraints, Constraints $\eqref{eqn:ncnlp-head-bounds}$ head bounds at junctions, and Constraints $\eqref{eqn:ncnlp-flow-bounds}$ are flow bounds. Note that the sources of nonconvexity and nonlinearity are Constraints $\eqref{eqn:ncnlp-head-loss}$.