lixiaojun
2025-01-21 f589894c84d47b9671eef6d3a8337b6b51b32edb
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
/**
@defgroup Project Project Functions
These functions are used to manage a project.
*/
 
/**
@defgroup Hydraulics Hydraulic Analysis Functions
These functions are used to perform a hydraulic analysis.
*/
 
/**
@defgroup Quality Water Quality Analysis Functions
These functions are used to perform a water quality analysis.
*/
 
/**
@defgroup Reporting Reporting Functions
These functions are used to report simulation results.
*/
 
/**
@defgroup Options Analysis Options Functions
These functions are used to get and set analysis options.
*/
 
/**
@defgroup Nodes Network Node Functions
These functions are used for working with network nodes.
*/
 
/**
@defgroup Demands Nodal Demand Functions
These functions are used for managing nodal demands.
*/
 
/**
@defgroup Links Network Link Functions
These functions are used for working with network links.
*/
 
/**
@defgroup Patterns Time Pattern Functions
These functions are used for working with time patterns.
*/
 
/**
@defgroup Curves Data Curve Functions
These functions are used for working with data curves.
*/
 
/**
@defgroup Controls Simple Control Functions
These functions are used for working with simple conditional controls.
*/
 
/**
@defgroup Rules Rule-Based Control Functions
These functions are used for working with rule-based controls.
*/
 
/**
@defgroup Enumerations Enumerated Types
These are the toolkit's enumerated types whose members are used as function arguments.
*/
 
/**
@addtogroup Project
@{
@fn int EN_createproject(EN_Project *ph)
@fn int EN_deleteproject(EN_Project ph)
@fn int EN_runproject(EN_Project ph, const char *f1, const char *f2, const char *f3, void (*pviewprog)(char *))
@fn int EN_init(EN_Project ph, const char *rptFile, const char *outFile, int unitsType, int headLossType)
@fn int EN_open(EN_Project ph, const char *inpFile, const char *rptFile, const char *binOutFile)
@fn int EN_getcount(EN_Project ph, int code, int *count)
@fn int EN_gettitle(EN_Project ph, char *line1, char *line2, char *line3)
@fn int EN_settitle(EN_Project ph, char *line1, char *line2, char *line3)
@fn int EN_saveinpfile(EN_Project ph, const char *filename)
@fn int EN_close(EN_Project ph)
@}
*/
 
/**
@addtogroup Hydraulics
@{
@fn int EN_solveH(EN_Project ph)
@fn int EN_usehydfile(EN_Project ph, const char *filename)
@fn int EN_openH(EN_Project ph)
@fn int EN_initH(EN_Project ph, int initFlag)
@fn int EN_runH(EN_Project ph, long *currentTime)
@fn int EN_nextH(EN_Project ph, long *tStep)
@fn int EN_saveH(EN_Project ph)
@fn int EN_savehydfile(EN_Project ph, const char *filename)
@fn int EN_closeH(EN_Project ph)
@}
*/
 
/**
@addtogroup Quality
@{
@fn int EN_solveQ(EN_Project ph)
@fn int EN_openQ(EN_Project ph)
@fn int EN_initQ(EN_Project ph, int saveFlag)
@fn int EN_runQ(EN_Project ph, long *currentTime)
@fn int EN_nextQ(EN_Project ph, long *tStep)
@fn int EN_stepQ(EN_Project ph, long *timeLeft)
@fn int EN_closeQ(EN_Project ph)
@}
*/
 
/**
@addtogroup Reporting
@{
@fn int EN_writeline(EN_Project ph, char *line)
@fn int EN_report(EN_Project ph)
@fn int EN_copyreport(EN_Project ph, char *filename)
@fn int EN_clearreport(EN_Project ph)
@fn int EN_resetreport(EN_Project ph)
@fn int EN_setreport(EN_Project ph, char *reportFormat)
@fn int EN_setstatusreport(EN_Project ph, int code)
@fn int EN_getversion(int *version)
@fn int EN_geterror(int errcode, char *errmsg, int maxLen)
@fn int EN_getstatistic(EN_Project ph, int type, double* value)
@fn int EN_getresultindex(EN_Project ph, int type, int index, int *value)
 
@}
*/
 
