Skip to content

Commit

Permalink
Update PowerModels, PowerModelsRestoration (#30)
Browse files Browse the repository at this point in the history
Update test for MOPS restoration budget

* Bump version to 0.5.1
  • Loading branch information
noahrhodes authored Apr 1, 2024
1 parent 641f6b0 commit ab06eb9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PowerModelsWildfire"
uuid = "01a8e460-0890-11ea-3f19-8b8faecc21cc"
authors = ["Noah Rhodes <noahx23@gmail.com>"]
version = "0.5.0"
version = "0.5.1"

[deps]
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
Expand All @@ -20,8 +20,8 @@ Ipopt = "~0.8, ~0.9, ~1"
JuMP = "~0.22, ~0.23, ~1"
Juniper = "~0.8, ~0.9"
Memento = "~1.0, ~1.1, ~1.2, ~1.3, ~1.4"
PowerModels = "~0.19.2,~0.19.3,~0.19.4,~0.19.5,~0.19.6,~0.19.7,~0.19.8,~0.19.9"
PowerModelsRestoration = "~0.6, ~0.7"
PowerModels = "~0.19, ~0.21"
PowerModelsRestoration = "~0.6, ~0.7, ~0.8, ~0.9"
julia = "^1.0"

[extras]
Expand Down
24 changes: 13 additions & 11 deletions test/mops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,12 @@
result = PowerModelsWildfire.run_mopsar(case_mn, PowerModels.DCPPowerModel, milp_solver);
@test result["termination_status"] == OPTIMAL

@test isapprox(result["objective"],0.0939; atol=1e-4)
@test isapprox(result["objective"],0.0947; atol=1e-4)

PowerModels.update_data!(case_mn,result["solution"])
@test isapprox(calc_total_risk(case_mn), 855.0, atol=1e-4)
@test isapprox(calc_load(case_mn),26.91, atol=1e-2)
@test isapprox(calc_total_risk(case_mn), 725.0, atol=1e-4)
@test isapprox(calc_load(case_mn),21.0, atol=1e-2)


# All devices active in period 1
@test sum(branch["br_status"] for (id,branch) in case_mn["nw"]["1"]["branch"]) == 5
Expand All @@ -178,18 +179,19 @@
@test sum(branch["br_status"] for (id,branch) in case_mn["nw"]["2"]["branch"]) <= 5
@test sum(gen["gen_status"] for (id,gen) in case_mn["nw"]["2"]["gen"]) <= 5
@test sum(bus["status"] for (id,bus) in case_mn["nw"]["2"]["bus"]) <= 5
@test sum(branch["br_status"] for (id,branch) in case_mn["nw"]["2"]["branch"]) +
sum(gen["gen_status"] for (id,gen) in case_mn["nw"]["2"]["gen"]) +
sum(bus["status"] for (id,bus) in case_mn["nw"]["2"]["bus"]) == 9


# 4 devices repaired in period 3
@test sum(branch["br_status"] for (id,branch) in case_mn["nw"]["3"]["branch"]) +
sum(gen["gen_status"] for (id,gen) in case_mn["nw"]["3"]["gen"]) +
sum(bus["status"] for (id,bus) in case_mn["nw"]["3"]["bus"]) == 13


devices_active_in_2 = sum(branch["br_status"] for (id,branch) in case_mn["nw"]["2"]["branch"]) +
sum(gen["gen_status"] for (id,gen) in case_mn["nw"]["2"]["gen"]) +
sum(bus["status"] for (id,bus) in case_mn["nw"]["2"]["bus"])
devices_active_in_3 = sum(branch["br_status"] for (id,branch) in case_mn["nw"]["3"]["branch"]) +
sum(gen["gen_status"] for (id,gen) in case_mn["nw"]["3"]["gen"]) +
sum(bus["status"] for (id,bus) in case_mn["nw"]["3"]["bus"])

@test isapprox(devices_active_in_3 - devices_active_in_2, 4, atol=1e-4)
end

@testset "load weights" begin
case = PowerModels.parse_file("./networks/case5_risk_mops.m")
case_mn = PowerModels.replicate(case, 3)
Expand Down

0 comments on commit ab06eb9

Please sign in to comment.