-
Notifications
You must be signed in to change notification settings - Fork 0
/
toolkit.h
293 lines (244 loc) · 8.99 KB
/
toolkit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
/*
*******************************************************************
TOOLKIT.H - Prototypes for EPANET Functions Exported to DLL Toolkit
VERSION: threaded.r177svn
AUTHOR: M. Lopez-Ibanez (M. L\'opez-Ib\'a\~nez)
Napier University, Edinburgh, UK.
$LastChangedBy: manu $ $Revision: 149 $
$LastChangedDate: 2007-11-20 19:34:51 +0100 (Tue, 20 Nov 2007) $
---------------------------------------------------------------------
Copyright (c) 2005, 2006 Manuel Lopez-Ibanez
TeX: \copyright 2005, 2006 Manuel L\'opez-Ib\'a\~nez
This program is free software (software libre); you can redistribute
it and/or modify it under the terms of version 2 of the GNU General
Public License version as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, you can obtain a copy of the GNU
General Public License at:
http://www.gnu.org/copyleft/gpl.html
or by writing to:
Free Software Foundation, Inc., 59 Temple Place,
Suite 330, Boston, MA 02111-1307 USA
----------------------------------------------------------------------
----------------------------------------------------------------------
Original public domain sources (no license) from:
VERSION: threaded.r177svn
DATE: 5/8/00
10/25/00
3/1/01
AUTHOR: L. Rossman
US EPA - NRMRL
*******************************************************************
*/
#define EPANET_VERSION "undefined"
typedef struct _ENsimulation_t * ENsimulation_t;
#ifndef LINUX
#ifdef DLL
#ifdef __cplusplus
#define DLLEXPORT extern "C" __declspec(dllexport) __stdcall
#else
#define DLLEXPORT __declspec(dllexport) __stdcall
#endif
#else
#define DLLEXPORT
#endif
#else
#define DLLEXPORT
#endif
/* These are codes used by the DLL functions */
#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_VOLUME 20
#define EN_INITVOL 21
#define EN_MAXLEVEL 30
#define EN_MINLEVEL 31
#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_UPATTERN 20
#define EN_SCHEDULE 21
#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_CLOCKSTART 20
#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_PUMPCOUNT 6
#define EN_RESERVCOUNT 7
#define EN_JUNCSCOUNT 8
#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_NOSAVE 0 /* Save-results-to-file flag */
#define EN_SAVE 1
/*** Updated 3/1/01 ***/
#define EN_INITFLOW 10 /* Re-initialize flows flag */
#define EN_MAX_ID_LEN 15 // Max. # characters in ID name
#define EN_MAX_MSG_LEN 79 // Max. # characters in message text
#define EN_MAX_FILENAME_LEN 259 // Max. # characters in file name
/* These are the external functions that comprise the DLL */
/*** Updated 3/1/01 ***/
int DLLEXPORT ENepanet(char *, char *, char *, void (*) (char *));
int DLLEXPORT ENopen(char *, char *, char *);
#if 0
int DLLEXPORT ENsaveinpfile(char *);
#endif
int DLLEXPORT ENclose(void);
int DLLEXPORT ENsolveH(void);
#if 0
int DLLEXPORT ENsaveH(void);
#endif
int DLLEXPORT ENopenH(ENsimulation_t *);
int DLLEXPORT ENinitH(ENsimulation_t, int);
int DLLEXPORT ENrunH(ENsimulation_t, long *);
int DLLEXPORT ENnextH(ENsimulation_t, long *);
int DLLEXPORT ENcloseH(ENsimulation_t);
#if 0
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 *);
#endif
int DLLEXPORT ENgetcontrol(ENsimulation_t, 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 *);
#if 0
int DLLEXPORT ENgetqualtype(int *, int *);
#endif
int DLLEXPORT ENgeterror(int, char *, int);
int DLLEXPORT ENgetnodeindex(char *, int *);
int DLLEXPORT ENgetnodeid(int, char *);
int DLLEXPORT ENgetnodetype(int, int *);
int DLLEXPORT ENgetnodevalue(ENsimulation_t, int, int, float *);
int DLLEXPORT ENgetlinkindex(char *, int *);
int DLLEXPORT ENgetlinkid(int, char *);
int DLLEXPORT ENgetlinktype(int, int *);
int DLLEXPORT ENgetlinknodes(int, int *, int *);
int DLLEXPORT ENgetlinkvalue(ENsimulation_t, int, int, float *);
/*** Updated 10/25/00 ***/
int DLLEXPORT ENgetversion(int *);
int DLLEXPORT ENsetcontrol(ENsimulation_t, int, int, int, float, int, float);
#if 0
int DLLEXPORT ENsetnodevalue(int, int, float);
#endif
int DLLEXPORT ENsetlinkvalue(ENsimulation_t, int, int, float);
int DLLEXPORT ENsetpattern(ENsimulation_t, int, float *, int);
int DLLEXPORT ENsetpatternvalue(ENsimulation_t, int, int, float);
int DLLEXPORT ENsettimeparam(int, long);
int DLLEXPORT ENsetoption(int, float);
#if 0
int DLLEXPORT ENsetstatusreport(int);
int DLLEXPORT ENsetqualtype(int, char *, char *, char *);
#endif
int DLLEXPORT ENaddpattern(char *id);
int DLLEXPORT ENgettotalenergycost(ENsimulation_t, float *cost);
int DLLEXPORT ENgetpumpswitches(ENsimulation_t, int index, int *value);
int DLLEXPORT ENgetpumpindex(int pump_index, int *link_index);
int DLLEXPORT ENgettankindex(int tank_index, int *node_index);
#if 0
int DLLEXPORT ENaddleveltrigger(int pump_index, int tank_index,
int start_time, int stop_time,
float level, int status);
#endif
int DLLEXPORT ENgetminstoptime(ENsimulation_t, int index, int *value);
int DLLEXPORT ENrulesclear(void);
int DLLEXPORT ENgetnumwarnings(ENsimulation_t);
int DLLEXPORT ENgettotaldemand(ENsimulation_t, float *demand);
int DLLEXPORT ENgettotalinflow(ENsimulation_t, float *inflow);
int DLLEXPORT ENgettotalleakage(ENsimulation_t, float *leakage);
int DLLEXPORT ENgetnode_xcoord(int index, float *x);
int DLLEXPORT ENgetnode_ycoord(int index, float *y);