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: 02/01/2020
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 *out_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 *out_currentTime);
303 
336  int DLLEXPORT EN_nextH(EN_Project ph, long *out_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 *out_currentTime);
453 
484  int DLLEXPORT EN_nextQ(EN_Project ph, long *out_tStep);
485 
500  int DLLEXPORT EN_stepQ(EN_Project ph, long *out_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 *out_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* out_value);
640 
655  int DLLEXPORT EN_getresultindex(EN_Project ph, int type, int index, int *out_value);
656 
657  /********************************************************************
658 
659  Analysis Options Functions
660 
661  ********************************************************************/
662 
670  int DLLEXPORT EN_getoption(EN_Project ph, int option, double *out_value);
671 
680  int DLLEXPORT EN_setoption(EN_Project ph, int option, double value);
681 
691  int DLLEXPORT EN_getflowunits(EN_Project ph, int *out_units);
692 
702  int DLLEXPORT EN_setflowunits(EN_Project ph, int units);
703 
711  int DLLEXPORT EN_gettimeparam(EN_Project ph, int param, long *out_value);
712 
720  int DLLEXPORT EN_settimeparam(EN_Project ph, int param, long value);
721 
731  int DLLEXPORT EN_getqualinfo(EN_Project ph, int *out_qualType, char *out_chemName,
732  char *out_chemUnits, int *out_traceNode);
733 
741  int DLLEXPORT EN_getqualtype(EN_Project ph, int *out_qualType, int *out_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 *out_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 *out_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 *out_nodeType);
832 
844  int DLLEXPORT EN_getnodevalue(EN_Project ph, int index, int property, double *out_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 *out_x, double *out_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 *out_type, double *out_pmin,
928  double *out_preq, double *out_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 *out_demandIndex);
987 
995  int DLLEXPORT EN_getnumdemands(EN_Project ph, int nodeIndex, int *out_numDemands);
996 
1005  int DLLEXPORT EN_getbasedemand(EN_Project ph, int nodeIndex, int demandIndex,
1006  double *out_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 *out_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 *out_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 *out_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 *out_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 *out_node1, int *out_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 *out_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 *out_count);
1239 
1249  int DLLEXPORT EN_getvertex(EN_Project ph, int index, int vertex, double *out_x, double *out_y);
1250 
1260  int DLLEXPORT EN_setvertex(EN_Project ph, int index, int vertex, double x, double y);
1261 
1273  int DLLEXPORT EN_setvertices(EN_Project ph, int index, double *x, double *y, int count);
1274 
1275  /********************************************************************
1276 
1277  Pump Functions
1278 
1279  ********************************************************************/
1280 
1288  int DLLEXPORT EN_getpumptype(EN_Project ph, int linkIndex, int *out_pumpType);
1289 
1297  int DLLEXPORT EN_getheadcurveindex(EN_Project ph, int linkIndex, int *out_curveIndex);
1298 
1306  int DLLEXPORT EN_setheadcurveindex(EN_Project ph, int linkIndex, int curveIndex);
1307 
1308  /********************************************************************
1309 
1310  Time Pattern Functions
1311 
1312  ********************************************************************/
1313 
1322  int DLLEXPORT EN_addpattern(EN_Project ph, char *id);
1323 
1330  int DLLEXPORT EN_deletepattern(EN_Project ph, int index);
1331 
1339  int DLLEXPORT EN_getpatternindex(EN_Project ph, char *id, int *out_index);
1340 
1350  int DLLEXPORT EN_getpatternid(EN_Project ph, int index, char *out_id);
1351 
1361  int DLLEXPORT EN_setpatternid(EN_Project ph, int index, char *id);
1362 
1370  int DLLEXPORT EN_getpatternlen(EN_Project ph, int index, int *out_len);
1371 
1380  int DLLEXPORT EN_getpatternvalue(EN_Project ph, int index, int period, double *out_value);
1381 
1390  int DLLEXPORT EN_setpatternvalue(EN_Project ph, int index, int period, double value);
1391 
1399  int DLLEXPORT EN_getaveragepatternvalue(EN_Project ph, int index, double *out_value);
1400 
1414  int DLLEXPORT EN_setpattern(EN_Project ph, int index, double *values, int len);
1415 
1416  /********************************************************************
1417 
1418  Data Curve Functions
1419 
1420  ********************************************************************/
1421 
1430  int DLLEXPORT EN_addcurve(EN_Project ph, char *id);
1431 
1438  int DLLEXPORT EN_deletecurve(EN_Project ph, int index);
1439 
1447  int DLLEXPORT EN_getcurveindex(EN_Project ph, char *id, int *out_index);
1448 
1458  int DLLEXPORT EN_getcurveid(EN_Project ph, int index, char *out_id);
1459 
1469  int DLLEXPORT EN_setcurveid(EN_Project ph, int index, char *id);
1470 
1478  int DLLEXPORT EN_getcurvelen(EN_Project ph, int index, int *out_len);
1479 
1487  int DLLEXPORT EN_getcurvetype(EN_Project ph, int index, int *out_type);
1488 
1496  int DLLEXPORT EN_setcurvetype(EN_Project ph, int index, int type);
1497 
1507  int DLLEXPORT EN_getcurvevalue(EN_Project ph, int curveIndex, int pointIndex,
1508  double *out_x, double *out_y);
1509 
1519  int DLLEXPORT EN_setcurvevalue(EN_Project ph, int curveIndex, int pointIndex,
1520  double x, double y);
1521 
1536  int DLLEXPORT EN_getcurve(EN_Project ph, int index, char *out_id, int *out_nPoints,
1537  double *out_xValues, double *out_yValues);
1538 
1553  int DLLEXPORT EN_setcurve(EN_Project ph, int index, double *xValues,
1554  double *yValues, int nPoints);
1555 
1556  /********************************************************************
1557 
1558  Simple Controls Functions
1559 
1560  ********************************************************************/
1561 
1575  int DLLEXPORT EN_addcontrol(EN_Project ph, int type, int linkIndex,
1576  double setting, int nodeIndex, double level, int *out_index);
1577 
1584  int DLLEXPORT EN_deletecontrol(EN_Project ph, int index);
1585 
1599  int DLLEXPORT EN_getcontrol(EN_Project ph, int index, int *out_type, int *out_linkIndex,
1600  double *out_setting, int *out_nodeIndex, double *out_level);
1601 
1615  int DLLEXPORT EN_setcontrol(EN_Project ph, int index, int type, int linkIndex,
1616  double setting, int nodeIndex, double level);
1617 
1618 
1619  /********************************************************************
1620 
1621  Rule-Based Controls Functions
1622 
1623  ********************************************************************/
1624 
1634  int DLLEXPORT EN_addrule(EN_Project ph, char *rule);
1635 
1642  int DLLEXPORT EN_deleterule(EN_Project ph, int index);
1643 
1654  int DLLEXPORT EN_getrule(EN_Project ph, int index, int *out_nPremises,
1655  int *out_nThenActions, int *out_nElseActions, double *out_priority);
1656 
1666  int DLLEXPORT EN_getruleID(EN_Project ph, int index, char *out_id);
1667 
1684  int DLLEXPORT EN_getpremise(EN_Project ph, int ruleIndex, int premiseIndex,
1685  int *out_logop, int *out_object, int *out_objIndex, int *out_variable,
1686  int *out_relop, int *out_status, double *out_value);
1687 
1703  int DLLEXPORT EN_setpremise(EN_Project ph, int ruleIndex, int premiseIndex,
1704  int logop, int object, int objIndex, int variable, int relop,
1705  int status, double value);
1706 
1715  int DLLEXPORT EN_setpremiseindex(EN_Project ph, int ruleIndex, int premiseIndex,
1716  int objIndex);
1717 
1727  int DLLEXPORT EN_setpremisestatus(EN_Project ph, int ruleIndex, int premiseIndex,
1728  int status);
1729 
1738  int DLLEXPORT EN_setpremisevalue(EN_Project ph, int ruleIndex, int premiseIndex,
1739  double value);
1740 
1751  int DLLEXPORT EN_getthenaction(EN_Project ph, int ruleIndex, int actionIndex,
1752  int *out_linkIndex, int *out_status, double *out_setting);
1753 
1764  int DLLEXPORT EN_setthenaction(EN_Project ph, int ruleIndex, int actionIndex,
1765  int linkIndex, int status, double setting);
1766 
1777  int DLLEXPORT EN_getelseaction(EN_Project ph, int ruleIndex, int actionIndex,
1778  int *out_linkIndex, int *out_status, double *out_setting);
1779 
1790  int DLLEXPORT EN_setelseaction(EN_Project ph, int ruleIndex, int actionIndex,
1791  int linkIndex, int status, double setting);
1792 
1800  int DLLEXPORT EN_setrulepriority(EN_Project ph, int index, double priority);
1801 
1802 #if defined(__cplusplus)
1803 }
1804 #endif
1805 
1806 #endif //EPANET2_2_H
EN_settimeparam
int EN_settimeparam(EN_Project ph, int param, long value)
Sets the value of a time parameter.
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_getnodeindex
int EN_getnodeindex(EN_Project ph, char *id, int *out_index)
Gets the index of a node given its ID name.
EN_nextQ
int EN_nextQ(EN_Project ph, long *out_tStep)
Advances a water quality simulation over the time until the next hydraulic event.
EN_runQ
int EN_runQ(EN_Project ph, long *out_currentTime)
Makes hydraulic and water quality results at the start of the current time period available to a proj...
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_getcurvelen
int EN_getcurvelen(EN_Project ph, int index, int *out_len)
Retrieves the number of points in a curve.
EN_runH
int EN_runH(EN_Project ph, long *out_currentTime)
Computes a hydraulic solution for the current point in time.
EN_deleterule
int EN_deleterule(EN_Project ph, int index)
Deletes an existing rule-based control.
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_getrule
int EN_getrule(EN_Project ph, int index, int *out_nPremises, int *out_nThenActions, int *out_nElseActions, double *out_priority)
Retrieves summary information about a rule-based control.
EN_setdemandname
int EN_setdemandname(EN_Project ph, int nodeIndex, int demandIdx, char *demandName)
Assigns a name to a node's demand category.
EN_getversion
int EN_getversion(int *out_version)
Retrieves the toolkit API version number.
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_getqualinfo
int EN_getqualinfo(EN_Project ph, int *out_qualType, char *out_chemName, char *out_chemUnits, int *out_traceNode)
Gets information about the type of water quality analysis requested.
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_addcurve
int EN_addcurve(EN_Project ph, char *id)
Adds a new data curve to a project.
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_getdemandpattern
int EN_getdemandpattern(EN_Project ph, int nodeIndex, int demandIndex, int *out_patIndex)
Retrieves the index of a time pattern assigned to one of a node's demand categories.
EN_getstatistic
int EN_getstatistic(EN_Project ph, int type, double *out_value)
Retrieves a particular simulation statistic.
EN_getcontrol
int EN_getcontrol(EN_Project ph, int index, int *out_type, int *out_linkIndex, double *out_setting, int *out_nodeIndex, double *out_level)
Retrieves the properties of a simple control.
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_getflowunits
int EN_getflowunits(EN_Project ph, int *out_units)
Retrieves a project's flow units.
EN_saveinpfile
int EN_saveinpfile(EN_Project ph, const char *filename)
Saves a project's data to an EPANET-formatted text file.
EN_getbasedemand
int EN_getbasedemand(EN_Project ph, int nodeIndex, int demandIndex, double *out_baseDemand)
Gets the base demand for one of a node's demand categories.
EN_stepQ
int EN_stepQ(EN_Project ph, long *out_timeLeft)
Advances a water quality simulation by a single water quality time step.
EN_setnodeid
int EN_setnodeid(EN_Project ph, int index, char *newid)
Changes the ID name of a node.
EN_getdemandindex
int EN_getdemandindex(EN_Project ph, int nodeIndex, char *demandName, int *out_demandIndex)
Retrieves the index of a node's named demand category.
EN_getaveragepatternvalue
int EN_getaveragepatternvalue(EN_Project ph, int index, double *out_value)
Retrieves the average of all pattern factors in a time pattern.
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_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_gettimeparam
int EN_gettimeparam(EN_Project ph, int param, long *out_value)
Retrieves the value of a time parameter.
EN_getnodevalue
int EN_getnodevalue(EN_Project ph, int index, int property, double *out_value)
Retrieves a property value for a node.
EN_getpatternindex
int EN_getpatternindex(EN_Project ph, char *id, int *out_index)
Retrieves the index of a time pattern given its ID name.
EN_setnodevalue
int EN_setnodevalue(EN_Project ph, int index, int property, double value)
Sets a property value for a node.
EN_getnodetype
int EN_getnodetype(EN_Project ph, int index, int *out_nodeType)
Retrieves a node's type given its index.
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_getcurvetype
int EN_getcurvetype(EN_Project ph, int index, int *out_type)
Retrieves a curve's type.
EN_getnumdemands
int EN_getnumdemands(EN_Project ph, int nodeIndex, int *out_numDemands)
Retrieves the number of demand categories for a junction node.
EN_getpatternlen
int EN_getpatternlen(EN_Project ph, int index, int *out_len)
Retrieves the number of time periods in a time pattern.
EN_getresultindex
int EN_getresultindex(EN_Project ph, int type, int index, int *out_value)
Retrieves the order in which a node or link appears in an output file.
EN_settitle
int EN_settitle(EN_Project ph, char *line1, char *line2, char *line3)
Sets the title lines of the project.
EN_addrule
int EN_addrule(EN_Project ph, char *rule)
Adds a new rule-based control to a project.
EN_nextH
int EN_nextH(EN_Project ph, long *out_tStep)
Determines the length of time until the next hydraulic event occurs in an extended period simulation.
EN_addnode
int EN_addnode(EN_Project ph, char *id, int nodeType, int *out_index)
Adds a new node 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_getcurveindex
int EN_getcurveindex(EN_Project ph, char *id, int *out_index)
Retrieves the index of a curve given its ID name.
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_getpatternvalue
int EN_getpatternvalue(EN_Project ph, int index, int period, double *out_value)
Retrieves a time pattern's factor for a given time period.
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_setcurvetype
int EN_setcurvetype(EN_Project ph, int index, int type)
Sets a curve's type.
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_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_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_getoption
int EN_getoption(EN_Project ph, int option, double *out_value)
Retrieves the value of an analysis option.
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_getcoord
int EN_getcoord(EN_Project ph, int index, double *out_x, double *out_y)
Gets the (x,y) coordinates of a node.
EN_openH
int EN_openH(EN_Project ph)
Opens a project's hydraulic solver.
EN_getcurvevalue
int EN_getcurvevalue(EN_Project ph, int curveIndex, int pointIndex, double *out_x, double *out_y)
Retrieves the value of a single data point for a curve.
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_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_getqualtype
int EN_getqualtype(EN_Project ph, int *out_qualType, int *out_traceNode)
Retrieves the type of water quality analysis to be run.
EN_getpremise
int EN_getpremise(EN_Project ph, int ruleIndex, int premiseIndex, int *out_logop, int *out_object, int *out_objIndex, int *out_variable, int *out_relop, int *out_status, double *out_value)
Gets the properties of a premise in a rule-based control.
EN_setoption
int EN_setoption(EN_Project ph, int option, double value)
Sets the value for an anlysis option.
EN_getthenaction
int EN_getthenaction(EN_Project ph, int ruleIndex, int actionIndex, int *out_linkIndex, int *out_status, double *out_setting)
Gets the properties of a THEN action in a rule-based control.
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_getdemandmodel
int EN_getdemandmodel(EN_Project ph, int *out_type, double *out_pmin, double *out_preq, double *out_pexp)
Retrieves the type of demand model in use and its parameters.
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_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_addcontrol
int EN_addcontrol(EN_Project ph, int type, int linkIndex, double setting, int nodeIndex, double level, int *out_index)
Adds a new simple control to a project.
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.
EN_getcurve
int EN_getcurve(EN_Project ph, int index, char *out_id, int *out_nPoints, double *out_xValues, double *out_yValues)
Retrieves all of a curve's data.
EN_getelseaction
int EN_getelseaction(EN_Project ph, int ruleIndex, int actionIndex, int *out_linkIndex, int *out_status, double *out_setting)
Gets the properties of an ELSE action in a rule-based control.
EN_getcount
int EN_getcount(EN_Project ph, int object, int *out_count)
Retrieves the number of objects of a given type in a project.