Difference between revisions of "EPANET-Emitter"
m (moved EPANET to EPANET-Emitter) |
|||
(38 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Matters related to EPANET2.0 emitter modification (Assela Pathirana, UNESCO-IHE) will appear here. | Matters related to EPANET2.0 emitter modification (EPANET-Emitter) (Assela Pathirana, UNESCO-IHE) will appear here. | ||
==What and Why== | |||
Under ideal operating conditions, water distribution networks have adequate operating pressure | |||
throughout the system, making the water withdrawal virtually independent of the system pressure | |||
-- the demand is fully determined by the end-of-pipe, customer behavior. However, there are | |||
many practical situations where the operating pressure of the networks are less than ideal -- due | |||
to excessive demand, among other reasons. Examples are contingencies like pipe breakage and | |||
day-to-day operation of many water networks of urban centers of the third world. | |||
We modifed the EPANET 2.0 computational engine to implement pressure-sensitive demand | |||
in network calculations, in a way that is completely compatible with the existing user interface of | |||
the standard EPANET model. Further the EPANET-toolkit applications using the demand-driven | |||
EPANET (standard) engine can benefit from this modified form without changing any application | |||
code. | |||
The new software is fully integrated to the EPANET 2.0 Graphical user interface. | |||
==Important Note== | |||
* Accidentally, a bug was introduced in compiling version 0.9. This results in wrong demands reported in GUI program. Until it is fixed, please use 0.3 instead! | |||
==Downloads== | ==Downloads== | ||
;Installation files: | ;Installation files: | ||
:* Initial release, | :* Initial release, beta version: [[Media:epanet2-emitter-setup-v0.3.zip|epanet2-emitter-setup-v0.3.zip]] | ||
===source code=== | |||
;Note: *Both these sources are organized as visual studio (2008) projects. (Free version will work fine) | |||
:* Please note that I am not in a position to provide support for working with this code. | |||
* Source code of modified EPANet engine : [[file:en_emitter_source.rar]] | |||
* A reference program showing how to call : [[file:en_emitter_ref.rar]] | |||
==Citing EPANET Emitter== | |||
Please use the following when citing the model. | |||
<tt>EPANET2 Desktop Application for Pressure Driven Demand Modeling | |||
Assela Pathirana, ASCE Conf. Proc. 425, 8 (2010), DOI:10.1061/41203(425)8</tt> | |||
* Download: [[file:ENEmitter_WDSA210.pdf]] | |||
==Known Issues== | |||
* The program will not handle networks with emitters. This is due to the fact that emitters are used for the PDA calculation. In a future version, this will be attended to. | |||
* The custom <tt>epanet2.dll</tt> will only work with the custom <tt>epanet2w.exe</tt> GUI and the other way around. This is because of the additional variable (ECUP) implemented in both <tt>epanet2.dll</tt> and <tt>epanet2w.exe</tt>. | |||
* The <tt>.net</tt> files (binary format of EPANET2) produced by standard <tt>EPANET</tt> and the current edition are not interchangeable. However, text network format (<tt>.inp</tt>) of standard <tt>EPANET</tt> can be opened with <tt>EPANET-PDA</tt>. Network files created by <tt>EPANET-PDA</tt> will show an error (<tt>Error 201 at line nnn: [OPTIONS] ECUP x</tt>) when opened in standard EPANET, but this can be safely ignored. | |||
;History: | |||
<!-- :* [[image:epanet2-emitter-setup-v0.9.zip|epanet2-emitter-setup-v0.9.zip]] | |||
:* [[image:epanet2-emitter-setup-v0.4.zip|epanet2-emitter-setup-v0.4.zip]] --> | |||
:* [[image:epanet2-emitter-setup-v0.3.zip|epanet2-emitter-setup-v0.3.zip]] | |||
:* [[image:epanet2-emitter-setup-v0.2.zip|epanet2-emitter-setup-v0.2.zip]] | |||
:* [[Image:epanet2-emitter-setup-v0.1.zip|epanet2-emitter-setup-v0.1.zip]]) | |||
==Bug Fixes== | |||
* 17:41, 5 March 2009 (JST) : version 0.4 : There was a [[wikipedia:name mangling|name decoration]] issue in the epanet2.dll. The exported names were only undecorated ones (So that Delphi can call them). However, this made C++ to call original epanet calls instead of emitter-wrapper calls. Now C/C++ decorated names are also exported so that epanet2.dll can be used for toolkit calls with C/C++. | |||
* 22:34, 15 June 2010 (JST) Added new routines to get and set Emitter exponent and ECUP from the toolkit. The set function must be called only after initH call. | |||
* The above revision (version 0.9) introduced a new bug. Please use version 0.3 until it is fixed. Download links for 0.9 was removed. | |||
==Custom Header file== | |||
<source lang=cpp> | |||
/* | |||
** EPANET2.H | |||
** | |||
** C/C++ header file for EPANET Programmers Toolkit | |||
** | |||
** Last updated on 2/14/08 (2.00.12) | |||
*/ | |||
#ifndef EPANET2_H | |||
#define EPANET2_H | |||
// --- 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_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_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_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 | |||
#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 | |||
#define EN_AGE 2 | |||
#define EN_TRACE 3 | |||
#define EN_CONCEN 0 /* Source quality types */ | |||
#define EN_MASS 1 | |||
#define EN_SETPOINT 2 | |||
#define EN_FLOWPACED 3 | |||
#define EN_CFS 0 /* Flow units types */ | |||
#define EN_GPM 1 | |||
#define EN_MGD 2 | |||
#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 | |||
#define EN_TIMER 2 | |||
#define EN_TIMEOFDAY 3 | |||
#define EN_AVERAGE 1 /* Time statistic types. */ | |||
#define EN_MINIMUM 2 | |||
#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 flow flag */ | |||
// --- define WINDOWS | |||
#undef WINDOWS | |||
#ifdef _WIN32 | |||
#define WINDOWS | |||
#endif | |||
#ifdef __WIN32__ | |||
#define WINDOWS | |||
#endif | |||
// --- define DLLEXPORT | |||
#ifdef WINDOWS | |||
#ifdef __cplusplus | |||
#define DLLEXPORT extern "C" int __declspec(dllexport) __stdcall | |||
#else | |||
#define DLLEXPORT __declspec(dllexport) __stdcall | |||
#endif | |||
#else | |||
#ifdef __cplusplus | |||
#define DLLEXPORT extern "C" | |||
#else | |||
#define DLLEXPORT | |||
#endif | |||
#endif | |||
// --- declare the EPANET toolkit functions | |||
DLLEXPORT ENepanet(char *, char *, char *, void (*) (char *)); | |||
DLLEXPORT ENopen(char *, char *, char *); | |||
DLLEXPORT ENsaveinpfile(char *); | |||
DLLEXPORT ENclose(void); | |||
DLLEXPORT ENsolveH(void); | |||
DLLEXPORT ENsaveH(void); | |||
DLLEXPORT ENopenH(void); | |||
DLLEXPORT ENinitH(int); | |||
DLLEXPORT ENrunH(long *); | |||
DLLEXPORT ENnextH(long *); | |||
DLLEXPORT ENcloseH(void); | |||
DLLEXPORT ENsavehydfile(char *); | |||
DLLEXPORT ENusehydfile(char *); | |||
DLLEXPORT ENsolveQ(void); | |||
DLLEXPORT ENopenQ(void); | |||
DLLEXPORT ENinitQ(int); | |||
DLLEXPORT ENrunQ(long *); | |||
DLLEXPORT ENnextQ(long *); | |||
DLLEXPORT ENstepQ(long *); | |||
DLLEXPORT ENcloseQ(void); | |||
DLLEXPORT ENwriteline(char *); | |||
DLLEXPORT ENreport(void); | |||
DLLEXPORT ENresetreport(void); | |||
DLLEXPORT ENsetreport(char *); | |||
DLLEXPORT ENgetcontrol(int, int *, int *, float *, | |||
int *, float *); | |||
DLLEXPORT ENgetcount(int, int *); | |||
DLLEXPORT ENgetoption(int, float *); | |||
DLLEXPORT ENgettimeparam(int, long *); | |||
DLLEXPORT ENgetflowunits(int *); | |||
DLLEXPORT ENgetpatternindex(char *, int *); | |||
DLLEXPORT ENgetpatternid(int, char *); | |||
DLLEXPORT ENgetpatternlen(int, int *); | |||
DLLEXPORT ENgetpatternvalue(int, int, float *); | |||
DLLEXPORT ENgetqualtype(int *, int *); | |||
DLLEXPORT ENgeterror(int, char *, int); | |||
DLLEXPORT ENgetnodeindex(char *, int *); | |||
DLLEXPORT ENgetnodeid(int, char *); | |||
DLLEXPORT ENgetnodetype(int, int *); | |||
DLLEXPORT ENgetnodevalue(int, int, float *); | |||
DLLEXPORT ENgetlinkindex(char *, int *); | |||
DLLEXPORT ENgetlinkid(int, char *); | |||
DLLEXPORT ENgetlinktype(int, int *); | |||
DLLEXPORT ENgetlinknodes(int, int *, int *); | |||
DLLEXPORT ENgetlinkvalue(int, int, float *); | |||
DLLEXPORT ENgetversion(int *); | |||
DLLEXPORT ENsetcontrol(int, int, int, float, int, float); | |||
DLLEXPORT ENsetnodevalue(int, int, float); | |||
DLLEXPORT ENsetlinkvalue(int, int, float); | |||
DLLEXPORT ENaddpattern(char *); | |||
DLLEXPORT ENsetpattern(int, float *, int); | |||
DLLEXPORT ENsetpatternvalue(int, int, float); | |||
DLLEXPORT ENsettimeparam(int, long); | |||
DLLEXPORT ENsetoption(int, float); | |||
DLLEXPORT ENsetstatusreport(int); | |||
DLLEXPORT ENsetqualtype(int, char *, char *, char *); | |||
/* functions for calling modified toolkit */ | |||
DLLEXPORT ENepanet_wrap(char *, char *, char *, void (*) (char *)); | |||
DLLEXPORT ENopen_wrap(char *, char *, char *); | |||
DLLEXPORT ENsaveinpfile_wrap(char *); | |||
DLLEXPORT ENclose_wrap(void); | |||
DLLEXPORT ENsolveH_wrap(void); | |||
DLLEXPORT ENsaveH_wrap(void); | |||
DLLEXPORT ENopenH_wrap(void); | |||
DLLEXPORT ENinitH_wrap(int); | |||
DLLEXPORT ENrunH_wrap(long *); | |||
DLLEXPORT ENnextH_wrap(long *); | |||
DLLEXPORT ENcloseH_wrap(void); | |||
DLLEXPORT ENsavehydfile_wrap(char *); | |||
DLLEXPORT ENusehydfile_wrap(char *); | |||
DLLEXPORT ENsolveQ_wrap(void); | |||
DLLEXPORT ENopenQ_wrap(void); | |||
DLLEXPORT ENinitQ_wrap(int); | |||
DLLEXPORT ENrunQ_wrap(long *); | |||
DLLEXPORT ENnextQ_wrap(long *); | |||
DLLEXPORT ENstepQ_wrap(long *); | |||
DLLEXPORT ENcloseQ_wrap(void); | |||
DLLEXPORT ENwriteline_wrap(char *); | |||
DLLEXPORT ENreport_wrap(void); | |||
DLLEXPORT ENresetreport_wrap(void); | |||
DLLEXPORT ENsetreport_wrap(char *); | |||
DLLEXPORT ENgetcontrol_wrap(int, int *, int *, float *, | |||
int *, float *); | |||
DLLEXPORT ENgetcount_wrap(int, int *); | |||
DLLEXPORT ENgetoption_wrap(int, float *); | |||
DLLEXPORT ENgettimeparam_wrap(int, long *); | |||
DLLEXPORT ENgetflowunits_wrap(int *); | |||
DLLEXPORT ENgetpatternindex_wrap(char *, int *); | |||
DLLEXPORT ENgetpatternid_wrap(int, char *); | |||
DLLEXPORT ENgetpatternlen_wrap(int, int *); | |||
DLLEXPORT ENgetpatternvalue_wrap(int, int, float *); | |||
DLLEXPORT ENgetqualtype_wrap(int *, int *); | |||
DLLEXPORT ENgeterror_wrap(int, char *, int); | |||
DLLEXPORT ENgetnodeindex_wrap(char *, int *); | |||
DLLEXPORT ENgetnodeid_wrap(int, char *); | |||
DLLEXPORT ENgetnodetype_wrap(int, int *); | |||
DLLEXPORT ENgetnodevalue_wrap(int, int, float *); | |||
DLLEXPORT ENgetlinkindex_wrap(char *, int *); | |||
DLLEXPORT ENgetlinkid_wrap(int, char *); | |||
DLLEXPORT ENgetlinktype_wrap(int, int *); | |||
DLLEXPORT ENgetlinknodes_wrap(int, int *, int *); | |||
DLLEXPORT ENgetlinkvalue_wrap(int, int, float *); | |||
DLLEXPORT ENgetversion_wrap(int *); | |||
DLLEXPORT ENsetcontrol_wrap(int, int, int, float, int, float); | |||
DLLEXPORT ENsetnodevalue_wrap(int, int, float); | |||
DLLEXPORT ENsetlinkvalue_wrap(int, int, float); | |||
DLLEXPORT ENaddpattern_wrap(char *); | |||
DLLEXPORT ENsetpattern_wrap(int, float *, int); | |||
DLLEXPORT ENsetpatternvalue_wrap(int, int, float); | |||
DLLEXPORT ENsettimeparam_wrap(int, long); | |||
DLLEXPORT ENsetoption_wrap(int, float); | |||
DLLEXPORT ENsetstatusreport_wrap(int); | |||
DLLEXPORT ENsetqualtype_wrap(int, char *, char *, char *); | |||
DLLEXPORT ENgetemitter_wrap(float *eexp_, float *ecup_); | |||
DLLEXPORT ENsetemitter_wrap(float eexp_, float ecup_); | |||
#endif | |||
</source> | |||
==See Also== | |||
* [[EPANET-Python]] - A python interface for EPANET 2.0 | |||
[[category:Computing]][[category:Unix]][[Category:Hydrology-Meteorology]] |
Latest revision as of 10:16, 1 June 2012
Matters related to EPANET2.0 emitter modification (EPANET-Emitter) (Assela Pathirana, UNESCO-IHE) will appear here.
What and Why
Under ideal operating conditions, water distribution networks have adequate operating pressure throughout the system, making the water withdrawal virtually independent of the system pressure -- the demand is fully determined by the end-of-pipe, customer behavior. However, there are many practical situations where the operating pressure of the networks are less than ideal -- due to excessive demand, among other reasons. Examples are contingencies like pipe breakage and day-to-day operation of many water networks of urban centers of the third world.
We modifed the EPANET 2.0 computational engine to implement pressure-sensitive demand in network calculations, in a way that is completely compatible with the existing user interface of the standard EPANET model. Further the EPANET-toolkit applications using the demand-driven EPANET (standard) engine can benefit from this modified form without changing any application code.
The new software is fully integrated to the EPANET 2.0 Graphical user interface.
Important Note
- Accidentally, a bug was introduced in compiling version 0.9. This results in wrong demands reported in GUI program. Until it is fixed, please use 0.3 instead!
Downloads
- Installation files
-
- Initial release, beta version: epanet2-emitter-setup-v0.3.zip
source code
- Note
- *Both these sources are organized as visual studio (2008) projects. (Free version will work fine)
- Please note that I am not in a position to provide support for working with this code.
- Source code of modified EPANet engine : File:En emitter source.rar
- A reference program showing how to call : File:En emitter ref.rar
Citing EPANET Emitter
Please use the following when citing the model.
EPANET2 Desktop Application for Pressure Driven Demand Modeling Assela Pathirana, ASCE Conf. Proc. 425, 8 (2010), DOI:10.1061/41203(425)8
- Download: File:ENEmitter WDSA210.pdf
Known Issues
- The program will not handle networks with emitters. This is due to the fact that emitters are used for the PDA calculation. In a future version, this will be attended to.
- The custom epanet2.dll will only work with the custom epanet2w.exe GUI and the other way around. This is because of the additional variable (ECUP) implemented in both epanet2.dll and epanet2w.exe.
- The .net files (binary format of EPANET2) produced by standard EPANET and the current edition are not interchangeable. However, text network format (.inp) of standard EPANET can be opened with EPANET-PDA. Network files created by EPANET-PDA will show an error (Error 201 at line nnn: [OPTIONS] ECUP x) when opened in standard EPANET, but this can be safely ignored.
- History
Bug Fixes
- 17:41, 5 March 2009 (JST) : version 0.4 : There was a name decoration issue in the epanet2.dll. The exported names were only undecorated ones (So that Delphi can call them). However, this made C++ to call original epanet calls instead of emitter-wrapper calls. Now C/C++ decorated names are also exported so that epanet2.dll can be used for toolkit calls with C/C++.
- 22:34, 15 June 2010 (JST) Added new routines to get and set Emitter exponent and ECUP from the toolkit. The set function must be called only after initH call.
- The above revision (version 0.9) introduced a new bug. Please use version 0.3 until it is fixed. Download links for 0.9 was removed.
Custom Header file
/*
** EPANET2.H
**
** C/C++ header file for EPANET Programmers Toolkit
**
** Last updated on 2/14/08 (2.00.12)
*/
#ifndef EPANET2_H
#define EPANET2_H
// --- 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_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_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_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
#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
#define EN_AGE 2
#define EN_TRACE 3
#define EN_CONCEN 0 /* Source quality types */
#define EN_MASS 1
#define EN_SETPOINT 2
#define EN_FLOWPACED 3
#define EN_CFS 0 /* Flow units types */
#define EN_GPM 1
#define EN_MGD 2
#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
#define EN_TIMER 2
#define EN_TIMEOFDAY 3
#define EN_AVERAGE 1 /* Time statistic types. */
#define EN_MINIMUM 2
#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 flow flag */
// --- define WINDOWS
#undef WINDOWS
#ifdef _WIN32
#define WINDOWS
#endif
#ifdef __WIN32__
#define WINDOWS
#endif
// --- define DLLEXPORT
#ifdef WINDOWS
#ifdef __cplusplus
#define DLLEXPORT extern "C" int __declspec(dllexport) __stdcall
#else
#define DLLEXPORT __declspec(dllexport) __stdcall
#endif
#else
#ifdef __cplusplus
#define DLLEXPORT extern "C"
#else
#define DLLEXPORT
#endif
#endif
// --- declare the EPANET toolkit functions
DLLEXPORT ENepanet(char *, char *, char *, void (*) (char *));
DLLEXPORT ENopen(char *, char *, char *);
DLLEXPORT ENsaveinpfile(char *);
DLLEXPORT ENclose(void);
DLLEXPORT ENsolveH(void);
DLLEXPORT ENsaveH(void);
DLLEXPORT ENopenH(void);
DLLEXPORT ENinitH(int);
DLLEXPORT ENrunH(long *);
DLLEXPORT ENnextH(long *);
DLLEXPORT ENcloseH(void);
DLLEXPORT ENsavehydfile(char *);
DLLEXPORT ENusehydfile(char *);
DLLEXPORT ENsolveQ(void);
DLLEXPORT ENopenQ(void);
DLLEXPORT ENinitQ(int);
DLLEXPORT ENrunQ(long *);
DLLEXPORT ENnextQ(long *);
DLLEXPORT ENstepQ(long *);
DLLEXPORT ENcloseQ(void);
DLLEXPORT ENwriteline(char *);
DLLEXPORT ENreport(void);
DLLEXPORT ENresetreport(void);
DLLEXPORT ENsetreport(char *);
DLLEXPORT ENgetcontrol(int, int *, int *, float *,
int *, float *);
DLLEXPORT ENgetcount(int, int *);
DLLEXPORT ENgetoption(int, float *);
DLLEXPORT ENgettimeparam(int, long *);
DLLEXPORT ENgetflowunits(int *);
DLLEXPORT ENgetpatternindex(char *, int *);
DLLEXPORT ENgetpatternid(int, char *);
DLLEXPORT ENgetpatternlen(int, int *);
DLLEXPORT ENgetpatternvalue(int, int, float *);
DLLEXPORT ENgetqualtype(int *, int *);
DLLEXPORT ENgeterror(int, char *, int);
DLLEXPORT ENgetnodeindex(char *, int *);
DLLEXPORT ENgetnodeid(int, char *);
DLLEXPORT ENgetnodetype(int, int *);
DLLEXPORT ENgetnodevalue(int, int, float *);
DLLEXPORT ENgetlinkindex(char *, int *);
DLLEXPORT ENgetlinkid(int, char *);
DLLEXPORT ENgetlinktype(int, int *);
DLLEXPORT ENgetlinknodes(int, int *, int *);
DLLEXPORT ENgetlinkvalue(int, int, float *);
DLLEXPORT ENgetversion(int *);
DLLEXPORT ENsetcontrol(int, int, int, float, int, float);
DLLEXPORT ENsetnodevalue(int, int, float);
DLLEXPORT ENsetlinkvalue(int, int, float);
DLLEXPORT ENaddpattern(char *);
DLLEXPORT ENsetpattern(int, float *, int);
DLLEXPORT ENsetpatternvalue(int, int, float);
DLLEXPORT ENsettimeparam(int, long);
DLLEXPORT ENsetoption(int, float);
DLLEXPORT ENsetstatusreport(int);
DLLEXPORT ENsetqualtype(int, char *, char *, char *);
/* functions for calling modified toolkit */
DLLEXPORT ENepanet_wrap(char *, char *, char *, void (*) (char *));
DLLEXPORT ENopen_wrap(char *, char *, char *);
DLLEXPORT ENsaveinpfile_wrap(char *);
DLLEXPORT ENclose_wrap(void);
DLLEXPORT ENsolveH_wrap(void);
DLLEXPORT ENsaveH_wrap(void);
DLLEXPORT ENopenH_wrap(void);
DLLEXPORT ENinitH_wrap(int);
DLLEXPORT ENrunH_wrap(long *);
DLLEXPORT ENnextH_wrap(long *);
DLLEXPORT ENcloseH_wrap(void);
DLLEXPORT ENsavehydfile_wrap(char *);
DLLEXPORT ENusehydfile_wrap(char *);
DLLEXPORT ENsolveQ_wrap(void);
DLLEXPORT ENopenQ_wrap(void);
DLLEXPORT ENinitQ_wrap(int);
DLLEXPORT ENrunQ_wrap(long *);
DLLEXPORT ENnextQ_wrap(long *);
DLLEXPORT ENstepQ_wrap(long *);
DLLEXPORT ENcloseQ_wrap(void);
DLLEXPORT ENwriteline_wrap(char *);
DLLEXPORT ENreport_wrap(void);
DLLEXPORT ENresetreport_wrap(void);
DLLEXPORT ENsetreport_wrap(char *);
DLLEXPORT ENgetcontrol_wrap(int, int *, int *, float *,
int *, float *);
DLLEXPORT ENgetcount_wrap(int, int *);
DLLEXPORT ENgetoption_wrap(int, float *);
DLLEXPORT ENgettimeparam_wrap(int, long *);
DLLEXPORT ENgetflowunits_wrap(int *);
DLLEXPORT ENgetpatternindex_wrap(char *, int *);
DLLEXPORT ENgetpatternid_wrap(int, char *);
DLLEXPORT ENgetpatternlen_wrap(int, int *);
DLLEXPORT ENgetpatternvalue_wrap(int, int, float *);
DLLEXPORT ENgetqualtype_wrap(int *, int *);
DLLEXPORT ENgeterror_wrap(int, char *, int);
DLLEXPORT ENgetnodeindex_wrap(char *, int *);
DLLEXPORT ENgetnodeid_wrap(int, char *);
DLLEXPORT ENgetnodetype_wrap(int, int *);
DLLEXPORT ENgetnodevalue_wrap(int, int, float *);
DLLEXPORT ENgetlinkindex_wrap(char *, int *);
DLLEXPORT ENgetlinkid_wrap(int, char *);
DLLEXPORT ENgetlinktype_wrap(int, int *);
DLLEXPORT ENgetlinknodes_wrap(int, int *, int *);
DLLEXPORT ENgetlinkvalue_wrap(int, int, float *);
DLLEXPORT ENgetversion_wrap(int *);
DLLEXPORT ENsetcontrol_wrap(int, int, int, float, int, float);
DLLEXPORT ENsetnodevalue_wrap(int, int, float);
DLLEXPORT ENsetlinkvalue_wrap(int, int, float);
DLLEXPORT ENaddpattern_wrap(char *);
DLLEXPORT ENsetpattern_wrap(int, float *, int);
DLLEXPORT ENsetpatternvalue_wrap(int, int, float);
DLLEXPORT ENsettimeparam_wrap(int, long);
DLLEXPORT ENsetoption_wrap(int, float);
DLLEXPORT ENsetstatusreport_wrap(int);
DLLEXPORT ENsetqualtype_wrap(int, char *, char *, char *);
DLLEXPORT ENgetemitter_wrap(float *eexp_, float *ecup_);
DLLEXPORT ENsetemitter_wrap(float eexp_, float ecup_);
#endif
See Also
- EPANET-Python - A python interface for EPANET 2.0