Input validators and Network builders
CommonOPF.format_input_dict
— Functionfunction format_input_dict(d::Dict)::Dict
Convert busses from Vector{String} to Tuple{String, String} for all edge types
Subtypes of AbstractBus
CommonOPF.build_busses
— Functionfunction build_busses(dicts::AbstractVector{Dict{Symbol, Any}}, ConcreteBusType::DataType)
unpack each dict in dicts
into ConcreteBusType
constructor and pass the results to check_edges!
.
returns Vector{ConcreteBusType}
CommonOPF.check_busses!
— Functioncheck_busses!(busses::AbstractVector{<:AbstractBus}) = nothing
The default action after build_busses.
check_busses!(loads::AbstractVector{Load})
Remove (and warn about it) if any Load have no way to define the loads
CommonOPF.fill_node_attributes!
— Functionfill_node_attributes!(g::MetaGraphsNext.AbstractGraph, vals::AbstractVector{<:AbstractBus})
For each concrete bus in vals
store the concrete bus in the graph at concrete_bus.node
.
CommonOPF.fill_load!
— FunctionRules:
- If
q_to_p
is defined and akwsN
value is defined then we fill thekvarN
value, where $N \in {1,2,3}$.
Subtypes of AbstractEdge
CommonOPF.build_edges
— Functionfunction build_edges(dicts::AbstractVector{Dict}, Edge::DataType)
unpack each dict in dicts
into Edge
and pass the results to check_edges!
. returns Vector{Edge}
CommonOPF.check_edges!
— Functioncheck_edges!(edges::AbstractVector{<:AbstractEdge})::Bool = true
The default action after build_edges.
check_edges!(conductors::AbstractVector{Conductor})
if all phases
are missing then - warn_singlephase_conductors_and_copy_templates(conductors)
else - validate_multiphase_edges!(conductors)
check_edges!(transformers::AbstractVector{Transformer})::Bool
fill in rmatrix
and xmatrix
if phases
is not missing. For now assuming zero mutual impedances.
check_edges!(regulators::AbstractVector{VoltageRegulator})::Bool
Warn if not missing both vregpu and turnratio and call validatemultiphaseedges! if any phases
are not missing.
CommonOPF.fill_edges!
— Functionfunction fill_edges!(g::MetaGraphsNext.AbstractGraph, vals::AbstractVector{<:AbstractEdge})
For each edge
in
valsstore the
edge`in the graph using the
edge.busses`:
b1, b2 = edge.busses
graph[b1, b2] = edge
Existing edges are overwritten with a warning.
CommonOPF.fill_impedance_matrices!
— Functionfunction fill_impedance_matrices!(edge::AbstractEdge)
Put the resistance and reactance values on the diagonal of the rmatrix and xmatrix respectively
function fill_impedance_matrices!(cond::Conductor)
Use zero and positive sequence impedances to create phase-impedance matrix.
CommonOPF.unpack_input_matrices!
— Functionfunction unpack_input_matrices!(edge::AbstractEdge)
Convert lower diagonal impedance matrices loaded in from YAML or JSON to 3x3 matrices. The "matrices" come in as Vector{Vector} and look like:
julia> d[:conductors][3][:rmatrix]
3-element Vector{Vector{Float64}}:
[0.31]
[0.15, 0.32]
[0.15, 0.15, 0.33]
CommonOPF.validate_multiphase_edges!
— Functionvalidate_multiphase_edges!(edges::AbstractVector{<:AbstractEdge})
The default method for checking for missing phases and filling rmatrix
and xmatrix
values for subtypes of AbstractEdge
. We assume that the subtype has resistance
and reactance
properties and warn if any phases
are missing as well as if we cannot infer impedance values.
validate_multiphase_edges!(conds::AbstractVector{Conductor})::Bool
Fill in impedance matrices and @warn
for any conductors that do not have inputs required to define impedance.
CommonOPF.warn_singlephase_conductors_and_copy_templates
— Functionwarn_singlephase_conductors_and_copy_templates(conds::AbstractVector{Conductor})
- Warn when missing templates and/or cannot define impedances.
- Copy template r1 and x1 values.