# Constraints

PowerModelsDistribution.constraint_SWL_psdMethod

Take a multi-conductor voltage variable V and a current variable I. The associated power is then defined as S = VI^H Define the lifted variables as W and L as W = VV^H, L = I*I^H Then, it is equally valid that [W S; S^H L] ∈ PSDCone, rank([W S; S^H L])=1 This function adds this PSD constraint for the rectangular coordinates of S, W and L.

source
PowerModelsDistribution.constraint_capacitor_on_offMethod
constraint_capacitor_on_off(pm::AbstractUnbalancedACPModel, i::Int; nw::Int=nw_id_default)

Add constraints to model capacitor switching

\begin{align} &\text{kvar control (ON): } q-q_\text{on} ≤ M_q ⋅ z - ϵ ⋅ (1-z), \\ &\text{kvar control (OFF): } q-q_\text{off} ≥ -M_q ⋅ (1-z) - ϵ ⋅ z, \\ &\text{voltage control (ON): } v-v_\text{min} ≥ -M_v ⋅ z + ϵ ⋅ (1-z), \\ &\text{voltage control (OFF): } v-v_\text{max} ≤ M_v ⋅ (1-z) - ϵ ⋅ z. \end{align}
source
PowerModelsDistribution.constraint_capacitor_on_offMethod
constraint_capacitor_on_off(pm::AbstractUnbalancedACRModel, i::Int; nw::Int=nw_id_default)

Add constraints to model capacitor switching

\begin{align} &\text{kvar control (ON): } q-q_\text{on} ≤ M_q ⋅ z - ϵ ⋅ (1-z), \\ &\text{kvar control (OFF): } q-q_\text{off} ≥ -M_q ⋅ (1-z) - ϵ ⋅ z, \\ &\text{voltage control (ON): } v_r^2 + v_i^2 - v_\text{min}^2 ≥ -M_v ⋅ z + ϵ ⋅ (1-z), \\ &\text{voltage control (OFF): } v_r^2 + v_i^2 - v_\text{max}^2 ≤ M_v ⋅ (1-z) - ϵ ⋅ z. \end{align}
source
PowerModelsDistribution.constraint_capacitor_on_offMethod
constraint_capacitor_on_off(pm::AbstractUnbalancedIVRModel, i::Int; nw::Int=nw_id_default)

Add constraints to model capacitor switching

\begin{align} &\text{kvar control: } s = (vr_fr+im*vi_fr).*(cr_fr-im*ci_fr),\\ &\text{kvar control (ON): } \Im{s}-q_\text{on} ≤ M_q ⋅ z - ϵ ⋅ (1-z), \\ &\text{kvar control (OFF): } \Im{s}-q_\text{off} ≥ -M_q ⋅ (1-z) - ϵ ⋅ z, \\ &\text{voltage control (ON): } v_r^2 + v_i^2 - v_\text{min}^2 ≥ -M_v ⋅ z + ϵ ⋅ (1-z), \\ &\text{voltage control (OFF): } v_r^2 + v_i^2 - v_\text{max}^2 ≤ M_v ⋅ (1-z) - ϵ ⋅ z. \end{align}
source
PowerModelsDistribution.constraint_capacitor_on_offMethod
constraint_capacitor_on_off(pm::FBSUBFPowerModel, i::Int; nw::Int=nw_id_default)

Add constraints to model capacitor switching

\begin{align} &\text{kvar control (ON): } q-q_\text{on} ≤ M_q ⋅ z - ϵ ⋅ (1-z), \\ &\text{kvar control (OFF): } q-q_\text{off} ≥ -M_q ⋅ (1-z) - ϵ ⋅ z, \\ &\text{voltage control (ON): } 2 ⋅ v_{r0} ⋅ v_r + 2 ⋅ v_{i0} ⋅ v_i - v_{r0}^2 - v_{i0}^2 - v_\text{min}^2 ≥ -M_v ⋅ z + ϵ ⋅ (1-z), \\ &\text{voltage control (OFF): } 2 ⋅ v_{r0} ⋅ v_r + 2 ⋅ v_{i0} ⋅ v_i - v_{r0}^2 - v_{i0}^2 - v_\text{max}^2 ≤ M_v ⋅ (1-z) - ϵ ⋅ z. \end{align}
source
PowerModelsDistribution.constraint_capacitor_on_offMethod
constraint_capacitor_on_off(pm::LPUBFDiagModel, i::Int; nw::Int=nw_id_default)

Add constraints to model capacitor switching

\begin{align} &\text{kvar control (ON): } q-q_\text{on} ≤ M_q ⋅ z - ϵ ⋅ (1-z), \\ &\text{kvar control (OFF): } q-q_\text{off} ≥ -M_q ⋅ (1-z) - ϵ ⋅ z, \\ &\text{voltage control (ON): } w - v_\text{min}^2 ≥ -M_v ⋅ z + ϵ ⋅ (1-z), \\ &\text{voltage control (OFF): } w - v_\text{max}^2 ≤ M_v ⋅ (1-z) - ϵ ⋅ z. \end{align}
source
PowerModelsDistribution.constraint_mc_ampacity_fromMethod
constraint_mc_ampacity_from(pm::AbstractUnbalancedACPModel, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, c_rating::Vector{<:Real})::Nothing

ACP current limit constraint on branches from-side

mathp_{fr}^2 + q_{fr}^2 \leq vm_{fr}^2 i_{max}^2

source
PowerModelsDistribution.constraint_mc_ampacity_fromMethod
constraint_mc_ampacity_from(pm::AbstractUnbalancedRectangularModels, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, c_rating::Vector{<:Real})::Nothing

ACP current limit constraint on branches from-side

mathp_{fr}^2 + q_{fr}^2 \leq (vr_{fr}^2 + vi_{fr}^2) i_{max}^2

source
PowerModelsDistribution.constraint_mc_ampacity_fromMethod
constraint_mc_ampacity_from(pm::AbstractUnbalancedWModels, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, c_rating::Vector{<:Real})::Nothing

ACP current limit constraint on branches from-side

mathp_{fr}^2 + q_{fr}^2 \leq w_{fr} i_{max}^2

source
PowerModelsDistribution.constraint_mc_ampacity_fromMethod
constraint_mc_ampacity_from(pm::AbstractUnbalancedWModels, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, c_rating::Vector{<:Real})

ACP current limit constraint on branches from-side

mathp_{fr}^2 + q_{fr}^2 \leq w_{fr} i_{max}^2

source
PowerModelsDistribution.constraint_mc_ampacity_toMethod
constraint_mc_ampacity_to(pm::AbstractUnbalancedACPModel, nw::Int, t_idx::Tuple{Int,Int,Int}, t_connections::Vector{Int}, c_rating::Vector{<:Real})::Nothing

ACP current limit constraint on branches to-side

mathp_{to}^2 + q_{to}^2 \leq vm_{to}^2 i_{max}^2

source
PowerModelsDistribution.constraint_mc_ampacity_toMethod
constraint_mc_ampacity_to(pm::AbstractUnbalancedRectangularModels, nw::Int, t_idx::Tuple{Int,Int,Int}, t_connections::Vector{Int}, c_rating::Vector{<:Real})::Nothing

ACP current limit constraint on branches to-side

mathp_{to}^2 + q_{to}^2 \leq (vr_{to}^2 + vi_{to}^2) i_{max}^2

source
PowerModelsDistribution.constraint_mc_ampacity_toMethod
constraint_mc_ampacity_to(pm::AbstractUnbalancedWModels, nw::Int, t_idx::Tuple{Int,Int,Int}, t_connections::Vector{Int}, c_rating::Vector{<:Real})::Nothing

ACP current limit constraint on branches to-side

mathp_{to}^2 + q_{to}^2 \leq w_{to} i_{max}^2

source
PowerModelsDistribution.constraint_mc_ampacity_toMethod
constraint_mc_ampacity_to(pm::AbstractUnbalancedWModels, nw::Int, t_idx::Tuple{Int,Int,Int}, t_connections::Vector{Int}, c_rating::Vector{<:Real})

ACP current limit constraint on branches to-side

mathp_{to}^2 + q_{to}^2 \leq w_{to} i_{max}^2

source
PowerModelsDistribution.constraint_mc_branch_current_limitMethod
function constraint_mc_branch_current_limit(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector,
t_connections::Vector,
c_rating::Vector{<:Real};
report::Bool=true
)

For ACR models with explicit neutrals, imposes a bound on the total current magnitude per conductor.

p_fr^2 + q_fr^2 <= r^2 * (vr_fr^2 + vi_fr^2)
p_to^2 + q_to^2 <= r^2 * (vr_to^2 + vi_to^2)
source
PowerModelsDistribution.constraint_mc_branch_current_limitMethod
function constraint_mc_branch_current_limit(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector,
t_connections::Vector,
c_rating::Vector{<:Real};
report::Bool=true
)

For IVR models with explicit neutrals, imposes a bound on the current magnitude per conductor at both ends of the branch (total current, i.e. including shunt contributions).

cr_fr^2 + ci_fr^2 <= c_rating^2
cr_to^2 + ci_to^2 <= c_rating^2
source
PowerModelsDistribution.constraint_mc_branch_current_limitMethod
function constraint_mc_branch_current_limit(
pm::ExplicitNeutralModels,
id::Int;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true,
)

For models with explicit neutrals, imposes a bound on the current magnitude per conductor at both ends of the branch (total current, i.e. including shunt contributions)

source
PowerModelsDistribution.constraint_mc_bus_voltage_balanceMethod
constraint_mc_bus_voltage_balance(pm::AbstractUnbalancedPowerModel, bus_id::Int; nw=nw_id_default)::Nothing

Template function for bus voltage balance constraints.

