Skip to content

Commit

Permalink
Merge pull request #1191 from NREL-Sienna/ps/table_data_parser
Browse files Browse the repository at this point in the history
feat: Added flexibility to either read "Up", "UP" or "uP" on the table data parser
  • Loading branch information
jd-lara authored Sep 16, 2024
2 parents 8cc13d1 + e704697 commit 0515d58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/parsers/power_system_table_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -775,9 +775,9 @@ function services_csv_parser!(sys::System, data::PowerSystemTableData)
end

function get_reserve_direction(direction::AbstractString)
if direction == "Up"
if lowercase(direction) == "up"
return ReserveUp
elseif direction == "Down"
elseif lowercase(direction) == "down"
return ReserveDown
else
throw(DataFormatError("invalid reserve direction $direction"))
Expand Down
4 changes: 3 additions & 1 deletion test/test_power_system_table_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ end
@testset "Test reserve direction" begin
@test PSY.get_reserve_direction("Up") == ReserveUp
@test PSY.get_reserve_direction("Down") == ReserveDown
@test PSY.get_reserve_direction("up") == ReserveUp
@test PSY.get_reserve_direction("down") == ReserveDown

for invalid in ("up", "down", "right", "left")
for invalid in ("right", "left")
@test_throws PSY.DataFormatError PSY.get_reserve_direction(invalid)
end
end
Expand Down

0 comments on commit 0515d58

Please sign in to comment.