OpenWaterAnalytics/EPANET-Matlab-Toolkit

EMT incorrectly reads valve setting when its fixed status is OPEN or CLOSED not 'NONE'

stephen-young opened this issue · 2 comments

Describe the bug
When a valve in the network has a fixed status of "closed" or "OPEN" in the status section of the .inp file, the epanet object does assign the correct number for its setting.

I've put two networks in valve_issue_networks.zip to illustrate the problem. Both networks have a PRV that has a pressure setting of 30 m. Both networks are identical except for the initial/fixed status of the valve is "open" in one and "none" in the other.

When I load the network where the valve's initial status is "none" and query the valve's initial setting with getLinkInitialSetting, the valve's setting is read correctly as 30 but when I load the network where the valve's initial status is "open", the setting has a value of -3.048e+09.

When computing a hydraulic analysis with the "open" valve with the incorrect setting, the results show the expected behaviour of the valve setting being ignored but what if there was a control statement in the network that made the valve become active? Would the PRV setting of -3.048+09 be respected by the hydraulic solver?

To Reproduce

net = epanet('simple_network_1P1T1D1V_valve_status_none.inp');
net.getLinkInitialSetting(net.LinkValveIndex) % Valve setting read correctly

net2 = epanet('simple_network_1P1T1D1V_valve_status_open.inp');
net.getLinkInitialSetting(net.LinkValveIndex) % Valve setting read incorrectly as -3.048e+09

Desktop (please complete the following information):

  • OS: Windows 10 Version 1909 (OS Build 18363.592)
  • MATLAB version: 9.6.0.1114505 (R2019a) Update 2
  • epanet version: 2.1.8.1

Thanks for the issue! I have reposted your issue to EPANET because I think this is an EPANET bug, not EMT. OpenWaterAnalytics/EPANET#583

have experienced the following three issues with this.

  • when the network is saved, instead of saving TCV valve controls with Closed conditions as 'LINK V6_6 CLOSED AT TIME 9:00', it saves 'LINK V6_6 0000 AT TIME 9'.

  • furthermore, when using the EMT getControls command, it returns, 'LINK V6_6 CLOSED AT TIME 32400'. Though the status of this valve at this timestamp is 1.

  • lastly, trying to set controls for more than 24hours resets the time. using the getControls command, the command 'LINK V6_6 CLOSED AT TIME 0' is returned for a command set as 'LINK V6_6 CLOSED AT TIME 24:00'