Constraints

Constraint Templates

Constraint templates help simplify data wrangling across multiple Petro Flow formulations by providing an abstraction layer between the network data and network constraint definitions. The constraint template's job is to extract the required parameters from a given network data structure and pass the data as named arguments to the Petroleum Flow formulations.

These templates should be defined over AbstractPetroleumModel and should not refer to model variables. For more details, see the files: core/constraint_template.jl and core/constraint.jl.

Junction Constraints

Volume flow balance constraints

The primary constraints related to junctions ensure that volume flow is balanced at these nodes.

PetroleumModels.constraint_junction_volume_flow_balanceFunction

Constraint for balancing volumetric flow a function (nodes)

source

Constraint for balancing volumetric flow at junctions (nodes) in the pipeline system. Given junction $i$, this constraint takes the form of $\sum_{j \in Producers_i} qg_j - \sum_{j \in Consumers_i} ql_j = \sum_{ij \in Pipes^f_{ij}} q_{ij} - \sum_{ij \in Pipes^t_{ji}} q_{ji} + \sum_{ij \in Pumps^f_{ij}} q_{ij} - \sum_{ij \in Pumps^t_{ji}} q_{ji} + \sum_{ij \in Tanks^f_{ij}} q_{ij} - \sum_{ij \in Tanks^t_{ji}} q_{ji}$ where $qg$ and $ql$ includes variable and constant demand and production as defined by the $is\_dispatchable$ flag

source

Pipe Constraints

Bernoulli equation

The primary constraints related to pipes ensure that that head change and flow across a pipe is represented by Bernoulli equation. In this constraint head loss across a pipe is related through the Leibenzon relationship.

PetroleumModels.constraint_leibenzonFunction

Leibenzon model for pipeline physics

source

Constraint for computing the relationship between volumetric flow and head difference at either end of a pipe. For a pipe $(i,j)$, this constraint is computed as $(h_i - h_j) = (z_j - z_i) + \frac{\beta * \nu^m}{D_{ij}^{5.0-m}} * L_{ij} * 1.02 * q_{ij}^{2.0-m}$. The constraint adopts the Leibenzon model

source

Pump Constraints

Operation constraints

The primary constraints related to pumps ensure that the pumps operate within the limits of their capability (head difference, volume flow, rotational speed and pump efficiency).

PetroleumModels.constraint_pump_efficiencyFunction

constraint for computing the efficiency of the pump

source

Constraint for computing the efficiency of a pump $\eta = \overline{\eta} - (\frac{q_{ij}}{\hat{q_{ij}}} - \frac{w_{ij}}{\hat{w}_{ij}})^2 * (\frac{\hat{w}}{w_{ij}})^2 * \overline{\eta})$

source

Tank Constraints

Flow balance constraints

Tanks are used to model storage nodes in a pipeline system. The primary constraint ensures the head and flow on both sides of tanks are within the limits capability of the tank's intake and offtake pipes.

Missing docstring.

Missing docstring for constraint_tank_volume_balance. Check Documenter's build log for details.