Merge pull request #840 from OpenWaterAnalytics/dev-demand_deficit_fix

Limit demand deficit to be >= 0
This commit is contained in:
Lew Rossman
2025-03-19 19:00:03 -04:00
committed by GitHub
2 changed files with 2 additions and 1 deletions

View File

@@ -2380,6 +2380,7 @@ int DLLEXPORT EN_getnodevalue(EN_Project p, int index, int property, double *val
// while DemandFlow contains delivered consumer demand // while DemandFlow contains delivered consumer demand
if (hyd->FullDemand[index] <= 0.0) return 0; if (hyd->FullDemand[index] <= 0.0) return 0;
v = (hyd->FullDemand[index] - hyd->DemandFlow[index]) * Ucf[FLOW]; v = (hyd->FullDemand[index] - hyd->DemandFlow[index]) * Ucf[FLOW];
if (v < 0.0) v = 0.0;
break; break;
case EN_NODE_INCONTROL: case EN_NODE_INCONTROL:

View File

@@ -702,7 +702,7 @@ int pdaconverged(Project *pr)
{ {
Hydraul *hyd = &pr->hydraul; Hydraul *hyd = &pr->hydraul;
const double QTOL = 0.0001; // 0.0001 cfs ~= 0.005 gpm ~= 0.2 lpm) const double QTOL = 0.0001; // 0.0001 cfs ~= 0.05 gpm ~= 0.2 lpm)
int i, converged = 1; int i, converged = 1;
double totalDemand = 0.0, totalReduction = 0.0; double totalDemand = 0.0, totalReduction = 0.0;