Constraints

Constraint Templates

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

These templates should be defined over AbstractPowerModel and should not refer to model variables. For more details, see the files: core/constraint_template.jl and core/constraint.jl (core/constraint_template.jl provides higher level APIs, and pulls out index information from the data dictionaries, before calling out to methods defined in core/constraint.jl).

Voltage Constraints

PowerModels.constraint_model_voltageFunction

This constraint captures problem agnostic constraints that are used to link the model's voltage variables together, in addition to the standard problem formulation constraints.

Notable examples include the constraints linking the voltages in the ACTPowerModel, constraints linking convex relaxations of voltage variables.

source

do nothing, most models to not require any model-specific voltage constraints

source
source
source
source
source
source
source
PowerModels.constraint_model_voltage_on_offFunction

This constraint captures problem agnostic constraints that are used to link the model's voltage variables together, in addition to the standard problem formulation constraints. The on/off name indicates that the voltages in this constraint can be set to zero via an indicator variable

Notable examples include the constraints linking the voltages in the ACTPowerModel, constraints linking convex relaxations of voltage variables.

source

do nothing, most models to not require any model-specific on/off voltage constraints

source

do nothing, this model does not have complex voltage constraints

source

do nothing, this model does not have complex voltage variables

source
source
source
PowerModels.constraint_model_voltage_neFunction

This constraint captures problem agnostic constraints that are used to link the model's voltage variables together, in addition to the standard problem formulation constraints. The network expantion name (ne) indicates that the voltages in this constraint can be set to zero via an indicator variable

Notable examples include the constraints linking the voltages in the ACTPowerModel, constraints linking convex relaxations of voltage variables.

source

do nothing, most models to not require any model-specific network expansion voltage constraints

source

do nothing, this model does not have complex voltage constraints

source

do nothing, this model does not have complex voltage variables

source
source

Generator Constraints

Bus Constraints

Setpoint Constraints

Power Balance Constraints

KCL Constraints

Missing docstring.

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

Missing docstring.

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

Missing docstring.

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

Branch Constraints

Ohm's Law Constraints

PowerModels.constraint_ohms_yt_fromFunction
source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

p[f_idx] ==  (g+g_fr)/tm*v[f_bus]^2 + (-g*tr+b*ti)/tm^2*(v[f_bus]*v[t_bus]*cos(t[f_bus]-t[t_bus])) + (-b*tr-g*ti)/tm^2*(v[f_bus]*v[t_bus]*sin(t[f_bus]-t[t_bus]))
q[f_idx] == -(b+b_fr)/tm*v[f_bus]^2 - (-b*tr-g*ti)/tm^2*(v[f_bus]*v[t_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr+b*ti)/tm^2*(v[f_bus]*v[t_bus]*sin(t[f_bus]-t[t_bus]))
source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

p[f_idx] == -b*(t[f_bus] - t[t_bus])
source

nothing to do, no voltage angle variables

source
source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

source
PowerModels.constraint_ohms_yt_toFunction
source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

p[t_idx] ==  (g+g_to)*v[t_bus]^2 + (-g*tr-b*ti)/tm^2*(v[t_bus]*v[f_bus]*cos(t[t_bus]-t[f_bus])) + (-b*tr+g*ti)/tm^2*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus]))
q[t_idx] == -(b+b_to)*v[t_bus]^2 - (-b*tr+g*ti)/tm^2*(v[t_bus]*v[f_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr-b*ti)/tm^2*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus]))
source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

source

nothing to do, this model is symetric

source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

source
source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

source
PowerModels.constraint_ohms_y_fromFunction
source

Creates Ohms constraints for AC models (y post fix indicates that Y values are in rectangular form)

p[f_idx] ==  (g+g_fr)*(v[f_bus]/tr)^2 + -g*v[f_bus]/tr*v[t_bus]*cos(t[f_bus]-t[t_bus]-as) + -b*v[f_bus]/tr*v[t_bus]*sin(t[f_bus]-t[t_bus]-as)
q[f_idx] == -(b+b_fr)*(v[f_bus]/tr)^2 + b*v[f_bus]/tr*v[t_bus]*cos(t[f_bus]-t[t_bus]-as) + -g*v[f_bus]/tr*v[t_bus]*sin(t[f_bus]-t[t_bus]-as)
source
PowerModels.constraint_ohms_y_toFunction
source

Creates Ohms constraints for AC models (y post fix indicates that Y values are in rectangular form)

p[t_idx] ==  (g+g_to)*v[t_bus]^2 + -g*v[t_bus]*v[f_bus]/tr*cos(t[t_bus]-t[f_bus]+as) + -b*v[t_bus]*v[f_bus]/tr*sin(t[t_bus]-t[f_bus]+as)
q[t_idx] == -(b+b_to)*v[t_bus]^2 +  b*v[t_bus]*v[f_bus]/tr*cos(t[f_bus]-t[t_bus]+as) + -g*v[t_bus]*v[f_bus]/tr*sin(t[t_bus]-t[f_bus]+as)
source

On/Off Ohm's Law Constraints

PowerModels.constraint_ohms_yt_from_on_offFunction
source
p[f_idx] == z*(g/tm*v[f_bus]^2 + (-g*tr+b*ti)/tm^2*(v[f_bus]*v[t_bus]*cos(t[f_bus]-t[t_bus])) + (-b*tr-g*ti)/tm^2*(v[f_bus]*v[t_bus]*sin(t[f_bus]-t[t_bus])))
q[f_idx] == z*(-(b+c/2)/tm*v[f_bus]^2 - (-b*tr-g*ti)/tm^2*(v[f_bus]*v[t_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr+b*ti)/tm^2*(v[f_bus]*v[t_bus]*sin(t[f_bus]-t[t_bus])))
source

-b*(t[f_bus] - t[t_bus] + vad_min*(1-z_branch[i])) <= p[f_idx] <= -b*(t[f_bus] - t[t_bus] + vad_max*(1-z_branch[i]))

source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

p[f_idx] ==        g/tm*w_fr[i] + (-g*tr+b*ti)/tm*(wr[i]) + (-b*tr-g*ti)/tm*(wi[i])
q[f_idx] == -(b+c/2)/tm*w_fr[i] - (-b*tr-g*ti)/tm*(wr[i]) + (-g*tr+b*ti)/tm*(wi[i])
source
PowerModels.constraint_ohms_yt_to_on_offFunction
source
p[t_idx] == z*(g*v[t_bus]^2 + (-g*tr-b*ti)/tm^2*(v[t_bus]*v[f_bus]*cos(t[t_bus]-t[f_bus])) + (-b*tr+g*ti)/tm^2*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus])))
q[t_idx] == z*(-(b+c/2)*v[t_bus]^2 - (-b*tr+g*ti)/tm^2*(v[t_bus]*v[f_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr-b*ti)/tm^2*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus])))
source

nothing to do, this model is symetric

source
source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

p[t_idx] ==        g*w_to[i] + (-g*tr-b*ti)/tm*(wr[i]) + (-b*tr+g*ti)/tm*(-wi[i])
q[t_idx] == -(b+c/2)*w_to[i] - (-b*tr+g*ti)/tm*(wr[i]) + (-g*tr-b*ti)/tm*(-wi[i])
source
PowerModels.constraint_ohms_yt_from_neFunction
source
p_ne[f_idx] == z*(g/tm*v[f_bus]^2 + (-g*tr+b*ti)/tm^2*(v[f_bus]*v[t_bus]*cos(t[f_bus]-t[t_bus])) + (-b*tr-g*ti)/tm^2*(v[f_bus]*v[t_bus]*sin(t[f_bus]-t[t_bus])))
q_ne[f_idx] == z*(-(b+c/2)/tm*v[f_bus]^2 - (-b*tr-g*ti)/tm^2*(v[f_bus]*v[t_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr+b*ti)/tm^2*(v[f_bus]*v[t_bus]*sin(t[f_bus]-t[t_bus])))
source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

p[f_idx] == g/tm*w_fr_ne[i] + (-g*tr+b*ti)/tm*(wr_ne[i]) + (-b*tr-g*ti)/tm*(wi_ne[i])
q[f_idx] == -(b+c/2)/tm*w_fr_ne[i] - (-b*tr-g*ti)/tm*(wr_ne[i]) + (-g*tr+b*ti)/tm*(wi_ne[i])
source
PowerModels.constraint_ohms_yt_to_neFunction
source
p_ne[t_idx] == z*(g*v[t_bus]^2 + (-g*tr-b*ti)/tm^2*(v[t_bus]*v[f_bus]*cos(t[t_bus]-t[f_bus])) + (-b*tr+g*ti)/tm^2*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus])))
q_ne[t_idx] == z*(-(b+c/2)*v[t_bus]^2 - (-b*tr+g*ti)/tm^2*(v[t_bus]*v[f_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr-b*ti)/tm^2*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus])))
source

nothing to do, this model is symetric

source
source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

p[t_idx] == g*w_to_ne[i] + (-g*tr-b*ti)/tm*(wr_ne[i]) + (-b*tr+g*ti)/tm*(-wi_ne[i])
q[t_idx] == -(b+c/2)*w_to_ne[i] - (-b*tr+g*ti)/tm*(wr_ne[i]) + (-g*tr-b*ti)/tm*(-wi_ne[i])
source

Current

Thermal Limit Constraints

PowerModels.constraint_thermal_limit_fromFunction
constraint_thermal_limit_from(pm::AbstractPowerModel, n::Int, i::Int)

Adds the (upper and lower) thermal limit constraints for the desired branch to the PowerModel.

source

p[f_idx]^2 + q[f_idx]^2 <= rate_a^2

source

[rate_a, p[f_idx], q[f_idx]] in SecondOrderCone

source

p[f_idx]^2 + q[f_idx]^2 <= rate_a^2

source

-rate_a <= p[f_idx] <= rate_a

source

Current Limit Constraints

Phase Angle Difference Constraints

Loss Constraints

Storage Constraints

Missing docstring.

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

DC Line Constraints