You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to adjust the maximum flow rate setting of an FCV during a simulation? For example, I am interested in controlling a FCV to change the initial_setting of an FCV from 0.5 to 0.4 CMS five hours into a 24 hour simulation.
I thought I may be able to do this through a rule using SimTimeCondition but the flow rate in the simulation is remaining constrained by the original setting of 0.5 CMS and it is above the new limit of 0.4 for t=5-24 hours.
Below I have included the code for the rule I tried to add:
import wntr
import wntr.network.controls as controls
# Create a water network model
inp_file = 'networks/Net3_withFCV.inp'
wn = wntr.network.WaterNetworkModel(inp_file)
wn.convert_controls_to_rules(priority=3) #convert controls to rules
# Modify the water network model
Nt=24
wn.options.time.duration = Nt*3600 # 24 hour scheduling horizon
wn.options.time.hydraulic_timestep = 2 #every 2 seconds
wn.options.time.report_timestep = 2 #every 2 seconds
wn.options.time.rule_timestep = 3600
wn.options.time.pattern_timestep = 3600 # every 1 hour (demand constant over hour)
wn.options.hydraulic.required_pressure = 14.065 #[m]
wn.options.hydraulic.minimum_pressure = 0 # [m]
wn.options.hydraulic.demand_model = 'PDD' # pressure-driven demand
wn.options.energy.global_efficiency = 75
t=5 # Time period where FCV initial_setting is changed
valve1 = wn.get_link('FCV1')
valve1.initial_status = "ACTIVE"
# Adjust the max flow rate through valve
cond1 = controls.SimTimeCondition(wn, '=', t*3600)
act1v = controls.ControlAction(valve1, 'initial_setting', 0.4)
rule_temp = controls.Rule(cond1, [act1v], name='rule_valve1_t{}'.format(t), priority=6)
wn.add_control('rule_valve1_t{}'.format(t), rule_temp) #add rule
sim = wntr.sim.EpanetSimulator(wn)
results = sim.run_sim()
The text was updated successfully, but these errors were encountered:
Is it possible to adjust the maximum flow rate setting of an FCV during a simulation? For example, I am interested in controlling a FCV to change the initial_setting of an FCV from 0.5 to 0.4 CMS five hours into a 24 hour simulation.
I thought I may be able to do this through a rule using SimTimeCondition but the flow rate in the simulation is remaining constrained by the original setting of 0.5 CMS and it is above the new limit of 0.4 for t=5-24 hours.
Below I have included the code for the rule I tried to add:
The text was updated successfully, but these errors were encountered: