# Variables

PowerModelsDistribution.variable_mc_branch_currentMethod
function variable_mc_branch_current(
pm::AbstractExplicitNeutralIVRModel;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true
)

For IVR models with explicit neutrals, creates total current variables :cr and :ci, series current variables :csr and :csi, and placeholder dictionaries for the terminal current flows :cr_bus and :ci_bus

source
PowerModelsDistribution.variable_mc_branch_currentMethod
function variable_mc_branch_current(
pm::ReducedExplicitNeutralIVRModels;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true
)

For branch-reduced IVR models with explicit neutrals, creates series current variables :csr and :csi, placeholder dictionaries for the total current :cr and :ci, and placeholder dictionaries for the terminal current flows :cr_bus and :ci_bus

source
PowerModelsDistribution.variable_mc_branch_powerMethod
function variable_mc_branch_power(
pm::AbstractExplicitNeutralACRModel;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true,
)

For ACR models with explicit neutrals, creates branch power variables :p and :q and placeholder dictionaries for the terminal power flows :p_bus and :q_bus.

source
PowerModelsDistribution.variable_mc_bus_voltageMethod
variable_mc_bus_voltage(pm::FBSUBFPowerModel; nw::Int=nw_id_default, bounded::Bool=true, report::Bool=true)

Voltage variables are defined in rectangular coordinates similar to ACRUPowerModel. An initial operating point is specified for linearization.

source
PowerModelsDistribution.variable_mc_bus_voltageMethod
variable_mc_bus_voltage(pm::FOTPUPowerModel; nw::Int=nw_id_default, bounded::Bool=true, report::Bool=true)

Voltage variables are defined in polar coordinates similar to ACPUPowerModel. An initial operating point is specified for linearization.

source
PowerModelsDistribution.variable_mc_bus_voltageMethod
variable_mc_bus_voltage(pm::FOTRUPowerModel; nw::Int=nw_id_default, bounded::Bool=true, report::Bool=true)

Voltage variables are defined in rectangular coordinates similar to ACRUPowerModel. An initial operating point is specified for linearization similar to FBSUBFPowerModel.

source
PowerModelsDistribution.variable_mc_bus_voltageMethod
function variable_mc_bus_voltage(
pm::RectangularVoltageExplicitNeutralModels;
nw=nw_id_default,
bounded::Bool=true,
)

Creates rectangular voltage variables :vr and :vi for models with explicit neutrals

source
PowerModelsDistribution.variable_mc_generator_powerMethod
function variable_mc_generator_power(
pm::AbstractExplicitNeutralACRModel;
nw::Int=nw_id_default,
)

For ACR models with explicit neutrals, creates generator power variables :pg and :qg, and placeholder dictionaries for terminal power flows :pg_bus and :qg_bus,

source
PowerModelsDistribution.variable_mc_generator_powerMethod
function variable_mc_generator_power(
)

For quadratic IVR models with explicit neutrals, creates generator power variables :pg and :qg

source
PowerModelsDistribution.variable_mc_load_currentMethod
function variable_mc_load_current(
pm::AbstractExplicitNeutralIVRModel;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true
)

For IVR models with explicit neutrals, creates placeholder dictionaries for the load current :crd and :cid, and for the terminal current flows :crd_bus and :cid_bus

source
PowerModelsDistribution.variable_mc_load_currentMethod
function variable_mc_load_current(
)

For quadratic IVR models with explicit neutrals, creates load current variables :crd and :cid, and placeholder dictionaries for the terminal current flows :crd_bus and :cid_bus

source
PowerModelsDistribution.variable_mc_load_currentMethod
variable_mc_load_current(pm::FBSUBFPowerModel, load_ids::Vector{Int}; nw::Int=nw_id_default, bounded::Bool=true, report::Bool=true)

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.variable_mc_load_powerMethod
function variable_mc_load_power(
pm::AbstractExplicitNeutralACRModel;
nw=nw_id_default,
bounded::Bool=true,
report::Bool=true
)

For ACR models with explicit neutrals, creates placeholder dictionaries for load power expressions :pd and :qd

source
PowerModelsDistribution.variable_mc_load_powerMethod
function variable_mc_load_power(
pm::AbstractNLExplicitNeutralIVRModel;
nw=nw_id_default,
bounded::Bool=true,
report::Bool=true
)