/**
@addtogroup Options
@{
@fn int EN_getoption(EN_Project ph, int option, double *value)
@fn int EN_setoption(EN_Project ph, int option, double value)
@fn int EN_getflowunits(EN_Project ph, int *units)
@fn int EN_setflowunits(EN_Project ph, int units)
@fn int EN_gettimeparam(EN_Project ph, int param, long *value)
@fn int EN_settimeparam(EN_Project ph, int param, long value)
@fn int EN_getqualinfo(EN_Project ph, int *qualType, char *chemName, char *chemUnits, int *traceNode)
@fn int EN_getqualtype(EN_Project ph, int *qualType, int *traceNode)
@fn int EN_setqualtype(EN_Project ph, int qualType, char *chemName, char *chemUnits, char *traceNode)
@}
*/
 
/**
@addtogroup Nodes
@{
@fn int EN_addnode(EN_Project ph, char *id, int nodeType, int *index)
@fn int EN_deletenode(EN_Project ph, int index, int actionCode)
@fn int EN_getnodeindex(EN_Project ph, char *id, int *index)
@fn int EN_getnodeid(EN_Project ph, int index, char *id)
@fn int EN_setnodeid(EN_Project ph, int index, char *newid)
@fn int EN_getnodetype(EN_Project ph, int index, int *code)
@fn int EN_getnodevalue(EN_Project ph, int index, int code, double *value)
@fn int EN_setnodevalue(EN_Project ph, int index, int code, double v)
@fn int EN_setjuncdata(EN_Project ph, int index, double elev, double dmnd, char *dmndpat)
@fn int EN_settankdata(EN_Project ph, int index, double elev, double initlvl,
        double minlvl, double maxlvl, double diam, double minvol, char *volcurve)
@fn int EN_getcoord(EN_Project ph, int index, double *x, double *y)
@fn int EN_setcoord(EN_Project ph, int index, double x, double y)
@}
*/
 
/**
@addtogroup Demands
@{
@fn int EN_getdemandmodel(EN_Project ph, int *type, double *pmin, double *preq, double *pexp)
@fn int EN_setdemandmodel(EN_Project ph, int type, double pmin, double preq, double pexp)
@fn int EN_adddemand(EN_Project ph, int nodeIndex, double baseDemand, char *demandPattern, char *demandName)
@fn int EN_deletedemand(EN_Project ph, int nodeIndex, int demandIndex)
@fn int EN_getdemandindex(EN_Project p, int nodeIndex, char *demandName, int *demandIndex)
@fn int EN_getnumdemands(EN_Project ph, int nodeIndex, int *numDemands)
@fn int EN_getbasedemand(EN_Project ph, int nodeIndex, int demandIndex, double *baseDemand)
@fn int EN_setbasedemand(EN_Project ph, int nodeIndex, int demandIndex, double baseDemand)
@fn int EN_getdemandpattern(EN_Project ph, int nodeIndex, int demandIndex, int *pattIndex)
@fn int EN_setdemandpattern(EN_Project ph, int nodeIndex, int demandIndex, int patIndex)
@fn int EN_getdemandname(EN_Project ph, int nodeIndex, int demandIdx, char *demandName)
@fn int EN_setdemandname(EN_Project ph, int nodeIndex, int demandIdx, char *demandName)
@}
*/
 
/**
@addtogroup Links
@{
@fn int EN_addlink(EN_Project ph, char *id, int linkType, char *fromNode, char *toNode, int *index)
@fn int EN_deletelink(EN_Project ph, int index, int actionCode)
@fn int EN_getlinkindex(EN_Project ph, char *id, int *index)
@fn int EN_getlinkid(EN_Project ph, int index, char *id)
@fn int EN_setlinkid(EN_Project ph, int index, char *newid)
@fn int EN_getlinktype(EN_Project ph, int index, int *linkType)
@fn int EN_setlinktype(EN_Project ph, int *index, int linkType, int actionCode)
@fn int EN_getlinknodes(EN_Project ph, int index, int *node1, int *node2)
@fn int EN_setlinknodes(EN_Project ph, int index, int node1, int node2)
@fn int EN_getlinkvalue(EN_Project ph, int index, int property, double *value)
@fn int EN_setlinkvalue(EN_Project ph, int index, int property, double value)
@fn int EN_setpipedata(EN_Project ph, int index, double length, double diam, double rough,  double mloss)
@fn int EN_getpumptype(EN_Project ph, int linkIndex, int *pumpType)
@fn int EN_getheadcurveindex(EN_Project ph, int pumpIndex, int *curveIndex)
@fn int EN_setheadcurveindex(EN_Project ph, int pumpIndex, int curveIndex)
@fn int EN_getvertexcount(EN_Project ph, int index, int *count)
@fn int EN_getvertex(EN_Project ph, int index, int vertex, double *x, double *y)
@fn int EN_setvertices(EN_Project ph, int index, double *x, double *y, int count)
@}
*/
 
/**
@addtogroup Patterns
@{
@fn int EN_addpattern(EN_Project ph, char *id)
@fn int EN_deletepattern(EN_Project ph, int index)
@fn int EN_getpatternindex(EN_Project ph, char *id, int *index)
@fn int EN_getpatternid(EN_Project ph, int index, char *id)
@fn int EN_setpatternid(EN_Project ph, int index, char *id)
@fn int EN_getpatternlen(EN_Project ph, int index, int *len)
@fn int EN_getpatternvalue(EN_Project ph, int index, int period, double *value)
@fn int EN_setpatternvalue(EN_Project ph, int index, int period, double value)
@fn int EN_getaveragepatternvalue(EN_Project ph, int index, double *value)
@fn int EN_setpattern(EN_Project ph, int index, double *f, int len)
@}
*/
 
/**
@addtogroup Curves
@{
@fn int EN_addcurve(EN_Project ph, char *id)
@fn int EN_deletecurve(EN_Project ph, int index)
@fn int EN_getcurveindex(EN_Project ph, char *id, int *index)
@fn int EN_getcurveid(EN_Project ph, int index, char *id)
@fn int EN_setcurveid(EN_Project ph, int index, char *id)
@fn int EN_getcurvelen(EN_Project ph, int index, int *len)
@fn int EN_getcurvetype(EN_Project ph, int index, int *type)
@fn int EN_getcurvevalue(EN_Project ph, int curveIndex, int pointIndex, double *x, double *y)
@fn int EN_setcurvevalue(EN_Project ph, int curveIndex, int pointIndex, double x, double y)
@fn int EN_getcurve(EN_Project ph, int curveIndex, char* id, int *nPoints, double **xValues, double **yValues)
@fn int EN_setcurve(EN_Project ph, int index, double *xValues, double *yValues, int nPoints)
@}
*/
 
/**
@addtogroup Controls
@{
@fn int EN_addcontrol(EN_Project ph, int type, int linkIndex, double setting, int nodeIndex, double level, int *index)
@fn int EN_deletecontrol(EN_Project ph, int index)
@fn int EN_getcontrol(EN_Project ph, int index, int *type, int *linkIndex, double *setting, int *nodeIndex, double *level)
@fn int EN_setcontrol(EN_Project ph, int index, int type, int linkIndex, double setting, int nodeIndex, double level)
@}
*/
 
/**
@addtogroup Rules
@{
@fn int EN_addrule(EN_Project ph, char *rule)
@fn int EN_deleterule(EN_Project ph, int index)
@fn int EN_getrule(EN_Project ph, int index, int *nPremises, int *nThenActions, int *nElseActions, double *priority)
@fn int EN_getruleID(EN_Project ph, int index, char* id);
@fn int EN_getpremise(EN_Project ph, int ruleIndex, int premiseIndex, int *logop,  int *object, int *objIndex,
        int *variable, int *relop, int *status, double *value)
@fn int EN_setpremise(EN_Project ph, int ruleIndex, int premiseIndex,
                 int logop, int object, int objIndex, int variable, int relop, int status, double value)
@fn int EN_setpremiseindex(EN_Project ph, int ruleIndex, int premiseIndex, int objIndex)
@fn int EN_setpremisestatus(EN_Project ph, int ruleIndex, int premiseIndex, int status)
@fn int EN_setpremisevalue(EN_Project ph, int ruleIndex, int premiseIndex, double value)
@fn int EN_getthenaction(EN_Project ph, int ruleIndex, int actionIndex, int *linkIndex, int *status, double *setting)
@fn int EN_setthenaction(EN_Project ph, int ruleIndex, int actionIndex, int linkIndex, int status, double setting)
@fn int EN_getelseaction(EN_Project ph, int ruleIndex, int actionIndex, int *linkIndex, int *status, double *setting)
@fn int EN_setelseaction(EN_Project ph, int ruleIndex, int actionIndex, int linkIndex, int status, double setting)
@fn int EN_setrulepriority(EN_Project ph, int index, double priority)
@}
*/
 
