Skip to content

Commit

Permalink
Merge pull request OpenWaterAnalytics#803 from OpenWaterAnalytics/bug…
Browse files Browse the repository at this point in the history
…fix/tank-never-drains

fixes regression related to tank fill/empty events
  • Loading branch information
samhatchett authored Jun 24, 2024
2 parents 59f7295 + 0329819 commit 94d136b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hydstatus.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,10 @@ void tankstatus(Project *pr, int k, int n, double q)
if (tank->A == 0.0) return;

// Can't add flow to a full tank
if (hyd->NodeHead[n] >= tank->Hmax && !tank->CanOverflow && q < TINY)
if (hyd->NodeHead[n] >= tank->Hmax && !tank->CanOverflow && q < 0.0)
hyd->LinkStatus[k] = TEMPCLOSED;

// Can't remove flow from an empty tank
else if (hyd->NodeHead[n] <= tank->Hmin && q > -TINY)
else if (hyd->NodeHead[n] <= tank->Hmin && q > 0.0)
hyd->LinkStatus[k] = TEMPCLOSED;
}

0 comments on commit 94d136b

Please sign in to comment.