epanet-plus 0.0.1__cp312-cp312-macosx_10_13_x86_64.whl

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.

Potentially problematic release.


This version of epanet-plus might be problematic. Click here for more details.

Files changed (105) hide show
  1. docs/conf.py +67 -0
  2. epanet-msx-src/dispersion.h +27 -0
  3. epanet-msx-src/hash.c +107 -0
  4. epanet-msx-src/hash.h +28 -0
  5. epanet-msx-src/include/epanetmsx.h +104 -0
  6. epanet-msx-src/include/epanetmsx_export.h +42 -0
  7. epanet-msx-src/mathexpr.c +937 -0
  8. epanet-msx-src/mathexpr.h +39 -0
  9. epanet-msx-src/mempool.c +204 -0
  10. epanet-msx-src/mempool.h +24 -0
  11. epanet-msx-src/msxchem.c +1285 -0
  12. epanet-msx-src/msxcompiler.c +368 -0
  13. epanet-msx-src/msxdict.h +42 -0
  14. epanet-msx-src/msxdispersion.c +586 -0
  15. epanet-msx-src/msxerr.c +116 -0
  16. epanet-msx-src/msxfile.c +260 -0
  17. epanet-msx-src/msxfuncs.c +175 -0
  18. epanet-msx-src/msxfuncs.h +35 -0
  19. epanet-msx-src/msxinp.c +1504 -0
  20. epanet-msx-src/msxout.c +398 -0
  21. epanet-msx-src/msxproj.c +791 -0
  22. epanet-msx-src/msxqual.c +2011 -0
  23. epanet-msx-src/msxrpt.c +400 -0
  24. epanet-msx-src/msxtank.c +422 -0
  25. epanet-msx-src/msxtoolkit.c +1164 -0
  26. epanet-msx-src/msxtypes.h +551 -0
  27. epanet-msx-src/msxutils.c +524 -0
  28. epanet-msx-src/msxutils.h +56 -0
  29. epanet-msx-src/newton.c +158 -0
  30. epanet-msx-src/newton.h +34 -0
  31. epanet-msx-src/rk5.c +287 -0
  32. epanet-msx-src/rk5.h +39 -0
  33. epanet-msx-src/ros2.c +293 -0
  34. epanet-msx-src/ros2.h +35 -0
  35. epanet-msx-src/smatrix.c +816 -0
  36. epanet-msx-src/smatrix.h +29 -0
  37. epanet-src/AUTHORS +60 -0
  38. epanet-src/LICENSE +21 -0
  39. epanet-src/enumstxt.h +151 -0
  40. epanet-src/epanet.c +5937 -0
  41. epanet-src/epanet2.c +961 -0
  42. epanet-src/epanet2.def +131 -0
  43. epanet-src/errors.dat +79 -0
  44. epanet-src/flowbalance.c +186 -0
  45. epanet-src/funcs.h +219 -0
  46. epanet-src/genmmd.c +1000 -0
  47. epanet-src/hash.c +177 -0
  48. epanet-src/hash.h +28 -0
  49. epanet-src/hydcoeffs.c +1303 -0
  50. epanet-src/hydraul.c +1164 -0
  51. epanet-src/hydsolver.c +781 -0
  52. epanet-src/hydstatus.c +442 -0
  53. epanet-src/include/epanet2.h +466 -0
  54. epanet-src/include/epanet2_2.h +1962 -0
  55. epanet-src/include/epanet2_enums.h +518 -0
  56. epanet-src/inpfile.c +884 -0
  57. epanet-src/input1.c +672 -0
  58. epanet-src/input2.c +970 -0
  59. epanet-src/input3.c +2265 -0
  60. epanet-src/leakage.c +527 -0
  61. epanet-src/mempool.c +146 -0
  62. epanet-src/mempool.h +24 -0
  63. epanet-src/output.c +853 -0
  64. epanet-src/project.c +1691 -0
  65. epanet-src/quality.c +695 -0
  66. epanet-src/qualreact.c +800 -0
  67. epanet-src/qualroute.c +696 -0
  68. epanet-src/report.c +1559 -0
  69. epanet-src/rules.c +1500 -0
  70. epanet-src/smatrix.c +871 -0
  71. epanet-src/text.h +508 -0
  72. epanet-src/types.h +928 -0
  73. epanet-src/util/cstr_helper.c +59 -0
  74. epanet-src/util/cstr_helper.h +38 -0
  75. epanet-src/util/errormanager.c +92 -0
  76. epanet-src/util/errormanager.h +39 -0
  77. epanet-src/util/filemanager.c +212 -0
  78. epanet-src/util/filemanager.h +81 -0
  79. epanet-src/validate.c +408 -0
  80. epanet.cpython-312-darwin.so +0 -0
  81. epanet_plus/VERSION +1 -0
  82. epanet_plus/__init__.py +8 -0
  83. epanet_plus/epanet_plus.c +118 -0
  84. epanet_plus/epanet_toolkit.py +2730 -0
  85. epanet_plus/epanet_wrapper.py +2414 -0
  86. epanet_plus/include/epanet_plus.h +9 -0
  87. epanet_plus-0.0.1.dist-info/METADATA +152 -0
  88. epanet_plus-0.0.1.dist-info/RECORD +105 -0
  89. epanet_plus-0.0.1.dist-info/WHEEL +6 -0
  90. epanet_plus-0.0.1.dist-info/licenses/LICENSE +21 -0
  91. epanet_plus-0.0.1.dist-info/top_level.txt +11 -0
  92. examples/basic_usage.py +35 -0
  93. python-extension/ext.c +344 -0
  94. python-extension/pyepanet.c +2133 -0
  95. python-extension/pyepanet.h +143 -0
  96. python-extension/pyepanet2.c +1823 -0
  97. python-extension/pyepanet2.h +141 -0
  98. python-extension/pyepanet_plus.c +37 -0
  99. python-extension/pyepanet_plus.h +4 -0
  100. python-extension/pyepanetmsx.c +388 -0
  101. python-extension/pyepanetmsx.h +35 -0
  102. tests/test_epanet.py +16 -0
  103. tests/test_epanetmsx.py +36 -0
  104. tests/test_epyt.py +114 -0
  105. tests/test_load_inp_from_buffer.py +18 -0
