USEPA / WNTR

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

Control API for WNTRSimulator does not include a case for a "ValueCondition" of a Junction and its pressure (i.e. a SCADA system tied to a pressure gauge) #185

Closed kalebsm closed 3 years ago

kalebsm commented 3 years ago

I believe WNTRSimulator does not know how to handle a simple control that initiates a pump action based on an individual node pressure reading (as opposed to tank and its level, which is the case for all the simple controls in Net6). Say for example, a distribution network has a SCADA system tied to a pressure gauge at a critical junction, and at a certain pressure it triggers the pumps.

First, I isolated that type of simple control in my input file to show that it was indeed the problem. Then I replicated it in Net6 by adding the highlighted simple control: image image

Also, I tried writing the control through the WNTR API language, but it also gave me the same error message I have described previously.

`Pump = wntr_obj.get_link('Pump2')

Junction = wntr_obj.get_node('Junction')

pump_cond0 = controls.ValueCondition(Junction, 'pressure', '>', 50/3.28)

pump_act0 = controls.ControlAction(pump, 'status', 0)

pump_rule0 = controls.Rule(pump_cond0, [pump_act0], name='rule3')

wntr_obj.add_control('rule3', pump_rule0)`

So I believe the problem is that the Control API for WNTRSimulator does not include a case for a "ValueCondition" for Junction pressure.

dbhart commented 3 years ago

So, I have finally tracked this down. The issue is not in the controls, the issue is in the WNTRSimulator. We have internal statuses for things like tank levels, etc., but did not, somehow, get one for pressure. So the Junction class doesn't have a current_pressure type parameter. Blurg. I'll see if I can get this fixed.

dbhart commented 3 years ago

I have added what I believe to be a fix in my personal master branch - I will be putting a push request in to USEPA/wntr/master soon.

kalebsm commented 3 years ago

Thank you David Hart (@dbhart). I appreciate the help.