Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Tabulation causing error on parse_file #394

Closed
felipemarkson opened this issue Aug 16, 2022 · 2 comments · Fixed by #395
Closed

[BUG] Tabulation causing error on parse_file #394

felipemarkson opened this issue Aug 16, 2022 · 2 comments · Fixed by #395
Labels
Category: Data Parsers parser issues Type: Bug Something isn't working

Comments

@felipemarkson
Copy link
Contributor

felipemarkson commented Aug 16, 2022

Describe the bug
The character UTF-8 0x09 (Tabulation) is not recognized in the parse_file using .dss files.

Minimum Viable Example

DSS Code

// test.dss
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

Julia File

import PowerModelsDistribution
const PMD = PowerModelsDistribution

case_file = "test.dss"

model_dict = PMD.parse_file(case_file)

Screenshots
image

System Information (please complete the following information):

  • OS: Manjaro Linux x86_64
  • Version Kernel Linux 5.15.60-1-MANJARO
@felipemarkson
Copy link
Contributor Author

felipemarkson commented Aug 16, 2022

I think that the problem is this function:

function _parse_properties(properties::AbstractString)::Vector{String}

Because many of the validation statements use space. E.g.:

elseif !occursin("=", string_out) && (char == ' ' || n == num_chars)
end_equality = true
elseif occursin("=", string_out) && (char == ' ' || n == num_chars) && end_array
end_equality = true
else
end_equality = false
end

Maybe changing the space validation to the built-in Julia's function isspace can solve this issue.

@pseudocubic, I can create a PR if you are ok with this solution.

@pseudocubic
Copy link
Collaborator

@felipemarkson isspace looks like a promising solution, I would welcome the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Data Parsers parser issues Type: Bug Something isn't working
Projects
None yet
2 participants