Skip to content

Commit

Permalink
update case4acdc
Browse files Browse the repository at this point in the history
- costs are updated to get same result with different machines
  • Loading branch information
jay-dave committed Mar 20, 2021
1 parent d347cae commit 11573fb
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 34 deletions.
14 changes: 7 additions & 7 deletions test/data/tnep/case4_acdc.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@
%% candidate branches
%column_names% fbusdc tbusdc r l c rateA rateB rateC status cost
mpc.branchdc_ne = [
3 4 0.052 0 0 200 150 150 1 1;
3 5 0.052 0 0 200 150 150 1 1;
3 1 0.052 0 0 200 150 150 1 1;
3 4 0.052 0 0 200 150 150 1 15;
3 5 0.052 0 0 200 150 150 1 25;
3 1 0.052 0 0 200 150 150 1 18;
];

%% candidate converters
%column_names% busdc_i busac_i type_dc type_ac P_g Q_g islcc Vtar rtf xtf transformer tm bf filter rc xc reactor basekVac Vmmax Vmmin Imax status LossA LossB LossCrec LossCinv droop Pdcset Vdcset dVdcset Pacmax Pacmin Qacmax Qacmin cost
mpc.convdc_ne = [
3 4 1 1 0 0 0 1 0.01 0.01 1 1 0.01 1 0.01 0.01 1 345 1.1 0.9 2.2 1 1.103 0.887 2.885 1.885 0.0050 -58.6274 1.0079 0 100 -100 50 -50 1;
3 4 1 1 0 0 0 1 0.01 0.01 1 1 0.01 1 0.01 0.01 1 345 1.1 0.9 5.0 1 1.103 0.887 2.885 1.885 0.0050 -58.6274 1.0079 0 250 -250 100 -100 2;
4 1 1 1 0 0 0 1 0.01 0.01 1 1 0.01 1 0.01 0.01 1 345 1.1 0.9 2.2 1 1.103 0.887 2.885 1.885 0.0050 -58.6274 1.0079 0 100 -100 50 -50 1.2;
5 2 1 1 0 0 0 1 0.01 0.01 1 1 0.01 1 0.01 0.01 0 345 1.1 0.9 2.2 1 1.103 0.887 2.885 1.885 0.0050 -58.6274 1.0079 0 250 -250 100 -100 1.1;
3 4 1 1 0 0 0 1 0.01 0.01 1 1 0.01 1 0.01 0.01 1 345 1.1 0.9 2.2 1 1.103 0.887 2.885 1.885 0.0050 -58.6274 1.0079 0 100 -100 50 -50 10;
3 4 1 1 0 0 0 1 0.01 0.01 1 1 0.01 1 0.01 0.01 1 345 1.1 0.9 5.0 1 1.103 0.887 2.885 1.885 0.0050 -58.6274 1.0079 0 250 -250 100 -100 20;
4 1 1 1 0 0 0 1 0.01 0.01 1 1 0.01 1 0.01 0.01 1 345 1.1 0.9 2.2 1 1.103 0.887 2.885 1.885 0.0050 -58.6274 1.0079 0 100 -100 50 -50 120;
5 2 1 1 0 0 0 1 0.01 0.01 1 1 0.01 1 0.01 0.01 0 345 1.1 0.9 2.2 1 1.103 0.887 2.885 1.885 0.0050 -58.6274 1.0079 0 250 -250 100 -100 110;
];

% 3 4 1 1 0 0 0 1 0.01 0.01 1 1 0.01 1 0.01 0.01 1 345 1.1 0.9 1.1 1 1.103 0.887 2.885 1.885 0.0050 -58.6274 1.0079 0 100 -100 10 -10 1;
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ if local_test == true
import Gurobi
import Mosek
import MosekTools
import CPLEX
# import CPLEX
gurobi = JuMP.optimizer_with_attributes(Gurobi.Optimizer)
cplex = JuMP.optimizer_with_attributes(CPLEX.Optimizer)
# cplex = JuMP.optimizer_with_attributes(CPLEX.Optimizer)
mosek = JuMP.optimizer_with_attributes(Mosek.Optimizer)
##############################
end
Expand Down
55 changes: 30 additions & 25 deletions test/tnep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ if local_test == true
@test isapprox(resultSOCWR["solution"]["convdc_ne"]["6"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["branchdc_ne"]["3"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["branchdc_ne"]["10"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["branchdc_ne"]["3"]["pf"], -2.29067; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["branchdc_ne"]["3"]["pf"], -2.29067; atol = 1e-1)
@test isapprox(resultSOCWR["solution"]["busdc_ne"]["2"]["wdc_ne"], 1.18695; atol = 1e-2)
end
@testset "9-bus case" begin
Expand All @@ -119,7 +119,7 @@ if local_test == true
@test isapprox(resultQC["solution"]["convdc_ne"]["6"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultQC["solution"]["branchdc_ne"]["3"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultQC["solution"]["branchdc_ne"]["10"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultQC["solution"]["branchdc_ne"]["3"]["pf"], -2.272; atol = 1e-2)
@test isapprox(resultQC["solution"]["branchdc_ne"]["3"]["pf"], -2.29; atol = 1e-1)
@test isapprox(resultQC["solution"]["busdc_ne"]["2"]["wdc_ne"], 1.18695; atol = 1e-2)
end
@testset "9-bus case" begin
Expand Down Expand Up @@ -185,38 +185,43 @@ end
@testset "ACDC tnep" begin
@testset "DCP" begin
resultDCP = run_acdctnepopf("../test/data/tnep/case4_acdc.m", DCPPowerModel, cbc; setting = s)
@test isapprox(resultDCP["objective"], 303.9545; atol = 1e-1)
@test isapprox(resultDCP["objective"], 329.95456; atol = 1e-1)
@test isapprox(resultDCP["solution"]["branchdc_ne"]["3"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultDCP["solution"]["branchdc_ne"]["3"]["pf"], -1.009; atol = 1e-2)
@test isapprox(resultDCP["solution"]["branchdc_ne"]["3"]["pf"], -1.009; atol = 1e-2)
@test isapprox(resultDCP["solution"]["branchdc_ne"]["1"]["pf"], 0; atol = 1e-2)
@test isapprox(resultDCP["solution"]["convdc_ne"]["1"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultDCP["solution"]["convdc_ne"]["1"]["pconv"], -1; atol = 1e-2)
@test isapprox(resultDCP["solution"]["ne_branch"]["1"]["built"], 1; atol = 1e-2)
end
@testset "ACP" begin
resultACP = run_acdctnepopf("../test/data/tnep/case4_acdc.m", ACPPowerModel, juniper; setting = s)
@test isapprox(resultACP["objective"], 321.00; atol = 1e0)
@test isapprox(resultACP["objective"], 348.0219; atol = 1e-1)
@test isapprox(resultACP["solution"]["branchdc_ne"]["3"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultACP["solution"]["branchdc_ne"]["3"]["pf"], -0.631; atol = 1e-2)
@test isapprox(resultACP["solution"]["branchdc_ne"]["1"]["pf"], 0; atol = 1e-2)
@test isapprox(resultACP["solution"]["convdc_ne"]["1"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultACP["solution"]["convdc_ne"]["1"]["pconv"], -0.860; atol = 1e-1)
@test isapprox(resultACP["solution"]["convdc_ne"]["1"]["pconv"], -0.618; atol = 1e-2)
@test isapprox(resultACP["solution"]["ne_branch"]["1"]["built"], 1; atol = 1e-2)
end
@testset "LPAC" begin
resultLPAC = run_acdctnepopf("../test/data/tnep/case4_acdc.m", LPACCPowerModel, juniper; setting = s)
@test isapprox(resultLPAC["objective"], 307.075; atol = 1e-1)
@test isapprox(resultLPAC["objective"], 333.095; atol = 1e-1)
@test isapprox(resultLPAC["solution"]["branchdc_ne"]["3"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultLPAC["solution"]["branchdc_ne"]["3"]["pf"], -1.2466;atol = 1e-2)
@test isapprox(resultLPAC["solution"]["convdc_ne"]["2"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultLPAC["solution"]["convdc_ne"]["2"]["pconv"], -1.2355; atol = 1e-2)
@test isapprox(resultLPAC["solution"]["branchdc_ne"]["3"]["pf"], -1.009; atol = 1e-2)
@test isapprox(resultLPAC["solution"]["branchdc_ne"]["1"]["pf"], 0; atol = 1e-2)
@test isapprox(resultLPAC["solution"]["convdc_ne"]["1"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultLPAC["solution"]["convdc_ne"]["1"]["pconv"], -1; atol = 1e-2)
@test isapprox(resultLPAC["solution"]["ne_branch"]["1"]["built"], 1; atol = 1e-2)
end
if local_test == true
@testset "SOCWR" begin
resultSOCWR = run_acdctnepopf("../test/data/tnep/case4_acdc.m", SOCWRPowerModel, gurobi; setting = s)
@test isapprox(resultSOCWR["objective"], 320.952; atol = 1e-1)
@test isapprox(resultSOCWR["solution"]["branchdc_ne"]["2"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["branchdc_ne"]["2"]["pf"], -0.879; atol = 1e-2)
@test isapprox(resultSOCWR["objective"], 348.021; atol = 1e-1)
@test isapprox(resultSOCWR["solution"]["branchdc_ne"]["3"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["branchdc_ne"]["3"]["pf"], -0.631; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["branchdc_ne"]["1"]["pf"], 0; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["convdc_ne"]["1"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["convdc_ne"]["1"]["pconv"], -0.8665; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["convdc_ne"]["1"]["pconv"], -0.618; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["ne_branch"]["1"]["built"], 1; atol = 1e-2)
end
end
Expand Down Expand Up @@ -283,10 +288,10 @@ s = Dict("output" => Dict("branch_flows" => true), "conv_losses_mp" => true, "pr
@testset "DCP" begin
data_acdc = build_mn_data("../test/data/tnep/case4_acdc.m")
resultDCP = run_mp_acdctnepopf(data_acdc, DCPPowerModel, cbc, multinetwork=true; setting = s)
@test isapprox(resultDCP["objective"], 607.909; atol = 1e-1)
@test isapprox(resultDCP["objective"], 659.90; atol = 1e-1)
@test isapprox(resultDCP["solution"]["nw"]["1"]["branchdc_ne"]["3"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultDCP["solution"]["nw"]["1"]["branchdc_ne"]["3"]["pf"], -1.009; atol = 1e-2)
@test isapprox(resultDCP["solution"]["nw"]["2"]["branchdc_ne"]["3"]["pf"], -1.009; atol = 1e-2)
@test isapprox(resultDCP["solution"]["nw"]["2"]["branchdc_ne"]["1"]["pf"], 0; atol = 1e-2)
@test isapprox(resultDCP["solution"]["nw"]["2"]["convdc_ne"]["1"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultDCP["solution"]["nw"]["1"]["convdc_ne"]["1"]["pconv"], -1; atol = 1e-2)
@test isapprox(resultDCP["solution"]["nw"]["1"]["ne_branch"]["1"]["built"], 1; atol = 1e-2)
Expand All @@ -306,23 +311,23 @@ s = Dict("output" => Dict("branch_flows" => true), "conv_losses_mp" => true, "pr
@testset "ACP" begin # Normally fine but fails on travis
data_acdc = build_mn_data("../test/data/tnep/case4_acdc.m")
resultACP = run_mp_acdctnepopf(data_acdc, ACPPowerModel, juniper, multinetwork=true; setting = s)
@test isapprox(resultACP["objective"], 648.318; atol = 1e-1)
@test isapprox(resultACP["objective"], 696.043; atol = 1e-1)
@test isapprox(resultACP["solution"]["nw"]["1"]["branchdc_ne"]["3"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultACP["solution"]["nw"]["1"]["branchdc_ne"]["3"]["pf"], -0.2327; atol = 1e-2)
@test isapprox(resultACP["solution"]["nw"]["2"]["branchdc_ne"]["3"]["pf"], -0.2327; atol = 1e-2)
@test isapprox(resultACP["solution"]["nw"]["1"]["branchdc_ne"]["3"]["pf"], -0.631; atol = 1e-2)
@test isapprox(resultACP["solution"]["nw"]["2"]["branchdc_ne"]["1"]["pf"], 0; atol = 1e-2)
@test isapprox(resultACP["solution"]["nw"]["2"]["convdc_ne"]["1"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultACP["solution"]["nw"]["1"]["convdc_ne"]["1"]["pconv"], -0.5083; atol = 1e-2)
@test isapprox(resultACP["solution"]["nw"]["1"]["convdc_ne"]["1"]["pconv"], -0.6189; atol = 1e-2)
@test isapprox(resultACP["solution"]["nw"]["1"]["ne_branch"]["1"]["built"], 1; atol = 1e-2)
end
@testset "SOCWR" begin
data_acdc = build_mn_data("../test/data/tnep/case4_acdc.m")
resultSOCWR = run_mp_acdctnepopf(data_acdc, SOCWRPowerModel, gurobi, multinetwork=true; setting = s)
@test isapprox(resultSOCWR["objective"], 641.99; atol = 1e-1)
@test isapprox(resultSOCWR["solution"]["nw"]["2"]["branchdc_ne"]["2"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["nw"]["1"]["branchdc_ne"]["2"]["pf"], -0.8814; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["nw"]["2"]["branchdc_ne"]["2"]["pf"], -0.8741; atol = 1e-2)
@test isapprox(resultSOCWR["objective"], 696.04; atol = 1e-1)
@test isapprox(resultSOCWR["solution"]["nw"]["2"]["branchdc_ne"]["3"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["nw"]["1"]["branchdc_ne"]["3"]["pf"], -0.631; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["nw"]["2"]["branchdc_ne"]["1"]["pf"], 0; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["nw"]["2"]["convdc_ne"]["1"]["isbuilt"], 1; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["nw"]["1"]["convdc_ne"]["1"]["pconv"], -0.8688; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["nw"]["1"]["convdc_ne"]["1"]["pconv"], -0.618; atol = 1e-2)
@test isapprox(resultSOCWR["solution"]["nw"]["1"]["ne_branch"]["1"]["built"], 1; atol = 1e-2)
end
end
Expand Down

2 comments on commit 11573fb

@hakanergun
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

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/32423

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 the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.0 -m "<description of version>" 11573fbc5e1c600f4a03fc31bed920018022ed10
git push origin v0.4.0

Please sign in to comment.