-
Notifications
You must be signed in to change notification settings - Fork 205
Closed
Labels
Description
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.