@model-create/epanet-engine 0.7.1-alpha.2 → 0.8.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +7 -8
- package/dist/index.d.ts +1661 -681
- package/dist/index.js +91 -15
- package/package.json +16 -16
- package/Dockerfile +0 -9
- package/build.sh +0 -59
- package/dist/index.es6.js +0 -3
- package/dist/index.html +0 -319
- package/index.html +0 -319
- package/src/epanet_wrapper.cpp +0 -1131
- package/src/index.d.ts +0 -691
- package/src/wrapper/cjs-postfix.js +0 -7
- package/src/wrapper/cjs-prefix.js +0 -9
- package/src/wrapper/es6-postfix.js +0 -2
- package/test.c +0 -54
package/dist/index.d.ts
CHANGED
|
@@ -1,691 +1,1671 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// Definitions by: Kensuke Matsuzaki <https://github.com/zakki>
|
|
4
|
-
// Periklis Tsirakidis <https://github.com/periklis>
|
|
5
|
-
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
6
|
-
// TypeScript Version: 2.2
|
|
7
|
-
|
|
8
|
-
/** Other WebAssembly declarations, for compatibility with older versions of Typescript */
|
|
9
|
-
declare namespace WebAssembly {
|
|
10
|
-
interface Module {}
|
|
11
|
-
}
|
|
1
|
+
// Generated from epanet2_2.h on 2025-05-07T18:36:00.035Z
|
|
2
|
+
// WARNING: This file is auto-generated. Do not edit manually.
|
|
12
3
|
|
|
13
|
-
|
|
14
|
-
interface FileSystemType {}
|
|
15
|
-
type EnvironmentType = "WEB" | "NODE" | "SHELL" | "WORKER";
|
|
16
|
-
type ValueType = "number" | "string" | "array" | "boolean";
|
|
17
|
-
type TypeCompatibleWithC = number | string | any[] | boolean;
|
|
18
|
-
|
|
19
|
-
type WebAssemblyImports = Array<{
|
|
20
|
-
name: string;
|
|
21
|
-
kind: string;
|
|
22
|
-
}>;
|
|
23
|
-
|
|
24
|
-
type WebAssemblyExports = Array<{
|
|
25
|
-
module: string;
|
|
26
|
-
name: string;
|
|
27
|
-
kind: string;
|
|
28
|
-
}>;
|
|
29
|
-
|
|
30
|
-
interface CCallOpts {
|
|
31
|
-
async?: boolean;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
4
|
+
type Pointer = number;
|
|
34
5
|
|
|
35
|
-
interface
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
preRun: Array<{ (): void }>;
|
|
42
|
-
postRun: Array<{ (): void }>;
|
|
43
|
-
onAbort: { (what: any): void };
|
|
44
|
-
onRuntimeInitialized: { (): void };
|
|
45
|
-
preinitializedWebGLContext: WebGLRenderingContext;
|
|
46
|
-
noInitialRun: boolean;
|
|
47
|
-
noExitRuntime: boolean;
|
|
48
|
-
logReadFiles: boolean;
|
|
49
|
-
filePackagePrefixURL: string;
|
|
50
|
-
wasmBinary: ArrayBuffer;
|
|
51
|
-
|
|
52
|
-
destroy(object: object): void;
|
|
53
|
-
getPreloadedPackage(
|
|
54
|
-
remotePackageName: string,
|
|
55
|
-
remotePackageSize: number
|
|
56
|
-
): ArrayBuffer;
|
|
57
|
-
instantiateWasm(
|
|
58
|
-
imports: Emscripten.WebAssemblyImports,
|
|
59
|
-
successCallback: (module: WebAssembly.Module) => void
|
|
60
|
-
): Emscripten.WebAssemblyExports;
|
|
61
|
-
locateFile(url: string): string;
|
|
62
|
-
onCustomMessage(event: MessageEvent): void;
|
|
63
|
-
|
|
64
|
-
Runtime: any;
|
|
65
|
-
|
|
66
|
-
ccall(
|
|
67
|
-
ident: string,
|
|
68
|
-
returnType: Emscripten.ValueType | null,
|
|
69
|
-
argTypes: Emscripten.ValueType[],
|
|
70
|
-
args: Emscripten.TypeCompatibleWithC[],
|
|
71
|
-
opts?: Emscripten.CCallOpts
|
|
72
|
-
): any;
|
|
73
|
-
cwrap(
|
|
74
|
-
ident: string,
|
|
75
|
-
returnType: Emscripten.ValueType | null,
|
|
76
|
-
argTypes: Emscripten.ValueType[],
|
|
77
|
-
opts?: Emscripten.CCallOpts
|
|
78
|
-
): (...args: any[]) => any;
|
|
79
|
-
|
|
80
|
-
setValue(ptr: number, value: any, type: string, noSafe?: boolean): void;
|
|
81
|
-
getValue(ptr: number, type: string, noSafe?: boolean): number;
|
|
82
|
-
|
|
83
|
-
ALLOC_NORMAL: number;
|
|
84
|
-
ALLOC_STACK: number;
|
|
85
|
-
ALLOC_STATIC: number;
|
|
86
|
-
ALLOC_DYNAMIC: number;
|
|
87
|
-
ALLOC_NONE: number;
|
|
88
|
-
|
|
89
|
-
allocate(
|
|
90
|
-
slab: any,
|
|
91
|
-
types: string | string[],
|
|
92
|
-
allocator: number,
|
|
93
|
-
ptr: number
|
|
94
|
-
): number;
|
|
95
|
-
|
|
96
|
-
// USE_TYPED_ARRAYS == 1
|
|
97
|
-
HEAP: Int32Array;
|
|
98
|
-
IHEAP: Int32Array;
|
|
99
|
-
FHEAP: Float64Array;
|
|
100
|
-
|
|
101
|
-
// USE_TYPED_ARRAYS == 2
|
|
102
|
-
HEAP8: Int8Array;
|
|
103
|
-
HEAP16: Int16Array;
|
|
104
|
-
HEAP32: Int32Array;
|
|
105
|
-
HEAPU8: Uint8Array;
|
|
106
|
-
HEAPU16: Uint16Array;
|
|
107
|
-
HEAPU32: Uint32Array;
|
|
108
|
-
HEAPF32: Float32Array;
|
|
109
|
-
HEAPF64: Float64Array;
|
|
110
|
-
|
|
111
|
-
TOTAL_STACK: number;
|
|
112
|
-
TOTAL_MEMORY: number;
|
|
113
|
-
FAST_MEMORY: number;
|
|
114
|
-
|
|
115
|
-
addOnPreRun(cb: () => any): void;
|
|
116
|
-
addOnInit(cb: () => any): void;
|
|
117
|
-
addOnPreMain(cb: () => any): void;
|
|
118
|
-
addOnExit(cb: () => any): void;
|
|
119
|
-
addOnPostRun(cb: () => any): void;
|
|
120
|
-
|
|
121
|
-
// Tools
|
|
122
|
-
intArrayFromString(
|
|
123
|
-
stringy: string,
|
|
124
|
-
dontAddNull?: boolean,
|
|
125
|
-
length?: number
|
|
126
|
-
): number[];
|
|
127
|
-
intArrayToString(array: number[]): string;
|
|
128
|
-
writeStringToMemory(str: string, buffer: number, dontAddNull: boolean): void;
|
|
129
|
-
writeArrayToMemory(array: number[], buffer: number): void;
|
|
130
|
-
writeAsciiToMemory(str: string, buffer: number, dontAddNull: boolean): void;
|
|
131
|
-
|
|
132
|
-
addRunDependency(id: any): void;
|
|
133
|
-
removeRunDependency(id: any): void;
|
|
134
|
-
|
|
135
|
-
preloadedImages: any;
|
|
136
|
-
preloadedAudios: any;
|
|
137
|
-
|
|
138
|
-
_malloc(size: number): number;
|
|
139
|
-
_free(ptr: number): void;
|
|
140
|
-
|
|
141
|
-
// Exported Functions - LB
|
|
142
|
-
FS: EmscriptenFileSysten;
|
|
143
|
-
UTF8ToString(ptr: number, maxBytesToRead?: number): string;
|
|
144
|
-
getversion(ptr: number): number;
|
|
145
|
-
geterror(errorCode: number, ptr: number): number;
|
|
146
|
-
Epanet: EpanetProjectConstructable;
|
|
6
|
+
// TODO: Define EmscriptenFS interface more completely if needed
|
|
7
|
+
interface EmscriptenFS {
|
|
8
|
+
mkdir(path: string): void;
|
|
9
|
+
writeFile(path: string, data: string | Uint8Array, opts?: { encoding?: 'utf8' | 'binary' }): void;
|
|
10
|
+
readFile(path: string, opts?: { encoding: 'utf8' | 'binary' }): string | Uint8Array;
|
|
11
|
+
// Add other FS methods you use
|
|
147
12
|
}
|
|
148
13
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
unitsType: number,
|
|
164
|
-
headLossType: number
|
|
165
|
-
): number;
|
|
166
|
-
getcount(obj: number, count: number): number;
|
|
167
|
-
gettitle(out_line1: number, out_line2: number, out_line3: number): number;
|
|
168
|
-
settitle(line1: string, line2: string, line3: string): number;
|
|
169
|
-
saveinpfile(filename: string): number;
|
|
170
|
-
|
|
171
|
-
// Hydraulic Analysis Functions
|
|
172
|
-
solveH(): number;
|
|
173
|
-
usehydfile(filename: string): number;
|
|
174
|
-
openH(): number;
|
|
175
|
-
initH(initFlag: number): number;
|
|
176
|
-
runH(currentTime: number): number;
|
|
177
|
-
nextH(tStep: number): number;
|
|
178
|
-
saveH(): number;
|
|
179
|
-
savehydfile(filename: string): number;
|
|
180
|
-
closeH(): number;
|
|
181
|
-
|
|
182
|
-
// Water Quality Analysis Functions
|
|
183
|
-
solveQ(): number;
|
|
184
|
-
openQ(): number;
|
|
185
|
-
initQ(initFlag: number): number;
|
|
186
|
-
runQ(currentTime: number): number;
|
|
187
|
-
nextQ(tStep: number): number;
|
|
188
|
-
stepQ(timeLeft: number): number;
|
|
189
|
-
closeQ(): number;
|
|
190
|
-
|
|
191
|
-
// Reporting Functions
|
|
192
|
-
writeline(line: string): number;
|
|
193
|
-
report(): number;
|
|
194
|
-
copyreport(filename: string): number;
|
|
195
|
-
clearreport(): number;
|
|
196
|
-
resetreport(): number;
|
|
197
|
-
setreport(format: string): number;
|
|
198
|
-
setstatusreport(level: number): number;
|
|
199
|
-
getstatistic(type: number, value: number): number;
|
|
200
|
-
getresultindex(type: number, index: number, value: number): number;
|
|
201
|
-
|
|
202
|
-
// Analysis Options Functions
|
|
203
|
-
getflowunits(units: number): number;
|
|
204
|
-
getoption(option: number, value: number): number;
|
|
205
|
-
getqualinfo(
|
|
206
|
-
qualType: number,
|
|
207
|
-
out_chemName: number,
|
|
208
|
-
out_chemUnits: number,
|
|
209
|
-
traceNode: number
|
|
210
|
-
): number;
|
|
211
|
-
getqualtype(qualType: number, traceNode: number): number;
|
|
212
|
-
gettimeparam(param: number, value: number): number;
|
|
213
|
-
setflowunits(units: number): number;
|
|
214
|
-
setoption(option: number, value: number): number;
|
|
215
|
-
setqualtype(
|
|
216
|
-
qualType: number,
|
|
217
|
-
chemName: string,
|
|
218
|
-
chemUnits: string,
|
|
219
|
-
traceNode: string
|
|
220
|
-
): number;
|
|
221
|
-
settimeparam(param: number, value: number): number;
|
|
222
|
-
|
|
223
|
-
// Network Node Functions
|
|
224
|
-
addnode(id: string, nodeType: number, index: number): number;
|
|
225
|
-
deletenode(index: number, actionCode: number): number;
|
|
226
|
-
getnodeindex(id: string, index: number): number;
|
|
227
|
-
getnodeid(index: number, out_id: number): number;
|
|
228
|
-
setnodeid(index: number, newid: string): number;
|
|
229
|
-
getnodetype(index: number, nodeType: number): number;
|
|
230
|
-
getnodevalue(index: number, property: number, value: number): number;
|
|
231
|
-
setnodevalue(index: number, property: number, value: number): number;
|
|
232
|
-
setjuncdata(
|
|
233
|
-
index: number,
|
|
234
|
-
elev: number,
|
|
235
|
-
dmnd: number,
|
|
236
|
-
dmndpat: string
|
|
237
|
-
): number;
|
|
238
|
-
settankdata(
|
|
239
|
-
index: number,
|
|
240
|
-
elev: number,
|
|
241
|
-
initlvl: number,
|
|
242
|
-
minlvl: number,
|
|
243
|
-
maxlvl: number,
|
|
244
|
-
diam: number,
|
|
245
|
-
minvol: number,
|
|
246
|
-
volcurve: string
|
|
247
|
-
): number;
|
|
248
|
-
getcoord(index: number, x: number, y: number): number;
|
|
249
|
-
setcoord(index: number, x: number, y: number): number;
|
|
250
|
-
|
|
251
|
-
//Nodal Demand Functions
|
|
252
|
-
adddemand(
|
|
253
|
-
nodeIndex: number,
|
|
254
|
-
baseDemand: number,
|
|
255
|
-
demandPattern: string,
|
|
256
|
-
demandName: string
|
|
257
|
-
): number;
|
|
258
|
-
deletedemand(nodeIndex: number, demandIndex: number): number;
|
|
259
|
-
getbasedemand(
|
|
260
|
-
nodeIndex: number,
|
|
261
|
-
demandIndex: number,
|
|
262
|
-
baseDemand: number
|
|
263
|
-
): number;
|
|
264
|
-
getdemandindex(
|
|
265
|
-
nodeIndex: number,
|
|
266
|
-
demandName: string,
|
|
267
|
-
demandIndex: number
|
|
268
|
-
): number;
|
|
269
|
-
getdemandmodel(
|
|
270
|
-
type: number,
|
|
271
|
-
pmin: number,
|
|
272
|
-
preq: number,
|
|
273
|
-
pexp: number
|
|
274
|
-
): number;
|
|
275
|
-
getdemandname(
|
|
276
|
-
nodeIndex: number,
|
|
277
|
-
demandIndex: number,
|
|
278
|
-
out_demandName: number
|
|
279
|
-
): number;
|
|
280
|
-
getdemandpattern(
|
|
281
|
-
nodeIndex: number,
|
|
282
|
-
demandIndex: number,
|
|
283
|
-
patIndex: number
|
|
284
|
-
): number;
|
|
285
|
-
getnumdemands(nodeIndex: number, numDemands: number): number;
|
|
286
|
-
setbasedemand(
|
|
287
|
-
nodeIndex: number,
|
|
288
|
-
demandIndex: number,
|
|
289
|
-
baseDemand: number
|
|
290
|
-
): number;
|
|
291
|
-
setdemandmodel(
|
|
292
|
-
type: number,
|
|
293
|
-
pmin: number,
|
|
294
|
-
preq: number,
|
|
295
|
-
pexp: number
|
|
296
|
-
): number;
|
|
297
|
-
setdemandname(
|
|
298
|
-
nodeIndex: number,
|
|
299
|
-
demandIdx: number,
|
|
300
|
-
demandName: string
|
|
301
|
-
): number;
|
|
302
|
-
setdemandpattern(
|
|
303
|
-
nodeIndex: number,
|
|
304
|
-
demandIndex: number,
|
|
305
|
-
patIndex: number
|
|
306
|
-
): number;
|
|
307
|
-
|
|
308
|
-
// Network Link Functions
|
|
309
|
-
addlink(
|
|
310
|
-
id: string,
|
|
311
|
-
linkType: number,
|
|
312
|
-
fromNode: string,
|
|
313
|
-
toNode: string,
|
|
314
|
-
index: number
|
|
315
|
-
): number;
|
|
316
|
-
deletelink(index: number, actionCode: number): number;
|
|
317
|
-
getlinkindex(id: string, index: number): number;
|
|
318
|
-
getlinkid(index: number, out_id: number): number;
|
|
319
|
-
setlinkid(index: number, newid: string): number;
|
|
320
|
-
getlinktype(index: number, linkType: number): number;
|
|
321
|
-
setlinktype(
|
|
322
|
-
inout_index: number,
|
|
323
|
-
linkType: number,
|
|
324
|
-
actionCode: number
|
|
325
|
-
): number;
|
|
326
|
-
getlinknodes(index: number, node1: number, node2: number): number;
|
|
327
|
-
setlinknodes(index: number, node1: number, node2: number): number;
|
|
328
|
-
getlinkvalue(index: number, property: number, value: number): number;
|
|
329
|
-
setlinkvalue(index: number, property: number, value: number): number;
|
|
330
|
-
setpipedata(
|
|
331
|
-
index: number,
|
|
332
|
-
length: number,
|
|
333
|
-
diam: number,
|
|
334
|
-
rough: number,
|
|
335
|
-
mloss: number
|
|
336
|
-
): number;
|
|
337
|
-
getpumptype(linkIndex: number, pumpType: number): number;
|
|
338
|
-
getheadcurveindex(linkIndex: number, curveIndex: number): number;
|
|
339
|
-
setheadcurveindex(linkIndex: number, curveIndex: number): number;
|
|
340
|
-
getvertexcount(index: number, count: number): number;
|
|
341
|
-
getvertex(index: number, vertex: number, x: number, y: number): number;
|
|
342
|
-
setvertices(index: number, x: number, y: number, count: number): number;
|
|
343
|
-
|
|
344
|
-
// Time Pattern Functions
|
|
345
|
-
addpattern(id: string): number;
|
|
346
|
-
deletepattern(index: number): number;
|
|
347
|
-
getpatternindex(id: string, index: number): number;
|
|
348
|
-
getpatternid(index: number, out_id: number): number;
|
|
349
|
-
setpatternid(index: number, id: string): number;
|
|
350
|
-
getpatternlen(index: number, len: number): number;
|
|
351
|
-
getpatternvalue(index: number, period: number, value: number): number;
|
|
352
|
-
setpatternvalue(index: number, period: number, value: number): number;
|
|
353
|
-
getaveragepatternvalue(index: number, value: number): number;
|
|
354
|
-
setpattern(index: number, values: number, len: number): number;
|
|
355
|
-
|
|
356
|
-
// Data Curve Functions
|
|
357
|
-
addcurve(id: string): number;
|
|
358
|
-
deletecurve(index: number): number;
|
|
359
|
-
getcurveindex(id: string, index: number): number;
|
|
360
|
-
getcurveid(index: number, out_id: number): number;
|
|
361
|
-
setcurveid(index: number, id: string): number;
|
|
362
|
-
getcurvelen(index: number, len: number): number;
|
|
363
|
-
getcurvetype(index: number, type: number): number;
|
|
364
|
-
getcurvevalue(
|
|
365
|
-
curveIndex: number,
|
|
366
|
-
pointIndex: number,
|
|
367
|
-
x: number,
|
|
368
|
-
y: number
|
|
369
|
-
): number;
|
|
370
|
-
setcurvevalue(
|
|
371
|
-
curveIndex: number,
|
|
372
|
-
pointIndex: number,
|
|
373
|
-
x: number,
|
|
374
|
-
y: number
|
|
375
|
-
): number;
|
|
376
|
-
setcurve(
|
|
377
|
-
index: number,
|
|
378
|
-
xValues: number,
|
|
379
|
-
yValues: number,
|
|
380
|
-
nPoints: number
|
|
381
|
-
): number;
|
|
382
|
-
|
|
383
|
-
// Simple Control Functions
|
|
384
|
-
addcontrol(
|
|
385
|
-
type: number,
|
|
386
|
-
linkIndex: number,
|
|
387
|
-
setting: number,
|
|
388
|
-
nodeIndex: number,
|
|
389
|
-
level: number,
|
|
390
|
-
index: number
|
|
391
|
-
): number;
|
|
392
|
-
deletecontrol(index: number): number;
|
|
393
|
-
getcontrol(
|
|
394
|
-
index: number,
|
|
395
|
-
type: number,
|
|
396
|
-
linkIndex: number,
|
|
397
|
-
setting: number,
|
|
398
|
-
nodeIndex: number,
|
|
399
|
-
level: number
|
|
400
|
-
): number;
|
|
401
|
-
setcontrol(
|
|
402
|
-
index: number,
|
|
403
|
-
type: number,
|
|
404
|
-
linkIndex: number,
|
|
405
|
-
setting: number,
|
|
406
|
-
nodeIndex: number,
|
|
407
|
-
level: number
|
|
408
|
-
): number;
|
|
409
|
-
|
|
410
|
-
// Rule-Based Control Functions
|
|
411
|
-
addrule(rule: string): number;
|
|
412
|
-
deleterule(index: number): number;
|
|
413
|
-
getrule(
|
|
414
|
-
index: number,
|
|
415
|
-
nPremises: number,
|
|
416
|
-
nThenActions: number,
|
|
417
|
-
nElseActions: number,
|
|
418
|
-
priority: number
|
|
419
|
-
): number;
|
|
420
|
-
getruleID(index: number, out_id: number): number;
|
|
421
|
-
getpremise(
|
|
422
|
-
ruleIndex: number,
|
|
423
|
-
premiseIndex: number,
|
|
424
|
-
logop: number,
|
|
425
|
-
object: number,
|
|
426
|
-
objIndex: number,
|
|
427
|
-
variable: number,
|
|
428
|
-
relop: number,
|
|
429
|
-
status: number,
|
|
430
|
-
value: number
|
|
431
|
-
): number;
|
|
432
|
-
setpremise(
|
|
433
|
-
ruleIndex: number,
|
|
434
|
-
premiseIndex: number,
|
|
435
|
-
logop: number,
|
|
436
|
-
object: number,
|
|
437
|
-
objIndex: number,
|
|
438
|
-
variable: number,
|
|
439
|
-
relop: number,
|
|
440
|
-
status: number,
|
|
441
|
-
value: number
|
|
442
|
-
): number;
|
|
443
|
-
setpremiseindex(
|
|
444
|
-
ruleIndex: number,
|
|
445
|
-
premiseIndex: number,
|
|
446
|
-
objIndex: number
|
|
447
|
-
): number;
|
|
448
|
-
setpremisestatus(
|
|
449
|
-
ruleIndex: number,
|
|
450
|
-
premiseIndex: number,
|
|
451
|
-
status: number
|
|
452
|
-
): number;
|
|
453
|
-
setpremisevalue(
|
|
454
|
-
ruleIndex: number,
|
|
455
|
-
premiseIndex: number,
|
|
456
|
-
value: number
|
|
457
|
-
): number;
|
|
458
|
-
getthenaction(
|
|
459
|
-
ruleIndex: number,
|
|
460
|
-
actionIndex: number,
|
|
461
|
-
linkIndex: number,
|
|
462
|
-
status: number,
|
|
463
|
-
setting: number
|
|
464
|
-
): number;
|
|
465
|
-
setthenaction(
|
|
466
|
-
ruleIndex: number,
|
|
467
|
-
actionIndex: number,
|
|
468
|
-
linkIndex: number,
|
|
469
|
-
status: number,
|
|
470
|
-
setting: number
|
|
471
|
-
): number;
|
|
472
|
-
getelseaction(
|
|
473
|
-
ruleIndex: number,
|
|
474
|
-
actionIndex: number,
|
|
475
|
-
linkIndex: number,
|
|
476
|
-
status: number,
|
|
477
|
-
setting: number
|
|
478
|
-
): number;
|
|
479
|
-
setelseaction(
|
|
480
|
-
ruleIndex: number,
|
|
481
|
-
actionIndex: number,
|
|
482
|
-
linkIndex: number,
|
|
483
|
-
status: number,
|
|
484
|
-
setting: number
|
|
485
|
-
): number;
|
|
486
|
-
setrulepriority(index: number, priority: number): number;
|
|
487
|
-
}
|
|
14
|
+
export interface EpanetModule {
|
|
15
|
+
// --- Standard Emscripten Runtime ---
|
|
16
|
+
_malloc(size: number): Pointer;
|
|
17
|
+
_free(ptr: Pointer): void;
|
|
18
|
+
FS: EmscriptenFS;
|
|
19
|
+
getValue(ptr: Pointer, type: 'i8' | 'i16' | 'i32' | 'i64' | 'float' | 'double' | '*' | string, noSafe?: boolean): number;
|
|
20
|
+
lengthBytesUTF8(str: string): number;
|
|
21
|
+
stringToUTF8(str: string, outPtr: Pointer, maxBytesToWrite: number): void;
|
|
22
|
+
stringToNewUTF8(str: string): Pointer;
|
|
23
|
+
UTF8ToString(ptr: Pointer): string;
|
|
24
|
+
HEAP8: Int8Array;
|
|
25
|
+
HEAP32: Int32Array;
|
|
26
|
+
HEAPF64: Float64Array;
|
|
27
|
+
// Add any other EXPORTED_RUNTIME_METHODS here
|
|
488
28
|
|
|
489
|
-
//
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
): string | Uint8Array;
|
|
499
|
-
writeFile(
|
|
500
|
-
path: string,
|
|
501
|
-
data: string | ArrayBufferView,
|
|
502
|
-
opts?: { flags?: string }
|
|
503
|
-
): void;
|
|
504
|
-
}
|
|
29
|
+
// --- Exported EPANET Functions ---
|
|
30
|
+
/**
|
|
31
|
+
* Creates an EPANET project.
|
|
32
|
+
*
|
|
33
|
+
* @param ph [out] an EPANET project handle that is passed into all other API functions.
|
|
34
|
+
* @returns an error code.
|
|
35
|
+
EN_createproject must be called before any other API functions are used.
|
|
36
|
+
*/
|
|
37
|
+
_EN_createproject(ph: Pointer): number;
|
|
505
38
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
interface ErrnoError {}
|
|
515
|
-
|
|
516
|
-
let ignorePermissions: boolean;
|
|
517
|
-
let trackingDelegate: any;
|
|
518
|
-
let tracking: any;
|
|
519
|
-
let genericErrors: any;
|
|
520
|
-
|
|
521
|
-
//
|
|
522
|
-
// paths
|
|
523
|
-
//
|
|
524
|
-
function lookupPath(path: string, opts: any): Lookup;
|
|
525
|
-
function getPath(node: FSNode): string;
|
|
526
|
-
|
|
527
|
-
//
|
|
528
|
-
// nodes
|
|
529
|
-
//
|
|
530
|
-
function isFile(mode: number): boolean;
|
|
531
|
-
function isDir(mode: number): boolean;
|
|
532
|
-
function isLink(mode: number): boolean;
|
|
533
|
-
function isChrdev(mode: number): boolean;
|
|
534
|
-
function isBlkdev(mode: number): boolean;
|
|
535
|
-
function isFIFO(mode: number): boolean;
|
|
536
|
-
function isSocket(mode: number): boolean;
|
|
537
|
-
|
|
538
|
-
//
|
|
539
|
-
// devices
|
|
540
|
-
//
|
|
541
|
-
function major(dev: number): number;
|
|
542
|
-
function minor(dev: number): number;
|
|
543
|
-
function makedev(ma: number, mi: number): number;
|
|
544
|
-
function registerDevice(dev: number, ops: any): void;
|
|
545
|
-
|
|
546
|
-
//
|
|
547
|
-
// core
|
|
548
|
-
//
|
|
549
|
-
function syncfs(populate: boolean, callback: (e: any) => any): void;
|
|
550
|
-
function syncfs(callback: (e: any) => any, populate?: boolean): void;
|
|
551
|
-
function mount(
|
|
552
|
-
type: Emscripten.FileSystemType,
|
|
553
|
-
opts: any,
|
|
554
|
-
mountpoint: string
|
|
555
|
-
): any;
|
|
556
|
-
function unmount(mountpoint: string): void;
|
|
557
|
-
|
|
558
|
-
function mkdir(path: string, mode?: number): any;
|
|
559
|
-
function mkdev(path: string, mode?: number, dev?: number): any;
|
|
560
|
-
function symlink(oldpath: string, newpath: string): any;
|
|
561
|
-
function rename(old_path: string, new_path: string): void;
|
|
562
|
-
function rmdir(path: string): void;
|
|
563
|
-
function readdir(path: string): any;
|
|
564
|
-
function unlink(path: string): void;
|
|
565
|
-
function readlink(path: string): string;
|
|
566
|
-
function stat(path: string, dontFollow?: boolean): any;
|
|
567
|
-
function lstat(path: string): any;
|
|
568
|
-
function chmod(path: string, mode: number, dontFollow?: boolean): void;
|
|
569
|
-
function lchmod(path: string, mode: number): void;
|
|
570
|
-
function fchmod(fd: number, mode: number): void;
|
|
571
|
-
function chown(
|
|
572
|
-
path: string,
|
|
573
|
-
uid: number,
|
|
574
|
-
gid: number,
|
|
575
|
-
dontFollow?: boolean
|
|
576
|
-
): void;
|
|
577
|
-
function lchown(path: string, uid: number, gid: number): void;
|
|
578
|
-
function fchown(fd: number, uid: number, gid: number): void;
|
|
579
|
-
function truncate(path: string, len: number): void;
|
|
580
|
-
function ftruncate(fd: number, len: number): void;
|
|
581
|
-
function utime(path: string, atime: number, mtime: number): void;
|
|
582
|
-
function open(
|
|
583
|
-
path: string,
|
|
584
|
-
flags: string,
|
|
585
|
-
mode?: number,
|
|
586
|
-
fd_start?: number,
|
|
587
|
-
fd_end?: number
|
|
588
|
-
): FSStream;
|
|
589
|
-
function close(stream: FSStream): void;
|
|
590
|
-
function llseek(stream: FSStream, offset: number, whence: number): any;
|
|
591
|
-
function read(
|
|
592
|
-
stream: FSStream,
|
|
593
|
-
buffer: ArrayBufferView,
|
|
594
|
-
offset: number,
|
|
595
|
-
length: number,
|
|
596
|
-
position?: number
|
|
597
|
-
): number;
|
|
598
|
-
function write(
|
|
599
|
-
stream: FSStream,
|
|
600
|
-
buffer: ArrayBufferView,
|
|
601
|
-
offset: number,
|
|
602
|
-
length: number,
|
|
603
|
-
position?: number,
|
|
604
|
-
canOwn?: boolean
|
|
605
|
-
): number;
|
|
606
|
-
function allocate(stream: FSStream, offset: number, length: number): void;
|
|
607
|
-
function mmap(
|
|
608
|
-
stream: FSStream,
|
|
609
|
-
buffer: ArrayBufferView,
|
|
610
|
-
offset: number,
|
|
611
|
-
length: number,
|
|
612
|
-
position: number,
|
|
613
|
-
prot: number,
|
|
614
|
-
flags: number
|
|
615
|
-
): any;
|
|
616
|
-
function ioctl(stream: FSStream, cmd: any, arg: any): any;
|
|
617
|
-
function readFile(
|
|
618
|
-
path: string,
|
|
619
|
-
opts?: { encoding?: "binary" | "utf8"; flags?: string }
|
|
620
|
-
): string | Uint8Array;
|
|
621
|
-
function writeFile(
|
|
622
|
-
path: string,
|
|
623
|
-
data: string | ArrayBufferView,
|
|
624
|
-
opts?: { flags?: string }
|
|
625
|
-
): void;
|
|
626
|
-
|
|
627
|
-
//
|
|
628
|
-
// module-level FS code
|
|
629
|
-
//
|
|
630
|
-
function cwd(): string;
|
|
631
|
-
function chdir(path: string): void;
|
|
632
|
-
function init(
|
|
633
|
-
input: null | (() => number | null),
|
|
634
|
-
output: null | ((c: number) => any),
|
|
635
|
-
error: null | ((c: number) => any)
|
|
636
|
-
): void;
|
|
637
|
-
|
|
638
|
-
function createLazyFile(
|
|
639
|
-
parent: string | FSNode,
|
|
640
|
-
name: string,
|
|
641
|
-
url: string,
|
|
642
|
-
canRead: boolean,
|
|
643
|
-
canWrite: boolean
|
|
644
|
-
): FSNode;
|
|
645
|
-
function createPreloadedFile(
|
|
646
|
-
parent: string | FSNode,
|
|
647
|
-
name: string,
|
|
648
|
-
url: string,
|
|
649
|
-
canRead: boolean,
|
|
650
|
-
canWrite: boolean,
|
|
651
|
-
onload?: () => void,
|
|
652
|
-
onerror?: () => void,
|
|
653
|
-
dontCreateFile?: boolean,
|
|
654
|
-
canOwn?: boolean
|
|
655
|
-
): void;
|
|
656
|
-
}
|
|
39
|
+
/**
|
|
40
|
+
* Deletes a currently opened EPANET project.
|
|
41
|
+
*
|
|
42
|
+
* @param ph [out] an EPANET project handle which is returned as NULL.
|
|
43
|
+
* @returns an error code.
|
|
44
|
+
EN_deleteproject should be called after all network analysis has been completed.
|
|
45
|
+
*/
|
|
46
|
+
_EN_deleteproject(ph: Pointer): number;
|
|
657
47
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
maxBytesToRead?: number
|
|
675
|
-
): void;
|
|
676
|
-
declare function lengthBytesUTF16(str: string): number;
|
|
677
|
-
declare function UTF32ToString(ptr: number): string;
|
|
678
|
-
declare function stringToUTF32(
|
|
679
|
-
str: string,
|
|
680
|
-
outPtr: number,
|
|
681
|
-
maxBytesToRead?: number
|
|
682
|
-
): void;
|
|
683
|
-
declare function lengthBytesUTF32(str: string): number;
|
|
684
|
-
|
|
685
|
-
interface Math {
|
|
686
|
-
imul(a: number, b: number): number;
|
|
48
|
+
/**
|
|
49
|
+
* Runs a complete EPANET simulation.
|
|
50
|
+
*
|
|
51
|
+
* @param ph an EPANET project handle.
|
|
52
|
+
* @param inpFile the name of an existing EPANET-formatted input file.
|
|
53
|
+
* @param rptFile the name of a report file to be created (or "" if not needed)
|
|
54
|
+
* @param outFile the name of a binary output file to be created (or "" if not needed)
|
|
55
|
+
* @param pviewprog a callback function that takes a character string (char *) as its only parameter.
|
|
56
|
+
* @returns an error code
|
|
57
|
+
The callback function should reside in and be used by the calling code to display
|
|
58
|
+
the progress messages that EPANET generates as it carries out its computations. Here is
|
|
59
|
+
an example of a such a function that displays progress messages to stdout:
|
|
60
|
+
\code {.c}
|
|
61
|
+
void writeConsole(char *s)
|
|
62
|
+
{
|
|
63
|
+
fprintf(stdout, "\n%s", s);
|
|
687
64
|
}
|
|
65
|
+
\endcode
|
|
66
|
+
It would be passed into EN_runproject as `&writeConsole`. If this feature is not needed then
|
|
67
|
+
the pviewprog argument should be `NULL`.
|
|
68
|
+
*/
|
|
69
|
+
_EN_runproject(ph: Pointer, inpFile: Pointer, rptFile: Pointer, outFile: Pointer, pviewprog: Pointer): number;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Initializes an EPANET project.
|
|
73
|
+
*
|
|
74
|
+
* @param ph an EPANET project handle.
|
|
75
|
+
* @param rptFile the name of a report file to be created (or "" if not needed).
|
|
76
|
+
* @param outFile the name of a binary output file to be created (or "" if not needed).
|
|
77
|
+
* @param unitsType the choice of flow units (see @ref EN_FlowUnits).
|
|
78
|
+
* @param headLossType the choice of head loss formula (see @ref EN_HeadLossType).
|
|
79
|
+
* @returns an error code.
|
|
80
|
+
This function should be called immediately after ::EN_createproject if an EPANET-formatted input
|
|
81
|
+
file will not be used to supply network data. If the project receives it's network data
|
|
82
|
+
from an input file then there is no need to call this function.
|
|
83
|
+
*/
|
|
84
|
+
_EN_init(ph: Pointer, rptFile: Pointer, outFile: Pointer, unitsType: number, headLossType: number): number;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Opens an EPANET input file & reads in network data.
|
|
88
|
+
*
|
|
89
|
+
* @param ph an EPANET project handle.
|
|
90
|
+
* @param inpFile the name of an existing EPANET-formatted input file.
|
|
91
|
+
* @param rptFile the name of a report file to be created (or "" if not needed).
|
|
92
|
+
* @param outFile the name of a binary output file to be created (or "" if not needed).
|
|
93
|
+
* @returns an error code.
|
|
94
|
+
This function should be called immediately after ::EN_createproject if an EPANET-formatted
|
|
95
|
+
input file will be used to supply network data.
|
|
96
|
+
*/
|
|
97
|
+
_EN_open(ph: Pointer, inpFile: Pointer, rptFile: Pointer, outFile: Pointer): number;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Retrieves the title lines of the project
|
|
101
|
+
*
|
|
102
|
+
* @param ph an EPANET project handle.
|
|
103
|
+
* @param out_line1 [out] first title line
|
|
104
|
+
* @param out_line2 [out] second title line
|
|
105
|
+
* @param out_line3 [out] third title line
|
|
106
|
+
* @returns an error code
|
|
107
|
+
*/
|
|
108
|
+
_EN_gettitle(ph: Pointer, out_line1: Pointer, out_line2: Pointer, out_line3: Pointer): number;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Sets the title lines of the project
|
|
112
|
+
*
|
|
113
|
+
* @param ph an EPANET project handle.
|
|
114
|
+
* @param line1 first title line
|
|
115
|
+
* @param line2 second title line
|
|
116
|
+
* @param line3 third title line
|
|
117
|
+
* @returns an error code
|
|
118
|
+
*/
|
|
119
|
+
_EN_settitle(ph: Pointer, line1: Pointer, line2: Pointer, line3: Pointer): number;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Retrieves a descriptive comment assigned to a Node, Link, Pattern or Curve.
|
|
123
|
+
*
|
|
124
|
+
* @param ph an EPANET project handle.
|
|
125
|
+
* @param object a type of object (either EN_NODE, EN_LINK, EN_TIMEPAT or EN_CURVE)
|
|
126
|
+
* @param index the object's index starting from 1
|
|
127
|
+
* @param out_comment [out] the comment string assigned to the object
|
|
128
|
+
* @returns an error code
|
|
129
|
+
*/
|
|
130
|
+
_EN_getcomment(ph: Pointer, object: number, index: number, out_comment: Pointer): number;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Assigns a descriptive comment to a Node, Link, Pattern or Curve.
|
|
134
|
+
*
|
|
135
|
+
* @param ph an EPANET project handle.
|
|
136
|
+
* @param object a type of object (either EN_NODE, EN_LINK, EN_TIMEPAT or EN_CURVE)
|
|
137
|
+
* @param index the object's index starting from 1
|
|
138
|
+
* @param comment [out] the comment string assigned to the object
|
|
139
|
+
* @returns an error code
|
|
140
|
+
*/
|
|
141
|
+
_EN_setcomment(ph: Pointer, object: number, index: number, comment: Pointer): number;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Retrieves the number of objects of a given type in a project.
|
|
145
|
+
*
|
|
146
|
+
* @param ph an EPANET project handle.
|
|
147
|
+
* @param object a type of object to count (see @ref EN_CountType)
|
|
148
|
+
* @param count [out] number of objects of the specified type
|
|
149
|
+
* @returns an error code
|
|
150
|
+
*/
|
|
151
|
+
_EN_getcount(ph: Pointer, object: number, count: Pointer): number;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Saves a project's data to an EPANET-formatted text file.
|
|
155
|
+
*
|
|
156
|
+
* @param ph an EPANET project handle.
|
|
157
|
+
* @param filename the name of the file to create.
|
|
158
|
+
* @returns Error code
|
|
159
|
+
*/
|
|
160
|
+
_EN_saveinpfile(ph: Pointer, filename: Pointer): number;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Closes a project and frees all of its memory.
|
|
164
|
+
*
|
|
165
|
+
* @param ph an EPANET project handle.
|
|
166
|
+
* @returns Error code
|
|
167
|
+
This function clears all existing data from a project but does not delete the
|
|
168
|
+
project, so it can be re-used with another set of network data. Use ::EN_deleteproject
|
|
169
|
+
to actually delete a project from memory.
|
|
170
|
+
*/
|
|
171
|
+
_EN_close(ph: Pointer): number;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Runs a complete hydraulic simulation with results for all time periods
|
|
175
|
+
written to a temporary hydraulics file.
|
|
176
|
+
*
|
|
177
|
+
* @param ph an EPANET project handle.
|
|
178
|
+
* @returns an error code.
|
|
179
|
+
Use ::EN_solveH to generate a complete hydraulic solution which can stand alone
|
|
180
|
+
or be used as input to a water quality analysis. This function will not allow one to
|
|
181
|
+
examine intermediate hydraulic results as they are generated. It can also be followed by calls
|
|
182
|
+
to ::EN_saveH and ::EN_report to write hydraulic results to the report file.
|
|
183
|
+
The sequence ::EN_openH - ::EN_initH - ::EN_runH - ::EN_nextH - ::EN_closeH
|
|
184
|
+
can be used instead to gain access to results at intermediate time periods and
|
|
185
|
+
directly adjust link status and control settings as a simulation proceeds.
|
|
186
|
+
<b>Example:</b>
|
|
187
|
+
\code {.c}
|
|
188
|
+
EN_Project ph;
|
|
189
|
+
EN_createproject(&ph);
|
|
190
|
+
EN_open(ph, "net1.inp", "net1.rpt", "");
|
|
191
|
+
EN_solveH(ph);
|
|
192
|
+
EN_solveQ(ph);
|
|
193
|
+
EN_report(ph);
|
|
194
|
+
EN_deleteproject(ph);
|
|
195
|
+
\endcode
|
|
196
|
+
*/
|
|
197
|
+
_EN_solveH(ph: Pointer): number;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Uses a previously saved binary hydraulics file to supply a project's hydraulics.
|
|
201
|
+
*
|
|
202
|
+
* @param ph an EPANET project handle.
|
|
203
|
+
* @param filename the name of the binary file containing hydraulic results.
|
|
204
|
+
* @returns an error code.
|
|
205
|
+
Call this function to re-use a set of hydraulic analysis results saved previously. This
|
|
206
|
+
can save computational time if water quality analyses are being made under the same set
|
|
207
|
+
of hydraulic conditions.
|
|
208
|
+
Do not call this function while the hydraulics solver is open.
|
|
209
|
+
*/
|
|
210
|
+
_EN_usehydfile(ph: Pointer, filename: Pointer): number;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Opens a project's hydraulic solver.
|
|
214
|
+
*
|
|
215
|
+
* @param ph an EPANET project handle.
|
|
216
|
+
* @returns an error code.
|
|
217
|
+
Call ::EN_openH prior to running the first hydraulic analysis using the
|
|
218
|
+
::EN_initH - ::EN_runH - ::EN_nextH sequence. Multiple analyses can be made before
|
|
219
|
+
calling ::EN_closeH to close the hydraulic solver.
|
|
220
|
+
Do not call this function if ::EN_solveH is being used to run a complete hydraulic
|
|
221
|
+
analysis or if hydraulics are being supplied by a previously saved hydraulics file
|
|
222
|
+
using ::EN_usehydfile.
|
|
223
|
+
*/
|
|
224
|
+
_EN_openH(ph: Pointer): number;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Initializes a network prior to running a hydraulic analysis.
|
|
228
|
+
*
|
|
229
|
+
* @param ph an EPANET project handle.
|
|
230
|
+
* @param initFlag a 2-digit initialization flag (see @ref EN_InitHydOption).
|
|
231
|
+
* @returns an error code.
|
|
232
|
+
This function initializes storage tank levels, link status and settings, and
|
|
233
|
+
the simulation time clock prior to running a hydraulic analysis.
|
|
234
|
+
The initialization flag is a two digit number where the 1st (left) digit
|
|
235
|
+
indicates if link flows should be re-initialized (1) or not (0), and the
|
|
236
|
+
2nd digit indicates if hydraulic results should be saved to a temporary
|
|
237
|
+
binary hydraulics file (1) or not (0).
|
|
238
|
+
Be sure to call ::EN_initH prior to running a hydraulic analysis using a
|
|
239
|
+
::EN_runH - ::EN_nextH loop.
|
|
240
|
+
Choose to save hydraulics results if you will be:
|
|
241
|
+
- making a subsequent water quality run,
|
|
242
|
+
- using ::EN_report to generate a report
|
|
243
|
+
- using ::EN_savehydfile to save the binary hydraulics file.
|
|
244
|
+
There is no need to save hydraulics if you will be writing custom code to
|
|
245
|
+
process hydraulic results as they are generated using the functions ::EN_getnodevalue
|
|
246
|
+
and ::EN_getlinkvalue.
|
|
247
|
+
*/
|
|
248
|
+
_EN_initH(ph: Pointer, initFlag: number): number;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Computes a hydraulic solution for the current point in time.
|
|
252
|
+
*
|
|
253
|
+
* @param ph an EPANET project handle.
|
|
254
|
+
* @param currentTime [out] the current simulation time in seconds.
|
|
255
|
+
* @returns an error or warning code.
|
|
256
|
+
This function is used in a loop with ::EN_nextH to run an extended period hydraulic
|
|
257
|
+
simulation. This process automatically updates the simulation clock time so \b currentTime
|
|
258
|
+
should be treated as a read-only variable.
|
|
259
|
+
::EN_initH must have been called prior to running the ::EN_runH - ::EN_nextH loop.
|
|
260
|
+
See ::EN_nextH for an example of using this function.
|
|
261
|
+
*/
|
|
262
|
+
_EN_runH(ph: Pointer, currentTime: Pointer): number;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Determines the length of time until the next hydraulic event occurs in an
|
|
266
|
+
extended period simulation.
|
|
267
|
+
*
|
|
268
|
+
* @param ph an EPANET project handle.
|
|
269
|
+
* @param tStep [out] the time (in seconds) until the next hydraulic event or 0 if at
|
|
270
|
+
the end of the full simulation duration.
|
|
271
|
+
* @returns an error code.
|
|
272
|
+
This function is used in a loop with ::EN_runH to run an extended period hydraulic
|
|
273
|
+
simulation.
|
|
274
|
+
The value of \b tstep should be treated as a read-only variable. It is automatically
|
|
275
|
+
computed as the smaller of:
|
|
276
|
+
- the time interval until the next hydraulic time step begins
|
|
277
|
+
- the time interval until the next reporting time step begins
|
|
278
|
+
- the time interval until the next change in demands occurs
|
|
279
|
+
- the time interval until a tank becomes full or empty
|
|
280
|
+
- the time interval until a control or rule fires.
|
|
281
|
+
<B>Example:</B>
|
|
282
|
+
\code {.c}
|
|
283
|
+
long t, tstep;
|
|
284
|
+
EN_openH(ph);
|
|
285
|
+
EN_initH(ph, EN_NOSAVE);
|
|
286
|
+
do {
|
|
287
|
+
EN_runH(ph, &t);
|
|
288
|
+
// Retrieve hydraulic results for time t
|
|
289
|
+
EN_nextH(ph, &tstep);
|
|
290
|
+
} while (tstep > 0);
|
|
291
|
+
EN_closeH(ph);
|
|
292
|
+
\endcode
|
|
293
|
+
*/
|
|
294
|
+
_EN_nextH(ph: Pointer, tStep: Pointer): number;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Transfers a project's hydraulics results from its temporary hydraulics file
|
|
298
|
+
to its binary output file, where results are only reported at uniform reporting intervals.
|
|
299
|
+
*
|
|
300
|
+
* @param ph an EPANET project handle.
|
|
301
|
+
* @returns an error code.
|
|
302
|
+
::EN_saveH is used when only a hydraulic analysis is run and results at uniform reporting
|
|
303
|
+
intervals need to be transferred to a project's binary output file. Such would be the case
|
|
304
|
+
when results are to be written in formatted fashion to the project's report file using ::EN_report.
|
|
305
|
+
*/
|
|
306
|
+
_EN_saveH(ph: Pointer): number;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Saves a project's temporary hydraulics file to disk.
|
|
310
|
+
*
|
|
311
|
+
* @param ph an EPANET project handle.
|
|
312
|
+
* @param filename the name of the file to be created.
|
|
313
|
+
* @returns an error code.
|
|
314
|
+
Use this function to save the current set of hydraulics results to a file, either for
|
|
315
|
+
post-processing or to be used at a later time by calling the ::EN_usehydfile function.
|
|
316
|
+
The hydraulics file contains nodal demands and heads and link flows, status, and settings
|
|
317
|
+
for all hydraulic time steps, even intermediate ones.
|
|
318
|
+
Before calling this function hydraulic results must have been generated and saved by having
|
|
319
|
+
called ::EN_solveH or the ::EN_initH - ::EN_runH - ::EN_nextH sequence with the initflag
|
|
320
|
+
argument of ::EN_initH set to \b EN_SAVE or \b EN_SAVE_AND_INIT.
|
|
321
|
+
*/
|
|
322
|
+
_EN_savehydfile(ph: Pointer, filename: Pointer): number;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Closes the hydraulic solver freeing all of its allocated memory.
|
|
326
|
+
*
|
|
327
|
+
* @param ph
|
|
328
|
+
* @returns an error code.
|
|
329
|
+
Call ::EN_closeH after all hydraulics analyses have been made using
|
|
330
|
+
::EN_initH - ::EN_runH - ::EN_nextH. Do not call this function if ::EN_solveH is being used.
|
|
331
|
+
*/
|
|
332
|
+
_EN_closeH(ph: Pointer): number;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Runs a complete water quality simulation with results at uniform
|
|
336
|
+
reporting intervals written to the project's binary output file.
|
|
337
|
+
*
|
|
338
|
+
* @param ph an EPANET project handle.
|
|
339
|
+
* @returns an error code.
|
|
340
|
+
A hydraulic analysis must have been run and saved to a hydraulics file before
|
|
341
|
+
calling ::EN_solveQ. This function will not allow one to examine intermediate water
|
|
342
|
+
quality results as they are generated. It can be followed by a call to ::EN_report
|
|
343
|
+
to write all hydraulic and water quality results to a formatted report file.
|
|
344
|
+
One can instead use the ::EN_openQ - ::EN_initQ - ::EN_runQ - ::EN_nextQ - ::EN_closeQ
|
|
345
|
+
sequence to gain access to gain access to water quality results at intermediate time
|
|
346
|
+
periods.
|
|
347
|
+
<b>Example:</b> see ::EN_solveH.
|
|
348
|
+
*/
|
|
349
|
+
_EN_solveQ(ph: Pointer): number;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Opens a project's water quality solver.
|
|
353
|
+
*
|
|
354
|
+
* @param ph n EPANET project handle.
|
|
355
|
+
* @returns an error code.
|
|
356
|
+
Call ::EN_openQ prior to running the first water quality analysis using an
|
|
357
|
+
::EN_initQ - ::EN_runQ - ::EN_nextQ (or ::EN_stepQ) sequence. Multiple water
|
|
358
|
+
quality analyses can be made before calling ::EN_closeQ to close the water
|
|
359
|
+
quality solver.
|
|
360
|
+
Do not call this function if a complete water quality analysis will be made
|
|
361
|
+
using ::EN_solveQ.
|
|
362
|
+
*/
|
|
363
|
+
_EN_openQ(ph: Pointer): number;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Initializes a network prior to running a water quality analysis.
|
|
367
|
+
*
|
|
368
|
+
* @param ph an EPANET project handle.
|
|
369
|
+
* @param saveFlag set to \b EN_SAVE (1) if results are to be saved to the project's
|
|
370
|
+
binary output file, or to \b EN_NOSAVE (0) if not.
|
|
371
|
+
* @returns an error code.
|
|
372
|
+
Call ::EN_initQ prior to running a water quality analysis using ::EN_runQ in
|
|
373
|
+
conjunction with either ::EN_nextQ or ::EN_stepQ.
|
|
374
|
+
::EN_openQ must have been called prior to calling ::EN_initQ.
|
|
375
|
+
Do not call ::EN_initQ if a complete water quality analysis will be made using ::EN_solveQ.
|
|
376
|
+
*/
|
|
377
|
+
_EN_initQ(ph: Pointer, saveFlag: number): number;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Makes hydraulic and water quality results at the start of the current time
|
|
381
|
+
period available to a project's water quality solver.
|
|
382
|
+
*
|
|
383
|
+
* @param ph an EPANET project handle.
|
|
384
|
+
* @param currentTime [out] current simulation time in seconds.
|
|
385
|
+
* @returns an error code.
|
|
386
|
+
Use ::EN_runQ along with ::EN_nextQ in a loop to access water quality results at the
|
|
387
|
+
start of each hydraulic period in an extended period simulation. Or use it in a loop
|
|
388
|
+
with ::EN_stepQ to access results at the start of each water quality time step. See
|
|
389
|
+
each of these functions for examples of how to code such loops.
|
|
390
|
+
::EN_initQ must have been called prior to running an ::EN_runQ - ::EN_nextQ
|
|
391
|
+
(or ::EN_stepQ) loop.
|
|
392
|
+
The current time of the simulation is determined from information saved with the
|
|
393
|
+
hydraulic analysis that preceded the water quality analysis. Treat it as a read-only
|
|
394
|
+
variable.
|
|
395
|
+
*/
|
|
396
|
+
_EN_runQ(ph: Pointer, currentTime: Pointer): number;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Advances a water quality simulation over the time until the next hydraulic event.
|
|
400
|
+
*
|
|
401
|
+
* @param ph an EPANET project handle.
|
|
402
|
+
* @param tStep [out] time (in seconds) until the next hydraulic event or 0 if at the end
|
|
403
|
+
of the full simulation duration.
|
|
404
|
+
* @returns an error code.
|
|
405
|
+
This function is used in a loop with ::EN_runQ to perform an extended period water
|
|
406
|
+
quality analysis. It reacts and routes a project's water quality constituent over a
|
|
407
|
+
time step determined by when the next hydraulic event occurs. Use ::EN_stepQ instead
|
|
408
|
+
if you wish to generate results over each water quality time step.
|
|
409
|
+
The value of \b tStep is determined from information produced by the hydraulic analysis
|
|
410
|
+
that preceded the water quality analysis. Treat it as a read-only variable.
|
|
411
|
+
<b>Example:</b>
|
|
412
|
+
\code {.c}
|
|
413
|
+
long t, tStep;
|
|
414
|
+
EN_solveH(ph); // Generate & save hydraulics
|
|
415
|
+
EN_openQ(ph);
|
|
416
|
+
EN_initQ(ph, EN_NOSAVE);
|
|
417
|
+
do {
|
|
418
|
+
EN_runQ(ph, &t);
|
|
419
|
+
// Monitor results at time t, which
|
|
420
|
+
// begins a new hydraulic time period
|
|
421
|
+
EN_nextQ(ph, &tStep);
|
|
422
|
+
} while (tStep > 0);
|
|
423
|
+
EN_closeQ(ph);
|
|
424
|
+
\endcode
|
|
425
|
+
*/
|
|
426
|
+
_EN_nextQ(ph: Pointer, tStep: Pointer): number;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Advances a water quality simulation by a single water quality time step.
|
|
430
|
+
*
|
|
431
|
+
* @param ph an EPANET project handle.
|
|
432
|
+
* @param timeLeft [out] time left (in seconds) to the overall simulation duration.
|
|
433
|
+
* @returns an error code.
|
|
434
|
+
This function is used in a loop with ::EN_runQ to perform an extended period water
|
|
435
|
+
quality simulation. It allows one to generate water quality results at each water
|
|
436
|
+
quality time step of the simulation, rather than over each hydraulic event period
|
|
437
|
+
as with ::EN_nextQ.
|
|
438
|
+
Use the argument \b timeLeft to determine when no more calls to ::EN_runQ are needed
|
|
439
|
+
because the end of the simulation period has been reached (i.e., when \b timeLeft = 0).
|
|
440
|
+
*/
|
|
441
|
+
_EN_stepQ(ph: Pointer, timeLeft: Pointer): number;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Closes the water quality solver, freeing all of its allocated memory.
|
|
445
|
+
*
|
|
446
|
+
* @param ph an EPANET project handle.
|
|
447
|
+
* @returns an error code.
|
|
448
|
+
Call ::EN_closeQ after all water quality analyses have been made using the
|
|
449
|
+
::EN_initQ - ::EN_runQ - ::EN_nextQ (or ::EN_stepQ) sequence of function calls.
|
|
450
|
+
Do not call this function if ::EN_solveQ is being used.
|
|
451
|
+
*/
|
|
452
|
+
_EN_closeQ(ph: Pointer): number;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Writes a line of text to a project's report file.
|
|
456
|
+
*
|
|
457
|
+
* @param ph an EPANET project handle.
|
|
458
|
+
* @param line a text string to write.
|
|
459
|
+
* @returns an error code.
|
|
460
|
+
*/
|
|
461
|
+
_EN_writeline(ph: Pointer, line: Pointer): number;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Writes simulation results in a tabular format to a project's report file.
|
|
465
|
+
*
|
|
466
|
+
* @param ph an EPANET project handle.
|
|
467
|
+
* @returns an error code
|
|
468
|
+
Either a full hydraulic analysis or full hydraulic and water quality analysis must
|
|
469
|
+
have been run, with results saved to file, before ::EN_report is called. In the
|
|
470
|
+
former case, ::EN_saveH must also be called first to transfer results from the
|
|
471
|
+
project's intermediate hydraulics file to its output file.
|
|
472
|
+
The format of the report is controlled by commands issued with ::EN_setreport.
|
|
473
|
+
*/
|
|
474
|
+
_EN_report(ph: Pointer): number;
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Copies the current contents of a project's report file to another file.
|
|
478
|
+
*
|
|
479
|
+
* @param ph an EPANET project handle.
|
|
480
|
+
* @param filename the full path name of the destination file.
|
|
481
|
+
* @returns an error code.
|
|
482
|
+
This function allows toolkit clients to retrieve the contents of a project's
|
|
483
|
+
report file while the project is still open.
|
|
484
|
+
*/
|
|
485
|
+
_EN_copyreport(ph: Pointer, filename: Pointer): number;
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Clears the contents of a project's report file.
|
|
489
|
+
*
|
|
490
|
+
* @param ph an EPANET project handle.
|
|
491
|
+
* @returns an error code.
|
|
492
|
+
*/
|
|
493
|
+
_EN_clearreport(ph: Pointer): number;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Resets a project's report options to their default values.
|
|
497
|
+
*
|
|
498
|
+
* @param ph an EPANET project handle.
|
|
499
|
+
* @returns an error code
|
|
500
|
+
After calling this function the default reporting options are in effect. These are:
|
|
501
|
+
- no status report
|
|
502
|
+
- no energy report
|
|
503
|
+
- no nodes reported on
|
|
504
|
+
- no links reported on
|
|
505
|
+
- node variables reported to 2 decimal places
|
|
506
|
+
- link variables reported to 2 decimal places (3 for friction factor)
|
|
507
|
+
- node variables reported are elevation, head, pressure, and quality
|
|
508
|
+
- link variables reported are flow, velocity, and head loss.
|
|
509
|
+
*/
|
|
510
|
+
_EN_resetreport(ph: Pointer): number;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Processes a reporting format command.
|
|
514
|
+
*
|
|
515
|
+
* @param ph an EPANET project handle.
|
|
516
|
+
* @param format a report formatting command.
|
|
517
|
+
* @returns an error code
|
|
518
|
+
Acceptable report formatting commands are described in the @ref ReportPage section of
|
|
519
|
+
the @ref InpFile topic.
|
|
520
|
+
Formatted results of a simulation can be written to a project's report file
|
|
521
|
+
using the ::EN_report function.
|
|
522
|
+
*/
|
|
523
|
+
_EN_setreport(ph: Pointer, format: Pointer): number;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Sets the level of hydraulic status reporting.
|
|
527
|
+
*
|
|
528
|
+
* @param ph an EPANET project handle.
|
|
529
|
+
* @param level a status reporting level code (see @ref EN_StatusReport).
|
|
530
|
+
* @returns an error code.
|
|
531
|
+
Status reporting writes changes in the hydraulics status of network elements to a
|
|
532
|
+
project's report file as a hydraulic simulation unfolds. There are three levels
|
|
533
|
+
of reporting: \b EN_NO_REPORT (no status reporting), \b EN_NORMAL_REPORT (normal
|
|
534
|
+
reporting) \b EN_FULL_REPORT (full status reporting).
|
|
535
|
+
The full status report contains information at each trial of the solution to the
|
|
536
|
+
system hydraulic equations at each time step of a simulation. It is useful mainly
|
|
537
|
+
for debugging purposes.
|
|
538
|
+
If many hydraulic analyses will be run in the application it is recommended that
|
|
539
|
+
status reporting be turned off (<b>level = EN_NO_REPORT</b>).
|
|
540
|
+
*/
|
|
541
|
+
_EN_setstatusreport(ph: Pointer, level: number): number;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Retrieves the toolkit API version number.
|
|
545
|
+
*
|
|
546
|
+
* @param version [out] the version of the OWA-EPANET toolkit.
|
|
547
|
+
* @returns an error code.
|
|
548
|
+
The version number is to be interpreted with implied decimals, i.e.,
|
|
549
|
+
"20100" == "2(.)01(.)00"
|
|
550
|
+
*/
|
|
551
|
+
_EN_getversion(version: Pointer): number;
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Returns the text of an error message generated by an error code.
|
|
555
|
+
*
|
|
556
|
+
* @param errcode an error code.
|
|
557
|
+
* @param out_errmsg [out] the error message generated by the error code
|
|
558
|
+
* @param maxLen maximum number of characters that errmsg can hold
|
|
559
|
+
* @returns an error code
|
|
560
|
+
Error message strings should be at least @ref EN_SizeLimits "EN_MAXMSG" characters in length.
|
|
561
|
+
*/
|
|
562
|
+
_EN_geterror(errcode: number, out_errmsg: Pointer, maxLen: number): number;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Retrieves a particular simulation statistic.
|
|
566
|
+
*
|
|
567
|
+
* @param ph an EPANET project handle.
|
|
568
|
+
* @param type the type of statistic to retrieve (see @ref EN_AnalysisStatistic).
|
|
569
|
+
* @param value [out] the value of the statistic.
|
|
570
|
+
* @returns an error code
|
|
571
|
+
*/
|
|
572
|
+
_EN_getstatistic(ph: Pointer, type: number, value: Pointer): number;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Retrieves the order in which a node or link appears in an @ref OutFile "output file".
|
|
576
|
+
*
|
|
577
|
+
* @param ph an EPANET project handle.
|
|
578
|
+
* @param type a type of element (either @ref EN_NODE or @ref EN_LINK).
|
|
579
|
+
* @param index the element's current index (starting from 1).
|
|
580
|
+
* @param value [out] the order in which the element's results were written to file.
|
|
581
|
+
* @returns an error code.
|
|
582
|
+
If the element does not appear in the file then its result index is 0.
|
|
583
|
+
This function can be used to correctly retrieve results from an EPANET binary output file
|
|
584
|
+
after the order of nodes or links in a network's database has been changed due to editing
|
|
585
|
+
operations.
|
|
586
|
+
*/
|
|
587
|
+
_EN_getresultindex(ph: Pointer, type: number, index: number, value: Pointer): number;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Retrieves the value of an analysis option.
|
|
591
|
+
*
|
|
592
|
+
* @param ph an EPANET project handle.
|
|
593
|
+
* @param option a type of analysis option (see @ref EN_Option).
|
|
594
|
+
* @param value [out] the current value of the option.
|
|
595
|
+
* @returns an error code
|
|
596
|
+
*/
|
|
597
|
+
_EN_getoption(ph: Pointer, option: number, value: Pointer): number;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Sets the value for an anlysis option.
|
|
601
|
+
*
|
|
602
|
+
* @param ph an EPANET project handle.
|
|
603
|
+
* @param option a type of analysis option (see @ref EN_Option).
|
|
604
|
+
* @param value the new value assigned to the option.
|
|
605
|
+
* @returns an error code.
|
|
606
|
+
@see EN_Option
|
|
607
|
+
*/
|
|
608
|
+
_EN_setoption(ph: Pointer, option: number, value: number): number;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Retrieves a project's flow units.
|
|
612
|
+
*
|
|
613
|
+
* @param ph an EPANET project handle.
|
|
614
|
+
* @param units [out] a flow units code (see @ref EN_FlowUnits)
|
|
615
|
+
* @returns an error code.
|
|
616
|
+
Flow units in liters or cubic meters implies that SI metric units are used for all
|
|
617
|
+
other quantities in addition to flow. Otherwise US Customary units are employed.
|
|
618
|
+
*/
|
|
619
|
+
_EN_getflowunits(ph: Pointer, units: Pointer): number;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Sets a project's flow units.
|
|
623
|
+
*
|
|
624
|
+
* @param ph an EPANET project handle.
|
|
625
|
+
* @param units a flow units code (see @ref EN_FlowUnits)
|
|
626
|
+
* @returns an error code.
|
|
627
|
+
Flow units in liters or cubic meters implies that SI metric units are used for all
|
|
628
|
+
other quantities in addition to flow. Otherwise US Customary units are employed.
|
|
629
|
+
*/
|
|
630
|
+
_EN_setflowunits(ph: Pointer, units: number): number;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Retrieves the value of a time parameter.
|
|
634
|
+
*
|
|
635
|
+
* @param ph an EPANET project handle.
|
|
636
|
+
* @param param a time parameter code (see @ref EN_TimeParameter).
|
|
637
|
+
* @param value [out] the current value of the time parameter (in seconds).
|
|
638
|
+
* @returns an error code.
|
|
639
|
+
*/
|
|
640
|
+
_EN_gettimeparam(ph: Pointer, param: number, value: Pointer): number;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Sets the value of a time parameter.
|
|
644
|
+
*
|
|
645
|
+
* @param ph an EPANET project handle.
|
|
646
|
+
* @param param a time parameter code (see @ref EN_TimeParameter).
|
|
647
|
+
* @param value the new value of the time parameter (in seconds)
|
|
648
|
+
* @returns an error code.
|
|
649
|
+
*/
|
|
650
|
+
_EN_settimeparam(ph: Pointer, param: number, value: number): number;
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Gets information about the type of water quality analysis requested.
|
|
654
|
+
*
|
|
655
|
+
* @param ph an EPANET project handle.
|
|
656
|
+
* @param qualType [out] type of analysis to run (see @ref EN_QualityType).
|
|
657
|
+
* @param out_chemName [out] name of chemical constituent.
|
|
658
|
+
* @param out_chemUnits [out] concentration units of the constituent.
|
|
659
|
+
* @param traceNode [out] index of the node being traced (if applicable).
|
|
660
|
+
* @returns an error code.
|
|
661
|
+
*/
|
|
662
|
+
_EN_getqualinfo(ph: Pointer, qualType: Pointer, out_chemName: Pointer, out_chemUnits: Pointer, traceNode: Pointer): number;
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Retrieves the type of water quality analysis to be run.
|
|
666
|
+
*
|
|
667
|
+
* @param ph an EPANET project handle.
|
|
668
|
+
* @param qualType [out] the type of analysis to run (see @ref EN_QualityType).
|
|
669
|
+
* @param traceNode [out] the index of node being traced, if <b>qualType = EN_TRACE</b>.
|
|
670
|
+
* @returns an error code.
|
|
671
|
+
*/
|
|
672
|
+
_EN_getqualtype(ph: Pointer, qualType: Pointer, traceNode: Pointer): number;
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Sets the type of water quality analysis to run.
|
|
676
|
+
*
|
|
677
|
+
* @param ph an EPANET project handle.
|
|
678
|
+
* @param qualType the type of analysis to run (see @ref EN_QualityType).
|
|
679
|
+
* @param chemName the name of the quality constituent.
|
|
680
|
+
* @param chemUnits the concentration units of the constituent.
|
|
681
|
+
* @param traceNode the ID name of the node being traced if <b>qualType = EN_TRACE</b>.
|
|
682
|
+
* @returns an error code.
|
|
683
|
+
Chemical name and units can be an empty string if the analysis is not for a chemical.
|
|
684
|
+
The same holds for the trace node if the analysis is not for source tracing.
|
|
685
|
+
Note that the trace node is specified by ID name and not by index.
|
|
686
|
+
*/
|
|
687
|
+
_EN_setqualtype(ph: Pointer, qualType: number, chemName: Pointer, chemUnits: Pointer, traceNode: Pointer): number;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Adds a new node to a project.
|
|
691
|
+
*
|
|
692
|
+
* @param ph an EPANET project handle.
|
|
693
|
+
* @param id the ID name of the node to be added.
|
|
694
|
+
* @param nodeType the type of node being added (see @ref EN_NodeType)
|
|
695
|
+
* @param index [out] the index of the newly added node
|
|
696
|
+
* @returns an error code.
|
|
697
|
+
When a new node is created all of its properties (see @ref EN_NodeProperty) are set to 0.
|
|
698
|
+
*/
|
|
699
|
+
_EN_addnode(ph: Pointer, id: Pointer, nodeType: number, index: Pointer): number;
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Deletes a node from a project.
|
|
703
|
+
*
|
|
704
|
+
* @param ph an EPANET project handle.
|
|
705
|
+
* @param index the index of the node to be deleted.
|
|
706
|
+
* @param actionCode the action taken if any control contains the node and its links.
|
|
707
|
+
* @returns an error code.
|
|
708
|
+
If \b actionCode is \b EN_UNCONDITIONAL then the node, its incident links and all
|
|
709
|
+
simple and rule-based controls that contain them are deleted. If set to
|
|
710
|
+
\b EN_CONDITIONAL then the node is not deleted if it or its incident links appear
|
|
711
|
+
in any controls and error code 261 is returned.
|
|
712
|
+
*/
|
|
713
|
+
_EN_deletenode(ph: Pointer, index: number, actionCode: number): number;
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Gets the index of a node given its ID name.
|
|
717
|
+
*
|
|
718
|
+
* @param ph an EPANET project handle.
|
|
719
|
+
* @param id a node ID name.
|
|
720
|
+
* @param index [out] the node's index (starting from 1).
|
|
721
|
+
* @returns an error code
|
|
722
|
+
*/
|
|
723
|
+
_EN_getnodeindex(ph: Pointer, id: Pointer, index: Pointer): number;
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Gets the ID name of a node given its index.
|
|
727
|
+
*
|
|
728
|
+
* @param ph an EPANET project handle.
|
|
729
|
+
* @param index a node's index (starting from 1).
|
|
730
|
+
* @param out_id [out] the node's ID name.
|
|
731
|
+
* @returns an error code
|
|
732
|
+
The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID" characters.
|
|
733
|
+
*/
|
|
734
|
+
_EN_getnodeid(ph: Pointer, index: number, out_id: Pointer): number;
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Changes the ID name of a node.
|
|
738
|
+
*
|
|
739
|
+
* @param ph an EPANET project handle.
|
|
740
|
+
* @param index a node's index (starting from 1).
|
|
741
|
+
* @param newid the new ID name for the node.
|
|
742
|
+
* @returns an error code.
|
|
743
|
+
The ID name must not be longer than @ref EN_SizeLimits "EN_MAXID" characters.
|
|
744
|
+
*/
|
|
745
|
+
_EN_setnodeid(ph: Pointer, index: number, newid: Pointer): number;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Retrieves a node's type given its index.
|
|
749
|
+
*
|
|
750
|
+
* @param ph an EPANET project handle.
|
|
751
|
+
* @param index a node's index (starting from 1).
|
|
752
|
+
* @param nodeType [out] the node's type (see @ref EN_NodeType).
|
|
753
|
+
* @returns an error code.
|
|
754
|
+
*/
|
|
755
|
+
_EN_getnodetype(ph: Pointer, index: number, nodeType: Pointer): number;
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Retrieves a property value for a node.
|
|
759
|
+
*
|
|
760
|
+
* @param ph an EPANET project handle.
|
|
761
|
+
* @param index a node's index.
|
|
762
|
+
* @param property the property to retrieve (see @ref EN_NodeProperty).
|
|
763
|
+
* @param value [out] the current value of the property.
|
|
764
|
+
* @returns an error code.
|
|
765
|
+
Values are returned in units that depend on the units used for flow rate
|
|
766
|
+
(see @ref Units).
|
|
767
|
+
*/
|
|
768
|
+
_EN_getnodevalue(ph: Pointer, index: number, property: number, value: Pointer): number;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Sets a property value for a node.
|
|
772
|
+
*
|
|
773
|
+
* @param ph an EPANET project handle.
|
|
774
|
+
* @param index a node's index (starting from 1).
|
|
775
|
+
* @param property the property to set (see @ref EN_NodeProperty).
|
|
776
|
+
* @param value the new value for the property.
|
|
777
|
+
* @returns an error code.
|
|
778
|
+
Values are in units that depend on the units used for flow rate (see @ref Units).
|
|
779
|
+
*/
|
|
780
|
+
_EN_setnodevalue(ph: Pointer, index: number, property: number, value: number): number;
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Sets a group of properties for a junction node.
|
|
784
|
+
*
|
|
785
|
+
* @param ph an EPANET project handle.
|
|
786
|
+
* @param index a junction node's index (starting from 1).
|
|
787
|
+
* @param elev the value of the junction's elevation.
|
|
788
|
+
* @param dmnd the value of the junction's primary base demand.
|
|
789
|
+
* @param dmndpat the ID name of the demand's time pattern ("" for no pattern)
|
|
790
|
+
* @returns an error code.
|
|
791
|
+
These properties have units that depend on the units used for flow rate (see @ref Units).
|
|
792
|
+
*/
|
|
793
|
+
_EN_setjuncdata(ph: Pointer, index: number, elev: number, dmnd: number, dmndpat: Pointer): number;
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Sets a group of properties for a tank node.
|
|
797
|
+
*
|
|
798
|
+
* @param ph an EPANET project handle.
|
|
799
|
+
* @param index a tank node's index (starting from 1).
|
|
800
|
+
* @param elev the tank's bottom elevation.
|
|
801
|
+
* @param initlvl the initial water level in the tank.
|
|
802
|
+
* @param minlvl the minimum water level for the tank.
|
|
803
|
+
* @param maxlvl the maximum water level for the tank.
|
|
804
|
+
* @param diam the tank's diameter (0 if a volume curve is supplied).
|
|
805
|
+
* @param minvol the volume of the tank at its minimum water level.
|
|
806
|
+
* @param volcurve the name of the tank's volume curve ("" for no curve)
|
|
807
|
+
* @returns an error code.
|
|
808
|
+
These properties have units that depend on the units used for flow rate (see @ref Units).
|
|
809
|
+
*/
|
|
810
|
+
_EN_settankdata(ph: Pointer, index: number, elev: number, initlvl: number, minlvl: number, maxlvl: number, diam: number, minvol: number, volcurve: Pointer): number;
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Gets the (x,y) coordinates of a node.
|
|
814
|
+
*
|
|
815
|
+
* @param ph an EPANET project handle.
|
|
816
|
+
* @param index a node index (starting from 1).
|
|
817
|
+
* @param x [out] the node's X-coordinate value.
|
|
818
|
+
* @param y [out] the node's Y-coordinate value.
|
|
819
|
+
* @returns an error code.
|
|
820
|
+
*/
|
|
821
|
+
_EN_getcoord(ph: Pointer, index: number, x: Pointer, y: Pointer): number;
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Sets the (x,y) coordinates of a node.
|
|
825
|
+
*
|
|
826
|
+
* @param ph an EPANET project handle.
|
|
827
|
+
* @param index a node index (starting from 1).
|
|
828
|
+
* @param x the node's X-coordinate value.
|
|
829
|
+
* @param y the node's Y-coordinate value.
|
|
830
|
+
* @returns an error code.
|
|
831
|
+
*/
|
|
832
|
+
_EN_setcoord(ph: Pointer, index: number, x: number, y: number): number;
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Retrieves the type of demand model in use and its parameters.
|
|
836
|
+
*
|
|
837
|
+
* @param ph an EPANET project handle.
|
|
838
|
+
* @param type [out] Type of demand model (see @ref EN_DemandModel).
|
|
839
|
+
* @param pmin [out] Pressure below which there is no demand.
|
|
840
|
+
* @param preq [out] Pressure required to deliver full demand.
|
|
841
|
+
* @param pexp [out] Pressure exponent in demand function.
|
|
842
|
+
* @returns an error code.
|
|
843
|
+
Parameters <b>pmin, preq,</b> and \b pexp are only used when the demand model is \b EN_PDA.
|
|
844
|
+
*/
|
|
845
|
+
_EN_getdemandmodel(ph: Pointer, type: Pointer, pmin: Pointer, preq: Pointer, pexp: Pointer): number;
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
* Sets the type of demand model to use and its parameters.
|
|
849
|
+
*
|
|
850
|
+
* @param ph an EPANET project handle.
|
|
851
|
+
* @param type Type of demand model (see @ref EN_DemandModel).
|
|
852
|
+
* @param pmin Pressure below which there is no demand.
|
|
853
|
+
* @param preq Pressure required to deliver full demand.
|
|
854
|
+
* @param pexp Pressure exponent in demand function.
|
|
855
|
+
* @returns an error code.
|
|
856
|
+
Set \b type to \b EN_DDA for a traditional demand driven analysis (in which case the
|
|
857
|
+
remaining three parameter values are ignored) or to \b EN_PDA for a pressure driven
|
|
858
|
+
analysis. In the latter case a node's demand is computed as:
|
|
859
|
+
> `Dfull * [ (P - pmin) / (preq - pmin) ] ^ pexp`
|
|
860
|
+
where `Dfull` is the full demand and `P` is the current pressure.
|
|
861
|
+
Setting \b preq equal to \b pmin will result in a solution with the smallest amount of
|
|
862
|
+
demand reductions needed to insure that no node delivers positive demand at a pressure
|
|
863
|
+
below \b pmin.
|
|
864
|
+
*/
|
|
865
|
+
_EN_setdemandmodel(ph: Pointer, type: number, pmin: number, preq: number, pexp: number): number;
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* appends a new demand to a junction node demands list.
|
|
869
|
+
*
|
|
870
|
+
* @param ph an EPANET project handle.
|
|
871
|
+
* @param nodeIndex the index of a node (starting from 1).
|
|
872
|
+
* @param baseDemand the demand's base value.
|
|
873
|
+
* @param demandPattern the name of a time pattern used by the demand
|
|
874
|
+
* @param demandName the name of the demand's category
|
|
875
|
+
* @returns an error code.
|
|
876
|
+
A NULL or blank string can be used for `demandPattern` and for `demandName` to indicate
|
|
877
|
+
that no time pattern or category name is associated with the demand.
|
|
878
|
+
*/
|
|
879
|
+
_EN_adddemand(ph: Pointer, nodeIndex: number, baseDemand: number, demandPattern: Pointer, demandName: Pointer): number;
|
|
688
880
|
|
|
689
|
-
|
|
690
|
-
|
|
881
|
+
/**
|
|
882
|
+
* deletes a demand from a junction node.
|
|
883
|
+
*
|
|
884
|
+
* @param ph an EPANET project handle.
|
|
885
|
+
* @param nodeIndex the index of a node (starting from 1).
|
|
886
|
+
* @param demandIndex the position of the demand in the node's demands list (starting from 1).
|
|
887
|
+
* @returns an error code.
|
|
888
|
+
*/
|
|
889
|
+
_EN_deletedemand(ph: Pointer, nodeIndex: number, demandIndex: number): number;
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Retrieves the index of a node's named demand category
|
|
893
|
+
*
|
|
894
|
+
* @param ph an EPANET project handle.
|
|
895
|
+
* @param nodeIndex the index of a node (starting from 1)
|
|
896
|
+
* @param demandName the name of a demand category for the node
|
|
897
|
+
* @param demandIndex [out] the index of the demand being sought
|
|
898
|
+
* @returns an error code
|
|
899
|
+
*/
|
|
900
|
+
_EN_getdemandindex(ph: Pointer, nodeIndex: number, demandName: Pointer, demandIndex: Pointer): number;
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Retrieves the number of demand categories for a junction node.
|
|
904
|
+
*
|
|
905
|
+
* @param ph an EPANET project handle.
|
|
906
|
+
* @param nodeIndex the index of a node (starting from 1).
|
|
907
|
+
* @param numDemands [out] the number of demand categories assigned to the node.
|
|
908
|
+
* @returns an error code.
|
|
909
|
+
*/
|
|
910
|
+
_EN_getnumdemands(ph: Pointer, nodeIndex: number, numDemands: Pointer): number;
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Gets the base demand for one of a node's demand categories.
|
|
914
|
+
*
|
|
915
|
+
* @param ph an EPANET project handle.
|
|
916
|
+
* @param nodeIndex a node's index (starting from 1).
|
|
917
|
+
* @param demandIndex the index of a demand category for the node (starting from 1).
|
|
918
|
+
* @param baseDemand [out] the category's base demand.
|
|
919
|
+
* @returns an error code.
|
|
920
|
+
*/
|
|
921
|
+
_EN_getbasedemand(ph: Pointer, nodeIndex: number, demandIndex: number, baseDemand: Pointer): number;
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Sets the base demand for one of a node's demand categories.
|
|
925
|
+
*
|
|
926
|
+
* @param ph an EPANET project handle.
|
|
927
|
+
* @param nodeIndex a node's index (starting from 1).
|
|
928
|
+
* @param demandIndex the index of a demand category for the node (starting from 1).
|
|
929
|
+
* @param baseDemand the new base demand for the category.
|
|
930
|
+
* @returns an error code.
|
|
931
|
+
*/
|
|
932
|
+
_EN_setbasedemand(ph: Pointer, nodeIndex: number, demandIndex: number, baseDemand: number): number;
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Retrieves the index of a time pattern assigned to one of a node's demand categories.
|
|
936
|
+
*
|
|
937
|
+
* @param ph an EPANET project handle.
|
|
938
|
+
* @param nodeIndex the node's index (starting from 1).
|
|
939
|
+
* @param demandIndex the index of a demand category for the node (starting from 1).
|
|
940
|
+
* @param patIndex [out] the index of the category's time pattern.
|
|
941
|
+
* @returns an error code.
|
|
942
|
+
A returned pattern index of 0 indicates that no time pattern has been assigned to the
|
|
943
|
+
demand category.
|
|
944
|
+
*/
|
|
945
|
+
_EN_getdemandpattern(ph: Pointer, nodeIndex: number, demandIndex: number, patIndex: Pointer): number;
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Sets the index of a time pattern used for one of a node's demand categories.
|
|
949
|
+
*
|
|
950
|
+
* @param ph an EPANET project handle.
|
|
951
|
+
* @param nodeIndex a node's index (starting from 1).
|
|
952
|
+
* @param demandIndex the index of one of the node's demand categories (starting from 1).
|
|
953
|
+
* @param patIndex the index of the time pattern assigned to the category.
|
|
954
|
+
* @returns an error code.
|
|
955
|
+
Specifying a pattern index of 0 indicates that no time pattern is assigned to the
|
|
956
|
+
demand category.
|
|
957
|
+
*/
|
|
958
|
+
_EN_setdemandpattern(ph: Pointer, nodeIndex: number, demandIndex: number, patIndex: number): number;
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Retrieves the name of a node's demand category.
|
|
962
|
+
*
|
|
963
|
+
* @param ph an EPANET project handle.
|
|
964
|
+
* @param nodeIndex a node's index (starting from 1).
|
|
965
|
+
* @param demandIndex the index of one of the node's demand categories (starting from 1).
|
|
966
|
+
* @param out_demandName [out] The name of the selected category.
|
|
967
|
+
* @returns an error code.
|
|
968
|
+
\b demandName must be sized to contain at least @ref EN_SizeLimits "EN_MAXID" characters.
|
|
969
|
+
*/
|
|
970
|
+
_EN_getdemandname(ph: Pointer, nodeIndex: number, demandIndex: number, out_demandName: Pointer): number;
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* Assigns a name to a node's demand category.
|
|
974
|
+
*
|
|
975
|
+
* @param ph an EPANET project handle.
|
|
976
|
+
* @param nodeIndex a node's index (starting from 1).
|
|
977
|
+
* @param demandIdx the index of one of the node's demand categories (starting from 1).
|
|
978
|
+
* @param demandName the new name assigned to the category.
|
|
979
|
+
* @returns Error code.
|
|
980
|
+
The category name must contain no more than @ref EN_SizeLimits "EN_MAXID" characters.
|
|
981
|
+
*/
|
|
982
|
+
_EN_setdemandname(ph: Pointer, nodeIndex: number, demandIdx: number, demandName: Pointer): number;
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Adds a new link to a project.
|
|
986
|
+
*
|
|
987
|
+
* @param ph an EPANET project handle.
|
|
988
|
+
* @param id the ID name of the link to be added.
|
|
989
|
+
* @param linkType The type of link being added (see @ref EN_LinkType)
|
|
990
|
+
* @param fromNode The ID name of the link's starting node.
|
|
991
|
+
* @param toNode The ID name of the link's ending node.
|
|
992
|
+
* @param index [out] the index of the newly added link.
|
|
993
|
+
* @returns an error code.
|
|
994
|
+
A new pipe is assigned a diameter of 10 inches (254 mm) and a length of 330
|
|
995
|
+
feet (~ 100 meters). Its roughness coefficient depends on the head loss formula in effect (see @ref EN_HeadLossType) as follows:
|
|
996
|
+
- Hazen-Williams formula: 130
|
|
997
|
+
- Darcy-Weisbach formula: 0.5 millifeet (0.15 mm)
|
|
998
|
+
- Chezy-Manning formula: 0.01
|
|
999
|
+
All other pipe properties are set to 0.
|
|
1000
|
+
A new pump has a status of \b EN_OPEN, a speed setting of 1, and has no pump
|
|
1001
|
+
curve or power rating assigned to it.
|
|
1002
|
+
A new valve has a diameter of 10 inches (254 mm) and all other properties set to 0.
|
|
1003
|
+
See @ref EN_LinkProperty.
|
|
1004
|
+
*/
|
|
1005
|
+
_EN_addlink(ph: Pointer, id: Pointer, linkType: number, fromNode: Pointer, toNode: Pointer, index: Pointer): number;
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Deletes a link from the project.
|
|
1009
|
+
*
|
|
1010
|
+
* @param ph an EPANET project handle.
|
|
1011
|
+
* @param index the index of the link to be deleted.
|
|
1012
|
+
* @param actionCode The action taken if any control contains the link.
|
|
1013
|
+
* @returns an error code.
|
|
1014
|
+
If \b actionCode is \b EN_UNCONDITIONAL then the link and all simple and rule-based
|
|
1015
|
+
controls that contain it are deleted. If set to \b EN_CONDITIONAL then the link
|
|
1016
|
+
is not deleted if it appears in any control and error 261 is returned.
|
|
1017
|
+
*/
|
|
1018
|
+
_EN_deletelink(ph: Pointer, index: number, actionCode: number): number;
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Gets the index of a link given its ID name.
|
|
1022
|
+
*
|
|
1023
|
+
* @param ph an EPANET project handle.
|
|
1024
|
+
* @param id a link's ID name.
|
|
1025
|
+
* @param index [out] the link's index (starting from 1).
|
|
1026
|
+
* @returns an error code.
|
|
1027
|
+
*/
|
|
1028
|
+
_EN_getlinkindex(ph: Pointer, id: Pointer, index: Pointer): number;
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* Gets the ID name of a link given its index.
|
|
1032
|
+
*
|
|
1033
|
+
* @param ph an EPANET project handle.
|
|
1034
|
+
* @param index a link's index (starting from 1).
|
|
1035
|
+
* @param out_id [out] The link's ID name.
|
|
1036
|
+
* @returns an error code.
|
|
1037
|
+
The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID" characters.
|
|
1038
|
+
*/
|
|
1039
|
+
_EN_getlinkid(ph: Pointer, index: number, out_id: Pointer): number;
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Changes the ID name of a link.
|
|
1043
|
+
*
|
|
1044
|
+
* @param ph an EPANET project handle.
|
|
1045
|
+
* @param index a link's index (starting from 1).
|
|
1046
|
+
* @param newid the new ID name for the link.
|
|
1047
|
+
* @returns Error code.
|
|
1048
|
+
The ID name must not be longer than @ref EN_SizeLimits "EN_MAXID" characters.
|
|
1049
|
+
*/
|
|
1050
|
+
_EN_setlinkid(ph: Pointer, index: number, newid: Pointer): number;
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* Retrieves a link's type.
|
|
1054
|
+
*
|
|
1055
|
+
* @param ph an EPANET project handle.
|
|
1056
|
+
* @param index a link's index (starting from 1).
|
|
1057
|
+
* @param linkType [out] the link's type (see @ref EN_LinkType).
|
|
1058
|
+
* @returns an error code.
|
|
1059
|
+
*/
|
|
1060
|
+
_EN_getlinktype(ph: Pointer, index: number, linkType: Pointer): number;
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Changes a link's type.
|
|
1064
|
+
*
|
|
1065
|
+
* @param ph an EPANET project handle.
|
|
1066
|
+
* @param inout_index [out] the link's index before [in] and after [out] the type change.
|
|
1067
|
+
* @param linkType the new type to change the link to (see @ref EN_LinkType).
|
|
1068
|
+
* @param actionCode the action taken if any controls contain the link.
|
|
1069
|
+
* @returns an error code.
|
|
1070
|
+
If \b actionCode is \b EN_UNCONDITIONAL then all simple and rule-based controls that
|
|
1071
|
+
contain the link are deleted when the link's type is changed. If set to
|
|
1072
|
+
\b EN_CONDITIONAL then the type change is cancelled if the link appears in any
|
|
1073
|
+
control and error 261 is returned.
|
|
1074
|
+
*/
|
|
1075
|
+
_EN_setlinktype(ph: Pointer, inout_index: Pointer, linkType: number, actionCode: number): number;
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* Gets the indexes of a link's start- and end-nodes.
|
|
1079
|
+
*
|
|
1080
|
+
* @param ph an EPANET project handle.
|
|
1081
|
+
* @param index a link's index (starting from 1).
|
|
1082
|
+
* @param node1 [out] the index of the link's start node (starting from 1).
|
|
1083
|
+
* @param node2 [out] the index of the link's end node (starting from 1).
|
|
1084
|
+
* @returns an error code.
|
|
1085
|
+
*/
|
|
1086
|
+
_EN_getlinknodes(ph: Pointer, index: number, node1: Pointer, node2: Pointer): number;
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* Sets the indexes of a link's start- and end-nodes.
|
|
1090
|
+
*
|
|
1091
|
+
* @param ph an EPANET project handle.
|
|
1092
|
+
* @param index a link's index (starting from 1).
|
|
1093
|
+
* @param node1 The index of the link's start node (starting from 1).
|
|
1094
|
+
* @param node2 The index of the link's end node (starting from 1).
|
|
1095
|
+
* @returns an error code.
|
|
1096
|
+
*/
|
|
1097
|
+
_EN_setlinknodes(ph: Pointer, index: number, node1: number, node2: number): number;
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* Retrieves a property value for a link.
|
|
1101
|
+
*
|
|
1102
|
+
* @param ph an EPANET project handle.
|
|
1103
|
+
* @param index a link's index (starting from 1).
|
|
1104
|
+
* @param property the property to retrieve (see @ref EN_LinkProperty).
|
|
1105
|
+
* @param value [out] the current value of the property.
|
|
1106
|
+
* @returns an error code.
|
|
1107
|
+
Values are returned in units that depend on the units used for flow rate (see @ref Units).
|
|
1108
|
+
*/
|
|
1109
|
+
_EN_getlinkvalue(ph: Pointer, index: number, property: number, value: Pointer): number;
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Sets a property value for a link.
|
|
1113
|
+
*
|
|
1114
|
+
* @param ph an EPANET project handle.
|
|
1115
|
+
* @param index a link's index.
|
|
1116
|
+
* @param property the property to set (see @ref EN_LinkProperty).
|
|
1117
|
+
* @param value the new value for the property.
|
|
1118
|
+
* @returns an error code.
|
|
1119
|
+
Values are in units that depend on the units used for flow rate (see @ref Units).
|
|
1120
|
+
*/
|
|
1121
|
+
_EN_setlinkvalue(ph: Pointer, index: number, property: number, value: number): number;
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* Sets a group of properties for a pipe link.
|
|
1125
|
+
*
|
|
1126
|
+
* @param ph an EPANET project handle.
|
|
1127
|
+
* @param index the index of a pipe link (starting from 1).
|
|
1128
|
+
* @param length the pipe's length.
|
|
1129
|
+
* @param diam the pipe's diameter.
|
|
1130
|
+
* @param rough the pipe's roughness coefficient.
|
|
1131
|
+
* @param mloss the pipe's minor loss coefficient.
|
|
1132
|
+
* @returns an error code.
|
|
1133
|
+
These properties have units that depend on the units used for flow rate (see @ref Units).
|
|
1134
|
+
*/
|
|
1135
|
+
_EN_setpipedata(ph: Pointer, index: number, length: number, diam: number, rough: number, mloss: number): number;
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Retrieves the number of internal vertex points assigned to a link.
|
|
1139
|
+
*
|
|
1140
|
+
* @param ph an EPANET project handle.
|
|
1141
|
+
* @param index a link's index (starting from 1).
|
|
1142
|
+
* @param count [out] the number of vertex points that describe the link's shape.
|
|
1143
|
+
* @returns an error code.
|
|
1144
|
+
*/
|
|
1145
|
+
_EN_getvertexcount(ph: Pointer, index: number, count: Pointer): number;
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* Retrieves the coordinate's of a vertex point assigned to a link.
|
|
1149
|
+
*
|
|
1150
|
+
* @param ph an EPANET project handle.
|
|
1151
|
+
* @param index a link's index (starting from 1).
|
|
1152
|
+
* @param vertex a vertex point index (starting from 1).
|
|
1153
|
+
* @param x [out] the vertex's X-coordinate value.
|
|
1154
|
+
* @param y [out] the vertex's Y-coordinate value.
|
|
1155
|
+
* @returns an error code.
|
|
1156
|
+
*/
|
|
1157
|
+
_EN_getvertex(ph: Pointer, index: number, vertex: number, x: Pointer, y: Pointer): number;
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* Assigns a set of internal vertex points to a link.
|
|
1161
|
+
*
|
|
1162
|
+
* @param ph an EPANET project handle.
|
|
1163
|
+
* @param index a link's index (starting from 1).
|
|
1164
|
+
* @param x an array of X-coordinates for the vertex points.
|
|
1165
|
+
* @param y an array of Y-coordinates for the vertex points.
|
|
1166
|
+
* @param count the number of vertex points being assigned.
|
|
1167
|
+
* @returns an error code.
|
|
1168
|
+
Replaces any existing vertices previously assigned to the link.
|
|
1169
|
+
*/
|
|
1170
|
+
_EN_setvertices(ph: Pointer, index: number, x: Pointer, y: Pointer, count: number): number;
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Retrieves the type of head curve used by a pump.
|
|
1174
|
+
*
|
|
1175
|
+
* @param ph an EPANET project handle.
|
|
1176
|
+
* @param linkIndex the index of a pump link (starting from 1).
|
|
1177
|
+
* @param pumpType [out] the type of head curve used by the pump (see @ref EN_PumpType).
|
|
1178
|
+
* @returns an error code.
|
|
1179
|
+
*/
|
|
1180
|
+
_EN_getpumptype(ph: Pointer, linkIndex: number, pumpType: Pointer): number;
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Retrieves the curve assigned to a pump's head curve.
|
|
1184
|
+
*
|
|
1185
|
+
* @param ph an EPANET project handle.
|
|
1186
|
+
* @param linkIndex the index of a pump link (starting from 1).
|
|
1187
|
+
* @param curveIndex [out] the index of the curve assigned to the pump's head curve.
|
|
1188
|
+
* @returns an error code.
|
|
1189
|
+
*/
|
|
1190
|
+
_EN_getheadcurveindex(ph: Pointer, linkIndex: number, curveIndex: Pointer): number;
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Assigns a curve to a pump's head curve.
|
|
1194
|
+
*
|
|
1195
|
+
* @param ph an EPANET project handle.
|
|
1196
|
+
* @param linkIndex the index of a pump link (starting from 1).
|
|
1197
|
+
* @param curveIndex the index of a curve to be assigned as the pump's head curve.
|
|
1198
|
+
* @returns an error code.
|
|
1199
|
+
*/
|
|
1200
|
+
_EN_setheadcurveindex(ph: Pointer, linkIndex: number, curveIndex: number): number;
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Adds a new time pattern to a project.
|
|
1204
|
+
*
|
|
1205
|
+
* @param ph an EPANET project handle.
|
|
1206
|
+
* @param id the ID name of the pattern to add.
|
|
1207
|
+
* @returns an error code.
|
|
1208
|
+
The new pattern contains a single time period whose factor is 1.0.
|
|
1209
|
+
*/
|
|
1210
|
+
_EN_addpattern(ph: Pointer, id: Pointer): number;
|
|
1211
|
+
|
|
1212
|
+
/**
|
|
1213
|
+
* Deletes a time pattern from a project.
|
|
1214
|
+
*
|
|
1215
|
+
* @param ph an EPANET project handle.
|
|
1216
|
+
* @param index the time pattern's index (starting from 1).
|
|
1217
|
+
* @returns an error code.
|
|
1218
|
+
*/
|
|
1219
|
+
_EN_deletepattern(ph: Pointer, index: number): number;
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* Retrieves the index of a time pattern given its ID name.
|
|
1223
|
+
*
|
|
1224
|
+
* @param ph an EPANET project handle.
|
|
1225
|
+
* @param id the ID name of a time pattern.
|
|
1226
|
+
* @param index [out] the time pattern's index (starting from 1).
|
|
1227
|
+
* @returns an error code.
|
|
1228
|
+
*/
|
|
1229
|
+
_EN_getpatternindex(ph: Pointer, id: Pointer, index: Pointer): number;
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* Retrieves the ID name of a time pattern given its index.
|
|
1233
|
+
*
|
|
1234
|
+
* @param ph an EPANET project handle.
|
|
1235
|
+
* @param index a time pattern index (starting from 1).
|
|
1236
|
+
* @param out_id [out] the time pattern's ID name.
|
|
1237
|
+
* @returns an error code.
|
|
1238
|
+
The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID" characters.
|
|
1239
|
+
*/
|
|
1240
|
+
_EN_getpatternid(ph: Pointer, index: number, out_id: Pointer): number;
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* Changes the ID name of a time pattern given its index.
|
|
1244
|
+
*
|
|
1245
|
+
* @param ph an EPANET project handle.
|
|
1246
|
+
* @param index a time pattern index (starting from 1).
|
|
1247
|
+
* @param id the time pattern's new ID name.
|
|
1248
|
+
* @returns an error code.
|
|
1249
|
+
The new ID name must not exceed @ref EN_SizeLimits "EN_MAXID" characters.
|
|
1250
|
+
*/
|
|
1251
|
+
_EN_setpatternid(ph: Pointer, index: number, id: Pointer): number;
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* Retrieves the number of time periods in a time pattern.
|
|
1255
|
+
*
|
|
1256
|
+
* @param ph an EPANET project handle.
|
|
1257
|
+
* @param index a time pattern index (starting from 1).
|
|
1258
|
+
* @param len [out] the number of time periods in the pattern.
|
|
1259
|
+
* @returns an error code.
|
|
1260
|
+
*/
|
|
1261
|
+
_EN_getpatternlen(ph: Pointer, index: number, len: Pointer): number;
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Retrieves a time pattern's factor for a given time period.
|
|
1265
|
+
*
|
|
1266
|
+
* @param ph an EPANET project handle.
|
|
1267
|
+
* @param index a time pattern index (starting from 1).
|
|
1268
|
+
* @param period a time period in the pattern (starting from 1).
|
|
1269
|
+
* @param value [out] the pattern factor for the given time period.
|
|
1270
|
+
* @returns an error code.
|
|
1271
|
+
*/
|
|
1272
|
+
_EN_getpatternvalue(ph: Pointer, index: number, period: number, value: Pointer): number;
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* Sets a time pattern's factor for a given time period.
|
|
1276
|
+
*
|
|
1277
|
+
* @param ph an EPANET project handle.
|
|
1278
|
+
* @param index a time pattern index (starting from 1).
|
|
1279
|
+
* @param period a time period in the pattern (starting from 1).
|
|
1280
|
+
* @param value the new value of the pattern factor for the given time period.
|
|
1281
|
+
* @returns an error code.
|
|
1282
|
+
*/
|
|
1283
|
+
_EN_setpatternvalue(ph: Pointer, index: number, period: number, value: number): number;
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* Retrieves the average of all pattern factors in a time pattern.
|
|
1287
|
+
*
|
|
1288
|
+
* @param ph an EPANET project handle.
|
|
1289
|
+
* @param index a time pattern index (starting from 1).
|
|
1290
|
+
* @param value [out] The average of all of the time pattern's factors.
|
|
1291
|
+
* @returns an error code.
|
|
1292
|
+
*/
|
|
1293
|
+
_EN_getaveragepatternvalue(ph: Pointer, index: number, value: Pointer): number;
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Sets the pattern factors for a given time pattern.
|
|
1297
|
+
*
|
|
1298
|
+
* @param ph an EPANET project handle.
|
|
1299
|
+
* @param index a time pattern index (starting from 1).
|
|
1300
|
+
* @param values an array of new pattern factor values.
|
|
1301
|
+
* @param len the number of factor values supplied.
|
|
1302
|
+
* @returns an error code.
|
|
1303
|
+
\b values is a zero-based array that contains \b len elements.
|
|
1304
|
+
Use this function to redefine (and resize) a time pattern all at once;
|
|
1305
|
+
use @ref EN_setpatternvalue to revise pattern factors one at a time.
|
|
1306
|
+
*/
|
|
1307
|
+
_EN_setpattern(ph: Pointer, index: number, values: Pointer, len: number): number;
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* Adds a new data curve to a project.
|
|
1311
|
+
*
|
|
1312
|
+
* @param ph an EPANET project handle.
|
|
1313
|
+
* @param id The ID name of the curve to be added.
|
|
1314
|
+
* @returns an error code.
|
|
1315
|
+
The new curve contains a single data point (1.0, 1.0).
|
|
1316
|
+
*/
|
|
1317
|
+
_EN_addcurve(ph: Pointer, id: Pointer): number;
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* Deletes a data curve from a project.
|
|
1321
|
+
*
|
|
1322
|
+
* @param ph an EPANET project handle.
|
|
1323
|
+
* @param index the data curve's index (starting from 1).
|
|
1324
|
+
* @returns an error code.
|
|
1325
|
+
*/
|
|
1326
|
+
_EN_deletecurve(ph: Pointer, index: number): number;
|
|
1327
|
+
|
|
1328
|
+
/**
|
|
1329
|
+
* Retrieves the index of a curve given its ID name.
|
|
1330
|
+
*
|
|
1331
|
+
* @param ph an EPANET project handle.
|
|
1332
|
+
* @param id the ID name of a curve.
|
|
1333
|
+
* @param index [out] The curve's index (starting from 1).
|
|
1334
|
+
* @returns an error code.
|
|
1335
|
+
*/
|
|
1336
|
+
_EN_getcurveindex(ph: Pointer, id: Pointer, index: Pointer): number;
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* Retrieves the ID name of a curve given its index.
|
|
1340
|
+
*
|
|
1341
|
+
* @param ph an EPANET project handle.
|
|
1342
|
+
* @param index a curve's index (starting from 1).
|
|
1343
|
+
* @param out_id [out] the curve's ID name.
|
|
1344
|
+
* @returns an error code.
|
|
1345
|
+
The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID" characters.
|
|
1346
|
+
*/
|
|
1347
|
+
_EN_getcurveid(ph: Pointer, index: number, out_id: Pointer): number;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Changes the ID name of a data curve given its index.
|
|
1351
|
+
*
|
|
1352
|
+
* @param ph an EPANET project handle.
|
|
1353
|
+
* @param index a data curve index (starting from 1).
|
|
1354
|
+
* @param id the data curve's new ID name.
|
|
1355
|
+
* @returns an error code.
|
|
1356
|
+
The new ID name must not exceed @ref EN_SizeLimits "EN_MAXID" characters.
|
|
1357
|
+
*/
|
|
1358
|
+
_EN_setcurveid(ph: Pointer, index: number, id: Pointer): number;
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* Retrieves the number of points in a curve.
|
|
1362
|
+
*
|
|
1363
|
+
* @param ph an EPANET project handle.
|
|
1364
|
+
* @param index a curve's index (starting from 1).
|
|
1365
|
+
* @param len [out] The number of data points assigned to the curve.
|
|
1366
|
+
* @returns an error code.
|
|
1367
|
+
*/
|
|
1368
|
+
_EN_getcurvelen(ph: Pointer, index: number, len: Pointer): number;
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* Retrieves a curve's type.
|
|
1372
|
+
*
|
|
1373
|
+
* @param ph an EPANET project handle.
|
|
1374
|
+
* @param index a curve's index (starting from 1).
|
|
1375
|
+
* @param type [out] the curve's type (see @ref EN_CurveType).
|
|
1376
|
+
* @returns an error code.
|
|
1377
|
+
*/
|
|
1378
|
+
_EN_getcurvetype(ph: Pointer, index: number, type: Pointer): number;
|
|
1379
|
+
|
|
1380
|
+
/**
|
|
1381
|
+
* Retrieves the value of a single data point for a curve.
|
|
1382
|
+
*
|
|
1383
|
+
* @param ph an EPANET project handle.
|
|
1384
|
+
* @param curveIndex a curve's index (starting from 1).
|
|
1385
|
+
* @param pointIndex the index of a point on the curve (starting from 1).
|
|
1386
|
+
* @param x [out] the point's x-value.
|
|
1387
|
+
* @param y [out] the point's y-value.
|
|
1388
|
+
* @returns an error code.
|
|
1389
|
+
*/
|
|
1390
|
+
_EN_getcurvevalue(ph: Pointer, curveIndex: number, pointIndex: number, x: Pointer, y: Pointer): number;
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* Sets the value of a single data point for a curve.
|
|
1394
|
+
*
|
|
1395
|
+
* @param ph an EPANET project handle.
|
|
1396
|
+
* @param curveIndex a curve's index (starting from 1).
|
|
1397
|
+
* @param pointIndex the index of a point on the curve (starting from 1).
|
|
1398
|
+
* @param x the point's new x-value.
|
|
1399
|
+
* @param y the point's new y-value.
|
|
1400
|
+
* @returns an error code.
|
|
1401
|
+
*/
|
|
1402
|
+
_EN_setcurvevalue(ph: Pointer, curveIndex: number, pointIndex: number, x: number, y: number): number;
|
|
1403
|
+
|
|
1404
|
+
/**
|
|
1405
|
+
* Retrieves all of a curve's data.
|
|
1406
|
+
*
|
|
1407
|
+
* @param ph an EPANET project handle.
|
|
1408
|
+
* @param index a curve's index (starting from 1).
|
|
1409
|
+
* @param out_id [out] the curve's ID name.
|
|
1410
|
+
* @param nPoints [out] the number of data points on the curve.
|
|
1411
|
+
* @param xValues [out] the curve's x-values.
|
|
1412
|
+
* @param yValues [out] the curve's y-values.
|
|
1413
|
+
* @returns an error code.
|
|
1414
|
+
The calling program is responsible for making `xValues` and `yValues` large enough
|
|
1415
|
+
to hold `nPoints` number of data points and for sizing `id` to hold at least
|
|
1416
|
+
@ref EN_SizeLimits "EN_MAXID" characters.
|
|
1417
|
+
*/
|
|
1418
|
+
_EN_getcurve(ph: Pointer, index: number, out_id: Pointer, nPoints: Pointer, xValues: Pointer, yValues: Pointer): number;
|
|
1419
|
+
|
|
1420
|
+
/**
|
|
1421
|
+
* assigns a set of data points to a curve.
|
|
1422
|
+
*
|
|
1423
|
+
* @param ph an EPANET project handle.
|
|
1424
|
+
* @param index a curve's index (starting from 1).
|
|
1425
|
+
* @param xValues an array of new x-values for the curve.
|
|
1426
|
+
* @param yValues an array of new y-values for the curve.
|
|
1427
|
+
* @param nPoints the new number of data points for the curve.
|
|
1428
|
+
* @returns an error code.
|
|
1429
|
+
\b xValues and \b yValues are zero-based arrays that contains \b nPoints elements.
|
|
1430
|
+
Use this function to redefine (and resize) a curve all at once;
|
|
1431
|
+
use @ref EN_setcurvevalue to revise a curve's data points one at a time.
|
|
1432
|
+
*/
|
|
1433
|
+
_EN_setcurve(ph: Pointer, index: number, xValues: Pointer, yValues: Pointer, nPoints: number): number;
|
|
1434
|
+
|
|
1435
|
+
/**
|
|
1436
|
+
* Adds a new simple control to a project.
|
|
1437
|
+
*
|
|
1438
|
+
* @param ph an EPANET project handle.
|
|
1439
|
+
* @param type the type of control to add (see @ref EN_ControlType).
|
|
1440
|
+
* @param linkIndex the index of a link to control (starting from 1).
|
|
1441
|
+
* @param setting control setting applied to the link.
|
|
1442
|
+
* @param nodeIndex index of the node used to control the link
|
|
1443
|
+
(0 for \b EN_TIMER and \b EN_TIMEOFDAY controls).
|
|
1444
|
+
* @param level action level (tank level, junction pressure, or time in seconds)
|
|
1445
|
+
that triggers the control.
|
|
1446
|
+
* @param index [out] index of the new control.
|
|
1447
|
+
* @returns an error code.
|
|
1448
|
+
*/
|
|
1449
|
+
_EN_addcontrol(ph: Pointer, type: number, linkIndex: number, setting: number, nodeIndex: number, level: number, index: Pointer): number;
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* Deletes an existing simple control.
|
|
1453
|
+
*
|
|
1454
|
+
* @param ph an EPANET project handle.
|
|
1455
|
+
* @param index the index of the control to delete (starting from 1).
|
|
1456
|
+
* @returns an error code.
|
|
1457
|
+
*/
|
|
1458
|
+
_EN_deletecontrol(ph: Pointer, index: number): number;
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* Retrieves the properties of a simple control.
|
|
1462
|
+
*
|
|
1463
|
+
* @param ph an EPANET project handle.
|
|
1464
|
+
* @param index the control's index (starting from 1).
|
|
1465
|
+
* @param type [out] the type of control (see @ref EN_ControlType).
|
|
1466
|
+
* @param linkIndex [out] the index of the link being controlled.
|
|
1467
|
+
* @param setting [out] the control setting applied to the link.
|
|
1468
|
+
* @param nodeIndex [out] the index of the node used to trigger the control
|
|
1469
|
+
(0 for \b EN_TIMER and \b EN_TIMEOFDAY controls).
|
|
1470
|
+
* @param level [out] the action level (tank level, junction pressure, or time in seconds)
|
|
1471
|
+
that triggers the control.
|
|
1472
|
+
* @returns an error code.
|
|
1473
|
+
*/
|
|
1474
|
+
_EN_getcontrol(ph: Pointer, index: number, type: Pointer, linkIndex: Pointer, setting: Pointer, nodeIndex: Pointer, level: Pointer): number;
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* Sets the properties of an existing simple control.
|
|
1478
|
+
*
|
|
1479
|
+
* @param ph an EPANET project handle.
|
|
1480
|
+
* @param index the control's index (starting from 1).
|
|
1481
|
+
* @param type the type of control (see @ref EN_ControlType).
|
|
1482
|
+
* @param linkIndex the index of the link being controlled.
|
|
1483
|
+
* @param setting the control setting applied to the link.
|
|
1484
|
+
* @param nodeIndex the index of the node used to trigger the control
|
|
1485
|
+
(0 for \b EN_TIMER and \b EN_TIMEOFDAY controls).
|
|
1486
|
+
* @param level the action level (tank level, junction pressure, or time in seconds)
|
|
1487
|
+
that triggers the control.
|
|
1488
|
+
* @returns an error code.
|
|
1489
|
+
*/
|
|
1490
|
+
_EN_setcontrol(ph: Pointer, index: number, type: number, linkIndex: number, setting: number, nodeIndex: number, level: number): number;
|
|
1491
|
+
|
|
1492
|
+
/**
|
|
1493
|
+
* Adds a new rule-based control to a project.
|
|
1494
|
+
*
|
|
1495
|
+
* @param ph an EPANET project handle.
|
|
1496
|
+
* @param rule text of the rule following the format used in an EPANET input file.
|
|
1497
|
+
* @returns an error code.
|
|
1498
|
+
Consult the @ref RulesPage section of the @ref InpFile topic to learn about a
|
|
1499
|
+
rule's format. Each clause of the rule must end with a newline character <b>`\n`</b>.
|
|
1500
|
+
*/
|
|
1501
|
+
_EN_addrule(ph: Pointer, rule: Pointer): number;
|
|
1502
|
+
|
|
1503
|
+
/**
|
|
1504
|
+
* Deletes an existing rule-based control.
|
|
1505
|
+
*
|
|
1506
|
+
* @param ph an EPANET project handle.
|
|
1507
|
+
* @param index the index of the rule to be deleted (starting from 1).
|
|
1508
|
+
* @returns an error code.
|
|
1509
|
+
*/
|
|
1510
|
+
_EN_deleterule(ph: Pointer, index: number): number;
|
|
1511
|
+
|
|
1512
|
+
/**
|
|
1513
|
+
* Retrieves summary information about a rule-based control.
|
|
1514
|
+
*
|
|
1515
|
+
* @param ph an EPANET project handle.
|
|
1516
|
+
* @param index the rule's index (starting from 1).
|
|
1517
|
+
* @param nPremises [out] number of premises in the rule's IF section.
|
|
1518
|
+
* @param nThenActions [out] number of actions in the rule's THEN section.
|
|
1519
|
+
* @param nElseActions [out] number of actions in the rule's ELSE section.
|
|
1520
|
+
* @param priority [out] the rule's priority value.
|
|
1521
|
+
* @returns an error code.
|
|
1522
|
+
*/
|
|
1523
|
+
_EN_getrule(ph: Pointer, index: number, nPremises: Pointer, nThenActions: Pointer, nElseActions: Pointer, priority: Pointer): number;
|
|
1524
|
+
|
|
1525
|
+
/**
|
|
1526
|
+
* Gets the ID name of a rule-based control given its index.
|
|
1527
|
+
*
|
|
1528
|
+
* @param ph an EPANET project handle.
|
|
1529
|
+
* @param index the rule's index (starting from 1).
|
|
1530
|
+
* @param out_id [out] the rule's ID name.
|
|
1531
|
+
* @returns Error code.
|
|
1532
|
+
The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID" characters.
|
|
1533
|
+
*/
|
|
1534
|
+
_EN_getruleID(ph: Pointer, index: number, out_id: Pointer): number;
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* Gets the properties of a premise in a rule-based control.
|
|
1538
|
+
*
|
|
1539
|
+
* @param ph an EPANET project handle.
|
|
1540
|
+
* @param ruleIndex the rule's index (starting from 1).
|
|
1541
|
+
* @param premiseIndex the position of the premise in the rule's list of premises
|
|
1542
|
+
(starting from 1).
|
|
1543
|
+
* @param logop [out] the premise's logical operator ( \b IF = 1, \b AND = 2, \b OR = 3 ).
|
|
1544
|
+
* @param object [out] the type of object the premise refers to (see @ref EN_RuleObject).
|
|
1545
|
+
* @param objIndex [out] the index of the object (e.g. the index of a tank).
|
|
1546
|
+
* @param variable [out] the object's variable being compared (see @ref EN_RuleVariable).
|
|
1547
|
+
* @param relop [out] the premise's comparison operator (see @ref EN_RuleOperator).
|
|
1548
|
+
* @param status [out] the status that the object's status is compared to
|
|
1549
|
+
(see @ref EN_RuleStatus).
|
|
1550
|
+
* @param value [out] the value that the object's variable is compared to.
|
|
1551
|
+
* @returns an error code.
|
|
1552
|
+
*/
|
|
1553
|
+
_EN_getpremise(ph: Pointer, ruleIndex: number, premiseIndex: number, logop: Pointer, object: Pointer, objIndex: Pointer, variable: Pointer, relop: Pointer, status: Pointer, value: Pointer): number;
|
|
1554
|
+
|
|
1555
|
+
/**
|
|
1556
|
+
* Sets the properties of a premise in a rule-based control.
|
|
1557
|
+
*
|
|
1558
|
+
* @param ph an EPANET project handle.
|
|
1559
|
+
* @param ruleIndex the rule's index (starting from 1).
|
|
1560
|
+
* @param premiseIndex the position of the premise in the rule's list of premises.
|
|
1561
|
+
* @param logop the premise's logical operator ( \b IF = 1, \b AND = 2, \b OR = 3 ).
|
|
1562
|
+
* @param object the type of object the premise refers to (see @ref EN_RuleObject).
|
|
1563
|
+
* @param objIndex the index of the object (e.g. the index of a tank).
|
|
1564
|
+
* @param variable the object's variable being compared (see @ref EN_RuleVariable).
|
|
1565
|
+
* @param relop the premise's comparison operator (see @ref EN_RuleOperator).
|
|
1566
|
+
* @param status the status that the object's status is compared to
|
|
1567
|
+
(see @ref EN_RuleStatus).
|
|
1568
|
+
* @param value the value that the object's variable is compared to.
|
|
1569
|
+
* @returns an error code.
|
|
1570
|
+
*/
|
|
1571
|
+
_EN_setpremise(ph: Pointer, ruleIndex: number, premiseIndex: number, logop: number, object: number, objIndex: number, variable: number, relop: number, status: number, value: number): number;
|
|
1572
|
+
|
|
1573
|
+
/**
|
|
1574
|
+
* Sets the index of an object in a premise of a rule-based control.
|
|
1575
|
+
*
|
|
1576
|
+
* @param ph an EPANET project handle.
|
|
1577
|
+
* @param ruleIndex the rule's index (starting from 1).
|
|
1578
|
+
* @param premiseIndex the premise's index (starting from 1).
|
|
1579
|
+
* @param objIndex the index of the premise's object (e.g. the index of a tank).
|
|
1580
|
+
* @returns an error code.
|
|
1581
|
+
*/
|
|
1582
|
+
_EN_setpremiseindex(ph: Pointer, ruleIndex: number, premiseIndex: number, objIndex: number): number;
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* Sets the status being compared to in a premise of a rule-based control.
|
|
1586
|
+
*
|
|
1587
|
+
* @param ph an EPANET project handle.
|
|
1588
|
+
* @param ruleIndex the rule's index (starting from 1).
|
|
1589
|
+
* @param premiseIndex the premise's index (starting from 1).
|
|
1590
|
+
* @param status the status that the premise's object status is compared to
|
|
1591
|
+
(see @ref EN_RuleStatus).
|
|
1592
|
+
* @returns an error code.
|
|
1593
|
+
*/
|
|
1594
|
+
_EN_setpremisestatus(ph: Pointer, ruleIndex: number, premiseIndex: number, status: number): number;
|
|
1595
|
+
|
|
1596
|
+
/**
|
|
1597
|
+
* Sets the value in a premise of a rule-based control.
|
|
1598
|
+
*
|
|
1599
|
+
* @param ph an EPANET project handle.
|
|
1600
|
+
* @param ruleIndex the rule's index (staring from 1).
|
|
1601
|
+
* @param premiseIndex the premise's index (starting from 1).
|
|
1602
|
+
* @param value The value that the premise's variable is compared to.
|
|
1603
|
+
* @returns an error code.
|
|
1604
|
+
*/
|
|
1605
|
+
_EN_setpremisevalue(ph: Pointer, ruleIndex: number, premiseIndex: number, value: number): number;
|
|
1606
|
+
|
|
1607
|
+
/**
|
|
1608
|
+
* Gets the properties of a THEN action in a rule-based control.
|
|
1609
|
+
*
|
|
1610
|
+
* @param ph an EPANET project handle.
|
|
1611
|
+
* @param ruleIndex the rule's index (starting from 1).
|
|
1612
|
+
* @param actionIndex the index of the THEN action to retrieve (starting from 1).
|
|
1613
|
+
* @param linkIndex [out] the index of the link in the action (starting from 1).
|
|
1614
|
+
* @param status [out] the status assigned to the link (see @ref EN_RuleStatus)
|
|
1615
|
+
* @param setting [out] the value assigned to the link's setting.
|
|
1616
|
+
* @returns an error code.
|
|
1617
|
+
*/
|
|
1618
|
+
_EN_getthenaction(ph: Pointer, ruleIndex: number, actionIndex: number, linkIndex: Pointer, status: Pointer, setting: Pointer): number;
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* Sets the properties of a THEN action in a rule-based control.
|
|
1622
|
+
*
|
|
1623
|
+
* @param ph an EPANET project handle.
|
|
1624
|
+
* @param ruleIndex the rule's index (starting from 1).
|
|
1625
|
+
* @param actionIndex the index of the THEN action to modify (starting from 1).
|
|
1626
|
+
* @param linkIndex the index of the link in the action.
|
|
1627
|
+
* @param status the new status assigned to the link (see @ref EN_RuleStatus).
|
|
1628
|
+
* @param setting the new value assigned to the link's setting.
|
|
1629
|
+
* @returns an error code.
|
|
1630
|
+
*/
|
|
1631
|
+
_EN_setthenaction(ph: Pointer, ruleIndex: number, actionIndex: number, linkIndex: number, status: number, setting: number): number;
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* Gets the properties of an ELSE action in a rule-based control.
|
|
1635
|
+
*
|
|
1636
|
+
* @param ph an EPANET project handle.
|
|
1637
|
+
* @param ruleIndex the rule's index (starting from 1).
|
|
1638
|
+
* @param actionIndex the index of the ELSE action to retrieve (starting from 1).
|
|
1639
|
+
* @param linkIndex [out] the index of the link in the action.
|
|
1640
|
+
* @param status [out] the status assigned to the link (see @ref EN_RuleStatus).
|
|
1641
|
+
* @param setting [out] the value assigned to the link's setting.
|
|
1642
|
+
* @returns an error code.
|
|
1643
|
+
*/
|
|
1644
|
+
_EN_getelseaction(ph: Pointer, ruleIndex: number, actionIndex: number, linkIndex: Pointer, status: Pointer, setting: Pointer): number;
|
|
1645
|
+
|
|
1646
|
+
/**
|
|
1647
|
+
* Sets the properties of an ELSE action in a rule-based control.
|
|
1648
|
+
*
|
|
1649
|
+
* @param ph an EPANET project handle.
|
|
1650
|
+
* @param ruleIndex the rule's index (starting from 1).
|
|
1651
|
+
* @param actionIndex the index of the ELSE action being modified (starting from 1).
|
|
1652
|
+
* @param linkIndex the index of the link in the action (starting from 1).
|
|
1653
|
+
* @param status the new status assigned to the link (see @ref EN_RuleStatus)
|
|
1654
|
+
* @param setting the new value assigned to the link's setting.
|
|
1655
|
+
* @returns an error code.
|
|
1656
|
+
*/
|
|
1657
|
+
_EN_setelseaction(ph: Pointer, ruleIndex: number, actionIndex: number, linkIndex: number, status: number, setting: number): number;
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* Sets the priority of a rule-based control.
|
|
1661
|
+
*
|
|
1662
|
+
* @param ph an EPANET project handle.
|
|
1663
|
+
* @param index the rule's index (starting from 1).
|
|
1664
|
+
* @param priority the priority value assigned to the rule.
|
|
1665
|
+
* @returns an error code.
|
|
1666
|
+
*/
|
|
1667
|
+
_EN_setrulepriority(ph: Pointer, index: number, priority: number): number;
|
|
691
1668
|
}
|
|
1669
|
+
|
|
1670
|
+
// Default export factory function matching Emscripten MODULARIZE=1 and EXPORT_ES6=1
|
|
1671
|
+
export default function EpanetModuleFactory(moduleOverrides?: object): Promise<EpanetModule>;
|