Fix emitter calculation

This commit is contained in:
lbutler
2025-07-05 21:24:39 -04:00
parent 3d1d6496c9
commit 375a772d2e
2 changed files with 3 additions and 6 deletions

View File

@@ -2285,8 +2285,7 @@ int DLLEXPORT EN_getnodevalue(EN_Project p, int index, int property, double *val
v = 0.0; v = 0.0;
if (Node[index].Ke > 0.0) if (Node[index].Ke > 0.0)
{ {
ecfTmp = (parser->Unitsflag == US) ? (1.0 / PSIperFT) : (1.0 / MperFT); ecfTmp = (parser->Unitsflag == US) ? (PSIperFT * hyd->SpGrav) : (MperFT * hyd->SpGrav);
ecfTmp /= hyd->SpGrav;
v = Ucf[FLOW] / pow((ecfTmp * Node[index].Ke), (1.0 / hyd->Qexp)); v = Ucf[FLOW] / pow((ecfTmp * Node[index].Ke), (1.0 / hyd->Qexp));
} }
break; break;
@@ -2534,8 +2533,7 @@ int DLLEXPORT EN_setnodevalue(EN_Project p, int index, int property, double valu
if (value < 0.0) return 209; if (value < 0.0) return 209;
if (value > 0.0) if (value > 0.0)
{ {
ecfTmp = (parser->Unitsflag == US) ? (1.0 / PSIperFT) : (1.0 / MperFT); ecfTmp = (parser->Unitsflag == US) ? (PSIperFT * hyd->SpGrav) : (MperFT * hyd->SpGrav);
ecfTmp /= hyd->SpGrav;
value = pow((Ucf[FLOW] / value), hyd->Qexp) / ecfTmp; value = pow((Ucf[FLOW] / value), hyd->Qexp) / ecfTmp;
} }
Node[index].Ke = value; Node[index].Ke = value;

View File

@@ -545,8 +545,7 @@ void convertunits(Project *pr)
hyd->Preq /= pr->Ucf[PRESSURE]; hyd->Preq /= pr->Ucf[PRESSURE];
// Convert emitter discharge coeffs. to head loss coeff. // Convert emitter discharge coeffs. to head loss coeff.
ecf = (parser->Unitsflag == US) ? (1.0 / PSIperFT) : (1.0 / MperFT); ecf = (parser->Unitsflag == US) ? (PSIperFT * hyd->SpGrav) : (MperFT * hyd->SpGrav);
ecf /= hyd->SpGrav;
ucf = pow(pr->Ucf[FLOW], hyd->Qexp) / ecf; ucf = pow(pr->Ucf[FLOW], hyd->Qexp) / ecf;
for (i = 1; i <= net->Njuncs; i++) for (i = 1; i <= net->Njuncs; i++)