WNTR
WNTR copied to clipboard
WNTRSimulator simulates a single timestep every time run_sim is called even if the sim_time is past the duration
WNTRSimulator simulates a single timestep every time run_sim is called even if the sim_time is past the duration
Hi, I find this behavior actually useful - you can set a duration equal to the hydraulic timestep, and then simulate an arbitrary number of steps (e.g. until a condition in your script is met). What bothers me is that sometimes when you call
sim = wntr.sim.EpanetSimulator(wn)
results= sim.run_sim()
results can be an empty dataframe. A workaround is adding something like:
while results.node["pressure"].empty: results= sim.run_sim()