Impose all balance related constraints for which key present in data model of bus. For a discussion of sequence components and voltage unbalance factor (VUF), see @INPROCEEDINGS{girigoudarmolzahnroald-2019, author={K. Girigoudar and D. K. Molzahn and L. A. Roald}, booktitle={submitted}, title={{Analytical and Empirical Comparisons of Voltage Unbalance Definitions}}, year={2019}, month={}, url={https://molzahn.github.io/pubs/girigoudarmolzahnroald-2019.pdf} }

source
PowerModelsDistribution.constraint_mc_bus_voltage_dropMethod
function constraint_mc_bus_voltage_drop(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
i::Int,
f_bus::Int,
t_bus::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
r::Matrix{<:Real},
x::Matrix{<:Real}
)

For IVR models with explicit neutrals, defines voltage drop over a branch, linking from and to side complex voltage.

vr_to == vr_fr - r*csr_fr + x*csi_fr
vi_to == vi_fr - r*csi_fr - x*csr_fr
source
PowerModelsDistribution.constraint_mc_current_balanceMethod
function constraint_mc_current_balance(
pm::RectangularVoltageExplicitNeutralModels,
nw::Int,
i::Int,
terminals::Vector{Int},
grounded::Vector{Bool},
bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}},
bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}},
bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}},
bus_gens::Vector{Tuple{Int,Vector{Int}}},
bus_storage::Vector{Tuple{Int,Vector{Int}}},
bus_shunts::Vector{Tuple{Int,Vector{Int}}}
)

Kirchhoff's current law applied to buses sum(cr + im*ci) = 0

