Internal Functions

Base.delete!Method

Base.delete! for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.delete!Method

Base.delete! for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.eltypeMethod

Base.eltype for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.getMethod

Base.get for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.getindexMethod

Base.getindex for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.getpropertyMethod

Base.getproperty for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.haskeyMethod

Base.haskey for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.isemptyMethod

Base.isempty for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.iterateMethod

Base.iterate for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.keysMethod

Base.keys for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.keytypeMethod

Base.keytype for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.lengthMethod

Base.length for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.merge!Method

Base.merge! for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.parseMethod

Parses dss capacitor control type into CapControlType enum

source
Base.setindex!Method

Base.setindex! for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.setproperty!Method

Base.setproperty! for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.showMethod

Base.show variant for InfrastructureModel,InfrastructureObject to make them Dict-like

source
Base.showMethod

Base.show variant for InfrastructureModel,InfrastructureObject to make them Dict-like

source
Base.summaryMethod

Base.summary for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
Base.valtypeMethod

Base.valtype for InfrastructureModel,InfrastructureObject to give them Dict-like behavior

source
PowerModelsDistribution._adjust_small_line_admittances!Method
_adjust_small_line_admittances!(data_eng::Dict{String,<:Any}; min_admittance_val::Real=1e-2, replace_admittance_val::Real=0.0)

Replaces admittances (gfr, gto, bfr, bto) on lines, linecodes, and switches lower than min_admittance_val with replace_admittance_val.

source
PowerModelsDistribution._adjust_small_line_impedances!Method
_adjust_small_line_impedances!(data_eng::Dict{String,<:Any}; min_impedance_val::Real=1e-2, replace_impedance_val::Real=0.0)

Replaces impedances (rs, xs) on lines, linecodes, and switches lower than min_impedance_val with replace_impedance_val.

source
PowerModelsDistribution._apply_kron_reduction!Method
_apply_kron_reduction!(data_eng::Dict{String,<:Any}; kr_phases::Union{Vector{Int},Vector{String}}=[1,2,3], kr_neutral::Union{Int,String}=4)

Applies a Kron Reduction to the network, reducing out the kr_neutral, leaving only the kr_phases

source
PowerModelsDistribution._apply_voltage_bounds!Method
_apply_voltage_bounds!(data_eng::Dict{String,<:Any}; vm_lb::Union{Real,Missing}=0.9, vm_ub::Union{Real,Missing}=1.1)

add voltage bounds to all buses based on per-unit upper (vm_ub) and lower (vm_lb), scaled by the bus's voltage based

source
PowerModelsDistribution._calc_branch_current_maxMethod

Returns a total (shunt+series) current magnitude bound for the from and to side of a branch. The total power rating also implies a current bound through the lower bound on the voltage magnitude of the connected buses.

source
PowerModelsDistribution._calc_branch_power_maxMethod

Returns a total (shunt+series) power magnitude bound for the from and to side of a branch. The total current rating also implies a current bound through the upper bound on the voltage magnitude of the connected buses.

source
PowerModelsDistribution._calc_branch_power_max_frtoMethod

Returns a total (shunt+series) power magnitude bound for the from and to side of a branch. The total current rating also implies a current bound through the upper bound on the voltage magnitude of the connected buses.

source
PowerModelsDistribution._calc_bus_vm_ll_boundsMethod

Returns bounds in line-to-line bounds on the voltage magnitude. If these are not part of the problem specification, then a valid upper bound is implied by the line-to-neutral bounds, but a lower bound (greater than zero) is not. Therefore, a default lower bound is then used, specified by the keyword argument vdmin_eps. The returned bounds are for the pairs 1->2, 2->3, 3->1

source
PowerModelsDistribution._calc_load_vboundsMethod

Returns the voltage magnitude bounds for the individual load elements in a multiphase load. These are inferred from vmin/vmax for wye loads and from calcbusvmll_bounds for delta loads.

source
PowerModelsDistribution._calc_shuntMethod

Given a set of addmittances 'y' connected from the conductors 'fcnds' to the conductors 'tcnds', this method will return a list of conductors 'cnd' and a matrix 'Y', which will satisfy I[cnds] = Y*V[cnds].

source
PowerModelsDistribution._calc_voltage_basesMethod
_calc_voltage_bases(data_model::Dict{String,<:Any}, vbase_sources::Dict{String,<:Real}, edge_elements::Vector{String})::Tuple{Dict,Dict}

Calculates voltage bases for each voltage zone for buses and branches given a list of edge_elements

source
PowerModelsDistribution._compute_UvMethod
_compute_Uv(
  pfd::PowerFlowData,
  max_iter::Int,
  stat_tol::Float,
  verbose::Bool
)

