Merge branch 'dev' into dev_2.3

This commit is contained in:
Lew Rossman
2020-07-10 14:36:46 -04:00
10 changed files with 74 additions and 45 deletions

View File

@@ -1591,6 +1591,11 @@ int DLLEXPORT EN_settimeparam(EN_Project p, int param, long value)
time->Qtime = value;
break;
case EN_STARTTIME:
if (value < 0 || value > SECperDAY) return 213;
time->Tstart = value;
break;
default:
return 251;
}
@@ -1772,6 +1777,8 @@ int DLLEXPORT EN_addnode(EN_Project p, char *id, int nodeType, int *index)
hyd->NodeDemand = (double *)realloc(hyd->NodeDemand, size);
qual->NodeQual = (double *)realloc(qual->NodeQual, size);
hyd->NodeHead = (double *)realloc(hyd->NodeHead, size);
hyd->DemandFlow = (double *)realloc(hyd->DemandFlow, size);
hyd->EmitterFlow = (double *)realloc(hyd->EmitterFlow, size);
// Actions taken when a new Junction is added
if (nodeType == EN_JUNCTION)
@@ -2247,6 +2254,10 @@ int DLLEXPORT EN_getnodevalue(EN_Project p, int index, int property, double *val
(hyd->NodeDemand[index] - hyd->EmitterFlow[index])) * Ucf[FLOW];
break;
case EN_NODE_INCONTROL:
v = (double)incontrols(p, NODE, index);
break;
default:
return 251;
}
@@ -2621,8 +2632,8 @@ int DLLEXPORT EN_settankdata(EN_Project p, int index, double elev,
Network *net = &p->network;
int i, j, n, curveIndex = 0;
double area, elevation = elev;
double *Ucf = p->Ucf;
double area;
Stank *Tank = net->Tank;
Scurve *curve;
@@ -2659,11 +2670,11 @@ int DLLEXPORT EN_settankdata(EN_Project p, int index, double elev,
else area = PI * diam * diam / 4.0;
// Assign parameters to tank object
net->Node[Tank[j].Node].El = elevation;
net->Node[Tank[j].Node].El = elev / Ucf[ELEV];
Tank[j].A = area / Ucf[ELEV] / Ucf[ELEV];
Tank[j].H0 = elevation + initlvl / Ucf[ELEV];
Tank[j].Hmin = elevation + minlvl / Ucf[ELEV];
Tank[j].Hmax = elevation + maxlvl / Ucf[ELEV];
Tank[j].H0 = (elev + initlvl) / Ucf[ELEV];
Tank[j].Hmin = (elev + minlvl) / Ucf[ELEV];
Tank[j].Hmax = (elev + maxlvl) / Ucf[ELEV];
Tank[j].Vcurve = curveIndex;
if (curveIndex == 0)
{
@@ -3631,7 +3642,8 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
{
return EN_getlinkvalue(p, index, EN_ROUGHNESS, value);
}
v = Link[index].Kc;
if (Link[index].Kc == MISSING) v = 0.0;
else v = Link[index].Kc;
switch (Link[index].Type)
{
case PRV:
@@ -3785,6 +3797,10 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
v = Link[index].Kc;
}
case EN_LINK_INCONTROL:
v = (double)incontrols(p, LINK, index);
break;
default:
return 251;
}
@@ -3852,7 +3868,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
case EN_MINORLOSS:
if (Link[index].Type != PUMP)
{
if (value <= 0.0) return 211;
if (value < 0.0) return 211;
Link[index].Km = 0.02517 * value / SQR(Link[index].Diam) /
SQR(Link[index].Diam);
}