epanet-plus 0.1.3__tar.gz

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.
Files changed (123) hide show
  1. epanet_plus-0.1.3/LICENSE +21 -0
  2. epanet_plus-0.1.3/MANIFEST.in +6 -0
  3. epanet_plus-0.1.3/PKG-INFO +155 -0
  4. epanet_plus-0.1.3/README.md +130 -0
  5. epanet_plus-0.1.3/REQUIREMENTS.txt +0 -0
  6. epanet_plus-0.1.3/docs/conf.py +67 -0
  7. epanet_plus-0.1.3/epanet-msx-src/dispersion.h +27 -0
  8. epanet_plus-0.1.3/epanet-msx-src/hash.c +107 -0
  9. epanet_plus-0.1.3/epanet-msx-src/hash.h +28 -0
  10. epanet_plus-0.1.3/epanet-msx-src/include/epanetmsx.h +104 -0
  11. epanet_plus-0.1.3/epanet-msx-src/include/epanetmsx_export.h +42 -0
  12. epanet_plus-0.1.3/epanet-msx-src/mathexpr.c +937 -0
  13. epanet_plus-0.1.3/epanet-msx-src/mathexpr.h +39 -0
  14. epanet_plus-0.1.3/epanet-msx-src/mempool.c +204 -0
  15. epanet_plus-0.1.3/epanet-msx-src/mempool.h +24 -0
  16. epanet_plus-0.1.3/epanet-msx-src/msxchem.c +1285 -0
  17. epanet_plus-0.1.3/epanet-msx-src/msxcompiler.c +368 -0
  18. epanet_plus-0.1.3/epanet-msx-src/msxdict.h +42 -0
  19. epanet_plus-0.1.3/epanet-msx-src/msxdispersion.c +586 -0
  20. epanet_plus-0.1.3/epanet-msx-src/msxerr.c +116 -0
  21. epanet_plus-0.1.3/epanet-msx-src/msxfile.c +260 -0
  22. epanet_plus-0.1.3/epanet-msx-src/msxfuncs.c +175 -0
  23. epanet_plus-0.1.3/epanet-msx-src/msxfuncs.h +35 -0
  24. epanet_plus-0.1.3/epanet-msx-src/msxinp.c +1504 -0
  25. epanet_plus-0.1.3/epanet-msx-src/msxout.c +398 -0
  26. epanet_plus-0.1.3/epanet-msx-src/msxproj.c +791 -0
  27. epanet_plus-0.1.3/epanet-msx-src/msxqual.c +2011 -0
  28. epanet_plus-0.1.3/epanet-msx-src/msxrpt.c +400 -0
  29. epanet_plus-0.1.3/epanet-msx-src/msxtank.c +422 -0
  30. epanet_plus-0.1.3/epanet-msx-src/msxtoolkit.c +1164 -0
  31. epanet_plus-0.1.3/epanet-msx-src/msxtypes.h +551 -0
  32. epanet_plus-0.1.3/epanet-msx-src/msxutils.c +524 -0
  33. epanet_plus-0.1.3/epanet-msx-src/msxutils.h +56 -0
  34. epanet_plus-0.1.3/epanet-msx-src/newton.c +158 -0
  35. epanet_plus-0.1.3/epanet-msx-src/newton.h +34 -0
  36. epanet_plus-0.1.3/epanet-msx-src/rk5.c +287 -0
  37. epanet_plus-0.1.3/epanet-msx-src/rk5.h +39 -0
  38. epanet_plus-0.1.3/epanet-msx-src/ros2.c +293 -0
  39. epanet_plus-0.1.3/epanet-msx-src/ros2.h +35 -0
  40. epanet_plus-0.1.3/epanet-msx-src/smatrix.c +816 -0
  41. epanet_plus-0.1.3/epanet-msx-src/smatrix.h +29 -0
  42. epanet_plus-0.1.3/epanet-src/AUTHORS +60 -0
  43. epanet_plus-0.1.3/epanet-src/LICENSE +21 -0
  44. epanet_plus-0.1.3/epanet-src/enumstxt.h +151 -0
  45. epanet_plus-0.1.3/epanet-src/epanet.c +5937 -0
  46. epanet_plus-0.1.3/epanet-src/epanet2.c +961 -0
  47. epanet_plus-0.1.3/epanet-src/epanet2.def +131 -0
  48. epanet_plus-0.1.3/epanet-src/errors.dat +79 -0
  49. epanet_plus-0.1.3/epanet-src/flowbalance.c +186 -0
  50. epanet_plus-0.1.3/epanet-src/funcs.h +219 -0
  51. epanet_plus-0.1.3/epanet-src/genmmd.c +1000 -0
  52. epanet_plus-0.1.3/epanet-src/hash.c +177 -0
  53. epanet_plus-0.1.3/epanet-src/hash.h +28 -0
  54. epanet_plus-0.1.3/epanet-src/hydcoeffs.c +1303 -0
  55. epanet_plus-0.1.3/epanet-src/hydraul.c +1164 -0
  56. epanet_plus-0.1.3/epanet-src/hydsolver.c +781 -0
  57. epanet_plus-0.1.3/epanet-src/hydstatus.c +442 -0
  58. epanet_plus-0.1.3/epanet-src/include/epanet2.h +466 -0
  59. epanet_plus-0.1.3/epanet-src/include/epanet2_2.h +1962 -0
  60. epanet_plus-0.1.3/epanet-src/include/epanet2_enums.h +518 -0
  61. epanet_plus-0.1.3/epanet-src/inpfile.c +884 -0
  62. epanet_plus-0.1.3/epanet-src/input1.c +672 -0
  63. epanet_plus-0.1.3/epanet-src/input2.c +970 -0
  64. epanet_plus-0.1.3/epanet-src/input3.c +2265 -0
  65. epanet_plus-0.1.3/epanet-src/leakage.c +527 -0
  66. epanet_plus-0.1.3/epanet-src/mempool.c +146 -0
  67. epanet_plus-0.1.3/epanet-src/mempool.h +24 -0
  68. epanet_plus-0.1.3/epanet-src/output.c +853 -0
  69. epanet_plus-0.1.3/epanet-src/project.c +1691 -0
  70. epanet_plus-0.1.3/epanet-src/quality.c +695 -0
  71. epanet_plus-0.1.3/epanet-src/qualreact.c +800 -0
  72. epanet_plus-0.1.3/epanet-src/qualroute.c +696 -0
  73. epanet_plus-0.1.3/epanet-src/report.c +1559 -0
  74. epanet_plus-0.1.3/epanet-src/rules.c +1500 -0
  75. epanet_plus-0.1.3/epanet-src/smatrix.c +871 -0
  76. epanet_plus-0.1.3/epanet-src/text.h +508 -0
  77. epanet_plus-0.1.3/epanet-src/types.h +928 -0
  78. epanet_plus-0.1.3/epanet-src/util/cstr_helper.c +59 -0
  79. epanet_plus-0.1.3/epanet-src/util/cstr_helper.h +38 -0
  80. epanet_plus-0.1.3/epanet-src/util/errormanager.c +92 -0
  81. epanet_plus-0.1.3/epanet-src/util/errormanager.h +39 -0
  82. epanet_plus-0.1.3/epanet-src/util/filemanager.c +212 -0
  83. epanet_plus-0.1.3/epanet-src/util/filemanager.h +81 -0
  84. epanet_plus-0.1.3/epanet-src/validate.c +408 -0
  85. epanet_plus-0.1.3/epanet_plus/VERSION +1 -0
  86. epanet_plus-0.1.3/epanet_plus/__init__.py +8 -0
  87. epanet_plus-0.1.3/epanet_plus/__pycache__/__init__.cpython-310.pyc +0 -0
  88. epanet_plus-0.1.3/epanet_plus/__pycache__/epanet_toolkit.cpython-310.pyc +0 -0
  89. epanet_plus-0.1.3/epanet_plus/__pycache__/epanet_wrapper.cpython-310.pyc +0 -0
  90. epanet_plus-0.1.3/epanet_plus/epanet.egg-info/PKG-INFO +16 -0
  91. epanet_plus-0.1.3/epanet_plus/epanet.egg-info/SOURCES.txt +98 -0
  92. epanet_plus-0.1.3/epanet_plus/epanet.egg-info/dependency_links.txt +1 -0
  93. epanet_plus-0.1.3/epanet_plus/epanet.egg-info/top_level.txt +2 -0
  94. epanet_plus-0.1.3/epanet_plus/epanet_plus.c +118 -0
  95. epanet_plus-0.1.3/epanet_plus/epanet_plus.egg-info/PKG-INFO +16 -0
  96. epanet_plus-0.1.3/epanet_plus/epanet_plus.egg-info/SOURCES.txt +102 -0
  97. epanet_plus-0.1.3/epanet_plus/epanet_plus.egg-info/dependency_links.txt +1 -0
  98. epanet_plus-0.1.3/epanet_plus/epanet_plus.egg-info/top_level.txt +2 -0
  99. epanet_plus-0.1.3/epanet_plus/epanet_toolkit.py +2779 -0
  100. epanet_plus-0.1.3/epanet_plus/epanet_wrapper.py +2434 -0
  101. epanet_plus-0.1.3/epanet_plus/include/epanet_plus.h +9 -0
  102. epanet_plus-0.1.3/epanet_plus.egg-info/PKG-INFO +155 -0
  103. epanet_plus-0.1.3/epanet_plus.egg-info/SOURCES.txt +121 -0
  104. epanet_plus-0.1.3/epanet_plus.egg-info/dependency_links.txt +1 -0
  105. epanet_plus-0.1.3/epanet_plus.egg-info/top_level.txt +12 -0
  106. epanet_plus-0.1.3/examples/basic_usage.py +35 -0
  107. epanet_plus-0.1.3/examples/epanet_msx.py +35 -0
  108. epanet_plus-0.1.3/pyproject.toml +64 -0
  109. epanet_plus-0.1.3/python-extension/ext.c +344 -0
  110. epanet_plus-0.1.3/python-extension/pyepanet.c +2771 -0
  111. epanet_plus-0.1.3/python-extension/pyepanet.h +144 -0
  112. epanet_plus-0.1.3/python-extension/pyepanet2.c +2453 -0
  113. epanet_plus-0.1.3/python-extension/pyepanet2.h +142 -0
  114. epanet_plus-0.1.3/python-extension/pyepanet_plus.c +43 -0
  115. epanet_plus-0.1.3/python-extension/pyepanet_plus.h +4 -0
  116. epanet_plus-0.1.3/python-extension/pyepanetmsx.c +524 -0
  117. epanet_plus-0.1.3/python-extension/pyepanetmsx.h +35 -0
  118. epanet_plus-0.1.3/setup.cfg +4 -0
  119. epanet_plus-0.1.3/setup.py +3 -0
  120. epanet_plus-0.1.3/tests/test_epanet.py +18 -0
  121. epanet_plus-0.1.3/tests/test_epanetmsx.py +38 -0
  122. epanet_plus-0.1.3/tests/test_epyt.py +115 -0
  123. epanet_plus-0.1.3/tests/test_load_inp_from_buffer.py +59 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) EPANET-PLUS Developers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ recursive-include epanet-src/ *
