Skip to content

Commit

Permalink
Merge pull request #10 from noahrhodes/fix_9
Browse files Browse the repository at this point in the history
Change _pglib to use input path, not constant global
  • Loading branch information
noahrhodes authored May 27, 2024
2 parents 2b16d7e + 237331f commit 3a7c357
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/PGLib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ function _pglib(fname::AbstractString, path::AbstractString)
case = PowerModels.parse_file(joinpath(path, "pglib_opf_$fname.m"))
else
# if single case contains name
files = readdir(joinpath(PGLib_opf))
files = readdir(joinpath(path))
filtered_files = filter(x-> occursin(fname,x) , files)
if length(filtered_files)==1
file=filtered_files[1]
@info "opening case `$file`"
case = PowerModels.parse_file(joinpath(PGLib_opf, file))
case = PowerModels.parse_file(joinpath(path, file))
else
@warn "Case `$(fname)` was not found. Try running `find_pglib_case(\"$fname\")` to find similar case names."
return Dict{String,Any}()
Expand Down
4 changes: 2 additions & 2 deletions test/pglib_opf_case3_lmbd.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% %%%%%
%%%% IEEE PES Power Grid Library - Optimal Power Flow - v21.07 %%%%%
%%%% IEEE PES Power Grid Library - Optimal Power Flow - v23.07 %%%%%
%%%% (https://github.com/power-grid-lib/pglib-opf) %%%%%
%%%% Benchmark Group - Typical Operations %%%%%
%%%% 29 - July - 2021 %%%%%
%%%% 23 - July - 2023 %%%%%
%%%% %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
Expand Down
8 changes: 4 additions & 4 deletions test/pglib_opf_case3_lmbd__api.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% %%%%%
%%%% IEEE PES Power Grid Library - Optimal Power Flow - v21.07 %%%%%
%%%% IEEE PES Power Grid Library - Optimal Power Flow - v23.07 %%%%%
%%%% (https://github.com/power-grid-lib/pglib-opf) %%%%%
%%%% Benchmark Group - Active Power Increase %%%%%
%%%% 29 - July - 2021 %%%%%
%%%% 23 - July - 2023 %%%%%
%%%% %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function mpc = pglib_opf_case3_lmbd__api
Expand All @@ -15,7 +15,7 @@
mpc.bus = [
1 3 147.08 40.00 0.0 0.0 1 1.00000 0.00000 240.0 1 1.10000 0.90000;
2 2 147.08 40.00 0.0 0.0 1 1.00000 0.00000 240.0 1 1.10000 0.90000;
3 2 127.02 50.00 0.0 0.0 1 1.00000 0.00000 240.0 1 1.10000 0.90000;
3 2 127.03 50.00 0.0 0.0 1 1.00000 0.00000 240.0 1 1.10000 0.90000;
];

%% generator data
Expand Down Expand Up @@ -51,7 +51,7 @@
% INFO : === Load Replacement Notes ===
% INFO : Bus 1 : Pd=110.0, Qd=40.0 -> Pd=147.08, Qd=40.00
% INFO : Bus 2 : Pd=110.0, Qd=40.0 -> Pd=147.08, Qd=40.00
% INFO : Bus 3 : Pd=95.0, Qd=50.0 -> Pd=127.02, Qd=50.00
% INFO : Bus 3 : Pd=95.0, Qd=50.0 -> Pd=127.03, Qd=50.00
% INFO :
% INFO : === Generator Setpoint Replacement Notes ===
% INFO : Gen at bus 1 : Pg=1000.0, Qg=0.0 -> Pg=265.0, Qg=41.0
Expand Down
4 changes: 2 additions & 2 deletions test/pglib_opf_case3_lmbd__sad.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% %%%%%
%%%% IEEE PES Power Grid Library - Optimal Power Flow - v21.07 %%%%%
%%%% IEEE PES Power Grid Library - Optimal Power Flow - v23.07 %%%%%
%%%% (https://github.com/power-grid-lib/pglib-opf) %%%%%
%%%% Benchmark Group - Small Angle Difference %%%%%
%%%% 29 - July - 2021 %%%%%
%%%% 23 - July - 2023 %%%%%
%%%% %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function mpc = pglib_opf_case3_lmbd__sad
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ using Test
silence() #suppress PowerModels output

case = parse_file(joinpath("./pglib_opf_case3_lmbd.m"))
case_api = parse_file(joinpath("./pglib_opf_case3_lmbd.m"))
case_sad = parse_file(joinpath("./pglib_opf_case3_lmbd.m"))
case_api = parse_file(joinpath("./pglib_opf_case3_lmbd__api.m"))
case_sad = parse_file(joinpath("./pglib_opf_case3_lmbd__sad.m"))


@testset "pglib" begin
Expand Down

0 comments on commit 3a7c357

Please sign in to comment.