Skip to content

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

@kbonney

Description

@kbonney

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions