openswmm 5.3.0.dev0__py3-none-any.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.
- openswmm/CMakeLists.txt +31 -0
- openswmm/__init__.py +42 -0
- openswmm/_openswmm.pyx +12 -0
- openswmm/data/__init__.py +0 -0
- openswmm/gym/__init__.py +0 -0
- openswmm/openswmm.pxd +10 -0
- openswmm/output/CMakeLists.txt +45 -0
- openswmm/output/__init__.pxd +1 -0
- openswmm/output/__init__.py +13 -0
- openswmm/output/_output.pyi +732 -0
- openswmm/output/_output.pyx +1557 -0
- openswmm/output/output.pxd +368 -0
- openswmm/solver/CMakeLists.txt +50 -0
- openswmm/solver/__init__.pxd +1 -0
- openswmm/solver/__init__.py +22 -0
- openswmm/solver/_solver.pyi +1012 -0
- openswmm/solver/_solver.pyx +1646 -0
- openswmm/solver/solver.pxd +356 -0
- openswmm-5.3.0.dev0.dist-info/METADATA +228 -0
- openswmm-5.3.0.dev0.dist-info/RECORD +36 -0
- openswmm-5.3.0.dev0.dist-info/WHEEL +5 -0
- openswmm-5.3.0.dev0.dist-info/licenses/LICENSE +12 -0
- openswmm-5.3.0.dev0.dist-info/top_level.txt +2 -0
- tests/.DS_Store +0 -0
- tests/__init__.py +3 -0
- tests/data/.DS_Store +0 -0
- tests/data/__init__.py +3 -0
- tests/data/output/__init__.py +22 -0
- tests/data/output/example_output_1.out +0 -0
- tests/data/output/json_time_series.pickle +0 -0
- tests/data/solver/__init__.py +17 -0
- tests/data/solver/non_existent_input_file.rpt +2387 -0
- tests/data/solver/site_drainage_example.inp +499 -0
- tests/data/solver/site_drainage_example.rpt +354 -0
- tests/test_swmm_solver.py +716 -0
- tests/test_swwm_output.py +1048 -0
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
# Description: Cython module for openswmmcore output file processing and data extraction functions for the openswmmcore python package.
|
|
2
|
+
# Created by: Caleb Buahin (EPA/ORD/CESER/WID)
|
|
3
|
+
# Created on: 2024-11-19
|
|
4
|
+
|
|
5
|
+
# cython: language_level=3
|
|
6
|
+
# SWMM datetime encode decoder functions (not very elegant/need to fix later)
|
|
7
|
+
# cdef extern from "datetime.h"
|
|
8
|
+
|
|
9
|
+
# SWMM output enumeration types.
|
|
10
|
+
cdef extern from "openswmm_output_enums.h":
|
|
11
|
+
|
|
12
|
+
# Unit system used in the output file
|
|
13
|
+
ctypedef enum SMO_unitSystem:
|
|
14
|
+
SMO_US # US customary units
|
|
15
|
+
SMO_SI # SI metric units
|
|
16
|
+
|
|
17
|
+
# Flow units used in the simulation
|
|
18
|
+
ctypedef enum SMO_flowUnits:
|
|
19
|
+
SMO_CFS # Cubic feet per second
|
|
20
|
+
SMO_GPM # Gallons per minute
|
|
21
|
+
SMO_MGD # Million gallons per day
|
|
22
|
+
SMO_CMS # Cubic meters per second
|
|
23
|
+
SMO_LPS # Liters per second
|
|
24
|
+
SMO_MLD # Million liters per day
|
|
25
|
+
|
|
26
|
+
# Concentration units used in the simulation
|
|
27
|
+
ctypedef enum SMO_concUnits:
|
|
28
|
+
SMO_MG # Milligrams per liter
|
|
29
|
+
SMO_UG # Micrograms per liter
|
|
30
|
+
SMO_COUNT # Counts per liter
|
|
31
|
+
SMO_NONE # No units
|
|
32
|
+
|
|
33
|
+
# SWMM element types
|
|
34
|
+
ctypedef enum SMO_elementType:
|
|
35
|
+
SMO_subcatch # Subcatchment
|
|
36
|
+
SMO_node # Node
|
|
37
|
+
SMO_link # Link
|
|
38
|
+
SMO_sys # System
|
|
39
|
+
SMO_pollut # Pollutant
|
|
40
|
+
|
|
41
|
+
# Report time related attributes
|
|
42
|
+
ctypedef enum SMO_time:
|
|
43
|
+
SMO_reportStep # Report step size (seconds)
|
|
44
|
+
SMO_numPeriods # Number of reporting periods
|
|
45
|
+
|
|
46
|
+
# Subcatchment attributes
|
|
47
|
+
ctypedef enum SMO_subcatchAttribute:
|
|
48
|
+
SMO_rainfall_subcatch # Subcatchment rainfall (in/hr or mm/hr)
|
|
49
|
+
SMO_snow_depth_subcatch # Subcatchment snow depth (in or mm)
|
|
50
|
+
SMO_evap_loss # Subcatchment evaporation loss (in/hr or mm/hr)
|
|
51
|
+
SMO_infil_loss # Subcatchment infiltration loss (in/hr or mm/hr)
|
|
52
|
+
SMO_runoff_rate # Subcatchment runoff flow (flow units)
|
|
53
|
+
SMO_gwoutflow_rate # Subcatchment groundwater flow (flow units)
|
|
54
|
+
SMO_gwtable_elev # Subcatchment groundwater elevation (ft or m)
|
|
55
|
+
SMO_soil_moisture # Subcatchment soil moisture content (-)
|
|
56
|
+
SMO_pollutant_conc_subcatch # Subcatchment pollutant concentration (-)
|
|
57
|
+
|
|
58
|
+
# Node attributes
|
|
59
|
+
ctypedef enum SMO_nodeAttribute:
|
|
60
|
+
SMO_invert_depth # Node depth above invert (ft or m)
|
|
61
|
+
SMO_hydraulic_head # Node hydraulic head (ft or m)
|
|
62
|
+
SMO_stored_ponded_volume # Node volume stored (ft3 or m3)
|
|
63
|
+
SMO_lateral_inflow # Node lateral inflow (flow units)
|
|
64
|
+
SMO_total_inflow # Node total inflow (flow units)
|
|
65
|
+
SMO_flooding_losses # Node flooding losses (flow units)
|
|
66
|
+
SMO_pollutant_conc_node # Node pollutant concentration (-)
|
|
67
|
+
|
|
68
|
+
# Link attributes
|
|
69
|
+
ctypedef enum SMO_linkAttribute:
|
|
70
|
+
SMO_flow_rate_link # Link flow rate (flow units)
|
|
71
|
+
SMO_flow_depth # Link flow depth (ft or m)
|
|
72
|
+
SMO_flow_velocity # Link flow velocity (ft/s or m/s)
|
|
73
|
+
SMO_flow_volume # Link flow volume (ft3 or m3)
|
|
74
|
+
SMO_capacity # Link capacity (fraction of conduit filled)
|
|
75
|
+
SMO_pollutant_conc_link # Link pollutant concentration (-)
|
|
76
|
+
|
|
77
|
+
# System attributes
|
|
78
|
+
ctypedef enum SMO_systemAttribute:
|
|
79
|
+
SMO_air_temp # Air temperature (deg. F or deg. C)
|
|
80
|
+
SMO_rainfall_system # Rainfall intensity (in/hr or mm/hr)
|
|
81
|
+
SMO_snow_depth_system # Snow depth (in or mm)
|
|
82
|
+
SMO_evap_infil_loss # Evaporation and infiltration loss rate (in/day or mm/day)
|
|
83
|
+
SMO_runoff_flow # Runoff flow (flow units)
|
|
84
|
+
SMO_dry_weather_inflow # Dry weather inflow (flow units)
|
|
85
|
+
SMO_groundwater_inflow # Groundwater inflow (flow units)
|
|
86
|
+
SMO_RDII_inflow # Rainfall Derived Infiltration and Inflow (RDII) (flow units)
|
|
87
|
+
SMO_direct_inflow # Direct inflow (flow units)
|
|
88
|
+
SMO_total_lateral_inflow # Total lateral inflow; sum of variables 4 to 8 (flow units)
|
|
89
|
+
SMO_flood_losses # Flooding losses (flow units)
|
|
90
|
+
SMO_outfall_flows # Outfall flow (flow units)
|
|
91
|
+
SMO_volume_stored # Volume stored in storage nodes (ft3 or m3)
|
|
92
|
+
SMO_evap_rate # Evaporation rate (in/day or mm/day)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# SWMM Output API functions
|
|
96
|
+
cdef extern from "openswmm_output.h":
|
|
97
|
+
|
|
98
|
+
# Opaque pointer to struct. Do not access variables.
|
|
99
|
+
ctypedef void* SMO_Handle
|
|
100
|
+
|
|
101
|
+
# Maximum length of a file name
|
|
102
|
+
cdef const int MAXFILENAME
|
|
103
|
+
|
|
104
|
+
# Maximum length of an element name
|
|
105
|
+
cdef const int MAXELENAME
|
|
106
|
+
|
|
107
|
+
# Initializes the SWMM output file handle
|
|
108
|
+
# p_handle: Pointer to a SMO_Handle
|
|
109
|
+
# Returns: Error code 0 if successful or -1 if an error occurs
|
|
110
|
+
int SMO_init(SMO_Handle *p_handle)
|
|
111
|
+
|
|
112
|
+
# Closes the SWMM output file handle
|
|
113
|
+
# p_handle: Pointer to a SMO_Handle
|
|
114
|
+
# Returns: Error code 0 if successful or -1 if an error occurs
|
|
115
|
+
int SMO_close(SMO_Handle *p_handle)
|
|
116
|
+
|
|
117
|
+
# Opens a SWMM output file
|
|
118
|
+
# p_handle: Pointer to a SMO_Handle
|
|
119
|
+
# path: Path to the SWMM output file
|
|
120
|
+
# Returns: Error code
|
|
121
|
+
int SMO_open(SMO_Handle p_handle, const char *path)
|
|
122
|
+
|
|
123
|
+
# Retrieves the model version number that created the output file
|
|
124
|
+
# p_handle: Pointer to a SMO_Handle
|
|
125
|
+
# version: Pointer to the version number
|
|
126
|
+
# Returns: Error code
|
|
127
|
+
int SMO_getVersion(SMO_Handle p_handle, int *version)
|
|
128
|
+
|
|
129
|
+
# Retrieves the number of elements in the SWMM model
|
|
130
|
+
# p_handle: Pointer to a SMO_Handle
|
|
131
|
+
# elementCount: Pointer to the number of elements
|
|
132
|
+
# length: Pointer to the length of the elementCount array
|
|
133
|
+
# Returns: Error code
|
|
134
|
+
int SMO_getProjectSize(SMO_Handle p_handle, int **elementCount, int *length)
|
|
135
|
+
|
|
136
|
+
# Retrieves the unit system used in the SWMM model
|
|
137
|
+
# p_handle: Pointer to a SMO_Handle
|
|
138
|
+
# unitSystem: Pointer to the unit system
|
|
139
|
+
# Returns: Error code
|
|
140
|
+
int SMO_getUnits(SMO_Handle p_handle, int **unitFlag, int *length)
|
|
141
|
+
|
|
142
|
+
# Retrieves the flow units used in the SWMM model
|
|
143
|
+
# p_handle: Pointer to a SMO_Handle
|
|
144
|
+
# unitFlag: Pointer to the flow units
|
|
145
|
+
# Returns: Error code
|
|
146
|
+
int SMO_getFlowUnits(SMO_Handle p_handle, int *unitFlag)
|
|
147
|
+
|
|
148
|
+
# Retrieves the pollutant units used in the SWMM model
|
|
149
|
+
# p_handle: Pointer to a SMO_Handle
|
|
150
|
+
# unitFlag: Pointer to the pollutant units
|
|
151
|
+
# length: Pointer to the length of the unitFlag array
|
|
152
|
+
# Returns: Error code
|
|
153
|
+
int SMO_getPollutantUnits(SMO_Handle p_handle, int **unitFlag, int *length)
|
|
154
|
+
|
|
155
|
+
# Retrieves the start date of the simulation
|
|
156
|
+
# p_handle: Pointer to a SMO_Handle
|
|
157
|
+
# date: Pointer to the start date
|
|
158
|
+
# Returns: Error code
|
|
159
|
+
int SMO_getStartDate(SMO_Handle p_handle, double *date)
|
|
160
|
+
|
|
161
|
+
# Retrieves the number of reporting periods in the simulation
|
|
162
|
+
# p_handle: Pointer to a SMO_Handle
|
|
163
|
+
# code: The type of reporting attribute to retrieve
|
|
164
|
+
# time: Pointer to the reporting attribute value
|
|
165
|
+
# Returns: Error code
|
|
166
|
+
int SMO_getTimes(SMO_Handle p_handle, int code, int *time)
|
|
167
|
+
|
|
168
|
+
# Retrieves the element name
|
|
169
|
+
# p_handle: Pointer to a SMO_Handle
|
|
170
|
+
# type: The type of element
|
|
171
|
+
# elementIndex: The index of the element
|
|
172
|
+
# elementName: Pointer to the element name
|
|
173
|
+
# size: Pointer to the size of the elementName array
|
|
174
|
+
# Returns: Error code
|
|
175
|
+
int SMO_getElementName(SMO_Handle p_handle, int type, int elementIndex, char **elementName, int *size)
|
|
176
|
+
|
|
177
|
+
# Retrieves the number of attributes for a given element type
|
|
178
|
+
# p_handle: Pointer to a SMO_Handle
|
|
179
|
+
# type: The type of element
|
|
180
|
+
# count: Pointer to the number of attributes
|
|
181
|
+
# Returns: Error code
|
|
182
|
+
int SMO_getNumVars(SMO_Handle p_handle, SMO_elementType type, int *count)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
# Retrieves the attribute code for a given element type and attribute index
|
|
186
|
+
# p_handle: Pointer to a SMO_Handle
|
|
187
|
+
# type: The type of element
|
|
188
|
+
# varIndex: The index of the attribute
|
|
189
|
+
# Returns: The attribute code
|
|
190
|
+
int SMO_getVarCode(SMO_Handle p_handle, SMO_elementType type, int varIndex, int *varCode)
|
|
191
|
+
|
|
192
|
+
# Retrieves the attribute codes for a given element type
|
|
193
|
+
# p_handle: Pointer to a SMO_Handle
|
|
194
|
+
# type: The type of element
|
|
195
|
+
# varCodes: Pointer to the attribute codes
|
|
196
|
+
# size: Pointer to the size of the varCodes array
|
|
197
|
+
# Returns: Error code
|
|
198
|
+
int SMO_getVarCodes(SMO_Handle p_handle, SMO_elementType type, int **varCodes, int *size)
|
|
199
|
+
|
|
200
|
+
# Retrieves the number of properties for a given element type
|
|
201
|
+
# p_handle: Pointer to a SMO_Handle
|
|
202
|
+
# type: The type of element
|
|
203
|
+
# count: Pointer to the number of properties
|
|
204
|
+
# Returns: Error code
|
|
205
|
+
int SMO_getNumProperties(SMO_Handle p_handle, SMO_elementType type, int *count)
|
|
206
|
+
|
|
207
|
+
# Retrieves the property code for a given element type and property index
|
|
208
|
+
# p_handle: Pointer to a SMO_Handle
|
|
209
|
+
# type: The type of element
|
|
210
|
+
# propertyIndex: The index of the property
|
|
211
|
+
# propertyCode: Pointer to the property code
|
|
212
|
+
# Returns: The property code
|
|
213
|
+
int SMO_getPropertyCode(SMO_Handle p_handle, SMO_elementType type, int propertyIndex, int *propertyCode)
|
|
214
|
+
|
|
215
|
+
# Retrieves the property codes for a given element type
|
|
216
|
+
# p_handle: Pointer to a SMO_Handle
|
|
217
|
+
# type: The type of element
|
|
218
|
+
# propertyCodes: Pointer to the property codes
|
|
219
|
+
# size: Pointer to the size of the propertyCodes array
|
|
220
|
+
# Returns: Error code
|
|
221
|
+
int SMO_getPropertyCodes(SMO_Handle p_handle, SMO_elementType type, int **propertyCodes, int *size)
|
|
222
|
+
|
|
223
|
+
# Retrieves the property value for a given element type, property index, and element index
|
|
224
|
+
# p_handle: Pointer to a SMO_Handle
|
|
225
|
+
# type: The type of element
|
|
226
|
+
# propertyIndex: The index of the property
|
|
227
|
+
# elementIndex: The index of the element
|
|
228
|
+
# value: Pointer to the property value
|
|
229
|
+
int SMO_getPropertyValue(SMO_Handle p_handle, SMO_elementType type, int propertyIndex, int elementIndex, float *value)
|
|
230
|
+
|
|
231
|
+
# Retrieves the property values for a given element type, property index, and element index
|
|
232
|
+
# p_handle: Pointer to a SMO_Handle
|
|
233
|
+
# type: The type of element
|
|
234
|
+
# propertyIndex: The index of the property
|
|
235
|
+
# elementIndex: The index of the element
|
|
236
|
+
# outValueArray: Pointer to the property values
|
|
237
|
+
# length: Pointer to the length of the outValueArray array
|
|
238
|
+
# Returns: Error code
|
|
239
|
+
int SMO_getPropertyValues(SMO_Handle p_handle, SMO_elementType type, int elementIndex, float **outValueArray, int *length)
|
|
240
|
+
|
|
241
|
+
# Retrieves subcatchment attribute values for a given time period and attribute type
|
|
242
|
+
# p_handle: Pointer to a SMO_Handle
|
|
243
|
+
# subcatchIndex: The index of the subcatchment
|
|
244
|
+
# attr: The subcatchment attribute type to retrieve
|
|
245
|
+
# startPeriod: The starting time period to retrieve data from
|
|
246
|
+
# endPeriod: The ending time period to retrieve data from
|
|
247
|
+
# outValueArray: Pointer to the subcatchment attribute values
|
|
248
|
+
# length: Pointer to the length of the outValueArray array
|
|
249
|
+
# Returns: Error code
|
|
250
|
+
int SMO_getSubcatchSeries(SMO_Handle p_handle, int subcatchIndex, SMO_subcatchAttribute attr, int startPeriod, int endPeriod, float **outValueArray, int *length)
|
|
251
|
+
|
|
252
|
+
# Retrieves node attribute values for a given time period and attribute type
|
|
253
|
+
# p_handle: Pointer to a SMO_Handle
|
|
254
|
+
# nodeIndex: The index of the node
|
|
255
|
+
# attr: The node attribute type to retrieve
|
|
256
|
+
# startPeriod: The starting time period to retrieve data from
|
|
257
|
+
# endPeriod: The ending time period to retrieve data from
|
|
258
|
+
# outValueArray: Pointer to the node attribute values
|
|
259
|
+
# length: Pointer to the length of the outValueArray array
|
|
260
|
+
# Returns: Error code
|
|
261
|
+
int SMO_getNodeSeries(SMO_Handle p_handle, int nodeIndex, SMO_nodeAttribute attr, int startPeriod, int endPeriod, float **outValueArray, int *length)
|
|
262
|
+
|
|
263
|
+
# Retrieves link attribute values for a given time period and attribute type
|
|
264
|
+
# p_handle: Pointer to a SMO_Handle
|
|
265
|
+
# linkIndex: The index of the link
|
|
266
|
+
# attr: The link attribute type to retrieve
|
|
267
|
+
# startPeriod: The starting time period to retrieve data from
|
|
268
|
+
# endPeriod: The ending time period to retrieve data from
|
|
269
|
+
# outValueArray: Pointer to the link attribute values
|
|
270
|
+
# length: Pointer to the length of the outValueArray array
|
|
271
|
+
# Returns: Error code
|
|
272
|
+
int SMO_getLinkSeries(SMO_Handle p_handle, int linkIndex, SMO_linkAttribute attr, int startPeriod, int endPeriod, float **outValueArray, int *length)
|
|
273
|
+
|
|
274
|
+
# Retrieves system attribute values for a given time period and attribute type
|
|
275
|
+
# p_handle: Pointer to a SMO_Handle
|
|
276
|
+
# attr: The system attribute type to retrieve
|
|
277
|
+
# startPeriod: The starting time period to retrieve data from
|
|
278
|
+
# endPeriod: The ending time period to retrieve data from
|
|
279
|
+
# outValueArray: Pointer to the system attribute values
|
|
280
|
+
# length: Pointer to the length of the outValueArray array
|
|
281
|
+
# Returns: Error code
|
|
282
|
+
int SMO_getSystemSeries(SMO_Handle p_handle, SMO_systemAttribute attr, int startPeriod, int endPeriod, float **outValueArray, int *length)
|
|
283
|
+
|
|
284
|
+
# Retrieves subcatchment attribute values for a given time period and attribute type
|
|
285
|
+
# p_handle: Pointer to a SMO_Handle
|
|
286
|
+
# timeIndex: The index of the time period
|
|
287
|
+
# attr: The subcatchment attribute type to retrieve
|
|
288
|
+
# outValueArray: Pointer to the subcatchment attribute values
|
|
289
|
+
# length: Pointer to the length of the outValueArray array
|
|
290
|
+
# Returns: Error code
|
|
291
|
+
int SMO_getSubcatchAttribute(SMO_Handle p_handle, int timeIndex, SMO_subcatchAttribute attr, float **outValueArray, int *length)
|
|
292
|
+
|
|
293
|
+
# Retrieves node attribute values for a given time period and attribute type
|
|
294
|
+
# p_handle: Pointer to a SMO_Handle
|
|
295
|
+
# timeIndex: The index of the time period
|
|
296
|
+
# attr: The node attribute type to retrieve
|
|
297
|
+
# outValueArray: Pointer to the node attribute values
|
|
298
|
+
# length: Pointer to the length of the outValueArray array
|
|
299
|
+
# Returns: Error code
|
|
300
|
+
int SMO_getNodeAttribute(SMO_Handle p_handle, int timeIndex, SMO_nodeAttribute attr, float **outValueArray, int *length)
|
|
301
|
+
|
|
302
|
+
# Retrieves link attribute values for a given time period and attribute type
|
|
303
|
+
# p_handle: Pointer to a SMO_Handle
|
|
304
|
+
# timeIndex: The index of the time period
|
|
305
|
+
# attr: The link attribute type to retrieve
|
|
306
|
+
# outValueArray: Pointer to the link attribute values
|
|
307
|
+
# length: Pointer to the length of the outValueArray array
|
|
308
|
+
# Returns: Error code
|
|
309
|
+
int SMO_getLinkAttribute(SMO_Handle p_handle, int timeIndex, SMO_linkAttribute attr, float **outValueArray, int *length)
|
|
310
|
+
|
|
311
|
+
# Retrieves system attribute values for a given time period and attribute type
|
|
312
|
+
# p_handle: Pointer to a SMO_Handle
|
|
313
|
+
# timeIndex: The index of the time period
|
|
314
|
+
# attr: The system attribute type to retrieve
|
|
315
|
+
# outValueArray: Pointer to the system attribute values
|
|
316
|
+
# length: Pointer to the length of the outValueArray array
|
|
317
|
+
# Returns: Error code
|
|
318
|
+
int SMO_getSystemAttribute(SMO_Handle p_handle, int timeIndex, SMO_systemAttribute attr, float **outValueArray, int *length)
|
|
319
|
+
|
|
320
|
+
# Retrieves subcatchment result values for a given time period
|
|
321
|
+
# p_handle: Pointer to a SMO_Handle
|
|
322
|
+
# timeIndex: The index of the time period
|
|
323
|
+
# subcatchIndex: The index of the subcatchment
|
|
324
|
+
# outValueArray: Pointer to the subcatchment result values
|
|
325
|
+
# length: Pointer to the length of the outValueArray array
|
|
326
|
+
# Returns: Error code
|
|
327
|
+
int SMO_getSubcatchResult(SMO_Handle p_handle, int timeIndex, int subcatchIndex, float **outValueArray, int *length)
|
|
328
|
+
|
|
329
|
+
# Retrieves node result values for a given time period
|
|
330
|
+
# p_handle: Pointer to a SMO_Handle
|
|
331
|
+
# timeIndex: The index of the time period
|
|
332
|
+
# nodeIndex: The index of the node
|
|
333
|
+
# outValueArray: Pointer to the node result values
|
|
334
|
+
# length: Pointer to the length of the outValueArray array
|
|
335
|
+
# Returns: Error code
|
|
336
|
+
int SMO_getNodeResult(SMO_Handle p_handle, int timeIndex, int nodeIndex, float **outValueArray, int *length)
|
|
337
|
+
|
|
338
|
+
# Retrieves link result values for a given time period
|
|
339
|
+
# p_handle: Pointer to a SMO_Handle
|
|
340
|
+
# timeIndex: The index of the time period
|
|
341
|
+
# linkIndex: The index of the link
|
|
342
|
+
# outValueArray: Pointer to the link result values
|
|
343
|
+
# length: Pointer to the length of the outValueArray array
|
|
344
|
+
# Returns: Error code
|
|
345
|
+
int SMO_getLinkResult(SMO_Handle p_handle, int timeIndex, int linkIndex, float **outValueArray, int *length)
|
|
346
|
+
|
|
347
|
+
# Retrieves system result values for a given time period
|
|
348
|
+
# p_handle: Pointer to a SMO_Handle
|
|
349
|
+
# timeIndex: The index of the time period
|
|
350
|
+
# dummyIndex: The index of the system
|
|
351
|
+
# outValueArray: Pointer to the system result values
|
|
352
|
+
# length: Pointer to the length of the outValueArray array
|
|
353
|
+
# Returns: Error code
|
|
354
|
+
int SMO_getSystemResult(SMO_Handle p_handle, int timeIndex, int dummyIndex, float **outValueArray, int *length)
|
|
355
|
+
|
|
356
|
+
# Frees memory allocated by the API for the outValueArray
|
|
357
|
+
# array: Pointer to the outValueArray
|
|
358
|
+
void SMO_free(void **array)
|
|
359
|
+
|
|
360
|
+
# Clears the error status of the SMO_Handle
|
|
361
|
+
# p_handle: Pointer to a SMO_Handle
|
|
362
|
+
void SMO_clearError(SMO_Handle p_handle)
|
|
363
|
+
|
|
364
|
+
# Retrieves the error message from the SMO_Handle
|
|
365
|
+
# p_handle: Pointer to a SMO_Handle
|
|
366
|
+
# msg_buffer: Pointer to the error message
|
|
367
|
+
# Returns: Error code
|
|
368
|
+
int SMO_checkError(SMO_Handle p_handle, char **msg_buffer)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# CMake configuration for openswmmcore library
|
|
2
|
+
#
|
|
3
|
+
# Created by: Caleb Buahin (EPA/ORD/CESER/WID)
|
|
4
|
+
# Created on: 2024-11-19
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
# Add Cython target
|
|
8
|
+
add_cython_target(_solver _solver.pyx CXX PY3)
|
|
9
|
+
|
|
10
|
+
# Add library
|
|
11
|
+
add_library(_solver MODULE ${_solver})
|
|
12
|
+
|
|
13
|
+
# Link to SWMM and Python libraries
|
|
14
|
+
target_link_libraries(
|
|
15
|
+
_solver
|
|
16
|
+
OpenSWMMCore::openswmmcore
|
|
17
|
+
OpenSWMMCore::openswmmcore_solver
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Specify that this is a Python extension module
|
|
21
|
+
python_extension_module(_solver)
|
|
22
|
+
|
|
23
|
+
if(APPLE)
|
|
24
|
+
set(INSTALL_LIB_ROOT "@loader_path;@rpath;@loader_path/../../../..;${SOLVER_BUILD_DIR}")
|
|
25
|
+
set(BUILD_LIB_ROOT "@loader_path;@rpath;${SOLVER_BUILD_DIR}")
|
|
26
|
+
elseif(UNIX)
|
|
27
|
+
set(INSTALL_LIB_ROOT "$ORIGIN;$ORIGIN/../../../..;${SOLVER_BUILD_DIR}")
|
|
28
|
+
set(BUILD_LIB_ROOT "$ORIGIN;${SOLVER_BUILD_DIR}")
|
|
29
|
+
endif()
|
|
30
|
+
|
|
31
|
+
# Set up rpath for runswmm inside install package
|
|
32
|
+
set_target_properties(_solver
|
|
33
|
+
PROPERTIES
|
|
34
|
+
BUILD_RPATH "${BUILD_LIB_ROOT}"
|
|
35
|
+
INSTALL_RPATH "${INSTALL_LIB_ROOT}"
|
|
36
|
+
BUILD_WITH_INSTALL_RPATH True
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Install the target
|
|
40
|
+
install(TARGETS _solver LIBRARY DESTINATION openswmm/solver)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Include directories
|
|
45
|
+
target_include_directories(
|
|
46
|
+
_solver
|
|
47
|
+
PUBLIC
|
|
48
|
+
${CMAKE_CURRENT_SOURCE_DIR}
|
|
49
|
+
)
|
|
50
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .solver cimport *
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Description: __init__.py file for the openswmmcore.solver package.
|
|
2
|
+
# Created by: Caleb Buahin (EPA/ORD/CESER/WID)
|
|
3
|
+
# Created on: 2024-11-19
|
|
4
|
+
|
|
5
|
+
from ._solver import (
|
|
6
|
+
SWMMObjects,
|
|
7
|
+
SWMMNodeTypes,
|
|
8
|
+
SWMMRainGageProperties,
|
|
9
|
+
SWMMSubcatchmentProperties,
|
|
10
|
+
SWMMNodeProperties,
|
|
11
|
+
SWMMLinkProperties,
|
|
12
|
+
SWMMSystemProperties,
|
|
13
|
+
SWMMFlowUnits,
|
|
14
|
+
SWMMAPIErrors,
|
|
15
|
+
run_solver,
|
|
16
|
+
decode_swmm_datetime,
|
|
17
|
+
encode_swmm_datetime,
|
|
18
|
+
version,
|
|
19
|
+
SolverState,
|
|
20
|
+
SWMMSolverException,
|
|
21
|
+
Solver
|
|
22
|
+
)
|