@@ -0,0 +1,2414 @@
1
+ """
2
+ This module contains a Python wrapper (incl. error handling) for EPANET and EPANET-MSX functions.
3
+ """
4
+ import warnings
5
+ import epanet
6
+
7
+
8
+ class EpanetAPI():
9
+ """
10
+ Interface for EPANET and EPANET-MSX functions, incl. a proper error handling.
11
+
12
+ Parameters
13
+ ----------
14
+ use_project : `bool`, optional
15
+ If True, projects will be used when calling EPANET functions (default in EPANET >= 2.2).
16
+ Note that this is incompatible with EPANET-MSX. Please set to False when using EPANET-MSX.
17
+
18
+ The default is False.
19
+
20
+ raise_on_error : `bool`, optional
21
+ True if an exception should be raised in the case of an error/warning, False otherwise.
22
+
23
+ The default is True.
24
+ warn_on_error : `bool`, optional
25
+ True if a warning should be generated in the case of an error/warning, False otherwise.
26
+
27
+ The default is False.
28
+ ignore_error_codes : `list[int]`, optional
29
+ List of error codes that should be ignored -- i.e., no exception or warning
30
+ will be generated.
31
+
32
+ The default is an empty list.
33
+ """
34
+ def __init__(self, use_project: bool = False, raise_exception_on_error: bool = True,
35
+ warn_on_error: bool = False, ignore_error_codes: list[int] = []):
36
+ if not isinstance(use_project, bool):
37
+ raise TypeError("'use_project' must be an instance of 'bool' " +
38
+ f"but not of '{type(use_project)}'")
39
+ if not isinstance(raise_exception_on_error, bool):
40
+ raise TypeError("'raise_exception_on_error' must be an instance of 'bool' " +
41
+ f"but not of '{type(raise_exception_on_error)}'")
42
+ if not isinstance(warn_on_error, bool):
43
+ raise TypeError("'warn_on_error' must be an instance of 'bool' " +
44
+ f"but not of type '{type(warn_on_error)}'")
45
+ if not isinstance(ignore_error_codes, list):
46
+ raise TypeError("'ignore_error_codes' must be an instance of 'list[int]' " +
47
+ f"but not of '{type(ignore_error_codes)}'")
48
+ else:
49
+ if any(not isinstance(item, int) for item in ignore_error_codes):
50
+ raise TypeError("All items in 'ignore_error_codes' must be of type 'int'")
51
+
52
+ if raise_exception_on_error is True and warn_on_error is True:
53
+ raise ValueError("'raise_exception_on_error' and 'warn_on_error' can not be both True")
54
+
55
+ self._use_project = use_project
56
+ self._ph = None
57
+ self._raise_on_error = raise_exception_on_error
58
+ self._warn_on_error = warn_on_error
59
+ self._ignore_error_codes = ignore_error_codes
60
+ self._last_error_code = None
61
+ self._last_error_desc = None
62
+
63
+ def set_error_handling(self, raise_exception_on_error: bool, warn_on_error: bool,
64
+ ignore_error_codes: list[int] = []) -> None:
65
+ """
66
+ Specifies the behavior in the case of an error/warning --
67
+ i.e. should an exception or warning be raised or not?
68
+
69
+ Parameters
70
+ ----------
71
+ raise_exception_on_error : `bool`
72
+ True if an exception should be raised, False otherwise.
73
+ warn_on_error : `bool`
74
+ True if a warning should be generated, False otherwise.
75
+ ignore_error_codes : `list[int]`
76
+ List of error codes that should be ignored -- i.e., no exception or
77
+ warning will be generated.
78
+ """
79
+ self._raise_on_error = raise_exception_on_error
80
+ self._warn_on_error = warn_on_error
81
+ self._ignore_error_codes = ignore_error_codes
82
+
83
+ def get_last_error_desc(self) -> str:
84
+ """
85
+ Returns the description of the last EPANET-(MSX) error/warning (if any).
86
+
87
+ Returns
88
+ -------
89
+ `str`
90
+ Description of the last error/warning. None, if there was no error/warning.
91
+ """
92
+ return self._last_error_desc
93
+
94
+ def get_last_error_code(self) -> int:
95
+ """
96
+ Returns the code of the last EPANET-(MSX) error/warnning (if any).
97
+
98
+ Refer to the `EPANET documentation <http://wateranalytics.org/EPANET/group___warning_codes.html>`_
99
+ for a list of all possible warning codes and their meanings.
100
+
101
+ Returns
102
+ -------
103
+ `int`
104
+ Code of the last error/warning. 0, if there was no error/warning.
105
+ """
106
+ return self._last_error_code
107
+
108
+ def was_last_func_successful(self) -> bool:
109
+ """
110
+ Checks if the last EPANET call was successful or not.
111
+
112
+ Parameters
113
+ ----------
114
+ `bool`
115
+ True if the last EPANET call returned an error/warning, False otherwise.
116
+ """
117
+ return self._last_error_desc is None
118
+
119
+ def _reset_error(self) -> None:
120
+ self.__last_error_code = 0
121
+ self.__last_error_desc = None
122
+
123
+ def _process_result(self, ret: tuple, msx_call: bool = False):
124
+ ret_other = None
125
+ if len(ret) == 1:
126
+ errcode = ret[0]
127
+ else:
128
+ errcode, *ret_other = ret
129
+
130
+ if errcode != 0:
131
+ self._last_error_code = errcode
132
+ if msx_call is False:
133
+ self._last_error_desc = self.geterror(errcode)
134
+ else:
135
+ self._last_error_desc = self.MSXgeterror(errcode)
136
+
137
+ if self._last_error_code not in self._ignore_error_codes:
138
+ if self._warn_on_error:
139
+ warnings.warn(self._last_error_desc, RuntimeWarning)
140
+ if self._raise_on_error:
141
+ raise RuntimeError(self._last_error_desc)
142
+
143
+ if ret_other is not None and len(ret_other) == 1:
144
+ return ret_other[0]
145
+ else:
146
+ return ret_other
147
+
148
+ @property
149
+ def use_project(self) -> bool:
150
+ """
151
+ Returns whether EPANET projects are used or not.
152
+
153
+ Returns
154
+ -------
155
+ `bool`
156
+ True, if EPANET projects are used, False otherwise.
157
+ """
158
+ return self._use_project
159
+
160
+ @property
161
+ def ph(self) -> int:
162
+ """
163
+ Returns a pointer (memory address) to the project structure.
164
+
165
+ Returns
166
+ -------
167
+ `int`
168
+ Pointer to project structure -- please do not change or access the memory location!
169
+ """
170
+ return self._ph
171
+
172
+ def openfrombuffer(self, inpBuffer: str, inpFile: str, rptFile: str, outFile: str):
173
+ """
174
+ EN_openfrombuffer -- extension of EPANET and part of EPANET-PLUS
175
+
176
+ Parameters
177
+ ----------
178
+ inpBuffer : `str`
179
+ inpFile : `str`
180
+ rptFile : `str`
181
+ outFile : `str`
182
+ """
183
+ if self._use_project is False:
184
+ return self._process_result(epanet.ENopenfrombuffer(inpBuffer, inpFile, rptFile,
185
+ outFile))
186
+ else:
187
+ return self._process_result(epanet.EN_openfrombuffer(inpBuffer, inpFile, rptFile,
188
+ outFile))
189
+
190
+ def createproject(self):
191
+ """
192
+ EN_createproject
193
+ """
194
+ if self._use_project is False:
195
+ raise ValueError("Can not create project because of use_project=False")
196
+ else:
197
+ self._ph = self._process_result(epanet.EN_createproject())
198
+
199
+ def deleteproject(self):
200
+ """
201
+ EN_deleteproject
202
+ """
203
+ if self._use_project is False:
204
+ raise ValueError("Can not delete project because of use_project=False")
205
+ else:
206
+ return self._process_result(epanet.EN_deleteproject(self._ph))
207
+
208
+ def init(self, rptFile: str, outFile: str, unitsType: int, headLossType: int):
209
+ """
210
+ EN_init
211
+
212
+ Parameters
213
+ ----------
214
+ rptFile : `str`
215
+ outFile : `str`
216
+ unitsType : `int`
217
+ headLossType : `int`
218
+ """
219
+ if self._use_project is False:
220
+ return self._process_result(epanet.ENinit(rptFile, outFile, unitsType, headLossType))
221
+ else:
222
+ return self._process_result(epanet.EN_init(self._ph, rptFile, outFile, unitsType,
223
+ headLossType))
224
+
225
+ def open(self, inpFile: str, rptFile: str, outFile: str):
226
+ """
227
+ EN_open
228
+
229
+ Parameters
230
+ ----------
231
+ inpFile : `str`
232
+ rptFile : `str`
233
+ outFile : `str`
234
+ """
235
+ if self._use_project is False:
236
+ return self._process_result(epanet.ENopen(inpFile, rptFile, outFile))
237
+ else:
238
+ return self._process_result(epanet.EN_open(self._ph, inpFile, rptFile, outFile))
239
+
240
+ def gettitle(self):
241
+ """
242
+ EN_gettitle
243
+ """
244
+ if self._use_project is False:
245
+ return self._process_result(epanet.ENgettitle())
246
+ else:
247
+ return self._process_result(epanet.EN_gettitle(self._ph))
248
+
249
+ def settitle(self, line1: str, line2: str, line3: str):
250
+ """
251
+ EN_settitle
252
+
253
+ Parameters
254
+ ----------
255
+ line1: str
256
+ line2: str
257
+ line3: str
258
+ """
259
+ if self._use_project is False:
260
+ return self._process_result(epanet.ENsettitle(line1, line2, line3))
261
+ else:
262
+ return self._process_result(epanet.EN_settitle(self._ph, line1, line2, line3))
263
+
264
+ def getcomment(self, obj: int, index: int):
265
+ """
266
+ EN_getcomment
267
+
268
+ Parameters
269
+ ----------
270
+ obj : `int`
271
+ index : `int`
272
+ """
273
+ if self._use_project is False:
274
+ return self._process_result(epanet.ENgetcomment(obj, index))
275
+ else:
276
+ return self._process_result(epanet.EN_getcomment(self._ph, obj, index))
277
+
278
+ def setcomment(self, obj: int, index: int, comment: str):
279
+ """
280
+ EN_setcomment
281
+
282
+ Parameters
283
+ ----------
284
+ obj : `int`
285
+ index : `int`
286
+ comment : `str`
287
+ """
288
+ if self._use_project is False:
289
+ return self._process_result(epanet.ENsetcomment(obj, index, comment))
290
+ else:
291
+ return self._process_result(epanet.EN_setcomment(self._ph, obj, index, comment))
292
+
293
+ def getcount(self, obj: int):
294
+ """
295
+ EN_getcount
296
+
297
+ Parameters
298
+ ----------
299
+ obj : `int`
300
+ """
301
+ if self._use_project is False:
302
+ return self._process_result(epanet.ENgetcount(obj))
303
+ else:
304
+ return self._process_result(epanet.EN_getcount(self._ph, obj))
305
+
306
+ def saveinpfile(self, filename: str):
307
+ """
308
+ EN_saveinpfile
309
+
310
+ Parameters
311
+ ----------
312
+ filename : `str`
313
+ """
314
+ if self._use_project is False:
315
+ return self._process_result(epanet.ENsaveinpfile(filename))
316
+ else:
317
+ return self._process_result(epanet.EN_saveinpfile(self._ph, filename))
318
+
319
+ def close(self):
320
+ """
321
+ EN_close
322
+ """
323
+ if self._use_project is False:
324
+ return self._process_result(epanet.ENclose())
325
+ else:
326
+ return self._process_result(epanet.EN_close(self._ph))
327
+
328
+ def solveH(self):
329
+ """
330
+ EN_solveH
331
+ """
332
+ if self._use_project is False:
333
+ return self._process_result(epanet.ENsolveH())
334
+ else:
335
+ return self._process_result(epanet.EN_solveH(self._ph))
336
+
337
+ def usehydfile(self, filename: str):
338
+ """
339
+ EN_usehydfile
340
+
341
+ Parameters
342
+ ----------
343
+ filename : `str`
344
+ """
345
+ if self._use_project is False:
346
+ return self._process_result(epanet.ENusehydfile(filename))
347
+ else:
348
+ return self._process_result(epanet.EN_usehydfile(filename))
349
+
350
+ def openH(self):
351
+ """
352
+ EN_openH
353
+ """
354
+ if self._use_project is False:
355
+ return self._process_result(epanet.ENopenH())
356
+ else:
357
+ return self._process_result(epanet.EN_openH(self._ph))
358
+
359
+ def initH(self, initFlag: int):
360
+ """
361
+ EN_initH
362
+
363
+ Parameters
364
+ ----------
365
+ initFlag : `int`
366
+ """
367
+ if self._use_project is False:
368
+ return self._process_result(epanet.ENinitH(initFlag))
369
+ else:
370
+ return self._process_result(epanet.EN_initH(self._ph, initFlag))
371
+
372
+ def runH(self):
373
+ """
374
+ EN_runH
375
+ """
376
+ if self._use_project is False:
377
+ return self._process_result(epanet.ENrunH())
378
+ else:
379
+ return self._process_result(epanet.EN_runH(self._ph))
380
+
381
+ def nextH(self):
382
+ """
383
+ EN_nextH
384
+ """
385
+ if self._use_project is False:
386
+ return self._process_result(epanet.ENnextH())
387
+ else:
388
+ return self._process_result(epanet.EN_nextH(self._ph))
389
+
390
+ def saveH(self):
391
+ """
392
+ EN_saveH
393
+ """
394
+ if self._use_project is False:
395
+ return self._process_result(epanet.ENsaveH())
396
+ else:
397
+ return self._process_result(epanet.EN_saveH(self._ph))
398
+
399
+ def savehydfile(self, filename):
400
+ """
401
+ EN_savehydfile
402
+
403
+ Parameters
404
+ ----------
405
+ filename : `str`
406
+ """
407
+ if self._use_project is False:
408
+ return self._process_result(epanet.ENsavehydfile(filename))
409
+ else:
410
+ return self._process_result(epanet.EN_savehydfile(self._ph, filename))
411
+
412
+ def closeH(self):
413
+ """
414
+ EN_closeH
415
+ """
416
+ if self._use_project is False:
417
+ return self._process_result(epanet.ENcloseH())
418
+ else:
419
+ return self._process_result(epanet.EN_closeH(self._ph))
420
+
421
+ def solveQ(self):
422
+ """
423
+ EN_solveQ
424
+ """
425
+ if self._use_project is False:
426
+ return self._process_result(epanet.ENsolveQ())
427
+ else:
428
+ return self._process_result(epanet.EN_solveQ(self._ph))
429
+
430
+ def openQ(self):
431
+ """
432
+ EN_openQ
433
+ """
434
+ if self._use_project is False:
435
+ return self._process_result(epanet.ENopenQ())
436
+ else:
437
+ return self._process_result(epanet.EN_openQ(self._ph))
438
+
439
+ def initQ(self, save_flag: int):
440
+ """
441
+ EN_initQ
442
+
443
+ Parameters
444
+ ----------
445
+ save_flag : `int`
446
+ """
447
+ if self._use_project is False:
448
+ return self._process_result(epanet.ENinitQ(save_flag))
449
+ else:
450
+ return self._process_result(epanet.EN_initQ(self._ph, save_flag))
451
+
452
+ def runQ(self):
453
+ """
454
+ EN_runQ
455
+ """
456
+ if self._use_project is False:
457
+ return self._process_result(epanet.ENrunQ())
458
+ else:
459
+ return self._process_result(epanet.EN_runQ(self._ph))
460
+
461
+ def nextQ(self):
462
+ """
463
+ EN_nextQ
464
+ """
465
+ if self._use_project is False:
466
+ return self._process_result(epanet.ENnextQ())
467
+ else:
468
+ return self._process_result(epanet.EN_nextQ(self._ph))
469
+
470
+ def stepQ(self):
471
+ """
472
+ EN_stepQ
473
+ """
474
+ if self._use_project is False:
475
+ return self._process_result(epanet.ENstepQ())
476
+ else:
477
+ return self._process_result(epanet.EN_stepQ(self._ph))
478
+
479
+ def closeQ(self):
480
+ """
481
+ EN_closeQ
482
+ """
483
+ if self._use_project is False:
484
+ return self._process_result(epanet.ENcloseQ())
485
+ else:
486
+ return self._process_result(epanet.EN_closeQ(self._ph))
487
+
488
+ def writeline(self, line: str):
489
+ """
490
+ EN_writeline
491
+
492
+ Parameters
493
+ ----------
494
+ line : `str`
495
+ """
496
+ if self._use_project is False:
497
+ return self._process_result(epanet.ENwriteline(line))
498
+ else:
499
+ return self._process_result(epanet.EN_writeline(self._ph, line))
500
+
501
+ def report(self):
502
+ """
503
+ EN_report
504
+ """
505
+ if self._use_project is False:
506
+ return self._process_result(epanet.ENreport())
507
+ else:
508
+ return self._process_result(epanet.EN_report(self._ph))
509
+
510
+ def copyreport(self):
511
+ """
512
+ EN_copyreport
513
+ """
514
+ if self._use_project is False:
515
+ return self._process_result(epanet.ENcopyreport())
516
+ else:
517
+ return self._process_result(epanet.EN_copyreport(self._ph))
518
+
519
+ def clearreport(self):
520
+ """
521
+ EN_clearreport
522
+ """
523
+ if self._use_project is False:
524
+ return self._process_result(epanet.ENclearreport())
525
+ else:
526
+ return self._process_result(epanet.EN_clearreport(self._ph))
527
+
528
+ def resetreport(self):
529
+ """
530
+ EN_resetreport
531
+ """
532
+ if self._use_project is False:
533
+ return self._process_result(epanet.ENresetreport())
534
+ else:
535
+ return self._process_result(epanet.EN_resetreport(self._ph))
536
+
537
+ def setreport(self, format_desc: str):
538
+ """
539
+ EN_setreport
540
+
541
+ Parameters
542
+ ----------
543
+ format_desc : `str`
544
+ """
545
+ if self._use_project is False:
546
+ return self._process_result(epanet.ENsetreport(format_desc))
547
+ else:
548
+ return self._process_result(epanet.EN_setreport(self._ph, format_desc))
549
+
550
+ def setstatusreport(self, level: int):
551
+ """
552
+ EN_setstatusreport
553
+
554
+ Parameters
555
+ ----------
556
+ level : `int`
557
+ """
558
+ if self._use_project is False:
559
+ return self._process_result(epanet.ENsetstatusreport(level))
560
+ else:
561
+ return self._process_result(epanet.EN_setstatusreport(self._ph, level))
562
+
563
+ def getversion(self):
564
+ """
565
+ EN_getversion
566
+ """
567
+ if self._use_project is False:
568
+ return self._process_result(epanet.ENgetversion())
569
+ else:
570
+ return self._process_result(epanet.EN_getversion())
571
+
572
+ def geterror(self, error_code: int):
573
+ """
574
+ EN_geterror
575
+
576
+ Parameters
577
+ ----------
578
+ error_code : `int`
579
+ """
580
+ if self._use_project is False:
581
+ err, err_msg = epanet.ENgeterror(error_code)
582
+ else:
583
+ err, err_msg = epanet.EN_geterror(error_code)
584
+
585
+ if err != 0:
586
+ raise RuntimeError("Failed to get error message")
587
+
588
+ return err_msg
589
+
590
+ def getstatistic(self, stat_type: int):
591
+ """
592
+ EN_getstatistic
593
+
594
+ Parameters
595
+ ----------
596
+ stat_type : `int`
597
+ """
598
+ if self._use_project is False:
599
+ return self._process_result(epanet.ENgetstatistic(stat_type))
600
+ else:
601
+ return self._process_result(epanet.EN_getstatistic(self._ph, stat_type))
602
+
603
+ def getresultindex(self, result_type: int, index: int):
604
+ """
605
+ EN_getresultindex
606
+
607
+ Parameters
608
+ ----------
609
+ result_type : `int`
610
+ index : `int`
611
+ """
612
+ if self._use_project is False:
613
+ return self._process_result(epanet.ENgetresultindex(result_type, index))
614
+ else:
615
+ return self._process_result(epanet.EN_getresultindex(self._ph, result_type, index))
616
+
617
+ def getoption(self, option: int):
618
+ """
619
+ EN_getoption
620
+
621
+ Parameters
622
+ ----------
623
+ option : `int`
624
+ """
625
+ if self._use_project is False:
626
+ return self._process_result(epanet.ENgetoption(option))
627
+ else:
628
+ return self._process_result(epanet.EN_getoption(self._ph, option))
629
+
630
+ def setoption(self, option: int, value: float):
631
+ """
632
+ EN_setoption
633
+
634
+ Parameters
635
+ ----------
636
+ option : `int`
637
+ value : `float`
638
+ """
639
+ if self._use_project is False:
640
+ return self._process_result(epanet.ENsetoption(option, value))
641
+ else:
642
+ return self._process_result(epanet.EN_setoption(self._ph, option, value))
643
+
644
+ def getflowunits(self):
645
+ """
646
+ EN_getflowunits
647
+ """
648
+ if self._use_project is False:
649
+ return self._process_result(epanet.ENgetflowunits())
650
+ else:
651
+ return self._process_result(epanet.EN_getflowunits(self._ph))
652
+
653
+ def setflowunits(self, units: int):
654
+ """
655
+ EN_setflowunits
656
+
657
+ Parameters
658
+ ----------
659
+ units : `int`
660
+ """
661
+ if self._use_project is False:
662
+ return self._process_result(epanet.ENsetflowunits(units))
663
+ else:
664
+ return self._process_result(epanet.EN_setflowunits(self._ph, units))
665
+
666
+ def gettimeparam(self, param: int):
667
+ """
668
+ EN_gettimeparam
669
+
670
+ Parameters
671
+ ----------
672
+ param : `int`
673
+ """
674
+ if self._use_project is False:
675
+ return self._process_result(epanet.ENgettimeparam(param))
676
+ else:
677
+ return self._process_result(epanet.EN_gettimeparam(self._ph, param))
678
+
679
+ def settimeparam(self, param: int, value: int):
680
+ """
681
+ EN_settimeparam
682
+
683
+ Parameters
684
+ ----------
685
+ param : `int`
686
+ value : `int`
687
+ """
688
+ if self._use_project is False:
689
+ return self._process_result(epanet.ENsettimeparam(param, value))
690
+ else:
691
+ return self._process_result(epanet.EN_settimeparam(self._ph, param, value))
692
+
693
+ def getqualinfo(self):
694
+ """
695
+ EN_getqualinfo
696
+ """
697
+ if self._use_project is False:
698
+ return self._process_result(epanet.ENgetqualinfo())
699
+ else:
700
+ return self._process_result(epanet.EN_getqualinfo(self._ph))
701
+
702
+ def getqualtype(self):
703
+ """
704
+ EN_getqualtype
705
+ """
706
+ if self._use_project is False:
707
+ return self._process_result(epanet.ENgetqualtype())
708
+ else:
709
+ return self._process_result(epanet.EN_getqualtype(self._ph))
710
+
711
+ def setqualtype(self, qual_type: int, chem_name: str, chem_units: str, trace_node_id: str):
712
+ """
713
+ EN_setqualtype
714
+
715
+ Parameters
716
+ ----------
717
+ qual_type : `int`
718
+ chem_name : `str`
719
+ chem_units : `str`
720
+ trace_node_id : `str`
721
+ """
722
+ if self._use_project is False:
723
+ return self._process_result(epanet.ENsetqualtype(qual_type, chem_name, chem_units,
724
+ trace_node_id))
725
+ else:
726
+ return self._process_result(epanet.EN_setqualtype(self._ph, qual_type, chem_name,
727
+ chem_units, trace_node_id))
728
+
729
+ def addnode(self, node_id: str, node_type: int):
730
+ """
731
+ EN_addnode
732
+
733
+ Parameters
734
+ ----------
735
+ node_id : `str`
736
+ node_type : `int`
737
+ """
738
+ if self._use_project is False:
739
+ return self._process_result(epanet.ENaddnode(node_id, node_type))
740
+ else:
741
+ return self._process_result(epanet.EN_addnode(self._ph, node_id, node_type))
742
+
743
+ def deletenode(self, index: int, action_code: int):
744
+ """
745
+ EN_deletenode
746
+
747
+ Parameters
748
+ ----------
749
+ index : `int`
750
+ action_code : `int`
751
+ """
752
+ if self._use_project is False:
753
+ return self._process_result(epanet.ENdeletenode(index, action_code))
754
+ else:
755
+ return self._process_result(epanet.EN_deletenode(self._ph, index, action_code))
756
+
757
+ def getnodeindex(self, node_id: str):
758
+ """
759
+ EN_getnodeindex
760
+
761
+ Parameters
762
+ ----------
763
+ node_id : `str`
764
+ """
765
+ if self._use_project is False:
766
+ return self._process_result(epanet.ENgetnodeindex(node_id))
767
+ else:
768
+ return self._process_result(epanet.EN_getnodeindex(self._ph, node_id))
769
+
770
+ def getnodeid(self, index: int):
771
+ """
772
+ EN_getnodeid
773
+
774
+ Parameters
775
+ ----------
776
+ index : `int`
777
+ """
778
+ if self._use_project is False:
779
+ return self._process_result(epanet.ENgetnodeid(index))
780
+ else:
781
+ return self._process_result(epanet.EN_getnodeid(self._ph, index))
782
+
783
+ def setnodeid(self, index: int, new_id: str):
784
+ """
785
+ EN_setnodeid
786
+
787
+ Parameters
788
+ ----------
789
+ index : `int`
790
+ new_id : `str`
791
+ """
792
+ if self._use_project is False:
793
+ return self._process_result(epanet.ENsetnodeid(index, new_id))
794
+ else:
795
+ return self._process_result(epanet.EN_setnodeid(self._ph, index, new_id))
796
+
797
+ def getnodetype(self, index: int):
798
+ """
799
+ EN_getnodetype
800
+
801
+ Parameters
802
+ ----------
803
+ index : `int`
804
+ """
805
+ if self._use_project is False:
806
+ return self._process_result(epanet.ENgetnodetype(index))
807
+ else:
808
+ return self._process_result(epanet.EN_getnodetype(self._ph, index))
809
+
810
+ def getnodevalue(self, index: int, node_property: int):
811
+ """
812
+ EN_getnodevalue
813
+
814
+ Parameters
815
+ ----------
816
+ index : `int`
817
+ node_property : `int`
818
+ """
819
+ if self._use_project is False:
820
+ return self._process_result(epanet.ENgetnodevalue(index, node_property))
821
+ else:
822
+ return self._process_result(epanet.EN_getnodevalue(self._ph, index, node_property))
823
+
824
+ def setnodevalue(self, index: int, node_property: int, value: float):
825
+ """
826
+ EN_setnodevalue
827
+
828
+ Parameters
829
+ ----------
830
+ index : `int`
831
+ node_property : `int`
832
+ value : `float`
833
+ """
834
+ if self._use_project is False:
835
+ return self._process_result(epanet.ENsetnodevalue(index, node_property, value))
836
+ else:
837
+ return self._process_result(epanet.EN_setnodevalue(self._ph, index, node_property,
838
+ value))
839
+
840
+ def setjuncdata(self, index: int, elev: float, dmnd: float, dmnd_pat: str):
841
+ """
842
+ EN_setjuncdata
843
+
844
+ Parameters
845
+ ----------
846
+ index : `int`
847
+ elev : `float`
848
+ dmnd : `float`
849
+ dmdn_pat : `float`
850
+ """
851
+ if self._use_project is False:
852
+ return self._process_result(epanet.ENsetjuncdata(index, elev, dmnd, dmnd_pat))
853
+ else:
854
+ return self._process_result(epanet.EN_setjuncdata(self._ph, index, elev, dmnd,
855
+ dmnd_pat))
856
+
857
+ def settankdata(self, index: int, elev: float, initlvl: float, minlvl: float, maxlvl: float,
858
+ diam: float, minvol: float, volcurve: str):
859
+ """
860
+ EN_settankdata
861
+
862
+ Parameters
863
+ ----------
864
+ index : `int`
865
+ elev : `float`
866
+ initlvl : `float`
867
+ minlvl : `float`
868
+ maxlvl : `float`
869
+ diam : `float`
870
+ minvol : `float`
871
+ volcurve : `str`
872
+ """
873
+ if self._use_project is False:
874
+ return self._process_result(epanet.ENsettankdata(index, elev, initlvl, minlvl, maxlvl,
875
+ diam, minvol, volcurve))
876
+ else:
877
+ return self._process_result(epanet.EN_settankdata(self._ph, index, elev, initlvl,
878
+ minlvl, maxlvl, diam, minvol,
879
+ volcurve))
880
+
881
+ def getcoord(self, index: int):
882
+ """
883
+ EN_getcoord
884
+
885
+ Parameters
886
+ ----------
887
+ index : `int`
888
+ """
889
+ if self._use_project is False:
890
+ return self._process_result(epanet.ENgetcoord(index))
891
+ else:
892
+ return self._process_result(epanet.EN_getcoord(self._ph, index))
893
+
894
+ def setcoord(self, index: int, x: float, y: float):
895
+ """
896
+ EN_setcoord
897
+
898
+ Parameters
899
+ ----------
900
+ index : `int`
901
+ x : `float`
902
+ y : `float`
903
+ """
904
+ if self._use_project is False:
905
+ return self._process_result(epanet.ENsetcoord(index, x, y))
906
+ else:
907
+ return self._process_result(epanet.EN_setcoord(self._ph, index, x, y))
908
+
909
+ def getdemandmodel(self):
910
+ """
911
+ EN_getdemandmodel
912
+ """
913
+ if self._use_project is False:
914
+ return self._process_result(epanet.ENgetdemandmodel())
915
+ else:
916
+ return self._process_result(epanet.EN_getdemandmodel(self._ph))
917
+
918
+ def setdemandmodel(self, demand_type: int, pmin: float, preq: float, pexp: float):
919
+ """
920
+ EN_setdemandmodel
921
+
922
+ Parameters
923
+ ----------
924
+ demand_type : `int`
925
+ pmin : `float`
926
+ preq : `float`
927
+ pexp : `float`
928
+ """
929
+ if self._use_project is False:
930
+ return self._process_result(epanet.ENsetdemandmodel(demand_type, pmin, preq, pexp))
931
+ else:
932
+ return self._process_result(epanet.EN_setdemandmodel(self._ph, demand_type,
933
+ pmin, preq, pexp))
934
+
935
+ def adddemand(self, node_index: int, base_demand: float, demand_pattern: str, demand_name: str):
936
+ """
937
+ EN_adddemand
938
+
939
+ node_index : `int`
940
+ base_demand : `float`
941
+ demand_pattern : `str`
942
+ demand_name : `str`
943
+ """
944
+ if self._use_project is False:
945
+ return self._process_result(epanet.ENadddemand(node_index, base_demand, demand_pattern,
946
+ demand_name))
947
+ else:
948
+ return self._process_result(epanet.EN_adddemand(self._ph, node_index, base_demand,
949
+ demand_pattern, demand_name))
950
+
951
+ def deletedemand(self, node_index: int, demand_index: int):
952
+ """
953
+ EN_deletedemand
954
+
955
+ Parameters
956
+ ----------
957
+ node_index : `int`
958
+ demand_index : `int`
959
+ """
960
+ if self._use_project is False:
961
+ return self._process_result(epanet.ENdeletedemand(node_index, demand_index))
962
+ else:
963
+ return self._process_result(epanet.EN_deletedemand(self._ph, node_index, demand_index))
964
+
965
+ def getdemandindex(self, node_index: int, demand_name: str):
966
+ """
967
+ EN_getdemandindex
968
+
969
+ Parameters
970
+ ----------
971
+ node_index : `int`
972
+ demand_name : `str`
973
+ """
974
+ if self._use_project is False:
975
+ return self._process_result(epanet.ENgetdemandindex(node_index, demand_name))
976
+ else:
977
+ return self._process_result(epanet.EN_getdemandindex(self._ph, node_index, demand_name))
978
+
979
+ def getnumdemands(self, node_index: int):
980
+ """
981
+ EN_getnumdemands
982
+
983
+ Parameters
984
+ ----------
985
+ node_index : `int`
986
+ """
987
+ if self._use_project is False:
988
+ return self._process_result(epanet.ENgetnumdemands(node_index))
989
+ else:
990
+ return self._process_result(epanet.EN_getnumdemands(self._ph, node_index))
991
+
992
+ def getbasedemand(self, node_index: int, demand_index: int):
993
+ """
994
+ EN_getbasedemand
995
+
996
+ Parameters
997
+ ----------
998
+ node_index : `int`
999
+ demand_index : `int`
1000
+ """
1001
+ if self._use_project is False:
1002
+ return self._process_result(epanet.ENgetbasedemand(node_index, demand_index))
1003
+ else:
1004
+ return self._process_result(epanet.EN_getbasedemand(self._ph, node_index, demand_index))
1005
+
1006
+ def setbasedemand(self, node_index: int, demand_index: int, base_demand: float):
1007
+ """
1008
+ EN_setbasedemand
1009
+
1010
+ Parameters
1011
+ ----------
1012
+ node_index : `int`
1013
+ demand_index : `int`
1014
+ base_demand : `float`
1015
+ """
1016
+ if self._use_project is False:
1017
+ return self._process_result(epanet.ENsetbasedemand(node_index, demand_index,
1018
+ base_demand))
1019
+ else:
1020
+ return self._process_result(epanet.EN_setbasedemand(self._ph, node_index, demand_index,
1021
+ base_demand))
1022
+
1023
+ def getdemandpattern(self, node_index: int, demand_index: int):
1024
+ """
1025
+ EN_getdemandpattern
1026
+
1027
+ Parameters
1028
+ ----------
1029
+ node_index : `int`
1030
+ demand_index : `int`
1031
+ """
1032
+ if self._use_project is False:
1033
+ return self._process_result(epanet.ENgetdemandpattern(node_index, demand_index))
1034
+ else:
1035
+ return self._process_result(epanet.EN_getdemandpattern(self._ph, node_index,
1036
+ demand_index))
1037
+
1038
+ def setdemandpattern(self, node_index: int, demand_index: int, pat_index: int):
1039
+ """
1040
+ EN_setdemandpattern
1041
+
1042
+ Parameters
1043
+ ----------
1044
+ node_index : `int`
1045
+ demand_index : `int`
1046
+ pat_index : `int`
1047
+ """
1048
+ if self._use_project is False:
1049
+ return self._process_result(epanet.ENsetdemandpattern(node_index, demand_index,
1050
+ pat_index))
1051
+ else:
1052
+ return self._process_result(epanet.EN_setdemandpattern(self._ph, node_index,
1053
+ demand_index, pat_index))
1054
+
1055
+ def getdemandname(self, node_index: int, demand_index: int):
1056
+ """
1057
+ EN_getdemandname
1058
+
1059
+ Parameters
1060
+ ----------
1061
+ node_index : `int`
1062
+ demand_index : `int`
1063
+ """
1064
+ if self._use_project is False:
1065
+ return self._process_result(epanet.ENgetdemandname(node_index, demand_index))
1066
+ else:
1067
+ return self._process_result(epanet.EN_getdemandname(self._ph, node_index, demand_index))
1068
+
1069
+ def setdemandname(self, node_index: int, demand_index: int, demand_name: str):
1070
+ """
1071
+ EN_setdemandname
1072
+
1073
+ Parameters
1074
+ ----------
1075
+ node_index : `int`
1076
+ demand_index : `int`
1077
+ demand_name : `str`
1078
+ """
1079
+ if self._use_project is False:
1080
+ return self._process_result(epanet.ENsetdemandname(node_index, demand_index,
1081
+ demand_name))
1082
+ else:
1083
+ return self._process_result(epanet.EN_setdemandname(self._ph, node_index, demand_index,
1084
+ demand_name))
1085
+
1086
+ def addlink(self, id: str, link_type: int, from_node: str, to_node: str):
1087
+ """
1088
+ EN_addlink
1089
+
1090
+ Parameters
1091
+ ----------
1092
+ id : `str`
1093
+ link_type : `int`
1094
+ from_node : `str`
1095
+ to_node : `str`
1096
+ """
1097
+ if self._use_project is False:
1098
+ return self._process_result(epanet.ENaddlink(id, link_type, from_node, to_node))
1099
+ else:
1100
+ return self._process_result(epanet.EN_addlink(self._ph, id, link_type, from_node,
1101
+ to_node))
1102
+
1103
+ def deletelink(self, index: int, action_code: int):
1104
+ """
1105
+ EN_deletelink
1106
+
1107
+ Parameters
1108
+ ----------
1109
+ index : `int`
1110
+ action_code : `int`
1111
+ """
1112
+ if self._use_project is False:
1113
+ return self._process_result(epanet.ENdeletelink(index, action_code))
1114
+ else:
1115
+ return self._process_result(epanet.EN_deletelink(self._ph, index, action_code))
1116
+
1117
+ def getlinkindex(self, link_id: str):
1118
+ """
1119
+ EN_getlinkindex
1120
+
1121
+ Parameters
1122
+ ----------
1123
+ link_id : `str`
1124
+ """
1125
+ if self._use_project is False:
1126
+ return self._process_result(epanet.ENgetlinkindex(link_id))
1127
+ else:
1128
+ return self._process_result(epanet.EN_getlinkindex(self._ph, link_id))
1129
+
1130
+ def getlinkid(self, index: int):
1131
+ """
1132
+ EN_getlinkid
1133
+
1134
+ Parameters
1135
+ ----------
1136
+ index : `int`
1137
+ """
1138
+ if self._use_project is False:
1139
+ return self._process_result(epanet.ENgetlinkid(index))
1140
+ else:
1141
+ return self._process_result(epanet.EN_getlinkid(self._ph, index))
1142
+
1143
+ def setlinkid(self, index: int, new_id: str):
1144
+ """
1145
+ EN_setlinkid
1146
+
1147
+ Parameters
1148
+ ----------
1149
+ index : `int`
1150
+ new_id : `str`
1151
+ """
1152
+ if self._use_project is False:
1153
+ return self._process_result(epanet.ENsetlinkid(index, new_id))
1154
+ else:
1155
+ return self._process_result(epanet.EN_setlinkid(self._ph, index, new_id))
1156
+
1157
+ def getlinktype(self, index: int):
1158
+ """
1159
+ EN_getlinktype
1160
+
1161
+ Parameters
1162
+ ----------
1163
+ index : `int`
1164
+ """
1165
+ if self._use_project is False:
1166
+ return self._process_result(epanet.ENgetlinktype(index))
1167
+ else:
1168
+ return self._process_result(epanet.EN_getlinktype(self._ph, index))
1169
+
1170
+ def setlinktype(self, index: int, link_type: int, action_code: int):
1171
+ """
1172
+ EN_setlinktype
1173
+
1174
+ Parameters
1175
+ ----------
1176
+ index : `int`
1177
+ link_type : `int`
1178
+ action_code : `int`
1179
+ """
1180
+ if self._use_project is False:
1181
+ return self._process_result(epanet.ENsetlinktype(index, link_type, action_code))
1182
+ else:
1183
+ return self._process_result(epanet.EN_setlinktype(self._ph, index, link_type,
1184
+ action_code))
1185
+
1186
+ def getlinknodes(self, index: int):
1187
+ """
1188
+ EN_getlinknodes
1189
+
1190
+ Parameters
1191
+ ----------
1192
+ index : `int`
1193
+ """
1194
+ if self._use_project is False:
1195
+ return self._process_result(epanet.ENgetlinknodes(index))
1196
+ else:
1197
+ return self._process_result(epanet.EN_getlinknodes(self._ph, index))
1198
+
1199
+ def setlinknodes(self, index: int, node1: int, node2: int):
1200
+ """
1201
+ EN_setlinknodes
1202
+
1203
+ Parameters
1204
+ ----------
1205
+ index : `int`
1206
+ node1 : `int`
1207
+ node2 : `int`
1208
+ """
1209
+ if self._use_project is False:
1210
+ return self._process_result(epanet.ENsetlinknodes(index, node1, node2))
1211
+ else:
1212
+ return self._process_result(epanet.EN_setlinknodes(self._ph, index, node1, node2))
1213
+
1214
+ def getlinkvalue(self, index: int, property: int):
1215
+ """
1216
+ EN_getlinkvalue
1217
+
1218
+ Parameters
1219
+ ----------
1220
+ index : `int`
1221
+ property : `int`
1222
+ """
1223
+ if self._use_project is False:
1224
+ return self._process_result(epanet.ENgetlinkvalue(index, property))
1225
+ else:
1226
+ return self._process_result(epanet.EN_getlinkvalue(self._ph, index, property))
1227
+
1228
+ def setlinkvalue(self, index: int, property: int, value: float):
1229
+ """
1230
+ EN_setlinkvalue
1231
+
1232
+ Parameters
1233
+ ----------
1234
+ index : `int`
1235
+ property : `int`
1236
+ value : `float`
1237
+ """
1238
+ if self._use_project is False:
1239
+ return self._process_result(epanet.ENsetlinkvalue(index, property, value))
1240
+ else:
1241
+ return self._process_result(epanet.EN_setlinkvalue(self._ph, index, property, value))
1242
+
1243
+ def setpipedata(self, index: int, length: float, diam: float, rough: float, mloss: float):
1244
+ """
1245
+ EN_setpipedata
1246
+
1247
+ Parameters
1248
+ ----------
1249
+ index : `int`
1250
+ length : `float`
1251
+ diam : `float`
1252
+ rough : `float`
1253
+ mloss : `float`
1254
+ """
1255
+ if self._use_project is False:
1256
+ return self._process_result(epanet.ENsetpipedata(index, length, diam, rough, mloss))
1257
+ else:
1258
+ return self._process_result(epanet.EN_setpipedata(self._ph, index, length, diam, rough,
1259
+ mloss))
1260
+
1261
+ def getvertexcount(self, index: int):
1262
+ """
1263
+ EN_getvertexcount
1264
+
1265
+ Parameters
1266
+ ----------
1267
+ index : `int`
1268
+ """
1269
+ if self._use_project is False:
1270
+ return self._process_result(epanet.ENgetvertexcount(index))
1271
+ else:
1272
+ return self._process_result(epanet.EN_getvertexcount(self._ph, index))
1273
+
1274
+ def getvertex(self, index: int, vertex: int):
1275
+ """
1276
+ EN_getvertex
1277
+
1278
+ Parameters
1279
+ ----------
1280
+ index : `int`
1281
+ vertex : `int`
1282
+ """
1283
+ if self._use_project is False:
1284
+ return self._process_result(epanet.ENgetvertex(index, vertex))
1285
+ else:
1286
+ return self._process_result(epanet.EN_getvertex(self._ph, index, vertex))
1287
+
1288
+ def setvertices(self, index: int, x: list[float], y: list[float], count: int):
1289
+ """
1290
+ EN_setvertices
1291
+
1292
+ Parameters
1293
+ ----------
1294
+ index : `int`
1295
+ x : `list[float]`
1296
+ y : `list[float]`
1297
+ count : `int`
1298
+ """
1299
+ if self._use_project is False:
1300
+ return self._process_result(epanet.ENsetvertices(index, x, y, count))
1301
+ else:
1302
+ return self._process_result(epanet.EN_setvertices(self._ph, index, x, y, count))
1303
+
1304
+ def getpumptype(self, link_index: int):
1305
+ """
1306
+ EN_getpumptype
1307
+
1308
+ Parameters
1309
+ ----------
1310
+ link_index : `int`
1311
+ """
1312
+ if self._use_project is False:
1313
+ return self._process_result(epanet.ENgetpumptype(link_index))
1314
+ else:
1315
+ return self._process_result(epanet.EN_getpumptype(self._ph, link_index))
1316
+
1317
+ def getheadcurveindex(self, link_index: int):
1318
+ """
1319
+ EN_getheadcurveindex
1320
+
1321
+ Parameters
1322
+ ----------
1323
+ link_index : `int`
1324
+ """
1325
+ if self._use_project is False:
1326
+ return self._process_result(epanet.ENgetheadcurveindex(link_index))
1327
+ else:
1328
+ return self._process_result(epanet.EN_getheadcurveindex(self._ph, link_index))
1329
+
1330
+ def setheadcurveindex(self, link_index: int, curve_index: int):
1331
+ """
1332
+ EN_setheadcurveindex
1333
+
1334
+ Parameters
1335
+ ----------
1336
+ link_index : `int`
1337
+ curve_index : `int`
1338
+ """
1339
+ if self._use_project is False:
1340
+ return self._process_result(epanet.ENsetheadcurveindex(link_index, curve_index))
1341
+ else:
1342
+ return self._process_result(epanet.EN_setheadcurveindex(self._ph, link_index,
1343
+ curve_index))
1344
+
1345
+ def addpattern(self, id: str):
1346
+ """
1347
+ EN_addpattern
1348
+
1349
+ Parameters
1350
+ ----------
1351
+ id : `str`
1352
+ """
1353
+ if self._use_project is False:
1354
+ return self._process_result(epanet.ENaddpattern(id))
1355
+ else:
1356
+ return self._process_result(epanet.EN_addpattern(self._ph, id))
1357
+
1358
+ def deletepattern(self, index: int):
1359
+ """
1360
+ EN_deletepattern
1361
+
1362
+ Parameters
1363
+ ----------
1364
+ index : `int`
1365
+ """
1366
+ if self._use_project is False:
1367
+ return self._process_result(epanet.ENdeletepattern(index))
1368
+ else:
1369
+ return self._process_result(epanet.EN_deletepattern(self._ph, index))
1370
+
1371
+ def getpatternindex(self, pattern_id: str):
1372
+ """
1373
+ EN_getpatternindex
1374
+
1375
+ Parameters
1376
+ ----------
1377
+ pattern_id : `str`
1378
+ """
1379
+ if self._use_project is False:
1380
+ return self._process_result(epanet.ENgetpatternindex(pattern_id))
1381
+ else:
1382
+ return self._process_result(epanet.EN_getpatternindex(self._ph, pattern_id))
1383
+
1384
+ def getpatternid(self, index: int):
1385
+ """
1386
+ EN_getpatternid
1387
+
1388
+ Parameters
1389
+ ----------
1390
+ index : `int`
1391
+ """
1392
+ if self._use_project is False:
1393
+ return self._process_result(epanet.ENgetpatternid(index))
1394
+ else:
1395
+ return self._process_result(epanet.EN_getpatternid(self._ph, index))
1396
+
1397
+ def setpatternid(self, index: int, id: str):
1398
+ """
1399
+ EN_setpatternid
1400
+
1401
+ Parameters
1402
+ ----------
1403
+ index : `int`
1404
+ id : `str`
1405
+ """
1406
+ if self._use_project is False:
1407
+ return self._process_result(epanet.ENsetpatternid(index, id))
1408
+ else:
1409
+ return self._process_result(epanet.EN_setpatternid(self._ph, index, id))
1410
+
1411
+ def getpatternlen(self, index: int):
1412
+ """
1413
+ EN_getpatternlen
1414
+
1415
+ Parameters
1416
+ ----------
1417
+ index : `int`
1418
+ """
1419
+ if self._use_project is False:
1420
+ return self._process_result(epanet.ENgetpatternlen(index))
1421
+ else:
1422
+ return self._process_result(epanet.EN_getpatternlen(self._ph, index))
1423
+
1424
+ def getpatternvalue(self, index: int, period: int):
1425
+ """
1426
+ EN_getpatternvalue
1427
+
1428
+ Parameters
1429
+ ----------
1430
+ index : `int`
1431
+ period : `int`
1432
+ """
1433
+ if self._use_project is False:
1434
+ return self._process_result(epanet.ENgetpatternvalue(index, period))
1435
+ else:
1436
+ return self._process_result(epanet.EN_getpatternvalue(self._ph, index, period))
1437
+
1438
+ def setpatternvalue(self, index: int, period: int, value: float):
1439
+ """
1440
+ EN_setpatternvalue
1441
+
1442
+ Parameters
1443
+ ----------
1444
+ index : `int`
1445
+ period : `int`
1446
+ value : `float`
1447
+ """
1448
+ if self._use_project is False:
1449
+ return self._process_result(epanet.ENsetpatternvalue(index, period, value))
1450
+ else:
1451
+ return self._process_result(epanet.EN_setpatternvalue(self._ph, index, period, value))
1452
+
1453
+ def getaveragepatternvalue(self, index: int):
1454
+ """
1455
+ EN_getaveragepatternvalue
1456
+
1457
+ Parameters
1458
+ ----------
1459
+ index : `int`
1460
+ """
1461
+ if self._use_project is False:
1462
+ return self._process_result(epanet.ENgetaveragepatternvalue(index))
1463
+ else:
1464
+ return self._process_result(epanet.EN_getaveragepatternvalue(self._ph, index))
1465
+
1466
+ def setpattern(self, index: int, values: list[float], len: int):
1467
+ """
1468
+ EN_setpattern
1469
+
1470
+ Parameters
1471
+ ----------
1472
+ index : `int`
1473
+ values : `list[float]`
1474
+ len : `int`
1475
+ """
1476
+ if self._use_project is False:
1477
+ return self._process_result(epanet.ENsetpattern(index, values, len))
1478
+ else:
1479
+ return self._process_result(epanet.EN_setpattern(self._ph, index, values, len))
1480
+
1481
+ def addcurve(self, id: str):
1482
+ """
1483
+ EN_addcurve
1484
+
1485
+ Parameters
1486
+ ----------
1487
+ id : `str`
1488
+ """
1489
+ if self._use_project is False:
1490
+ return self._process_result(epanet.ENaddcurve(id))
1491
+ else:
1492
+ return self._process_result(epanet.EN_addcurve(self._ph, id))
1493
+
1494
+ def deletecurve(self, index: int):
1495
+ """
1496
+ EN_deletecurve
1497
+
1498
+ Parameters
1499
+ ----------
1500
+ index : `int`
1501
+ """
1502
+ if self._use_project is False:
1503
+ return self._process_result(epanet.ENdeletecurve(index))
1504
+ else:
1505
+ return self._process_result(epanet.EN_deletecurve(self._ph, index))
1506
+
1507
+ def getcurveindex(self, id: str):
1508
+ """
1509
+ EN_getcurveindex
1510
+
1511
+ Parameters
1512
+ ----------
1513
+ id : `str`
1514
+ """
1515
+ if self._use_project is False:
1516
+ return self._process_result(epanet.ENgetcurveindex(id))
1517
+ else:
1518
+ return self._process_result(epanet.EN_getcurveindex(self._ph, id))
1519
+
1520
+ def getcurveid(self, index: int):
1521
+ """
1522
+ EN_getcurveid
1523
+
1524
+ Parameters
1525
+ ----------
1526
+ index : `int`
1527
+ """
1528
+ if self._use_project is False:
1529
+ return self._process_result(epanet.ENgetcurveid(index))
1530
+ else:
1531
+ return self._process_result(epanet.EN_getcurveid(self._ph, index))
1532
+
1533
+ def setcurveid(self, index: int, id: str):
1534
+ """
1535
+ EN_setcurveid
1536
+
1537
+ Parameters
1538
+ ----------
1539
+ index : `int`
1540
+ id : `str`
1541
+ """
1542
+ if self._use_project is False:
1543
+ return self._process_result(epanet.ENsetcurveid(index, id))
1544
+ else:
1545
+ return self._process_result(epanet.EN_setcurveid(self._ph, index, id))
1546
+
1547
+ def getcurvelen(self, index: int):
1548
+ """
1549
+ EN_getcurvelen
1550
+
1551
+ Parameters
1552
+ ----------
1553
+ index : `int`
1554
+ """
1555
+ if self._use_project is False:
1556
+ return self._process_result(epanet.ENgetcurvelen(index))
1557
+ else:
1558
+ return self._process_result(epanet.EN_getcurvelen(self._ph, index))
1559
+
1560
+ def getcurvetype(self, index: int):
1561
+ """
1562
+ EN_getcurvetype
1563
+
1564
+ Parameters
1565
+ ----------
1566
+ index : `int`
1567
+ """
1568
+ if self._use_project is False:
1569
+ return self._process_result(epanet.ENgetcurvetype(index))
1570
+ else:
1571
+ return self._process_result(epanet.EN_getcurvetype(self._ph, index))
1572
+
1573
+ def getcurvevalue(self, curve_index: int, point_index: int):
1574
+ """
1575
+ EN_getcurvevalue
1576
+
1577
+ Parameters
1578
+ ----------
1579
+ curve_index : `int`
1580
+ point_index : `int`
1581
+ """
1582
+ if self._use_project is False:
1583
+ return self._process_result(epanet.ENgetcurvevalue(curve_index, point_index))
1584
+ else:
1585
+ return self._process_result(epanet.EN_getcurvevalue(self._ph, curve_index, point_index))
1586
+
1587
+ def setcurvevalue(self, curve_index: int, point_index: int, x: float, y: float):
1588
+ """
1589
+ EN_setcurvevalue
1590
+
1591
+ Parameters
1592
+ ----------
1593
+ curve_index : `int`
1594
+ point_index : `int`
1595
+ x : `float`
1596
+ y : `float`
1597
+ """
1598
+ if self._use_project is False:
1599
+ return self._process_result(epanet.ENsetcurvevalue(curve_index, point_index, x, y))
1600
+ else:
1601
+ return self._process_result(epanet.EN_setcurvevalue(self._ph, curve_index, point_index,
1602
+ x, y))
1603
+
1604
+ def getcurve(self, index: int):
1605
+ """
1606
+ EN_getcurve
1607
+
1608
+ Parameters
1609
+ ----------
1610
+ index : `int`
1611
+ """
1612
+ if self._use_project is False:
1613
+ return self._process_result(epanet.ENgetcurve(index))
1614
+ else:
1615
+ return self._process_result(epanet.EN_getcurve(self._ph, index))
1616
+
1617
+ def setcurve(self, index: int, x_values: list[float], y_values: list[float], n_points: int):
1618
+ """
1619
+ EN_setcurve
1620
+
1621
+ Parameters
1622
+ ----------
1623
+ index : `int`
1624
+ x_values : `list[float]`
1625
+ y_values : `list[float]`
1626
+ n_points : `int`
1627
+ """
1628
+ if self._use_project is False:
1629
+ return self._process_result(epanet.ENsetcurve(index, x_values, y_values, n_points))
1630
+ else:
1631
+ return self._process_result(epanet.EN_setcurve(self._ph, index, x_values, y_values,
1632
+ n_points))
1633
+
1634
+ def addcontrol(self, type: int, link_index: int, setting: float, node_index: int, level: float):
1635
+ """
1636
+ EN_addcontrol
1637
+
1638
+ Parameters
1639
+ ----------
1640
+ type : `int`
1641
+ link_index : `int`
1642
+ setting : `float`
1643
+ node_index . `int`
1644
+ level : `float`
1645
+ """
1646
+ if self._use_project is False:
1647
+ return self._process_result(epanet.ENaddcontrol(type, link_index, setting, node_index,
1648
+ level))
1649
+ else:
1650
+ return self._process_result(epanet.EN_addcontrol(self._ph, type, link_index, setting,
1651
+ node_index, level))
1652
+
1653
+ def deletecontrol(self, index: int):
1654
+ """
1655
+ EN_deletecontrol
1656
+
1657
+ Parameters
1658
+ ----------
1659
+ index : `int`
1660
+ """
1661
+ if self._use_project is False:
1662
+ return self._process_result(epanet.ENdeletecontrol(index))
1663
+ else:
1664
+ return self._process_result(epanet.EN_deletecontrol(self._ph, index))
1665
+
1666
+ def getcontrol(self, index: int):
1667
+ """
1668
+ EN_getcontrol
1669
+
1670
+ Parameters
1671
+ ----------
1672
+ index : `int`
1673
+ """
1674
+ if self._use_project is False:
1675
+ return self._process_result(epanet.ENgetcontrol(index))
1676
+ else:
1677
+ return self._process_result(epanet.EN_getcontrol(self._ph, index))
1678
+
1679
+ def setcontrol(self, index: int, type: int, link_index: int, setting: float, node_index: int,
1680
+ level: float):
1681
+ """
1682
+ EN_setcontrol
1683
+
1684
+ Parameters
1685
+ ----------
1686
+ index : `int`
1687
+ type : `int`
1688
+ link_index : `int`
1689
+ setting : `float`
1690
+ node_index : `int`
1691
+ level : `float`
1692
+ """
1693
+ if self._use_project is False:
1694
+ return self._process_result(epanet.ENsetcontrol(index, type, link_index, setting,
1695
+ node_index, level))
1696
+ else:
1697
+ return self._process_result(epanet.EN_setcontrol(self._ph, index, type, link_index,
1698
+ setting, node_index, level))
1699
+
1700
+ def addrule(self, rule: str):
1701
+ """
1702
+ EN_addrule
1703
+
1704
+ Parameters
1705
+ ----------
1706
+ rule : `str`
1707
+ """
1708
+ if self._use_project is False:
1709
+ return self._process_result(epanet.ENaddrule(rule))
1710
+ else:
1711
+ return self._process_result(epanet.EN_addrule(self._ph, rule))
1712
+
1713
+ def deleterule(self, index: int):
1714
+ """
1715
+ EN_deleterule
1716
+
1717
+ Parameters
1718
+ ----------
1719
+ index : `int`
1720
+ """
1721
+ if self._use_project is False:
1722
+ return self._process_result(epanet.ENdeleterule(index))
1723
+ else:
1724
+ return self._process_result(epanet.EN_deleterule(self.ph, index))
1725
+
1726
+ def getrule(self, index: int):
1727
+ """
1728
+ EN_getrule
1729
+
1730
+ Parameters
1731
+ ----------
1732
+ index : `int`
1733
+ """
1734
+ if self._use_project is False:
1735
+ return self._process_result(epanet.ENgetrule(index))
1736
+ else:
1737
+ return self._process_result(epanet.EN_getrule(self._ph, index))
1738
+
1739
+ def getruleid(self, index: int):
1740
+ """
1741
+ EN_getruleID
1742
+
1743
+ Parameters
1744
+ ----------
1745
+ index : `int`
1746
+ """
1747
+ if self._use_project is False:
1748
+ return self._process_result(epanet.ENgetruleID(index))
1749
+ else:
1750
+ return self._process_result(epanet.EN_getruleID(self._ph, index))
1751
+
1752
+ def getpremise(self, rule_index: int, premise_index: int):
1753
+ """
1754
+ EN_getpremise
1755
+
1756
+ Parameters
1757
+ ----------
1758
+ rule_index : `int`
1759
+ premise_index : `int`
1760
+ """
1761
+ if self._use_project is False:
1762
+ return self._process_result(epanet.ENgetpremise(rule_index, premise_index))
1763
+ else:
1764
+ return self._process_result(epanet.EN_getpremise(self._ph, rule_index, premise_index))
1765
+
1766
+ def setpremise(self, rule_index: int, premise_index: int, logop: int, object: int,
1767
+ obj_index: int, variable: int, relop: int, status: int, value: float):
1768
+ """
1769
+ EN_setpremise
1770
+
1771
+ Parameters
1772
+ ----------
1773
+ rule_index : `int`
1774
+ premise_index : `int`
1775
+ logop : `int`
1776
+ object : `int`
1777
+ obj_index : `int`
1778
+ variable : `int`
1779
+ relop : `int`
1780
+ status : `int`
1781
+ value : `float`
1782
+ """
1783
+ if self._use_project is False:
1784
+ return self._process_result(epanet.ENsetpremise(rule_index, premise_index, logop,
1785
+ object, obj_index, variable, relop,
1786
+ status, value))
1787
+ else:
1788
+ return self._process_result(epanet.EN_setpremise(self._ph, rule_index, premise_index,
1789
+ logop, object, obj_index, variable,
1790
+ relop, status, value))
1791
+
1792
+ def setpremiseindex(self, rule_index: int, premise_index: int, obj_index: int):
1793
+ """
1794
+ EN_setpremiseindex
1795
+
1796
+ Parameters
1797
+ ----------
1798
+ rule_index : `int`
1799
+ premise_index : `int`
1800
+ obj_index : `int`
1801
+ """
1802
+ if self._use_project is False:
1803
+ return self._process_result(epanet.ENsetpremiseindex(rule_index, premise_index,
1804
+ obj_index))
1805
+ else:
1806
+ return self._process_result(epanet.EN_setpremiseindex(self._ph, rule_index,
1807
+ premise_index, obj_index))
1808
+
1809
+ def setpremisestatus(self, rule_index: int, premise_index: int, status: int):
1810
+ """
1811
+ EN_setpremisestatus
1812
+
1813
+ Parameters
1814
+ ----------
1815
+ rule_index : `int`
1816
+ premise_index : `int`
1817
+ status : `int`
1818
+ """
1819
+ if self._use_project is False:
1820
+ return self._process_result(epanet.ENsetpremisestatus(rule_index, premise_index,
1821
+ status))
1822
+ else:
1823
+ return self._process_result(epanet.EN_setpremisestatus(self._ph, rule_index,
1824
+ premise_index, status))
1825
+
1826
+ def setpremisevalue(self, rule_index: int, premise_index: int, value: float):
1827
+ """
1828
+ EN_setpremisevalue
1829
+
1830
+ Parameters
1831
+ ----------
1832
+ rule_index : `int`
1833
+ premise_index : `int`
1834
+ value : `float`
1835
+ """
1836
+ if self._use_project is False:
1837
+ return self._process_result(epanet.ENsetpremisevalue(rule_index, premise_index, value))
1838
+ else:
1839
+ return self._process_result(epanet.EN_setpremisevalue(self._ph, rule_index, premise_index, value))
1840
+
1841
+ def getthenaction(self, rule_index: int, action_index: int):
1842
+ """
1843
+ EN_getthenaction
1844
+
1845
+ Parameters
1846
+ ----------
1847
+ rule_index : `int`
1848
+ action_index : `int`
1849
+ """
1850
+ if self._use_project is False:
1851
+ return self._process_result(epanet.ENgetthenaction(rule_index, action_index))
1852
+ else:
1853
+ return self._process_result(epanet.EN_getthenaction(self._ph, rule_index, action_index))
1854
+
1855
+ def setthenaction(self, rule_index: int, action_index: int, link_index: int, status: int,
1856
+ setting: float):
1857
+ """
1858
+ EN_setthenaction
1859
+
1860
+ Parameters
1861
+ ----------
1862
+ rule_index : `int`
1863
+ action_index : `int`
1864
+ link_index : `int`
1865
+ status : `int`
1866
+ setting : `float`
1867
+ """
1868
+ if self._use_project is False:
1869
+ return self._process_result(epanet.ENsetthenaction(rule_index, action_index, link_index,
1870
+ status, setting))
1871
+ else:
1872
+ return self._process_result(epanet.EN_setthenaction(self._ph, rule_index, action_index,
1873
+ link_index, status, setting))
1874
+
1875
+ def getelseaction(self, rule_index: int, action_index: int):
1876
+ """
1877
+ EN_getelseaction
1878
+
1879
+ Parameters
1880
+ ----------
1881
+ rule_index : `int`
1882
+ action_index : `int`
1883
+ """
1884
+ if self._use_project is False:
1885
+ return self._process_result(epanet.ENgetelseaction(rule_index, action_index))
1886
+ else:
1887
+ return self._process_result(epanet.EN_getelseaction(self._ph, rule_index, action_index))
1888
+
1889
+ def setelseaction(self, rule_index: int, action_index: int, link_index: int, status: int,
1890
+ setting: float):
1891
+ """
1892
+ EN_setelseaction
1893
+
1894
+ Parameters
1895
+ ----------
1896
+ rule_index : `int`
1897
+ action_index : `int`
1898
+ link_index : `int`
1899
+ status : `int`
1900
+ setting : `float`
1901
+ """
1902
+ if self._use_project is False:
1903
+ return self._process_result(epanet.ENsetelseaction(rule_index, action_index, link_index,
1904
+ status, setting))
1905
+ else:
1906
+ return self._process_result(epanet.EN_setelseaction(self._ph, rule_index, action_index,
1907
+ link_index, status, setting))
1908
+
1909
+ def setrulepriority(self, index: int, priority: float):
1910
+ """
1911
+ EN_setrulepriority
1912
+
1913
+ Parameters
1914
+ ----------
1915
+ index : `int`
1916
+ priority : `float`
1917
+ """
1918
+ if self._use_project is False:
1919
+ return self._process_result(epanet.ENsetrulepriority(index, priority))
1920
+ else:
1921
+ return self._process_result(epanet.EN_setrulepriority(self._ph, index, priority))
1922
+
1923
+ def gettag(self, obj_type: int, obj_idx: int):
1924
+ """
1925
+ EN_gettag
1926
+
1927
+ Parameters
1928
+ ----------
1929
+ obj_type : `int`
1930
+ obj_idx : `int`
1931
+ """
1932
+ if self._use_project is False:
1933
+ return self._process_result(epanet.ENgettag(obj_type, obj_idx))
1934
+ else:
1935
+ return self._process_result(epanet.EN_gettag(self._ph, obj_type, obj_idx))
1936
+
1937
+ def settag(self, obj_type: int, obj_idx: int, tag: str):
1938
+ """
1939
+ EN_settag
1940
+
1941
+ Parameters
1942
+ ----------
1943
+ obj_type : `int`
1944
+ obj_idx : `int`
1945
+ tag : `str`
1946
+ """
1947
+ if self._use_project is False:
1948
+ return self._process_result(epanet.ENsettag(obj_type, obj_idx, tag))
1949
+ else:
1950
+ return self._process_result(epanet.EN_settag(self._ph, obj_type, obj_idx, tag))
1951
+
1952
+ def timetonextevent(self):
1953
+ """
1954
+ EN_timetonextevent
1955
+ """
1956
+ if self._use_project is False:
1957
+ return self._process_result(epanet.ENtimetonextevent())
1958
+ else:
1959
+ return self._process_result(epanet.EN_timetonextevent(self._ph))
1960
+
1961
+ def getnodevalues(self, property: int):
1962
+ """
1963
+ EN_getnodevalues
1964
+
1965
+ Parameters
1966
+ ----------
1967
+ property : `int`
1968
+ """
1969
+ if self._use_project is False:
1970
+ return self._process_result(epanet.ENgetnodevalues(property))
1971
+ else:
1972
+ return self._process_result(epanet.EN_getnodevalues(self._ph, property))
1973
+
1974
+ def getlinkvalues(self, property: int):
1975
+ """
1976
+ EN_getlinkvalues
1977
+
1978
+ Parameters
1979
+ ----------
1980
+ property : `int`
1981
+ """
1982
+ if self._use_project is False:
1983
+ return self._process_result(epanet.ENgetlinkvalues(property))
1984
+ else:
1985
+ return self._process_result(epanet.EN_getlinkvalues(self._ph, property))
1986
+
1987
+ def setvertex(self, link_idx: int, vertex_idx: int, x: float, y: float):
1988
+ """
1989
+ EN_setvertex
1990
+
1991
+ Parameters
1992
+ ----------
1993
+ link_idx : `int`
1994
+ vertex_idx : `int`
1995
+ x : `float`
1996
+ y : `float`
1997
+ """
1998
+ if self._use_project is False:
1999
+ return self._process_result(epanet.ENsetvertex(link_idx, vertex_idx, x, y))
2000
+ else:
2001
+ return self._process_result(epanet.EN_setvertex(self._ph, link_idx, vertex_idx, x, y))
2002
+
2003
+ def loadpatternfile(self, filename: str, id: str):
2004
+ """
2005
+ EN_loadpatternfile
2006
+
2007
+ Parameters
2008
+ ----------
2009
+ filename : `str`
2010
+ id : `str`
2011
+ """
2012
+ if self._use_project is False:
2013
+ return self._process_result(epanet.ENloadpatternfile(filename, id))
2014
+ else:
2015
+ return self._process_result(epanet.EN_loadpatternfile(self._ph, filename, id))
2016
+
2017
+ def setcurvetype(self, curve_idx: int, curve_type: int):
2018
+ """
2019
+ EN_setcurvetype
2020
+
2021
+ Parameters
2022
+ ----------
2023
+ curve_idx : `int`
2024
+ curve_type : `int`
2025
+ """
2026
+ if self._use_project is False:
2027
+ return self._process_result(epanet.ENsetcurvetype(curve_idx, curve_type))
2028
+ else:
2029
+ return self._process_result(epanet.EN_setcurvetype(self._ph, curve_idx, curve_type))
2030
+
2031
+ def getcontrolenabled(self, control_idx: int):
2032
+ """
2033
+ EN_getcontrolenabled
2034
+
2035
+ Parameters
2036
+ ----------
2037
+ control_idx : `int`
2038
+ """
2039
+ if self._use_project is False:
2040
+ return self._process_result(epanet.ENgetcontrolenabled(control_idx))
2041
+ else:
2042
+ return self._process_result(epanet.EN_getcontrolenabled(self._ph, control_idx))
2043
+
2044
+ def setcontrolenabled(self, control_idx: int, enabled: int):
2045
+ """
2046
+ EN_setcontrolenabled
2047
+
2048
+ Parameters
2049
+ ----------
2050
+ control_idx : `int`
2051
+ enabled : `int`
2052
+ """
2053
+ if self._use_project is False:
2054
+ return self._process_result(epanet.ENsetcontrolenabled(control_idx, enabled))
2055
+ else:
2056
+ return self._process_result(epanet.EN_setcontrolenabled(self._ph, control_idx, enabled))
2057
+
2058
+ def getruleenabled(self, rule_idx: int):
2059
+ """
2060
+ EN_getruleenabled
2061
+
2062
+ Parameters
2063
+ ----------
2064
+ rule_idx : `int`
2065
+ """
2066
+ if self._use_project is False:
2067
+ return self._process_result(epanet.ENgetruleenabled(rule_idx))
2068
+ else:
2069
+ return self._process_result(epanet.EN_getruleenabled(self._ph, rule_idx))
2070
+
2071
+ def setruleenabled(self, rule_idx: int, enabled: int):
2072
+ """
2073
+ EN_setruleenabled
2074
+
2075
+ Parameters
2076
+ ----------
2077
+ rule_idx : `int`
2078
+ enabled : `int`
2079
+ """
2080
+ if self._use_project is False:
2081
+ return self._process_result(epanet.ENsetruleenabled(rule_idx, enabled))
2082
+ else:
2083
+ return self._process_result(epanet.EN_setruleenabled(self._ph, rule_idx, enabled))
2084
+
2085
+ def MSXENopen(self, inp_file: str, rpt_file: str, out_file: str):
2086
+ """
2087
+ MSXENopen
2088
+
2089
+ Parameters
2090
+ ----------
2091
+ inp_file : `str`
2092
+ rpt_file : `str`
2093
+ out_file : `str`
2094
+ """
2095
+ return self._process_result(epanet.MSXENopen(inp_file, rpt_file, out_file), msx_call=True)
2096
+
2097
+ def MSXopen(self, fname: str):
2098
+ """
2099
+ MSXopen
2100
+
2101
+ Parameters
2102
+ ----------
2103
+ fname : `str`
2104
+ """
2105
+ return self._process_result(epanet.MSXopen(fname), msx_call=True)
2106
+
2107
+ def MSXsolveH(self):
2108
+ """
2109
+ MSXsolveH
2110
+ """
2111
+ return self._process_result(epanet.MSXsolveH(), msx_call=True)
2112
+
2113
+ def MSXusehydfile(self, fname: str):
2114
+ """
2115
+ MSXusehydfile
2116
+
2117
+ Parameters
2118
+ ----------
2119
+ fname : `str`
2120
+ """
2121
+ return self._process_result(epanet.MSXusehydfile(fname), msx_call=True)
2122
+
2123
+ def MSXsolveQ(self):
2124
+ """
2125
+ MSXsolveQ
2126
+ """
2127
+ return self._process_result(epanet.MSXsolveQ(), msx_call=True)
2128
+
2129
+ def MSXinit(self, save_flag: int):
2130
+ """
2131
+ MSXinit
2132
+
2133
+ Parameters
2134
+ ----------
2135
+ save_flag : `int`
2136
+ """
2137
+ return self._process_result(epanet.MSXinit(save_flag), msx_call=True)
2138
+
2139
+ def MSXstep(self):
2140
+ """
2141
+ MSXstep
2142
+ """
2143
+ return self._process_result(epanet.MSXstep(), msx_call=True)
2144
+
2145
+ def MSXsaveoutfile(self, fname: str):
2146
+ """
2147
+ MSXsaveoutfile
2148
+
2149
+ Parameters
2150
+ ----------
2151
+ fname : `str`
2152
+ """
2153
+ return self._process_result(epanet.MSXsaveoutfile(fname), msx_call=True)
2154
+
2155
+ def MSXsavemsxfile(self, fname: str):
2156
+ """
2157
+ MSXsavemsxfile
2158
+
2159
+ Parameters
2160
+ ----------
2161
+ fname : `str`
2162
+ """
2163
+ return self._process_result(epanet.MSXsavemsxfile(fname), msx_call=True)
2164
+
2165
+ def MSXreport(self):
2166
+ """
2167
+ MSXreport
2168
+ """
2169
+ return self._process_result(epanet.MSXreport(), msx_call=True)
2170
+
2171
+ def MSXclose(self):
2172
+ """
2173
+ MSXclose
2174
+ """
2175
+ return self._process_result(epanet.MSXclose(), msx_call=True)
2176
+
2177
+ def MSXENclose(self):
2178
+ """
2179
+ MSXENclose
2180
+ """
2181
+ return self._process_result(epanet.MSXENclose(), msx_call=True)
2182
+
2183
+ def MSXgetindex(self, item_type: int, id: str):
2184
+ """
2185
+ MSXgetindex
2186
+
2187
+ Parameters
2188
+ ----------
2189
+ item_type : `int`
2190
+ id : `str`
2191
+ """
2192
+ return self._process_result(epanet.MSXgetindex(item_type, id), msx_call=True)
2193
+
2194
+ def MSXgetIDlen(self, item_type: int, index: int):
2195
+ """
2196
+ MSXgetIDlen
2197
+
2198
+ Parameters
2199
+ ----------
2200
+ item_type : `int`
2201
+ index : `int`
2202
+ """
2203
+ return self._process_result(epanet.MSXgetIDlen(item_type, index), msx_call=True)
2204
+
2205
+ def MSXgetID(self, item_type: int, index: int):
2206
+ """
2207
+ MSXgetID
2208
+
2209
+ Parameters
2210
+ ----------
2211
+ item_type : `int`
2212
+ index : `int`
2213
+ """
2214
+ return self._process_result(epanet.MSXgetID(item_type, index), msx_call=True)
2215
+
2216
+ def MSXgetcount(self, item_type: int):
2217
+ """
2218
+ MSXgetcount
2219
+
2220
+ Parameters
2221
+ ----------
2222
+ item_type : `int`
2223
+ """
2224
+ return self._process_result(epanet.MSXgetcount(item_type), msx_call=True)
2225
+
2226
+ def MSXgetspecies(self, index: int):
2227
+ """
2228
+ MSXgetspecies
2229
+
2230
+ Parameters
2231
+ ----------
2232
+ index : `int`
2233
+ """
2234
+ return self._process_result(epanet.MSXgetspecies(index), msx_call=True)
2235
+
2236
+ def MSXgetconstant(self, index: int):
2237
+ """
2238
+ MSXgetconstant
2239
+
2240
+ Parameters
2241
+ ----------
2242
+ index : `int`
2243
+ """
2244
+ return self._process_result(epanet.MSXgetconstant(index), msx_call=True)
2245
+
2246
+ def MSXgetparameter(self, item_type: int, index: int, param: int):
2247
+ """
2248
+ MSXgetparameter
2249
+
2250
+ Parameters
2251
+ ----------
2252
+ item_type : `int`
2253
+ index : `int`
2254
+ param : `int`
2255
+ """
2256
+ return self._process_result(epanet.MSXgetparameter(item_type, index, param), msx_call=True)
2257
+
2258
+ def MSXgetsource(self, node: int, species: int):
2259
+ """
2260
+ MSXgetsource
2261
+
2262
+ Parameters
2263
+ ----------
2264
+ node : `int`
2265
+ species : `int`
2266
+ """
2267
+ return self._process_result(epanet.MSXgetsource(node, species), msx_call=True)
2268
+
2269
+ def MSXgetpatternlen(self, pat: int):
2270
+ """
2271
+ MSXgetpatternlen
2272
+
2273
+ Parameters
2274
+ ----------
2275
+ pat : `int`
2276
+ """
2277
+ return self._process_result(epanet.MSXgetpatternlen(pat), msx_call=True)
2278
+
2279
+ def MSXgetpatternvalue(self, pat: int, period: int):
2280
+ """
2281
+ MSXgetpatternvalue
2282
+
2283
+ Parameters
2284
+ ----------
2285
+ pat : `int`
2286
+ period : `int`
2287
+ """
2288
+ return self._process_result(epanet.MSXgetpatternvalue(pat, period), msx_call=True)
2289
+
2290
+ def MSXgetinitqual(self, item_type: int, index: int, species: int):
2291
+ """
2292
+ MSXgetinitqual
2293
+
2294
+ Parameters
2295
+ ----------
2296
+ item_type : `int`
2297
+ index : `int`
2298
+ species : `int`
2299
+ """
2300
+ return self._process_result(epanet.MSXgetinitqual(item_type, index, species), msx_call=True)
2301
+
2302
+ def MSXgetqual(self, item_type: int, index: int, species: int):
2303
+ """
2304
+ MSXgetqual
2305
+
2306
+ Parameters
2307
+ ----------
2308
+ item_type : `int`
2309
+ index : `int`
2310
+ species : `int`
2311
+ """
2312
+ return self._process_result(epanet.MSXgetqual(item_type, index, species), msx_call=True)
2313
+
2314
+ def MSXgeterror(self, err_code: int):
2315
+ """
2316
+ MSXgeterror
2317
+
2318
+ Parameters
2319
+ ----------
2320
+ err_code : `int`
2321
+ """
2322
+ err, msg = epanet.MSXgeterror(err_code)
2323
+ if err != 0:
2324
+ raise RuntimeError("Failed to get error message")
2325
+ else:
2326
+ return msg
2327
+
2328
+ def MSXsetconstant(self, index: int, value: float):
2329
+ """
2330
+ MSXsetconstant
2331
+
2332
+ Parameters
2333
+ ----------
2334
+ index : `int`
2335
+ value : `float`
2336
+ """
2337
+ return self._process_result(epanet.MSXsetconstant(index, value))
2338
+
2339
+ def MSXsetparameter(self, item_type: int, index: int, param: int, value: float):
2340
+ """
2341
+ MSXsetparameter
2342
+
2343
+ Parameters
2344
+ ----------
2345
+ item_type : `int`
2346
+ index : `int`
2347
+ param : `int`
2348
+ value : `float`
2349
+ """
2350
+ return self._process_result(epanet.MSXsetparameter(item_type, index, param, value),
2351
+ msx_call=True)
2352
+
2353
+ def MSXsetinitqual(self, item_type: int, index: int, species: int, value: float):
2354
+ """
2355
+ MSXsetinitqual
2356
+
2357
+ Parameters
2358
+ ----------
2359
+ item_type : `int`
2360
+ index : `int`
2361
+ species : `int`
2362
+ value : `float`
2363
+ """
2364
+ return self._process_result(epanet.MSXsetinitqual(item_type, index, species, value),
2365
+ msx_call=True)
2366
+
2367
+ def MSXsetsource(self, node: int, species: int, item_type: int, level: float, pat: int):
2368
+ """
2369
+ MSXsetsource
2370
+
2371
+ Parameters
2372
+ ----------
2373
+ node : `int`
2374
+ species : `int`
2375
+ item_type : `int`
2376
+ level : `float`
2377
+ pat : `int`
2378
+ """
2379
+ return self._process_result(epanet.MSXsetsource(node, species, item_type, level, pat),
2380
+ msx_call=True)
2381
+
2382
+ def MSXsetpatternvalue(self, pat: int, period: int, value: float):
2383
+ """
2384
+ MSXsetpatternvalue
2385
+
2386
+ Parameters
2387
+ ----------
2388
+ pat : `int`
2389
+ period : `int`
2390
+ value : `float`
2391
+ """
2392
+ return self._process_result(epanet.MSXsetpatternvalue(pat, period, value), msx_call=True)
2393
+
2394
+ def MSXsetpattern(self, pat: int, mult: list[float], len: int):
2395
+ """
2396
+ MSXsetpattern
2397
+
2398
+ Parameters
2399
+ ----------
2400
+ pat : `int`
2401
+ mult : `list[float]`
2402
+ len : `int`
2403
+ """
2404
+ return self._process_result(epanet.MSXsetpattern(pat, mult, len), msx_call=True)
2405
+
2406
+ def MSXaddpattern(self, id: str):
2407
+ """
2408
+ MSXaddpattern
2409
+
2410
+ Parameters
2411
+ ----------
2412
+ id : `str`
2413
+ """
2414
+ return self._process_result(epanet.MSXaddpattern(id), msx_call=True)