From bad4684da87b390104cb47d6b3882bbd9b871fe2 Mon Sep 17 00:00:00 2001 From: carleton Date: Fri, 23 Aug 2019 11:51:00 -0600 Subject: [PATCH 1/6] update docs --- docs/Project.toml | 2 -- docs/src/constraints.md | 2 +- docs/src/model.md | 2 +- docs/src/utilities.md | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index abd342d1d..dfa65cd10 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,4 +1,2 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0" -JuMP = "4076af6c-e467-56ae-b986-b466b2749572" diff --git a/docs/src/constraints.md b/docs/src/constraints.md index 47e142045..3dad8d040 100644 --- a/docs/src/constraints.md +++ b/docs/src/constraints.md @@ -12,7 +12,7 @@ These templates should be defined over `GenericPowerModel` and should not refer ## Voltage Constraints ```@docs -constraint_voltage +constraint_model_voltage constraint_model_voltage_on_off constraint_model_voltage_ne ``` diff --git a/docs/src/model.md b/docs/src/model.md index 79f7569f4..351f03b3d 100644 --- a/docs/src/model.md +++ b/docs/src/model.md @@ -14,5 +14,5 @@ which utilizes the following (internal) functions: ```@docs build_ref -buspair_parameters +buspair_parameters! ``` diff --git a/docs/src/utilities.md b/docs/src/utilities.md index c7b07da06..6f83074e9 100644 --- a/docs/src/utilities.md +++ b/docs/src/utilities.md @@ -7,5 +7,5 @@ This section provides an overview of the some of the utility functions that are To improve the quality of the convex relaxations available in PowerModels and also to obtain tightened bounds on the voltage-magnitude and phase-angle difference variables, an optimization-based bound-tightening algorithm is made available as a function in PowerModels. ```@docs -run_obbt_opf +run_obbt_opf! ``` From 2e56bf1c6abd98cfd9eecf20d63044f66cb52652 Mon Sep 17 00:00:00 2001 From: ccoffrin Date: Mon, 26 Aug 2019 19:15:13 -0600 Subject: [PATCH 2/6] updates for InfrastructureModels v0.3 --- .travis.yml | 7 +------ CHANGELOG.md | 3 ++- Manifest.toml | 9 ++++----- Project.toml | 2 +- src/core/data.jl | 2 +- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index de64c59d2..6349eb149 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,17 +3,12 @@ os: - linux - osx julia: - - 1.0 - 1.1 + - 1.2 - nightly matrix: allow_failures: - julia: nightly -script: - - julia --project -e 'import Pkg; Pkg.build(); Pkg.instantiate()' - - julia --project -e 'import Pkg; Pkg.test(coverage=true);' -after_success: - - julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())' jobs: include: - stage: "Documentation" diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a94883a9..87ec7c07e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ PowerModels.jl Change Log ========================= ### Staged -- nothing +- Update to InfrastructureModels v0.3 +- Dropped CI on Julia v1.0 ### v0.12.4 - Fixed support for data without an explicit switch section diff --git a/Manifest.toml b/Manifest.toml index d4642688c..ef646261c 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -77,9 +77,9 @@ version = "0.10.3" [[InfrastructureModels]] deps = ["JuMP", "Memento"] -git-tree-sha1 = "d380c59122887b4794e72bf92e9cf2a664654f18" +git-tree-sha1 = "59a44201fc4e7641012354d60f0eb14d7968bd7a" uuid = "2030c09a-7f63-5d83-885d-db604e0e9cc0" -version = "0.2.2" +version = "0.3.1" [[InteractiveUtils]] deps = ["Markdown"] @@ -130,10 +130,9 @@ version = "0.12.1" uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[Mocking]] -deps = ["Compat", "Dates"] -git-tree-sha1 = "4bf69aaf823b119b034e091e16b18311aa191663" +git-tree-sha1 = "7f42a32a8cef08f45d43c35663e73bd4e3b35f6d" uuid = "78c3b35d-d492-501b-9361-3d52fe80e533" -version = "0.5.7" +version = "0.6.0" [[NaNMath]] deps = ["Compat"] diff --git a/Project.toml b/Project.toml index 51c3c8ad1..5de8a835c 100644 --- a/Project.toml +++ b/Project.toml @@ -15,7 +15,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [compat] Cbc = ">= 0.4" -InfrastructureModels = "~0.2.1" +InfrastructureModels = "~0.3" Ipopt = ">= 0.4" JSON = ">= 0.18" JuMP = "~0.19.1" diff --git a/src/core/data.jl b/src/core/data.jl index 2eff95e86..e73eee1c7 100644 --- a/src/core/data.jl +++ b/src/core/data.jl @@ -237,7 +237,7 @@ with minimal data replication. """ function replicate(sn_data::Dict{String,<:Any}, count::Int; global_keys::Set{String}=Set{String}()) pm_global_keys = Set(["baseMVA", "per_unit"]) - return InfrastructureModels.replicate(sn_data, count, global_keys=union(global_keys, pm_global_keys)) + return InfrastructureModels.replicate(sn_data, count, union(global_keys, pm_global_keys)) end From 9d3f5e9d148aeebf6c7f69e187b9291d3ce61fa9 Mon Sep 17 00:00:00 2001 From: Carleton Coffrin Date: Mon, 26 Aug 2019 19:50:06 -0600 Subject: [PATCH 3/6] add codecov flag to travis settings --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6349eb149..a998b631b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ julia: matrix: allow_failures: - julia: nightly +codecov: true jobs: include: - stage: "Documentation" From 2cd0c03ec72ecd2ebb8b87f56d3d7448bfe75819 Mon Sep 17 00:00:00 2001 From: ccoffrin Date: Mon, 26 Aug 2019 21:45:47 -0600 Subject: [PATCH 4/6] add support for power balance duals in w-space formulations, see #591 --- CHANGELOG.md | 1 + src/form/shared.jl | 4 ++-- test/output.jl | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87ec7c07e..92180c4d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ PowerModels.jl Change Log ========================= ### Staged +- Fixed power balance duals in w-space formulations (#591) - Update to InfrastructureModels v0.3 - Dropped CI on Julia v1.0 diff --git a/src/form/shared.jl b/src/form/shared.jl index 15e853821..18bee34cf 100644 --- a/src/form/shared.jl +++ b/src/form/shared.jl @@ -64,8 +64,8 @@ function constraint_power_balance_shunt(pm::GenericPowerModel{T}, n::Int, c::Int p_dc = var(pm, n, c, :p_dc) q_dc = var(pm, n, c, :q_dc) - JuMP.@constraint(pm.model, sum(p[a] for a in bus_arcs) + sum(p_dc[a_dc] for a_dc in bus_arcs_dc) == sum(pg[g] for g in bus_gens) - sum(pd for pd in values(bus_pd)) - sum(gs for gs in values(bus_gs))*w) - JuMP.@constraint(pm.model, sum(q[a] for a in bus_arcs) + sum(q_dc[a_dc] for a_dc in bus_arcs_dc) == sum(qg[g] for g in bus_gens) - sum(qd for qd in values(bus_qd)) + sum(bs for bs in values(bus_bs))*w) + con(pm, n, c, :kcl_p)[i] = JuMP.@constraint(pm.model, sum(p[a] for a in bus_arcs) + sum(p_dc[a_dc] for a_dc in bus_arcs_dc) == sum(pg[g] for g in bus_gens) - sum(pd for pd in values(bus_pd)) - sum(gs for gs in values(bus_gs))*w) + con(pm, n, c, :kcl_q)[i] = JuMP.@constraint(pm.model, sum(q[a] for a in bus_arcs) + sum(q_dc[a_dc] for a_dc in bus_arcs_dc) == sum(qg[g] for g in bus_gens) - sum(qd for qd in values(bus_qd)) + sum(bs for bs in values(bus_bs))*w) end diff --git a/test/output.jl b/test/output.jl index 08cbe3dc3..a76b2573a 100644 --- a/test/output.jl +++ b/test/output.jl @@ -116,6 +116,28 @@ end @test isapprox(branch["mu_sm_to"], 0.0; atol = 1e-2) end end + + + result = run_opf("../test/data/matpower/case5.m", SOCWRPowerModel, ipopt_solver, setting = settings) + @testset "5 bus - kcl duals soc qp" begin + for (i, bus) in result["solution"]["bus"] + @test bus["lam_kcl_r"] <= -2900.00 + @test bus["lam_kcl_r"] >= -3100.00 + @test bus["lam_kcl_i"] <= 0.001 + @test bus["lam_kcl_i"] >= -5.000 + end + end + + result = run_opf("../test/data/matpower/case5.m", SOCWRConicPowerModel, scs_solver, setting = settings) + @testset "5 bus - kcl duals soc conic" begin + for (i, bus) in result["solution"]["bus"] + @test bus["lam_kcl_r"] <= -2900.00 + @test bus["lam_kcl_r"] >= -3100.00 + @test bus["lam_kcl_i"] <= 0.001 + @test bus["lam_kcl_i"] >= -5.000 + end + end + end From e59a222a545c84448eb479e69e1314c95f2cd044 Mon Sep 17 00:00:00 2001 From: ccoffrin Date: Tue, 27 Aug 2019 07:59:54 -0600 Subject: [PATCH 5/6] updates for jump v0.20, closes #583 --- CHANGELOG.md | 3 ++- Manifest.toml | 20 +++++++++++++------- Project.toml | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92180c4d1..aede75024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ PowerModels.jl Change Log ========================= ### Staged -- Fixed power balance duals in w-space formulations (#591) - Update to InfrastructureModels v0.3 +- Update to JuMP v0.20 +- Fixed power balance duals in w-space formulations (#591) - Dropped CI on Julia v1.0 ### v0.12.4 diff --git a/Manifest.toml b/Manifest.toml index ef646261c..5e0ee52c8 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -3,6 +3,12 @@ [[Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +[[BenchmarkTools]] +deps = ["JSON", "Printf", "Statistics", "Test"] +git-tree-sha1 = "5d1dd8577643ba9014574cd40d9c028cd5e4b85a" +uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" +version = "0.4.2" + [[BinDeps]] deps = ["Compat", "Libdl", "SHA", "URIParser"] git-tree-sha1 = "12093ca6cdd0ee547c39b1870e0c9c3f154d9ca9" @@ -77,9 +83,9 @@ version = "0.10.3" [[InfrastructureModels]] deps = ["JuMP", "Memento"] -git-tree-sha1 = "59a44201fc4e7641012354d60f0eb14d7968bd7a" +git-tree-sha1 = "4739474cbd631b821dba4253c05150f1d1880d22" uuid = "2030c09a-7f63-5d83-885d-db604e0e9cc0" -version = "0.3.1" +version = "0.3.2" [[InteractiveUtils]] deps = ["Markdown"] @@ -93,9 +99,9 @@ version = "0.21.0" [[JuMP]] deps = ["Calculus", "DataStructures", "ForwardDiff", "LinearAlgebra", "MathOptInterface", "NaNMath", "Random", "SparseArrays", "Statistics"] -git-tree-sha1 = "a37fdb14ee3a04b4df44c20a73da89c57035bdf2" +git-tree-sha1 = "a970a86abc924f2c126cdb4978a5e8923d0e7b22" uuid = "4076af6c-e467-56ae-b986-b466b2749572" -version = "0.19.2" +version = "0.20.0" [[LibGit2]] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" @@ -115,10 +121,10 @@ deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[MathOptInterface]] -deps = ["Compat", "Unicode"] -git-tree-sha1 = "5d3de69c9220610d0336ab45d3eb8b6ac7a7c807" +deps = ["BenchmarkTools", "LinearAlgebra", "OrderedCollections", "SparseArrays", "Test", "Unicode"] +git-tree-sha1 = "5e6e36e2f01efbc62b3f8bf68c8cf82035e2c6a6" uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" -version = "0.8.4" +version = "0.9.1" [[Memento]] deps = ["Dates", "Distributed", "JSON", "Serialization", "Sockets", "Syslogs", "Test", "TimeZones", "UUIDs"] diff --git a/Project.toml b/Project.toml index 5de8a835c..a382e09c1 100644 --- a/Project.toml +++ b/Project.toml @@ -18,9 +18,9 @@ Cbc = ">= 0.4" InfrastructureModels = "~0.3" Ipopt = ">= 0.4" JSON = ">= 0.18" -JuMP = "~0.19.1" +JuMP = "~0.19.1, ~0.20" Juniper = ">= 0.4" -MathOptInterface = "~0.8" +MathOptInterface = "~0.8, ~0.9" Memento = "~0.10, ~0.11, ~0.12" SCS = ">= 0.4" julia = "^1" From 27353b6d25a9e19d58091ec85cb36e27fce2bb31 Mon Sep 17 00:00:00 2001 From: carleton Date: Wed, 28 Aug 2019 10:10:37 -0600 Subject: [PATCH 6/6] prep for next release --- CHANGELOG.md | 6 ++++-- Project.toml | 2 +- src/io/matpower.jl | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aede75024..63b89b992 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,10 @@ PowerModels.jl Change Log ========================= ### Staged -- Update to InfrastructureModels v0.3 -- Update to JuMP v0.20 +- nothing + +### v0.12.5 +- Update to InfrastructureModels v0.3 and JuMP v0.20 - Fixed power balance duals in w-space formulations (#591) - Dropped CI on Julia v1.0 diff --git a/Project.toml b/Project.toml index a382e09c1..7c16f6c39 100644 --- a/Project.toml +++ b/Project.toml @@ -2,7 +2,7 @@ name = "PowerModels" uuid = "c36e90e8-916a-50a6-bd94-075b64ef4655" authors = ["Carleton Coffrin"] repo = "https://github.com/lanl-ansi/PowerModels.jl" -version = "0.12.4" +version = "0.12.5" [deps] InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0" diff --git a/src/io/matpower.jl b/src/io/matpower.jl index 8503aaa0e..18c0d89f1 100644 --- a/src/io/matpower.jl +++ b/src/io/matpower.jl @@ -382,7 +382,7 @@ function _matpower_to_powermodels!(mp_data::Dict{String,<:Any}) # use once available InfrastructureModels.arrays_to_dicts!(pm_data) - for optional in ["dcline", "load", "shunt", "storage"] + for optional in ["dcline", "load", "shunt", "storage", "switch"] if length(pm_data[optional]) == 0 pm_data[optional] = Dict{String,Any}() end