OpenSWMM Engine  6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
Loading...
Searching...
No Matches
openswmm_gages.h
Go to the documentation of this file.
1
14
15#ifndef OPENSWMM_GAGES_H
16#define OPENSWMM_GAGES_H
17
18#include "openswmm_engine.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
31
40
41/* =========================================================================
42 * Identity
43 * ========================================================================= */
44
51
58SWMM_ENGINE_API int swmm_gage_index(SWMM_Engine engine, const char* id);
59
66SWMM_ENGINE_API const char* swmm_gage_id(SWMM_Engine engine, int idx);
67
68/* =========================================================================
69 * Creation (BUILDING or OPENED — "editable" states)
70 * ========================================================================= */
71
79SWMM_ENGINE_API int swmm_gage_add(SWMM_Engine engine, const char* id);
80
81/* =========================================================================
82 * Property setters (BUILDING or OPENED)
83 * ========================================================================= */
84
92SWMM_ENGINE_API int swmm_gage_set_rain_type(SWMM_Engine engine, int idx, int type);
93
101SWMM_ENGINE_API int swmm_gage_set_rain_interval(SWMM_Engine engine, int idx, double seconds);
102
110SWMM_ENGINE_API int swmm_gage_set_data_source(SWMM_Engine engine, int idx, int source);
111
119SWMM_ENGINE_API int swmm_gage_set_timeseries(SWMM_Engine engine, int idx, const char* ts_id);
120
135SWMM_ENGINE_API int swmm_gage_set_filename(SWMM_Engine engine, int idx, const char* path,
136 const char* station_id);
137
145SWMM_ENGINE_API int swmm_gage_set_station_id(SWMM_Engine engine, int idx, const char* station_id);
146
154SWMM_ENGINE_API int swmm_gage_set_snow_factor(SWMM_Engine engine, int idx, double factor);
155
163SWMM_ENGINE_API int swmm_gage_set_rain_units(SWMM_Engine engine, int idx, int units);
164
178SWMM_ENGINE_API int swmm_gage_set_scale_factor(SWMM_Engine engine, int idx, double factor);
179
180/* =========================================================================
181 * Property getters
182 * ========================================================================= */
183
191SWMM_ENGINE_API int swmm_gage_get_rain_type(SWMM_Engine engine, int idx, int* type);
192
200SWMM_ENGINE_API int swmm_gage_get_data_source(SWMM_Engine engine, int idx, int* source);
201
209SWMM_ENGINE_API int swmm_gage_get_scale_factor(SWMM_Engine engine, int idx, double* factor);
210
218SWMM_ENGINE_API int swmm_gage_get_rain_interval(SWMM_Engine engine, int idx, double* seconds);
219
227SWMM_ENGINE_API int swmm_gage_get_snow_factor(SWMM_Engine engine, int idx, double* factor);
228
238SWMM_ENGINE_API int swmm_gage_get_timeseries(SWMM_Engine engine, int idx, char* buf, int buflen);
239
249SWMM_ENGINE_API int swmm_gage_get_station_id(SWMM_Engine engine, int idx, char* buf, int buflen);
250
258SWMM_ENGINE_API int swmm_gage_get_rain_units(SWMM_Engine engine, int idx, int* units);
259
260/* =========================================================================
261 * State
262 * ========================================================================= */
263
265SWMM_ENGINE_API int swmm_gage_get_rainfall(SWMM_Engine engine, int idx, double* rainfall);
266
273SWMM_ENGINE_API int swmm_gage_set_rainfall(SWMM_Engine engine, int idx, double rainfall);
274
275/* =========================================================================
276 * Bulk access
277 * ========================================================================= */
278
286SWMM_ENGINE_API int swmm_gage_get_rainfall_bulk(SWMM_Engine engine, double* buf, int count);
287
291SWMM_ENGINE_API int swmm_gage_rename(SWMM_Engine engine, int idx, const char* newId);
292
293#ifdef __cplusplus
294} /* extern "C" */
295#endif
296
297#endif /* OPENSWMM_GAGES_H */
#define SWMM_ENGINE_API
Definition openswmm_2d.h:37
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:35
OpenSWMM Engine — primary transparent C API (master header).
SWMM_GageRainType
Rain gage rainfall data format.
Definition openswmm_gages.h:35
@ SWMM_RAIN_VOLUME
Definition openswmm_gages.h:37
@ SWMM_RAIN_CUMULATIVE
Definition openswmm_gages.h:38
@ SWMM_RAIN_INTENSITY
Definition openswmm_gages.h:36
SWMM_ENGINE_API int swmm_gage_add(SWMM_Engine engine, const char *id)
Add a new rain gage to the model.
Definition openswmm_gages_impl.cpp:43
SWMM_ENGINE_API int swmm_gage_get_rain_interval(SWMM_Engine engine, int idx, double *seconds)
Get the rainfall recording interval for a gage.
Definition openswmm_gages_impl.cpp:205
SWMM_ENGINE_API int swmm_gage_get_snow_factor(SWMM_Engine engine, int idx, double *factor)
Get the snow-catch deficiency correction factor (SCF) for a gage.
Definition openswmm_gages_impl.cpp:214
SWMM_ENGINE_API int swmm_gage_get_timeseries(SWMM_Engine engine, int idx, char *buf, int buflen)
Get the assigned time series id for a TIMESERIES-source gage.
Definition openswmm_gages_impl.cpp:222
SWMM_GageDataSource
Rain gage data source type.
Definition openswmm_gages.h:27
@ SWMM_GAGE_TIMESERIES
Definition openswmm_gages.h:28
@ SWMM_GAGE_FILE
Definition openswmm_gages.h:29
SWMM_ENGINE_API int swmm_gage_set_snow_factor(SWMM_Engine engine, int idx, double factor)
Set the snow-catch deficiency correction factor (SCF) for a gage.
Definition openswmm_gages_impl.cpp:137
SWMM_ENGINE_API int swmm_gage_set_scale_factor(SWMM_Engine engine, int idx, double factor)
Set the rainfall scaling factor for a gage.
Definition openswmm_gages_impl.cpp:159
SWMM_ENGINE_API int swmm_gage_set_filename(SWMM_Engine engine, int idx, const char *path, const char *station_id)
Assign an external rainfall file as the data source for a gage.
Definition openswmm_gages_impl.cpp:108
SWMM_ENGINE_API int swmm_gage_count(SWMM_Engine engine)
Get the total number of rain gages in the model.
Definition openswmm_gages_impl.cpp:22
SWMM_ENGINE_API int swmm_gage_get_rainfall(SWMM_Engine engine, int idx, double *rainfall)
Get current rainfall rate at a gage (project rate units).
Definition openswmm_gages_impl.cpp:258
SWMM_ENGINE_API int swmm_gage_set_timeseries(SWMM_Engine engine, int idx, const char *ts_id)
Assign a time series as the data source for a gage.
Definition openswmm_gages_impl.cpp:95
SWMM_ENGINE_API int swmm_gage_set_rain_interval(SWMM_Engine engine, int idx, double seconds)
Set the rainfall recording interval for a gage.
Definition openswmm_gages_impl.cpp:77
SWMM_ENGINE_API int swmm_gage_get_scale_factor(SWMM_Engine engine, int idx, double *factor)
Get the rainfall scaling factor for a gage.
Definition openswmm_gages_impl.cpp:188
SWMM_ENGINE_API int swmm_gage_set_rain_type(SWMM_Engine engine, int idx, int type)
Set the rainfall data format for a gage.
Definition openswmm_gages_impl.cpp:67
SWMM_ENGINE_API int swmm_gage_get_rain_type(SWMM_Engine engine, int idx, int *type)
Get the rainfall data format for a gage.
Definition openswmm_gages_impl.cpp:172
SWMM_ENGINE_API int swmm_gage_index(SWMM_Engine engine, const char *id)
Look up a rain gage's zero-based index by its string identifier.
Definition openswmm_gages_impl.cpp:27
SWMM_ENGINE_API int swmm_gage_set_data_source(SWMM_Engine engine, int idx, int source)
Set the data source type for a gage.
Definition openswmm_gages_impl.cpp:86
SWMM_ENGINE_API int swmm_gage_set_station_id(SWMM_Engine engine, int idx, const char *station_id)
Set the station id for a file-based gage (standard SWMM rain file).
Definition openswmm_gages_impl.cpp:126
SWMM_ENGINE_API const char * swmm_gage_id(SWMM_Engine engine, int idx)
Get the string identifier of a rain gage by index.
Definition openswmm_gages_impl.cpp:32
SWMM_ENGINE_API int swmm_gage_set_rainfall(SWMM_Engine engine, int idx, double rainfall)
Override rainfall at a gage for the current timestep.
Definition openswmm_gages_impl.cpp:266
SWMM_ENGINE_API int swmm_gage_get_rainfall_bulk(SWMM_Engine engine, double *buf, int count)
Get current rainfall rates for all gages in a single call.
Definition openswmm_gages_impl.cpp:279
SWMM_ENGINE_API int swmm_gage_get_station_id(SWMM_Engine engine, int idx, char *buf, int buflen)
Get the station id for a file-based gage.
Definition openswmm_gages_impl.cpp:237
SWMM_ENGINE_API int swmm_gage_set_rain_units(SWMM_Engine engine, int idx, int units)
Set the rain-depth units declared for a file-based gage.
Definition openswmm_gages_impl.cpp:149
SWMM_ENGINE_API int swmm_gage_get_rain_units(SWMM_Engine engine, int idx, int *units)
Get the rain-depth units declared for a file-based gage.
Definition openswmm_gages_impl.cpp:246
SWMM_ENGINE_API int swmm_gage_rename(SWMM_Engine engine, int idx, const char *newId)
Rename the rain gage at idx to newId. Returns SWMM_ERR_BADPARAM if newId is null, empty,...
Definition openswmm_gages_impl.cpp:288
SWMM_ENGINE_API int swmm_gage_get_data_source(SWMM_Engine engine, int idx, int *source)
Get the data source type for a gage.
Definition openswmm_gages_impl.cpp:180