Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot see added controls in exported .inp file #346

Open
mark-chung opened this issue Apr 28, 2023 · 1 comment
Open

Cannot see added controls in exported .inp file #346

mark-chung opened this issue Apr 28, 2023 · 1 comment
Labels

Comments

@mark-chung
Copy link

Summary
I make some changes in wntr objects eg. remove valves, add new valves, adding simple controls. Then, I export as .inp file and open the file in EPANET. From EPANET, I could see the valves attributes are changed. However, the added controls do not appear in EPANET 'Simple Controls Editor'. Can anyone please help?

Example

Remove original valve, add new valve with desired attributes

valve1 = 'V_1'
f_v1 = wn.get_link(valve1)
wn.remove_link(V_1)
wn.add_valve(valve1, 'J_2','J_3', diameter=0.5, valve_type='FCV', minor_loss=0.0, initial_setting=0.0, initial_status='Active')
f_v1 = wn.get_link(valve1)

Add controls (set flow at time '00:00')

act = controls.ControlAction(f_v1 , 'flow', 100)
cond = controls.SimTimeCondition(wn, '=', '00:00')
ctrl = controls.Control(cond, act, name='c1')
wn.add_control('newc1', ctrl)
print (ctrl)

output: IF SYSTEM TIME IS 00:00:00 THEN VALVE V_1 FLOW IS 100.0 PRIORITY 3

@kaklise
Copy link
Collaborator

kaklise commented Apr 28, 2023

Thanks for posting this example. WNTR can create controls that are not recognized by EPANET (and therefore not saved to the EPANET inp file), but in this case the ControlAction should change the valve "setting" attribute (which is flow for a FCV) instead of "flow" (which is a simulation result). We should add checks for valid attributes in the control classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants