-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REF: Update to PowerModels v0.12 conventions (#149)
* UPD: PowerModels v0.11 (#141) * UPD: PowerModels v0.11 Compatibilty * REF: rename internal functions * UPD: PMs version req in docs * ADD: export.jl Adds explicit exports * PowerModels v0.12 update (#142) * UPD: function names * UPD: LOGGER to internal global * UPD: function names Updated constraint names to be more consistent with PowerModels PMs to _PMs const constraint_tp_voltage -> constraint_tp_model_voltage constraint_kcl_... -> constraint_power_balance_... constraint_tp_branch_current -> constraint_tp_model_current constraint_ohms_tp_yt_... -> constraint_tp_ohms_yt_... constraint_voltage_magnitude_difference -> constraint_tp_voltage_magnitude_difference constraint_flow_losses -> constraint_tp_flow_losses add_... -> add_...! * UPD: cm -> ccm * REM: unused function commented out constraint_tp_flow_losses function is duplicate and old one no longer used? * ADD: auto export * UPD: changelog * UPD: manifest for PowerModels#master * UPD: PMs version in Docs * FIX: update function names Updates function names from load models PR (#123) to new names / conventions * UPD: add_arcs_trans! Rename `add_arcs_trans!` -> `ref_add_arcs_trans!` Moves `ref_add_arcs_trans!` to `ref_extensions` in build model step Removes explicit exports (handled by `src/core/export.jl` automatically) Closes #144 * UPD: calc_tp_voltage_product_bounds renames calc_tp_voltage_product_bounds -> _calc_tp_voltage_product_bounds to be consistent with internal function naming conventions * UPD: Function names and Docs updates Documentation updates: - all functions have docstrings (empty incl.) - enforces two lines between function definitions - single line docstrings are always wrapped in single double quotes, instead of triple double quotes Refactors: - Moves `_wrap_to_180`, `_wrap_to_pi` and `_roll` to `core/data.jl` Function renames: - roll -> _roll - sqr -> _sqr - double_operators -> _double_operators - single_operators -> _single_operators - parse_conn -> _parse_conn - isa_conn -> _isa_conn - get_prop_name -> _get_prop_name - parse_matrix -> _parse_matrix - parse_array -> _parse_array - parse_rpn -> _parse_rpn - parse_buscoords -> _parse_buscoords - parse_element_with_dtype -> _parse_element_with_dtype - parse_busname -> _parse_busname - get_conductors_ordered -> _get_conductors_orders - to_sym_keys -> _to_sym_keys - to_meters -> _convert_to_meters - parse_matlab_string -> _parse_matlab_string - ml2pm_bus -> ml2tppm_bus! - ml2pm_load -> ml2tppm_load! - ml2pm_shunt -> ml2tppm_shunt! - ml2pm_gen -> ml2tppm_gen! - ml2pm_branch -> ml2tppm_branch! - dss2tppm_bus! -> _dss2tppm_bus! - dss2tppm_load! -> _dss2tppm_load! - dss2tppm_shunt! -> _dss2tppm_shunt! - dss2tppm_gen! -> _dss2tppm_gen! - dss2tppm_branch! -> _dss2tppm_branch! - dss2tppm_transformer! -> _dss2tppm_transformer! - dss2tppm_reactor! -> _dss2tppm_reactor! - dss2tppm_pvsystem! -> _dss2tppm_pvsystem - dss2tppm_storage! -> _dss2tppm_storage! - correct_duplicate_components -> _correct_duplicate_components - get_pbs_solution -> solution_pbs! - add_bus_slack_setpoint -> add_setpoint_bus_slack! - get_solution_tp -> solution_tp! Fixes: - some run_tp_... functions pointed to the wrong post_tp_... function, fixed - added some run_tp_... functions to parse files (storage) - simplified run_tp_... functions that parse files * UPD: voltage balance constraints function updates - fix PMs function names - PMs -> _PMs - move add_arcs_trans! -> ref_extensions * UPD: v0.5 * REF: move solution functions moves solution related functions to core/solution.jl * FIX: broken function names * REF: Move types to core/types.jl * UPD: dss_structs names Update names to follow pep8 naming conventions (not a struct, don't use camelcase
- Loading branch information
1 parent
846c398
commit 149a1ff
Showing
57 changed files
with
2,686 additions
and
2,677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name = "PowerModelsDistribution" | |
uuid = "d7431456-977f-11e9-2de3-97ff7677985e" | ||
authors = ["David M Fobes <[email protected]>", "Carleton Coffrin"] | ||
repo = "https://github.com/lanl-ansi/PowerModelsDistribution.jl.git" | ||
version = "0.4.0" | ||
version = "0.5.0" | ||
|
||
[deps] | ||
InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0" | ||
|
@@ -20,7 +20,7 @@ JuMP = "^0.19.2" | |
JSON = ">= 0.18" | ||
Juniper = ">= 0.4" | ||
Memento = ">= 0.8, < 0.13" | ||
PowerModels = "^0.10" | ||
PowerModels = "^0.12" | ||
SCS = ">= 0.4" | ||
julia = "^1" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,60 @@ | ||
module PowerModelsDistribution | ||
|
||
import JuMP | ||
import PowerModels | ||
import InfrastructureModels | ||
import Memento | ||
|
||
import LinearAlgebra | ||
|
||
const PMs = PowerModels | ||
|
||
function __init__() | ||
global LOGGER = Memento.getlogger(PowerModels) | ||
end | ||
|
||
include("core/ref.jl") | ||
include("core/multiconductor.jl") | ||
include("core/variable.jl") | ||
include("core/constraint.jl") | ||
include("core/objective.jl") | ||
include("core/solution.jl") | ||
|
||
include("form/acp.jl") | ||
include("form/acr.jl") | ||
include("form/apo.jl") | ||
include("form/dcp.jl") | ||
include("form/bf.jl") | ||
include("form/bf_mx.jl") | ||
include("form/bf_mx_lin.jl") | ||
include("form/bf_mx_soc.jl") | ||
include("form/bf_mx_sdp.jl") | ||
include("form/shared.jl") | ||
include("form/wr.jl") | ||
|
||
include("core/constraint_template.jl") | ||
include("core/relaxation_scheme.jl") | ||
|
||
include("io/matlab.jl") | ||
include("io/common.jl") | ||
include("io/dss_parse.jl") | ||
include("io/dss_structs.jl") | ||
include("io/opendss.jl") | ||
|
||
include("prob/tp_opf.jl") | ||
include("prob/tp_opf_lm.jl") | ||
include("prob/tp_opf_oltc.jl") | ||
include("prob/tp_opf_bctr.jl") | ||
include("prob/tp_opf_bf.jl") | ||
include("prob/tp_ots.jl") | ||
include("prob/tp_pf.jl") | ||
include("prob/tp_pf_lm.jl") | ||
include("prob/tp_pf_bf.jl") | ||
include("prob/tp_debug.jl") | ||
include("prob/tp_test.jl") | ||
import JuMP | ||
import PowerModels | ||
import InfrastructureModels | ||
import Memento | ||
|
||
import LinearAlgebra | ||
|
||
const _PMs = PowerModels | ||
|
||
function __init__() | ||
global _LOGGER = Memento.getlogger(PowerModels) | ||
end | ||
|
||
include("core/types.jl") | ||
include("core/data.jl") | ||
include("core/ref.jl") | ||
include("core/multiconductor.jl") | ||
include("core/variable.jl") | ||
include("core/constraint.jl") | ||
include("core/objective.jl") | ||
include("core/solution.jl") | ||
|
||
include("form/acp.jl") | ||
include("form/acr.jl") | ||
include("form/apo.jl") | ||
include("form/dcp.jl") | ||
include("form/bf.jl") | ||
include("form/bf_mx.jl") | ||
include("form/bf_mx_lin.jl") | ||
include("form/bf_mx_soc.jl") | ||
include("form/bf_mx_sdp.jl") | ||
include("form/shared.jl") | ||
include("form/wr.jl") | ||
|
||
include("core/constraint_template.jl") | ||
include("core/relaxation_scheme.jl") | ||
|
||
include("io/matlab.jl") | ||
include("io/common.jl") | ||
include("io/dss_parse.jl") | ||
include("io/dss_structs.jl") | ||
include("io/opendss.jl") | ||
|
||
include("prob/tp_opf.jl") | ||
include("prob/tp_opf_lm.jl") | ||
include("prob/tp_opf_oltc.jl") | ||
include("prob/tp_opf_bctr.jl") | ||
include("prob/tp_opf_bf.jl") | ||
include("prob/tp_ots.jl") | ||
include("prob/tp_pf.jl") | ||
include("prob/tp_pf_lm.jl") | ||
include("prob/tp_pf_bf.jl") | ||
include("prob/tp_debug.jl") | ||
include("prob/tp_test.jl") | ||
|
||
include("core/export.jl") | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
|
||
function constraint_tp_branch_current(pm::PMs.GenericPowerModel, i::Int; kwargs...) | ||
for c in PMs.conductor_ids(pm) | ||
PMs.constraint_branch_current(pm, i, cnd=c; kwargs...) | ||
"" | ||
function constraint_tp_model_current(pm::_PMs.GenericPowerModel; kwargs...) | ||
for c in _PMs.conductor_ids(pm) | ||
_PMs.constraint_model_current(pm; cnd=c, kwargs...) | ||
end | ||
end | ||
|
||
|
||
function constraint_tp_theta_ref(pm::PMs.GenericPowerModel, i::Int; nw::Int=pm.cnw) | ||
for cnd in PMs.conductor_ids(pm) | ||
"" | ||
function constraint_tp_theta_ref(pm::_PMs.GenericPowerModel, i::Int; nw::Int=pm.cnw) | ||
for cnd in _PMs.conductor_ids(pm) | ||
constraint_tp_theta_ref(pm, nw, cnd, i) | ||
end | ||
end | ||
|
||
|
||
function constraint_tp_storage_loss(pm::PMs.GenericPowerModel, n::Int, i, bus, r, x, standby_loss) | ||
conductors = PMs.conductor_ids(pm) | ||
vm = [PMs.var(pm, n, c, :vm, bus) for c in conductors] | ||
ps = [PMs.var(pm, n, c, :ps, i) for c in conductors] | ||
qs = [PMs.var(pm, n, c, :qs, i) for c in conductors] | ||
sc = PMs.var(pm, n, :sc, i) | ||
sd = PMs.var(pm, n, :sd, i) | ||
"" | ||
function constraint_tp_storage_loss(pm::_PMs.GenericPowerModel, n::Int, i, bus, r, x, standby_loss) | ||
conductors = _PMs.conductor_ids(pm) | ||
vm = [_PMs.var(pm, n, c, :vm, bus) for c in conductors] | ||
ps = [_PMs.var(pm, n, c, :ps, i) for c in conductors] | ||
qs = [_PMs.var(pm, n, c, :qs, i) for c in conductors] | ||
sc = _PMs.var(pm, n, :sc, i) | ||
sd = _PMs.var(pm, n, :sd, i) | ||
|
||
JuMP.@NLconstraint(pm.model, sum(ps[c] for c in conductors) + (sd - sc) == standby_loss + sum( r[c]*(ps[c]^2 + qs[c]^2)/vm[c]^2 for c in conductors)) | ||
end |
Oops, something went wrong.
149a1ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register()
149a1ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/1698
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via: