From 11573fbc5e1c600f4a03fc31bed920018022ed10 Mon Sep 17 00:00:00 2001 From: jay-dave Date: Sat, 20 Mar 2021 13:55:46 +0100 Subject: [PATCH] update case4acdc - costs are updated to get same result with different machines --- test/data/tnep/case4_acdc.m | 14 +++++----- test/runtests.jl | 4 +-- test/tnep.jl | 55 ++++++++++++++++++++----------------- 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/test/data/tnep/case4_acdc.m b/test/data/tnep/case4_acdc.m index acf55eb4..9f0c58ea 100644 --- a/test/data/tnep/case4_acdc.m +++ b/test/data/tnep/case4_acdc.m @@ -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; diff --git a/test/runtests.jl b/test/runtests.jl index 1c175bc3..561c0ff2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 diff --git a/test/tnep.jl b/test/tnep.jl index 0b68aa3f..62b9079f 100644 --- a/test/tnep.jl +++ b/test/tnep.jl @@ -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 @@ -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 @@ -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 @@ -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) @@ -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