openswmm 5.3.0.dev0__tar.gz → 5.3.0.dev1__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.
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/PKG-INFO +53 -46
- openswmm-5.3.0.dev1/README.md +183 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/solver/solver.pxd +1 -1
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/setup.py +2 -2
- openswmm-5.3.0.dev0/README.md +0 -176
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/LICENSE +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/MANIFEST.in +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/CMakeLists.txt +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/__init__.py +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/_openswmm.pyx +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/data/__init__.py +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/gym/__init__.py +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/openswmm.pxd +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/output/CMakeLists.txt +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/output/__init__.pxd +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/output/__init__.py +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/output/_output.pyi +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/output/_output.pyx +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/output/output.pxd +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/solver/CMakeLists.txt +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/solver/__init__.pxd +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/solver/__init__.py +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/solver/_solver.pyi +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm/solver/_solver.pyx +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/openswmm.egg-info/SOURCES.txt +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/pyproject.toml +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/setup.cfg +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/.DS_Store +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/__init__.py +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/data/.DS_Store +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/data/__init__.py +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/data/output/__init__.py +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/data/output/example_output_1.out +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/data/output/json_time_series.pickle +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/data/solver/__init__.py +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/data/solver/non_existent_input_file.rpt +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/data/solver/site_drainage_example.inp +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/data/solver/site_drainage_example.rpt +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/test_swmm_solver.py +0 -0
- {openswmm-5.3.0.dev0 → openswmm-5.3.0.dev1}/tests/test_swwm_output.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openswmm
|
|
3
|
-
Version: 5.3.0.
|
|
3
|
+
Version: 5.3.0.dev1
|
|
4
4
|
Summary: A python package for EPA SWMM preprocessing, solver, and post-processing.
|
|
5
5
|
Author-email: Caleb Buahin <caleb.buahin@gmail.com>
|
|
6
6
|
Maintainer-email: Caleb Buahin <caleb.buahin@gmail.com>
|
|
@@ -50,18 +50,28 @@ Dynamic: description
|
|
|
50
50
|
Dynamic: description-content-type
|
|
51
51
|
Dynamic: license-file
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
==========================================
|
|
53
|
+
## Stormwater Management Model (SWMM) Open Source Initiative
|
|
55
54
|
|
|
56
|
-
Stormwater Management Model (SWMM)
|
|
55
|
+
Stormwater Management Model (SWMM) SWMM is a dynamic hydrology-hydraulic water quality simulation model.
|
|
56
|
+
It is used for single event or long-term (continuous) simulation of runoff quantity and quality from primarily
|
|
57
|
+
urban areas. SWMM was originally developed by the U.S. Environmental Protection Agency (EPA) is being advanced
|
|
58
|
+
as an open source project by the community to ensure its long-term sustainability.
|
|
59
|
+
|
|
60
|
+
Recent advancements to the SWMM computational engine include a modernized codebase with improved modularity and computational
|
|
61
|
+
efficiency, a well-documented application programming interface (API) for easier integration with third-party applications,
|
|
62
|
+
and Python bindings for enhanced accessibility and usability by the broader community.
|
|
63
|
+
|
|
64
|
+
New process formulations including a spatially explicit overland flow solver, a groundwater transport model,
|
|
65
|
+
and a new low impact development (LID) module have also been added and are being tested.
|
|
66
|
+
|
|
67
|
+
The SWMM source code is written in the C/C++ Programming Language.
|
|
57
68
|
|
|
58
69
|
## Build Status
|
|
59
|
-
[](https://github.com/HydroCouple/Stormwater-Management-Model/issues)
|
|
70
|
+
[](https://github.com/HydroCouple/OpenSWMMCore/actions/workflows/unit_testing.yml?query=branch%3Abug_fixes)
|
|
71
|
+
[](https://github.com/HydroCouple/OpenSWMMCore/actions/workflows/regression_testing.yml?query=branch%3Abug_fixes)
|
|
72
|
+
[](https://github.com/HydroCouple/OpenSWMMCore/actions/workflows/documentation.yml?query=branch%3Abug_fixes)
|
|
73
|
+
[](https://github.com/HydroCouple/OpenSWMMCore/actions/workflows/deployment.yml?query=branch%3Abug_fixes)
|
|
74
|
+
[](https://github.com/HydroCouple/OpenSWMMCore/issues)
|
|
65
75
|
|
|
66
76
|
## Python Binding
|
|
67
77
|
[](https://pypi.org/project/openswmm)
|
|
@@ -72,70 +82,70 @@ Stormwater Management Model (SWMM) computational engine and output post-processi
|
|
|
72
82
|
[](https://pepy.tech/project/openswmm)
|
|
73
83
|
|
|
74
84
|
## Introduction
|
|
75
|
-
This is the official SWMM source code repository maintained by US EPA Office of Research and Development, Center For Environmental Solutions & Emergency Response, Water Infrastructure Division located in Cincinnati, Ohio.
|
|
76
85
|
|
|
77
|
-
|
|
86
|
+
This repository hosts a community-driven, open source initiative to continue development of the SWMM computational engine.
|
|
87
|
+
The project aims to preserve and advance the rich legacy of SWMM by developing high-quality, QA/QC'd, and peer-reviewed
|
|
88
|
+
code while the EPA Office of Research and Development (ORD) is being dissolved. The goal is to build an active community
|
|
89
|
+
around the codebase so it can be sustainably maintained and improved, and to continue collaborating with the agency
|
|
90
|
+
toward future official releases when feasible. This community is actively working with organizations such as
|
|
91
|
+
ASCE's Environmental and Water Resources Institute (EWRI) and Water Environment Federation (WEF) to ensure the
|
|
92
|
+
long-term sustainability of the SWMM codebase.
|
|
93
|
+
|
|
94
|
+
SWMM is a dynamic hydrology-hydraulic water quality simulation model. It is used for single event or long-term
|
|
95
|
+
(continuous) simulation of runoff quantity and quality from primarily urban areas. SWMM source code is written
|
|
96
|
+
in the C Programming Language and released in the Public Domain.
|
|
78
97
|
|
|
79
98
|
## Build Instructions
|
|
80
99
|
|
|
81
100
|
The 'src' folder of this repository contains the C source code for
|
|
82
|
-
version of Storm Water Management Model's computational
|
|
83
|
-
engine.
|
|
84
|
-
the various code modules. The code can be compiled into both a shared
|
|
101
|
+
the current version of Storm Water Management Model's computational
|
|
102
|
+
engine. The code can be compiled into both a shared
|
|
85
103
|
object library and a command line executable. Under Windows, the
|
|
86
|
-
library file (
|
|
104
|
+
library file (openswmmcore.dll) is used to power SWMM's graphical user
|
|
87
105
|
interface.
|
|
88
106
|
|
|
89
107
|
Also included is a python interface for the SWMM computational engine and output
|
|
90
108
|
post-processing application programming interfaces located in the python folder.
|
|
91
109
|
|
|
110
|
+
### Computational Engine
|
|
111
|
+
|
|
92
112
|
The 'CMakeLists.txt' file is a script used by CMake (https://cmake.org/)
|
|
93
113
|
to build the SWMM binaries. CMake is a cross-platform build tool
|
|
94
114
|
that generates platform native build systems for many compilers. To
|
|
95
115
|
check if the required version is installed on your system, enter from
|
|
96
|
-
a console window and check that the version is 3.
|
|
116
|
+
a console window and check that the version is 3.15 or higher.
|
|
97
117
|
|
|
98
118
|
```bash
|
|
99
119
|
cmake --version
|
|
100
120
|
```
|
|
101
121
|
|
|
102
|
-
To build the SWMM engine
|
|
103
|
-
using CMake and the Microsoft Visual Studio C compiler on Windows:
|
|
122
|
+
To build the SWMM engine and related libraries:
|
|
104
123
|
|
|
105
124
|
1. Open a console window and navigate to the directory where this
|
|
106
125
|
Readme file resides (which should have 'src' as a sub-directory
|
|
107
126
|
underneath it).
|
|
108
127
|
|
|
109
|
-
2.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
mkdir build
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
3. Then the following CMake commands to build the binaries:
|
|
128
|
+
2. Then the following CMake commands to build the binaries. Where
|
|
129
|
+
<platform> can either be Windows, Linux, or Darwin. The confurations
|
|
130
|
+
for the platforms can be modified in the CMakePresets.json file.
|
|
116
131
|
|
|
117
132
|
``` bash
|
|
118
|
-
cmake
|
|
119
|
-
cmake --build
|
|
133
|
+
cmake ---preset=<platform>
|
|
134
|
+
cmake --build build --target package
|
|
120
135
|
```
|
|
121
136
|
|
|
122
|
-
|
|
123
|
-
in double quotes (e.g., "Visual Studio 17 2022" for windows, "Ninja" for linux, or "Xcode" for macos). The resulting engine shared libraries (i.e., swmm5.dll), command line executable (i.e., runswmm.exe), and output processing libraries (i.e., swmm-output.dll)
|
|
124
|
-
will appear in the build\Release directory.
|
|
125
|
-
|
|
126
|
-
### Python Bindings (Experimental)
|
|
137
|
+
### Python Bindings
|
|
127
138
|
|
|
128
|
-
|
|
139
|
+
Python bindings for the SWMM API have been developed. _**These bindings are still under development and testing**_.
|
|
140
|
+
The python bindings can be built and installed locally using the following command.
|
|
129
141
|
|
|
130
142
|
```bash
|
|
131
143
|
cd python
|
|
132
144
|
python -m pip install -r requirements.txt
|
|
133
145
|
python -m pip install .
|
|
134
146
|
```
|
|
135
|
-
Users may also build python wheels for installation or distribution.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
Example usage of python bindings can be found below. More extensive documentation will be provided once cleared.
|
|
147
|
+
Users may also build python wheels for installation or distribution. Example usage of python bindings can be
|
|
148
|
+
found below. More extensive documentation will be provided once cleared.
|
|
139
149
|
|
|
140
150
|
```python
|
|
141
151
|
|
|
@@ -150,7 +160,7 @@ with Solver(inp_file="input_file.inp") as swmm_solver:
|
|
|
150
160
|
# Open swmm file and starts the simulation
|
|
151
161
|
swmm_solver.start()
|
|
152
162
|
|
|
153
|
-
# Set initialization parameters e.g., time step stride, start date, end
|
|
163
|
+
# Set initialization parameters e.g., time step stride, start date, end da.te etc.
|
|
154
164
|
swmm_solver.time_stride = 600
|
|
155
165
|
|
|
156
166
|
for elapsed_time, current_datetime in swmm_solver:
|
|
@@ -167,12 +177,15 @@ with Solver(inp_file="input_file.inp") as swmm_solver:
|
|
|
167
177
|
|
|
168
178
|
# Alternative 2 to run SWMM
|
|
169
179
|
swmm_solver = Solver(inp_file="input_file.inp")
|
|
180
|
+
|
|
181
|
+
# Open and start the simulation
|
|
170
182
|
swmm_solver.initialize()
|
|
171
183
|
|
|
172
184
|
for elapsed_time, current_datetime in swmm_solver:
|
|
173
185
|
# Get and set attributes per timestep
|
|
174
186
|
print(current_datetime)
|
|
175
187
|
|
|
188
|
+
|
|
176
189
|
swmm_solver.finalize()
|
|
177
190
|
# or
|
|
178
191
|
# swmm_solver.end()
|
|
@@ -218,11 +231,5 @@ pytest --data-dir <path-to-regression-testing-files> --atol <absolute-tolerance>
|
|
|
218
231
|
```
|
|
219
232
|
|
|
220
233
|
## Find Out More
|
|
221
|
-
The source code distributed here is identical to the code found at the official [SWMM website](https://www.epa.gov/water-research/storm-water-management-model-swmm).
|
|
222
|
-
The SWMM website also hosts the official manuals and installation binaries for the SWMM software.
|
|
223
|
-
|
|
224
|
-
A live web version of the SWMM documentation of the API and user manuals can be found on the [SWMM GitHub Pages website](https://usepa.github.io/Stormwater-Management-Model). Note that this is an experimental version that is still under development and has yet to go through EPA'S official quality assurance review process.
|
|
225
|
-
|
|
226
|
-
## Disclaimer
|
|
227
|
-
The United States Environmental Protection Agency (EPA) GitHub project code is provided on an "as is" basis and the user assumes responsibility for its use. EPA has relinquished control of the information and no longer has responsibility to protect the integrity, confidentiality, or availability of the information. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by EPA. The EPA seal and logo shall not be used in any manner to imply endorsement of any commercial product or activity by EPA or the United States Government.
|
|
228
234
|
|
|
235
|
+
A live web version of the SWMM documentation of the API and user manuals can be found on the [SWMM GitHub Pages website](https://hydrocouple.github.io/OpenSWMMCore). Note that this documentation is experimental and maintained by the community; it has yet to go through formal agency quality assurance review. The project welcomes contributions, review, and collaboration from the community and from agency partners toward future official releases.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
## Stormwater Management Model (SWMM) Open Source Initiative
|
|
2
|
+
|
|
3
|
+
Stormwater Management Model (SWMM) SWMM is a dynamic hydrology-hydraulic water quality simulation model.
|
|
4
|
+
It is used for single event or long-term (continuous) simulation of runoff quantity and quality from primarily
|
|
5
|
+
urban areas. SWMM was originally developed by the U.S. Environmental Protection Agency (EPA) is being advanced
|
|
6
|
+
as an open source project by the community to ensure its long-term sustainability.
|
|
7
|
+
|
|
8
|
+
Recent advancements to the SWMM computational engine include a modernized codebase with improved modularity and computational
|
|
9
|
+
efficiency, a well-documented application programming interface (API) for easier integration with third-party applications,
|
|
10
|
+
and Python bindings for enhanced accessibility and usability by the broader community.
|
|
11
|
+
|
|
12
|
+
New process formulations including a spatially explicit overland flow solver, a groundwater transport model,
|
|
13
|
+
and a new low impact development (LID) module have also been added and are being tested.
|
|
14
|
+
|
|
15
|
+
The SWMM source code is written in the C/C++ Programming Language.
|
|
16
|
+
|
|
17
|
+
## Build Status
|
|
18
|
+
[](https://github.com/HydroCouple/OpenSWMMCore/actions/workflows/unit_testing.yml?query=branch%3Abug_fixes)
|
|
19
|
+
[](https://github.com/HydroCouple/OpenSWMMCore/actions/workflows/regression_testing.yml?query=branch%3Abug_fixes)
|
|
20
|
+
[](https://github.com/HydroCouple/OpenSWMMCore/actions/workflows/documentation.yml?query=branch%3Abug_fixes)
|
|
21
|
+
[](https://github.com/HydroCouple/OpenSWMMCore/actions/workflows/deployment.yml?query=branch%3Abug_fixes)
|
|
22
|
+
[](https://github.com/HydroCouple/OpenSWMMCore/issues)
|
|
23
|
+
|
|
24
|
+
## Python Binding
|
|
25
|
+
[](https://pypi.org/project/openswmm)
|
|
26
|
+
[](https://pypi.org/project/openswmm)
|
|
27
|
+
[](https://pypi.org/project/openswmm)
|
|
28
|
+
[](https://pepy.tech/project/openswmm)
|
|
29
|
+
[](https://pepy.tech/project/openswmm)
|
|
30
|
+
[](https://pepy.tech/project/openswmm)
|
|
31
|
+
|
|
32
|
+
## Introduction
|
|
33
|
+
|
|
34
|
+
This repository hosts a community-driven, open source initiative to continue development of the SWMM computational engine.
|
|
35
|
+
The project aims to preserve and advance the rich legacy of SWMM by developing high-quality, QA/QC'd, and peer-reviewed
|
|
36
|
+
code while the EPA Office of Research and Development (ORD) is being dissolved. The goal is to build an active community
|
|
37
|
+
around the codebase so it can be sustainably maintained and improved, and to continue collaborating with the agency
|
|
38
|
+
toward future official releases when feasible. This community is actively working with organizations such as
|
|
39
|
+
ASCE's Environmental and Water Resources Institute (EWRI) and Water Environment Federation (WEF) to ensure the
|
|
40
|
+
long-term sustainability of the SWMM codebase.
|
|
41
|
+
|
|
42
|
+
SWMM is a dynamic hydrology-hydraulic water quality simulation model. It is used for single event or long-term
|
|
43
|
+
(continuous) simulation of runoff quantity and quality from primarily urban areas. SWMM source code is written
|
|
44
|
+
in the C Programming Language and released in the Public Domain.
|
|
45
|
+
|
|
46
|
+
## Build Instructions
|
|
47
|
+
|
|
48
|
+
The 'src' folder of this repository contains the C source code for
|
|
49
|
+
the current version of Storm Water Management Model's computational
|
|
50
|
+
engine. The code can be compiled into both a shared
|
|
51
|
+
object library and a command line executable. Under Windows, the
|
|
52
|
+
library file (openswmmcore.dll) is used to power SWMM's graphical user
|
|
53
|
+
interface.
|
|
54
|
+
|
|
55
|
+
Also included is a python interface for the SWMM computational engine and output
|
|
56
|
+
post-processing application programming interfaces located in the python folder.
|
|
57
|
+
|
|
58
|
+
### Computational Engine
|
|
59
|
+
|
|
60
|
+
The 'CMakeLists.txt' file is a script used by CMake (https://cmake.org/)
|
|
61
|
+
to build the SWMM binaries. CMake is a cross-platform build tool
|
|
62
|
+
that generates platform native build systems for many compilers. To
|
|
63
|
+
check if the required version is installed on your system, enter from
|
|
64
|
+
a console window and check that the version is 3.15 or higher.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
cmake --version
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
To build the SWMM engine and related libraries:
|
|
71
|
+
|
|
72
|
+
1. Open a console window and navigate to the directory where this
|
|
73
|
+
Readme file resides (which should have 'src' as a sub-directory
|
|
74
|
+
underneath it).
|
|
75
|
+
|
|
76
|
+
2. Then the following CMake commands to build the binaries. Where
|
|
77
|
+
<platform> can either be Windows, Linux, or Darwin. The confurations
|
|
78
|
+
for the platforms can be modified in the CMakePresets.json file.
|
|
79
|
+
|
|
80
|
+
``` bash
|
|
81
|
+
cmake ---preset=<platform>
|
|
82
|
+
cmake --build build --target package
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Python Bindings
|
|
86
|
+
|
|
87
|
+
Python bindings for the SWMM API have been developed. _**These bindings are still under development and testing**_.
|
|
88
|
+
The python bindings can be built and installed locally using the following command.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cd python
|
|
92
|
+
python -m pip install -r requirements.txt
|
|
93
|
+
python -m pip install .
|
|
94
|
+
```
|
|
95
|
+
Users may also build python wheels for installation or distribution. Example usage of python bindings can be
|
|
96
|
+
found below. More extensive documentation will be provided once cleared.
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
|
|
100
|
+
from openswmmcore import solver
|
|
101
|
+
from openswmmcore.solver import Solver
|
|
102
|
+
from openswmmcore.output import Output
|
|
103
|
+
|
|
104
|
+
# Alternative 1 to run SWMM
|
|
105
|
+
|
|
106
|
+
with Solver(inp_file="input_file.inp") as swmm_solver:
|
|
107
|
+
|
|
108
|
+
# Open swmm file and starts the simulation
|
|
109
|
+
swmm_solver.start()
|
|
110
|
+
|
|
111
|
+
# Set initialization parameters e.g., time step stride, start date, end da.te etc.
|
|
112
|
+
swmm_solver.time_stride = 600
|
|
113
|
+
|
|
114
|
+
for elapsed_time, current_datetime in swmm_solver:
|
|
115
|
+
|
|
116
|
+
# Get and set attributes per timestep
|
|
117
|
+
print(current_datetime)
|
|
118
|
+
|
|
119
|
+
swmm_solver.set_value(
|
|
120
|
+
object_type=solver.SWMMObjects.RAIN_GAGE,
|
|
121
|
+
property_type=solver.SWMMRainGageProperties.GAGE_RAINFALL,
|
|
122
|
+
index="RG1",
|
|
123
|
+
value=3.6
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Alternative 2 to run SWMM
|
|
127
|
+
swmm_solver = Solver(inp_file="input_file.inp")
|
|
128
|
+
|
|
129
|
+
# Open and start the simulation
|
|
130
|
+
swmm_solver.initialize()
|
|
131
|
+
|
|
132
|
+
for elapsed_time, current_datetime in swmm_solver:
|
|
133
|
+
# Get and set attributes per timestep
|
|
134
|
+
print(current_datetime)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
swmm_solver.finalize()
|
|
138
|
+
# or
|
|
139
|
+
# swmm_solver.end()
|
|
140
|
+
# swmm_solver.report()
|
|
141
|
+
# swmm_solver.close()
|
|
142
|
+
|
|
143
|
+
# Alternative 3 to run SWMM
|
|
144
|
+
swmm_solver = Solver(inp_file="input_file.inp")
|
|
145
|
+
swmm_solver.execute()
|
|
146
|
+
|
|
147
|
+
# To read output file
|
|
148
|
+
|
|
149
|
+
swmm_output = Output(output_file='output_file.out')
|
|
150
|
+
|
|
151
|
+
# Dict[datetime, float]
|
|
152
|
+
link_timeseries = swmm_output.get_link_timeseries(
|
|
153
|
+
element_index="C1",
|
|
154
|
+
attribute=output.LinkAttribute.FLOW_RATE,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Unit and Regression Testing
|
|
160
|
+
|
|
161
|
+
Unit tests and regression tests have been developed for both the natively compiled SWMM computational engine and output toolkit as well as their respective python bindings. Unit tests for the natively compiled toolkits use the Boost 1.67.0 library and can be compiled by adding DBUILD_TESTS=ON flag during the cmake build phase as shown below:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
ctest --test-dir . -DBUILD_TESTS=ON --config Debug --output-on-failure
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Unit testing on the python bindings may be executed using the following command after installation.
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
cd python\tests
|
|
171
|
+
pytest .
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Regression tests are executed using the python bindings using the pytest and pytest-regressions extension using the following commands.
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
cd ci
|
|
178
|
+
pytest --data-dir <path-to-regression-testing-files> --atol <absolute-tolerance> --rtol <relative-tolerance> --benchmark-compare --benchmark-json=PATH
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Find Out More
|
|
182
|
+
|
|
183
|
+
A live web version of the SWMM documentation of the API and user manuals can be found on the [SWMM GitHub Pages website](https://hydrocouple.github.io/OpenSWMMCore). Note that this documentation is experimental and maintained by the community; it has yet to go through formal agency quality assurance review. The project welcomes contributions, review, and collaboration from the community and from agency partners toward future official releases.
|
|
@@ -70,7 +70,7 @@ def get_cmake_args():
|
|
|
70
70
|
|
|
71
71
|
# def get_version(qualifier: str = 'dev0'):
|
|
72
72
|
# """Extract version from version.h file"""
|
|
73
|
-
# version_file = os.path.join(here, "../
|
|
73
|
+
# version_file = os.path.join(here, "../solver/version.h")
|
|
74
74
|
# with open(version_file, 'r') as f:
|
|
75
75
|
# content = f.read()
|
|
76
76
|
# major = re.search(r'#define OPENSWMM_VERSION_MAJOR (\d+)', content).group(1)
|
|
@@ -89,7 +89,7 @@ setup(
|
|
|
89
89
|
long_description=get_readme(),
|
|
90
90
|
long_description_content_type="text/markdown",
|
|
91
91
|
packages=find_packages(),
|
|
92
|
-
version="5.3.0.
|
|
92
|
+
version="5.3.0.dev1",
|
|
93
93
|
cmake_args=[
|
|
94
94
|
*get_cmake_args(),
|
|
95
95
|
],
|
openswmm-5.3.0.dev0/README.md
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
EPA ORD Stormwater Management Model (SWMM)
|
|
2
|
-
==========================================
|
|
3
|
-
|
|
4
|
-
Stormwater Management Model (SWMM) computational engine and output post-processing codebase
|
|
5
|
-
|
|
6
|
-
## Build Status
|
|
7
|
-
[](https://github.com/HydroCouple/Stormwater-Management-Model/actions/workflows/unit_testing.yml)
|
|
8
|
-
[](https://github.com/HydroCouple/Stormwater-Management-Model/actions/workflows/regression_testing.yml)
|
|
9
|
-
[](https://github.com/HydroCouple/Stormwater-Management-Model/actions/workflows/build_docs.yml)
|
|
10
|
-
[](https://github.com/HydroCouple/Stormwater-Management-Model/actions/workflows/deploy.yml)
|
|
11
|
-
[](https://github.com/HydroCouple/Stormwater-Management-Model/actions/workflows/build-and-test.yml)
|
|
12
|
-
[](https://github.com/HydroCouple/Stormwater-Management-Model/issues)
|
|
13
|
-
|
|
14
|
-
## Python Binding
|
|
15
|
-
[](https://pypi.org/project/openswmm)
|
|
16
|
-
[](https://pypi.org/project/openswmm)
|
|
17
|
-
[](https://pypi.org/project/openswmm)
|
|
18
|
-
[](https://pepy.tech/project/openswmm)
|
|
19
|
-
[](https://pepy.tech/project/openswmm)
|
|
20
|
-
[](https://pepy.tech/project/openswmm)
|
|
21
|
-
|
|
22
|
-
## Introduction
|
|
23
|
-
This is the official SWMM source code repository maintained by US EPA Office of Research and Development, Center For Environmental Solutions & Emergency Response, Water Infrastructure Division located in Cincinnati, Ohio.
|
|
24
|
-
|
|
25
|
-
SWMM is a dynamic hydrology-hydraulic water quality simulation model. It is used for single event or long-term (continuous) simulation of runoff quantity and quality from primarily urban areas. SWMM source code is written in the C Programming Language and released in the Public Domain.
|
|
26
|
-
|
|
27
|
-
## Build Instructions
|
|
28
|
-
|
|
29
|
-
The 'src' folder of this repository contains the C source code for
|
|
30
|
-
version of Storm Water Management Model's computational
|
|
31
|
-
engine. Consult the included 'Roadmap.txt' file for an overview of
|
|
32
|
-
the various code modules. The code can be compiled into both a shared
|
|
33
|
-
object library and a command line executable. Under Windows, the
|
|
34
|
-
library file (swmm5.dll) is used to power SWMM's graphical user
|
|
35
|
-
interface.
|
|
36
|
-
|
|
37
|
-
Also included is a python interface for the SWMM computational engine and output
|
|
38
|
-
post-processing application programming interfaces located in the python folder.
|
|
39
|
-
|
|
40
|
-
The 'CMakeLists.txt' file is a script used by CMake (https://cmake.org/)
|
|
41
|
-
to build the SWMM binaries. CMake is a cross-platform build tool
|
|
42
|
-
that generates platform native build systems for many compilers. To
|
|
43
|
-
check if the required version is installed on your system, enter from
|
|
44
|
-
a console window and check that the version is 3.5 or higher.
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
cmake --version
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
To build the SWMM engine library and its command line executable
|
|
51
|
-
using CMake and the Microsoft Visual Studio C compiler on Windows:
|
|
52
|
-
|
|
53
|
-
1. Open a console window and navigate to the directory where this
|
|
54
|
-
Readme file resides (which should have 'src' as a sub-directory
|
|
55
|
-
underneath it).
|
|
56
|
-
|
|
57
|
-
2. Use the following command to create the directory for storing the built binaries:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
mkdir build
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
3. Then the following CMake commands to build the binaries:
|
|
64
|
-
|
|
65
|
-
``` bash
|
|
66
|
-
cmake -G <compiler> -B build
|
|
67
|
-
cmake --build ./build --config Release
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
where `<compiler>` is the name of the compiler being used
|
|
71
|
-
in double quotes (e.g., "Visual Studio 17 2022" for windows, "Ninja" for linux, or "Xcode" for macos). The resulting engine shared libraries (i.e., swmm5.dll), command line executable (i.e., runswmm.exe), and output processing libraries (i.e., swmm-output.dll)
|
|
72
|
-
will appear in the build\Release directory.
|
|
73
|
-
|
|
74
|
-
### Python Bindings (Experimental)
|
|
75
|
-
|
|
76
|
-
Experimental python bindings for the SWMM API are being developed to support regression and benchmark testing as well as for other applications. _**These bindings are still under development and testing and has yet to be cleared through US EPA ORD's official quality assurance review process**_. The exprimental python bindings can be built and installed locally using the following command.
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
cd python
|
|
80
|
-
python -m pip install -r requirements.txt
|
|
81
|
-
python -m pip install .
|
|
82
|
-
```
|
|
83
|
-
Users may also build python wheels for installation or distribution. Once the python bindings
|
|
84
|
-
have been validated and cleared through EPA's quality assuracnce clearance process, they will be available for installation via package indexing repositories such as pypi.
|
|
85
|
-
|
|
86
|
-
Example usage of python bindings can be found below. More extensive documentation will be provided once cleared.
|
|
87
|
-
|
|
88
|
-
```python
|
|
89
|
-
|
|
90
|
-
from openswmmcore import solver
|
|
91
|
-
from openswmmcore.solver import Solver
|
|
92
|
-
from openswmmcore.output import Output
|
|
93
|
-
|
|
94
|
-
# Alternative 1 to run SWMM
|
|
95
|
-
|
|
96
|
-
with Solver(inp_file="input_file.inp") as swmm_solver:
|
|
97
|
-
|
|
98
|
-
# Open swmm file and starts the simulation
|
|
99
|
-
swmm_solver.start()
|
|
100
|
-
|
|
101
|
-
# Set initialization parameters e.g., time step stride, start date, end date etc.
|
|
102
|
-
swmm_solver.time_stride = 600
|
|
103
|
-
|
|
104
|
-
for elapsed_time, current_datetime in swmm_solver:
|
|
105
|
-
|
|
106
|
-
# Get and set attributes per timestep
|
|
107
|
-
print(current_datetime)
|
|
108
|
-
|
|
109
|
-
swmm_solver.set_value(
|
|
110
|
-
object_type=solver.SWMMObjects.RAIN_GAGE,
|
|
111
|
-
property_type=solver.SWMMRainGageProperties.GAGE_RAINFALL,
|
|
112
|
-
index="RG1",
|
|
113
|
-
value=3.6
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
# Alternative 2 to run SWMM
|
|
117
|
-
swmm_solver = Solver(inp_file="input_file.inp")
|
|
118
|
-
swmm_solver.initialize()
|
|
119
|
-
|
|
120
|
-
for elapsed_time, current_datetime in swmm_solver:
|
|
121
|
-
# Get and set attributes per timestep
|
|
122
|
-
print(current_datetime)
|
|
123
|
-
|
|
124
|
-
swmm_solver.finalize()
|
|
125
|
-
# or
|
|
126
|
-
# swmm_solver.end()
|
|
127
|
-
# swmm_solver.report()
|
|
128
|
-
# swmm_solver.close()
|
|
129
|
-
|
|
130
|
-
# Alternative 3 to run SWMM
|
|
131
|
-
swmm_solver = Solver(inp_file="input_file.inp")
|
|
132
|
-
swmm_solver.execute()
|
|
133
|
-
|
|
134
|
-
# To read output file
|
|
135
|
-
|
|
136
|
-
swmm_output = Output(output_file='output_file.out')
|
|
137
|
-
|
|
138
|
-
# Dict[datetime, float]
|
|
139
|
-
link_timeseries = swmm_output.get_link_timeseries(
|
|
140
|
-
element_index="C1",
|
|
141
|
-
attribute=output.LinkAttribute.FLOW_RATE,
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## Unit and Regression Testing
|
|
147
|
-
|
|
148
|
-
Unit tests and regression tests have been developed for both the natively compiled SWMM computational engine and output toolkit as well as their respective python bindings. Unit tests for the natively compiled toolkits use the Boost 1.67.0 library and can be compiled by adding DBUILD_TESTS=ON flag during the cmake build phase as shown below:
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
ctest --test-dir . -DBUILD_TESTS=ON --config Debug --output-on-failure
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
Unit testing on the python bindings may be executed using the following command after installation.
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
cd python\tests
|
|
158
|
-
pytest .
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Regression tests are executed using the python bindings using the pytest and pytest-regressions extension using the following commands.
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
cd ci
|
|
165
|
-
pytest --data-dir <path-to-regression-testing-files> --atol <absolute-tolerance> --rtol <relative-tolerance> --benchmark-compare --benchmark-json=PATH
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Find Out More
|
|
169
|
-
The source code distributed here is identical to the code found at the official [SWMM website](https://www.epa.gov/water-research/storm-water-management-model-swmm).
|
|
170
|
-
The SWMM website also hosts the official manuals and installation binaries for the SWMM software.
|
|
171
|
-
|
|
172
|
-
A live web version of the SWMM documentation of the API and user manuals can be found on the [SWMM GitHub Pages website](https://usepa.github.io/Stormwater-Management-Model). Note that this is an experimental version that is still under development and has yet to go through EPA'S official quality assurance review process.
|
|
173
|
-
|
|
174
|
-
## Disclaimer
|
|
175
|
-
The United States Environmental Protection Agency (EPA) GitHub project code is provided on an "as is" basis and the user assumes responsibility for its use. EPA has relinquished control of the information and no longer has responsibility to protect the integrity, confidentiality, or availability of the information. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by EPA. The EPA seal and logo shall not be used in any manner to imply endorsement of any commercial product or activity by EPA or the United States Government.
|
|
176
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|