Modeling Components

PowerModelsDistribution.jl Library

source

Abstract form for linear unbalanced power flow models

source
source

Structure representing OpenDSS dss_source_id giving the type of the component dss_type, its name dss_name, and the active phases active_phases

source

LinDist3Flow per Sankur et al 2016, using vector variables for power, voltage and current in scalar form

source

default Lin3Distflow constructor for scalar form

source

LinDist3Flow per Sankur et al 2016, using vector variables for power, voltage and current

source

default LP unbalanced DistFlow constructor

source

Simplified BFM per Gan and Low 2014, PSCC, using matrix variables for power, voltage and current

source

default LP unbalanced DistFlow constructor

source

SDP BFM with KCL as matrix equation, Geth 2020 (under review)

source

default SDP unbalanced DistFlow with matrix KCL constructor

source

SDP BFM per Gan and Low 2014, PSCC

source

default SDP unbalanced DistFlow constructor

source

SOC relaxation of SDPUBFModel per Kim, Kojima, & Yamashita 2003, cast as a SOC

source

default SOC unbalanced DistFlow constructor

source

SOC relaxation of SDPUBFModel per Kim, Kojima, & Yamashita 2003, cast as an QCP

source

default SOC unbalanced DistFlow constructor

source
source
source
source
source
source
source
source
source
source
source
source
source
source

add bus statuses for load shed problem

source
source

adds voltage balance indicators; should only be called after addsetpointbus_voltage!

source

add generator statuses for load shed problem

source

add load setpoints for load shed problem

source

add shunt setpoints for load shed problem

source

add storage statuses for load shed problem

source

Calculates the tap scale factor for the non-dimensionalized equations.

source

For rectangular coordinates of a complex matrix M=Mre+im*Mim, this function applies constraints equivalent to requiring that M itself is PSD.

source

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.

source
source
source
source
source
source
source
source

generator active power setpoint constraint, delegate to PowerModels

source

bus voltage on/off constraint for load shed problem

source

on/off bus voltage constraint for DCP formulation, nothing to do

source

on/off constraint for bus voltages

source

on/off bus voltage constraint for relaxed forms

source

Defines branch flow model power flow loss equations

source

Defines branch flow model power flow equations

source

Defines branch flow model power flow equations

source

Defines branch flow model power flow equations

source
source

Defines branch flow model power flow equations

source

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.

source

Only KCLModels need to further constrain the generator variables.

source

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.

source

Creates the constraints modelling the (relaxed) voltage-dependent loads for the matrix KCL formulation.

source

Creates the constraints modelling the (relaxed) voltage-dependent loads.

source

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

source

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

source

exponential model in acp voltage coordinates

source

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

source

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

source

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))

source

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))

source

Defines relationship between branch (series) power flow, branch (series) current and node voltage magnitude

source

model current constraints

source

Defines relationship between branch (series) power flow, branch (series) current and node voltage magnitude

source

Defines relationship between branch (series) power flow, branch (series) current and node voltage magnitude

source
source

Defines relationship between branch (series) power flow, branch (series) current and node voltage magnitude

source

nothing to do, these models do not have complex voltage constraints

source

delegate back to PowerModels by default

source
source
source

Defines branch flow model power flow equations

source

Defines voltage drop over a branch, linking from and to side voltage

source

Defines voltage drop over a branch, linking from and to side voltage

source
source

Defines voltage drop over a branch, linking from and to side voltage

source

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)
            )
source

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))
source

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])
source

nothing to do, no voltage angle variables

source

ohms constraint for branches on the from-side

source

delegate back to PowerModels

source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

source

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]))
source

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]))
source

nothing to do, this model is symmetric

source

ohms constraint for branches on the to-side

source

delegate back to PowerModels

source

Creates Ohms constraints (yt post fix indicates that Y and T values are in rectangular form)

source

Do nothing, this model is symmetric

source

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.

source
source
source

power balanace constraint with line shunts and transformers, active power only

source

KCL including transformer arcs

source

power balance constraint with line shunts and transformers for relaxed WR forms

source

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'

source

For KCLMXModels, a new power balance constraint is required.

source
source
source
source

KCL including transformer arcs and load variables.

source
source

power balance constraint with line shunts and transformers for load shed problem, DCP formulation

source

KCL for load shed problem with transformers

source

KCL for load shed problem with transformers (AbstractWForms)

source
source
source
source
source

storage loss constraints, delegate to PowerModels

source

storage thermal limit constraints, delegate to PowerModels per conductor

source

branch thermal constraints from, delegate to PowerModels per conductor

source

branch thermal constraints to, delegate to PowerModels per conductor

source

balanced three-phase phasor

source

Creates phase angle constraints at reference buses

source

nothing to do, no voltage angle variables

source

reference angle constraints

source
source
source

Creates phase angle constraints at reference buses

source

do nothing, no way to represent this in these variables