source
PowerModelsDistribution.constraint_mc_current_balance_capcMethod
constraint_mc_current_balance_capc(pm::AbstractUnbalancedIVRModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

Current balance constraints with capacitor control.

source
PowerModelsDistribution.constraint_mc_current_fromMethod
function constraint_mc_current_from(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
f_bus::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
g_sh_fr::Matrix{<:Real},
b_sh_fr::Matrix{<:Real};
report::Bool=true
)

For IVR models with explicit neutrals, defines how current distributes over series and shunt impedances of a pi-model branch.

cr_fr == csr_fr + g_sh_fr*vr_fr - b_sh_fr*vi_fr
ci_fr == csi_fr + g_sh_fr*vi_fr + b_sh_fr*vr_fr
source
PowerModelsDistribution.constraint_mc_current_fromMethod
function constraint_mc_current_from(
pm::ReducedExplicitNeutralIVRModels,
nw::Int,
f_bus::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
g_sh_fr::Matrix{<:Real},
b_sh_fr::Matrix{<:Real};
report::Bool=true
)

For branch-reduced IVR models with explicit neutrals, defines how current distributes over series and shunt impedances of a pi-model branch.

cr_fr = csr_fr + g_sh_fr*vr_fr - b_sh_fr*vi_fr
ci_fr = csi_fr + g_sh_fr*vi_fr + b_sh_fr*vr_fr
source
PowerModelsDistribution.constraint_mc_current_toMethod
function constraint_mc_current_to(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
t_bus,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
g_sh_to::Matrix{<:Real},
b_sh_to::Matrix{<:Real};
report::Bool=true
)

For IVR models with explicit neutrals, defines how current distributes over series and shunt impedances of a pi-model branch.

cr_to == csr_to + g_sh_to*vr_to - b_sh_to*vi_to
ci_to == csi_to + g_sh_to*vi_to + b_sh_to*vr_to
source
PowerModelsDistribution.constraint_mc_current_toMethod
function constraint_mc_current_to(
pm::ReducedExplicitNeutralIVRModels,
nw::Int,
t_bus,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
g_sh_to::Matrix{<:Real},
b_sh_to::Matrix{<:Real};
report::Bool=true
)

For branch-reduced IVR models with explicit neutrals, defines how current distributes over series and shunt impedances of a pi-model branch.

cr_to = csr_to + g_sh_to*vr_to - b_sh_to*vi_to
ci_to = csi_to + g_sh_to*vi_to + b_sh_to*vr_to
source
PowerModelsDistribution.constraint_mc_generator_currentMethod
function constraint_mc_generator_current(
pm::AbstractExplicitNeutralIVRModel,
id::Int;
nw::Int=nw_id_default,
report::Bool=true,
bounded::Bool=true
)

For IVR models with explicit neutrals, creates expressions for the terminal current flows :crg_bus and :cig_bus.

source
PowerModelsDistribution.constraint_mc_generator_current_deltaMethod
function constraint_mc_generator_current_delta(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
id::Int,
connections::Vector{Int};
report::Bool=true,
bounded::Bool=true
)

For IVR models with explicit neutrals, creates expressions for the terminal current flows :crg_bus and :cig_bus of delta-connected generators

source
PowerModelsDistribution.constraint_mc_generator_current_wyeMethod
function constraint_mc_generator_current_wye(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
id::Int,
connections::Vector{Int};
report::Bool=true,
bounded::Bool=true
)

For IVR models with explicit neutrals, creates expressions for the terminal current flows :crg_bus and :cig_bus of wye-connected generators

source
PowerModelsDistribution.constraint_mc_generator_powerMethod
constraint_mc_generator_power(pm::AbstractUnbalancedPowerModel, id::Int; nw::Int=nw_id_default, report::Bool=true, bounded::Bool=true)::Nothing

Template function for generator power constraints

DELTA

When connected in delta, the load power gives the reference in the delta reference frame. This means

$$$sd_1 = v_ab.conj(i_ab) = (v_a-v_b).conj(i_ab)$$$

We can relate this to the per-phase power by

$$$sn_a = v_a.conj(i_a) = v_a.conj(i_ab-i_ca) = v_a.conj(conj(s_ab/v_ab) - conj(s_ca/v_ca)) = v_a.(s_ab/(v_a-v_b) - s_ca/(v_c-v_a))$$$

So for delta, sn is constrained indirectly.

source
PowerModelsDistribution.constraint_mc_generator_power_deltaMethod
function constraint_mc_generator_power_delta(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
pmin::Vector{<:Real},
pmax::Vector{<:Real},
qmin::Vector{<:Real},
qmax::Vector{<:Real};
report::Bool=true,
bounded::Bool=true
)

For ACR models with explicit neutrals, links the terminal power flows :pg_bus and :qg_bus to the power variables :pg and :qg for delta-connected generators

source
PowerModelsDistribution.constraint_mc_generator_power_deltaMethod
function constraint_mc_generator_power_delta(
pm::AbstractNLExplicitNeutralIVRModel,
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
pmin::Vector{<:Real},
pmax::Vector{<:Real},
qmin::Vector{<:Real},
qmax::Vector{<:Real};
report::Bool=true
)

For IVR models with explicit neutrals, creates non-linear expressions for the generator power :pd and :qd of delta-connected generators as a function of voltage and current

source
PowerModelsDistribution.constraint_mc_generator_power_deltaMethod
function constraint_mc_generator_power_delta(
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
pmin::Vector{<:Real},
pmax::Vector{<:Real},
qmin::Vector{<:Real},
qmax::Vector{<:Real};
report::Bool=true,
bounded::Bool=true
)

For quadratic IVR models with explicit neutrals, links the generator power variables :pd and :qd of delta-connected generators to the voltage and current

source
PowerModelsDistribution.constraint_mc_generator_power_deltaMethod
constraint_mc_generator_power_delta(pm::FBSUBFPowerModel, nw::Int, id::Int, bus_id::Int, connections::Vector{Int}, pmin::Vector{<:Real}, pmax::Vector{<:Real}, qmin::Vector{<:Real}, qmax::Vector{<:Real}; report::Bool=true, bounded::Bool=true)

\begin{align} &\text{Initial line-neutral voltage: } V_0 = V_{r0} +j V_{i0}\\ &\text{Three-phase delta transformation matrix: } M^\Delta = \begin{bmatrix}\;\;\;1 & -1 & \;\;0\\ \;\;\;0 & \;\;\;1 & -1\\ -1 & \;\;\;0 & \;\;\;1\end{bmatrix} \\ &\text{Single-phase delta transformation matrix (triple nodes): } M^\Delta = \begin{bmatrix}\;1 & -1 \end{bmatrix} \\ &\text{Initial line-line voltage: } V_0^\Delta = M^\Delta V_0 \\ &\text{Line-line current: } (I^\Delta)^* = S^\Delta \oslash V_0^\Delta \\ &\text{Line-neutral current: } I_{bus} = (M^\Delta)^T I^\Delta \\ &\text{Bus generation power: } S_{bus} = V_0 \oslash I_{bus}^* \end{align}
source
PowerModelsDistribution.constraint_mc_generator_power_deltaMethod
constraint_mc_generator_power_delta(pm::FOTPUPowerModel, nw::Int, id::Int, bus_id::Int, connections::Vector{Int}, pmin::Vector{<:Real}, pmax::Vector{<:Real}, qmin::Vector{<:Real}, qmax::Vector{<:Real}; report::Bool=true, bounded::Bool=true)

\begin{align} &\text{Initial line-neutral voltage: } V_0 = V_{m0} \angle V_{a0}\\ &\text{Three-phase delta transformation matrix: } M^\Delta = \begin{bmatrix}\;\;\;1 & -1 & \;\;0\\ \;\;\;0 & \;\;\;1 & -1\\ -1 & \;\;\;0 & \;\;\;1\end{bmatrix} \\ &\text{Single-phase delta transformation matrix (triple nodes): } M^\Delta = \begin{bmatrix}\;1 & -1 \end{bmatrix} \\ &\text{Initial line-line voltage: } V_0^\Delta = M^\Delta V_0 \\ &\text{Line-line current: } (I^\Delta)^* = S^\Delta \oslash V_0^\Delta \\ &\text{Line-neutral current: } I_{bus} = (M^\Delta)^T I^\Delta \\ &\text{Line-neutral generation power: } S_{bus} = V_0 \oslash I_{bus}^* \end{align}
source
PowerModelsDistribution.constraint_mc_generator_power_deltaMethod
constraint_mc_generator_power_delta(pm::FOTRUPowerModel, nw::Int, id::Int, bus_id::Int, connections::Vector{Int}, pmin::Vector{<:Real}, pmax::Vector{<:Real}, qmin::Vector{<:Real}, qmax::Vector{<:Real}; report::Bool=true, bounded::Bool=true)

\begin{align} &\text{Initial line-neutral voltage: } V_0 = V_{r0} +j V_{i0}\\ &\text{Three-phase delta transformation matrix: } M^\Delta = \begin{bmatrix}\;\;\;1 & -1 & \;\;0\\ \;\;\;0 & \;\;\;1 & -1\\ -1 & \;\;\;0 & \;\;\;1\end{bmatrix} \\ &\text{Single-phase delta transformation matrix (triple nodes): } M^\Delta = \begin{bmatrix}\;1 & -1 \end{bmatrix} \\ &\text{Initial line-line voltage: } V_0^\Delta = M^\Delta V_0 \\ &\text{Line-line current: } (I^\Delta)^* = S^\Delta \oslash V_0^\Delta \\ &\text{Line-neutral current: } I_{bus} = (M^\Delta)^T I^\Delta \\ &\text{Line-neutral generation power: } S_{bus} = V_0 \oslash I_{bus}^* \end{align}
source
PowerModelsDistribution.constraint_mc_generator_power_deltaMethod
constraint_mc_generator_power_delta(pm::LPUBFDiagModel, nw::Int, gen_id::Int, bus_id::Int, connections::Vector{Int}, pmin::Vector{<:Real}, pmax::Vector{<:Real}, qmin::Vector{<:Real}, qmax::Vector{<:Real}; report::Bool=true, bounded::Bool=true)

Adds constraints for delta-connected generators similar to delta-connected loads (using auxilary variable X).

\begin{align} &\text{Three-phase delta transformation matrix: } T^\Delta = \begin{bmatrix}\;\;\;1 & -1 & \;\;0\\ \;\;\;0 & \;\;\;1 & -1\\ -1 & \;\;\;0 & \;\;\;1\end{bmatrix} \\ &\text{Single-phase delta transformation matrix (triple nodes): } T^\Delta = \begin{bmatrix}\;1 & -1 \end{bmatrix} \\ &\text{Line-neutral generation power: } S_{bus} = diag(T^\Delta X_g) \\ &\text{Line-line generation power: } S^\Delta = diag(X_g T^\Delta) \end{align}
source
PowerModelsDistribution.constraint_mc_generator_power_deltaMethod
constraint_mc_generator_power_delta(pm::SOCUBFModels, nw::Int, gen_id::Int, bus_id::Int, connections::Vector{Int}, pmin::Vector{<:Real}, pmax::Vector{<:Real}, qmin::Vector{<:Real}, qmax::Vector{<:Real}; report::Bool=true, bounded::Bool=true)

Adds constraints for delta-connected generators similar to delta-connected loads (using auxilary variable X).

\begin{align} &\text{Three-phase delta transformation matrix: } T^\Delta = \begin{bmatrix}\;\;\;1 & -1 & \;\;0\\ \;\;\;0 & \;\;\;1 & -1\\ -1 & \;\;\;0 & \;\;\;1\end{bmatrix} \\ &\text{Single-phase delta transformation matrix (triple nodes): } T^\Delta = \begin{bmatrix}\;1 & -1 \end{bmatrix} \\ &\text{Line-neutral generation power: } S_{bus} = diag(T^\Delta X_g) \\ &\text{Line-line generation power: } S^\Delta = diag(X_g T^\Delta) \end{align}
source
PowerModelsDistribution.constraint_mc_generator_power_wyeMethod
function constraint_mc_generator_power_wye(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
pmin::Vector{<:Real},
pmax::Vector{<:Real},
qmin::Vector{<:Real},
qmax::Vector{<:Real};
report::Bool=true,
bounded::Bool=true
)

For ACR models with explicit neutrals, links the terminal power flows :pg_bus and :qg_bus to the power variables :pg and :qg for wye-connected generators

source
PowerModelsDistribution.constraint_mc_generator_power_wyeMethod
function constraint_mc_generator_power_wye(
pm::AbstractNLExplicitNeutralIVRModel,
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
pmin::Vector{<:Real},
pmax::Vector{<:Real},
qmin::Vector{<:Real},
qmax::Vector{<:Real};
report::Bool=true
)

For IVR models with explicit neutrals, creates non-linear expressions for the generator power :pd and :qd of wye-connected generators as a function of voltage and current

source
PowerModelsDistribution.constraint_mc_generator_power_wyeMethod
function constraint_mc_generator_power_wye(
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
pmin::Vector{<:Real},
pmax::Vector{<:Real},
qmin::Vector{<:Real},
qmax::Vector{<:Real};
report::Bool=true,
bounded::Bool=true
)

For quadratic IVR models with explicit neutrals, links the generator power variables :pd and :qd of wye-connected generators to the voltage and current

source
PowerModelsDistribution.constraint_mc_load_currentMethod
function constraint_mc_load_current(
pm::AbstractExplicitNeutralIVRModel,
id::Int;
nw::Int=nw_id_default,
report::Bool=true
)

For IVR models with explicit neutrals, create non-linear expressions for the terminal current flows :crd_bus and :cid_bus

source
PowerModelsDistribution.constraint_mc_load_currentMethod
function constraint_mc_load_current(
id::Int;
nw::Int=nw_id_default,
report::Bool=true,
bounded::Bool=true
)

For quadratic IVR models with explicit neutrals, create expressions for the terminal current flows :crd_bus and :cid_bus

source
PowerModelsDistribution.constraint_mc_load_current_deltaMethod
function constraint_mc_load_current_delta(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
a::Vector{<:Real},
alpha::Vector{<:Real},
b::Vector{<:Real},
beta::Vector{<:Real};
report::Bool=true
)

For IVR models with explicit neutrals, create non-linear expressions for the terminal current flows :crd_bus and :cid_bus of delta-connected loads

source
PowerModelsDistribution.constraint_mc_load_current_deltaMethod
function constraint_mc_load_current_delta(
nw::Int,
id::Int,
connections::Vector{Int};
report::Bool=true,
bounded::Bool=true
)

For quadratic IVR models with explicit neutrals, create expressions for the terminal current flows :crd_bus and :cid_bus for delta-connected loads

source
PowerModelsDistribution.constraint_mc_load_current_deltaMethod
constraint_mc_load_current_delta(pm::FOTPUPowerModel, nw::Int, load_id::Int, load_bus_id::Int, cp::Vector, cq::Vector)

No loads require a current variable. Delta loads are zero-order approximations and wye loads are first-order approximations around the initial operating point.

source
PowerModelsDistribution.constraint_mc_load_current_wyeMethod
function constraint_mc_load_current_wye(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
a::Vector{<:Real},
alpha::Vector{<:Real},
b::Vector{<:Real},
beta::Vector{<:Real};
report::Bool=true
)

For IVR models with explicit neutrals, create non-linear expressions for the terminal current flows :crd_bus and :cid_bus of wye-connected loads

source
PowerModelsDistribution.constraint_mc_load_current_wyeMethod
function constraint_mc_load_current_wye(
nw::Int,
id::Int,
connections::Vector{Int};
report::Bool=true,
bounded::Bool=true
)

For quadratic IVR models with explicit neutrals, create expressions for the terminal current flows :crd_bus and :cid_bus for wye-connected loads

source
PowerModelsDistribution.constraint_mc_load_powerMethod
function constraint_mc_load_power(
id::Int;
nw::Int=nw_id_default,
report::Bool=true
)

For quadratic IVR models with explicit neutrals, link the load power variables :pd and :qd to the voltage, and link together the power, voltage and current variables

source
PowerModelsDistribution.constraint_mc_load_powerMethod
constraint_mc_load_power(pm::AbstractUnbalancedPowerModel, id::Int; nw::Int=nw_id_default, report::Bool=true)::Nothing

CONSTANT POWER

$$$sd = [sd_1, sd_2, sd_3]$$$

What is actually fixed, depends on whether the load is connected in delta or wye. When connected in wye, the load power equals the per-phase power sn drawn at the bus to which the load is connected.

$$$sd_1 = v_a.conj(i_a) = sn_a$$$

CONSTANT CURRENT

Sets the active and reactive load power sd to be proportional to the the voltage magnitude.

$$$pd = cp.|vm| qd = cq.|vm| sd = cp.|vm| + j.cq.|vm|$$$

CONSTANT IMPEDANCE

Sets the active and reactive power drawn by the load to be proportional to the square of the voltage magnitude.

$$$pd = cp.|vm|^2 qd = cq.|vm|^2 sd = cp.|vm|^2 + j.cq.|vm|^2$$$

DELTA

When connected in delta, the load power gives the reference in the delta reference frame. This means

$$$sd_1 = v_ab.conj(i_ab) = (v_a-v_b).conj(i_ab)$$$

We can relate this to the per-phase power by

$$$sn_a = v_a.conj(i_a) = v_a.conj(i_ab-i_ca) = v_a.conj(conj(s_ab/v_ab) - conj(s_ca/v_ca)) = v_a.(s_ab/(v_a-v_b) - s_ca/(v_c-v_a))$$$

So for delta, sn is constrained indirectly.

source
PowerModelsDistribution.constraint_mc_load_powerMethod
constraint_mc_load_power(pm::FBSUBFPowerModel, load_id::Int; nw::Int=nw_id_default, report::Bool=true)

Load model is linearized around initial operating point. Wye loads are first-order and delta loads are zero-order approximations.

\begin{align} &\text{Initial operating point: } v_{rd}^0 + j ⋅ v_{id}^0~\text{where}~{(v_m^0)}^2 = {(v_{rd}^0)}^2 + {(v_{id}^0)}^2\\ &\text{Constant power: } P^d = P^{d0},~Q^d = Q^{d0} \\ &\text{Constant impedance: } P^d = a ⋅ \left(2\cdot v_{rd} ⋅ v_{rd}^0+2 ⋅ v_{id}*v_{id}^0-{(v_{m}^0)}^2\right),\\ & Q^d = b ⋅ \left(2\cdot v_{rd} ⋅ v_{rd}^0+2 ⋅ v_{id}*v_{id}^0-{(v_{m}^0)}^2\right), \\ &\text{Constant current: } P^d = a ⋅ \left(v_{m}^0 + \frac{v_{rd} ⋅ v_{rd}^0+ v_{id}*v_{id}^0-{(v_{m}^0)}^2}{v_{m}^0} \right),\\ & Q^d = b ⋅ \left(v_{m}^0 + \frac{v_{rd} ⋅ v_{rd}^0+ v_{id}*v_{id}^0-{(v_{m}^0)}^2}{v_{m}^0} \right). \end{align}
source
PowerModelsDistribution.constraint_mc_load_powerMethod
constraint_mc_load_power(pm::FOTPUPowerModel, load_id::Int; nw::Int=nw_id_default, report::Bool=true)

Load model is linearized around initial operating point. Wye loads are first-order and delta loads are zero-order approximations.

\begin{align} &\text{Initial operating point: } v_{m0} \angle v_{a0}\\ &\text{Constant power: } P^d = P^{d0},~Q^d = Q^{d0} \\ &\text{Constant impedance: } P^d = a \cdot \left({v_{m0}}^2+2 \cdot v_{m0} \cdot (v_m-v_{m0})\right),\\ & Q^d = b \cdot \left({v_{m0}}^2+2 \cdot v_{m0} \cdot (v_m-v_{m0})\right), \\ &\text{Constant current: } P^d = a \cdot v_m,\\ & Q^d = b \cdot v_m. \end{align}
source
PowerModelsDistribution.constraint_mc_load_powerMethod
constraint_mc_load_power(pm::LPUBFDiagModel, load_id::Int; nw::Int=nw_id_default, report::Bool=true)

Delta/voltage-dependent load models for LPUBFDiagModel. Delta loads use the auxilary power variable (X). The constant current load model is derived by linearizing around the flat-start voltage solution.

\begin{align} &\text{Constant power:} \Rightarrow P_i^d = P_i^{d0},~Q_i^d = Q_i^{d0} ~\forall i \in L \\ &\text{Constant impedance (Wye):} \Rightarrow P_i^d = a_i \cdot w_i,~Q_i^d = b_i \cdot w_i ~\forall i \in L \\ &\text{Constant impedance (Delta):} \Rightarrow P_i^d = 3\cdot a_i \cdot w_i,~Q_i^d = 3\cdot b_i \cdot w_i ~\forall i \in L \\ &\text{Constant current (Wye):} \Rightarrow P_i^d = \frac{a_i}{2}\cdot \left( 1+w_i \right),~Q_i^d = \frac{b_i}{2}\cdot \left( 1+w_i \right) \forall i \in L \\ &\text{Constant current (Delta):} \Rightarrow P_i^d = \frac{\sqrt{3} \cdot a_i}{2}\cdot \left( 1+w_i \right),~Q_i^d = \frac{\sqrt{3} \cdot b_i}{2}\cdot \left( 1+w_i \right) \forall i \in L \end{align}
source
PowerModelsDistribution.constraint_mc_load_power_deltaMethod
function constraint_mc_load_power_delta(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
a::Vector{<:Real},
alpha::Vector{<:Real},
b::Vector{<:Real},
beta::Vector{<:Real};
report::Bool=true
)

For ACR models with explicit neutrals, creates non-linear expressions for terminal power flows ':pdbus' and ':qdbus' of delta-connected loads

source
PowerModelsDistribution.constraint_mc_load_power_deltaMethod
function constraint_mc_load_power_delta(
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
a::Vector{<:Real},
b::Vector{<:Real};
report::Bool=true,
bounded::Bool=true
)

For quadratic IVR models with explicit neutrals, link the load power variables :pd and :qd to the voltage, and link together the power, voltage and current variables for delta-connected loads

source
PowerModelsDistribution.constraint_mc_load_power_wyeMethod
function constraint_mc_load_power_wye(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
a::Vector{<:Real},
alpha::Vector{<:Real},
b::Vector{<:Real},
beta::Vector{<:Real};
report::Bool=true
)

For ACR models with explicit neutrals, creates non-linear expressions for terminal power flows ':pdbus' and ':qdbus' of wye-connected loads

source
PowerModelsDistribution.constraint_mc_load_power_wyeMethod
function constraint_mc_load_power_wye(
nw::Int,
id::Int,
bus_id::Int,
connections::Vector{Int},
a::Vector{<:Real},
b::Vector{<:Real};
report::Bool=true,
bounded::Bool=true
)

For quadratic IVR models with explicit neutrals, link the load power variables :pd and :qd to the voltage, and link together the power, voltage and current variables for wye-connected loads

source
PowerModelsDistribution.constraint_mc_model_voltage_magnitude_differenceMethod
constraint_mc_model_voltage_magnitude_difference(pm::FBSUBFPowerModel, nw::Int, i::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, r::Matrix{<:Real}, x::Matrix{<:Real}, g_sh_fr::Matrix{<:Real}, b_sh_fr::Matrix{<:Real})

Voltage drop over a branch linearized around initial operating point (forward sweep)

\begin{align} &\text{Initial operating points: } (v_{r0}^{fr} + j ⋅ v_{i0}^{fr}),~ (v_{r0}^{to} + j ⋅ v_{i0}^{to})\\ &\text{Series active power flow: } p_s^{fr} = p^{fr} - g_{sh}^{fr} ⋅ {(v_{m0}^{fr})}^2,\\ &\text{Series reactive power flow: } q_s^{fr} = q^{fr} + b_{sh}^{fr} ⋅ {(v_{m0}^{fr})}^2,\\ &\text{Series real current flow: } cr_s^{fr} = \frac{(p_s^{fr} ⋅ v_{r0}^{fr} + q_s^{fr} ⋅ v_{i0}^{fr})}{{(v_{m0}^{fr})}^2},\\ &\text{Series imaginary current flow: } ci_s^{fr} = \frac{(-q_s^{fr} ⋅ v_{r0}^{fr} + p_s^{fr} ⋅ v_{i0}^{fr})}{{(v_{m0}^{fr})}^2},\\ &\text{Series real voltage drop: } v_{r}^{to} = v_{r}^{fr} - r ⋅ cr_s^{fr} + x ⋅ ci_s^{fr} ,\\ &\text{Series imaginary voltage drop: } v_{i}^{to} = v_{i}^{fr} - x ⋅ cr_s^{fr} - r ⋅ ci_s^{fr}. \end{align}
source
PowerModelsDistribution.constraint_mc_ohms_yt_fromMethod
function constraint_mc_ohms_yt_from(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
f_bus::Int,
t_bus::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
G::Matrix{<:Real},
B::Matrix{<:Real},
G_fr::Matrix{<:Real},
B_fr::Matrix{<:Real}
)

For ACR models with explicit neutrals, creates Ohms constraints for ACR models with explicit neutrals.

s_fr = v_fr.*conj(Y*(v_fr-v_to))
s_fr = (vr_fr+im*vi_fr).*(G-im*B)*([vr_fr-vr_to]-im*[vi_fr-vi_to])
s_fr = (vr_fr+im*vi_fr).*([G*vr_fr-G*vr_to-B*vi_fr+B*vi_to]-im*[G*vi_fr-G*vi_to+B*vr_fr-B*vr_to])
source
PowerModelsDistribution.constraint_mc_ohms_yt_fromMethod

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

p_fr ==     g[c,c] * vm_fr[c]^2 +
sum( g[c,d]*vm_fr[c]*vm_fr[d]*cos(va_fr[c]-va_fr[d]) +
b[c,d]*vm_fr[c]*vm_fr[d]*sin(va_fr[c]-va_fr[d]) for d in conductor_ids(pm) if d != c) +
sum(-g[c,d]*vm_fr[c]*vm_to[d]*cos(va_fr[c]-va_to[d]) +
-b[c,d]*vm_fr[c]*vm_to[d]*sin(va_fr[c]-va_to[d]) for d in conductor_ids(pm))
+ g_fr[c,c] * vm_fr[c]^2 +
sum( g_fr[c,d]*vm_fr[c]*vm_fr[d]*cos(va_fr[c]-va_fr[d]) +
b_fr[c,d]*vm_fr[c]*vm_fr[d]*sin(va_fr[c]-va_fr[d]) for d in conductor_ids(pm) if d != c)
)
q_fr == -b[c,c] *vm_fr[c]^2 -
sum( b[c,d]*vm_fr[c]*vm_fr[d]*cos(va_fr[c]-va_fr[d]) -
g[c,d]*vm_fr[c]*vm_fr[d]*sin(va_fr[c]-va_fr[d]) for d in conductor_ids(pm) if d != c) -
sum(-b[c,d]*vm_fr[c]*vm_to[d]*cos(va_fr[c]-va_to[d]) +
g[c,d]*vm_fr[c]*vm_to[d]*sin(va_fr[c]-va_to[d]) for d in conductor_ids(pm))
-b_fr[c,c] *vm_fr[c]^2 -
sum( b_fr[c,d]*vm_fr[c]*vm_fr[d]*cos(va_fr[c]-va_fr[d]) -
g_fr[c,d]*vm_fr[c]*vm_fr[d]*sin(va_fr[c]-va_fr[d]) for d in conductor_ids(pm) if d != c)
)
source
PowerModelsDistribution.constraint_mc_ohms_yt_fromMethod
constraint_mc_ohms_yt_from(pm::FOTPUPowerModel, nw::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, G::Matrix{<:Real}, B::Matrix{<:Real}, G_fr::Matrix{<:Real}, B_fr::Matrix{<:Real})

