Constraints

Constraint Templates

Constraint templates help simplify data wrangling across multiple Gas 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 Gas Flow formulations.

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

Junction Constraints

Flow balance constraints

The primary constraints related to junctions ensure that mass flow is balanced at these nodes. The specifics of the constraint implementation will change if there are network design options (denoted by \_ne in the name of the function).

GasModels.constraint_mass_flow_balanceFunction

Constraint: standard flow balance equation where demand and production are variables

source

Template: Constraints for mass flow balance equation where demand and production is are a mix of constants and variables

source

Constraint: standard flow balance equation where demand and production are variables

source
GasModels.constraint_mass_flow_balance_neFunction

Constraint: standard flow balance equation where demand and production are variables and there are expansion connections

source

Template: Constraints for mass flow balance equation where demand and production is are a mix of constants and variables and there are expansion connections

source

Constraint: standard flow balance equation where demand and production are variables and there are expansion connections

source

Direction On/off Constraints

The disjunctive forms of problems (where directions are controlled by on/off variables) include special (redundant) constraints which tie the direction variables together. Examples include ensuring that ensure at least one edge of junction that has only sources of natural gas has outgoing flow.

GasModels.constraint_source_flowFunction

Constraint: Make sure there is at least one direction set to take flow away from a junction (typically used on source nodes)

source

Template: Constraints for ensuring that at least one direction is set to take flow away from a junction (typically used on source nodes)

source
GasModels.constraint_sink_flowFunction

Constraint: Make sure there is at least one direction set to take flow to a junction (typically used on sink nodes)

source

Template: Constraints for ensuring that at least one direction is set to take flow away from a junction (typically used on sink nodes)

source
GasModels.constraint_conserve_flowFunction

Constraint: This constraint is intended to ensure that flow is one direction through a node with degree 2 and no production or consumption

source

Template: Constraints to ensure that flow is the same direction through a node with degree 2 and no production or consumption

source
GasModels.constraint_source_flow_neFunction

Constraint: Make sure there is at least one direction set to take flow away from a junction (typically used on source nodes)

source

Template: Constraints for ensuring that at least one direction is set to take flow away from a junction (typically used on source nodes)

source
GasModels.constraint_sink_flow_neFunction

Constraint: Make sure there is at least one direction set to take flow to a junction (typically used on sink nodes)

source

Template: Constraints for ensuring that at least one direction is set to take flow away from a junction (typically used on sink nodes)

source
GasModels.constraint_conserve_flow_neFunction

Constraint: This constraint is intended to ensure that flow is on direction through a node with degree 2 and no production or consumption for a node with expansion edges

source

Template: Constraints to ensure that flow is the same direction through a node with degree 2 and no production or consumption

source

Pipe Constraints

Weymouth's law constraints

The primary constraints related to pipes ensure that that pressure drop and flow across a pipe is related through the Weymouth relationships. Here, the naming convention ne is used to denote the form of the constraint used for expansion pipes and directed is used to denote the form of the constraint used when the direction of flow is constrained.

GasModels.constraint_pipe_weymouthFunction

Template: Weymouth equation for defining the relationship between pressure drop and flow across a pipe

source

Constraint: Weymouth equation–not applicable for MIP models

source

Constraint: Weymouth equation–not applicable for LP models

source

Weymouth equation with absolute value

source

Weymouth equation with discrete direction variables

source

Weymouth equation for an undirected pipe

source
GasModels.constraint_pipe_weymouth_neFunction

Template: Weymouth equation for expansion pipes

source

Constraint: Weymouth equation–not applicable for MIP models–not applicable for MIP models

source

Constraint: Weymouth equation–not applicable for MIP models–not applicable for LP models

source

Weymouth equation for an undirected expansion pipe

source

Weymouth equation for an undirected expansion pipe

source

Weymouth equation for an undirected expansion pipe

source
GasModels.constraint_pipe_weymouth_directedFunction

Template: Weymouth equation for defining the relationship between pressure drop and flow across a pipe where flow is constrained in one direction

source

