epanet-plus 0.0.1__cp310-cp310-win_amd64.whl → 0.1.0__cp310-cp310-win_amd64.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.

Binary file
epanet_plus/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
@@ -237,6 +237,21 @@ class EpanetAPI():
237
237
  else:
238
238
  return self._process_result(epanet.EN_open(self._ph, inpFile, rptFile, outFile))
239
239
 
240
+ def openX(self, inpFile: str, rptFile: str, outFile: str):
241
+ """
242
+ EN_openX
243
+
244
+ Parameters
245
+ ----------
246
+ inpFile : `str`
247
+ rptFile : `str`
248
+ outFile : `str`
249
+ """
250
+ if self._use_project is False:
251
+ return self._process_result(epanet.ENopenX(inpFile, rptFile, outFile))
252
+ else:
253
+ return self._process_result(epanet.EN_openX(self._ph, inpFile, rptFile, outFile))
254
+
240
255
  def gettitle(self):
241
256
  """
242
257
  EN_gettitle
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: epanet-plus
3
- Version: 0.0.1
3
+ Version: 0.1.0
4
4
  Summary: Python interface for EPANET-PLUS (incl. EPANET and EPANET-MSX)
5
5
  Author-email: André Artelt <aartelt@techfak.uni-bielefeld.de>
6
6
  License-Expression: MIT
@@ -17,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
20
21
  Requires-Python: >=3.9
21
22
  Description-Content-Type: text/markdown
22
23
  License-File: LICENSE
@@ -25,7 +26,7 @@ Dynamic: license-file
25
26
  [![pypi](https://img.shields.io/pypi/v/epanet-plus.svg)](https://pypi.org/project/epanet-plus/)
26
27
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
27
28
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/epanet-plus)
28
- [![build](https://github.com/WaterFutures/EPANET-PLUS/actions/workflows/build.yml/badge.svg)](https://github.com/WaterFutures/EPANET-PLUS/actions/workflows/build.yml)
29
+ [![Build + Test](https://github.com/WaterFutures/EPANET-PLUS/actions/workflows/build_test.yml/badge.svg)](https://github.com/WaterFutures/EPANET-PLUS/actions/workflows/build_test.yml)
29
30
  [![Documentation Status](https://readthedocs.org/projects/epanet-plus/badge/?version=stable)](https://epanet-plus.readthedocs.io/en/stable/?badge=stable)
30
31
  [![Downloads](https://static.pepy.tech/badge/epanet-plus)](https://pepy.tech/project/epanet-plus)
31
32
  [![Downloads](https://static.pepy.tech/badge/epanet-plus/month)](https://pepy.tech/project/epanet-plus)
@@ -48,7 +49,7 @@ Unique features of EPANET-PLUS that make it superior to other Python interfaces
48
49
 
49
50
  ## Installation
50
51
 
51
- Note that EPANET-PLUS supports Python 3.9 - 3.13.
52
+ Note that EPANET-PLUS supports Python 3.9 - 3.14.
52
53
  The Python package contains the the C library as a C extension and is
53
54
  already pre-build for all major platforms.
54
55
 
@@ -1,4 +1,4 @@
1
- epanet.cp310-win_amd64.pyd,sha256=KukBZk4nE2LlrjhVdfOfUdYnu3r-NBBi6WIjSC7MWus,494080
1
+ epanet.cp310-win_amd64.pyd,sha256=8YD3meZS_Fu1Tt18U-Wzb0zphDhOcJFVM7dI3CcJ82E,494080
2
2
  docs/conf.py,sha256=tsJLrKG1OZnnK8B0mzDX3fbG4CYe_rIRZvTH3JkvN7Y,2199
3
3
  epanet-msx-src/dispersion.h,sha256=rarrxJdtslA_yuZXei5xFN9j7nqWn5L9F4aLMPsCIh4,967
4
4
  epanet-msx-src/hash.c,sha256=IVzS2dWv8-GVJsQrWOP3ypcOizyfA16CnLpVhQ56ePQ,2955
@@ -78,19 +78,20 @@ epanet-src/util/errormanager.c,sha256=ooXxWIppEVavff6TKKto8Q6NCgNvwyh9foT1j9ingf
78
78
  epanet-src/util/errormanager.h,sha256=U31MIi-DL7xa-IhXJoAGBFRsoUl7YDtzj8OQDHpJDCs,1021
79
79
  epanet-src/util/filemanager.c,sha256=fs8H97AN8ZFyJV2sbJYiBW2i3e--MELZfMOU52oZqUs,4878
80
80
  epanet-src/util/filemanager.h,sha256=Ktdb0aGoxgiAmYuqrc4Mc3vQGQ3CYDfMBzc0U-3qGjY,1925
81
- epanet_plus/VERSION,sha256=axN4nkPlSFY0Uz3hamXYup00xMl1hYi2ZYBUNfgOsRU,5
81
+ epanet_plus/VERSION,sha256=atlhOkVXmNbZLl9fOQq0uqcFlryGntaxf1zdKyhjXwY,5
82
82
  epanet_plus/__init__.py,sha256=6LIHTbuelmJeIKzQomyObM4lrlZJEKhDgrEFGd-gCj4,223
83
83
  epanet_plus/epanet_plus.c,sha256=KnuP2GwTK56vmNN_742si856WDEa-PyuCifryzSCQB4,3301
84
84
  epanet_plus/epanet_toolkit.py,sha256=71lhwvBubd8USwDTHjHVbAy4gKkHhpLikpL05sFaJ_w,83667
85
- epanet_plus/epanet_wrapper.py,sha256=U7Xa9KKbazodWV768S0g0_7zQ5CF44qEfD7wrC0FHrw,75540
85
+ epanet_plus/epanet_wrapper.py,sha256=k7S_6JmFLLOkb1BlRhc-ajPjFktQPVCz6l1SXXKPhIs,76001
86
86
  epanet_plus/include/epanet_plus.h,sha256=lSCjHsQRSl2fS2lLcC_lj_6N4g9KanUBBuWqmPvrThs,348
87
- epanet_plus-0.0.1.dist-info/licenses/LICENSE,sha256=SkZQpJ9ap2kNSGgeKesdFgWc73oFIgLP1UmSStMM8ms,1095
87
+ epanet_plus-0.1.0.dist-info/licenses/LICENSE,sha256=SkZQpJ9ap2kNSGgeKesdFgWc73oFIgLP1UmSStMM8ms,1095
88
88
  examples/basic_usage.py,sha256=yHAg16dAjGa-ktyVjT5MeL8Rh5dYpWsUrh81N2zywtw,1122
89
+ examples/epanet_msx.py,sha256=D5wXc5oe3uEJi6bh3lYIfxDQZf60LWcpN741p90bXWc,1255
89
90
  python-extension/ext.c,sha256=HRAB553RjcNlgoBYnuNbt5IYFZymmUGZ65PSqYfe-dw,38527
90
- python-extension/pyepanet.c,sha256=iLpv-rBz5i_KuUG4Hwc9qRk7mfGVD8001kZ5KeHqFA8,57772
91
- python-extension/pyepanet.h,sha256=l9PdEJrMeyfrxfBQqLOiPn6AZ4etHaC7JWW-HATszlE,9236
92
- python-extension/pyepanet2.c,sha256=M2DZazB_tM0SmlkqqSnYHHaNJhoBOToC8qXqz-o0K84,46389
93
- python-extension/pyepanet2.h,sha256=-JdfrKuEsanNnQQQrP_s46W0_OvBXPOgoy4I43sjyqA,9204
91
+ python-extension/pyepanet.c,sha256=CuuNcWv7YIy7X-LsaVYdByEQ31DLcK4OFvzlIAOQKlo,58200
92
+ python-extension/pyepanet.h,sha256=3G46vHe9ZUldRlAVGML921jIa_nSzorgULfCrjpEjGY,9296
93
+ python-extension/pyepanet2.c,sha256=a5iifpTxNjesJE2h4DXCegLncJ7jpDGd3TOGhrH_rw4,46709
94
+ python-extension/pyepanet2.h,sha256=HkVvXUfgY7RmizZoU8QatE9N1qJfVmmETE4e1vlGpa4,9263
94
95
  python-extension/pyepanet_plus.c,sha256=yq0MGLq6EyTDYTSM9jM-h1rrYWvqo1tQjg1sAwfqtco,975
95
96
  python-extension/pyepanet_plus.h,sha256=CN4Dyfdi4B-EkYuzsoPbxOq7hT2DSHbnxMSD-2085p0,160
96
97
  python-extension/pyepanetmsx.c,sha256=NQOCcP8roqBPwFZUIKZbnGf0dVfin_LzsS6Nzu2Oreg,9670
@@ -99,7 +100,7 @@ tests/test_epanet.py,sha256=0umog3hTNUFyN2vrlS6U423w422WfZvLAq3N1CinPWU,479
99
100
  tests/test_epanetmsx.py,sha256=2zp2pb_5slxlfv2O1ti7igdpb10hQ9q4q0Y0jenzFlk,1032
100
101
  tests/test_epyt.py,sha256=kUuF8p4nUNr-2MGVzSGp3eHamF--UsnhNPNsvgRjxsM,3647
101
102
  tests/test_load_inp_from_buffer.py,sha256=7MLhiEk8qGKmUR4mJid8VEO5ZF8djfzmtL_hVAVezzA,561
102
- epanet_plus-0.0.1.dist-info/METADATA,sha256=StwQ9sWl6yr44C-28khd6PcHJ290s73pMxkgUj4Nq0g,5359
103
- epanet_plus-0.0.1.dist-info/WHEEL,sha256=KUuBC6lxAbHCKilKua8R9W_TM71_-9Sg5uEP3uDWcoU,101
104
- epanet_plus-0.0.1.dist-info/top_level.txt,sha256=igwRsFnggi2fSCG7AHkP3LfOLlgsT2aUu0oa8DpvHDo,103
105
- epanet_plus-0.0.1.dist-info/RECORD,,
103
+ epanet_plus-0.1.0.dist-info/METADATA,sha256=XeQADkHrmi-qW0blAInOnaWAMZiLduWNusqKSqQK5Vw,5428
104
+ epanet_plus-0.1.0.dist-info/WHEEL,sha256=KUuBC6lxAbHCKilKua8R9W_TM71_-9Sg5uEP3uDWcoU,101
105
+ epanet_plus-0.1.0.dist-info/top_level.txt,sha256=igwRsFnggi2fSCG7AHkP3LfOLlgsT2aUu0oa8DpvHDo,103
106
+ epanet_plus-0.1.0.dist-info/RECORD,,
examples/epanet_msx.py ADDED
@@ -0,0 +1,35 @@
1
+ """
2
+ Basic example demonstrating how to run an EPANET-MSX simulation.
3
+ """
4
+ from epanet_plus import EPyT, EpanetConstants
5
+
6
+
7
+ if __name__ == "__main__":
8
+ # Load an .inp and .msx file -- recall that for using EPANET-MSX,
9
+ # we have to fall back to EPANET < 2.2 (i.e., use_project=False)
10
+ epanet_api = EPyT("net2-cl2.inp", use_project=False)
11
+ epanet_api.load_msx_file("net2-cl2.msx")
12
+
13
+ print(f"Simulation duration: {epanet_api.gettimeparam(EpanetConstants.EN_DURATION)}")
14
+
15
+ # Solve hydraulics by calling MSXsolveH -- alternatively, the hydraulics can be solved
16
+ # in EPANET once and exported as a .hyd file, which can then be loaded into EPANET-MSX
17
+ epanet_api.MSXsolveH()
18
+
19
+ #epanet_api.solveH() # Only do this once -- you can then just load the .hyd file
20
+ #epanet_api.savehydfile("mySimNet2.hyd")
21
+ #epanet_api.MSXusehydfile("mySimNet2.hyd")
22
+
23
+ # Run EPANET-MSX simulation
24
+ epanet_api.MSXinit(0)
25
+ print(f"Species ID: {epanet_api.MSXgetindex(EpanetConstants.MSX_SPECIES, 'CL2')}")
26
+
27
+ while True:
28
+ t, tleft = epanet_api.MSXstep()
29
+
30
+ print(f"{epanet_api.MSXgetqual(EpanetConstants.MSX_NODE, 2, 1)} mg/L")
31
+
32
+ if tleft == 0:
33
+ break
34
+
35
+ epanet_api.close()
@@ -61,6 +61,23 @@ PyObject* method_EN_open(PyObject* self, PyObject* args)
61
61
  return PyTuple_Pack(1, PyLong_FromLong(err));
62
62
  }
63
63
 
64
+ PyObject* method_EN_openX(PyObject* self, PyObject* args)
65
+ {
66
+ uintptr_t ptr;
67
+ char* inpFile = NULL;
68
+ char* rptFile = NULL;
69
+ char* outFile = NULL;
70
+
71
+ if(!PyArg_ParseTuple(args, "Ksss", &ptr, &inpFile, &rptFile, &outFile)) {
72
+ return NULL;
73
+ }
74
+ EN_Project ph = (EN_Project) ptr;
75
+
76
+ int err = EN_openX(ph, inpFile, rptFile, outFile);
77
+
78
+ return PyTuple_Pack(1, PyLong_FromLong(err));
79
+ }
80
+
64
81
  PyObject* method_EN_gettitle(PyObject* self, PyObject* args)
65
82
  {
66
83
  uintptr_t ptr;
@@ -5,6 +5,7 @@ PyObject* method_EN_createproject(PyObject* self, PyObject* Py_UNUSED(args));
5
5
  PyObject* method_EN_deleteproject(PyObject* self, PyObject* args);
6
6
  PyObject* method_EN_init(PyObject* self, PyObject* args);
7
7
  PyObject* method_EN_open(PyObject* self, PyObject* args);
8
+ PyObject* method_EN_openX(PyObject* self, PyObject* args);
8
9
  PyObject* method_EN_gettitle(PyObject* self, PyObject* args);
9
10
  PyObject* method_EN_settitle(PyObject* self, PyObject* args);
10
11
  PyObject* method_EN_getcomment(PyObject* self, PyObject* args);
@@ -16,6 +16,18 @@ PyObject* method_ENopen(PyObject* self, PyObject* args)
16
16
  return PyTuple_Pack(1, PyLong_FromLong(err));
17
17
  }
18
18
 
19
+ PyObject* method_ENopenX(PyObject* self, PyObject* args)
20
+ {
21
+ char *inpFile, *rptFile, *outFile = NULL;
22
+
23
+ if(!PyArg_ParseTuple(args, "sss", &inpFile, &rptFile, &outFile)) {
24
+ return NULL;
25
+ }
26
+
27
+ int err = ENopenX(inpFile, rptFile, outFile);
28
+
29
+ return PyTuple_Pack(1, PyLong_FromLong(err));
30
+ }
19
31
 
20
32
  PyObject* method_ENclose(PyObject* self, PyObject* Py_UNUSED(args))
21
33
  {
@@ -2,6 +2,7 @@
2
2
 
3
3
 
4
4
  PyObject* method_ENopen(PyObject* self, PyObject* args);
5
+ PyObject* method_ENopenX(PyObject* self, PyObject* args);
5
6
  PyObject* method_ENclose(PyObject* self, PyObject* Py_UNUSED(args));
6
7
  PyObject* method_ENaddcontrol(PyObject* self, PyObject* args);
7
8
  PyObject* method_ENaddcurve(PyObject* self, PyObject* args);