Ohm constraints similar to ACPUPowerModel. The nonlinear functions are approximated around initial operating points.

source
PowerModelsDistribution.constraint_mc_ohms_yt_fromMethod
constraint_mc_ohms_yt_from(pm::FOTRUPowerModel, nw::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, G::Matrix{<:Real}, B::Matrix{<:Real}, G_fr::Matrix{<:Real}, B_fr::Matrix{<:Real})

Creates Ohms constraints by linearizing (similar to power balance constraints) around initial operating point.

source
PowerModelsDistribution.constraint_mc_ohms_yt_toMethod
function constraint_mc_ohms_yt_to(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
f_bus::Int,
t_bus::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
G::Matrix,
B::Matrix,
G_to::Matrix,
B_to::Matrix
)

For ACR models with explicit neutrals, 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*(v[t_bus]*v[f_bus]*cos(t[t_bus]-t[f_bus])) + (-b*tr+g*ti)/tm*(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*(v[t_bus]*v[f_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr-b*ti)/tm*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus]))
source
PowerModelsDistribution.constraint_mc_ohms_yt_toMethod

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*(v[t_bus]*v[f_bus]*cos(t[t_bus]-t[f_bus])) + (-b*tr+g*ti)/tm*(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*(v[t_bus]*v[f_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr-b*ti)/tm*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus]))
source
PowerModelsDistribution.constraint_mc_ohms_yt_toMethod

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*(v[t_bus]*v[f_bus]*cos(t[t_bus]-t[f_bus])) + (-b*tr+g*ti)/tm*(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*(v[t_bus]*v[f_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr-b*ti)/tm*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus]))
source
PowerModelsDistribution.constraint_mc_ohms_yt_toMethod
constraint_mc_ohms_yt_to(pm::FOTPUPowerModel, nw::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, G::Matrix{<:Real}, B::Matrix{<:Real}, G_to::Matrix{<:Real}, B_to::Matrix{<:Real})

