OWA-EPANET Toolkit  2.2
epanet2_2.h
Go to the documentation of this file.
1 
5 /*
6  ******************************************************************************
7  Project: OWA EPANET
8  Version: 2.2
9  Module: epanet2.h
10  Description: API function declarations
11  Authors: see AUTHORS
12  Copyright: see AUTHORS
13  License: see LICENSE
14  Last Updated: 10/29/2019
15  ******************************************************************************
16  */
17 
18 #ifndef EPANET2_2_H
19 #define EPANET2_2_H
20 
21 #ifdef epanet_py_EXPORTS
22  #define DLLEXPORT
23 #else
24  #ifndef DLLEXPORT
25  #ifdef _WIN32
26  #ifdef epanet2_EXPORTS
27  #define DLLEXPORT __declspec(dllexport) __stdcall
28  #else
29  #define DLLEXPORT __declspec(dllimport) __stdcall
30  #endif
31  #elif defined(__CYGWIN__)
32  #define DLLEXPORT __stdcall
33  #else
34  #define DLLEXPORT
35  #endif
36  #endif
37 #endif
38 
39 #include "epanet2_enums.h"
40 
41 // --- Declare the EPANET toolkit functions
42 #if defined(__cplusplus)
43 extern "C" {
44 #endif
45 
49 typedef struct Project *EN_Project;
50 
51 /********************************************************************
52 
53  Project Functions
54 
55 ********************************************************************/
56 
64  int DLLEXPORT EN_createproject(EN_Project *ph);
65 
73  int DLLEXPORT EN_deleteproject(EN_Project ph);
74 
96  int DLLEXPORT EN_runproject(EN_Project ph, const char *inpFile, const char *rptFile,
97  const char *outFile, void (*pviewprog)(char *));
98 
112  int DLLEXPORT EN_init(EN_Project ph, const char *rptFile, const char *outFile,
113  int unitsType, int headLossType);
114 
126  int DLLEXPORT EN_open(EN_Project ph, const char *inpFile, const char *rptFile,
127  const char *outFile);
128 
137  int DLLEXPORT EN_gettitle(EN_Project ph, char *out_line1, char *out_line2, char *out_line3);
138 
147  int DLLEXPORT EN_settitle(EN_Project ph, char *line1, char *line2, char *line3);
148 
157  int DLLEXPORT EN_getcomment(EN_Project ph, int object, int index, char *out_comment);
158 
167  int DLLEXPORT EN_setcomment(EN_Project ph, int object, int index, char *comment);
168 
176  int DLLEXPORT EN_getcount(EN_Project ph, int object, int *count);
177 
184  int DLLEXPORT EN_saveinpfile(EN_Project ph, const char *filename);
185 
195  int DLLEXPORT EN_close(EN_Project ph);
196 
197  /********************************************************************
198 
199  Hydraulic Analysis Functions
200 
201  ********************************************************************/
202 
229  int DLLEXPORT EN_solveH(EN_Project ph);
230 
243  int DLLEXPORT EN_usehydfile(EN_Project ph, const char *filename);
244 
258  int DLLEXPORT EN_openH(EN_Project ph);
259 
286  int DLLEXPORT EN_initH(EN_Project ph, int initFlag);
287 
302  int DLLEXPORT EN_runH(EN_Project ph, long *currentTime);
303 
336  int DLLEXPORT EN_nextH(EN_Project ph, long *tStep);
337 
348  int DLLEXPORT EN_saveH(EN_Project ph);
349 
366  int DLLEXPORT EN_savehydfile(EN_Project ph, const char *filename);
367 
375  int DLLEXPORT EN_closeH(EN_Project ph);
376 
377  /********************************************************************
378 
379  Water Quality Analysis Functions
380 
381  ********************************************************************/
382 
400  int DLLEXPORT EN_solveQ(EN_Project ph);
401 
415  int DLLEXPORT EN_openQ(EN_Project ph);
416 
431  int DLLEXPORT EN_initQ(EN_Project ph, int saveFlag);
432 
452  int DLLEXPORT EN_runQ(EN_Project ph, long *currentTime);
453 
484  int DLLEXPORT EN_nextQ(EN_Project ph, long *tStep);
485 
500  int DLLEXPORT EN_stepQ(EN_Project ph, long *timeLeft);
501 
512  int DLLEXPORT EN_closeQ(EN_Project ph);
513 
514  /********************************************************************
515 
516  Reporting Functions
517 
518  ********************************************************************/
519 
526  int DLLEXPORT EN_writeline(EN_Project ph, char *line);
527 
540  int DLLEXPORT EN_report(EN_Project ph);
541 
551  int DLLEXPORT EN_copyreport(EN_Project ph, char *filename);
552 
558  int DLLEXPORT EN_clearreport(EN_Project ph);
559 
575  int DLLEXPORT EN_resetreport(EN_Project ph);
576 
589  int DLLEXPORT EN_setreport(EN_Project ph, char *format);
590 
609  int DLLEXPORT EN_setstatusreport(EN_Project ph, int level);
610 
619  int DLLEXPORT EN_getversion(int *version);
620 
630  int DLLEXPORT EN_geterror(int errcode, char *out_errmsg, int maxLen);
631 
639  int DLLEXPORT EN_getstatistic(EN_Project ph, int type, double* value);
640 
655  int DLLEXPORT EN_getresultindex(EN_Project ph, int type, int index, int *value);
656 
657  /********************************************************************
658 
659  Analysis Options Functions
660 
661  ********************************************************************/
662 
670  int DLLEXPORT EN_getoption(EN_Project ph, int option, double *value);
671 
680  int DLLEXPORT EN_setoption(EN_Project ph, int option, double value);
681 
691  int DLLEXPORT EN_getflowunits(EN_Project ph, int *units);
692 
702  int DLLEXPORT EN_setflowunits(EN_Project ph, int units);
703 
711  int DLLEXPORT EN_gettimeparam(EN_Project ph, int param, long *value);
712 
720  int DLLEXPORT EN_settimeparam(EN_Project ph, int param, long value);
721 
731  int DLLEXPORT EN_getqualinfo(EN_Project ph, int *qualType, char *out_chemName,
732  char *out_chemUnits, int *traceNode);
733 
741  int DLLEXPORT EN_getqualtype(EN_Project ph, int *qualType, int *traceNode);
742 
757  int DLLEXPORT EN_setqualtype(EN_Project ph, int qualType, char *chemName,
758  char *chemUnits, char *traceNode);
759 
760  /********************************************************************
761 
762  Node Functions
763 
764  ********************************************************************/
765 
776  int DLLEXPORT EN_addnode(EN_Project ph, char *id, int nodeType, int *index);
777 
791  int DLLEXPORT EN_deletenode(EN_Project ph, int index, int actionCode);
792 
800  int DLLEXPORT EN_getnodeindex(EN_Project ph, char *id, int *index);
801 
811  int DLLEXPORT EN_getnodeid(EN_Project ph, int index, char *out_id);
812 
822  int DLLEXPORT EN_setnodeid(EN_Project ph, int index, char *newid);
823 
831  int DLLEXPORT EN_getnodetype(EN_Project ph, int index, int *nodeType);
832 
844  int DLLEXPORT EN_getnodevalue(EN_Project ph, int index, int property, double *value);
845 
856  int DLLEXPORT EN_setnodevalue(EN_Project ph, int index, int property, double value);
857 
869  int DLLEXPORT EN_setjuncdata(EN_Project ph, int index, double elev, double dmnd,
870  char *dmndpat);
871 
887  int DLLEXPORT EN_settankdata(EN_Project ph, int index, double elev, double initlvl,
888  double minlvl, double maxlvl, double diam, double minvol, char *volcurve);
889 
898  int DLLEXPORT EN_getcoord(EN_Project ph, int index, double *x, double *y);
899 
908  int DLLEXPORT EN_setcoord(EN_Project ph, int index, double x, double y);
909 
910  /********************************************************************
911 
912  Nodal Demand Functions
913 
914  ********************************************************************/
915 
927  int DLLEXPORT EN_getdemandmodel(EN_Project ph, int *type, double *pmin,
928  double *preq, double *pexp);
929 
949  int DLLEXPORT EN_setdemandmodel(EN_Project ph, int type, double pmin,
950  double preq, double pexp);
951 
952 
965  int DLLEXPORT EN_adddemand(EN_Project ph, int nodeIndex, double baseDemand,
966  char *demandPattern, char *demandName);
967 
975  int DLLEXPORT EN_deletedemand(EN_Project ph, int nodeIndex, int demandIndex);
976 
985  int DLLEXPORT EN_getdemandindex(EN_Project ph, int nodeIndex, char *demandName,
986  int *demandIndex);
987 
995  int DLLEXPORT EN_getnumdemands(EN_Project ph, int nodeIndex, int *numDemands);
996 
1005  int DLLEXPORT EN_getbasedemand(EN_Project ph, int nodeIndex, int demandIndex,
1006  double *baseDemand);
1007 
1016  int DLLEXPORT EN_setbasedemand(EN_Project ph, int nodeIndex, int demandIndex,
1017  double baseDemand);
1018 
1030  int DLLEXPORT EN_getdemandpattern(EN_Project ph, int nodeIndex, int demandIndex,
1031  int *patIndex);
1032 
1044  int DLLEXPORT EN_setdemandpattern(EN_Project ph, int nodeIndex, int demandIndex, int patIndex);
1045 
1056  int DLLEXPORT EN_getdemandname(EN_Project ph, int nodeIndex, int demandIndex, char *out_demandName);
1057 
1068  int DLLEXPORT EN_setdemandname(EN_Project ph, int nodeIndex, int demandIdx, char *demandName);
1069 
1070  /********************************************************************
1071 
1072  Link Functions
1073 
1074  ********************************************************************/
1075 
1101  int DLLEXPORT EN_addlink(EN_Project ph, char *id, int linkType, char *fromNode,
1102  char *toNode, int *index);
1103 
1115  int DLLEXPORT EN_deletelink(EN_Project ph, int index, int actionCode);
1116 
1124  int DLLEXPORT EN_getlinkindex(EN_Project ph, char *id, int *index);
1125 
1135  int DLLEXPORT EN_getlinkid(EN_Project ph, int index, char *out_id);
1136 
1146  int DLLEXPORT EN_setlinkid(EN_Project ph, int index, char *newid);
1147 
1155  int DLLEXPORT EN_getlinktype(EN_Project ph, int index, int *linkType);
1156 
1170  int DLLEXPORT EN_setlinktype(EN_Project ph, int *inout_index, int linkType, int actionCode);
1171 
1180  int DLLEXPORT EN_getlinknodes(EN_Project ph, int index, int *node1, int *node2);
1181 
1190  int DLLEXPORT EN_setlinknodes(EN_Project ph, int index, int node1, int node2);
1191 
1202  int DLLEXPORT EN_getlinkvalue(EN_Project ph, int index, int property, double *value);
1203 
1214  int DLLEXPORT EN_setlinkvalue(EN_Project ph, int index, int property, double value);
1215 
1228  int DLLEXPORT EN_setpipedata(EN_Project ph, int index, double length, double diam,
1229  double rough, double mloss);
1230 
1238  int DLLEXPORT EN_getvertexcount(EN_Project ph, int index, int *count);
1239 
1249  int DLLEXPORT EN_getvertex(EN_Project ph, int index, int vertex, double *x, double *y);
1250 
1262  int DLLEXPORT EN_setvertices(EN_Project ph, int index, double *x, double *y, int count);
1263 
1264  /********************************************************************
1265 
1266  Pump Functions
1267 
1268  ********************************************************************/
1269 
1277  int DLLEXPORT EN_getpumptype(EN_Project ph, int linkIndex, int *pumpType);
1278 
1286  int DLLEXPORT EN_getheadcurveindex(EN_Project ph, int linkIndex, int *curveIndex);
1287 
1295  int DLLEXPORT EN_setheadcurveindex(EN_Project ph, int linkIndex, int curveIndex);
1296 
1297  /********************************************************************
1298 
1299  Time Pattern Functions
1300 
1301  ********************************************************************/
1302 
1311  int DLLEXPORT EN_addpattern(EN_Project ph, char *id);
1312 
1319  int DLLEXPORT EN_deletepattern(EN_Project ph, int index);
1320 
1328  int DLLEXPORT EN_getpatternindex(EN_Project ph, char *id, int *index);
1329 
1339  int DLLEXPORT EN_getpatternid(EN_Project ph, int index, char *out_id);
1340 
1350  int DLLEXPORT EN_setpatternid(EN_Project ph, int index, char *id);
1351 
1359  int DLLEXPORT EN_getpatternlen(EN_Project ph, int index, int *len);
1360 
1369  int DLLEXPORT EN_getpatternvalue(EN_Project ph, int index, int period, double *value);
1370 
1379  int DLLEXPORT EN_setpatternvalue(EN_Project ph, int index, int period, double value);
1380 
1388  int DLLEXPORT EN_getaveragepatternvalue(EN_Project ph, int index, double *value);
1389 
1403  int DLLEXPORT EN_setpattern(EN_Project ph, int index, double *values, int len);
1404 
1405  /********************************************************************
1406 
1407  Data Curve Functions
1408 
1409  ********************************************************************/
1410 
1419  int DLLEXPORT EN_addcurve(EN_Project ph, char *id);
1420 
1427  int DLLEXPORT EN_deletecurve(EN_Project ph, int index);
1428 
1436  int DLLEXPORT EN_getcurveindex(EN_Project ph, char *id, int *index);
1437 
1447  int DLLEXPORT EN_getcurveid(EN_Project ph, int index, char *out_id);
1448 
1458  int DLLEXPORT EN_setcurveid(EN_Project ph, int index, char *id);
1459 
1467  int DLLEXPORT EN_getcurvelen(EN_Project ph, int index, int *len);
1468 
1476  int DLLEXPORT EN_getcurvetype(EN_Project ph, int index, int *type);
1477 
1487  int DLLEXPORT EN_getcurvevalue(EN_Project ph, int curveIndex, int pointIndex,
1488  double *x, double *y);
1489 
1499  int DLLEXPORT EN_setcurvevalue(EN_Project ph, int curveIndex, int pointIndex,
1500  double x, double y);
1501 
1516  int DLLEXPORT EN_getcurve(EN_Project ph, int index, char *out_id, int *nPoints,
1517  double *xValues, double *yValues);
1518 
1533  int DLLEXPORT EN_setcurve(EN_Project ph, int index, double *xValues,
1534  double *yValues, int nPoints);
1535 
1536  /********************************************************************
1537 
1538  Simple Controls Functions
1539 
1540  ********************************************************************/
1541 
1555  int DLLEXPORT EN_addcontrol(EN_Project ph, int type, int linkIndex,
1556  double setting, int nodeIndex, double level, int *index);
1557 
1564  int DLLEXPORT EN_deletecontrol(EN_Project ph, int index);
1565 
1579  int DLLEXPORT EN_getcontrol(EN_Project ph, int index, int *type, int *linkIndex,
1580  double *setting, int *nodeIndex, double *level);
1581 
1595  int DLLEXPORT EN_setcontrol(EN_Project ph, int index, int type, int linkIndex,
1596  double setting, int nodeIndex, double level);
1597 
1598 
1599  /********************************************************************
1600 
1601  Rule-Based Controls Functions
1602 
1603  ********************************************************************/
1604 
1614  int DLLEXPORT EN_addrule(EN_Project ph, char *rule);
1615 
1622  int DLLEXPORT EN_deleterule(EN_Project ph, int index);
1623 
1634  int DLLEXPORT EN_getrule(EN_Project ph, int index, int *nPremises,
1635  int *nThenActions, int *nElseActions, double *priority);
1636 
1646  int DLLEXPORT EN_getruleID(EN_Project ph, int index, char *out_id);
1647 
1664  int DLLEXPORT EN_getpremise(EN_Project ph, int ruleIndex, int premiseIndex,
1665  int *logop, int *object, int *objIndex, int *variable,
1666  int *relop, int *status, double *value);
1667 
1683  int DLLEXPORT EN_setpremise(EN_Project ph, int ruleIndex, int premiseIndex,
1684  int logop, int object, int objIndex, int variable, int relop,
1685  int status, double value);
1686 
1695  int DLLEXPORT EN_setpremiseindex(EN_Project ph, int ruleIndex, int premiseIndex,
1696  int objIndex);
1697 
1707  int DLLEXPORT EN_setpremisestatus(EN_Project ph, int ruleIndex, int premiseIndex,
1708  int status);
1709 
1718  int DLLEXPORT EN_setpremisevalue(EN_Project ph, int ruleIndex, int premiseIndex,
1719  double value);
1720 
1731  int DLLEXPORT EN_getthenaction(EN_Project ph, int ruleIndex, int actionIndex,
1732  int *linkIndex, int *status, double *setting);
1733 
1744  int DLLEXPORT EN_setthenaction(EN_Project ph, int ruleIndex, int actionIndex,
1745  int linkIndex, int status, double setting);
1746 
1757  int DLLEXPORT EN_getelseaction(EN_Project ph, int ruleIndex, int actionIndex,
1758  int *linkIndex, int *status, double *setting);
1759 
1770  int DLLEXPORT EN_setelseaction(EN_Project ph, int ruleIndex, int actionIndex,
1771  int linkIndex, int status, double setting);
1772 
1780  int DLLEXPORT EN_setrulepriority(EN_Project ph, int index, double priority);
1781 
1782 #if defined(__cplusplus)
1783 }
1784 #endif
1785 
1786 #endif //EPANET2_2_H
EN_getbasedemand
int EN_getbasedemand(EN_Project ph, int nodeIndex, int demandIndex, double *baseDemand)
Gets the base demand for one of a node's demand categories.
EN_settimeparam
int EN_settimeparam(EN_Project ph, int param, long value)
Sets the value of a time parameter.
EN_getstatistic
int EN_getstatistic(EN_Project ph, int type, double *value)
Retrieves a particular simulation statistic.
epanet2_enums.h
EN_setdemandpattern
int EN_setdemandpattern(EN_Project ph, int nodeIndex, int demandIndex, int patIndex)
Sets the index of a time pattern used for one of a node's demand categories.
EN_usehydfile
int EN_usehydfile(EN_Project ph, const char *filename)
Uses a previously saved binary hydraulics file to supply a project's hydraulics.
EN_setpatternvalue
int EN_setpatternvalue(EN_Project ph, int index, int period, double value)
Sets a time pattern's factor for a given time period.
EN_savehydfile
int EN_savehydfile(EN_Project ph, const char *filename)
Saves a project's temporary hydraulics file to disk.
EN_copyreport
int EN_copyreport(EN_Project ph, char *filename)
Copies the current contents of a project's report file to another file.
EN_addpattern
int EN_addpattern(EN_Project ph, char *id)
Adds a new time pattern to a project.
EN_gettimeparam
int EN_gettimeparam(EN_Project ph, int param, long *value)
Retrieves the value of a time parameter.
EN_getresultindex
int EN_getresultindex(EN_Project ph, int type, int index, int *value)
Retrieves the order in which a node or link appears in an output file.
EN_getnodetype
int EN_getnodetype(EN_Project ph, int index, int *nodeType)
Retrieves a node's type given its index.
EN_deleterule
int EN_deleterule(EN_Project ph, int index)
Deletes an existing rule-based control.
EN_getdemandpattern
int EN_getdemandpattern(EN_Project ph, int nodeIndex, int demandIndex, int *patIndex)
Retrieves the index of a time pattern assigned to one of a node's demand categories.
EN_setpremiseindex
int EN_setpremiseindex(EN_Project ph, int ruleIndex, int premiseIndex, int objIndex)
Sets the index of an object in a premise of a rule-based control.
EN_getdemandname
int EN_getdemandname(EN_Project ph, int nodeIndex, int demandIndex, char *out_demandName)
Retrieves the name of a node's demand category.
EN_getnodevalue
int EN_getnodevalue(EN_Project ph, int index, int property, double *value)
Retrieves a property value for a node.
EN_setdemandname
int EN_setdemandname(EN_Project ph, int nodeIndex, int demandIdx, char *demandName)
Assigns a name to a node's demand category.
EN_deletenode
int EN_deletenode(EN_Project ph, int index, int actionCode)
Deletes a node from a project.
EN_geterror
int EN_geterror(int errcode, char *out_errmsg, int maxLen)
Returns the text of an error message generated by an error code.
EN_getaveragepatternvalue
int EN_getaveragepatternvalue(EN_Project ph, int index, double *value)
Retrieves the average of all pattern factors in a time pattern.
EN_deletecurve
int EN_deletecurve(EN_Project ph, int index)
Deletes a data curve from a project.
EN_setpatternid
int EN_setpatternid(EN_Project ph, int index, char *id)
Changes the ID name of a time pattern given its index.
EN_setpremisestatus
int EN_setpremisestatus(EN_Project ph, int ruleIndex, int premiseIndex, int status)
Sets the status being compared to in a premise of a rule-based control.
EN_getoption
int EN_getoption(EN_Project ph, int option, double *value)
Retrieves the value of an analysis option.
EN_addcurve
int EN_addcurve(EN_Project ph, char *id)
Adds a new data curve to a project.
EN_getpatternvalue
int EN_getpatternvalue(EN_Project ph, int index, int period, double *value)
Retrieves a time pattern's factor for a given time period.
EN_getdemandindex
int EN_getdemandindex(EN_Project ph, int nodeIndex, char *demandName, int *demandIndex)
Retrieves the index of a node's named demand category.
EN_saveH
int EN_saveH(EN_Project ph)
Transfers a project's hydraulics results from its temporary hydraulics file to its binary output file...
EN_setbasedemand
int EN_setbasedemand(EN_Project ph, int nodeIndex, int demandIndex, double baseDemand)
Sets the base demand for one of a node's demand categories.
EN_closeH
int EN_closeH(EN_Project ph)
Closes the hydraulic solver freeing all of its allocated memory.
EN_setpattern
int EN_setpattern(EN_Project ph, int index, double *values, int len)
Sets the pattern factors for a given time pattern.
EN_open
int EN_open(EN_Project ph, const char *inpFile, const char *rptFile, const char *outFile)
Opens an EPANET input file & reads in network data.
EN_adddemand
int EN_adddemand(EN_Project ph, int nodeIndex, double baseDemand, char *demandPattern, char *demandName)
appends a new demand to a junction node demands list.
EN_setjuncdata
int EN_setjuncdata(EN_Project ph, int index, double elev, double dmnd, char *dmndpat)
Sets a group of properties for a junction node.
EN_saveinpfile
int EN_saveinpfile(EN_Project ph, const char *filename)
Saves a project's data to an EPANET-formatted text file.
EN_setnodeid
int EN_setnodeid(EN_Project ph, int index, char *newid)
Changes the ID name of a node.
EN_getcoord
int EN_getcoord(EN_Project ph, int index, double *x, double *y)
Gets the (x,y) coordinates of a node.
EN_getelseaction
int EN_getelseaction(EN_Project ph, int ruleIndex, int actionIndex, int *linkIndex, int *status, double *setting)
Gets the properties of an ELSE action in a rule-based control.
EN_getcount
int EN_getcount(EN_Project ph, int object, int *count)
Retrieves the number of objects of a given type in a project.
EN_setdemandmodel
int EN_setdemandmodel(EN_Project ph, int type, double pmin, double preq, double pexp)
Sets the type of demand model to use and its parameters.
EN_getcurveindex
int EN_getcurveindex(EN_Project ph, char *id, int *index)
Retrieves the index of a curve given its ID name.
EN_addcontrol
int EN_addcontrol(EN_Project ph, int type, int linkIndex, double setting, int nodeIndex, double level, int *index)
Adds a new simple control to a project.
EN_getversion
int EN_getversion(int *version)
Retrieves the toolkit API version number.
EN_getnumdemands
int EN_getnumdemands(EN_Project ph, int nodeIndex, int *numDemands)
Retrieves the number of demand categories for a junction node.
EN_getqualinfo
int EN_getqualinfo(EN_Project ph, int *qualType, char *out_chemName, char *out_chemUnits, int *traceNode)
Gets information about the type of water quality analysis requested.
EN_getcurvetype
int EN_getcurvetype(EN_Project ph, int index, int *type)
Retrieves a curve's type.
EN_getruleID
int EN_getruleID(EN_Project ph, int index, char *out_id)
Gets the ID name of a rule-based control given its index.
EN_addnode
int EN_addnode(EN_Project ph, char *id, int nodeType, int *index)
Adds a new node to a project.
EN_setnodevalue
int EN_setnodevalue(EN_Project ph, int index, int property, double value)
Sets a property value for a node.
EN_setcoord
int EN_setcoord(EN_Project ph, int index, double x, double y)
Sets the (x,y) coordinates of a node.
EN_Project
struct Project * EN_Project
The EPANET Project wrapper object.
Definition: epanet2_2.h:49
EN_solveH
int EN_solveH(EN_Project ph)
Runs a complete hydraulic simulation with results for all time periods written to a temporary hydraul...
EN_setcurvevalue
int EN_setcurvevalue(EN_Project ph, int curveIndex, int pointIndex, double x, double y)
Sets the value of a single data point for a curve.
EN_getdemandmodel
int EN_getdemandmodel(EN_Project ph, int *type, double *pmin, double *preq, double *pexp)
Retrieves the type of demand model in use and its parameters.
EN_settitle
int EN_settitle(EN_Project ph, char *line1, char *line2, char *line3)
Sets the title lines of the project.
EN_nextH
int EN_nextH(EN_Project ph, long *tStep)
Determines the length of time until the next hydraulic event occurs in an extended period simulation.
EN_addrule
int EN_addrule(EN_Project ph, char *rule)
Adds a new rule-based control to a project.
EN_setcurveid
int EN_setcurveid(EN_Project ph, int index, char *id)
Changes the ID name of a data curve given its index.
EN_setreport
int EN_setreport(EN_Project ph, char *format)
Processes a reporting format command.
EN_getnodeindex
int EN_getnodeindex(EN_Project ph, char *id, int *index)
Gets the index of a node given its ID name.
EN_getcurvelen
int EN_getcurvelen(EN_Project ph, int index, int *len)
Retrieves the number of points in a curve.
EN_getrule
int EN_getrule(EN_Project ph, int index, int *nPremises, int *nThenActions, int *nElseActions, double *priority)
Retrieves summary information about a rule-based control.
EN_createproject
int EN_createproject(EN_Project *ph)
Creates an EPANET project.
EN_writeline
int EN_writeline(EN_Project ph, char *line)
Writes a line of text to a project's report file.
EN_stepQ
int EN_stepQ(EN_Project ph, long *timeLeft)
Advances a water quality simulation by a single water quality time step.
EN_getcomment
int EN_getcomment(EN_Project ph, int object, int index, char *out_comment)
Retrieves a descriptive comment assigned to a Node, Link, Pattern or Curve.
EN_resetreport
int EN_resetreport(EN_Project ph)
Resets a project's report options to their default values.
EN_closeQ
int EN_closeQ(EN_Project ph)
Closes the water quality solver, freeing all of its allocated memory.
EN_initQ
int EN_initQ(EN_Project ph, int saveFlag)
Initializes a network prior to running a water quality analysis.
EN_init
int EN_init(EN_Project ph, const char *rptFile, const char *outFile, int unitsType, int headLossType)
Initializes an EPANET project.
EN_solveQ
int EN_solveQ(EN_Project ph)
Runs a complete water quality simulation with results at uniform reporting intervals written to the p...
EN_getthenaction
int EN_getthenaction(EN_Project ph, int ruleIndex, int actionIndex, int *linkIndex, int *status, double *setting)
Gets the properties of a THEN action in a rule-based control.
EN_setpremisevalue
int EN_setpremisevalue(EN_Project ph, int ruleIndex, int premiseIndex, double value)
Sets the value in a premise of a rule-based control.
EN_getqualtype
int EN_getqualtype(EN_Project ph, int *qualType, int *traceNode)
Retrieves the type of water quality analysis to be run.
EN_runproject
int EN_runproject(EN_Project ph, const char *inpFile, const char *rptFile, const char *outFile, void(*pviewprog)(char *))
Runs a complete EPANET simulation.
EN_setthenaction
int EN_setthenaction(EN_Project ph, int ruleIndex, int actionIndex, int linkIndex, int status, double setting)
Sets the properties of a THEN action in a rule-based control.
EN_close
int EN_close(EN_Project ph)
Closes a project and frees all of its memory.
EN_setelseaction
int EN_setelseaction(EN_Project ph, int ruleIndex, int actionIndex, int linkIndex, int status, double setting)
Sets the properties of an ELSE action in a rule-based control.
EN_getpatternid
int EN_getpatternid(EN_Project ph, int index, char *out_id)
Retrieves the ID name of a time pattern given its index.
EN_openH
int EN_openH(EN_Project ph)
Opens a project's hydraulic solver.
EN_getpremise
int EN_getpremise(EN_Project ph, int ruleIndex, int premiseIndex, int *logop, int *object, int *objIndex, int *variable, int *relop, int *status, double *value)
Gets the properties of a premise in a rule-based control.
EN_gettitle
int EN_gettitle(EN_Project ph, char *out_line1, char *out_line2, char *out_line3)
Retrieves the title lines of the project.
EN_setcomment
int EN_setcomment(EN_Project ph, int object, int index, char *comment)
Assigns a descriptive comment to a Node, Link, Pattern or Curve.
EN_getnodeid
int EN_getnodeid(EN_Project ph, int index, char *out_id)
Gets the ID name of a node given its index.
EN_report
int EN_report(EN_Project ph)
Writes simulation results in a tabular format to a project's report file.
EN_setflowunits
int EN_setflowunits(EN_Project ph, int units)
Sets a project's flow units.
EN_getcontrol
int EN_getcontrol(EN_Project ph, int index, int *type, int *linkIndex, double *setting, int *nodeIndex, double *level)
Retrieves the properties of a simple control.
EN_getcurvevalue
int EN_getcurvevalue(EN_Project ph, int curveIndex, int pointIndex, double *x, double *y)
Retrieves the value of a single data point for a curve.
EN_setrulepriority
int EN_setrulepriority(EN_Project ph, int index, double priority)
Sets the priority of a rule-based control.
EN_setcontrol
int EN_setcontrol(EN_Project ph, int index, int type, int linkIndex, double setting, int nodeIndex, double level)
Sets the properties of an existing simple control.
EN_getcurve
int EN_getcurve(EN_Project ph, int index, char *out_id, int *nPoints, double *xValues, double *yValues)
Retrieves all of a curve's data.
EN_getflowunits
int EN_getflowunits(EN_Project ph, int *units)
Retrieves a project's flow units.
EN_runH
int EN_runH(EN_Project ph, long *currentTime)
Computes a hydraulic solution for the current point in time.
EN_getpatternindex
int EN_getpatternindex(EN_Project ph, char *id, int *index)
Retrieves the index of a time pattern given its ID name.
EN_setoption
int EN_setoption(EN_Project ph, int option, double value)
Sets the value for an anlysis option.
EN_nextQ
int EN_nextQ(EN_Project ph, long *tStep)
Advances a water quality simulation over the time until the next hydraulic event.
EN_setcurve
int EN_setcurve(EN_Project ph, int index, double *xValues, double *yValues, int nPoints)
assigns a set of data points to a curve.
EN_getpatternlen
int EN_getpatternlen(EN_Project ph, int index, int *len)
Retrieves the number of time periods in a time pattern.
EN_setstatusreport
int EN_setstatusreport(EN_Project ph, int level)
Sets the level of hydraulic status reporting.
EN_clearreport
int EN_clearreport(EN_Project ph)
Clears the contents of a project's report file.
EN_runQ
int EN_runQ(EN_Project ph, long *currentTime)
Makes hydraulic and water quality results at the start of the current time period available to a proj...
EN_setqualtype
int EN_setqualtype(EN_Project ph, int qualType, char *chemName, char *chemUnits, char *traceNode)
Sets the type of water quality analysis to run.
EN_deletecontrol
int EN_deletecontrol(EN_Project ph, int index)
Deletes an existing simple control.
EN_settankdata
int EN_settankdata(EN_Project ph, int index, double elev, double initlvl, double minlvl, double maxlvl, double diam, double minvol, char *volcurve)
Sets a group of properties for a tank node.
EN_getcurveid
int EN_getcurveid(EN_Project ph, int index, char *out_id)
Retrieves the ID name of a curve given its index.
EN_setpremise
int EN_setpremise(EN_Project ph, int ruleIndex, int premiseIndex, int logop, int object, int objIndex, int variable, int relop, int status, double value)
Sets the properties of a premise in a rule-based control.
EN_deletedemand
int EN_deletedemand(EN_Project ph, int nodeIndex, int demandIndex)
deletes a demand from a junction node.
EN_deleteproject
int EN_deleteproject(EN_Project ph)
Deletes a currently opened EPANET project.
EN_openQ
int EN_openQ(EN_Project ph)
Opens a project's water quality solver.
EN_initH
int EN_initH(EN_Project ph, int initFlag)
Initializes a network prior to running a hydraulic analysis.
EN_deletepattern
int EN_deletepattern(EN_Project ph, int index)
Deletes a time pattern from a project.