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::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_bus_voltage_balanceMethod

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_generator_powerMethod

DELTA When connected in delta, the load power gives the reference in the delta reference frame. This means sd1 = vab.conj(iab) = (va-vb).conj(iab) We can relate this to the per-phase power by sna = va.conj(ia) = va.conj(iab-ica) = va.conj(conj(sab/vab) - conj(sca/vca)) = va.(sab/(va-vb) - sca/(vc-va)) So for delta, sn is constrained indirectly.

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_powerMethod

CONSTANT POWER Fixes the load power sd. sd = [sd1, sd2, sd3] 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. sd1 = va.conj(ia) = 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 sd1 = vab.conj(iab) = (va-vb).conj(iab) We can relate this to the per-phase power by sna = va.conj(ia) = va.conj(iab-ica) = va.conj(conj(sab/vab) - conj(sca/vca)) = va.(sab/(va-vb) - sca/(vc-va)) 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_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

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

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::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_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::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_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_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_voltage_angle_differenceMethod
constraint_mc_voltage_angle_difference(pm::FBSUBFPowerModel, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, angmin::Vector{<:Real}, angmax::Vector{<:Real})

Nothing to do, this model ignores angle difference constraints"

source
PowerModelsDistribution.constraint_mc_voltage_angle_differenceMethod
constraint_mc_voltage_angle_difference(pm::FOTRUPowerModel, nw::Int, f_idx::Tuple{Int,Int,Int}, f_connections::Vector{Int}, t_connections::Vector{Int}, angmin::Vector{<:Real}, angmax::Vector{<:Real})

Nothing to do, this model ignores angle difference constraints"

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_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

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

Miscellaneous Helpers