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

Exception occurs when running to_gis() on a WN with leaks #456

Open
kbonney opened this issue Nov 11, 2024 · 0 comments
Open

Exception occurs when running to_gis() on a WN with leaks #456

kbonney opened this issue Nov 11, 2024 · 0 comments
Labels

Comments

@kbonney
Copy link
Collaborator

kbonney commented Nov 11, 2024

Summary
Attempting to run the to_gis() method on a WaterNetworkModel which contains leaks causes an Exception:

Exception has occurred: AttributeError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
'Junction' object has no attribute 'link_type'

Example

import wntr

wn = wntr.network.WaterNetworkModel("Net3.inp")
node = wn.get_node("101")
node.add_leak(wn, area=1, start_time=0, end_time=3600)
wn.to_gis()

Environment
Provide information on your computing environment.

  • Operating system: Ubuntu 22
  • Python version: 3.10
  • WNTR version: Latest fetch from main branch.

Additional context
The Exception appears to be caused because the str magic method in ControlAction assumes that _target_obj is a link. However, when a leak is added to a node a control is added with a _target_obj that points to a node rather than a link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants