Merge branch 'rtx-1.1-lib-mods' into lemontiger-rtx
Conflicts: build/Xcode/epanet/epanet.xcodeproj/project.pbxproj include/epanet2.h src/epanet.c src/hydraul.c src/quality.c src/toolkit.h src/types.h src/vars.h
This commit is contained in:
154
src/epanet.c
154
src/epanet.c
@@ -131,8 +131,9 @@ execute function x and set the error code equal to its return value.
|
||||
#include "types.h"
|
||||
#include "enumstxt.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN
|
||||
#include "vars.h"
|
||||
#include "toolkit.h"
|
||||
#include "epanet2.h"
|
||||
|
||||
void (* viewprog) (char *); /* Pointer to progress viewing function */
|
||||
|
||||
@@ -306,6 +307,7 @@ int DLLEXPORT ENopen(char *f1, char *f2, char *f3)
|
||||
/* Free temporary linked lists used for Patterns & Curves */
|
||||
freeTmplist(Patlist);
|
||||
freeTmplist(Curvelist);
|
||||
freeTmplist(Coordlist);
|
||||
|
||||
/* If using previously saved hydraulics then open its file */
|
||||
if (Hydflag == USE) ERRCODE(openhydfile());
|
||||
@@ -963,7 +965,7 @@ int DLLEXPORT ENgetversion(int *v)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetcontrol(int cindex, int *ctype, int *lindex,
|
||||
float *setting, int *nindex, float *level)
|
||||
EN_API_FLOAT_TYPE *setting, int *nindex, EN_API_FLOAT_TYPE *level)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: cindex = control index (position of control statement
|
||||
** in the input file, starting from 1)
|
||||
@@ -1009,9 +1011,9 @@ int DLLEXPORT ENgetcontrol(int cindex, int *ctype, int *lindex,
|
||||
else if (*nindex > 0)
|
||||
lvl = (Control[cindex].Grade - Node[*nindex].El)*Ucf[PRESSURE];
|
||||
else
|
||||
lvl = (float)Control[cindex].Time;
|
||||
*setting = (float)s;
|
||||
*level = (float)lvl;
|
||||
lvl = (EN_API_FLOAT_TYPE)Control[cindex].Time;
|
||||
*setting = (EN_API_FLOAT_TYPE)s;
|
||||
*level = (EN_API_FLOAT_TYPE)lvl;
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1042,7 +1044,7 @@ int DLLEXPORT ENgetcount(int code, int *count)
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENgetoption(int code, float *value)
|
||||
int DLLEXPORT ENgetoption(int code, EN_API_FLOAT_TYPE *value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: code = option code (see TOOLKIT.H)
|
||||
** Output: *value = option value
|
||||
@@ -1052,7 +1054,7 @@ int DLLEXPORT ENgetoption(int code, float *value)
|
||||
*/
|
||||
{
|
||||
double v = 0.0;
|
||||
*value = 0.0f;
|
||||
*value = 0.0;
|
||||
if (!Openflag) return(102);
|
||||
switch (code)
|
||||
{
|
||||
@@ -1068,7 +1070,7 @@ int DLLEXPORT ENgetoption(int code, float *value)
|
||||
break;
|
||||
default: return(251);
|
||||
}
|
||||
*value = (float)v;
|
||||
*value = (EN_API_FLOAT_TYPE)v;
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1184,7 +1186,7 @@ int DLLEXPORT ENgetpatternlen(int index, int *len)
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENgetpatternvalue(int index, int period, float *value)
|
||||
int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of time pattern
|
||||
** period = pattern time period
|
||||
@@ -1194,11 +1196,11 @@ int DLLEXPORT ENgetpatternvalue(int index, int period, float *value)
|
||||
** and pattern
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{ *value = 0.0f;
|
||||
{ *value = 0.0;
|
||||
if (!Openflag) return(102);
|
||||
if (index < 1 || index > Npats) return(205);
|
||||
if (period < 1 || period > Pattern[index].Length) return(251);
|
||||
*value = (float)Pattern[index].F[period-1];
|
||||
*value = (EN_API_FLOAT_TYPE)Pattern[index].F[period-1];
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1333,7 +1335,22 @@ int DLLEXPORT ENgetnodetype(int index, int *code)
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENgetnodevalue(int index, int code, float *value)
|
||||
int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = node index
|
||||
** Output: *x = value of node's coordinate
|
||||
** *x = value of node's coordinate
|
||||
** Returns: error code
|
||||
** Purpose: retrieves coordinate x, y for a node
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*x = Coord[index].X[0];
|
||||
*y = Coord[index].Y[0];
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DLLEXPORT ENgetnodevalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = node index
|
||||
** code = node parameter code (see TOOLKIT.H)
|
||||
@@ -1348,7 +1365,7 @@ int DLLEXPORT ENgetnodevalue(int index, int code, float *value)
|
||||
Psource source;
|
||||
|
||||
/* Check for valid arguments */
|
||||
*value = 0.0f;
|
||||
*value = 0.0;
|
||||
if (!Openflag) return(102);
|
||||
if (index <= 0 || index > Nnodes) return(203);
|
||||
|
||||
@@ -1449,7 +1466,7 @@ int DLLEXPORT ENgetnodevalue(int index, int code, float *value)
|
||||
v = 0.0;
|
||||
if ( index > Njuncs )
|
||||
{
|
||||
v = 4.0/PI*sqrt(Tank[index-Njuncs].A)*Ucf[ELEV];
|
||||
v = sqrt(4.0/PI*Tank[index-Njuncs].A)*Ucf[ELEV];
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1506,7 +1523,7 @@ int DLLEXPORT ENgetnodevalue(int index, int code, float *value)
|
||||
|
||||
default: return(251);
|
||||
}
|
||||
*value = (float)v;
|
||||
*value = (EN_API_FLOAT_TYPE)v;
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1591,7 +1608,7 @@ int DLLEXPORT ENgetlinknodes(int index, int *node1, int *node2)
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENgetlinkvalue(int index, int code, float *value)
|
||||
int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
||||
/*------------------------------------------------------------------
|
||||
** Input: index = link index
|
||||
** code = link parameter code (see TOOLKIT.H)
|
||||
@@ -1604,7 +1621,7 @@ int DLLEXPORT ENgetlinkvalue(int index, int code, float *value)
|
||||
double a,h,q, v = 0.0;
|
||||
|
||||
/* Check for valid arguments */
|
||||
*value = 0.0f;
|
||||
*value = 0.0;
|
||||
if (!Openflag) return(102);
|
||||
if (index <= 0 || index > Nlinks) return(204);
|
||||
|
||||
@@ -1728,14 +1745,12 @@ int DLLEXPORT ENgetlinkvalue(int index, int code, float *value)
|
||||
|
||||
default: return(251);
|
||||
}
|
||||
*value = (float)v;
|
||||
*value = (EN_API_FLOAT_TYPE)v;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float **yValues) // !sph
|
||||
*/
|
||||
int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: curveIndex = curve index
|
||||
** Output: *nValues = number of points on curve
|
||||
@@ -1744,21 +1759,21 @@ int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float *
|
||||
** Returns: error code
|
||||
** Purpose: retrieves end nodes of a specific link
|
||||
**----------------------------------------------------------------
|
||||
*/ /*
|
||||
*/
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
Scurve curve = Curve[curveIndex];
|
||||
int nPoints = curve.Npts;
|
||||
|
||||
float *pointX = calloc(nPoints, sizeof(float));
|
||||
float *pointY = calloc(nPoints, sizeof(float));
|
||||
EN_API_FLOAT_TYPE *pointX = calloc(nPoints, sizeof(EN_API_FLOAT_TYPE));
|
||||
EN_API_FLOAT_TYPE *pointY = calloc(nPoints, sizeof(EN_API_FLOAT_TYPE));
|
||||
|
||||
for (int iPoint = 0; iPoint < nPoints; iPoint++) {
|
||||
double x = curve.X[iPoint] * Ucf[LENGTH];
|
||||
double y = curve.Y[iPoint] * Ucf[VOLUME];
|
||||
pointX[iPoint] = (float)x;
|
||||
pointY[iPoint] = (float)y;
|
||||
pointX[iPoint] = (EN_API_FLOAT_TYPE)x;
|
||||
pointY[iPoint] = (EN_API_FLOAT_TYPE)y;
|
||||
}
|
||||
|
||||
*nValues = nPoints;
|
||||
@@ -1767,7 +1782,7 @@ int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float *
|
||||
|
||||
return err;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------
|
||||
@@ -1777,7 +1792,7 @@ int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float *
|
||||
|
||||
|
||||
int DLLEXPORT ENsetcontrol(int cindex, int ctype, int lindex,
|
||||
float setting, int nindex, float level)
|
||||
EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: cindex = control index (position of control statement
|
||||
** in the input file, starting from 1)
|
||||
@@ -1865,7 +1880,7 @@ int DLLEXPORT ENsetcontrol(int cindex, int ctype, int lindex,
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENsetnodevalue(int index, int code, float v)
|
||||
int DLLEXPORT ENsetnodevalue(int index, int code, EN_API_FLOAT_TYPE v)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = node index
|
||||
** code = node parameter code (see TOOLKIT.H)
|
||||
@@ -2074,7 +2089,7 @@ int DLLEXPORT ENsetnodevalue(int index, int code, float v)
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENsetlinkvalue(int index, int code, float v)
|
||||
int DLLEXPORT ENsetlinkvalue(int index, int code, EN_API_FLOAT_TYPE v)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = link index
|
||||
** code = link parameter code (see TOOLKIT.H)
|
||||
@@ -2261,7 +2276,7 @@ int DLLEXPORT ENaddpattern(char *id)
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENsetpattern(int index, float *f, int n)
|
||||
int DLLEXPORT ENsetpattern(int index, EN_API_FLOAT_TYPE *f, int n)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = time pattern index
|
||||
** *f = array of pattern multipliers
|
||||
@@ -2290,7 +2305,7 @@ int DLLEXPORT ENsetpattern(int index, float *f, int n)
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENsetpatternvalue(int index, int period, float value)
|
||||
int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = time pattern index
|
||||
** period = time pattern period
|
||||
@@ -2321,10 +2336,16 @@ int DLLEXPORT ENsettimeparam(int code, long value)
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
if (OpenHflag || OpenQflag) {
|
||||
// --> there's nothing wrong with changing certain time parameters during a simulation run
|
||||
if (code != EN_DURATION) {
|
||||
// --> there's nothing wrong with changing certain time parameters during a simulation run, or before the run has started.
|
||||
// todo -- how to tell?
|
||||
/*
|
||||
if (code == EN_DURATION || code == EN_HTIME || code == EN_REPORTSTEP || code == EN_DURATION || Htime == 0) {
|
||||
// it's ok
|
||||
}
|
||||
else {
|
||||
return(109);
|
||||
}
|
||||
*/
|
||||
}
|
||||
if (value < 0) return(202);
|
||||
switch(code)
|
||||
@@ -2370,7 +2391,7 @@ int DLLEXPORT ENsettimeparam(int code, long value)
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENsetoption(int code, float v)
|
||||
int DLLEXPORT ENsetoption(int code, EN_API_FLOAT_TYPE v)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: code = option code (see TOOLKIT.H)
|
||||
** v = option value
|
||||
@@ -2721,10 +2742,12 @@ void initpointers()
|
||||
Pattern = NULL;
|
||||
Curve = NULL;
|
||||
Control = NULL;
|
||||
Coord = NULL;
|
||||
|
||||
X = NULL;
|
||||
Patlist = NULL;
|
||||
Curvelist = NULL;
|
||||
Coordlist = NULL;
|
||||
Adjlist = NULL;
|
||||
Aii = NULL;
|
||||
Aij = NULL;
|
||||
@@ -2804,12 +2827,14 @@ int allocdata()
|
||||
Control = (Scontrol *) calloc(MaxControls+1,sizeof(Scontrol));
|
||||
Pattern = (Spattern *) calloc(MaxPats+1, sizeof(Spattern));
|
||||
Curve = (Scurve *) calloc(MaxCurves+1, sizeof(Scurve));
|
||||
Coord = (Scoord *) calloc(MaxNodes+1, sizeof(Scoord));
|
||||
ERRCODE(MEMCHECK(Tank));
|
||||
ERRCODE(MEMCHECK(Pump));
|
||||
ERRCODE(MEMCHECK(Valve));
|
||||
ERRCODE(MEMCHECK(Control));
|
||||
ERRCODE(MEMCHECK(Pattern));
|
||||
ERRCODE(MEMCHECK(Curve));
|
||||
ERRCODE(MEMCHECK(Coord));
|
||||
}
|
||||
|
||||
/* Initialize pointers used in patterns, curves, and demand category lists */
|
||||
@@ -2827,7 +2852,19 @@ int allocdata()
|
||||
Curve[n].X = NULL;
|
||||
Curve[n].Y = NULL;
|
||||
}
|
||||
for (n=0; n<=MaxNodes; n++) Node[n].D = NULL;
|
||||
|
||||
for (n=0; n<=MaxNodes; n++)
|
||||
{
|
||||
// node demand
|
||||
Node[n].D = NULL;
|
||||
/* Allocate memory for coord data */
|
||||
Coord[n].X = (double *) calloc(1, sizeof(double));
|
||||
Coord[n].Y = (double *) calloc(1, sizeof(double));
|
||||
if (Coord[n].X == NULL || Coord[n].Y == NULL) return(101);
|
||||
Coord[n].X[0] = 0;
|
||||
Coord[n].Y[0] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Allocate memory for rule base (see RULES.C) */
|
||||
@@ -3206,22 +3243,27 @@ int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands)
|
||||
*numDemands=n;
|
||||
return 0;
|
||||
}
|
||||
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, float *baseDemand)
|
||||
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *baseDemand)
|
||||
{
|
||||
Pdemand d;
|
||||
int n=0;
|
||||
/* Check for valid arguments */
|
||||
if (!Openflag) return(102);
|
||||
if (nodeIndex <= 0 || nodeIndex > Nnodes) return(203);
|
||||
Pdemand d;
|
||||
int n=1;
|
||||
/* Check for valid arguments */
|
||||
if (!Openflag) return(102);
|
||||
if (nodeIndex <= 0 || nodeIndex > Nnodes) return(203);
|
||||
if (nodeIndex <= Njuncs) {
|
||||
for(d=Node[nodeIndex].D; n<demandIdx && d != NULL; d=d->next) n++;
|
||||
if(n!=demandIdx) return(253);
|
||||
*baseDemand=(float)(d->Base*Ucf[FLOW]);
|
||||
return 0;
|
||||
*baseDemand=(EN_API_FLOAT_TYPE)(d->Base*Ucf[FLOW]);
|
||||
}
|
||||
else {
|
||||
*baseDemand=(EN_API_FLOAT_TYPE)(0.0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIdx, int *pattIdx)
|
||||
{
|
||||
Pdemand d;
|
||||
int n=0;
|
||||
int n=1;
|
||||
/* Check for valid arguments */
|
||||
if (!Openflag) return(102);
|
||||
if (nodeIndex <= 0 || nodeIndex > Nnodes) return(203);
|
||||
@@ -3231,5 +3273,27 @@ int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIdx, int *pattIdx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of time pattern
|
||||
** period = pattern time period
|
||||
** Output: *value = pattern multiplier
|
||||
** Returns: error code
|
||||
** Purpose: retrieves multiplier for a specific time period
|
||||
** and pattern
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{ *value = 0.0;
|
||||
if (!Openflag) return(102);
|
||||
if (index < 1 || index > Npats) return(205);
|
||||
//if (period < 1 || period > Pattern[index].Length) return(251);
|
||||
for (int i=0; i<Pattern[index].Length; i++) {
|
||||
*value+=Pattern[index].F[i];
|
||||
}
|
||||
*value/=(EN_API_FLOAT_TYPE)Pattern[index].Length;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/*************************** END OF EPANET.C ***************************/
|
||||
|
||||
|
||||
@@ -65,11 +65,13 @@ int addnodeID(int, char *); /* Adds node ID to data base */
|
||||
int addlinkID(int, char *); /* Adds link ID to data base */
|
||||
int addpattern(char *); /* Adds pattern to data base */
|
||||
int addcurve(char *); /* Adds curve to data base */
|
||||
int addcoord(char *); /* Adds coord to data base */
|
||||
STmplist *findID(char *, STmplist *); /* Locates ID on linked list */
|
||||
int unlinked(void); /* Checks for unlinked nodes */
|
||||
int getpumpparams(void); /* Computes pump curve coeffs.*/
|
||||
int getpatterns(void); /* Gets pattern data from list*/
|
||||
int getcurves(void); /* Gets curve data from list */
|
||||
int getcoords(void); /* Gets coordinate data from list */
|
||||
int findmatch(char *,char *[]); /* Finds keyword in line */
|
||||
int match(char *, char *); /* Checks for word match */
|
||||
int gettokens(char *); /* Tokenizes input line */
|
||||
@@ -86,6 +88,7 @@ int pumpdata(void); /* Processes pump data */
|
||||
int valvedata(void); /* Processes valve data */
|
||||
int patterndata(void); /* Processes pattern data */
|
||||
int curvedata(void); /* Processes curve data */
|
||||
int coordata(void); /* Processes coordinate data */
|
||||
int demanddata(void); /* Processes demand data */
|
||||
int controldata(void); /* Processes simple controls */
|
||||
int energydata(void); /* Processes energy data */
|
||||
@@ -284,4 +287,4 @@ int saveepilog(void); /* Saves output file epilog */
|
||||
/* ------------ INPFILE.C --------------*/
|
||||
int saveinpfile(char *); /* Saves network to text file */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -58,6 +58,7 @@ AUTHOR: L. Rossman
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN extern
|
||||
#include "vars.h"
|
||||
|
||||
#define QZERO 1.e-6 /* Equivalent to zero flow */
|
||||
@@ -1063,7 +1064,6 @@ void tanklevels(long tstep)
|
||||
else if (Tank[i].V - D[n] <= Tank[i].Vmin) {
|
||||
Tank[i].V = Tank[i].Vmin;
|
||||
}
|
||||
|
||||
H[n] = tankgrade(i,Tank[i].V);
|
||||
}
|
||||
} /* End of tanklevels */
|
||||
|
||||
@@ -31,6 +31,7 @@ data describing a piping network to a file in EPANET's text format.
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN extern
|
||||
#include "vars.h"
|
||||
|
||||
/* Defined in enumstxt.h in EPANET.C */
|
||||
|
||||
@@ -32,6 +32,7 @@ AUTHOR: L. Rossman
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN extern
|
||||
#include "vars.h"
|
||||
|
||||
/*
|
||||
|
||||
136
src/input2.c
136
src/input2.c
@@ -36,6 +36,7 @@ The following utility functions are all called from INPUT3.C
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN extern
|
||||
#include "vars.h"
|
||||
|
||||
#define MAXERRS 10 /* Max. input errors reported */
|
||||
@@ -47,6 +48,7 @@ char *Tok[MAXTOKS]; /* Array of token strings */
|
||||
/* Used in INPUT3.C: */
|
||||
STmplist *PrevPat; /* Pointer to pattern list element */
|
||||
STmplist *PrevCurve; /* Pointer to curve list element */
|
||||
STmplist *PrevCoord; /* Pointer to coordinate list element */
|
||||
|
||||
/* Defined in enumstxt.h in EPANET.C */
|
||||
extern char *SectTxt[]; /* Input section keywords */
|
||||
@@ -77,7 +79,8 @@ int netsize()
|
||||
MaxRules = 0;
|
||||
MaxCurves = 0;
|
||||
sect = -1;
|
||||
|
||||
MaxCoords = 0;
|
||||
|
||||
/* Add a default pattern 0 */
|
||||
MaxPats = -1;
|
||||
addpattern("");
|
||||
@@ -105,20 +108,22 @@ int netsize()
|
||||
|
||||
/* Add to count of current component */
|
||||
switch(sect)
|
||||
{
|
||||
case _JUNCTIONS: MaxJuncs++; break;
|
||||
case _RESERVOIRS:
|
||||
case _TANKS: MaxTanks++; break;
|
||||
case _PIPES: MaxPipes++; break;
|
||||
case _PUMPS: MaxPumps++; break;
|
||||
case _VALVES: MaxValves++; break;
|
||||
case _CONTROLS: MaxControls++; break;
|
||||
case _RULES: addrule(tok); break; /* See RULES.C */
|
||||
case _PATTERNS: errcode = addpattern(tok);
|
||||
break;
|
||||
case _CURVES: errcode = addcurve(tok);
|
||||
break;
|
||||
}
|
||||
{
|
||||
case _JUNCTIONS: MaxJuncs++; break;
|
||||
case _RESERVOIRS:
|
||||
case _TANKS: MaxTanks++; break;
|
||||
case _PIPES: MaxPipes++; break;
|
||||
case _PUMPS: MaxPumps++; break;
|
||||
case _VALVES: MaxValves++; break;
|
||||
case _CONTROLS: MaxControls++; break;
|
||||
case _RULES: addrule(tok); break; /* See RULES.C */
|
||||
case _PATTERNS: errcode = addpattern(tok);
|
||||
break;
|
||||
case _CURVES: errcode = addcurve(tok);
|
||||
break;
|
||||
// case _COORDS: errcode = addcoord(tok); //06.02.2010-woohn
|
||||
// break;
|
||||
}
|
||||
if (errcode) break;
|
||||
}
|
||||
|
||||
@@ -171,6 +176,8 @@ int readdata()
|
||||
Npats = MaxPats;
|
||||
PrevPat = NULL;
|
||||
PrevCurve = NULL;
|
||||
PrevCoord = NULL;
|
||||
|
||||
sect = -1;
|
||||
errsum = 0;
|
||||
|
||||
@@ -238,6 +245,7 @@ int readdata()
|
||||
/* Get pattern & curve data from temp. lists */
|
||||
if (!errcode) errcode = getpatterns();
|
||||
if (!errcode) errcode = getcurves();
|
||||
//if (!errcode) errcode = getcoords();
|
||||
if (!errcode) errcode = getpumpparams();
|
||||
|
||||
/* Free input buffer */
|
||||
@@ -292,7 +300,7 @@ int newline(int sect, char *line)
|
||||
case _OPTIONS: return(optiondata());
|
||||
|
||||
/* Data in these sections are not used for any computations */
|
||||
case _COORDS: return(0);
|
||||
case _COORDS: return (0); //return(coordata());
|
||||
case _LABELS: return(0);
|
||||
case _TAGS: return(0);
|
||||
case _VERTICES: return(0);
|
||||
@@ -512,6 +520,43 @@ int addcurve(char *id)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int addcoord(char *id)
|
||||
/*
|
||||
**-------------------------------------------------------------
|
||||
** Input: id = curve ID label
|
||||
** Output: returns error code
|
||||
** Purpose: adds a new curve to the database
|
||||
**--------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
STmplist *c;
|
||||
|
||||
/* Check if ID is same as last one processed */
|
||||
if (Coordlist != NULL && strcmp(id,Coordlist->ID) == 0) return(0);
|
||||
|
||||
/* Check that coordinate was not already created */
|
||||
if (findID(id,Coordlist) == NULL)
|
||||
{
|
||||
|
||||
/* Update coordinate count & create new list element */
|
||||
(MaxCoords)++;
|
||||
c = (STmplist *) malloc(sizeof(STmplist));
|
||||
if (c == NULL) {
|
||||
return(101);
|
||||
}
|
||||
else {
|
||||
/* Initialize list element properties */
|
||||
// c->i = MaxCoords; // bug! if coordinates are not in the same order as junctions, then this is a BAD assumption
|
||||
// do this later: c->i = findnode(id);
|
||||
strncpy(c->ID,id,MAXID);
|
||||
c->x = NULL;
|
||||
c->y = NULL;
|
||||
c->next = Coordlist;
|
||||
Coordlist = c;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
STmplist *findID(char *id, STmplist *list)
|
||||
/*
|
||||
@@ -704,6 +749,65 @@ int getcurves(void)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int getcoords(void)
|
||||
/*
|
||||
**-----------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: returns error code
|
||||
** Purpose: retrieves curve data from temporary linked list
|
||||
**-----------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int i,j,n;
|
||||
double x;
|
||||
SFloatlist *xFloatList, *yFloatList;
|
||||
STmplist *coordinateList;
|
||||
|
||||
/* Start at head of coordinate list */
|
||||
coordinateList = Coordlist;
|
||||
|
||||
/* Traverse list of coordinates */
|
||||
while (coordinateList != NULL)
|
||||
{
|
||||
// BAD! ---> i = coordinateList->i;
|
||||
i = findnode(coordinateList->ID);
|
||||
if (i >= 1 && i <= MaxNodes)
|
||||
{
|
||||
/* Save coordinate ID */
|
||||
strcpy(Coord[i].ID, coordinateList->ID);
|
||||
|
||||
n = 1; //Coord[i].Npts
|
||||
|
||||
/* Traverse list of x,y data */
|
||||
x = BIG;
|
||||
xFloatList = coordinateList->x;
|
||||
yFloatList = coordinateList->y;
|
||||
j = n - 1;
|
||||
while (xFloatList != NULL && yFloatList != NULL && j >= 0)
|
||||
{
|
||||
|
||||
/* Check that x data is in ascending order */
|
||||
if (xFloatList->value >= x)
|
||||
{
|
||||
sprintf(Msg,ERR230,coordinateList->ID);
|
||||
writeline(Msg);
|
||||
return(200);
|
||||
}
|
||||
x = xFloatList->value;
|
||||
|
||||
/* Save x,y data in Curve structure */
|
||||
Coord[i].X[j] = xFloatList->value;
|
||||
xFloatList = xFloatList->next;
|
||||
Coord[i].Y[j] = yFloatList->value;
|
||||
yFloatList = yFloatList->next;
|
||||
j--;
|
||||
}
|
||||
}
|
||||
coordinateList = coordinateList->next;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int findmatch(char *line, char *keyword[])
|
||||
/*
|
||||
|
||||
56
src/input3.c
56
src/input3.c
@@ -31,6 +31,7 @@ All functions in this module are called from newline() in INPUT2.C.
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN extern
|
||||
#include "vars.h"
|
||||
|
||||
/* Defined in enumstxt.h in EPANET.C */
|
||||
@@ -41,6 +42,8 @@ extern char *Fldname[];
|
||||
extern char *Tok[MAXTOKS];
|
||||
extern STmplist *PrevPat;
|
||||
extern STmplist *PrevCurve;
|
||||
|
||||
extern STmplist *PrevCoord;
|
||||
extern int Ntokens;
|
||||
|
||||
|
||||
@@ -576,6 +579,59 @@ int curvedata()
|
||||
return(0);
|
||||
}
|
||||
|
||||
int coordata()
|
||||
/*
|
||||
**--------------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: returns error code
|
||||
** Purpose: processes coordinate data
|
||||
** Format:
|
||||
** [COORD]
|
||||
** id x y
|
||||
**--------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
double x,y;
|
||||
SFloatlist *fx, *fy;
|
||||
STmplist *c;
|
||||
|
||||
/* Check for valid curve ID */
|
||||
if (Ntokens < 3) return(201);
|
||||
|
||||
if (
|
||||
PrevCoord != NULL &&
|
||||
strcmp(Tok[0],PrevCoord->ID) == 0
|
||||
) c = PrevCoord;
|
||||
else c = findID(Tok[0],Coordlist);
|
||||
|
||||
// c = findID(Tok[0],Coordlist);
|
||||
if (c == NULL) return(205);
|
||||
|
||||
/* Check for valid data */
|
||||
if (!getfloat(Tok[1],&x)) return(202);
|
||||
if (!getfloat(Tok[2],&y)) return(202);
|
||||
|
||||
/* Add new data point to curve's linked list */
|
||||
fx = (SFloatlist *) malloc(sizeof(SFloatlist));
|
||||
fy = (SFloatlist *) malloc(sizeof(SFloatlist));
|
||||
if (fx == NULL || fy == NULL) return(101);
|
||||
fx->value = x;
|
||||
fx->next = c->x;
|
||||
c->x = fx;
|
||||
fy->value = y;
|
||||
fy->next = c->y;
|
||||
c->y = fy;
|
||||
//Curve[c->i].Npts++;
|
||||
|
||||
/* Save the pointer to this curve */
|
||||
PrevCoord = c;
|
||||
return(0);
|
||||
|
||||
/* Save coordn data */
|
||||
//Coord[Njuncs].X = x;
|
||||
//Coord[Njuncs].Y = y;
|
||||
|
||||
} /* end of coordata */
|
||||
|
||||
int demanddata()
|
||||
/*
|
||||
|
||||
@@ -23,6 +23,7 @@ AUTHOR: L. Rossman
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN extern
|
||||
#include "hash.h"
|
||||
#include "vars.h"
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ AUTHOR: L. Rossman
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN extern
|
||||
#include "vars.h"
|
||||
#include "mempool.h"
|
||||
|
||||
@@ -150,8 +151,9 @@ void initqual()
|
||||
for (i=1; i<=Nnodes; i++) C[i] = Node[i].C0;
|
||||
for (i=1; i<=Ntanks; i++) Tank[i].C = Node[Tank[i].Node].C0;
|
||||
for (i=1; i<=Ntanks; i++) Tank[i].V = Tank[i].V0;
|
||||
for (i=1; i<=Nnodes; i++)
|
||||
if (Node[i].S != NULL) Node[i].S->Smass = 0.0;
|
||||
for (i=1; i<=Nnodes; i++) {
|
||||
if (Node[i].S != NULL) Node[i].S->Smass = 0.0;
|
||||
}
|
||||
|
||||
QTankVolumes = calloc(Ntanks, sizeof(double)); // keep track of previous step's tank volumes.
|
||||
QLinkFlow = calloc(Nlinks, sizeof(double)); // keep track of previous step's link flows.
|
||||
@@ -192,7 +194,7 @@ void initqual()
|
||||
|
||||
/* Re-position hydraulics file */
|
||||
if (!OpenHflag) {
|
||||
fseek(HydFile,HydOffset,SEEK_SET);
|
||||
fseek(HydFile,HydOffset,SEEK_SET);
|
||||
}
|
||||
|
||||
|
||||
@@ -245,6 +247,21 @@ int runqual(long *t)
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
// stepwise calculation
|
||||
for (int i=1; i<= Ntanks; ++i) {
|
||||
QTankVolumes[i-1] = Tank[i].V;
|
||||
}
|
||||
|
||||
for (int i=1; i<= Nlinks; ++i)
|
||||
{
|
||||
if (S[i] <= CLOSED) {
|
||||
QLinkFlow[i-1] = Q[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return(errcode);
|
||||
}
|
||||
|
||||
@@ -1080,13 +1097,11 @@ void updatetanks(long dt)
|
||||
for (i=1; i<=Ntanks; i++)
|
||||
{
|
||||
n = Tank[i].Node;
|
||||
|
||||
/* Use initial quality for reservoirs */
|
||||
if (Tank[i].A == 0.0)
|
||||
{
|
||||
C[n] = Node[n].C0;
|
||||
}
|
||||
|
||||
/* Update tank WQ based on mixing model */
|
||||
else {
|
||||
switch(Tank[i].MixModel)
|
||||
|
||||
@@ -38,6 +38,7 @@ formatted string S to the report file.
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN extern
|
||||
#include "vars.h"
|
||||
|
||||
#define MAXCOUNT 10 /* Max. # of disconnected nodes listed */
|
||||
|
||||
@@ -33,6 +33,7 @@ AUTHOR: L. Rossman
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN extern
|
||||
#include "vars.h"
|
||||
|
||||
struct Premise /* Rule Premise Clause */
|
||||
|
||||
@@ -42,6 +42,7 @@ Linsolve() solves the linearized system of hydraulic equations.
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include "funcs.h"
|
||||
#define EXTERN extern
|
||||
#include "vars.h"
|
||||
|
||||
int *Degree; /* Number of links adjacent to each node */
|
||||
|
||||
262
src/toolkit.h
262
src/toolkit.h
@@ -1,262 +0,0 @@
|
||||
/*
|
||||
*******************************************************************
|
||||
|
||||
TOOLKIT.H - Prototypes for EPANET Functions Exported to DLL Toolkit
|
||||
|
||||
VERSION: 2.00
|
||||
DATE: 5/8/00
|
||||
10/25/00
|
||||
3/1/01
|
||||
8/15/07 (2.00.11)
|
||||
2/14/08 (2.00.12)
|
||||
AUTHOR: L. Rossman
|
||||
US EPA - NRMRL
|
||||
|
||||
*******************************************************************
|
||||
*/
|
||||
|
||||
#ifndef TOOLKIT_H
|
||||
#define TOOLKIT_H
|
||||
|
||||
/*** New compile directives ***/ //(2.00.11 - LR)
|
||||
//#define CLE /* Compile as a command line executable */
|
||||
//#define SOL /* Compile as a shared object library */
|
||||
//#define DLL /* Compile as a Windows DLL */
|
||||
|
||||
//#define CLE_LT /* LemonTiger test */ //Jinduan Chen
|
||||
#define DLL_LT /* Compile as a Windows DLL of LemonTiger */
|
||||
#ifdef __APPLE__
|
||||
#define DLLEXPORT
|
||||
#else
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#endif
|
||||
// --- Define the EPANET toolkit constants
|
||||
|
||||
#define EN_ELEVATION 0 /* Node parameters */
|
||||
#define EN_BASEDEMAND 1
|
||||
#define EN_PATTERN 2
|
||||
#define EN_EMITTER 3
|
||||
#define EN_INITQUAL 4
|
||||
#define EN_SOURCEQUAL 5
|
||||
#define EN_SOURCEPAT 6
|
||||
#define EN_SOURCETYPE 7
|
||||
#define EN_TANKLEVEL 8
|
||||
#define EN_DEMAND 9
|
||||
#define EN_HEAD 10
|
||||
#define EN_PRESSURE 11
|
||||
#define EN_QUALITY 12
|
||||
#define EN_SOURCEMASS 13
|
||||
#define EN_INITVOLUME 14
|
||||
#define EN_MIXMODEL 15
|
||||
#define EN_MIXZONEVOL 16
|
||||
|
||||
#define EN_TANKDIAM 17
|
||||
#define EN_MINVOLUME 18
|
||||
#define EN_VOLCURVE 19
|
||||
#define EN_MINLEVEL 20
|
||||
#define EN_MAXLEVEL 21
|
||||
#define EN_MIXFRACTION 22
|
||||
#define EN_TANK_KBULK 23
|
||||
#define EN_TANKVOLUME 24
|
||||
#define EN_MAXVOLUME 25
|
||||
|
||||
#define EN_DIAMETER 0 /* Link parameters */
|
||||
#define EN_LENGTH 1
|
||||
#define EN_ROUGHNESS 2
|
||||
#define EN_MINORLOSS 3
|
||||
#define EN_INITSTATUS 4
|
||||
#define EN_INITSETTING 5
|
||||
#define EN_KBULK 6
|
||||
#define EN_KWALL 7
|
||||
#define EN_FLOW 8
|
||||
#define EN_VELOCITY 9
|
||||
#define EN_HEADLOSS 10
|
||||
#define EN_STATUS 11
|
||||
#define EN_SETTING 12
|
||||
#define EN_ENERGY 13
|
||||
#define EN_LINKQUAL 14 /* TNT */
|
||||
|
||||
#define EN_DURATION 0 /* Time parameters */
|
||||
#define EN_HYDSTEP 1
|
||||
#define EN_QUALSTEP 2
|
||||
#define EN_PATTERNSTEP 3
|
||||
#define EN_PATTERNSTART 4
|
||||
#define EN_REPORTSTEP 5
|
||||
#define EN_REPORTSTART 6
|
||||
#define EN_RULESTEP 7
|
||||
#define EN_STATISTIC 8
|
||||
#define EN_PERIODS 9
|
||||
#define EN_STARTTIME 10 /* Added TNT 10/2/2009 */
|
||||
#define EN_HTIME 11
|
||||
#define EN_HALTFLAG 12
|
||||
#define EN_NEXTEVENT 13
|
||||
|
||||
#define EN_ITERATIONS 0
|
||||
#define EN_RELATIVEERROR 1
|
||||
|
||||
#define EN_NODECOUNT 0 /* Component counts */
|
||||
#define EN_TANKCOUNT 1
|
||||
#define EN_LINKCOUNT 2
|
||||
#define EN_PATCOUNT 3
|
||||
#define EN_CURVECOUNT 4
|
||||
#define EN_CONTROLCOUNT 5
|
||||
|
||||
#define EN_JUNCTION 0 /* Node types */
|
||||
#define EN_RESERVOIR 1
|
||||
#define EN_TANK 2
|
||||
|
||||
#define EN_CVPIPE 0 /* Link types. */
|
||||
#define EN_PIPE 1 /* See LinkType in TYPES.H */
|
||||
#define EN_PUMP 2
|
||||
#define EN_PRV 3
|
||||
#define EN_PSV 4
|
||||
#define EN_PBV 5
|
||||
#define EN_FCV 6
|
||||
#define EN_TCV 7
|
||||
#define EN_GPV 8
|
||||
|
||||
#define EN_NONE 0 /* Quality analysis types. */
|
||||
#define EN_CHEM 1 /* See QualType in TYPES.H */
|
||||
#define EN_AGE 2
|
||||
#define EN_TRACE 3
|
||||
|
||||
#define EN_CONCEN 0 /* Source quality types. */
|
||||
#define EN_MASS 1 /* See SourceType in TYPES.H. */
|
||||
#define EN_SETPOINT 2
|
||||
#define EN_FLOWPACED 3
|
||||
|
||||
#define EN_CFS 0 /* Flow units types. */
|
||||
#define EN_GPM 1 /* See FlowUnitsType */
|
||||
#define EN_MGD 2 /* in TYPES.H. */
|
||||
#define EN_IMGD 3
|
||||
#define EN_AFD 4
|
||||
#define EN_LPS 5
|
||||
#define EN_LPM 6
|
||||
#define EN_MLD 7
|
||||
#define EN_CMH 8
|
||||
#define EN_CMD 9
|
||||
|
||||
#define EN_TRIALS 0 /* Misc. options */
|
||||
#define EN_ACCURACY 1
|
||||
#define EN_TOLERANCE 2
|
||||
#define EN_EMITEXPON 3
|
||||
#define EN_DEMANDMULT 4
|
||||
|
||||
#define EN_LOWLEVEL 0 /* Control types. */
|
||||
#define EN_HILEVEL 1 /* See ControlType */
|
||||
#define EN_TIMER 2 /* in TYPES.H. */
|
||||
#define EN_TIMEOFDAY 3
|
||||
|
||||
#define EN_AVERAGE 1 /* Time statistic types. */
|
||||
#define EN_MINIMUM 2 /* See TstatType in TYPES.H */
|
||||
#define EN_MAXIMUM 3
|
||||
#define EN_RANGE 4
|
||||
|
||||
#define EN_MIX1 0 /* Tank mixing models */
|
||||
#define EN_MIX2 1
|
||||
#define EN_FIFO 2
|
||||
#define EN_LIFO 3
|
||||
|
||||
#define EN_NOSAVE 0 /* Save-results-to-file flag */
|
||||
#define EN_SAVE 1
|
||||
|
||||
#define EN_INITFLOW 10 /* Re-initialize flows flag */
|
||||
|
||||
|
||||
// --- Declare the EPANET toolkit functions
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
int DLLEXPORT ENepanet(char *, char *, char *, void (*) (char *));
|
||||
|
||||
int DLLEXPORT ENopen(char *, char *, char *);
|
||||
int DLLEXPORT ENsaveinpfile(char *);
|
||||
int DLLEXPORT ENclose(void);
|
||||
|
||||
int DLLEXPORT ENsolveH(void);
|
||||
int DLLEXPORT ENsaveH(void);
|
||||
int DLLEXPORT ENopenH(void);
|
||||
int DLLEXPORT ENinitH(int);
|
||||
int DLLEXPORT ENrunH(long *);
|
||||
int DLLEXPORT ENnextH(long *tstep);
|
||||
int DLLEXPORT ENcloseH(void);
|
||||
int DLLEXPORT ENsavehydfile(char *);
|
||||
int DLLEXPORT ENusehydfile(char *);
|
||||
|
||||
int DLLEXPORT ENsolveQ(void);
|
||||
int DLLEXPORT ENopenQ(void);
|
||||
int DLLEXPORT ENinitQ(int);
|
||||
int DLLEXPORT ENrunQ(long *);
|
||||
int DLLEXPORT ENnextQ(long *);
|
||||
int DLLEXPORT ENstepQ(long *);
|
||||
int DLLEXPORT ENcloseQ(void);
|
||||
|
||||
int DLLEXPORT ENwriteline(char *);
|
||||
int DLLEXPORT ENreport(void);
|
||||
int DLLEXPORT ENresetreport(void);
|
||||
int DLLEXPORT ENsetreport(char *);
|
||||
|
||||
int DLLEXPORT ENgetcontrol(int, int *, int *, float *,
|
||||
int *, float *);
|
||||
int DLLEXPORT ENgetcount(int, int *);
|
||||
int DLLEXPORT ENgetoption(int, float *);
|
||||
int DLLEXPORT ENgettimeparam(int, long *);
|
||||
int DLLEXPORT ENgetflowunits(int *);
|
||||
int DLLEXPORT ENgetpatternindex(char *, int *);
|
||||
int DLLEXPORT ENgetpatternid(int, char *);
|
||||
int DLLEXPORT ENgetpatternlen(int, int *);
|
||||
int DLLEXPORT ENgetpatternvalue(int, int, float *);
|
||||
int DLLEXPORT ENgetqualtype(int *, int *);
|
||||
int DLLEXPORT ENgeterror(int, char *, int);
|
||||
int DLLEXPORT ENgetstatistic(int code, int* value);
|
||||
|
||||
int DLLEXPORT ENgetnodeindex(char *, int *);
|
||||
int DLLEXPORT ENgetnodeid(int, char *);
|
||||
int DLLEXPORT ENgetnodetype(int, int *);
|
||||
int DLLEXPORT ENgetnodevalue(int, int, float *);
|
||||
|
||||
int DLLEXPORT ENgetnumdemands(int, int *);
|
||||
int DLLEXPORT ENgetbasedemand(int, int, float *);
|
||||
int DLLEXPORT ENgetdemandpattern(int, int, int *);
|
||||
|
||||
int DLLEXPORT ENgetlinkindex(char *, int *);
|
||||
int DLLEXPORT ENgetlinkid(int, char *);
|
||||
int DLLEXPORT ENgetlinktype(int, int *);
|
||||
int DLLEXPORT ENgetlinknodes(int, int *, int *);
|
||||
int DLLEXPORT ENgetlinkvalue(int, int, float *);
|
||||
|
||||
int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float **yValues);
|
||||
|
||||
int DLLEXPORT ENgetversion(int *);
|
||||
|
||||
int DLLEXPORT ENsetcontrol(int, int, int, float, int, float);
|
||||
int DLLEXPORT ENsetnodevalue(int, int, float);
|
||||
int DLLEXPORT ENsetlinkvalue(int, int, float);
|
||||
int DLLEXPORT ENaddpattern(char *);
|
||||
int DLLEXPORT ENsetpattern(int, float *, int);
|
||||
int DLLEXPORT ENsetpatternvalue(int, int, float);
|
||||
int DLLEXPORT ENsettimeparam(int, long);
|
||||
int DLLEXPORT ENsetoption(int, float);
|
||||
int DLLEXPORT ENsetstatusreport(int);
|
||||
int DLLEXPORT ENsetqualtype(int, char *, char *, char *);
|
||||
|
||||
//LemonTiger functions
|
||||
/* See testLT.c for a LemonTiger test */
|
||||
|
||||
//LT equivalent to ENopenH() + ENopenQ() + ENinitH() + ENinitQ()
|
||||
int DLLEXPORT ENopeninitHQ();
|
||||
|
||||
//LT equivalent to ENrunQ() + ENnextQ();
|
||||
int DLLEXPORT ENrunnextHQ(long*, long*);
|
||||
|
||||
//LT equivalent to ENrunQ() + ENstepQ();
|
||||
int DLLEXPORT ENrunstepHQ(long*, long*);
|
||||
|
||||
//LT equivalent to ENcloseH() + ENcloseQ();
|
||||
int DLLEXPORT ENcloseHQ();
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //TOOLKIT_H
|
||||
@@ -167,6 +167,13 @@ typedef struct /* CURVE OBJECT */
|
||||
double *Y; /* Y-values */
|
||||
} Scurve;
|
||||
|
||||
typedef struct /* Coord OBJECT */
|
||||
{
|
||||
char ID[MAXID+1]; /* Coord ID */
|
||||
double *X; /* X-values */
|
||||
double *Y; /* Y-values */
|
||||
} Scoord;
|
||||
|
||||
struct Sdemand /* DEMAND CATEGORY OBJECT */
|
||||
{
|
||||
double Base; /* Baseline demand */
|
||||
@@ -208,7 +215,7 @@ typedef struct /* LINK OBJECT */
|
||||
double Kb; /* Bulk react. coeff */
|
||||
double Kw; /* Wall react. coeff */
|
||||
double R; /* Flow resistance */
|
||||
double Rc; /* Reaction cal */ //woohn 2/11/13
|
||||
double Rc; /* Reaction cal */
|
||||
char Type; /* Link type */
|
||||
char Stat; /* Initial status */
|
||||
char Rpt; /* Reporting flag */
|
||||
|
||||
38
src/vars.h
38
src/vars.h
@@ -76,6 +76,7 @@ AUTHOR: L. Rossman
|
||||
MaxRules, /* Rule count */
|
||||
MaxPats, /* Pattern count */
|
||||
MaxCurves, /* Curve count */
|
||||
MaxCoords, /* Coords count */
|
||||
Nnodes, /* Number of network nodes */
|
||||
Ntanks, /* Number of tanks */
|
||||
Njuncs, /* Number of junction nodes */
|
||||
@@ -87,6 +88,7 @@ AUTHOR: L. Rossman
|
||||
Nrules, /* Number of control rules */
|
||||
Npats, /* Number of time patterns */
|
||||
Ncurves, /* Number of data curves */
|
||||
Ncoords, /* Number of Coords */
|
||||
Nperiods, /* Number of reporting periods */
|
||||
Ncoeffs, /* Number of non-0 matrix coeffs*/
|
||||
DefPat, /* Default demand pattern */
|
||||
@@ -151,23 +153,25 @@ AUTHOR: L. Rossman
|
||||
*Q, /* Link flows */
|
||||
*R, /* Pipe reaction rate */
|
||||
*X, /* General purpose array */
|
||||
*XC; /* General Purpose array - WQ */
|
||||
double *H; /* Node heads */
|
||||
double *QTankVolumes;
|
||||
double *QLinkFlow; //woohn 03112013
|
||||
STmplist *Patlist; /* Temporary time pattern list */
|
||||
STmplist *Curvelist; /* Temporary list of curves */
|
||||
Spattern *Pattern; /* Time patterns */
|
||||
Scurve *Curve; /* Curve data */
|
||||
Snode *Node; /* Node data */
|
||||
Slink *Link; /* Link data */
|
||||
Stank *Tank; /* Tank data */
|
||||
Spump *Pump; /* Pump data */
|
||||
Svalve *Valve; /* Valve data */
|
||||
Scontrol *Control; /* Control data */
|
||||
HTtable *Nht, *Lht; /* Hash tables for ID labels */
|
||||
Padjlist *Adjlist; /* Node adjacency lists */
|
||||
int _relativeError, _iterations; /* Info about hydraulic solution */
|
||||
*XC; /* General purpose array */
|
||||
EXTERN double *H; /* Node heads */
|
||||
EXTERN double *QTankVolumes;
|
||||
EXTERN double *QLinkFlow;
|
||||
EXTERN STmplist *Patlist; /* Temporary time pattern list */
|
||||
EXTERN STmplist *Curvelist; /* Temporary list of curves */
|
||||
EXTERN STmplist *Coordlist; /* Temporary list of coordinates*/
|
||||
EXTERN Spattern *Pattern; /* Time patterns */
|
||||
EXTERN Scurve *Curve; /* Curve data */
|
||||
EXTERN Scoord *Coord; /* Coordinate data */
|
||||
EXTERN Snode *Node; /* Node data */
|
||||
EXTERN Slink *Link; /* Link data */
|
||||
EXTERN Stank *Tank; /* Tank data */
|
||||
EXTERN Spump *Pump; /* Pump data */
|
||||
EXTERN Svalve *Valve; /* Valve data */
|
||||
EXTERN Scontrol *Control; /* Control data */
|
||||
EXTERN HTtable *Nht, *Lht; /* Hash tables for ID labels */
|
||||
EXTERN Padjlist *Adjlist; /* Node adjacency lists */
|
||||
EXTERN int _relativeError, _iterations; /* Info about hydraulic solution */
|
||||
|
||||
/*
|
||||
** NOTE: Hydraulic analysis of the pipe network at a given point in time
|
||||
|
||||
Reference in New Issue
Block a user