Merge branch 'dev' into 681-request-additional-api-function-for-getting-finer-grained-time-step-information

This commit is contained in:
Sam Hatchett
2023-01-19 11:52:18 -05:00
committed by GitHub
30 changed files with 488 additions and 43 deletions

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 11/08/2020
Last Updated: 08/13/2022
******************************************************************************
*/
@@ -841,6 +841,19 @@ int DLLEXPORT EN_closeQ(EN_Project p)
********************************************************************/
int DLLEXPORT EN_setreportcallback(EN_Project p, void (*callback)(void*,void*,char*))
{
p->report.reportCallback = callback;
return 0;
}
int DLLEXPORT EN_setreportcallbackuserdata(EN_Project p, void *userData)
{
p->report.reportCallbackUserData = userData;
return 0;
}
int DLLEXPORT EN_writeline(EN_Project p, char *line)
/*----------------------------------------------------------------
** Input: line = line of text
@@ -3184,7 +3197,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);
@@ -3244,6 +3257,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;
@@ -3503,7 +3517,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;
@@ -3828,7 +3842,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)
{
@@ -3951,6 +3972,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
@@ -4046,6 +4068,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)