2
+ recursive-include epanet-msx-src/ *
3
+ recursive-include epanet_plus/ *
4
+ recursive-include python-extension/ *
5
+ include epanet_plus/epanet_wrapper.py
6
+ include epanet_plus/epanet_toolkit.py
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: epanet-plus
3
+ Version: 0.1.3
4
+ Summary: Python interface for EPANET-PLUS (incl. EPANET and EPANET-MSX)
5
+ Author-email: André Artelt <aartelt@techfak.uni-bielefeld.de>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/WaterFutures/EPANET-PLUS
8
+ Project-URL: Documentation, https://epanet-plus.readthedocs.io/en/stable/
9
+ Project-URL: Repository, https://github.com/WaterFutures/EPANET-PLUS.git
10
+ Project-URL: Issues, https://github.com/WaterFutures/EPANET-PLUS/issues
11
+ Keywords: epanet,water,networks,hydraulics,quality,simulations
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Dynamic: license-file
25
+
26
+ [![pypi](https://img.shields.io/pypi/v/epanet-plus.svg)](https://pypi.org/project/epanet-plus/)
27
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
28
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/epanet-plus)
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)
30
+ [![Documentation Status](https://readthedocs.org/projects/epanet-plus/badge/?version=stable)](https://epanet-plus.readthedocs.io/en/stable/?badge=stable)
31
+ [![Downloads](https://static.pepy.tech/badge/epanet-plus)](https://pepy.tech/project/epanet-plus)
32
+ [![Downloads](https://static.pepy.tech/badge/epanet-plus/month)](https://pepy.tech/project/epanet-plus)
33
+
34
+ # EPANET-PLUS
35
+
36
+ EPANET-PLUS is a C library that merges [EPANET](https://github.com/OpenWaterAnalytics/EPANET)
37
+ and [EPANET-MSX](https://github.com/OpenWaterAnalytics/epanet-msx) into a single library.
38
+ Most importantly, it also provides a Python package with a high-performance interface
39
+ (i.e., C extension) to the C library, together with additional helper functions for an easier
40
+ use of EPANET and EPANET-MSX.
41
+
42
+ If you are interested in creating and simulating complex scenarios, we recommend to take a look
43
+ at [EPyT-Flow](https://github.com/WaterFutures/EPyT-Flow), which builds upon EPANET-PLUS.
44
+
45
+ ## Unique Features
46
+
47
+ Unique features of EPANET-PLUS that make it superior to other Python interfaces of EPANET are the following:
48
+
49
+ - High-performance (single) interface to the latest version of EPANET and EPANET-MSX
50
+ - Additional C-functions to extend EPANET and EPANET-MSX
51
+ - Python toolkit with handy functions for working with EPANET and EPANET-MSX
52
+
53
+ ## Installation
54
+
55
+ Note that EPANET-PLUS supports Python 3.9 - 3.14.
56
+ The Python package contains the the C library as a C extension and is
57
+ already pre-build for all major platforms.
58
+
59
+ ### PyPI
60
+
61
+ ```
62
+ pip install epanet-plus
63
+ ```
64
+
65
+
66
+ ### Git
67
+
68
+ Download or clone the repository:
69
+
70
+ ```
71
+ git clone https://github.com/WaterFutures/EPANET-PLUS.git
72
+ cd EPANET-PLUS
73
+ ```
74
+
75
+ Install all requirements as listed in [REQUIREMENTS.txt](https://raw.githubusercontent.com/WaterFutures/EPANET-PLUS/main/REQUIREMENTS.txt):
76
+
77
+ ```
78
+ pip install -r REQUIREMENTS.txt
79
+ ```
80
+
81
+ Build and install the package:
82
+
83
+ ```
84
+ pip install .
85
+ ```
86
+
87
+ ## Quick Example
88
+
89
+ ```python
90
+ from epanet_plus import EPyT, EpanetConstants
91
+
92
+ if __name__ == "__main__":
93
+ # Load an .inp file in EPANET using the toolkit class
94
+ epanet_api = EPyT("net2-cl2.inp")
95
+
96
+ # Print some general information
97
+ print(f"All nodes: {epanet_api.get_all_nodes_id()}")
98
+ print(f"All links: {epanet_api.get_all_links_id()}")
99
+
100
+ print(f"Simulation duration in seconds: {epanet_api.get_simulation_duration()}")
101
+ print(f"Hydraulic time step in seconds: {epanet_api.get_hydraulic_time_step()}")
102
+ print(f"Demand model: {epanet_api.get_demand_model()}")
103
+
104
+ # Run hydraulic simulation and output pressure at each node (at every simulation step)
105
+ epanet_api.openH()
106
+ epanet_api.initH(EpanetConstants.EN_NOSAVE)
107
+
108
+ tstep = 1
109
+ while tstep > 0:
110
+ t = epanet_api.runH()
111
+
112
+ print(epanet_api.getnodevalues(EpanetConstants.EN_PRESSURE))
113
+
114
+ tstep = epanet_api.nextH()
115
+
116
+ epanet_api.closeH()
117
+
118
+ # Close EPANET
119
+ epanet_api.close()
120
+ ```
121
+
122
+ ## Documentation
123
+
124
+ Documentation is available on readthedocs: [https://epanet-plus.readthedocs.io/en/latest/](https://epanet-plus.readthedocs.io/en/stable)
125
+
126
+ # License
127
+
128
+ MIT license -- see [LICENSE](LICENSE)
129
+
130
+ ## How to Cite?
131
+
132
+ If you use this software, please cite it as follows:
133
+
134
+ ```bibtex
135
+ @misc{github:epanetplus,
136
+ author = {André Artelt},
137
+ title = {{EPANET-PLUS}},
138
+ year = {2025},
139
+ publisher = {GitHub},
140
+ journal = {GitHub repository},
141
+ howpublished = {https://github.com/WaterFutures/EPANET-PLUS}
142
+ }
143
+ ```
144
+
145
+ ## How to get Support?
146
+
147
+ If you come across any bug or need assistance please feel free to open a new
148
+ [issue](https://github.com/WaterFutures/EPyT-Flow/issues/)
149
+ if non of the existing issues answers your questions.
150
+
151
+ ## How to Contribute?
152
+
153
+ Contributions (e.g. creating issues, pull-requests, etc.) are welcome --
154
+ please make sure to read the [code of conduct](CODE_OF_CONDUCT.md) and
155
+ follow the [developers' guidelines](DEVELOPERS.md).
@@ -0,0 +1,130 @@
1
+ [![pypi](https://img.shields.io/pypi/v/epanet-plus.svg)](https://pypi.org/project/epanet-plus/)
2
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/epanet-plus)
4
+ [![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)
5
+ [![Documentation Status](https://readthedocs.org/projects/epanet-plus/badge/?version=stable)](https://epanet-plus.readthedocs.io/en/stable/?badge=stable)
6
+ [![Downloads](https://static.pepy.tech/badge/epanet-plus)](https://pepy.tech/project/epanet-plus)
7
+ [![Downloads](https://static.pepy.tech/badge/epanet-plus/month)](https://pepy.tech/project/epanet-plus)
8
+
9
+ # EPANET-PLUS
10
+
11
+ EPANET-PLUS is a C library that merges [EPANET](https://github.com/OpenWaterAnalytics/EPANET)
12
+ and [EPANET-MSX](https://github.com/OpenWaterAnalytics/epanet-msx) into a single library.
13
+ Most importantly, it also provides a Python package with a high-performance interface
14
+ (i.e., C extension) to the C library, together with additional helper functions for an easier
15
+ use of EPANET and EPANET-MSX.
16
+
17
+ If you are interested in creating and simulating complex scenarios, we recommend to take a look
18
+ at [EPyT-Flow](https://github.com/WaterFutures/EPyT-Flow), which builds upon EPANET-PLUS.
19
+
20
+ ## Unique Features
21
+
22
+ Unique features of EPANET-PLUS that make it superior to other Python interfaces of EPANET are the following:
23
+
24
+ - High-performance (single) interface to the latest version of EPANET and EPANET-MSX
25
+ - Additional C-functions to extend EPANET and EPANET-MSX
26
+ - Python toolkit with handy functions for working with EPANET and EPANET-MSX
27
+
28
+ ## Installation
29
+
30
+ Note that EPANET-PLUS supports Python 3.9 - 3.14.
31
+ The Python package contains the the C library as a C extension and is
32
+ already pre-build for all major platforms.
33
+
34
+ ### PyPI
35
+
36
+ ```
37
+ pip install epanet-plus
38
+ ```
39
+
40
+
41
+ ### Git
42
+
43
+ Download or clone the repository:
44
+
45
+ ```
46
+ git clone https://github.com/WaterFutures/EPANET-PLUS.git
47
+ cd EPANET-PLUS
48
+ ```
49
+
50
+ Install all requirements as listed in [REQUIREMENTS.txt](https://raw.githubusercontent.com/WaterFutures/EPANET-PLUS/main/REQUIREMENTS.txt):
51
+
52
+ ```
53
+ pip install -r REQUIREMENTS.txt
54
+ ```
55
+
56
+ Build and install the package:
57
+
58
+ ```
59
+ pip install .
60
+ ```
61
+
62
+ ## Quick Example
63
+
64
+ ```python
65
+ from epanet_plus import EPyT, EpanetConstants
66
+
67
+ if __name__ == "__main__":
68
+ # Load an .inp file in EPANET using the toolkit class
69
+ epanet_api = EPyT("net2-cl2.inp")
70
+
71
+ # Print some general information
72
+ print(f"All nodes: {epanet_api.get_all_nodes_id()}")
73
+ print(f"All links: {epanet_api.get_all_links_id()}")
74
+
75
+ print(f"Simulation duration in seconds: {epanet_api.get_simulation_duration()}")
76
+ print(f"Hydraulic time step in seconds: {epanet_api.get_hydraulic_time_step()}")
77
+ print(f"Demand model: {epanet_api.get_demand_model()}")
78
+
79
+ # Run hydraulic simulation and output pressure at each node (at every simulation step)
80
+ epanet_api.openH()
81
+ epanet_api.initH(EpanetConstants.EN_NOSAVE)
82
+
83
+ tstep = 1
84
+ while tstep > 0:
85
+ t = epanet_api.runH()
86
+
87
+ print(epanet_api.getnodevalues(EpanetConstants.EN_PRESSURE))
88
+
89
+ tstep = epanet_api.nextH()
90
+
91
+ epanet_api.closeH()
92
+
93
+ # Close EPANET
94
+ epanet_api.close()
95
+ ```
96
+
97
+ ## Documentation
98
+
99
+ Documentation is available on readthedocs: [https://epanet-plus.readthedocs.io/en/latest/](https://epanet-plus.readthedocs.io/en/stable)
100
+
101
+ # License
102
+
103
+ MIT license -- see [LICENSE](LICENSE)
104
+
105
+ ## How to Cite?
106
+
107
+ If you use this software, please cite it as follows:
108
+
109
+ ```bibtex
110
+ @misc{github:epanetplus,
111
+ author = {André Artelt},
112
+ title = {{EPANET-PLUS}},
113
+ year = {2025},
114
+ publisher = {GitHub},
115
+ journal = {GitHub repository},
116
+ howpublished = {https://github.com/WaterFutures/EPANET-PLUS}
117
+ }
118
+ ```
119
+
120
+ ## How to get Support?
121
+
122
+ If you come across any bug or need assistance please feel free to open a new
123
+ [issue](https://github.com/WaterFutures/EPyT-Flow/issues/)
124
+ if non of the existing issues answers your questions.
125
+
126
+ ## How to Contribute?
127
+
128
+ Contributions (e.g. creating issues, pull-requests, etc.) are welcome --
129
+ please make sure to read the [code of conduct](CODE_OF_CONDUCT.md) and
130
+ follow the [developers' guidelines](DEVELOPERS.md).
File without changes
@@ -0,0 +1,67 @@
1
+ """
2
+ Configuration file for the Sphinx documentation builder.
3
+
4
+ This file only contains a selection of the most common options. For a full
5
+ list see the documentation: http://www.sphinx-doc.org/en/master/config
6
+ """
7
+
8
+ # -- Path setup --------------------------------------------------------------
9
+
10
+ # If extensions (or modules to document with autodoc) are in another directory,
11
+ # add these directories to sys.path here. If the directory is relative to the
12
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
13
+ #
14
+ import os
15
+ import sys
16
+ sys.path.insert(0, os.path.abspath('../'))
17
+
18
+
19
+ # -- Project information -----------------------------------------------------
20
+
21
+ project = 'EPANET-PLUS'
22
+ copyright = 'EPANET-PLUS Developers'
23
+ author = 'André Artelt'
24
+
25
+
26
+ # -- General configuration ---------------------------------------------------
27
+
28
+ autodoc_mock_imports = ["numpy", "scipy"]
29
+
30
+ # Add any Sphinx extension module names here, as strings. They can be
31
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32
+ # ones.
33
+ extensions = [
34
+ 'sphinx.ext.autodoc',
35
+ 'sphinx.ext.napoleon',
36
+ 'sphinx.ext.viewcode',
37
+ 'nbsphinx'
38
+ ]
39
+
40
+ # Show line numbers in the source code
41
+ viewcode_line_numbers = True
42
+
43
+ # Add any paths that contain templates here, relative to this directory.
44
+ templates_path = ['_templates']
45
+
46
+ # List of patterns, relative to source directory, that match files and
47
+ # directories to ignore when looking for source files.
48
+ # This pattern also affects html_static_path and html_extra_path.
49
+ exclude_patterns = []
50
+
51
+ # LaTeX
52
+ latex_elements = {
53
+ 'maxlistdepth': "10",
54
+ 'printindex': r'\def\twocolumn[#1]{#1}\printindex'
55
+ }
56
+
57
+ # -- Options for HTML output -------------------------------------------------
58
+
59
+ # The theme to use for HTML and HTML Help pages. See the documentation for
60
+ # a list of builtin themes.
61
+ #
62
+ html_theme = 'sphinx_rtd_theme'
63
+
64
+ # Add any paths that contain custom static files (such as style sheets) here,
65
+ # relative to this directory. They are copied after the builtin static files,
66
+ # so a file named "default.css" will overwrite the builtin "default.css".
67
+ html_static_path = ['_static']
@@ -0,0 +1,27 @@
1
+ #ifndef DISPERSION_H
2
+ #define DISPERSION_H
3
+
4
+ #define MAXSEGMENTS 5000
5
+
6
+ typedef enum {
7
+ XHEAD, // pump cannot deliver head (closed)
8
+ TEMPCLOSED, // temporarily closed
9
+ CLOSED, // closed
10
+ OPEN, // open
11
+ ACTIVE, // valve active (partially open)
12
+ XFLOW, // pump exceeds maximum flow
13
+ XFCV, // FCV cannot supply flow
14
+ XPRESSURE, // valve cannot supply pressure
15
+ FILLING, // tank filling
16
+ EMPTYING, // tank emptying
17
+ OVERFLOWING // tank overflowing
18
+ } StatusType;
19
+
20
+ int dispersion_open();
21
+ int dispersion_close();
22
+ void dispersion_pipe(int m, double tstep); //effective dispersion coefficient and upstream/downstream node impact calculation
23
+ void solve_nodequal(int m, double tstep); //solve nodal concentration
24
+ void segqual_update(int m, double tstep); //update pipe segment concentration
25
+ void tridiag(int n, double *a, double *b, double *c, double *r, double *y);
26
+
27
+ #endif
@@ -0,0 +1,107 @@
1
+ //-----------------------------------------------------------------------------
2
+ // hash.c
3
+ //
4
+ // Implementation of a simple Hash Table for string storage & retrieval
5
+ // /
6
+ // Written by L. Rossman
7
+ // Last Updated on 6/19/03
8
+ //
9
+ // The hash table data structure (HTable) is defined in "hash.h".
10
+ // Interface Functions:
11
+ // HTcreate() - creates a hash table
12
+ // HTinsert() - inserts a string & its index value into a hash table
13
+ // HTfind() - retrieves the index value of a string from a table
14
+ // HTfree() - frees a hash table
15
+ //-----------------------------------------------------------------------------
16
+
17
+ #include <string.h>
18
+ #include <stdlib.h>
19
+
20
+ #include "hash.h"
21
+
22
+ /* Use Fletcher's checksum to compute 2-byte hash of string */
23
+ unsigned int hash(char *str)
24
+ {
25
+ unsigned int sum1= 0, check1;
26
+ unsigned long sum2= 0L;
27
+ while( '\0' != *str )
28
+ {
29
+ sum1 += (*str);
30
+ str++;
31
+ if ( 255 <= sum1 ) sum1 -= 255;
32
+ sum2 += sum1;
33
+ }
34
+ check1= sum2;
35
+ check1 %= 255;
36
+ check1= 255 - (sum1+check1) % 255;
37
+ sum1= 255 - (sum1+check1) % 255;
38
+ return( ( ( check1 << 8 ) | sum1 ) % HTMAXSIZE);
39
+ }
40
+
41
+ HTtable *HTcreate()
42
+ {
43
+ int i;
44
+ HTtable *ht = (HTtable *) calloc(HTMAXSIZE, sizeof(HTtable));
45
+ if (ht != NULL) for (i=0; i<HTMAXSIZE; i++) ht[i] = NULL;
46
+ return(ht);
47
+ }
48
+
49
+ int HTinsert(HTtable *ht, char *key, int data)
50
+ {
51
+ unsigned int i = hash(key);
52
+ struct HTentry *entry;
53
+ if ( i >= HTMAXSIZE ) return(0);
54
+ entry = (struct HTentry *) malloc(sizeof(struct HTentry));
55
+ if (entry == NULL) return(0);
56
+ entry->key = key;
57
+ entry->data = data;
58
+ entry->next = ht[i];
59
+ ht[i] = entry;
60
+ return(1);
61
+ }
62
+
63
+ int HTfind(HTtable *ht, char *key)
64
+ {
65
+ unsigned int i = hash(key);
66
+ struct HTentry *entry;
67
+ if ( i >= HTMAXSIZE ) return(NOTFOUND);
68
+ entry = ht[i];
69
+ while (entry != NULL)
70
+ {
71
+ if ( strcmp(entry->key,key) == 0 ) return(entry->data);
72
+ entry = entry->next;
73
+ }
74
+ return(NOTFOUND);
75
+ }
76
+
77
+ char *HTfindKey(HTtable *ht, char *key)
78
+ {
79
+ unsigned int i = hash(key);
80
+ struct HTentry *entry;
81
+ if ( i >= HTMAXSIZE ) return(NULL);
82
+ entry = ht[i];
83
+ while (entry != NULL)
84
+ {
85
+ if ( strcmp(entry->key,key) == 0 ) return(entry->key);
86
+ entry = entry->next;
87
+ }
88
+ return(NULL);
89
+ }
90
+
91
+ void HTfree(HTtable *ht)
92
+ {
93
+ struct HTentry *entry,
94
+ *nextentry;
95
+ int i;
96
+ for (i=0; i<HTMAXSIZE; i++)
97
+ {
98
+ entry = ht[i];
99
+ while (entry != NULL)
100
+ {
101
+ nextentry = entry->next;
102
+ free(entry);
103
+ entry = nextentry;
104
+ }
105
+ }
106
+ free(ht);
107
+ }
@@ -0,0 +1,28 @@
1
+ /* HASH.H
2
+ **
3
+ ** Header file for Hash Table module HASH.C
4
+ **
5
+ */
6
+
7
+ #ifndef HASH_H
8
+ #define HASH_H
9
+
10
+ #define HTMAXSIZE 1999
11
+ #define NOTFOUND 0
12
+
13
+ struct HTentry
14
+ {
15
+ char *key;
16
+ int data;
17
+ struct HTentry *next;
18
+ };
19
+
20
+ typedef struct HTentry *HTtable;
21
+
22
+ HTtable *HTcreate(void);
23
+ int HTinsert(HTtable *, char *, int);
24
+ int HTfind(HTtable *, char *);
25
+ char *HTfindKey(HTtable *, char *);
26
+ void HTfree(HTtable *);
27
+
28
+ #endif
@@ -0,0 +1,104 @@
1
+ /******************************************************************************
2
+ ** MODULE: EPANETMSX.H
3
+ ** PROJECT: EPANET-MSX
4
+ ** DESCRIPTION: C/C++ header file for EPANET Multi-Species Extension Toolkit
5
+ ** AUTHORS: see AUTHORS
6
+ ** Copyright: see AUTHORS
7
+ ** License: see LICENSE
8
+ ** VERSION: 2.0.0
9
+ ** LAST UPDATE: 11/01/10
10
+ *******************************************************************************/
11
+
12
+ #include "epanet2.h" // EPANET toolkit header file
13
+
14
+ #ifndef EPANETMSX_H
15
+ #define EPANETMSX_H
16
+
17
+ #define epanetmsx_EXPORTS
18
+
19
+ #ifndef MSXDLLEXPORT
20
+ #ifdef _WIN32
21
+ #ifdef epanetmsx_EXPORTS
22
+ #define MSXDLLEXPORT __declspec(dllexport) __stdcall
23
+ #else
24
+ #define MSXDLLEXPORT __declspec(dllimport) __stdcall
25
+ #endif
26
+ #elif defined(__CYGWIN__)
27
+ #define MSXDLLEXPORT __stdcall
28
+ #else
29
+ #define MSXDLLEXPORT
30
+ #endif
31
+ #endif
32
+
33
+ // --- Declare the EPANETMSX toolkit functions
34
+ #if defined(__cplusplus)
35
+ extern "C" {
36
+ #endif
37
+
38
+ // --- define MSX constants
39
+
40
+ #define MSX_NODE 0
41
+ #define MSX_LINK 1
42
+ #define MSX_TANK 2
43
+ #define MSX_SPECIES 3
44
+ #define MSX_TERM 4
45
+ #define MSX_PARAMETER 5
46
+ #define MSX_CONSTANT 6
47
+ #define MSX_PATTERN 7
48
+
49
+ #define MSX_BULK 0
50
+ #define MSX_WALL 1
51
+
52
+ #define MSX_NOSOURCE -1
53
+ #define MSX_CONCEN 0
54
+ #define MSX_MASS 1
55
+ #define MSX_SETPOINT 2
56
+ #define MSX_FLOWPACED 3
57
+
58
+ // --- declare MSX functions
59
+
60
+ int MSXDLLEXPORT MSXENopen(const char *inpFile, const char *rptFile,
61
+ const char *outFile);
62
+ int MSXDLLEXPORT MSXopen(char *fname);
63
+ int MSXDLLEXPORT MSXsolveH(void);
64
+ int MSXDLLEXPORT MSXusehydfile(char *fname);
65
+ int MSXDLLEXPORT MSXsolveQ(void);
66
+ int MSXDLLEXPORT MSXinit(int saveFlag);
67
+ int MSXDLLEXPORT MSXstep(double *t, double *tleft);
68
+ int MSXDLLEXPORT MSXsaveoutfile(char *fname);
69
+ int MSXDLLEXPORT MSXsavemsxfile(char *fname);
70
+ int MSXDLLEXPORT MSXreport(void);
71
+ int MSXDLLEXPORT MSXclose(void);
72
+ int MSXDLLEXPORT MSXENclose(void);
73
+
74
+ int MSXDLLEXPORT MSXgetindex(int type, char *id, int *index);
75
+ int MSXDLLEXPORT MSXgetIDlen(int type, int index, int *len);
76
+ int MSXDLLEXPORT MSXgetID(int type, int index, char *id, int len);
77
+ int MSXDLLEXPORT MSXgetcount(int type, int *count);
78
+ int MSXDLLEXPORT MSXgetspecies(int index, int *type, char *units, double *aTol,
79
+ double *rTol);
80
+ int MSXDLLEXPORT MSXgetconstant(int index, double *value);
81
+ int MSXDLLEXPORT MSXgetparameter(int type, int index, int param, double *value);
82
+ int MSXDLLEXPORT MSXgetsource(int node, int species, int *type, double *level,
83
+ int *pat);
84
+ int MSXDLLEXPORT MSXgetpatternlen(int pat, int *len);
85
+ int MSXDLLEXPORT MSXgetpatternvalue(int pat, int period, double *value);
86
+ int MSXDLLEXPORT MSXgetinitqual(int type, int index, int species, double *value);
87
+ int MSXDLLEXPORT MSXgetqual(int type, int index, int species, double *value);
88
+ int MSXDLLEXPORT MSXgeterror(int code, char *msg, int len);
89
+
90
+ int MSXDLLEXPORT MSXsetconstant(int index, double value);
91
+ int MSXDLLEXPORT MSXsetparameter(int type, int index, int param, double value);
92
+ int MSXDLLEXPORT MSXsetinitqual(int type, int index, int species, double value);
93
+ int MSXDLLEXPORT MSXsetsource(int node, int species, int type, double level,
94
+ int pat);
95
+ int MSXDLLEXPORT MSXsetpatternvalue(int pat, int period, double value);
96
+ int MSXDLLEXPORT MSXsetpattern(int pat, double mult[], int len);
97
+ int MSXDLLEXPORT MSXaddpattern(char *id);
98
+
99
+
100
+ #if defined(__cplusplus)
101
+ }
102
+ #endif
103
+
104
+ #endif
@@ -0,0 +1,42 @@
1
+
2
+ #ifndef MSXDLLEXPORT_H
3
+ #define MSXDLLEXPORT_H
4
+
5
+ #ifdef SHARED_EXPORTS_BUILT_AS_STATIC
6
+ # define MSXDLLEXPORT
7
+ # define EPANETMSX_NO_EXPORT
8
+ #else
9
+ # ifndef MSXDLLEXPORT
10
+ # ifdef epanetmsx_EXPORTS
11
+ /* We are building this library */
12
+ # define MSXDLLEXPORT __attribute__((visibility("default")))
13
+ # else
14
+ /* We are using this library */
15
+ # define MSXDLLEXPORT __attribute__((visibility("default")))
16
+ # endif
17
+ # endif
18
+
19
+ # ifndef EPANETMSX_NO_EXPORT
20
+ # define EPANETMSX_NO_EXPORT __attribute__((visibility("hidden")))
21
+ # endif
22
+ #endif
23
+
24
+ #ifndef EPANETMSX_DEPRECATED
25
+ # define EPANETMSX_DEPRECATED __attribute__ ((__deprecated__))
26
+ #endif
27
+
28
+ #ifndef EPANETMSX_DEPRECATED_EXPORT
29
+ # define EPANETMSX_DEPRECATED_EXPORT MSXDLLEXPORT EPANETMSX_DEPRECATED
30
+ #endif
31
+
32
+ #ifndef EPANETMSX_DEPRECATED_NO_EXPORT
33
+ # define EPANETMSX_DEPRECATED_NO_EXPORT EPANETMSX_NO_EXPORT EPANETMSX_DEPRECATED
34
+ #endif
35
+
36
+ #if 0 /* DEFINE_NO_DEPRECATED */
37
+ # ifndef EPANETMSX_NO_DEPRECATED
38
+ # define EPANETMSX_NO_DEPRECATED
39
+ # endif
40
+ #endif
41
+
42
+ #endif /* MSXDLLEXPORT_H */