source

nothing to do, this model is symmetric

source

nothing to do, this model is symmetric

source

Transformer constraints, considering winding type, conductor order, polarity and tap settings.

source

Links the power flowing into both windings of a fixed tap transformer

source

Links the voltage at both windings of a fixed tap transformer

source
source

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

source

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

source

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

source

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

source

This is duplicated at PMD level to correctly handle the indexing of the shunts.

source

By default, delegate back to PM; only certain formulations differ between PMD and PMs.

source

This is duplicated at PMD level to correctly handle the indexing of the shunts.

source

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} }

source

Defines voltage drop over a branch, linking from and to side voltage magnitude

source

on/off bus voltage magnitude constraint

source

on/off voltage magnitude constraint

source

voltage magnitude setpoint constraint, delegate to PowerModels per conductor

source

on/off bus voltage magnitude squared constraint for relaxed formulations

source

on/off voltage magnitude squared constraint for relaxed formulations

source

This is duplicated at PMD level to correctly handle the indexing of the shunts.

source

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

source
source

Counts number of nodes in network

source

Counts number of nodes in network

source
find_bus(busname, pmd_data)

Finds the index number of the bus in existing data from the given busname.

source
find_component(pmd_data, name, compType)

Returns the component of compType with name from data of type Dict{String,Array}.

source

Corrects the shunts from vectors to matrices after the call to PMs.

source

Converts a Matlab dict into a PowerModelsDistribution dict

source

maximum loadability objective (continuous load shed) with storage

source

minimum load delta objective (continuous load shed) with storage

source

a quadratic penalty for bus power slack variables

source
source
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.

source
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.

source
parse_file(io)

Parses the IOStream of a file into a Three-Phase PowerModels data structure.

source
source
source
source

Parses a Dict resulting from the parsing of a DSS file into a PowerModels usable format

source

Parses a DSS file into a PowerModels usable format

source
parse_options(options)

Parses options defined with the set command in OpenDSS.

source

Load shedding problem including storage

source

Load shedding problem for Branch Flow model

source

Standard unit commitment (!relaxed) load shedding problem

source
source
source
source
source

This problem specification includes advanced load models, including constant power, constant current and constabt impedance delta-connected and wye-connected

source
source

OPF problem with slack power at every bus

source
source
source
source

PF problem with slack power at every bus

source

Adds arcs for PMD transformers; for dclines and branches this is done in PMs

source

For debugging / exploration: real-valued SDP to SDP relaxation based on PSDness of principal minors, default is 3x3 SDP relaxation

source

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} }

source

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}
}
source

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}
}
source

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} }

source

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}
}
source

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}
}
source
source
source
source
source
source
source
source

Run load shedding problem with storage

source
source

Run Branch Flow Model Load Shedding Problem

source
source

Run unit commitment load shedding problem (!relaxed)

source
source
source
source
source
source
source
source
source
source
source
source
source
source

OPF problem with slack power at every bus

source

OPF problem with slack power at every bus

source
source
source
source
source
source
source

PF problem with slack power at every bus

source

PF problem with slack power at every bus

source
source
source

solution builder for minimum load delta problem (load shed)

source

solution builder for branch-flow minimum load delta problem (load shed)

source
source

Create variables for active storage injection

source
source
source

nothing to do, variables not used in linearised branch flow model

source
source
source
source

branch flow variables, delegated back to PowerModels

source
source
source

generates variables for both active and reactive slack at each bus

source

Create voltage variables for branch flow model

source
source
source

create variables for generators, delegate to PowerModels

source

For the matrix KCL formulation, the generator needs an explicit current and power variable.

source

For the matrix KCL formulation, the generator needs an explicit current variable.

source

create on/off variables for generators, delegate to PowerModels

source

For the matrix KCL formulation, the generator needs an explicit power variable.

source

Create variables for bus status

source

Create variables for demand status

source

Create variables for generator status

source

Create variables for shunt status

source

Create variables for storage status

source

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.

source

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).

source

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.

source

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.

source

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]

source

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.

source

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.

source

Create tap variables.

source

Create variables for active and reactive storage injection

source

Create variables for reactive storage injection

source
source

variables for modeling storage units, includes grid injection and internal variables

source

Create variables for the active power flowing into all transformer windings.

source

Create variables for the active power flowing into all transformer windings

source

Creates variables for both active and reactive power flow at each transformer.

source

do nothing, no reactive power in this model

source

Create variables for the reactive power flowing into all transformer windings.

source
source
source
source

voltage variables, delegated back to PowerModels

source

voltage variables, relaxed form

source
source

on/off voltage magnitude variable

source

variable: w[i] >= 0 for i in buses

source

voltage variable magnitude squared (relaxed form)

source
source
source
source

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).

source

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).

source

Returns a pair of symmetric and skew-symmetric matrix variables.

source

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

source

