Skip to content

Commit

Permalink
mv LinDistFlow test to test_with_xpress (rm SCIP from test env)
Browse files Browse the repository at this point in the history
  • Loading branch information
NLaws committed May 5, 2023
1 parent 542e51e commit 49182da
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 37 deletions.
1 change: 0 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SCIP = "82193955-e24f-5292-bf16-6f2c5261a85f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Xpress = "9e70acf3-d6c9-5be6-b5bd-4e2c73e3e054"
36 changes: 0 additions & 36 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ using JuMP
using HiGHS
using JSON
using REopt
using SCIP # handles special order sets


if "Xpress" in ARGS
Expand Down Expand Up @@ -484,39 +483,4 @@ else # run HiGHS tests
@test sim_electric_kw s.electric_load.loads_kw atol=0.1
@test sim_cooling_ton s.cooling_load.loads_kw_thermal ./ REopt.KWH_THERMAL_PER_TONHOUR atol=0.1
end

@testset "LinDistFlow" begin
m = Model(optimizer_with_attributes(SCIP.Optimizer, "display/verblevel" => 0))
ps = [
REoptInputs("./scenarios/pv_storage.json"),
REoptInputs("./scenarios/monthly_rate.json"),
];
# make dummy REoptInputs with fixed systems for other nodes in network?
load_nodes = Dict(
"3" => [],
"10" => [],
)
ldf_inputs = LinDistFlow.Inputs(
"./data/car10linecodes.dss",
"0";
Pload=load_nodes,
Qload=load_nodes,
Sbase=1e6,
Vbase=12.5e3,
v0 = 1.00,
v_uplim = 1.05,
v_lolim = 0.95,
Ntimesteps = 8760
);
build_reopt!(m, ps)
LinDistFlow.build_ldf!(m, ldf_inputs, ps)
add_objective!(m, ps)
optimize!(m)

results = reopt_results(m, ps)
@test results[10]["Financial"]["lcc"] + results[3]["Financial"]["lcc"] 1.240037e7 + 437169 rtol=1e-5
P0 = value.(m[:Pj]["0",:]).data * ldf_inputs.Sbase / 1e3; # converting to kW
TotalGridPurchases = value.(m[:dvGridPurchase_3]).data + value.(m[:dvGridPurchase_10]).data;
@test maximum(TotalGridPurchases) maximum(P0) rtol = 1e-5 # lossless model
end
end
36 changes: 36 additions & 0 deletions test/test_with_xpress.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1673,3 +1673,39 @@ end
@test length(r["Messages"]["errors"]) > 0
@test length(r["Messages"]["warnings"]) > 0
end


@testset "LinDistFlow" begin
m = Model(optimizer_with_attributes(Xpress.Optimizer, "OUTPUTLOG" => 0))
ps = [
REoptInputs("./scenarios/pv_storage.json"),
REoptInputs("./scenarios/monthly_rate.json"),
];
# make dummy REoptInputs with fixed systems for other nodes in network?
load_nodes = Dict(
"3" => [],
"10" => [],
)
ldf_inputs = LinDistFlow.Inputs(
"./data/car10linecodes.dss",
"0";
Pload=load_nodes,
Qload=load_nodes,
Sbase=1e6,
Vbase=12.5e3,
v0 = 1.00,
v_uplim = 1.05,
v_lolim = 0.95,
Ntimesteps = 8760
);
build_reopt!(m, ps)
LinDistFlow.build_ldf!(m, ldf_inputs, ps)
add_objective!(m, ps)
optimize!(m)

results = reopt_results(m, ps)
@test results[10]["Financial"]["lcc"] + results[3]["Financial"]["lcc"] 1.240037e7 + 437169 rtol=1e-5
P0 = value.(m[:Pj]["0",:]).data * ldf_inputs.Sbase / 1e3; # converting to kW
TotalGridPurchases = value.(m[:dvGridPurchase_3]).data + value.(m[:dvGridPurchase_10]).data;
@test maximum(TotalGridPurchases) maximum(P0) rtol = 1e-5 # lossless model
end

0 comments on commit 49182da

Please sign in to comment.