Ohm constraints similar to ACPUPowerModel. The nonlinear functions are approximated around initial operating points.

source
PowerModelsDistribution.constraint_mc_ohms_yt_toMethod
constraint_mc_ohms_yt_to(pm::FOTRUPowerModel, nw::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, G::Matrix, B::Matrix, G_to::Matrix, B_to::Matrix)

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

source
PowerModelsDistribution.constraint_mc_power_balanceMethod
constraint_mc_power_balance(pm::AbstractUnbalancedActivePowerModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

power balanace constraint with line shunts and transformers, active power only

$$$p_{br} + p_{tr} + p_{sw} == p_{g} - p_{s} - p_{d} - G$$$
source
PowerModelsDistribution.constraint_mc_power_balanceMethod
constraint_mc_power_balance(pm::FBSUBFPowerModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

Power balance constraints similar to ACRUPowerModel with shunt current calculated using initial operating point.

source
PowerModelsDistribution.constraint_mc_power_balanceMethod
constraint_mc_power_balance(pm::FOTPUPowerModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

Power balance equations similar to ACPUPowerModel. The nonlinear functions are approximated around initial operating point.

\begin{align} &\text{Initial operating points: } v_{m0}^{t} \angle v_{a0}^t,~v_{m0}^u \angle v_{a0}^u\\ & {v_m^t}^2 \Rightarrow {v_{m0}^t}^2+2 \cdot v_{m0}^t \cdot (v_m^t-v_{m0}^t)\\ & v_m^t \cdot v_m^u \cdot \cos(v_a^t-v_a^u) \Rightarrow v_{m0}^t \cdot v_{m0}^u \cdot \cos(v_{a0}^t-v_{a0}^u) + \begin{bmatrix} v_{m0}^u \cdot \cos(v_{a0}^t-v_{a0}^u) \\ v_{m0}^t \cdot \cos(v_{a0}^t-v_{a0}^u) \\ -v_{m0}^t \cdot v_{m0}^u \cdot \sin(v_{a0}^t-v_{a0}^u) \\ v_{m0}^t \cdot v_{m0}^u \cdot \sin(v_{a0}^t-v_{a0}^u) \end{bmatrix}^\top \begin{bmatrix} v_m^t-v_{m0}^t \\ v_m^u-v_{m0}^u \\ v_a^t-v_{a0}^t \\ v_a^u-v_{a0}^u \end{bmatrix} \\ & v_m^t \cdot v_m^u \cdot \sin(v_a^t-v_a^u) \Rightarrow v_{m0}^t \cdot v_{m0}^u \cdot \sin(v_{a0}^t-v_{a0}^u) + \begin{bmatrix} v_{m0}^u \cdot \sin(v_{a0}^t-v_{a0}^u) \\ v_{m0}^t \cdot \sin(v_{a0}^t-v_{a0}^u) \\ v_{m0}^t \cdot v_{m0}^u \cdot \cos(v_{a0}^t-v_{a0}^u) \\ -v_{m0}^t \cdot v_{m0}^u \cdot \cos(v_{a0}^t-v_{a0}^u) \end{bmatrix}^\top \begin{bmatrix} v_m^t-v_{m0}^t \\ v_m^u-v_{m0}^u \\ v_a^t-v_{a0}^t \\ v_a^u-v_{a0}^u \end{bmatrix} \end{align}
source
PowerModelsDistribution.constraint_mc_power_balanceMethod
constraint_mc_power_balance(pm::FOTRUPowerModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

Power balance constraints similar to ACRUPowerModel with shunt current linearized around initial operating point.

\begin{align} &\text{Initial operating point: } (v_{r0} + j ⋅ v_{i0})\\ & v_{r} ⋅ v_{i} = v_{r0} ⋅ v_{i0} + v_{r} ⋅ v_{i0} + v_{r0} ⋅ v_{i} - 2 ⋅ v_{r0} ⋅ v_{i0} \end{align}
source
PowerModelsDistribution.constraint_mc_power_balanceMethod
function constraint_mc_power_balance(
pm::RectangularVoltageExplicitNeutralModels,
nw::Int,
i::Int,
terminals::Vector{Int},
grounded::Vector{Bool},
bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}},
bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}},
bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}},
bus_gens::Vector{Tuple{Int,Vector{Int}}},
bus_storage::Vector{Tuple{Int,Vector{Int}}},
bus_shunts::Vector{Tuple{Int,Vector{Int}}}
)

Imposes power balance constraints at each ungrounded terminal of bus i for rectangular voltage models with explicit neutrals. sum(p + im*q) = 0

