Power Model
All methods for constructing powermodels should be defined on the following type:
PowerModels.GenericPowerModel — Type.type GenericPowerModel{T<:AbstractPowerFormulation}
model::JuMP.Model
data::Dict{String,Any}
setting::Dict{String,Any}
solution::Dict{String,Any}
var::Dict{Symbol,Any} # model variable lookup
ref::Dict{Symbol,Any} # reference data
ext::Dict{Symbol,Any} # user extentions
endwhere
datais the original data, usually from reading in a.jsonor.m(patpower) file,settingusually looks something likeDict("output" => Dict("branch_flows" => true)), andrefis a place to store commonly used pre-computed data from of the data dictionary, primarily for converting data-types, filtering out deactivated components, and storing system-wide values that need to be computed globally. Seebuild_ref(data)for further details.
Methods on GenericPowerModel for defining variables and adding constraints should
work with the
refdict, rather than the originaldatadict,add them to
model::JuMP.Model, andfollow the conventions for variable and constraint names.
which utilizes the following (internal) functions:
PowerModels.build_ref — Function.Returns a dict that stores commonly used pre-computed data from of the data dictionary, primarily for converting data-types, filtering out deactivated components, and storing system-wide values that need to be computed globally.
Some of the common keys include:
:off_angminand:off_angmax(seecalc_theta_delta_bounds(data)),:bus– the set{(i, bus) in ref[:bus] : bus["bus_type"] != 4},:gen– the set{(i, gen) in ref[:gen] : gen["gen_status"] == 1 && gen["gen_bus"] in keys(ref[:bus])},:branch– the set of branches that are active in the network (based on the component status values),:arcs_from– the set[(i,b["f_bus"],b["t_bus"]) for (i,b) in ref[:branch]],:arcs_to– the set[(i,b["t_bus"],b["f_bus"]) for (i,b) in ref[:branch]],:arcs– the set of arcs from botharcs_fromandarcs_to,:bus_arcs– the mappingDict(i => [(l,i,j) for (l,i,j) in ref[:arcs]]),:buspairs– (seebuspair_parameters(ref[:arcs_from], ref[:branch], ref[:bus])),:bus_gens– the mappingDict(i => [gen["gen_bus"] for (i,gen) in ref[:gen]]).:bus_loads– the mappingDict(i => [load["load_bus"] for (i,load) in ref[:load]]).:bus_shunts– the mappingDict(i => [shunt["shunt_bus"] for (i,shunt) in ref[:shunt]]).:arcs_from_dc– the set[(i,b["f_bus"],b["t_bus"]) for (i,b) in ref[:dcline]],:arcs_to_dc– the set[(i,b["t_bus"],b["f_bus"]) for (i,b) in ref[:dcline]],:arcs_dc– the set of arcs from botharcs_from_dcandarcs_to_dc,:bus_arcs_dc– the mappingDict(i => [(l,i,j) for (l,i,j) in ref[:arcs_dc]]), and:buspairs_dc– (seebuspair_parameters(ref[:arcs_from_dc], ref[:dcline], ref[:bus])),
If :ne_branch exists, then the following keys are also available with similar semantics:
:ne_branch,:ne_arcs_from,:ne_arcs_to,:ne_arcs,:ne_bus_arcs,:ne_buspairs.
PowerModels.buspair_parameters — Function.compute bus pair level structures