Merge branch 'dev' into 683-request-better-logging-functionality
This commit is contained in:
26
src/epanet.c
26
src/epanet.c
@@ -7,7 +7,7 @@
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 11/08/2020
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -3162,7 +3162,7 @@ int DLLEXPORT EN_addlink(EN_Project p, char *id, int linkType,
|
||||
if (EN_getlinkindex(p, id, &i) == 0) return 215;
|
||||
|
||||
// Check for valid link type
|
||||
if (linkType < CVPIPE || linkType > GPV) return 251;
|
||||
if (linkType < CVPIPE || linkType > PCV) return 251;
|
||||
|
||||
// Lookup the link's from and to nodes
|
||||
n1 = hashtable_find(net->NodeHashTable, fromNode);
|
||||
@@ -3222,6 +3222,7 @@ int DLLEXPORT EN_addlink(EN_Project p, char *id, int linkType,
|
||||
size = (net->Nvalves + 1) * sizeof(Svalve);
|
||||
net->Valve = (Svalve *)realloc(net->Valve, size);
|
||||
net->Valve[net->Nvalves].Link = n;
|
||||
net->Valve[net->Nvalves].Curve = 0;
|
||||
}
|
||||
|
||||
link->Type = linkType;
|
||||
@@ -3481,7 +3482,7 @@ int DLLEXPORT EN_setlinktype(EN_Project p, int *index, int linkType, int actionC
|
||||
if (p->hydraul.OpenHflag || p->quality.OpenQflag) return 262;
|
||||
|
||||
// Check for valid input parameters
|
||||
if (linkType < 0 || linkType > GPV || actionCode < EN_UNCONDITIONAL ||
|
||||
if (linkType < 0 || linkType > PCV || actionCode < EN_UNCONDITIONAL ||
|
||||
actionCode > EN_CONDITIONAL)
|
||||
{
|
||||
return 251;
|
||||
@@ -3806,7 +3807,14 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
||||
v = (double)Pump[findpump(&p->network, index)].Epat;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case EN_PCV_CURVE:
|
||||
if (Link[index].Type == PCV)
|
||||
{
|
||||
v = net->Valve[findvalve(&p->network, index)].Curve;
|
||||
}
|
||||
break;
|
||||
|
||||
case EN_GPV_CURVE:
|
||||
if (Link[index].Type == GPV)
|
||||
{
|
||||
@@ -3929,6 +3937,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
||||
value /= Ucf[FLOW];
|
||||
break;
|
||||
case TCV:
|
||||
case PCV:
|
||||
break;
|
||||
case GPV:
|
||||
return 207; // Cannot modify setting for GPV
|
||||
@@ -4024,6 +4033,15 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
||||
net->Pump[pumpIndex].Epat = patIndex;
|
||||
}
|
||||
break;
|
||||
|
||||
case EN_PCV_CURVE:
|
||||
if (Link[index].Type == PCV)
|
||||
{
|
||||
curveIndex = ROUND(value);
|
||||
if (curveIndex < 0 || curveIndex > net->Ncurves) return 206;
|
||||
net->Valve[findvalve(&p->network, index)].Curve = curveIndex;
|
||||
}
|
||||
break;
|
||||
|
||||
case EN_GPV_CURVE:
|
||||
if (Link[index].Type == GPV)
|
||||
|
||||
Reference in New Issue
Block a user