source
PowerModelsDistribution.constraint_mc_power_balance_capcMethod
constraint_mc_power_balance_capc(pm::AbstractUnbalancedACPModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

Power balance constraints with capacitor control.

\begin{align} & Bs = z ⋅ bs, \\ &\text{capacitor ON: } z = 1, \\ &\text{capacitor OFF: } z = 0. \end{align}
source
PowerModelsDistribution.constraint_mc_power_balance_capcMethod
constraint_mc_power_balance_capc(pm::AbstractUnbalancedACRModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

Power balance constraints with capacitor control.

\begin{align} & Bt = z ⋅ bs, \\ &\text{capacitor ON: } z = 1, \\ &\text{capacitor OFF: } z = 0. \end{align}
source
PowerModelsDistribution.constraint_mc_power_balance_capcMethod
constraint_mc_power_balance_capc(pm::FBSUBFPowerModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

Power balance constraints with capacitor control similar to ACRUPowerModel with shunt current calculated using initial operating point.

source
PowerModelsDistribution.constraint_mc_power_balance_capcMethod
constraint_mc_power_balance_capc(pm::FOTPUPowerModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

Power balance constraints with capacitor control with shunt current calculated using initial operating point.

\begin{align} & B_s = b_s ⋅ z,~~ cq_{sh} = B_s ⋅ v, \\ & B_s \cdot v_m^t \cdot v_m^u \cdot \cos(v_a^t-v_a^u) \Rightarrow B_{s0} \cdot v_{m0}^t \cdot v_{m0}^u \cdot \cos(v_{a0}^t-v_{a0}^u) + \begin{bmatrix} B_{s0} \cdot v_{m0}^u \cdot \cos(v_{a0}^t-v_{a0}^u) \\ B_{s0} \cdot v_{m0}^t \cdot \cos(v_{a0}^t-v_{a0}^u) \\ -B_{s0} \cdot v_{m0}^t \cdot v_{m0}^u \cdot \sin(v_{a0}^t-v_{a0}^u) \\ B_{s0} \cdot v_{m0}^t \cdot v_{m0}^u \cdot \sin(v_{a0}^t-v_{a0}^u) \\ v_{m0}^t \cdot v_{m0}^u \cdot \cos(v_{a0}^t-v_{a0}^u) \end{bmatrix}^\top \begin{bmatrix} v_m^t-v_{m0}^t \\ v_m^u-v_{m0}^u \\ v_a^t-v_{a0}^t \\ v_a^u-v_{a0}^u \\ B_{s} -B_{s0} \end{bmatrix} \\ & B_s \cdot v_m^t \cdot v_m^u \cdot \sin(v_a^t-v_a^u) \Rightarrow B_{s0} \cdot v_{m0}^t \cdot v_{m0}^u \cdot \sin(v_{a0}^t-v_{a0}^u) + \begin{bmatrix} B_{s0} \cdot v_{m0}^u \cdot \sin(v_{a0}^t-v_{a0}^u) \\ B_{s0} \cdot v_{m0}^t \cdot \sin(v_{a0}^t-v_{a0}^u) \\ B_{s0} \cdot v_{m0}^t \cdot v_{m0}^u \cdot \cos(v_{a0}^t-v_{a0}^u) \\ -B_{s0} \cdot v_{m0}^t \cdot v_{m0}^u \cdot \cos(v_{a0}^t-v_{a0}^u) \\ v_{m0}^t \cdot v_{m0}^u \cdot \sin(v_{a0}^t-v_{a0}^u) \end{bmatrix}^\top \begin{bmatrix} v_m^t-v_{m0}^t \\ v_m^u-v_{m0}^u \\ v_a^t-v_{a0}^t \\ v_a^u-v_{a0}^u \\ B_{s} -B_{s0} \end{bmatrix} \end{align}
source
PowerModelsDistribution.constraint_mc_power_balance_capcMethod
constraint_mc_power_balance_capc(pm::FOTRUPowerModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

Power balance constraints with capacitor control with shunt current calculated using initial operating point.

\begin{align} & B_t = b_s ⋅ z,~~ cq_{sh} = B_t ⋅ v, \\ &\text{FOT approximation: } B_t ⋅ v_r ⋅ v_i = B_{t0} ⋅ v_{r0} ⋅ v_{i0} + B_{t} ⋅ v_{r0} ⋅ v_{i0} + B_{t0} ⋅ v_{r} ⋅ v_{i0} + B_{t0} ⋅ v_{r0} ⋅ v_{i} - 3 ⋅ B_{t0} ⋅ v_{r0} ⋅ v_{i0} \end{align}
source
PowerModelsDistribution.constraint_mc_power_balance_capcMethod
constraint_mc_power_balance_capc(pm::LPUBFDiagModel, nw::Int, i::Int, terminals::Vector{Int}, grounded::Vector{Bool}, bus_arcs::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_sw::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_arcs_trans::Vector{Tuple{Tuple{Int,Int,Int},Vector{Int}}}, bus_gens::Vector{Tuple{Int,Vector{Int}}}, bus_storage::Vector{Tuple{Int,Vector{Int}}}, bus_loads::Vector{Tuple{Int,Vector{Int}}}, bus_shunts::Vector{Tuple{Int,Vector{Int}}})

Power balance constraints with capacitor control linearized using McCormick envelopes

\begin{align} & B_s = b_s ⋅ z,~~ cq_{sh} = B_s ⋅ w, \\ &\text{Underestimator: } cq_{sh} ≥ B_s ⋅ w_\text{min},~~ cq_{sh} ≥ b_s ⋅ w + B_s ⋅ w_\text{max} - b_s ⋅ w_\text{max}\\ &\text{Overestimator: } cq_{sh} ≤ B_s ⋅ w_\text{max},~~ cq_{sh} ≤ b_s ⋅ w + B_s ⋅ w_\text{min} - b_s ⋅ w_\text{min}\\ \end{align}
source
PowerModelsDistribution.constraint_mc_power_lossesMethod
constraint_mc_power_losses(pm::FBSUBFPowerModel, nw::Int, i::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, r::Matrix{<:Real}, x::Matrix{<:Real}, g_sh_fr::Matrix{<:Real}, g_sh_to::Matrix{<:Real}, b_sh_fr::Matrix{<:Real}, b_sh_to::Matrix{<:Real})

Branch flow model power flow equation linearized around initial operating point (backward sweep)

\begin{align} &\text{Initial operating points: } (v_{r0}^{fr} + j ⋅ v_{i0}^{fr}),~ (v_{r0}^{to} + j ⋅ v_{i0}^{to})\\ &\text{Voltage drop: } v_{drop} = (v_{r0}^{fr} + j ⋅ v_{i0}^{fr}) - (v_{r0}^{to} + j ⋅ v_{i0}^{to}),\\ &\text{Line series admittance: } y = (r+j ⋅ x)^{-1},\\ &\text{Power loss: } s_{loss} = v_{drop} ⋅ (y ⋅ v_{drop})^*,\\ &\text{Active power flow: } p^{fr} + p^{to} = g_{sh}^{fr} ⋅ {(v_{m0}^{fr})}^2 + g_{sh}^{to} ⋅ {(v_{m0}^{to})}^2 + \Re(s_{loss}),\\ &\text{Reactive power flow: } q^{fr} + q^{to} = -b_{sh}^{fr} ⋅ {(v_{m0}^{fr})}^2 - b_{sh}^{to} ⋅ {(v_{m0}^{to})}^2 + \Im(s_{loss}). \end{align}
source
PowerModelsDistribution.constraint_mc_switch_ampacityMethod
constraint_mc_switch_ampacity(pm::AbstractUnbalancedACPModel, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, c_rating::Vector{<:Real})::Nothing

ACP current limit constraint on switches

mathp_{fr}^2 + q_{fr}^2 \leq vm_{fr}^2 i_{max}^2

source
PowerModelsDistribution.constraint_mc_switch_ampacityMethod
constraint_mc_switch_ampacity(pm::AbstractUnbalancedRectangularModels, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, c_rating::Vector{<:Real})::Nothing

ACP current limit constraint on switches

mathp_{fr}^2 + q_{fr}^2 \leq (vr_{fr}^2 + vi_{fr}^2) i_{max}^2

source
PowerModelsDistribution.constraint_mc_switch_ampacityMethod
constraint_mc_switch_ampacity(pm::AbstractUnbalancedWModels, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, c_rating::Vector{<:Real})::Nothing

ACP current limit constraint on switches from-side

mathp_{fr}^2 + q_{fr}^2 \leq w_{fr} i_{max}^2

source
PowerModelsDistribution.constraint_mc_switch_ampacityMethod
constraint_mc_switch_ampacity(pm::AbstractUnbalancedWModels, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, c_rating::Vector{<:Real})

ACP current limit constraint on switches from-side

mathp_{fr}^2 + q_{fr}^2 \leq w_{fr} i_{max}^2

source
PowerModelsDistribution.constraint_mc_switch_currentMethod
function constraint_mc_switch_current(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
id::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int};
report::Bool=true
)

For IVR models with explicit neutrals, create expressions for the terminal current flows :crsw_bus and cisw_bus, and link the from-side to the to-side switch current

source
PowerModelsDistribution.constraint_mc_switch_current_limitMethod
function constraint_mc_switch_current_limit(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
rating::Vector{<:Real}
)

For ACR models with explicit neutrals, imposes a bound on the switch current magnitude per conductor. Note that a bound on the from-side implies the same bound on the to-side current, so it suffices to apply this only explicitly at the from-side.

source
PowerModelsDistribution.constraint_mc_switch_current_limitMethod
function constraint_mc_switch_current_limit(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
f_idx::Tuple{Int,Int,Int},
connections::Vector{Int},
rating::Vector{<:Real}
)

For IVR models with explicit neutrals, imposes a bound on the switch current magnitude per conductor. Note that a bound on the from-side implies the same bound on the to-side current, so it suffices to apply this only explicitly at the from-side.

source
PowerModelsDistribution.constraint_mc_switch_powerMethod
function constraint_mc_switch_power(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
id::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int};
report::Bool=true
)

constraintmcswitchpower( pm::ReducedExplicitNeutralIVRModels, nw::Int, id::Int, fidx::Tuple{Int,Int,Int}, tidx::Tuple{Int,Int,Int}, fconnections::Vector{Int}, t_connections::Vector{Int}; report::Bool=true )

For IVR models with explicit neutrals, create expressions for the terminal power flows :psw_bus and qsw_bus, and link the from-side to the to-side switch power

source
PowerModelsDistribution.constraint_mc_switch_thermal_limitMethod
function constraint_mc_switch_thermal_limit(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
rating::Vector{<:Real}
)

For ACR models with explicit neutrals, imposes a bound on the switch power magnitude per conductor. Note that a bound on the from-side implies the same bound on the to-side power when the switch is closed (equal voltages), and also when it is open since the power then equals zero on both ends.

source
PowerModelsDistribution.constraint_mc_switch_thermal_limitMethod
function constraint_mc_switch_thermal_limit(
pm::AbstractNLExplicitNeutralIVRModel,
nw::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
rating::Vector{<:Real}
)

This method is not yet implemented for AbstractLPUBFModel. If the limit is finite, a warning is thrown.

source
PowerModelsDistribution.constraint_mc_switch_thermal_limitMethod
function constraint_mc_switch_thermal_limit(
pm::AbstractNLExplicitNeutralIVRModel,
nw::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
rating::Vector{<:Real}
)

For IVR models with explicit neutrals, imposes a bound on the switch power magnitude per conductor. Note that a bound on the from-side implies the same bound on the to-side power when the switch is closed (equal voltages), and also when it is open since the power then equals zero on both ends.

source
PowerModelsDistribution.constraint_mc_switch_thermal_limitMethod
function constraint_mc_switch_thermal_limit(
nw::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
rating::Vector{<:Real}
)

For quadratic IVR models with explicit neutrals, throw an error because this cannot be represented quadratically without introducing explicit power variables.

source
PowerModelsDistribution.constraint_mc_thermal_limit_fromMethod
function constraint_mc_thermal_limit_from(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
rate_a::Vector{<:Real}
)

For ACR models with explicit neutrals, imposes a bound on the from-side line power magnitude.

source
PowerModelsDistribution.constraint_mc_thermal_limit_fromMethod
function constraint_mc_thermal_limit_from(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
rate_a::Vector{<:Real}
)

For IVR models with explicit neutrals, imposes a bound on the from-side line power magnitude.

source
PowerModelsDistribution.constraint_mc_thermal_limit_fromMethod
function constraint_mc_thermal_limit_from(
nw::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
rate_a::Vector{<:Real}
)

For quadratic IVR models with explicit neutrals, throw an error because this cannot be represented quadratically without introducing explicit power variables.

source
PowerModelsDistribution.constraint_mc_thermal_limit_toMethod
function constraint_mc_thermal_limit_to(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
t_idx::Tuple{Int,Int,Int},
t_connections::Vector{Int},
rate_a::Vector{<:Real}
)

For ACR models with explicit neutrals, imposes a bound on the from-side line power magnitude.

source
PowerModelsDistribution.constraint_mc_thermal_limit_toMethod
function constraint_mc_thermal_limit_to(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
t_idx::Tuple{Int,Int,Int},
t_connections::Vector{Int},
rate_a::Vector{<:Real}
)

For IVR models with explicit neutrals, imposes a bound on the to-side line power magnitude.

source
PowerModelsDistribution.constraint_mc_thermal_limit_toMethod
function constraint_mc_thermal_limit_to(
nw::Int,
t_idx::Tuple{Int,Int,Int},
t_connections::Vector{Int},
rate_a::Vector{<:Real}
)

For quadratic IVR models with explicit neutrals, throw an error because this cannot be represented quadratically without introducing explicit power variables.

source
PowerModelsDistribution.constraint_mc_transformer_currentMethod
function constraint_mc_transformer_current(
pm::AbstractExplicitNeutralIVRModel,
i::Int;
nw::Int=nw_id_default,
fix_taps::Bool=true
)

For IVR models with explicit neutrals, links the current variables of the from-side and to-side transformer windings, and creates expressions for the terminal current flows

source
PowerModelsDistribution.constraint_mc_transformer_current_dyMethod
function constraint_mc_transformer_current_dy(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
trans_id::Int,
f_bus::Int,
t_bus::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
pol::Int,
tm_set::Vector{<:Real},
tm_fixed::Vector{Bool},
tm_scale::Real
)

For IVR models with explicit neutrals, links the current variables of the from-side and to-side transformer windings, and creates expressions for the terminal current flows for delta-wye connected transformers

scale*cr_fr_P + cr_to_P == 0
scale*ci_fr_P + ci_to_P == 0
source
PowerModelsDistribution.constraint_mc_transformer_current_yyMethod
function constraint_mc_transformer_current_yy(
pm::AbstractExplicitNeutralIVRModel,
nw::Int,
trans_id::Int,
f_bus::Int,
t_bus::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
pol::Int,
tm_set::Vector{<:Real},
tm_fixed::Vector{Bool},
tm_scale::Real
)

For IVR models with explicit neutrals, links the current variables of the from-side and to-side transformer windings, and creates expressions for the terminal current flows for wye-wye connected transformers

scale*cr_fr_P + cr_to_P == 0
scale*ci_fr_P + ci_to_P == 0
source
PowerModelsDistribution.constraint_mc_transformer_powerMethod
constraint_mc_transformer_power(pm::AbstractUnbalancedPowerModel, i::Int; nw::Int=nw_id_default, fix_taps::Bool=true)::Nothing

Template function for Transformer constraints in Power-voltage space, considering winding type, conductor order, polarity and tap settings.

source
PowerModelsDistribution.constraint_mc_transformer_power_dyMethod
function constraint_mc_transformer_power_dy(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
trans_id::Int,
f_bus::Int,
t_bus::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
pol::Int,
tm_set::Vector{<:Real},
tm_fixed::Vector{Bool},
tm_scale::Real
)

For ACR models with explicit neutrals, links the from-side and to-side power variables of delta-wye connected transformers. Expressions for the terminal power flow variables are also added.

source
PowerModelsDistribution.constraint_mc_transformer_power_dyMethod
constraint_mc_transformer_power_dy(pm::FBSUBFPowerModel, nw::Int, trans_id::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, pol::Int, tm_set::Vector{<:Real}, tm_fixed::Vector{Bool}, tm_scale::Real)

Add all constraints required to model a two-winding, delta-wye connected transformer similar to ACRUPowerModel with power constraints using initial operating point voltage instead of actual voltage variables.

source
PowerModelsDistribution.constraint_mc_transformer_power_dyMethod
constraint_mc_transformer_power_dy(pm::FOTPUPowerModel, nw::Int, trans_id::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, pol::Int, tm_set::Vector{<:Real}, tm_fixed::Vector{Bool}, tm_scale::Real)

Add all constraints required to model a two-winding, delta-wye connected transformer similar to ACPUPowerModel with voltage constraints linearized using first-order Taylor approximation and power constraints simplified using initial operating point voltage instead of actual voltage variables.

source
PowerModelsDistribution.constraint_mc_transformer_power_dyMethod
constraint_mc_transformer_power_dy(pm::FOTRUPowerModel, nw::Int, trans_id::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, pol::Int, tm_set::Vector{<:Real}, tm_fixed::Vector{Bool}, tm_scale::Real)

Add all constraints required to model a two-winding, delta-wye connected transformer similar to ACRUPowerModel with power constraints using initial operating point voltage instead of actual voltage variables.

source
PowerModelsDistribution.constraint_mc_transformer_power_dyMethod
constraint_mc_transformer_power_dy(pm::SOCUBFModels, nw::Int, trans_id::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, pol::Int, tm_set::Vector{<:Real}, tm_fixed::Vector{Bool}, tm_scale::Real)

Constraints to model a two-winding, delta-wye connected transformer.

\begin{align} &{W}_{fr}^{ij}-{W}_{fr}^{ik}-{W}_{fr}^{lj}+{W}_{fr}^{lk} = t_m^2{W}_{to}^{ij} ~\forall i,j \in \{1,2,3\}~ \text{and}~ k,l \in \{2,3,1\} \\ &{S}_{fr} = X_tT_t \\ &{S}_{fr}^\Delta = T_tX_t \\ & {s}_{fr}^\Delta + {s}_{to} = 0\\ & {M}_{\Delta} = \begin{bmatrix} {W}_{fr} & {X}_{t} \\ {X}_{t}^{\text{H}} & {L}_{\Delta} \end{bmatrix} \succeq 0 \end{align}
source
PowerModelsDistribution.constraint_mc_transformer_power_yyMethod
function constraint_mc_transformer_power_yy(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
trans_id::Int,
f_bus::Int,
t_bus::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
pol::Int,
tm_set::Vector{<:Real},
tm_fixed::Vector{Bool},
tm_scale::Real
)

For ACR models with explicit neutrals, links the from-side and to-side power variables of wye-wye connected transformers. Expressions for the terminal power flow variables are also added.

source
PowerModelsDistribution.constraint_mc_transformer_power_yyMethod
constraint_mc_transformer_power_yy(pm::FBSUBFPowerModel, nw::Int, trans_id::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, pol::Int, tm_set::Vector{<:Real}, tm_fixed::Vector{Bool}, tm_scale::Real)

Add all constraints required to model a two-winding, wye-wye connected transformer similar to ACRUPowerModel.

source
PowerModelsDistribution.constraint_mc_transformer_power_yyMethod
constraint_mc_transformer_power_yy(pm::FOTPUPowerModel, nw::Int, trans_id::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, pol::Int, tm_set::Vector{<:Real}, tm_fixed::Vector{Bool}, tm_scale::Real)

Add all constraints required to model a two-winding, wye-wye connected transformer similar to ACPUPowerModel.

source
PowerModelsDistribution.constraint_mc_transformer_power_yyMethod
constraint_mc_transformer_power_yy(pm::FOTRUPowerModel, nw::Int, trans_id::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, pol::Int, tm_set::Vector{<:Real}, tm_fixed::Vector{Bool}, tm_scale::Real)

Add all constraints required to model a two-winding, wye-wye connected transformer similar to ACRUPowerModel.

source
PowerModelsDistribution.constraint_mc_transformer_power_yyMethod
constraint_mc_transformer_power_yy(pm::SOCUBFModels, nw::Int, trans_id::Int, f_bus::Int, t_bus::Int, f_idx::Tuple{Int,Int,Int}, t_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, pol::Int, tm_set::Vector{<:Real}, tm_fixed::Vector{Bool}, tm_scale::Real)

Constraints to model a two-winding, wye-wye connected transformer.

\begin{align} & {W}_{fr} = {T}_{m}{T}_{m}^{H} {W}_{to} \\ & {s}_{fr} + {s}_{to} = 0 \end{align}
source
PowerModelsDistribution.constraint_mc_transformer_thermal_limitMethod
function constraint_mc_transformer_thermal_limit(
pm::AbstractExplicitNeutralACRModel,
nw::Int,
id::Int,
f_idx::Tuple,
t_idx::Tuple,
f_bus::Int,
t_bus::Int,
f_connections::Vector,
t_connections::Vector,
config::ConnConfig,
sm_ub::Real;
report::Bool=true
)

For ACR models with explicit neutrals, imposes a bound on the magnitude of the total apparent power at each winding of the transformer.

sum(pt_fr)^2 + sum(qt_fr)^2 <= sm_ub^2
sum(pt_to)^2 + sum(qt_to)^2 <= sm_ub^2
source
PowerModelsDistribution.constraint_mc_transformer_thermal_limitMethod
function constraint_mc_transformer_thermal_limit(
pm::AbstractNLExplicitNeutralIVRModel,
nw::Int,
id::Int,
f_idx::Tuple,
t_idx::Tuple,
f_bus::Int,
t_bus::Int,
f_connections::Vector,
t_connections::Vector,
config::ConnConfig,
sm_ub::Real;
report::Bool=true
)

For non-linear IVR models with explicit neutrals, imposes a bound on the magnitude of the total apparent power at both windings. Expressions are created for the transformer power variables.

sum(pt_fr)^2 + sum(qt_fr)^2 <= sm_ub^2
sum(pt_to)^2 + sum(qt_to)^2 <= sm_ub^2
source
PowerModelsDistribution.constraint_mc_transformer_thermal_limitMethod
function constraint_mc_transformer_thermal_limit(
nw::Int,
id::Int,
f_idx::Tuple,
t_idx::Tuple,
f_bus::Int,
t_bus::Int,
f_connections::Vector,
t_connections::Vector,
config::ConnConfig,
sm_ub::Real;
report::Bool=true
)

For quadratic IVR models with explicit neutrals, imposes a bound on the magnitude of the total apparent power at both windings.

sum(pt_fr)^2 + sum(qt_fr)^2 <= sm_ub^2
sum(pt_to)^2 + sum(qt_to)^2 <= sm_ub^2
source
PowerModelsDistribution.constraint_mc_transformer_voltage_dyMethod
function constraint_mc_transformer_voltage_dy(
pm::RectangularVoltageExplicitNeutralModels,
nw::Int,
trans_id::Int,
f_bus::Int,
t_bus::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
pol::Int,
tm_set::Vector{<:Real},
tm_fixed::Vector{Bool},
tm_scale::Real
)

For rectangular voltage models with explicit neutrals, links the voltage of the from-side and to-side transformer windings for delta-wye connected transformers

Md*vr_fr_P == scale * (vr_to_P - vr_to_n)
Md*vi_fr_P == scale * (vi_to_P - vi_to_n)
source
PowerModelsDistribution.constraint_mc_transformer_voltage_yyMethod
function constraint_mc_transformer_voltage_yy(
pm::RectangularVoltageExplicitNeutralModels,
nw::Int,
trans_id::Int,
f_bus::Int,
t_bus::Int,
f_idx::Tuple{Int,Int,Int},
t_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int},
pol::Int,
tm_set::Vector{<:Real},
tm_fixed::Vector{Bool},
tm_scale::Real
)

For rectangular voltage models with explicit neutrals, links the voltage of the from-side and to-side transformer windings for wye-wye connected transformers

(vr_fr_P-vr_fr_n) == scale * (vr_to_P.-vr_to_n)
(vi_fr_P-vi_fr_n) == scale * (vi_to_P.-vi_to_n)
source
PowerModelsDistribution.constraint_mc_voltage_absoluteMethod
function constraint_mc_voltage_absolute(
pm::RectangularVoltageExplicitNeutralModels,
nw::Int,
i::Int,
terminals::Vector{Int},
grounded::Vector{Bool},
vmin::Vector{<:Real},
vmax::Vector{<:Real};
report::Bool=true
)

Imposes absolute voltage magnitude bounds for models with explicit neutrals

source
PowerModelsDistribution.constraint_mc_voltage_fixedMethod
function constraint_mc_voltage_fixed(
pm::RectangularVoltageExplicitNeutralModels,
nw::Int,
i::Int,
vm::Vector{<:Real},
va::Vector{<:Real},
terminals::Vector{Int},
grounded::Vector{Bool}
)

Fixes the voltage variables at bus i to vm.*exp.(im*va)

source
PowerModelsDistribution.constraint_mc_voltage_magnitude_boundsMethod
constraint_mc_voltage_magnitude_bounds(pm::AbstractUnbalancedPowerModel, i::Int; nw::Int=nw_id_default)::Nothing

Template function for voltage magnitude bounds constraints.

This constraint captures problem agnostic constraints that define limits for voltage magnitudes (where variable bounds cannot be used). Notable examples include IVRUPowerModel and ACRUPowerModel.

source
PowerModelsDistribution.constraint_mc_voltage_magnitude_boundsMethod
constraint_mc_voltage_magnitude_bounds(pm::FBSUBFPowerModel, nw::Int, i::Int, vmin::Vector{<:Real}, vmax::Vector{<:Real})

Upper voltage magnitude limits are linearized using outer approximation. Lower voltage magnitude limits are linearized around initial operating point.

\begin{align} &\text{Initial operating point: } ⇒ v_{r}^0 + j ⋅ v_{i}^0~\text{where}~{(v_m^0)}^2 = {(v_{r}^0)}^2 + {(v_{i}^0)}^2\\ &\text{Lower limits: } 2 ⋅ v_{r} ⋅ v_{r}^0 + 2 ⋅ v_{i} ⋅ v_{i}^0 - {(v_{m}^0)}^2 ≥ v_{min}^2,\\ &\text{Upper limits: } -v_{max} ≤ v_{r} ≤ v_{max},\\ & -v_{max} ≤ v_{i} ≤ v_{max},\\ &-\sqrt{2} ⋅ v_{max} ≤ v_{r} + v_{i} ≤ \sqrt{2} ⋅ v_{max},\\ & -\sqrt{2} ⋅ v_{max} ≤ v_{r} - v_{i} ≤ \sqrt{2} ⋅ v_{max}. \end{align}
source
PowerModelsDistribution.constraint_mc_voltage_magnitude_fixedMethod
function constraint_mc_voltage_magnitude_fixed(
pm::RectangularVoltageExplicitNeutralModels,
nw::Int,
i::Int,
vm::Vector{<:Real},
va::Vector{<:Real},
terminals::Vector{Int},
grounded::Vector{Bool}
)

Fixes the voltage variables at bus i to vm.*exp.(im*va)

source
PowerModelsDistribution.constraint_mc_voltage_pairwiseMethod
function constraint_mc_voltage_pairwise(
pm::RectangularVoltageExplicitNeutralModels,
nw::Int,
i::Int,
terminals::Vector{Int},
grounded::Vector{Bool},
vm_pair_lb::Vector,
vm_pair_ub::Vector;
report::Bool=true
)

Imposes pairwise voltage magnitude bounds, i.e. magnitude bounds on the voltage between to terminals, for models with explicit neutrals

source
PowerModelsDistribution.constraint_mc_voltage_pairwiseMethod
function constraint_mc_voltage_pairwise(
pm::RectangularVoltageExplicitNeutralModels,
id::Int;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true,
)

Imposes pairwise voltage magnitude bounds, i.e. magnitude bounds on the voltage between to terminals, for models with explicit neutrals

source
PowerModelsDistribution.constraint_pqwMethod

Creates the constraints modelling the (relaxed) voltage-dependency of the power consumed in each phase, s=p+jq. This is completely symmetrical for p and q, with appropriate substitutions of the variables and parameters: p->q, a->b, alpha->beta, pmin->qmin, pmax->qmax

source
PowerModelsDistribution.constraint_switch_thermal_limitMethod
constraint_switch_thermal_limit(pm::AbstractUnbalancedPowerModel, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, rating::Vector{<:Real})::Nothing

Generic thermal limit constraint for switches (from-side)

mathp_{fr}^2 + q_{fr}^2 \leq S_{max}^2

source

## Relaxation Helpers

PowerModelsDistribution.cut_complex_product_and_angle_differenceMethod
cut_complex_product_and_angle_difference(m, wf, wt, wr, wi, angmin, angmax)

A valid inequality for the product of two complex variables with magnitude and angle difference bounds. In the literature this constraints are called the Lifted Nonlinear Cuts (LNCs). @misc{1512.04644, Author = {Carleton Coffrin and Hassan Hijazi and Pascal Van Hentenryck}, Title = {Strengthening the SDP Relaxation of AC Power Flows with Convex Envelopes, Bound Tightening, and Lifted Nonlinear Cuts}, Year = {2015}, Eprint = {arXiv:1512.04644}, }

source
PowerModelsDistribution.relaxation_psd_to_socMethod
relaxation_psd_to_soc(m::JuMP.Model, mxreal, mximag; complex::Bool=true)

See section 4.3 for complex to real PSD constraint transformation: @article{Fazel2001, author = {Fazel, M. and Hindi, H. and Boyd, S.P.}, title = {{A rank minimization heuristic with application to minimum order system approximation}}, doi = {10.1109/ACC.2001.945730}, journal = {Proc. American Control Conf.}, number = {2}, pages = {4734–4739}, url = {http://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?arnumber=945730}, volume = {6}, year = {2001} }

source
PowerModelsDistribution.relaxation_psd_to_soc_complexMethod
relaxation_psd_to_soc_complex(m, mxreal, mximag)

SDP to SOC relaxation of type 2, applied to complex-value matrix, as described in:

@article{Kim2003,
author = {Kim, S and Kojima, M and Yamashita, M},
title = {{Second order cone programming relaxation of a positive semidefinite constraint}},
doi = {10.1080/1055678031000148696},
journal = {Optimization Methods and Software},
number = {5},
pages = {535--541},
volume = {18},
year = {2003}
}
source
PowerModelsDistribution.relaxation_psd_to_soc_complex_conicMethod
relaxation_psd_to_soc_complex_conic(m, mxreal, mximag)

SDP to SOC relaxation of type 2, applied to complex-value matrix, as described in:

@article{Kim2003,
author = {Kim, S and Kojima, M and Yamashita, M},
title = {{Second order cone programming relaxation of a positive semidefinite constraint}},
doi = {10.1080/1055678031000148696},
journal = {Optimization Methods and Software},
number = {5},
pages = {535--541},
volume = {18},
year = {2003}
}
source
PowerModelsDistribution.relaxation_psd_to_soc_conicMethod
relaxation_psd_to_soc_conic(m, mxreal, mximag; complex=true)

See section 4.3 for complex to real PSD constraint transformation: @article{Fazel2001, author = {Fazel, M. and Hindi, H. and Boyd, S.P.}, title = {{A rank minimization heuristic with application to minimum order system approximation}}, doi = {10.1109/ACC.2001.945730}, journal = {Proc. American Control Conf.}, number = {2}, pages = {4734–4739}, url = {http://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?arnumber=945730}, volume = {6}, year = {2001} }

source
PowerModelsDistribution.relaxation_psd_to_soc_realMethod
relaxation_psd_to_soc_real(m, mx)

SDP to SOC relaxation of type 2, applied to real-value matrix, as described in:

@article{Kim2003,
author = {Kim, S and Kojima, M and Yamashita, M},
title = {{Second order cone programming relaxation of a positive semidefinite constraint}},
doi = {10.1080/1055678031000148696},
journal = {Optimization Methods and Software},
number = {5},
pages = {535--541},
volume = {18},
year = {2003}
}
source
PowerModelsDistribution.relaxation_psd_to_soc_real_conicMethod
relaxation_psd_to_soc_real_conic(m, mx)

SDP to SOC relaxation of type 2, applied to real-value matrix, as described in:

@article{Kim2003,
author = {Kim, S and Kojima, M and Yamashita, M},
title = {{Second order cone programming relaxation of a positive semidefinite constraint}},
doi = {10.1080/1055678031000148696},
journal = {Optimization Methods and Software},
number = {5},
pages = {535--541},
volume = {18},
year = {2003}
}
source