Skip to content

Commit

Permalink
FIX: parse_file in .dss files with character UTF-8 0x09 (Tabulati…
Browse files Browse the repository at this point in the history
…on) (#395)

* Adding test case

* Adding test for the tabulation test case

* Change space validations

* Update CHANGELOG.md
  • Loading branch information
felipemarkson authored Aug 24, 2022
1 parent 28995a1 commit 0f17d69
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Updated documentation in `make_multiconductor!` to better indicate its unsupported nature
- Added automatic detection of multinetwork data to `instantiate_mc_model`
- Converted `::Float64` types in function signatures to `::Real`
- Fixed bug in `parse_file` in `.dss` files with character UTF-8 0x09 (Tabulation) [#394](https://github.com/lanl-ansi/PowerModelsDistribution.jl/issues/394)

## v0.14.4

Expand Down
6 changes: 3 additions & 3 deletions src/io/dss/dss_parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -551,15 +551,15 @@ function _parse_properties(properties::AbstractString)::Vector{String}
substring_out = split(string_out, "=")
if length(substring_out) == 2 && substring_out[2] != ""
end_equality = true
elseif !occursin("=", string_out) && (char == ' ' || n == num_chars)
elseif !occursin("=", string_out) && (isspace(char) || n == num_chars)
end_equality = true
elseif occursin("=", string_out) && (char == ' ' || n == num_chars) && end_array
elseif occursin("=", string_out) && (isspace(char) || n == num_chars) && end_array
end_equality = true
else
end_equality = false
end

if char == ' '
if isspace(char)
end_property = true
else
end_property = false
Expand Down
5 changes: 5 additions & 0 deletions test/data/opendss/case_tabulation.dss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Clear
new circuit.test bus1=SOURCEBUS pu=1.0
New Line.Line_1 bus1=SOURCEBUS bus2=BUS_1
New Load.Load_1 phases=3 conn=Wye bus1=BUS_1 kw=0.1 kvar=0.03 model=1
solve
7 changes: 7 additions & 0 deletions test/opendss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@
"like" => "",
)
end

@testset "tabulation parse" begin
eng = parse_file("../test/data/opendss/case_tabulation.dss")

number_buses = 3
@test length(eng["bus"]) == number_buses
end
end

@testset "test different regcontrol configurations" begin
Expand Down

0 comments on commit 0f17d69

Please sign in to comment.