diff --git a/src/hydstatus.c b/src/hydstatus.c index 87d45c6..4b4dc4b 100644 --- a/src/hydstatus.c +++ b/src/hydstatus.c @@ -437,40 +437,12 @@ void tankstatus(Project *pr, int k, int n1, int n2) tank = &net->Tank[i]; if (tank->A == 0.0) return; - // Find head difference across link - h = hyd->NodeHead[n1] - hyd->NodeHead[n2]; - - // If tank is full, then prevent flow into it if (hyd->NodeHead[n1] >= tank->Hmax - hyd->Htol && !tank->CanOverflow) { - // Case 1: Link is a pump discharging into tank - if (link->Type == PUMP) - { - if (link->N2 == n1) hyd->LinkStatus[k] = TEMPCLOSED; - } - - // Case 2: Downstream head > tank head - // (e.g., an open outflow check valve would close) - else if (cvstatus(pr, OPEN, h, q) == CLOSED) - { - hyd->LinkStatus[k] = TEMPCLOSED; - } + if (q < 0.0) hyd->LinkStatus[k] = TEMPCLOSED; } - - // If tank is empty, then prevent flow out of it if (hyd->NodeHead[n1] <= tank->Hmin + hyd->Htol) { - // Case 1: Link is a pump discharging from tank - if (link->Type == PUMP) - { - if (link->N1 == n1) hyd->LinkStatus[k] = TEMPCLOSED; - } - - // Case 2: Tank head > downstream head - // (e.g., a closed outflow check valve would open) - else if (cvstatus(pr, CLOSED, h, q) == OPEN) - { - hyd->LinkStatus[k] = TEMPCLOSED; - } + if (q > 0.0) hyd->LinkStatus[k] = TEMPCLOSED; } }