/**
@addtogroup Enumerations
@{
\enum EN_SizeLimits
\enum EN_ObjectType
\enum EN_CountType
\enum EN_NodeType
\enum EN_LinkType
\enum EN_PumpType
\enum EN_PumpStateType
\enum EN_CurveType
\enum EN_QualityType
\enum EN_SourceType
\enum EN_ControlType
\enum EN_HeadLossType
\enum EN_NodeProperty
\enum EN_LinkProperty
\enum EN_LinkStatusType
\enum EN_TimeParameter
\enum EN_Option
\enum EN_FlowUnits
\enum EN_DemandModel
\enum EN_MixingModel
\enum EN_StatisticType
\enum EN_InitHydOption
\enum EN_ActionCodeType
\enum EN_AnalysisStatistic
\enum EN_StatusReport
\enum EN_RuleObject
\enum EN_RuleVariable
\enum EN_RuleOperator
\enum EN_RuleStatus
\def EN_MISSING
@}
*/
 
/**
@defgroup ErrorCodes Error Codes
 
| Code | Meaning                           |
|------|---------                          |
| 0    | No error                          |
| 101  | Insufficient memory available     |
| 102  | No network data available         |
| 103  | Hydraulic solver not opened   |
| 104  | No hydraulics for water quality analysis |
| 105  | Water quality solver not opened |
| 106  | No results saved to report on |
| 107  | Hydraulics supplied from external file |
| 108  | Cannot use external file while hydraulics solver is open |
| 110  | Cannot solve network hydraulic equations |
| 120  | Cannot solve water quality transport equations |
|  ||
| 200  | One or more errors in an input file |
| 201  | Syntax error |
| 202  | Function call contains an illegal numeric value |
| 203  | Function call refers to an undefined node |
| 204  | Function call refers to an undefined link |
| 205  | Function call refers to an undefined time pattern |
| 206  | Function call refers to an undefined curve |
| 207  | Function call attempts to control a check valve pipe or a GPV valve |
| 208  | Function call contains illegal PDA pressure limits |
| 209  | Function call contains an illegal node property value |
| 211  | Function call contains an illegal link property value |
| 212  | Function call refers to an undefined Trace Node |
| 213  | Function call contains an invalid option value |
| 214  | Too many characters in a line of an input file |
| 215  | Function call contains a duplicate ID label |
| 216  | Function call refers to an undefined pump |
| 217  | Invalid pump energy data |
| 219  | Illegal valve connection to tank node |
| 220  | Illegal valve connection to another valve |
| 221  | Mis-placed clause in rule-based control |
| 222  | Link assigned same start and end nodes |
| 223  | Not enough nodes in network |
| 224  | No tanks or reservoirs in network |
| 225  | Invalid lower/upper levels for tank |
| 226  | No head curve or power rating for pump |
| 227  | Invalid head curve for pump |
| 230  | Nonincreasing x-values for curve |
| 233  | Network has unconnected node |
| 240  | Function call refers to nonexistent water quality source |
| 241  | Function call refers to nonexistent control |
| 250  | Function call contains invalid format (e.g. too long an ID name) |
| 251  | Function call contains invalid parameter code |
| 253  | Function call refers to nonexistent demand category |
| 254  | Function call refers to node with no coordinates |
| 257  | Function call refers to nonexistent rule |
| 258  | Function call refers to nonexistent rule clause |
| 259  | Function call attempts to delete a node that still has links connected to it |
| 260  | Function call attempts to delete node assigned as a Trace Node |
| 261  | Function call attempts to delete a node or link contained in a control |
| 262  | Function call attempts to modify network structure while a solver is open |
|  ||
| 301  | Identical file names used for different types of files |
| 302  | Cannot open input file |
| 303  | Cannot open report file |
| 304  | Cannot open output file |
| 305  | Cannot open hydraulics file |
| 306  | Hydraulics file does not match network data |
| 307  | Cannot read hydraulics file |
| 308  | Cannot save results to binary file |
| 309  | Cannot save results to report file |
 
*/
 
/**
@defgroup WarningCodes Warning Codes
 
| Code | Description                       |
|------|---------                          |
|1 | System hydraulically unbalanced - convergence to a hydraulic solution was not achieved in the allowed number of trials |
|2 | System may be hydraulically unstable - hydraulic convergence was only achieved after the status of all links was held fixed |
|3 | System disconnected - one or more nodes with positive demands were disconnected from all supply sources |
|4 | Pumps cannot deliver enough flow or head - one or more pumps were forced to either shut down (due to insufficient head) or operate beyond the maximum rated flow |
|5 | Valves cannot deliver enough flow - one or more flow control valves could not deliver the required flow even when fully open |
|6 | System has negative pressures - negative pressures occurred at one or more junctions with positive demand |
 
*/