Constraint: Weymouth equation with one way direction–not applicable for MIP models

source

Constraint: Weymouth equation with one way direction–not applicable for LP models

source

Weymouth equation with one way direction

source

Weymouth equation with one way direction

source

Weymouth equation with a pipe with one way flow

source
GasModels.constraint_pipe_weymouth_ne_directedFunction

Template: Weymouth equation for expansion pipes where flow is restricted to one direction

source

Constraint: Weymouth equation–not applicable for MIP models–not applicable for MIP models

source

Constraint: Weymouth equation–not applicable for MIP models–not applicable for LP models

source

Weymouth equation for directed expansion pipes

source

Weymouth equation for directed expansion pipes

source

Weymouth equation for expansion pipes with undirected expansion pipes

source

Mass flow and pressure drop constraints

Secondarily, there are constraints associated with limits on pressure drop or mass flow across pipes. These constraints also use the ne and directed naming conventions.

GasModels.constraint_pipe_pressureFunction

Constraint: Constraints which define pressure drop across a pipe

source

Template: Pressure drop across pipes with on/off direction variables

source

Constraint: Constraints which define pressure drop across a pipe when there are on/off direction variables

source

Constraint: Constraints which define pressure drop across a pipe

source

Constraint: Constraints which define pressure drop across a pipe

source

Network expansion constraints

These constraints turn on or off the association between pressure and flow for pipes desiginated as expansion options.

GasModels.constraint_pipe_neFunction

Constraint: on/off constraints on flow across pipes for expansion pipes

source

Template: Constraint associatd with turning off flow depending on the status of expansion pipes

source

Direction on/off constraints

The disjunctive forms of problems (where directions are controlled by on/off variables) include special (redundant) constraints which tie the direction variables together. Examples include ensuring that ensuring that parallel pipes have flow in the same direction.

Missing docstring.

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

Missing docstring.

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

Resistor Constraints

Weymouth's law constraints

The primary constraints related to resistor ensure that that pressure drop and flow across a resistor is related through the Weymouth relationships. Here, directed is used to denote the form of the constraint used when the direction of flow is constrained.

GasModels.constraint_resistor_weymouthFunction

Template: Weymouth equation for defining the relationship between pressure drop and flow across a resistor

source

Constraint: Weymouth equation–not applicable for MIP models

source

Constraint: Weymouth equation–not applicable for LP models

source

Weymouth equation with absolute value

source

Weymouth equation with discrete direction variables

source

Weymouth equation for an undirected pipe

source
GasModels.constraint_resistor_weymouth_directedFunction

Template: Weymouth equation for defining the relationship between pressure drop and flow across a resistor where flow is constrained in one direction

source

Constraint: Weymouth equation with one way direction–not applicable for MIP models

source

Constraint: Weymouth equation with one way direction–not applicable for LP models

source

Weymouth equation with one way direction

source

Weymouth equation with one way direction

source

Weymouth equation with a resistor with one way flow

source

Mass flow and pressure drop constraints

Secondarily, there are constraints associated with limits on pressure drop or mass flow across pipes. These constraints also use the directed naming conventions.

GasModels.constraint_resistor_pressureFunction

Constraint: Constraints which define pressure drop across a resistor

source

Template: Pressure drop across resistor with on/off direction variables

source

Constraint: Constraints which define pressure drop across a resistor

source

Constraint: Constraints which define pressure drop across a resistor

source

Direction on/off constraints

The disjunctive forms of problems (where directions are controlled by on/off variables) include special (redundant) constraints which tie the direction variables together. Examples include ensuring that ensuring that parallel pipes have flow in the same direction.

Missing docstring.

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

Missing docstring.

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

Compressor Constraints

Operations Constraints

The primary constraints related to compressors ensure that that the compressors operate within the limits of their capability (boost ratio, energy consumption, etc.). These constraints use the ne and directed naming conventions to denote constraints where the compressor is an expansion option or direction of flow is fixed, respectively.

GasModels.constraint_compressor_ratiosFunction

Template: Compression ratios for a compressor

source

