USEPA / WNTR

An EPANET compatible python package to simulate and analyze water distribution networks under disaster scenarios.
Other
318 stars 183 forks source link

cannot remove any link #79

Closed tyjchen closed 5 years ago

tyjchen commented 5 years ago

i'm trying to remove a pipe from my epanet model using the following code wntr.remove_link('pipeA') however i get the error code back 'NoneType' object has no attribute 'update'

i tried to loop through every single pipe in my system and each trial gives me the same error back. i even tried re-exporting the .inp file multiples times on epanet. any pointers as to why? the network im using is in the link below https://ceprofs.civil.tamu.edu/kbrumbelow/Micropolis/index.htm

michaelbynum commented 5 years ago

Can you provide the full stack trace?

Michael

On Mar 26, 2019, at 12:53 PM, tyjchen notifications@github.com<mailto:notifications@github.com> wrote:

i'm trying to remove a pipe from my epanet model using the following code wntr.remove_link('pipeA') however i get the error code back 'NoneType' object has no attribute 'update'

i tried to loop through every single pipe in my system and each trial gives me the same error back. i even tried re-exporting the .inp file multiples times on epanet. any pointers as to why? the network im using is in the link below https://ceprofs.civil.tamu.edu/kbrumbelow/Micropolis/index.htm

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/USEPA/WNTR/issues/79, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ATdOLhVQrDAb4DqEoSy7mF_j-eTKrtnIks5vamy2gaJpZM4cMNSD.

tyjchen commented 5 years ago

heres the trace below, i find that i can remove pipes only after all controls have been removed, which is confusing to me because the controls are only being used in the pumps and tanks

wntr.remove_link('SC0') Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wntr/network/model.py", line 641, in remove_link if link in control.requires(): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wntr/network/controls.py", line 1752, in requires req = self._condition.requires() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wntr/network/controls.py", line 1029, in requires return self._condition_1.requires().update(self._condition_2.requires()) AttributeError: 'NoneType' object has no attribute 'update'

pshassett commented 5 years ago

Can you upload your .inp file?

michaelbynum commented 5 years ago

@tyjchen Sorry I am just now getting around to fixing this. I have identified the problem. I should have a fix shortly (hopefully tomorrow).

tyjchen commented 5 years ago

thank you! @michaelbynum

michaelbynum commented 5 years ago

@tyjchen The error arises when attempting to remove any of pumps HSP_1, HSP_2, or HSP_3. There are rules that affect these pumps, so the rules must be removed before removing the pumps. I submitted a PR (which should be merged shortly) which fixes the error message you get to be more helpful.

tyjchen commented 5 years ago

thank you @michaelbynum, should i just update my wntr package to see these changes?

michaelbynum commented 5 years ago

@tyjchen This has only been updated on github. I doubt there will be another release for about a month. If you want these changes, you will have to clone the repository and run python setup.py install or python setup.py develop.