Merge pull request #755 from lbutler/setcurvetype-support-EN_VALVE_CURVE

Update EN_setcurvetype to support EN_VALVE_CURVE
This commit is contained in:
Lew Rossman
2023-09-28 12:08:24 -04:00
committed by GitHub
2 changed files with 7 additions and 2 deletions

View File

@@ -4907,7 +4907,7 @@ int DLLEXPORT EN_setcurvetype(EN_Project p, int index, int type)
Network *net = &p->network;
if (!p->Openflag) return 102;
if (index < 1 || index > net->Ncurves) return 206;
if (type < 0 || type > EN_GENERIC_CURVE) return 251;
if (type < 0 || type > EN_VALVE_CURVE) return 251;
net->Curve[index].Type = type;
return 0;
}

View File

@@ -28,7 +28,7 @@ BOOST_FIXTURE_TEST_CASE(test_PCV_valve, FixtureOpenClose)
double x[] = { 0.0, 25., 50., 75., 100. };
double y[] = {0.0, 8.9, 18.4, 40.6, 100.0};
double v;
int linkIndex, curveIndex;
int linkIndex, curveIndex, curveType;
// Make steady state run
error = EN_settimeparam(ph, EN_DURATION, 0);
@@ -50,6 +50,11 @@ BOOST_FIXTURE_TEST_CASE(test_PCV_valve, FixtureOpenClose)
BOOST_REQUIRE(error == 0);
error = EN_setcurve(ph, curveIndex, x, y, npts);
BOOST_REQUIRE(error == 0);
error = EN_setcurvetype(ph, curveIndex, EN_VALVE_CURVE);
BOOST_REQUIRE(error == 0);
error = EN_getcurvetype(ph, curveIndex, &curveType);
BOOST_REQUIRE(error == 0);
BOOST_REQUIRE(curveType == EN_VALVE_CURVE);
// Assign curve & initial setting to PCV
error = EN_setlinkvalue(ph, linkIndex, EN_PCV_CURVE, curveIndex);