Change PCV settings from fraction to percent
This commit is contained in:
@@ -163,6 +163,10 @@ const
|
||||
EN_CMD = 9;
|
||||
EN_CMS = 10;
|
||||
|
||||
EN_PSI = 0; { Pressure units types }
|
||||
EN_KPA = 1;
|
||||
EN_METERS = 2;
|
||||
|
||||
EN_DDA = 0; { Demand model types }
|
||||
EN_PDA = 1;
|
||||
|
||||
|
||||
@@ -161,10 +161,10 @@ double pcvlosscoeff(Project* pr, int k, double s)
|
||||
/*
|
||||
**--------------------------------------------------------------
|
||||
** Input: k = link index
|
||||
** s = valve fraction open setting
|
||||
** s = valve percent open setting
|
||||
** Output: returns a valve loss coefficient
|
||||
** Purpose: finds a Positional Control Valve's loss
|
||||
** coefficient from its fraction open setting.
|
||||
** coefficient from its percent open setting.
|
||||
**--------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
@@ -176,7 +176,7 @@ double pcvlosscoeff(Project* pr, int k, double s)
|
||||
double kmo; // fully open loss coeff.
|
||||
double km; // partly open loss coeff.
|
||||
double kvr; // Kv / Kvo (Kvo = Kv at fully open)
|
||||
double *x, *y; // points on kvr v. frac. open curve
|
||||
double *x, *y; // points on kvr v. percent open curve
|
||||
int k1, k2, npts;
|
||||
Scurve *curve;
|
||||
|
||||
@@ -186,7 +186,7 @@ double pcvlosscoeff(Project* pr, int k, double s)
|
||||
// Valve is completely open so return its Km value
|
||||
d = net->Link[k].Diam;
|
||||
kmo = net->Link[k].Km;
|
||||
if (s >= 1.0) return kmo;
|
||||
if (s >= 100.0) return kmo;
|
||||
|
||||
// Valve is completely closed so return a large coeff.
|
||||
if (s <= 0.0) return CBIG;
|
||||
@@ -199,8 +199,8 @@ double pcvlosscoeff(Project* pr, int k, double s)
|
||||
// Valve curve data
|
||||
curve = &net->Curve[c];
|
||||
npts = curve->Npts;
|
||||
x = curve->X; // x = frac. open
|
||||
y = curve->Y; // y = Kv / Kvo
|
||||
x = curve->X; // x = % open
|
||||
y = curve->Y; // y = Kv / Kvo as a %
|
||||
|
||||
// s lies below first point of curve
|
||||
if (s < x[0])
|
||||
@@ -226,7 +226,8 @@ double pcvlosscoeff(Project* pr, int k, double s)
|
||||
}
|
||||
}
|
||||
|
||||
// kvr can't be > 1 or <= 0
|
||||
// Convert kvr from % to fraction
|
||||
kvr /= 100.;
|
||||
kvr = MIN(kvr, 1.0);
|
||||
kvr = MAX(kvr, CSMALL);
|
||||
|
||||
|
||||
@@ -550,7 +550,7 @@ int valvedata(Project *pr)
|
||||
if (c == 0) return setError(parser, 7, 206);
|
||||
losscurve = c;
|
||||
net->Curve[c].Type = VALVE_CURVE;
|
||||
if (setting > 1.0) setting = 1.0;
|
||||
if (setting > 100.0) setting = 100.0;
|
||||
}
|
||||
|
||||
// Check for illegal connections
|
||||
|
||||
@@ -25,8 +25,8 @@ BOOST_FIXTURE_TEST_CASE(test_PCV_valve, FixtureOpenClose)
|
||||
|
||||
{
|
||||
int npts = 5;
|
||||
double x[] = { 0.0, 0.25, 0.5, 0.75, 1. };
|
||||
double y[] = {0.0, 0.089, 0.184, 0.406, 1.0};
|
||||
double x[] = { 0.0, 25., 50., 75., 100. };
|
||||
double y[] = {0.0, 0.89, 18.4, 40.6, 100.0};
|
||||
double v;
|
||||
int linkIndex, curveIndex;
|
||||
|
||||
@@ -54,14 +54,14 @@ BOOST_FIXTURE_TEST_CASE(test_PCV_valve, FixtureOpenClose)
|
||||
// Assign curve & initial setting to PCV
|
||||
error = EN_setlinkvalue(ph, linkIndex, EN_PCV_CURVE, curveIndex);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_setlinkvalue(ph, linkIndex, EN_INITSETTING, 0.35);
|
||||
error = EN_setlinkvalue(ph, linkIndex, EN_INITSETTING, 35.);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
// Solve for hydraulics
|
||||
error = EN_solveH(ph);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
// The PCV interpolated relative flow coeff. at 0.35 open is 0.127.
|
||||
// The PCV interpolated relative flow coeff. at 35% open is 0.127.
|
||||
// This translates to a minor loss coeff. of 0.19 / 0.127^2 = 11.78.
|
||||
// If the PCV were replaced with a TCV at that setting the resulting
|
||||
// head loss would be 0.0255 ft which should equal the PCV result.
|
||||
|
||||
Reference in New Issue
Block a user