Same as variablemxreal, but adds skew-symmetry structure.

source

Same as variablemxreal, but adds symmetry structure

source

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.

source

list of constructor functions for easy access

source

properties that should be excluded from being overwritten during the application of like

source

do nothing

source
_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.

source
_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.

source

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.

source
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.

source

Rescales the parameters of a branch to reflect a change in voltage base

source

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.

source

Rescales the parameters of a shunt to reflect a change in voltage base

source
_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.

source

applies like to component

source
source
_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.

source

Combines transformers with 'bank' keyword into a single transformer

source

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

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

Returns a valid series current magnitude bound for a branch.

source

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

Returns a current magnitude bound for the generators.

source

Returns magnitude bounds for the current going through the load.

source

Returns a magnitude bound for the current going through the load.

source

Calculates lower and upper bounds for the loads themselves (not the power withdrawn at the bus).

source

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
source
source

Returns a Bool, indicating whether the convex hull of the voltage-dependent relationship needs a cone inclusion constraint.

source
_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).

source
_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.

source
_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.

source
_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.

source
_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.

source
_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.

source
_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.

source
_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.

source

Creates a virtual branch between the virtual_sourcebus and sourcebus with the impedance given by circuit

source
_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.

source
_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.

source

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.

source

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.

source
_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.

source
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.

source
_discover_buses(dss_data)

Discovers all of the buses (not separately defined in OpenDSS), from "lines".

source
_dss2pmd_branch!(pmd_data, dss_data, import_all)

Adds PowerModels-style branches to pmd_data from dss_data.

source
_dss2pmd_bus!(pmd_data, dss_data)

Adds PowerModels-style buses to pmd_data from dss_data.

source
_dss2pmd_gen!(pmd_data, dss_data, import_all)

Adds PowerModels-style generators to pmd_data from dss_data.

source
_dss2pmd_load!(pmd_data, dss_data, import_all)

Adds PowerModels-style loads to pmd_data from dss_data.

source
_dss2pmd_pvsystem!(pmd_data, dss_data)

Adds PowerModels-style pvsystems to pmd_data from dss_data.

source
_dss2pmd_reactor!(pmd_data, dss_data, import_all)

Adds PowerModels-style branch components based on DSS reactors to pmd_data from dss_data

source
_dss2pmd_shunt!(pmd_data, dss_data, import_all)

Adds PowerModels-style shunts to pmd_data from dss_data.

source
_dss2pmd_storage!(pmd_data, dss_data, import_all)

Adds PowerModels-style storage to pmd_data from dss_data

source
_dss2pmd_transformer!(pmd_data, dss_data, import_all)

Adds ThreePhasePowerModels-style transformers to pmd_data from dss_data.

source
source
_get_conductors_ordered(busname; neutral=true)

Returns an ordered list of defined conductors. If ground=false, will omit any 0

source

Returns a Dict{String,Type} for the desired component comp, giving all of the expected data types

source

returns the linecode with name id

source
_get_prop_name(ctype)

Returns the property names in order for a given component type ctype.

source

checks if data is an opendss-style array string

source

checks is a string is a connection by checking the values

source

checks if data is an opendss-style matrix string

source

detects if expr is Reverse Polish Notation expression

source

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
source
source

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

collects several fromkeys in an array and sets it to the tokey, removes from_keys

source
source
source
_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.

source

convert raw branch data into arrays

source

convert raw bus data into arrays

source

convert raw generator data into arrays

source

convert raw load data into arrays

source

convert raw shunt data into arrays

source

parse matrices according to active nodes

source
_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.

source
_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.

source
_parse_busname(busname)

Parses busnames as defined in OpenDSS, e.g. "primary.1.2.3.0".

source
_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.

source

parses connection "conn" specification reducing to wye or delta

source

Parses a component's OpenDSS source information into the dss_source_id struct

source

parses the raw dss values into their expected data types

source
_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.

source
source
_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.

source

parse matrices according to active nodes

source
_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.

source

parses Reverse Polish Notation expr

source

multi-network opf with storage

source

This function appends a component to a component dictionary of a pmd data model

source

Reorders a matrix based on the order that phases are listed in on the from- (pof) and to-sides (pot)

source

Replaces NaN values with zeros

source

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.

source

rolls a 1d array left or right by idx

source

multi-network opf with storage

source

multi-network opf with storage

source

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

checks if the given dict has a value, if not, sets a default value

source

Squares x, for parsing Reverse Polish Notation

source

Strips comments, defined by "!" from the ends of lines

source

strips lines that are either commented (block or single) or empty

source

converts Dict{String,Any} to Dict{Symbol,Any} for passing as kwargs

source

Translates legacy versions into current version format

source
source

https://stackoverflow.com/questions/39039553/lower-triangular-matrix-in-julia

source
_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.

source

wraps angles in degrees to 180

source

wraps angles in radians to pi

source