OpenWaterAnalytics / EPANET

The Water Distribution System Hydraulic and Water Quality Analysis Toolkit
MIT License
272 stars 201 forks source link

fixes regression related to tank fill/empty events #803

Closed samhatchett closed 2 weeks ago

samhatchett commented 2 weeks ago

In the affected code, q is really just a proxy for flow direction. And in cases where a tank has filled in a previous step, its connected link will have been TEMPCLOSED making the flow a very small (positive or negative) number. When this occurs, the link actually never opens even if dH says that the tank should be draining.

eladsal commented 2 weeks ago

@samhatchett, this runs well, thank you!

Would you mind adding to this commit a small fix introduced a little time ago which breaks compilation with old compilers and keeps our programming conventions of declaring variables? In epanet.c lines 2372 and 3943. Just move the declaration of i before the for loop. If not, I can make another PR. Thanks!