PowerModelsDistribution.jl Library
Abstract form for linear unbalanced power flow models
Structure representing OpenDSS dss_source_id
giving the type of the component dss_type
, its name dss_name
, and the active phases active_phases
LinDist3Flow per Sankur et al 2016, using vector variables for power, voltage and current in scalar form
default Lin3Distflow constructor for scalar form
LinDist3Flow per Sankur et al 2016, using vector variables for power, voltage and current
default LP unbalanced DistFlow constructor
Simplified BFM per Gan and Low 2014, PSCC, using matrix variables for power, voltage and current
default LP unbalanced DistFlow constructor
SDP BFM with KCL as matrix equation, Geth 2020 (under review)
default SDP unbalanced DistFlow with matrix KCL constructor
SDP BFM per Gan and Low 2014, PSCC
default SDP unbalanced DistFlow constructor
SOC relaxation of SDPUBFModel per Kim, Kojima, & Yamashita 2003, cast as a SOC
default SOC unbalanced DistFlow constructor
SOC relaxation of SDPUBFModel per Kim, Kojima, & Yamashita 2003, cast as an QCP
default SOC unbalanced DistFlow constructor
PowerModelsDistribution.add_rank!
— Method.add bus statuses for load shed problem
adds voltage balance indicators; should only be called after addsetpointbus_voltage!
add generator statuses for load shed problem
add load setpoints for load shed problem
add shunt setpoints for load shed problem
add storage statuses for load shed problem
Calculates the tap scale factor for the non-dimensionalized equations.
PowerModelsDistribution.constraint_M_psd
— Method.For rectangular coordinates of a complex matrix M=Mre+im*Mim, this function applies constraints equivalent to requiring that M itself is PSD.
Take a multi-conductor voltage variable V and a current variable I. The associated power is then defined as S = VI^H Define the lifted variables as W and L as W = VV^H, L = I*I^H Then, it is equally valid that [W S; S^H L] ∈ PSDCone, rank([W S; S^H L])=1 This function adds this PSD constraint for the rectangular coordinates of S, W and L.
generator active power setpoint constraint, delegate to PowerModels
bus voltage on/off constraint for load shed problem
on/off bus voltage constraint for DCP formulation, nothing to do
on/off constraint for bus voltages
on/off bus voltage constraint for relaxed forms
Defines branch flow model power flow loss equations
Defines branch flow model power flow equations
Defines branch flow model power flow equations
Defines branch flow model power flow equations
Defines branch flow model power flow equations
Link the current and power withdrawn by a generator at the bus through a PSD constraint. The rank-1 constraint is dropped in this formulation.
Only KCLModels need to further constrain the generator variables.
CONSTANT POWER Fixes the load power sd. sd = [sd1, sd2, sd3] What is actually fixed, depends on whether the load is connected in delta or wye. When connected in wye, the load power equals the per-phase power sn drawn at the bus to which the load is connected. sd1 = va.conj(ia) = sn_a
CONSTANT CURRENT Sets the active and reactive load power sd to be proportional to the the voltage magnitude. pd = cp.|vm| qd = cq.|vm| sd = cp.|vm| + j.cq.|vm|
CONSTANT IMPEDANCE Sets the active and reactive power drawn by the load to be proportional to the square of the voltage magnitude. pd = cp.|vm|^2 qd = cq.|vm|^2 sd = cp.|vm|^2 + j.cq.|vm|^2
DELTA When connected in delta, the load power gives the reference in the delta reference frame. This means sd1 = vab.conj(iab) = (va-vb).conj(iab) We can relate this to the per-phase power by sna = va.conj(ia) = va.conj(iab-ica) = va.conj(conj(sab/vab) - conj(sca/vca)) = va.(sab/(va-vb) - sca/(vc-va)) So for delta, sn is constrained indirectly.
Creates the constraints modelling the (relaxed) voltage-dependent loads for the matrix KCL formulation.
Creates the constraints modelling the (relaxed) voltage-dependent loads.
We want to express sab = cp.|vab|+im.cq.|vab| iab = conj(sab/vab) = |vab|.(cq-im.cq)/conj(vab) = (1/|vab|).(cp-im.cq)*vab idem for ibc and ica And then sa = va.conj(ia) = va.conj(iab-ica) idem for sb and sc
We want to express sab = cp.|vab|+im.cq.|vab| iab = conj(sab/vab) = |vab|.(cq-im.cq)/conj(vab) = (1/|vab|).(cp-im.cq)*vab idem for ibc and ica And then sa = va.conj(ia) = va.conj(iab-ica) idem for sb and sc
exponential model in acp voltage coordinates
We want to express sab = cp.|vab|^2+im.cq.|vab|^2 iab = conj(sab/vab) = |vab|^2.(cq-im.cq)/conj(vab) = (cp-im.cq)*vab idem for ibc and ica And then sa = va.conj(ia) = va.conj(iab-ica) idem for sb and s_c
We want to express sab = cp.|vab|^2+im.cq.|vab|^2 iab = conj(sab/vab) = |vab|^2.(cq-im.cq)/conj(vab) = (cp-im.cq)*vab idem for ibc and ica And then sa = va.conj(ia) = va.conj(iab-ica) idem for sb and s_c
For a delta load, sd = (sab, sbc, sca), but we want to fix s = (sa, sb, sc) s is a non-linear transform of v and sd, s=f(v,sd) sa = vaconj(sab/(va-vb) - sca/(vc-va)) sb = vbconj(sab/(va-vb) - sca/(vc-va)) sc = vc*conj(sab/(va-vb) - sca/(vc-va))
For a delta load, sd = (sab, sbc, sca), but we want to fix s = (sa, sb, sc) s is a non-linear transform of v and sd, s=f(v,sd) sa = vaconj(sab/(va-vb) - sca/(vc-va)) sb = vbconj(sab/(va-vb) - sca/(vc-va)) sc = vc*conj(sab/(va-vb) - sca/(vc-va))
Defines relationship between branch (series) power flow, branch (series) current and node voltage magnitude
model current constraints
Defines relationship between branch (series) power flow, branch (series) current and node voltage magnitude
Defines relationship between branch (series) power flow, branch (series) current and node voltage magnitude
Defines relationship between branch (series) power flow, branch (series) current and node voltage magnitude
nothing to do, these models do not have complex voltage constraints
delegate back to PowerModels by default
Defines branch flow model power flow equations
Defines voltage drop over a branch, linking from and to side voltage
Defines voltage drop over a branch, linking from and to side voltage
Defines voltage drop over a branch, linking from and to side voltage
Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)
p_fr == g[c,c] * vm_fr[c]^2 +
sum( g[c,d]*vm_fr[c]*vm_fr[d]*cos(va_fr[c]-va_fr[d]) +
b[c,d]*vm_fr[c]*vm_fr[d]*sin(va_fr[c]-va_fr[d]) for d in _PMs.conductor_ids(pm) if d != c) +
sum(-g[c,d]*vm_fr[c]*vm_to[d]*cos(va_fr[c]-va_to[d]) +
-b[c,d]*vm_fr[c]*vm_to[d]*sin(va_fr[c]-va_to[d]) for d in _PMs.conductor_ids(pm))
+ g_fr[c,c] * vm_fr[c]^2 +
sum( g_fr[c,d]*vm_fr[c]*vm_fr[d]*cos(va_fr[c]-va_fr[d]) +
b_fr[c,d]*vm_fr[c]*vm_fr[d]*sin(va_fr[c]-va_fr[d]) for d in _PMs.conductor_ids(pm) if d != c)
)
q_fr == -b[c,c] *vm_fr[c]^2 -
sum( b[c,d]*vm_fr[c]*vm_fr[d]*cos(va_fr[c]-va_fr[d]) -
g[c,d]*vm_fr[c]*vm_fr[d]*sin(va_fr[c]-va_fr[d]) for d in _PMs.conductor_ids(pm) if d != c) -
sum(-b[c,d]*vm_fr[c]*vm_to[d]*cos(va_fr[c]-va_to[d]) +
g[c,d]*vm_fr[c]*vm_to[d]*sin(va_fr[c]-va_to[d]) for d in _PMs.conductor_ids(pm))
-b_fr[c,c] *vm_fr[c]^2 -
sum( b_fr[c,d]*vm_fr[c]*vm_fr[d]*cos(va_fr[c]-va_fr[d]) -
g_fr[c,d]*vm_fr[c]*vm_fr[d]*sin(va_fr[c]-va_fr[d]) for d in _PMs.conductor_ids(pm) if d != c)
)
Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)
p_fr == sum(
vr_fr[c]*(g[c,d]*(vr_fr[d]-vr_to[d])-b[c,d]*(vi_fr[d]-vi_to[d]))
-vi_fr[c]*(-b[c,d]*(vr_fr[d]-vr_to[d])-g[c,d]*(vi_fr[d]-vi_to[d]))
for d in _PMs.conductor_ids(pm))
+ sum(
vr_fr[c]*(g_fr[c,d]*vr_fr[d]-b_fr[c,d]*vi_fr[d])
-vi_fr[c]*(-b_fr[c,d]*vr_fr[d]-g_fr[c,d]*vi_fr[d])
for d in _PMs.conductor_ids(pm))
q_fr == sum(
-vr_fr[c]*(b[c,d]*(vr_fr[d]-vr_to[d])+g[c,d]*(vi_fr[d]-vi_to[d]))
+vi_fr[c]*(g[c,d]*(vr_fr[d]-vr_to[d])-b[c,d]*(vi_fr[d]-vi_to[d]))
for d in _PMs.conductor_ids(pm))
+ sum(
-vr_fr[c]*(b_fr[c,d]*vr_fr[d]+g_fr[c,d]*vi_fr[d])
+vi_fr[c]*(g_fr[c,d]*vr_fr[d]-b_fr[c,d]*vi_fr[d])
for d in _PMs.conductor_ids(pm))
Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)
p[f_idx] == -b*(t[f_bus] - t[t_bus])
nothing to do, no voltage angle variables
ohms constraint for branches on the from-side
delegate back to PowerModels
Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)
Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)
p[t_idx] == (g+g_to)*v[t_bus]^2 + (-g*tr-b*ti)/tm*(v[t_bus]*v[f_bus]*cos(t[t_bus]-t[f_bus])) + (-b*tr+g*ti)/tm*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus]))
q[t_idx] == -(b+b_to)*v[t_bus]^2 - (-b*tr+g*ti)/tm*(v[t_bus]*v[f_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr-b*ti)/tm*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus]))
Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)
p[t_idx] == (g+g_to)*v[t_bus]^2 + (-g*tr-b*ti)/tm*(v[t_bus]*v[f_bus]*cos(t[t_bus]-t[f_bus])) + (-b*tr+g*ti)/tm*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus]))
q[t_idx] == -(b+b_to)*v[t_bus]^2 - (-b*tr+g*ti)/tm*(v[t_bus]*v[f_bus]*cos(t[f_bus]-t[t_bus])) + (-g*tr-b*ti)/tm*(v[t_bus]*v[f_bus]*sin(t[t_bus]-t[f_bus]))
nothing to do, this model is symmetric
ohms constraint for branches on the to-side
delegate back to PowerModels
Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)
Do nothing, this model is symmetric
For a variable tap transformer, fix the tap variables which are fixed. For example, an OLTC where the third phase is fixed, will have tap variables for all phases, but the third tap variable should be fixed.
power balanace constraint with line shunts and transformers, active power only
KCL including transformer arcs
power balance constraint with line shunts and transformers for relaxed WR forms
Shunt handling in matrix form: I = Y.U S = U.I' = U.(Y.U)' = U.U'.Y' = W.Y' = (Wr+j.Wi)(G+jB)' = (Wr+j.Wi)(G'-j.B') = (Wr.G'+Wi.B')+j(-Wr.B'+Wi.G') P = Wr.G'+Wi.B' Q = -Wr.B'+Wi.G'
For KCLMXModels, a new power balance constraint is required.
KCL including transformer arcs and load variables.
power balance constraint with line shunts and transformers for load shed problem, DCP formulation
KCL for load shed problem with transformers
KCL for load shed problem with transformers (AbstractWForms)
storage loss constraints, delegate to PowerModels
storage thermal limit constraints, delegate to PowerModels per conductor
branch thermal constraints from, delegate to PowerModels per conductor
branch thermal constraints to, delegate to PowerModels per conductor
balanced three-phase phasor
Creates phase angle constraints at reference buses
nothing to do, no voltage angle variables
reference angle constraints
Creates phase angle constraints at reference buses
do nothing, no way to represent this in these variables
nothing to do, this model is symmetric
nothing to do, this model is symmetric
Transformer constraints, considering winding type, conductor order, polarity and tap settings.
Links the power flowing into both windings of a fixed tap transformer
Links the voltage at both windings of a fixed tap transformer
a = exp(im2π/3) U+ = (1Ua + aUb a^2Uc)/3 U- = (1Ua + a^2Ub aUc)/3 vuf = |U-|/|U+| |U-| <= vufmax|U+| |U-|^2 <= vufmax^2*|U+|^2
a = exp(im2π/3) U+ = (1Ua + aUb a^2Uc)/3 U- = (1Ua + a^2Ub aUc)/3 vuf = |U-|/|U+| |U-| <= vufmax|U+| |U-|^2 <= vufmax^2*|U+|^2
a = exp(im2π/3) U+ = (1Ua + aUb a^2Uc)/3 U- = (1Ua + a^2Ub aUc)/3 vuf = |U-|/|U+| |U-| <= vufmax|U+| |U-|^2 <= vufmax^2*|U+|^2
a = exp(im2π/3) U+ = (1Ua + aUb a^2Uc)/3 U- = (1Ua + a^2Ub aUc)/3 vuf = |U-|/|U+| |U-| <= vufmax|U+| |U-|^2 <= vufmax^2*|U+|^2
This is duplicated at PMD level to correctly handle the indexing of the shunts.
By default, delegate back to PM; only certain formulations differ between PMD and PMs.
This is duplicated at PMD level to correctly handle the indexing of the shunts.
Impose all balance related constraints for which key present in data model of bus. For a discussion of sequence components and voltage unbalance factor (VUF), see @INPROCEEDINGS{girigoudarmolzahnroald-2019, author={K. Girigoudar and D. K. Molzahn and L. A. Roald}, booktitle={submitted}, title={{Analytical and Empirical Comparisons of Voltage Unbalance Definitions}}, year={2019}, month={}, url={https://molzahn.github.io/pubs/girigoudarmolzahnroald-2019.pdf} }
Defines voltage drop over a branch, linking from and to side voltage magnitude
on/off bus voltage magnitude constraint
on/off voltage magnitude constraint
voltage magnitude setpoint constraint, delegate to PowerModels per conductor
on/off bus voltage magnitude squared constraint for relaxed formulations
on/off voltage magnitude squared constraint for relaxed formulations
This is duplicated at PMD level to correctly handle the indexing of the shunts.
PowerModelsDistribution.constraint_pqw
— Method.Creates the constraints modelling the (relaxed) voltage-dependency of the power consumed in each phase, s=p+jq. This is completely symmetrical for p and q, with appropriate substitutions of the variables and parameters: p->q, a->b, alpha->beta, pmin->qmin, pmax->qmax
PowerModelsDistribution.count_nodes
— Method.Counts number of nodes in network
PowerModelsDistribution.count_nodes
— Method.Counts number of nodes in network
PowerModelsDistribution.find_bus
— Method.find_bus(busname, pmd_data)
Finds the index number of the bus in existing data from the given busname
.
PowerModelsDistribution.find_component
— Method.find_component(pmd_data, name, compType)
Returns the component of compType
with name
from data
of type Dict{String,Array}.
Corrects the shunts from vectors to matrices after the call to PMs.
PowerModelsDistribution.matlab_to_pmd
— Method.Converts a Matlab dict into a PowerModelsDistribution dict
maximum loadability objective (continuous load shed) with storage
minimum load delta objective (continuous load shed) with storage
a quadratic penalty for bus power slack variables
PowerModelsDistribution.parse_dss
— Method.PowerModelsDistribution.parse_dss
— Method.parse_dss(filename)
Parses a OpenDSS file given by filename
into a Dict{Array{Dict}}. Only supports components and options, but not commands, e.g. "plot" or "solve". Will also parse files defined inside of the originating DSS file via the "compile", "redirect" or "buscoords" commands.
PowerModelsDistribution.parse_dss_with_dtypes!
— Function.parse_dss_with_dtypes!(dss_data, toParse)
Parses the data in keys defined by toParse
in dss_data
using types given by the default properties from the get_prop_default
function.
PowerModelsDistribution.parse_file
— Method.parse_file(io)
Parses the IOStream of a file into a Three-Phase PowerModels data structure.
PowerModelsDistribution.parse_file
— Method.PowerModelsDistribution.parse_matlab
— Method.PowerModelsDistribution.parse_matlab
— Method.PowerModelsDistribution.parse_opendss
— Method.Parses a Dict resulting from the parsing of a DSS file into a PowerModels usable format
PowerModelsDistribution.parse_opendss
— Method.Parses a DSS file into a PowerModels usable format
PowerModelsDistribution.parse_options
— Method.parse_options(options)
Parses options defined with the set
command in OpenDSS.
PowerModelsDistribution.post_mc_mld
— Method.Load shedding problem including storage
PowerModelsDistribution.post_mc_mld_bf
— Method.Load shedding problem for Branch Flow model
PowerModelsDistribution.post_mc_mld_uc
— Method.Standard unit commitment (!relaxed) load shedding problem
PowerModelsDistribution.post_mc_opf
— Method.PowerModelsDistribution.post_mc_opf_bctr
— Method.PowerModelsDistribution.post_mc_opf_bf
— Method.PowerModelsDistribution.post_mc_opf_lm
— Method.This problem specification includes advanced load models, including constant power, constant current and constabt impedance delta-connected and wye-connected
PowerModelsDistribution.post_mc_opf_oltc
— Method.PowerModelsDistribution.post_mc_opf_pbs
— Method.OPF problem with slack power at every bus
PowerModelsDistribution.post_mc_pf
— Method.PowerModelsDistribution.post_mc_pf_bf
— Method.PowerModelsDistribution.post_mc_pf_lm
— Method.PowerModelsDistribution.post_mc_pf_pbs
— Method.PF problem with slack power at every bus
Adds arcs for PMD transformers; for dclines and branches this is done in PMs
For debugging / exploration: real-valued SDP to SDP relaxation based on PSDness of principal minors, default is 3x3 SDP relaxation
See section 4.3 for complex to real PSD constraint transformation: @article{Fazel2001, author = {Fazel, M. and Hindi, H. and Boyd, S.P.}, title = {{A rank minimization heuristic with application to minimum order system approximation}}, doi = {10.1109/ACC.2001.945730}, journal = {Proc. American Control Conf.}, number = {2}, pages = {4734–4739}, url = {http://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?arnumber=945730}, volume = {6}, year = {2001} }
SDP to SOC relaxation of type 2, applied to complex-value matrix, as described in:
@article{Kim2003,
author = {Kim, S and Kojima, M and Yamashita, M},
title = {{Second order cone programming relaxation of a positive semidefinite constraint}},
doi = {10.1080/1055678031000148696},
journal = {Optimization Methods and Software},
number = {5},
pages = {535--541},
volume = {18},
year = {2003}
}
SDP to SOC relaxation of type 2, applied to complex-value matrix, as described in:
@article{Kim2003,
author = {Kim, S and Kojima, M and Yamashita, M},
title = {{Second order cone programming relaxation of a positive semidefinite constraint}},
doi = {10.1080/1055678031000148696},
journal = {Optimization Methods and Software},
number = {5},
pages = {535--541},
volume = {18},
year = {2003}
}
See section 4.3 for complex to real PSD constraint transformation: @article{Fazel2001, author = {Fazel, M. and Hindi, H. and Boyd, S.P.}, title = {{A rank minimization heuristic with application to minimum order system approximation}}, doi = {10.1109/ACC.2001.945730}, journal = {Proc. American Control Conf.}, number = {2}, pages = {4734–4739}, url = {http://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?arnumber=945730}, volume = {6}, year = {2001} }
SDP to SOC relaxation of type 2, applied to real-value matrix, as described in:
@article{Kim2003,
author = {Kim, S and Kojima, M and Yamashita, M},
title = {{Second order cone programming relaxation of a positive semidefinite constraint}},
doi = {10.1080/1055678031000148696},
journal = {Optimization Methods and Software},
number = {5},
pages = {535--541},
volume = {18},
year = {2003}
}
SDP to SOC relaxation of type 2, applied to real-value matrix, as described in:
@article{Kim2003,
author = {Kim, S and Kojima, M and Yamashita, M},
title = {{Second order cone programming relaxation of a positive semidefinite constraint}},
doi = {10.1080/1055678031000148696},
journal = {Optimization Methods and Software},
number = {5},
pages = {535--541},
volume = {18},
year = {2003}
}
PowerModelsDistribution.run_ac_mc_opf
— Method.PowerModelsDistribution.run_ac_mc_opf_lm
— Method.PowerModelsDistribution.run_ac_mc_pf
— Method.PowerModelsDistribution.run_ac_mc_pf_lm
— Method.PowerModelsDistribution.run_dc_mc_opf_lm
— Method.PowerModelsDistribution.run_dc_mc_pf
— Method.PowerModelsDistribution.run_mc_mld
— Method.Run load shedding problem with storage
PowerModelsDistribution.run_mc_mld
— Method.PowerModelsDistribution.run_mc_mld_bf
— Method.Run Branch Flow Model Load Shedding Problem
PowerModelsDistribution.run_mc_mld_bf
— Method.PowerModelsDistribution.run_mc_mld_uc
— Method.Run unit commitment load shedding problem (!relaxed)
PowerModelsDistribution.run_mc_mld_uc
— Method.PowerModelsDistribution.run_mc_opf
— Method.PowerModelsDistribution.run_mc_opf
— Method.PowerModelsDistribution.run_mc_opf_bctr
— Method.PowerModelsDistribution.run_mc_opf_bctr
— Method.PowerModelsDistribution.run_mc_opf_bf
— Method.PowerModelsDistribution.run_mc_opf_bf
— Method.PowerModelsDistribution.run_mc_opf_bf_lm
— Method.PowerModelsDistribution.run_mc_opf_bf_lm
— Method.PowerModelsDistribution.run_mc_opf_lm
— Method.PowerModelsDistribution.run_mc_opf_lm
— Method.PowerModelsDistribution.run_mc_opf_oltc
— Method.PowerModelsDistribution.run_mc_opf_oltc
— Method.PowerModelsDistribution.run_mc_opf_pbs
— Method.OPF problem with slack power at every bus
PowerModelsDistribution.run_mc_opf_pbs
— Method.OPF problem with slack power at every bus
PowerModelsDistribution.run_mc_pf
— Method.PowerModelsDistribution.run_mc_pf
— Method.PowerModelsDistribution.run_mc_pf_bf
— Method.PowerModelsDistribution.run_mc_pf_bf
— Method.PowerModelsDistribution.run_mc_pf_lm
— Method.PowerModelsDistribution.run_mc_pf_lm
— Method.PowerModelsDistribution.run_mc_pf_pbs
— Method.PF problem with slack power at every bus
PowerModelsDistribution.run_mc_pf_pbs
— Method.PF problem with slack power at every bus
PowerModelsDistribution.solution_bctr!
— Method.PowerModelsDistribution.solution_bf!
— Method.PowerModelsDistribution.solution_mld!
— Method.solution builder for minimum load delta problem (load shed)
PowerModelsDistribution.solution_mld_bf!
— Method.solution builder for branch-flow minimum load delta problem (load shed)
PowerModelsDistribution.solution_pbs!
— Method.Create variables for active
storage injection
nothing to do, variables not used in linearised branch flow model
branch flow variables, delegated back to PowerModels
generates variables for both active
and reactive
slack at each bus
Create voltage variables for branch flow model
create variables for generators, delegate to PowerModels
For the matrix KCL formulation, the generator needs an explicit current and power variable.
For the matrix KCL formulation, the generator needs an explicit current variable.
create on/off variables for generators, delegate to PowerModels
For the matrix KCL formulation, the generator needs an explicit power variable.
Create variables for bus status
Create variables for demand status
Create variables for generator status
Create variables for shunt status
Create variables for storage status
PowerModelsDistribution.variable_mc_load
— Method.Create a dictionary with values of type Any for the load. Depending on the load model, this can be a parameter or a NLexpression. These will be inserted into KCL.
PowerModelsDistribution.variable_mc_load
— Method.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).
PowerModelsDistribution.variable_mc_load
— Method.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.
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.
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]
These variables reflect the power consumed by the load, NOT the power injected into the bus nodes; these variables only coincide for wye-connected loads with a grounded neutral.
The bus qualifier denotes that this is the power withdrawn at the bus; Only for grounded wye-connected loads, this is the same as the power consumed by the multi-phase load. The off-diagonals only need to be created for the matrix KCL formulation.
Create tap variables.
Create variables for active
and reactive
storage injection
Create variables for reactive
storage injection
variables for modeling storage units, includes grid injection and internal variables
Create variables for the active power flowing into all transformer windings.
Create variables for the active power flowing into all transformer windings
Creates variables for both active
and reactive
power flow at each transformer.
do nothing, no reactive power in this model
Create variables for the reactive power flowing into all transformer windings.
voltage variables, delegated back to PowerModels
voltage variables, relaxed form
on/off voltage magnitude variable
variable: w[i] >= 0
for i
in bus
es
voltage variable magnitude squared (relaxed form)
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).
Same as variablemxcomplex, 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).
Returns a pair of symmetric and skew-symmetric matrix variables.
PowerModelsDistribution.variable_mx_real
— Method.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
Same as variablemxreal, but adds skew-symmetry structure.
Same as variablemxreal, but adds symmetry structure
Same as variablemxreal, 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.
PowerModelsDistribution._constructors
— Constant.list of constructor functions for easy access
PowerModelsDistribution._like_exclusions
— Constant.properties that should be excluded from being overwritten during the application of like
PowerModels.constraint_model_current
— Method.do nothing
PowerModelsDistribution._add_component!
— Method._add_component!(dss_data, ctype_name, compDict)
Adds a component of type ctype_name
with properties given by compDict
to the existing dss_data
structure. If a component of the same type has already been added to dss_data
, the new component is appeneded to the existing array of components of that type, otherwise a new array is created.
PowerModelsDistribution._add_property
— Method._add_property(compDict, key, value)
Adds a property to an existing component properties dictionary compDict
given the key
and value
of the property. If a property of the same name already exists inside compDict
, the original value is converted to an array, and the new value is appended to the end.
PowerModelsDistribution._add_shunt!
— Method.Helper function to add a new shunt. The shunt element is always inserted at the internal bus of the second winding in OpenDSS. If one of the branches of the loss model connected to this bus, has zero impedance (for example, if XHL==0 or XLT==0 or R[3]==0), then this bus might be removed by rmredundantpdelements!, in which case a new shunt should be inserted at the remaining bus of the removed branch.
PowerModelsDistribution._adjust_base!
— Method.function _adjust_base!(pmd_data)
Updates the voltage base at each bus, so that the ratios of the voltage bases across a transformer are consistent with the ratios of voltage ratings of the windings. Default behaviour is to start at the primary winding of the first transformer, and to propagate from there. Branches are updated; the impedances and addmittances are rescaled to be consistent with the new voltage bases.
Rescales the parameters of a branch to reflect a change in voltage base
This is the recursive code that goes with adjustbase!; adjustbase! initializes arrays and other data that is passed along in the calls to this recursive function. For very large networks, this might have to be rewritten to not rely on recursion.
Rescales the parameters of a shunt to reflect a change in voltage base
_adjust_sourcegen_bounds!(pmd_data)
Changes the bounds for the sourcebus generator by checking the emergamps of all of the branches attached to the sourcebus and taking the sum of non-infinite values. Defaults to Inf if all emergamps connected to sourcebus are also Inf. This method was updated to include connected transformers as well. It know has to occur after the call to InfrastructureModels.arraystodicts, so the code was adjusted to accomodate that.
PowerModelsDistribution._apply_like!
— Method.applies like
to component
_assign_property!(dss_data, cType, cName, propName, propValue)
Assigns a property with name propName
and value propValue
to the component of type cType
named cName
in dss_data
.
Combines transformers with 'bank' keyword into a single transformer
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.
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.
Returns a valid series current magnitude bound for a branch.
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
Returns a current magnitude bound for the generators.
Returns magnitude bounds for the current going through the load.
Returns a magnitude bound for the current going through the load.
Calculates lower and upper bounds for the loads themselves (not the power withdrawn at the bus).
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.
Returns a Bool, indicating whether the convex hull of the voltage-dependent relationship needs a cone inclusion constraint.
_correct_duplicate_components!(dss_data)
Finds duplicate components in dss_data
and merges up, meaning that older data (lower indices) is always overwritten by newer data (higher indices).
PowerModelsDistribution._create_capacitor
— Function._create_capacitor(bus1, name, bus2=0; kwargs)
Creates a Dict{String,Any} containing all of the expected properties for a Capacitor. If bus2
is not specified, the capacitor will be treated as a shunt. See OpenDSS documentation for valid fields and ways to specify the different properties.
PowerModelsDistribution._create_generator
— Function._create_generator(bus1, name; kwargs...)
Creates a Dict{String,Any} containing all of the expected properties for a Generator. See OpenDSS documentation for valid fields and ways to specify the different properties.
PowerModelsDistribution._create_line
— Function._create_line(bus1, bus2, name; kwargs...)
Creates a Dict{String,Any} containing all of the properties for a Line. See OpenDSS documentation for valid fields and ways to specify the different properties.
PowerModelsDistribution._create_linecode
— Function._create_linecode(name; kwargs...)
Creates a Dict{String,Any} containing all of the properties of a Linecode. See OpenDSS documentation for valid fields and ways to specify the different properties. DEPRECIATED: Calculation all done inside of createline() due to Rg, Xg. Merge linecode values into line kwargs values BEFORE calling createline(). This is now mainly used for parsing linecode dicts into correct data types.
PowerModelsDistribution._create_load
— Function._create_load(bus1, name; kwargs...)
Creates a Dict{String,Any} containing all of the expected properties for a Load. See OpenDSS documentation for valid fields and ways to specify the different properties.
PowerModelsDistribution._create_pvsystem
— Function._create_pvsystem(bus1, name; kwargs...)
Creates a Dict{String,Any} containing all of the expected properties for a PVSystem. See OpenDSS document https://github.com/tshort/OpenDSS/blob/master/Doc/OpenDSS%20PVSystem%20Model.doc for valid fields and ways to specify the different properties.
PowerModelsDistribution._create_reactor
— Function._create_reactor(bus1, name, bus2=0; kwargs...)
Creates a Dict{String,Any} containing all of the expected properties for a Reactor. If bus2
is not specified Reactor is treated like a shunt. See OpenDSS documentation for valid fields and ways to specify the different properties.
Creates a virtual branch between the virtual_sourcebus
and sourcebus
with the impedance given by circuit
PowerModelsDistribution._create_storage
— Function._create_storage(bus1, name; kwargs...)
Creates a Dict{String,Any} containing all expected properties for a storage element. See OpenDSS documentation for valid fields and ways to specify the different properties.
PowerModelsDistribution._create_transformer
— Function._create_transformer(name; kwargs...)
Creates a Dict{String,Any} containing all of the expected properties for a Transformer. See OpenDSS documentation for valid fields and ways to specify the different properties.
PowerModelsDistribution._create_vbranch!
— Method.This function adds a new branch to the data model and returns its dictionary. It is virtual in the sense that it does not correspond to a branch in the network, but is part of the decomposition of the transformer.
PowerModelsDistribution._create_vbus!
— Method.This function adds a new bus to the data model and returns its dictionary. It is virtual in the sense that it does not correspond to a bus in the network, but is part of the decomposition of the transformer.
PowerModelsDistribution._create_vsource
— Function._create_vsource(bus1, name, bus2=0; kwargs...)
Creates a Dict{String,Any} containing all of the expected properties for a Voltage Source. If bus2
is not specified, VSource will be treated like a generator. Mostly used as sourcebus
which represents the circuit. See OpenDSS documentation for valid fields and ways to specify the different properties.
function _decompose_transformers!(pmd_data)
Replaces complex transformers with a composition of ideal transformers and branches which model losses. New buses (virtual, no physical meaning) are added.
PowerModelsDistribution._discover_buses
— Method._discover_buses(dss_data)
Discovers all of the buses (not separately defined in OpenDSS), from "lines".
PowerModelsDistribution._dss2pmd_branch!
— Method._dss2pmd_branch!(pmd_data, dss_data, import_all)
Adds PowerModels-style branches to pmd_data
from dss_data
.
PowerModelsDistribution._dss2pmd_bus!
— Function._dss2pmd_bus!(pmd_data, dss_data)
Adds PowerModels-style buses to pmd_data
from dss_data
.
PowerModelsDistribution._dss2pmd_gen!
— Method._dss2pmd_gen!(pmd_data, dss_data, import_all)
Adds PowerModels-style generators to pmd_data
from dss_data
.
PowerModelsDistribution._dss2pmd_load!
— Method._dss2pmd_load!(pmd_data, dss_data, import_all)
Adds PowerModels-style loads to pmd_data
from dss_data
.
_dss2pmd_pvsystem!(pmd_data, dss_data)
Adds PowerModels-style pvsystems to pmd_data
from dss_data
.
_dss2pmd_reactor!(pmd_data, dss_data, import_all)
Adds PowerModels-style branch components based on DSS reactors to pmd_data
from dss_data
PowerModelsDistribution._dss2pmd_shunt!
— Method._dss2pmd_shunt!(pmd_data, dss_data, import_all)
Adds PowerModels-style shunts to pmd_data
from dss_data
.
_dss2pmd_storage!(pmd_data, dss_data, import_all)
Adds PowerModels-style storage to pmd_data
from dss_data
_dss2pmd_transformer!(pmd_data, dss_data, import_all)
Adds ThreePhasePowerModels-style transformers to pmd_data
from dss_data
.
PowerModelsDistribution._find_ref_buses
— Method._get_conductors_ordered(busname; neutral=true)
Returns an ordered list of defined conductors. If ground=false, will omit any 0
PowerModelsDistribution._get_dtypes
— Method.Returns a Dict{String,Type} for the desired component comp
, giving all of the expected data types
PowerModelsDistribution._get_linecode
— Method.returns the linecode with name id
PowerModelsDistribution._get_prop_name
— Method._get_prop_name(ctype)
Returns the property names in order for a given component type ctype
.
PowerModelsDistribution._isa_array
— Method.checks if data
is an opendss-style array string
PowerModelsDistribution._isa_conn
— Method.checks is a string is a connection by checking the values
PowerModelsDistribution._isa_matrix
— Method.checks if data
is an opendss-style matrix string
PowerModelsDistribution._isa_rpn
— Method.detects if expr
is Reverse Polish Notation expression
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.
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.
PowerModelsDistribution._make_mpv!
— Method.collects several fromkeys in an array and sets it to the tokey, removes from_keys
PowerModelsDistribution._mat2ltrivec!
— Method.PowerModelsDistribution._mat2utrivec!
— Method.PowerModelsDistribution._merge_dss!
— Method._merge_dss!(dss_prime, dss_to_add)
Merges two (partially) parsed OpenDSS files to the same dictionary dss_prime
. Used in cases where files are referenced via the "compile" or "redirect" OpenDSS commands inside the originating file.
PowerModelsDistribution._ml2pmd_branch!
— Method.convert raw branch data into arrays
PowerModelsDistribution._ml2pmd_bus!
— Method.convert raw bus data into arrays
PowerModelsDistribution._ml2pmd_gen!
— Method.convert raw generator data into arrays
PowerModelsDistribution._ml2pmd_load!
— Method.convert raw load data into arrays
PowerModelsDistribution._ml2pmd_shunt!
— Method.convert raw shunt data into arrays
PowerModelsDistribution._parse_array
— Function.parse matrices according to active nodes
PowerModelsDistribution._parse_array
— Method._parse_array(dtype, data)
Parses a OpenDSS style array string data
into a one dimensional array of type dtype
. Array strings are capped by either brackets, single quotes, or double quotes, and elements are separated by spaces.
PowerModelsDistribution._parse_buscoords
— Method._parse_buscoords(file)
Parses a Bus Coordinate file
, in either "dat" or "csv" formats, where in "dat", columns are separated by spaces, and in "csv" by commas. File expected to contain "bus,x,y" on each line.
PowerModelsDistribution._parse_busname
— Method._parse_busname(busname)
Parses busnames as defined in OpenDSS, e.g. "primary.1.2.3.0".
PowerModelsDistribution._parse_component
— Function._parse_component(component, properies, compDict=Dict{String,Any}())
Parses a component
with properties
into a compDict
. If compDict
is not defined, an empty dictionary will be used. Assumes that unnamed properties are given in order, but named properties can be given anywhere.
PowerModelsDistribution._parse_conn
— Method.parses connection "conn" specification reducing to wye or delta
Parses a component's OpenDSS source information into the dss_source_id
struct
parses the raw dss values into their expected data types
PowerModelsDistribution._parse_line
— Function._parse_line(elements, curCompDict=Dict{String,Any}())
Parses an already separated line given by elements
(an array) of an OpenDSS file into curCompDict
. If not defined, curCompDict
is an empty dictionary.
PowerModelsDistribution._parse_matrix
— Method._parse_matrix(dtype, data)
Parses a OpenDSS style triangular matrix string data
into a two dimensional array of type dtype
. Matrix strings are capped by either parenthesis or brackets, rows are separated by "|", and columns are separated by spaces.
PowerModelsDistribution._parse_matrix
— Method.parse matrices according to active nodes
_parse_properties(properties)
Parses a string of properties
of a component type, character by character into an array with each element containing (if present) the property name, "=", and the property value.
PowerModelsDistribution._parse_rpn
— Function.parses Reverse Polish Notation expr
multi-network opf with storage
This function appends a component to a component dictionary of a pmd data model
PowerModelsDistribution._reorder_matrix
— Method.Reorders a matrix
based on the order that phases are listed in on the from- (pof
) and to-sides (pot
)
PowerModelsDistribution._replace_nan
— Method.Replaces NaN values with zeros
This function removes zero impedance branches. Only for transformer loss model! Branches with zero impedances are deleted, and one of the buses it connects. For now, the implementation should only be used on the loss model of transformers. When deleting buses, references at shunts, loads... should be updated accordingly. In the current implementation, that is only done for shunts. The other elements, such as loads, do not appear in the transformer loss model.
PowerModelsDistribution._roll
— Method.rolls a 1d array left or right by idx
PowerModelsDistribution._run_mn_mc_opf
— Method.multi-network opf with storage
PowerModelsDistribution._run_mn_mc_opf
— Method.multi-network opf with storage
PowerModelsDistribution._sc2br_impedance
— Method.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.
PowerModelsDistribution._set_default
— Method.checks if the given dict has a value, if not, sets a default value
PowerModelsDistribution._sqr
— Method.Squares x
, for parsing Reverse Polish Notation
PowerModelsDistribution._strip_comments
— Method.Strips comments, defined by "!" from the ends of lines
PowerModelsDistribution._strip_lines
— Method.strips lines that are either commented (block or single) or empty
PowerModelsDistribution._to_sym_keys
— Method.converts Dict{String,Any} to Dict{Symbol,Any} for passing as kwargs
Translates legacy versions into current version format
PowerModelsDistribution._vec2ltri!
— Method.PowerModelsDistribution._vec2utri!
— Method.https://stackoverflow.com/questions/39039553/lower-triangular-matrix-in-julia
PowerModelsDistribution._where_is_comp
— Method._where_is_comp(data, comp_id)
Finds existing component of id comp_id
in array of data
and returns index. Assumes all components in data
are unique.
PowerModelsDistribution._wrap_to_180
— Method.wraps angles in degrees to 180
PowerModelsDistribution._wrap_to_pi
— Method.wraps angles in radians to pi