For non-linear IVR models with explicit neutrals, creates placeholder dictionaries for the load power :pd and :qd, and for the terminal power flows :pd_bus and :qd_bus

source
PowerModelsDistribution.variable_mc_load_powerMethod
function variable_mc_load_power(
)

For quadratic IVR models with explicit neutrals, creates load power variables :pd and :qd

source
PowerModelsDistribution.variable_mc_load_powerMethod

The variable creation for the loads is rather complicated because Expressions are used wherever possible instead of explicit variables. Delta loads always need a current variable and auxilary power variable (X), and all other load model variables are then linear transformations of these (linear Expressions). Wye loads however, don't need any variables when the load is modelled as constant power or constant impedance. In all other cases (e.g. when a cone is used to constrain the power), variables need to be created.

source
PowerModelsDistribution.variable_mc_load_powerMethod

The variable creation for the loads is rather complicated because Expressions are used wherever possible instead of explicit variables. All loads need a current variable; for wye loads, this variable will be in the wye reference frame whilst for delta currents it will be in the delta reference frame. All loads need variables for the off-diagonals of the nodal power variables. In some cases, the diagonals elements can be created as Expressions. Delta loads only need a current variable and auxilary power variable (X), and all other load model variables are then linear transformations of these (linear Expressions).

source
PowerModelsDistribution.variable_mc_load_power_delta_auxMethod

Creates power matrix variable X for delta windings; this defines both the wye-side power Sy and the delta-side power Sd through the lin. transformations Sy = X.Td, Sd = Td.X with Td=[1 -1 0; 0 1 -1; -1 0 1]

