Merge pull request #669 from OpenWaterAnalytics/dev-pump-fix

Modify const. HP pump
This commit is contained in:
Lew Rossman
2022-04-05 09:15:18 -04:00
committed by GitHub

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS Authors: see AUTHORS
Copyright: see AUTHORS Copyright: see AUTHORS
License: see LICENSE License: see LICENSE
Last Updated: 02/14/2022 Last Updated: 03/30/2022
****************************************************************************** ******************************************************************************
*/ */
@@ -691,8 +691,6 @@ void pumpcoeff(Project *pr, int k)
hgrad; // Head loss gradient hgrad; // Head loss gradient
Spump *pump; Spump *pump;
double qstar;
// Use high resistance pipe if pump closed or cannot deliver head // Use high resistance pipe if pump closed or cannot deliver head
setting = hyd->LinkSetting[k]; setting = hyd->LinkSetting[k];
if (hyd->LinkStatus[k] <= CLOSED || setting == 0.0) if (hyd->LinkStatus[k] <= CLOSED || setting == 0.0)
@@ -746,19 +744,23 @@ void pumpcoeff(Project *pr, int k)
{ {
// ... compute pump curve's gradient // ... compute pump curve's gradient
hgrad = -r / q / q; hgrad = -r / q / q;
// ... use linear curve if gradient too large or too small
// ... treat as closed link if gradient too large
if (hgrad > CBIG) if (hgrad > CBIG)
{ {
hgrad = CBIG; hyd->P[k] = 1.0 / CBIG;
qstar = sqrt(-r / hgrad); hyd->Y[k] = hyd->LinkFlow[k];
hloss = (r / qstar) - hgrad * (qstar - q); return;
} }
else if (hgrad < hyd->RQtol)
// ... treat as open valve if gradient too small
else if (hgrad < CSMALL)
{ {
hgrad = hyd->RQtol; hyd->P[k] = 1.0 / CSMALL;
qstar = sqrt(-r / hgrad); hyd->Y[k] = hyd->LinkFlow[k];
hloss = (r / qstar) - hgrad * (qstar - q); return;
} }
// ... otherwise compute head loss from pump curve // ... otherwise compute head loss from pump curve
else else
{ {