Computes a nonlinear AC power flow in rectangular coordinates based on the admittance matrix of the network data using the fixed-point current injection method (See https://arxiv.org/abs/2305.04405). Returns a solution data structure in PowerModelsDistribution Dict format.

source
PowerModelsDistribution._compute_mc_pfMethod
_compute_mc_pf(
    data_math::Dict{String,<:Any};
    v_start::Union{Dict{<:Any,<:Any},Missing}=missing,
    explicit_neutral::Bool=false,
    max_iter::Int=100,
    stat_tol::Real=1E-8,
    verbose::Bool=false
)::Dict{String,Any}

Computes native power flow and outputs the result dict (See https://arxiv.org/abs/2305.04405).

Abbreviations:

  • ntype: node type (variable, fixed, grounded, virtual)
  • bts: bus-terminals for the component
  • ns: nodes
  • vns: virtual nodes
  • nr_vns: number of virtual nodes
  • y_prim: primitive admittance matrix for the component
  • cnlfunc: nonlinear compensation current function handle for the component
  • ctotsfunc: total current function handle for the component
source
PowerModelsDistribution._correct_bus_types!Method

checks bus types are suitable for a power flow study, if not, fixes them. the primary checks are that all type 2 buses (i.e., PV) have a connected and active generator and there is a single type 3 bus (i.e., slack bus) with an active connected generator. Assumes that the network is a single connected component

source
PowerModelsDistribution._cpf_branch_interfaceMethod
_cpf_branch_interface(
  branch::Dict,
  v_start::Dict,
  explicit_neutral::Bool,
  line_vbase::Dict,
  sbase::Float
)

Branch component interface outputs branch primitive Y matrix (See https://arxiv.org/abs/2305.04405 Section 4.1).

source
PowerModelsDistribution._cpf_generator_interfaceMethod
_cpf_generator_interface(
  gen::Dict,
  v_start::Dict,
  explicit_neutral::Bool,
  line_vbase::Dict,
  sbase::Float
)

Generator component interface outputs generator primitive Y matrix (See https://arxiv.org/abs/2305.04405 Section 4.4 and 4.5).

source
PowerModelsDistribution._cpf_load_interfaceMethod
_cpf_load_interface(
  load::Dict,
  v_start::Dict,
  explicit_neutral::Bool,
  line_vbase::Dict,
  sbase::Float
)

Load component interface outputs load primitive Y matrix (See https://arxiv.org/abs/2305.04405 Sections 4.4 and 4.5).

source
PowerModelsDistribution._cpf_shunt_interfaceMethod
_cpf_shunt_interface(
  shunt::Dict,
  v_start::Dict,
  explicit_neutral::Bool,
  line_vbase::Dict,
  sbase::Float
)

Shunt component interface outputs shunt primitive Y matrix (See https://arxiv.org/abs/2305.04405 Section 4.2).

source
PowerModelsDistribution._cpf_storage_interfaceMethod
_cpf_storage_interface(
  storage::Dict,
  v_start::Dict,
  explicit_neutral::Bool,
  line_vbase::Dict,
  sbase::Float
)

Storage component interface outputs storage primitive Y matrix (See https://arxiv.org/abs/2305.04405 Section 4.4 and 4.5).

source
PowerModelsDistribution._cpf_switch_interfaceMethod
_cpf_switch_interface(
  switch::Dict,
  v_start::Dict,
  explicit_neutral::Bool,
  line_vbase::Dict,
  sbase::Float
)

Branch component interface outputs branch primitive Y matrix (See https://arxiv.org/abs/2305.04405 Section 4.2).

source
PowerModelsDistribution._cpf_transformer_interfaceMethod
_cpf_transformer_interface(
  tr::Dict,
  v_start::Dict,
  explicit_neutral::Bool,
  line_vbase::Dict,
  sbase::Float
)

Transformer component interface outputs transformer primitive Y matrix (See https://arxiv.org/abs/2305.04405 Section 4.3).

source
PowerModelsDistribution._dss2eng_load!Function

Adds loads to data_eng from data_dss

Constant can still be scaled by other settings, fixed cannot Note that in the current feature set, fixed therefore equals constant

1: Constant P and Q, default 2: Constant Z 3: Constant P and quadratic Q 4: Exponential 5: Constant I 6: Constant P and fixed Q

7: Constant P and quadratic Q (i.e., fixed reactance)

8: ZIP

source
PowerModelsDistribution._equivalance_center_tap!Method
_equivalance_center_tap!(transformer::Dict{String,<:Any}, data_eng::Dict{String,<:Any})

Removes center tap transformers based on Eq. (1) from Kersting's paper 'Center-Tapped Transformers and 120/240-V Secondary Models' Z0 = 0.5r_t + j0.8x_t

source
PowerModelsDistribution._infer_neutral_terminalsMethod

Return a list of all implicit neutrals as a list of bus-terminal pairs. This is done by starting from a list of all terminals which are either a.connected to the neutral of wye-connected components; b. or are grounded. This initial list is then expanded to all terminals which are galvanically connected to terminals in the initial list.

source
PowerModelsDistribution._kronMethod
_kron(Z::Matrix{T}, Y::Matrix{T}, nconds::Int)::Tuple{Matrix{T}, Matrix{T}} where T <: Complex

Kron reduces impedance and shunt admittance matrices down to size (nconds, nconds)

source
PowerModelsDistribution._kron_reduce_implicit_neutrals!Method
_kron_reduce_implicit_neutrals!(data_eng::Dict{String,Any})::Dict{String,Any}

Kron-reduce all (implied) neutral conductors of lines, switches and shunts, and remove any terminals which become unconnected. A line or switch conductor is considered as a neutral conductor if it is connected between two neutral terminals. A terminal is a neutral terminals if it is galvanically connected (i.e. through a line or switch) to a grounded terminal, or the neutral conductor of a wye-connected component.

source
PowerModelsDistribution._load_expmodel_paramsMethod
_load_expmodel_params(load::Dict{String,<:Any}, bus::Dict{String,<:Any})

Returns the exponential load model parameters for a load. For an exponential load it simply returns certain data model properties, whilst for constantpower, constantcurrent and constant_impedance it returns the equivalent exponential model parameters.

source
PowerModelsDistribution._make_lossless!Method
_make_lossless!(data_eng::Dict{String,<:Any})

Remove parameters from objects with loss models to make them lossless. This includes linecodes, lines, switches, xfmrcodes, transformers, voltage sources, generators, solar, and storage, which all have (or will have in the future), loss model parameters that can be omitted.

source
PowerModelsDistribution._make_matrix_variable_elementMethod
_make_matrix_variable_element(
    model::JuMP.Model,
    indices::Array{T,1},
    n::Int,
    m::Int;
    upper_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
    lower_bound::Union{Missing, Dict{T,<:Matrix{<:Real}}}=missing,
    varname::String=""
) where T

Sometimes we want to bound only a subset of the elements of a matrix variable. For example, an unbounded Hermitian variable usually still has a lower bound of zero on the real diagonal elements. When there is a mix of bounded and unbounded elements, the unboundedness is encoded as 'Inf' and '-Inf' in the bound parameters. This cannot be passed directlty to JuMP, because it would lead to an error in Mosek for example. Instead, this method checks whether all bounds for an element (n,m) are Inf, and if so, does not pass a bound to JuMP.

source
PowerModelsDistribution._remove_all_bounds!Method
_remove_all_bounds!(data_eng; exclude::Vector{<:String}=String["energy_ub"], exclude_asset_type::Vector{String}=String[])

Removes all fields ending in 'ub' or 'lb' that aren't required by the math model. Properties can be excluded from this removal with exclude::Vector{String}

Whole asset types (e.g., "line") can be excluded using the keyword argument exclude_asset_type::Vector{String}

By default, "energy_ub" is excluded from this removal, since it is a required properly on storage.

source
PowerModelsDistribution._sanatize_lineMethod
_sanatize_line(line::String)::String

Sanitizes lines by stripping them clean of extra space and the beginnging and end, making everything lowercase, changing ~ or m to more, and stripping comments

source
PowerModelsDistribution._sc2br_impedanceMethod

Converts a set of short-circuit tests to an equivalent reactance network. Reference: R. C. Dugan, “A perspective on transformer modeling for distribution system analysis,” in 2003 IEEE Power Engineering Society General Meeting (IEEE Cat. No.03CH37491), 2003, vol. 1, pp. 114-119 Vol. 1.

source
PowerModelsDistribution._sol_data_model_acr!Method
_sol_data_model_acr!(solution::Dict{String,<:Any})

solutionprocessor, see [`solvemcmodel`](@ref solvemc_model), to convert ACR variables back into polar representation (default data model voltage form)

source
PowerModelsDistribution._solve_mc_modelMethod
_solve_mc_model(
    data::Dict{String,<:Any},
    model_type::Type,
    optimizer,
    build_method::Function;
    multinetwork::Bool=false,
    ref_extensions::Vector{<:Function}=Function[],
    solution_processors::Vector{<:Function}=Function[],
    relax_integrality::Bool=false,
    kwargs...
)::Dict{String,Any}

Internal solver interface that uses instantiate_mc_model directly and runs optimize_model!, returning a result

See solve_mc_model

source
PowerModelsDistribution._transform_loops!Method
_transform_loops!(
    data_eng::Dict{String,Any};
    zero_series_impedance_threshold::Real=1E-8,
    shunt_id_prefix::AbstractString="line_loop"
)::Dict{String,Any}

Transform line loops (connected to a single bus), which are not allowed in the mathematical model. Lossy line loops are converted to equivalent shunts, and lossless ones (i.e. short-circuits) are represented by merging the short-circuited terminals. The argument 'zeroseriesimpedance_threshold' controls the threshold below which the series impedance is considered to be a short-ciruit. This is useful because OpenDSS modelers have to insert tiny impedances to represent short-circuit reactors. The addmittance to ground should be zero to trigger the short-circuit handling.

source