epanet-plus 0.0.1__cp311-cp311-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.
- docs/conf.py +67 -0
- epanet-msx-src/dispersion.h +27 -0
- epanet-msx-src/hash.c +107 -0
- epanet-msx-src/hash.h +28 -0
- epanet-msx-src/include/epanetmsx.h +104 -0
- epanet-msx-src/include/epanetmsx_export.h +42 -0
- epanet-msx-src/mathexpr.c +937 -0
- epanet-msx-src/mathexpr.h +39 -0
- epanet-msx-src/mempool.c +204 -0
- epanet-msx-src/mempool.h +24 -0
- epanet-msx-src/msxchem.c +1285 -0
- epanet-msx-src/msxcompiler.c +368 -0
- epanet-msx-src/msxdict.h +42 -0
- epanet-msx-src/msxdispersion.c +586 -0
- epanet-msx-src/msxerr.c +116 -0
- epanet-msx-src/msxfile.c +260 -0
- epanet-msx-src/msxfuncs.c +175 -0
- epanet-msx-src/msxfuncs.h +35 -0
- epanet-msx-src/msxinp.c +1504 -0
- epanet-msx-src/msxout.c +398 -0
- epanet-msx-src/msxproj.c +791 -0
- epanet-msx-src/msxqual.c +2011 -0
- epanet-msx-src/msxrpt.c +400 -0
- epanet-msx-src/msxtank.c +422 -0
- epanet-msx-src/msxtoolkit.c +1164 -0
- epanet-msx-src/msxtypes.h +551 -0
- epanet-msx-src/msxutils.c +524 -0
- epanet-msx-src/msxutils.h +56 -0
- epanet-msx-src/newton.c +158 -0
- epanet-msx-src/newton.h +34 -0
- epanet-msx-src/rk5.c +287 -0
- epanet-msx-src/rk5.h +39 -0
- epanet-msx-src/ros2.c +293 -0
- epanet-msx-src/ros2.h +35 -0
- epanet-msx-src/smatrix.c +816 -0
- epanet-msx-src/smatrix.h +29 -0
- epanet-src/AUTHORS +60 -0
- epanet-src/LICENSE +21 -0
- epanet-src/enumstxt.h +151 -0
- epanet-src/epanet.c +5937 -0
- epanet-src/epanet2.c +961 -0
- epanet-src/epanet2.def +131 -0
- epanet-src/errors.dat +79 -0
- epanet-src/flowbalance.c +186 -0
- epanet-src/funcs.h +219 -0
- epanet-src/genmmd.c +1000 -0
- epanet-src/hash.c +177 -0
- epanet-src/hash.h +28 -0
- epanet-src/hydcoeffs.c +1303 -0
- epanet-src/hydraul.c +1164 -0
- epanet-src/hydsolver.c +781 -0
- epanet-src/hydstatus.c +442 -0
- epanet-src/include/epanet2.h +466 -0
- epanet-src/include/epanet2_2.h +1962 -0
- epanet-src/include/epanet2_enums.h +518 -0
- epanet-src/inpfile.c +884 -0
- epanet-src/input1.c +672 -0
- epanet-src/input2.c +970 -0
- epanet-src/input3.c +2265 -0
- epanet-src/leakage.c +527 -0
- epanet-src/mempool.c +146 -0
- epanet-src/mempool.h +24 -0
- epanet-src/output.c +853 -0
- epanet-src/project.c +1691 -0
- epanet-src/quality.c +695 -0
- epanet-src/qualreact.c +800 -0
- epanet-src/qualroute.c +696 -0
- epanet-src/report.c +1559 -0
- epanet-src/rules.c +1500 -0
- epanet-src/smatrix.c +871 -0
- epanet-src/text.h +508 -0
- epanet-src/types.h +928 -0
- epanet-src/util/cstr_helper.c +59 -0
- epanet-src/util/cstr_helper.h +38 -0
- epanet-src/util/errormanager.c +92 -0
- epanet-src/util/errormanager.h +39 -0
- epanet-src/util/filemanager.c +212 -0
- epanet-src/util/filemanager.h +81 -0
- epanet-src/validate.c +408 -0
- epanet.cp311-win_amd64.pyd +0 -0
- epanet_plus/VERSION +1 -0
- epanet_plus/__init__.py +8 -0
- epanet_plus/epanet_plus.c +118 -0
- epanet_plus/epanet_toolkit.py +2730 -0
- epanet_plus/epanet_wrapper.py +2414 -0
- epanet_plus/include/epanet_plus.h +9 -0
- epanet_plus-0.0.1.dist-info/METADATA +152 -0
- epanet_plus-0.0.1.dist-info/RECORD +105 -0
- epanet_plus-0.0.1.dist-info/WHEEL +5 -0
- epanet_plus-0.0.1.dist-info/licenses/LICENSE +21 -0
- epanet_plus-0.0.1.dist-info/top_level.txt +11 -0
- examples/basic_usage.py +35 -0
- python-extension/ext.c +344 -0
- python-extension/pyepanet.c +2133 -0
- python-extension/pyepanet.h +143 -0
- python-extension/pyepanet2.c +1823 -0
- python-extension/pyepanet2.h +141 -0
- python-extension/pyepanet_plus.c +37 -0
- python-extension/pyepanet_plus.h +4 -0
- python-extension/pyepanetmsx.c +388 -0
- python-extension/pyepanetmsx.h +35 -0
- tests/test_epanet.py +16 -0
- tests/test_epanetmsx.py +36 -0
- tests/test_epyt.py +114 -0
- tests/test_load_inp_from_buffer.py +18 -0
tests/test_epyt.py
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module tests the toolkit functions implemented in the clas EPyT.
|
|
3
|
+
"""
|
|
4
|
+
from epanet_plus import EPyT, EpanetConstants
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_topology():
|
|
8
|
+
def __test_code(epanet_api: EPyT):
|
|
9
|
+
assert len(epanet_api.get_all_nodes_id()) > 0
|
|
10
|
+
assert len(epanet_api.get_all_links_id()) > 0
|
|
11
|
+
|
|
12
|
+
assert len(epanet_api.get_all_nodes_idx()) > 0
|
|
13
|
+
assert len(epanet_api.get_all_links_idx()) > 0
|
|
14
|
+
|
|
15
|
+
epanet_api.get_all_junctions_id()
|
|
16
|
+
epanet_api.get_all_junctions_idx()
|
|
17
|
+
|
|
18
|
+
assert len(epanet_api.get_all_pipes_id()) > 0
|
|
19
|
+
assert len(epanet_api.get_all_pipes_idx()) > 0
|
|
20
|
+
|
|
21
|
+
assert len(epanet_api.get_all_tanks_id()) > 0
|
|
22
|
+
assert len(epanet_api.get_all_tanks_idx()) > 0
|
|
23
|
+
|
|
24
|
+
epanet_api.get_all_reservoirs_id()
|
|
25
|
+
epanet_api.get_all_reservoirs_idx()
|
|
26
|
+
epanet_api.get_all_pumps_id()
|
|
27
|
+
epanet_api.get_all_pumps_idx()
|
|
28
|
+
|
|
29
|
+
with EPyT("net2-cl2.inp") as epanet_api:
|
|
30
|
+
__test_code(epanet_api)
|
|
31
|
+
|
|
32
|
+
with EPyT("net2-cl2.inp", use_project=True) as epanet_api:
|
|
33
|
+
__test_code(epanet_api)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_parameters():
|
|
37
|
+
def __test_code(epanet_api: EPyT):
|
|
38
|
+
assert epanet_api.get_simulation_duration() > 0
|
|
39
|
+
assert epanet_api.get_hydraulic_time_step() > 0
|
|
40
|
+
assert epanet_api.get_reporting_start_time() >= 0
|
|
41
|
+
assert epanet_api.get_reporting_time_step() > 0
|
|
42
|
+
assert epanet_api.get_quality_time_step() > 0
|
|
43
|
+
|
|
44
|
+
with EPyT("net2-cl2.inp") as epanet_api:
|
|
45
|
+
__test_code(epanet_api)
|
|
46
|
+
|
|
47
|
+
with EPyT("net2-cl2.inp", use_project=True) as epanet_api:
|
|
48
|
+
__test_code(epanet_api)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_hyd_simulation():
|
|
52
|
+
def __test_code(epanet_api: EPyT):
|
|
53
|
+
epanet_api.openH()
|
|
54
|
+
epanet_api.initH(EpanetConstants.EN_NOSAVE)
|
|
55
|
+
|
|
56
|
+
tstep = 1
|
|
57
|
+
while tstep > 0:
|
|
58
|
+
epanet_api.runH()
|
|
59
|
+
|
|
60
|
+
assert len(epanet_api.getnodevalues(EpanetConstants.EN_PRESSURE)) > 0
|
|
61
|
+
assert len(epanet_api.getlinkvalues(EpanetConstants.EN_FLOW)) > 0
|
|
62
|
+
|
|
63
|
+
tstep = epanet_api.nextH()
|
|
64
|
+
|
|
65
|
+
epanet_api.closeH()
|
|
66
|
+
|
|
67
|
+
with EPyT("net2-cl2.inp") as epanet_api:
|
|
68
|
+
__test_code(epanet_api)
|
|
69
|
+
|
|
70
|
+
with EPyT("net2-cl2.inp", use_project=True) as epanet_api:
|
|
71
|
+
__test_code(epanet_api)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_quality_simulation():
|
|
75
|
+
def __test_code(epanet_api: EPyT):
|
|
76
|
+
epanet_api.openH()
|
|
77
|
+
epanet_api.initH(EpanetConstants.EN_NOSAVE)
|
|
78
|
+
|
|
79
|
+
epanet_api.openQ()
|
|
80
|
+
epanet_api.initQ(EpanetConstants.EN_NOSAVE)
|
|
81
|
+
|
|
82
|
+
tstep = 1
|
|
83
|
+
while tstep > 0:
|
|
84
|
+
epanet_api.runH()
|
|
85
|
+
epanet_api.runQ()
|
|
86
|
+
|
|
87
|
+
assert len(epanet_api.getnodevalues(EpanetConstants.EN_PRESSURE)) > 0
|
|
88
|
+
assert len(epanet_api.getlinkvalues(EpanetConstants.EN_FLOW)) > 0
|
|
89
|
+
assert len(epanet_api.getnodevalues(EpanetConstants.EN_QUALITY)) > 0
|
|
90
|
+
assert len(epanet_api.getlinkvalues(EpanetConstants.EN_QUALITY)) > 0
|
|
91
|
+
|
|
92
|
+
tstep = epanet_api.nextH()
|
|
93
|
+
epanet_api.nextQ()
|
|
94
|
+
|
|
95
|
+
epanet_api.closeQ()
|
|
96
|
+
epanet_api.closeH()
|
|
97
|
+
|
|
98
|
+
with EPyT("net2-cl2.inp") as epanet_api:
|
|
99
|
+
__test_code(epanet_api)
|
|
100
|
+
|
|
101
|
+
with EPyT("net2-cl2.inp", use_project=True) as epanet_api:
|
|
102
|
+
__test_code(epanet_api)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def test_msx():
|
|
106
|
+
with EPyT("net2-cl2.inp", use_project=False) as epanet_api:
|
|
107
|
+
epanet_api.load_msx_file("net2-cl2.msx")
|
|
108
|
+
|
|
109
|
+
assert epanet_api.get_msx_time_step() > 0
|
|
110
|
+
epanet_api.set_msx_time_step(150)
|
|
111
|
+
assert epanet_api.get_msx_time_step() == 150
|
|
112
|
+
|
|
113
|
+
epanet_api.get_all_msx_species_id()
|
|
114
|
+
epanet_api.get_all_msx_species_info()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module tests the EPANET-PLUS function for loading an .inp file from a buffer.
|
|
3
|
+
"""
|
|
4
|
+
import epanet
|
|
5
|
+
from epanet_plus import EpanetConstants
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_load_from_buffer():
|
|
9
|
+
inp_buffer = ""
|
|
10
|
+
with open("net2-cl2.inp", "rt") as f_in:
|
|
11
|
+
inp_buffer = "".join(f_in.readlines())
|
|
12
|
+
|
|
13
|
+
assert epanet.ENopenfrombuffer(inp_buffer, "net2-cl2.inp", "net2-cl2.rpt", "") == (0,)
|
|
14
|
+
|
|
15
|
+
assert epanet.ENgettitle() == (0, "EPANET Example Network 2", "", "")
|
|
16
|
+
assert epanet.ENgetcount(EpanetConstants.EN_NODECOUNT)[1] > 0
|
|
17
|
+
|
|
18
|
+
epanet.ENclose()
|