Constraint: enforces pressure changes bounds that obey compression ratios for a compressor with on/off direction variables

source

Constraint: Compressor ratio constraints on pressure differentials–not applicable for MIP models

source

Constraint: Compressor ratio constraints on pressure differentials–not applicable for LP models

source

enforces pressure changes bounds that obey compression ratios for an undirected compressor.

source
GasModels.constraint_compressor_ratios_directedFunction

Constraint: Compressor ratio when the flow direction is constrained

source

Template: Constraints on compressor ratios when flow is restricted to one direction

source

Constraint: Compressor ratio when the flow direction is constrained–not applicable for MIP models

source

Constraint: Compressor ratio when the flow direction is constrained–not applicable for LP models

source
GasModels.constraint_compressor_ratios_neFunction

Template: constraints on pressure drop across a compressor

source

Constraint: constraints on pressure drop across expansion compressors with on/off decision variables

source

Constraint: compressor ratios on a new compressor–not applicable for MIP models-not applicable for MIP models

source

Constraint: compressor ratios on a new compressor–not applicable for MIP models-not applicable for LP models

source

constraints on pressure drop across a compressor

source
GasModels.constraint_compressor_ratios_ne_directedFunction

Constraint: Pressure drop across an expansion compressor when direction is constrained

source

Template: Constraints on compressor ratios when flow is restricted to one direction and the compressor is an expanson option

source

Constraint: Pressure drop across an expansion compressor when direction is constrained-not applicable for MIP models

source

Constraint: Pressure drop across an expansion compressor when direction is constrained-not applicable for LP models

source

Direction On/off Constraints

The disjunctive forms of problems (where directions are controlled by on/off variables) include special constraints to connect direction of flow with the choice of the binary variable.

Missing docstring.

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

Missing docstring.

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

Network Expansion Constraints

Constraints are also used to turn on/off flow through a compressor in expansion planning formulations

Control Valve Constraints

Operations Constraints

The primary constraints related to control valves ensure that that the valves operate within the limits of their capability (pressure reduction). These constraints use the directed naming conventions to denote constraints where the control valve direction of flow is fixed. The control valve also has an open/close variable to determine whether or not flow is allowed through the valve

Missing docstring.

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

Missing docstring.

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

Missing docstring.

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

Missing docstring.

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

Direction On/off Constraints

The disjunctive forms of problems (where directions are controlled by on/off variables) include special constraints to connect direction of flow with the choice of the binary variable.

Missing docstring.

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

Missing docstring.

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

Valve Constraints

Operations Constraints

The primary function of a valve is to open or close a pipe. These constraints use the directed naming conventions to denote constraints where the valve direction of flow is fixed.

GasModels.constraint_on_off_valve_pressureFunction

Constraint: Constraints on pressure drop across valves where the valve can open or close

source

Template: Constraint on pressure drop across valves, where the valve may be closed or opened

source

Constraint: Constraints on pressure drop across valves where the valve can open or close–not applicable for MIP models

source

Constraint: Constraints on pressure drop across valves where the valve can open or close–not applicable for LP models

source

Direction On/off Constraints

The disjunctive forms of problems (where directions are controlled by on/off variables) include special constraints to connect direction of flow with the choice of the binary variable.

Missing docstring.

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

Missing docstring.

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

Short Pipes

Pressure Constraints

Short pipes are used to model frictionless connections between junctions. The primary constraint ensures the pressure on both sides of the short pipe are the same. These constraints use the directed naming conventions to denote constraints where the control valve direction of flow is fixed.

GasModels.constraint_short_pipe_pressureFunction

Constraint: Constraint on pressure drop across a short pipe

source

Template: Constraint on pressure drop across a short pipe

source

Constraint: Constraint on pressure drop across a short pipe–not applicable for MIP models

source

Constraint: Constraint on pressure drop across a short pipe–not applicable for LP models

source
Missing docstring.

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

Direction On/off Constraints

The disjunctive forms of problems (where directions are controlled by on/off variables) include special constraints to connect direction of flow with the choice of the binary variable.

Missing docstring.

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

Missing docstring.

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