See the paper by Zhao et al. for the first convex relaxation of delta transformations. @INPROCEEDINGS{zhaooptimal2017, author={C. Zhao, E. Dall'Anese and S. Low}, booktitle={IREP 2017 Bulk Power Systems Dynamics and Control Symposium}, title={{Optimal Power Flow in Multiphase Radial Networks with Delta Connections}}, year={2017}, month={}, url={https://www.nrel.gov/docs/fy18osti/67852.pdf} }

See upcoming paper for discussion of bounds. [reference added when accepted]

source
PowerModelsDistribution.variable_mc_load_power_delta_auxMethod
variable_mc_load_power_delta_aux(pm::FBSUBFPowerModel, load_ids::Vector{Int}; nw::Int=nw_id_default, eps::Real=0.1, bounded::Bool=true, report::Bool=true)

Auxiliary variables are not required since delta loads are zero-order approximations calculated using the initial operating point.

source
PowerModelsDistribution.variable_mc_switch_currentMethod
function variable_mc_switch_current(
pm::AbstractExplicitNeutralIVRModel;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true,
)

For IVR models with explicit neutrals, creates switch current variables :crs and :cis, and placeholder dictionaries for the terminal current flows :crsw_bus and :cisw_bus

source
PowerModelsDistribution.variable_mc_switch_current_realMethod
function variable_mc_switch_current_real(
pm::ExplicitNeutralModels;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true
)

For models with explicit neutrals, creates switch real current variables :crsw for models with explicit neutrals.

source
PowerModelsDistribution.variable_mc_switch_powerMethod
function variable_mc_switch_power(
pm::AbstractExplicitNeutralACRModel;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true,
)

For ACR models with explicit neutrals, creates switch power variables :p and :q and placeholder dictionaries for the terminal power flows :ps_bus and :qs_bus.

source
PowerModelsDistribution.variable_mc_switch_power_imaginaryMethod
function variable_mc_switch_power_imaginary(
pm::ExplicitNeutralModels;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true
)

For models with explicit neutrals, creates switch reactive power variables :qsw for models with explicit neutrals. This is defined per arc, i.e. with a variable for the from-side and to-side power.

source
PowerModelsDistribution.variable_mc_switch_power_realMethod
function variable_mc_switch_power_real(
pm::ExplicitNeutralModels;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true
)

For models with explicit neutrals, creates switch active power variables :psw for models with explicit neutrals. This is defined per arc, i.e. with a variable for the from-side and to-side power.

source
PowerModelsDistribution.variable_mc_transformer_currentMethod
function variable_mc_transformer_current(
pm::AbstractExplicitNeutralIVRModel;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true,
)

For IVR models with explicit neutrals, create transformer current variables :crt and :cit, and placeholder dictionaries for the terminal current flows :crt_bus and :cit_bus

source
PowerModelsDistribution.variable_mc_transformer_powerMethod
function variable_mc_transformer_power(
pm::AbstractExplicitNeutralACRModel;
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true,
)

For ACR models with explicit neutrals, creates transfomer power variables :pt and :qt, and placeholder dictionaries for transformer terminal power flows :pt_bus and :qt_bus

source
PowerModelsDistribution.variable_mc_transformer_powerMethod
function variable_mc_transformer_power(
nw::Int=nw_id_default,
bounded::Bool=true,
report::Bool=true,
)

For quadratic IVR models with explicit neutrals, creates transformer power variables :pt and :qt

source
PowerModelsDistribution.variable_mx_complexMethod
variable_mx_complex(
model::JuMP.Model,
indices::Array{T,1},
N::Dict{T,Vector{Int}},
M::Dict{T,Vector{Int}};
upper_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
lower_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
symm_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
name::Union{String, Tuple{String,String}}="",
prefix::String=""
)::Tuple where T

Shorthand to create two real matrix variables, where the first is the real part and the second the imaginary part.

If the name argument is a String, it will be suffixed with 're' and 'im'. It is possible to specify the names of the real and imaginary part directly as a Tuple as well (to achieve P and Q instead of Sre and Sim for example).

source
PowerModelsDistribution.variable_mx_complex_with_diagMethod
variable_mx_complex_with_diag(
model::JuMP.Model,
indices::Array{T,1},
N::Dict{T,Vector{Int}};
upper_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
lower_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
symm_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
diag_re::Dict{T,<:Vector{<:Any}}=Dict([(i, zeros(length(N[i]))) for i in indices]),
diag_im::Dict{T,<:Vector{<:Any}}=Dict([(i, zeros(length(N[i]))) for i in indices]),
name::Union{String, Tuple{String,String}}="",
prefix::String=""
)::Tuple where T

Same as variable_mx_complex, but square and the diagonal of the matrix variables consists of the constants passed as the diagre and diagim argument. The diag argument is a dictionary of (index, 1d-array) pairs.

Useful for power matrices with specified diagonals (constant power wye loads).

source
PowerModelsDistribution.variable_mx_hermitianMethod
variable_mx_hermitian(
model::JuMP.Model,
indices::Array{T,1},
N::Dict{T,Vector{Int}};
upper_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
lower_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
symm_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
sqrt_upper_bound::Union{Missing, Dict{T,<:Vector{<:Real}}}=missing,
sqrt_lower_bound::Union{Missing, Dict{T,<:Vector{<:Real}}}=missing,
set_lower_bound_diag_to_zero::Bool=false,
imag_set_diag_to_zero::Bool=true,
name::Union{String,Tuple{String,String}}="",
prefix::String=""
)::Tuple where T

Returns a pair of symmetric and skew-symmetric matrix variables.

source
PowerModelsDistribution.variable_mx_realMethod
variable_mx_real(
model::JuMP.Model,
indices::Array{T,1},
N::Dict{T,Vector{Int}},
M::Dict{T,Vector{Int}};
upper_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
lower_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
name::String="",
prefix::String=""
) where T

This function creates a set of real matrix variables of size NxM, indexed over the elements of the indices argument. The upper and lower bounds have to be specified, and are dictionaries with the indices as keys and the matrix bounds as values. The name and prefix arguments will be combined into the base_name argument for JuMP; the prefix will typically be the network number nw. Instead of sequentially creating the matrix variables, the elements of the matrices are created sequentially for all matrices at once. I.e., we loop over the elements, and not over the indices. This is needed so that the variable names printed by JuMP are in line with the current design.

Returns a dictionary of (index, matrix variable) pairs

source
PowerModelsDistribution.variable_mx_real_with_diagMethod
variable_mx_real_with_diag(
model::JuMP.Model,
indices::Array{T,1},
N::Dict{T,Vector{Int}};
upper_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
lower_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
diag::Dict{T,<:Vector{<:Any}}=Dict([(i, fill(0, length(N[i]))) for i in indices]),
name::String="",
prefix::String=""
) where T

Same as variable_mx_real, but has to be square and the diagonal of the matrix variables consists of the elements passed as the diag argument. The diag argument is a dictionary of (index, 1d-array) pairs. Useful for power matrices with specified diagonals (constant power wye loads). If not specified, the diagonal elements are set to zero.

source