Methods
Some various methods used in BranchFlowModel.jl:
This list of exported methods may not be up to date and there are missing doc strings. Contributions are welcome via fork and pull request.
Missing docstring for dsstxt_to_sparse_array
. Check Documenter's build log for details.
Missing docstring for dss_files_to_dict
. Check Documenter's build log for details.
Missing docstring for build_model!(m::JuMP.AbstractModel, net::Network{SinglePhase}; relaxed::Bool=true)build_model!(m::JuMP.AbstractModel, net::Network{MultiPhase}; PSD::Bool=true)add_variables
. Check Documenter's build log for details.
BranchFlowModel.constrain_power_balance
— Functionfunction constrain_power_balance(m, net::Network)
Define the m[:loadbalcons][bus] ∀ bus ∈ busses(net) as a Dict of constraints. The keys are "p" and "q" for real and reactive power balance respectively. The values are the JuMP constraints.
∑ Pij in - losses + net injection - ∑ Pjk out = 0
The net injection are user defined loads. If one wishes to make the net injection a decision variable then delete the constraint and redefine the constraint with your decision variable.
NOTE: using sum over Pij for future expansion to mesh grids and the convention: i -> j -> k
function constrain_power_balance(m, net::Network{MultiPhase})
Sij in - losses == sum of line flows out + net injection NOTE: using sum over Pij for future expansion to mesh grids i -> j -> k
All of the power balance constraints are stored in m[:loadbalcons]
with the bus name (string) as the first index. For example m[:loadbalcons]["busname"]
will give the constrain container from JuMP for all time steps.
Missing docstring for constrain_substation_voltage
. Check Documenter's build log for details.
BranchFlowModel.constrain_KVL
— Functionconstrain_KVL(m, net::Network{MultiPhase})
Add the voltage drop definitions between busses.
$w_j = w_i - S_{ij} Z^{\star} - Z S_{ij}^{\star} + Z L_{ij} Z^{\star}$
Missing docstring for constrain_bounds
. Check Documenter's build log for details.
BranchFlowModel.check_rank_one
— Functioncheck_rank_one(m::JuMP.AbstractModel, net::Network, tol=1e-3)
Check the rank of the m[:H]
matrices from the PSD cone constraints. Warnings express any values with rank greater than one.
Missing docstring for get_bus_values
. Check Documenter's build log for details.
Missing docstring for get_edge_values
. Check Documenter's build log for details.
Missing docstring for check_soc_inequalities
. Check Documenter's build log for details.
Missing docstring for get_load_bal_shadow_prices
. Check Documenter's build log for details.
Missing docstring for current_values_by_time_edge
. Check Documenter's build log for details.
Missing docstring for line_flow_values_by_time_edge
. Check Documenter's build log for details.
CommonOPF.reduce_tree!
— Functionreduce_tree!(net::Network{SinglePhase})
combine any line sets with intermediate busses that have indegree == outdegree == 1 and is not a load bus into a single line
See remove_bus!
for how the two lines are combined.
CommonOPF.trim_tree!
— Functiontrim_tree!(net::Network)
Trim any branches that have empty busses, i.e. remove the branches that have no loads or DER.
CommonOPF.make_graph
— Functionmake_graph(edges::AbstractVector{<:AbstractEdge}; directed::Union{Bool,Missing}=missing)
return MetaGraph made up of the edges
Also the graph[:intbusmap] is created with the dicts for bus => int and int => bus (because Graphs.jl only works with integer nodes)
julia> g["13", :bus]
10
julia> g[13, :bus]
"24"
julia> get_prop(g, :int_bus_map)[13]
"24"
CommonOPF.leaf_busses
— Functionleaf_busses(net::Network)
returns Vector{String}
containing all of the leaf busses in net.graph
Missing docstring for set_inputs!
. Check Documenter's build log for details.
Missing docstring for get_diffs
. Check Documenter's build log for details.
BranchFlowModel.solve_metagraph!
— Functionsolve_metagraph!(mg::MetaGraphsNext.MetaGraph, builder::Function, tol::T; α::T=0.5, verbose=false) where T <: Real
Given a MetaGraphsNext.MetaGraph and a JuMP Model builder
method iteratively solve the models until the tol
is met for the differences provided by BranchFlowModel.get_diffs
.
The builder
must accept only one argument of type CommonOPF.AbstractNetwork
that returns a JuMP.AbstractModel
. Each model returned from the builder
is stored as an :m
property in each vertex of mg
.
tol
is compared to the maximum absolute value of all the p, q, and v differences.
solve_metagraph!(mg::MetaGraphsNext.MetaGraph, builder::Function, tols::Vector{T}; α::T=0.5, verbose=false) where T <: Real
Given a MetaGraphsNext.MetaGraph and a JuMP Model builder
method iteratively solve the models until the tols
are met for the differences provided by BranchFlowModel.get_diffs
.
The builder
must accept only one argument of type CommonOPF.AbstractNetwork
that returns a JuMP.AbstractModel
. Each model returned from the builder
is stored as an :m
property in each vertex of mg
.
The tols
should have a length of three. The first value is compared to the maximum absolute difference in real power, the second for reactive power, and the third for |v|. All differences are calculated at the leaf/substation connections.
solve_metagraph!(mg::MetaGraphsNext.MetaGraph, builder::Dict{Int64, Function}, tols::Vector{T}; α::T=0.5, verbose=false) where T <: Real
Given a MetaGraphsNext.MetaGraph and a JuMP Model builder
method iteratively solve the models until the tols
are met for the differences provided by BranchFlowModel.get_diffs
. The builder
dict is used to build each model for the corresponding vertex key.
Each function in the builder
dict must accept only one argument of type CommonOPF.AbstractNetwork
that returns a JuMP.AbstractModel
. Each model returned from the builder function is stored as an :m
property in each vertex of mg
.
The tols
should have a length of three. The first value is compared to the maximum absolute difference in real power, the second for reactive power, and the third for |v|. All differences are calculated at the leaf/substation connections.
Missing docstring for metagraph_voltages
. Check Documenter's build log for details.
Missing docstring for check_unique_solution_conditions
. Check Documenter's build log for details.
Missing docstring for check_statuses
. Check Documenter's build log for details.
Missing docstring for reg_busses
. Check Documenter's build log for details.
CommonOPF.remove_bus!
— Functionremove_bus!(j::String, net::Network{SinglePhase})
Remove bus j
in the line i->j->k from the model by making an equivalent line from busses i->k
remove_bus!(j::String, net::Network{MultiPhase})
Remove bus j
in the line i->j->k from the model by making an equivalent line from busses i->k. We assume the conductors from i->j and j->k have impedance matrices.