Merge branch 'dev' into 681-request-additional-api-function-for-getting-finer-grained-time-step-information
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 06/20/2019
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,8 @@ char *LinkTxt[] = {w_CV,
|
||||
w_PBV,
|
||||
w_FCV,
|
||||
w_TCV,
|
||||
w_GPV};
|
||||
w_GPV,
|
||||
w_PCV};
|
||||
|
||||
char *StatTxt[] = {t_XHEAD,
|
||||
t_TEMPCLOSED,
|
||||
|
||||
39
src/epanet.c
39
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
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -212,6 +212,16 @@ int DLLEXPORT ENsetstatusreport(int level)
|
||||
return EN_setstatusreport(_defaultProject, level);
|
||||
}
|
||||
|
||||
int DLLEXPORT ENsetreportcallback(void (*callback)(void *userData, void *EN_projectHandle, char*))
|
||||
{
|
||||
return EN_setreportcallback(_defaultProject, callback);
|
||||
}
|
||||
|
||||
int DLLEXPORT ENsetreportcallbackuserdata(void *userData)
|
||||
{
|
||||
return EN_setreportcallbackuserdata(_defaultProject, userData);
|
||||
}
|
||||
|
||||
int DLLEXPORT ENgetversion(int *version) { return EN_getversion(version); }
|
||||
|
||||
int DLLEXPORT ENgeterror(int errcode, char *errmsg, int maxLen)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 02/03/2020
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef FUNCS_H
|
||||
@@ -167,6 +167,7 @@ void headlosscoeffs(Project *);
|
||||
void matrixcoeffs(Project *);
|
||||
void emitterheadloss(Project *, int, double *, double *);
|
||||
void demandheadloss(Project *, int, double, double, double *, double *);
|
||||
double pcvlosscoeff(Project *, int, double);
|
||||
|
||||
// ------- QUALITY.C --------------------
|
||||
|
||||
|
||||
123
src/hydcoeffs.c
123
src/hydcoeffs.c
@@ -7,7 +7,7 @@
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 03/30/2022
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -36,6 +36,7 @@ const double CBIG = 1.e8;
|
||||
|
||||
// Exported functions
|
||||
//void resistcoeff(Project *, int );
|
||||
//double pcvlosscoeff(Project *, int, double);
|
||||
//void headlosscoeffs(Project *);
|
||||
//void matrixcoeffs(Project *);
|
||||
//void emitterheadloss(Project *, int, double *, double *);
|
||||
@@ -59,6 +60,7 @@ static void valvecoeff(Project *pr, int k);
|
||||
static void gpvcoeff(Project *pr, int k);
|
||||
static void pbvcoeff(Project *pr, int k);
|
||||
static void tcvcoeff(Project *pr, int k);
|
||||
static void pcvcoeff(Project *pr, int k);
|
||||
static void prvcoeff(Project *pr, int k, int n1, int n2);
|
||||
static void psvcoeff(Project *pr, int k, int n1, int n2);
|
||||
static void fcvcoeff(Project *pr, int k, int n1, int n2);
|
||||
@@ -107,6 +109,10 @@ void resistcoeff(Project *pr, int k)
|
||||
case PUMP:
|
||||
link->R = CBIG;
|
||||
break;
|
||||
|
||||
case PCV:
|
||||
link->R = pcvlosscoeff(pr, k, link->Kc);
|
||||
break;
|
||||
|
||||
// ... For all other links (e.g. valves) use a small resistance
|
||||
default:
|
||||
@@ -116,6 +122,86 @@ void resistcoeff(Project *pr, int k)
|
||||
}
|
||||
|
||||
|
||||
double pcvlosscoeff(Project* pr, int k, double s)
|
||||
/*
|
||||
**--------------------------------------------------------------
|
||||
** Input: k = link index
|
||||
** s = valve fraction open setting
|
||||
** Output: returns a valve loss coefficient
|
||||
** Purpose: finds a Positional Control Valve's loss
|
||||
** coefficient from its fraction open setting.
|
||||
**--------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
Network* net = &pr->network;
|
||||
|
||||
int v = findvalve(net, k); // valve index
|
||||
int c = net->Valve[v].Curve; // Kv curve index
|
||||
double d; // valve diameter
|
||||
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
|
||||
int k1, k2, npts;
|
||||
Scurve *curve;
|
||||
|
||||
// Valve has no setting so return 0
|
||||
if (s == MISSING) return 0.0;
|
||||
|
||||
// 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;
|
||||
|
||||
// Valve is completely closed so return a large coeff.
|
||||
if (s <= 0.0) return CBIG;
|
||||
|
||||
// Valve has no assigned curve so assume a linear one
|
||||
if (c == 0) kvr = s;
|
||||
|
||||
else
|
||||
{
|
||||
// Valve curve data
|
||||
curve = &net->Curve[c];
|
||||
npts = curve->Npts;
|
||||
x = curve->X; // x = frac. open
|
||||
y = curve->Y; // y = Kv / Kvo
|
||||
|
||||
// s lies below first point of curve
|
||||
if (s < x[0])
|
||||
kvr = s / x[0] * y[0];
|
||||
|
||||
// s lies above last point of curve
|
||||
else if (s > x[npts-1])
|
||||
{
|
||||
k2 = npts - 1;
|
||||
kvr = (s - x[k2]) / (1. - x[k2]) * (1. - y[k2]) + y[k2];
|
||||
}
|
||||
|
||||
// Otherwise interpolate over curve segment that brackets s
|
||||
else
|
||||
{
|
||||
k2 = 0;
|
||||
while (k2 < npts && x[k2] < s) k2++;
|
||||
if (k2 == 0) k2++;
|
||||
else if (k2 == npts) k2--;
|
||||
k1 = k2 - 1;
|
||||
kvr = (y[k2] - y[k1]) / (x[k2] - x[k1]);
|
||||
kvr = y[k1] + kvr * (s - x[k1]);
|
||||
}
|
||||
}
|
||||
|
||||
// kvr can't be > 1 or <= 0
|
||||
kvr = MIN(kvr, 1.0);
|
||||
kvr = MAX(kvr, CSMALL);
|
||||
|
||||
// Convert from Kv ratio to minor loss coeff.
|
||||
km = kmo / (kvr * kvr);
|
||||
km = MIN(km, CBIG);
|
||||
return km;
|
||||
}
|
||||
|
||||
|
||||
void headlosscoeffs(Project *pr)
|
||||
/*
|
||||
**--------------------------------------------------------------
|
||||
@@ -148,6 +234,9 @@ void headlosscoeffs(Project *pr)
|
||||
case TCV:
|
||||
tcvcoeff(pr, k);
|
||||
break;
|
||||
case PCV:
|
||||
pcvcoeff(pr, k);
|
||||
break;
|
||||
case GPV:
|
||||
gpvcoeff(pr, k);
|
||||
break;
|
||||
@@ -945,6 +1034,36 @@ void tcvcoeff(Project *pr, int k)
|
||||
}
|
||||
|
||||
|
||||
void pcvcoeff(Project *pr, int k)
|
||||
/*
|
||||
**--------------------------------------------------------------
|
||||
** Input: k = link index
|
||||
** Output: none
|
||||
** Purpose: computes P & Y coeffs. for positional control valve
|
||||
**--------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
double km;
|
||||
Hydraul *hyd = &pr->hydraul;
|
||||
Slink *link = &pr->network.Link[k];
|
||||
|
||||
// Save original loss coeff. for open valve
|
||||
km = link->Km;
|
||||
|
||||
// If valve not fixed OPEN or CLOSED, compute its loss coeff.
|
||||
if (hyd->LinkSetting[k] != MISSING)
|
||||
{
|
||||
link->Km = link->R;
|
||||
}
|
||||
|
||||
// Then apply usual valve formula
|
||||
valvecoeff(pr, k);
|
||||
|
||||
// Restore original loss coeff.
|
||||
link->Km = km;
|
||||
}
|
||||
|
||||
|
||||
void prvcoeff(Project *pr, int k, int n1, int n2)
|
||||
/*
|
||||
**--------------------------------------------------------------
|
||||
@@ -1035,6 +1154,8 @@ void psvcoeff(Project *pr, int k, int n1, int n2)
|
||||
{
|
||||
sm->F[j] += hyd->Xflow[n1];
|
||||
}
|
||||
sm->Aij[sm->Ndx[k]] -= 1.0 / CBIG; // Preserve connectivity
|
||||
sm->Aii[j] += 1.0 / CBIG;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 03/19/2022
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -449,6 +449,7 @@ void setlinksetting(Project *pr, int index, double value, StatusType *s,
|
||||
else
|
||||
{
|
||||
if (*k == MISSING && *s <= CLOSED) *s = OPEN;
|
||||
if (t == PCV) link->R = pcvlosscoeff(pr, index, link->Kc);
|
||||
*k = value;
|
||||
}
|
||||
}
|
||||
@@ -604,6 +605,7 @@ int controls(Project *pr)
|
||||
{
|
||||
hyd->LinkStatus[k] = s2;
|
||||
hyd->LinkSetting[k] = k2;
|
||||
if (link->Type == PCV) link->R = pcvlosscoeff(pr, k, k2);
|
||||
if (pr->report.Statflag) writecontrolaction(pr,k,i);
|
||||
setsum++;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ Description: updates hydraulic status of network elements
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 05/15/2019
|
||||
Last Updated: 08/08/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -394,6 +394,15 @@ StatusType fcvstatus(Project *pr, int k, StatusType s, double h1, double h2)
|
||||
{
|
||||
status = ACTIVE;
|
||||
}
|
||||
|
||||
// Active valve's loss coeff. can't be < fully open loss coeff.
|
||||
else if (status == ACTIVE)
|
||||
{
|
||||
if ((h1 - h2) / SQR(hyd->LinkFlow[k]) < pr->network.Link[k].Km)
|
||||
{
|
||||
status = XFCV;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Description: saves network data to an EPANET formatted text file
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 10/29/2019
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -312,6 +312,11 @@ int saveinpfile(Project *pr, const char *fname)
|
||||
{
|
||||
sprintf(s1, "%-31s %12.4f", net->Curve[j].ID, km);
|
||||
}
|
||||
// For PCV add loss curve if present
|
||||
else if (link->Type == PCV && (j = net->Valve[i].Curve) > 0)
|
||||
{
|
||||
sprintf(s1, "%12.4f %12.4f %-31s", kc, km, net->Curve[j].ID);
|
||||
}
|
||||
else sprintf(s1, "%12.4f %12.4f", kc, km);
|
||||
fprintf(f, "\n%s %s", s, s1);
|
||||
if (link->Comment) fprintf(f, " ;%s", link->Comment);
|
||||
|
||||
20
src/input3.c
20
src/input3.c
@@ -7,7 +7,7 @@ Description: parses network data from a line of an EPANET input file
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 03/20/2022
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -471,7 +471,7 @@ int valvedata(Project *pr)
|
||||
** Purpose: processes valve data
|
||||
** Format:
|
||||
** [VALVE]
|
||||
** id node1 node2 diam type setting (lcoeff)
|
||||
** id node1 node2 diam type setting (lcoeff lcurve)
|
||||
**--------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
@@ -488,7 +488,8 @@ int valvedata(Project *pr)
|
||||
setting, // Valve setting
|
||||
lcoeff = 0.0; // Minor loss coeff.
|
||||
Slink *link;
|
||||
int err = 0;
|
||||
int err = 0,
|
||||
losscurve = 0; // Loss coeff. curve
|
||||
|
||||
// Add new valve to data base
|
||||
n = parser->Ntokens;
|
||||
@@ -521,6 +522,8 @@ int valvedata(Project *pr)
|
||||
type = TCV;
|
||||
else if (match(parser->Tok[4], w_GPV))
|
||||
type = GPV;
|
||||
else if (match(parser->Tok[4], w_PCV))
|
||||
type = PCV;
|
||||
else
|
||||
return setError(parser, 4, 213);
|
||||
|
||||
@@ -538,6 +541,16 @@ int valvedata(Project *pr)
|
||||
}
|
||||
else if (!getfloat(parser->Tok[5], &setting)) return setError(parser, 5, 202);
|
||||
if (n >= 7 && !getfloat(parser->Tok[6], &lcoeff)) return setError(parser, 6, 202);
|
||||
|
||||
// Find loss coeff. curve for PCV
|
||||
if (type == PCV && n >= 8)
|
||||
{
|
||||
c = findcurve(net, parser->Tok[7]);
|
||||
if (c == 0) return setError(parser, 7, 206);
|
||||
losscurve = c;
|
||||
net->Curve[c].Type = VALVE_CURVE;
|
||||
if (setting > 1.0) setting = 1.0;
|
||||
}
|
||||
|
||||
// Check for illegal connections
|
||||
if (valvecheck(pr, net->Nlinks, type, j1, j2))
|
||||
@@ -563,6 +576,7 @@ int valvedata(Project *pr)
|
||||
link->ResultIndex = 0;
|
||||
link->Comment = xstrcpy(&link->Comment, parser->Comment, MAXMSG);
|
||||
net->Valve[net->Nvalves].Link = net->Nlinks;
|
||||
net->Valve[net->Nvalves].Curve = losscurve;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Description: binary file read/write routines
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 05/13/2019
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -567,6 +567,7 @@ int linkoutput(Project *pr, int j, REAL4 *x, double ucf)
|
||||
case FCV:
|
||||
x[i] = (REAL4)(setting * pr->Ucf[FLOW]); break;
|
||||
case TCV:
|
||||
case PCV:
|
||||
x[i] = (REAL4)setting; break;
|
||||
default: x[i] = 0.0f;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 02/03/2020
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -281,6 +281,8 @@ void initpointers(Project *pr)
|
||||
pr->hydraul.smatrix.NZSUB = NULL;
|
||||
pr->hydraul.smatrix.LNZ = NULL;
|
||||
|
||||
pr->report.reportCallback = NULL;
|
||||
|
||||
initrules(pr);
|
||||
}
|
||||
|
||||
@@ -860,7 +862,7 @@ int findtank(Network *network, int index)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = node index
|
||||
** Output: none
|
||||
** Returns: index of tank with given node id, or NOTFOUND if tank not found
|
||||
** Returns: index of tank with given node index, or NOTFOUND if tank not found
|
||||
** Purpose: for use in the deletenode function
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
@@ -877,7 +879,7 @@ int findpump(Network *network, int index)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = link ID
|
||||
** Output: none
|
||||
** Returns: index of pump with given link id, or NOTFOUND if pump not found
|
||||
** Returns: index of pump with given link index, or NOTFOUND if pump not found
|
||||
** Purpose: for use in the deletelink function
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
@@ -894,7 +896,7 @@ int findvalve(Network *network, int index)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = link ID
|
||||
** Output: none
|
||||
** Returns: index of valve with given link id, or NOTFOUND if valve not found
|
||||
** Returns: index of valve with given link index, or NOTFOUND if valve not found
|
||||
** Purpose: for use in the deletelink function
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
@@ -1010,7 +1012,7 @@ void adjustcurves(Network *network, int index)
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int j, k, setting;
|
||||
int j, k, curve;
|
||||
|
||||
// Adjust tank volume curves
|
||||
for (j = 1; j <= network->Ntanks; j++)
|
||||
@@ -1025,15 +1027,25 @@ void adjustcurves(Network *network, int index)
|
||||
adjustcurve(&network->Pump[j].Ecurve, index);
|
||||
}
|
||||
|
||||
// Adjust GPV curves
|
||||
// Adjust PCV & GPV curves
|
||||
for (j = 1; j <= network->Nvalves; j++)
|
||||
{
|
||||
k = network->Valve[j].Link;
|
||||
if (network->Link[k].Type == PCV)
|
||||
{
|
||||
if ((curve = network->Valve[j].Curve) > 0)
|
||||
{
|
||||
adjustcurve(&curve, index);
|
||||
network->Valve[j].Curve = curve;
|
||||
if (curve == 0)
|
||||
network->Link[k].Kc = 0.0;
|
||||
}
|
||||
}
|
||||
if (network->Link[k].Type == GPV)
|
||||
{
|
||||
setting = INT(network->Link[k].Kc);
|
||||
adjustcurve(&setting, index);
|
||||
network->Link[k].Kc = setting;
|
||||
curve = INT(network->Link[k].Kc);
|
||||
adjustcurve(&curve, index);
|
||||
network->Link[k].Kc = curve;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -885,6 +885,12 @@ void writeline(Project *pr, char *s)
|
||||
**--------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
if (pr->report.reportCallback != NULL)
|
||||
{
|
||||
pr->report.reportCallback(pr->report.reportCallbackUserData, pr, s);
|
||||
return;
|
||||
}
|
||||
|
||||
Report *rpt = &pr->report;
|
||||
|
||||
if (rpt->RptFile == NULL) return;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 07/15/2019
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#define w_FCV "FCV"
|
||||
#define w_TCV "TCV"
|
||||
#define w_GPV "GPV"
|
||||
#define w_PCV "PCV"
|
||||
|
||||
#define w_OPEN "OPEN"
|
||||
#define w_CLOSED "CLOSED"
|
||||
|
||||
14
src/types.h
14
src/types.h
@@ -7,7 +7,7 @@
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 07/11/2020
|
||||
Last Updated: 08/13/2022
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -145,7 +145,8 @@ typedef enum {
|
||||
PBV, // pressure breaker valve
|
||||
FCV, // flow control valve
|
||||
TCV, // throttle control valve
|
||||
GPV // general purpose valve
|
||||
GPV, // general purpose valve
|
||||
PCV // positional control valve
|
||||
} LinkType;
|
||||
|
||||
typedef enum {
|
||||
@@ -166,7 +167,8 @@ typedef enum {
|
||||
PUMP_CURVE, // pump curve
|
||||
EFFIC_CURVE, // efficiency curve
|
||||
HLOSS_CURVE, // head loss curve
|
||||
GENERIC_CURVE // generic curve
|
||||
GENERIC_CURVE, // generic curve
|
||||
VALVE_CURVE // positional valve loss curve
|
||||
} CurveType;
|
||||
|
||||
typedef enum {
|
||||
@@ -455,6 +457,7 @@ typedef struct // Pump Object
|
||||
typedef struct // Valve Object
|
||||
{
|
||||
int Link; // link index of valve
|
||||
int Curve; // positional loss coeff. curve
|
||||
} Svalve;
|
||||
|
||||
typedef struct // Control Statement
|
||||
@@ -629,7 +632,10 @@ typedef struct {
|
||||
Rpt2Fname[MAXFNAME+1], // Secondary report file name
|
||||
DateStamp[26]; // Current date & time
|
||||
|
||||
SField Field[MAXVAR]; // Output reporting fields
|
||||
SField Field[MAXVAR]; // Output reporting fields
|
||||
|
||||
void (*reportCallback)(void*,void*,char*); // user-supplied reporting callback
|
||||
void *reportCallbackUserData; // user-supplied reporting context
|
||||
|
||||
} Report;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user