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] Joining lines calls a function which throws an error #416

Closed
hei06j opened this issue Jan 3, 2023 · 2 comments · Fixed by #418
Closed

[BUG] Joining lines calls a function which throws an error #416

hei06j opened this issue Jan 3, 2023 · 2 comments · Fixed by #418
Labels
Category: Data Models Data Models Type: Bug Something isn't working

Comments

@hei06j
Copy link
Contributor

hei06j commented Jan 3, 2023

In the network reduction by joining lines, the line 1338 with link below will throw an error if comp["bus"] in line 1334 is not a string, as it attempts to append an integer to a vector of strings.

append!(buses_exclude, buses)

buses = isa(comp["bus"], String) ? [comp["bus"]] : comp["bus"]

error:

ERROR: MethodError: Cannot `convert` an object of type Int64 to an object of type String

I assume replacing the last argument in line 1334 with [string(comp["bus"])] would fix the problem.

@pseudocubic
Copy link
Collaborator

I actually think that the correct way to fix this is to rewrite the line to check if isa(comp["bus"], Vector).

That said, I'm not clear on how we would end up with non-string bus names, could you provide a small example so that we can add a unit test?

@pseudocubic pseudocubic added Type: Bug Something isn't working Category: Data Models Data Models labels Jan 3, 2023
@hei06j
Copy link
Contributor Author

hei06j commented Jan 4, 2023

Actually you are correct. I encountered this error when I used the join_line code (with necessary modifications) to reduce a network in PowerModels.jl rather than PMD.jl. So given that this code works with data_eng and all assets have the key "bus" as string, my original bug is not valid here. Thanks so much for the clarification and I am happy for the issue to be closed if you want to.

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

Successfully merging a pull request may close this issue.

2 participants