![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
C API implementation — tables (time series, curves) and patterns. More...
Functions | |
| SWMM_ENGINE_API int | swmm_table_count (SWMM_Engine engine) |
| Get the total number of tables (time series + curves) in the model. | |
| SWMM_ENGINE_API int | swmm_table_index (SWMM_Engine engine, const char *id) |
| Look up a table's zero-based index by its string identifier. | |
| SWMM_ENGINE_API const char * | swmm_table_id (SWMM_Engine engine, int idx) |
| Get the string identifier of a table by index. | |
| SWMM_ENGINE_API int | swmm_timeseries_add (SWMM_Engine engine, const char *id) |
| Add a new time series to the model. | |
| SWMM_ENGINE_API int | swmm_curve_add (SWMM_Engine engine, const char *id, int type) |
| Add a new curve to the model. | |
| SWMM_ENGINE_API int | swmm_table_add_point (SWMM_Engine engine, int idx, double x, double y) |
| Append a data point (x, y) to a table. | |
| SWMM_ENGINE_API int | swmm_table_get_point_count (SWMM_Engine engine, int idx, int *count) |
| Get the number of data points in a table. | |
| SWMM_ENGINE_API int | swmm_table_get_point (SWMM_Engine engine, int idx, int pt_idx, double *x, double *y) |
| Get a specific data point from a table. | |
| SWMM_ENGINE_API int | swmm_table_clear (SWMM_Engine engine, int idx) |
| Remove all data points from a table. | |
| SWMM_ENGINE_API int | swmm_table_lookup (SWMM_Engine engine, int idx, double x, double *y) |
| Interpolate a Y value from a table for a given X. | |
| SWMM_ENGINE_API int | swmm_pattern_add (SWMM_Engine engine, const char *id, int type) |
| Add a new time pattern to the model. | |
| SWMM_ENGINE_API int | swmm_pattern_set_factors (SWMM_Engine engine, int idx, const double *factors, int count) |
| Set the multiplier factors for a time pattern. | |
| SWMM_ENGINE_API int | swmm_pattern_count (SWMM_Engine engine) |
| Get the total number of time patterns in the model. | |
C API implementation — tables (time series, curves) and patterns.
| SWMM_ENGINE_API int swmm_curve_add | ( | SWMM_Engine | engine, |
| const char * | id, | ||
| int | type | ||
| ) |
Add a new curve to the model.
Curve types: 0=STORAGE, 1=DIVERSION, 2=TIDAL, 3=RATING, 4=CONTROL, 5=SHAPE, 6=PUMP1..PUMP4, etc.
| engine | Engine handle (SWMM_STATE_BUILDING). |
| id | Unique null-terminated identifier. |
| type | Curve type code. |
| SWMM_ENGINE_API int swmm_pattern_add | ( | SWMM_Engine | engine, |
| const char * | id, | ||
| int | type | ||
| ) |
Add a new time pattern to the model.
Pattern types: 0=MONTHLY, 1=DAILY, 2=HOURLY, 3=WEEKEND.
| engine | Engine handle (SWMM_STATE_BUILDING). |
| id | Unique null-terminated identifier. |
| type | Pattern type code. |
| SWMM_ENGINE_API int swmm_pattern_count | ( | SWMM_Engine | engine | ) |
Get the total number of time patterns in the model.
| engine | Engine handle. |
| SWMM_ENGINE_API int swmm_pattern_set_factors | ( | SWMM_Engine | engine, |
| int | idx, | ||
| const double * | factors, | ||
| int | count | ||
| ) |
Set the multiplier factors for a time pattern.
| engine | Engine handle. |
| idx | Zero-based pattern index. |
| factors | Array of multiplier values. |
| count | Number of factors (e.g., 12 for MONTHLY, 24 for HOURLY). |
| SWMM_ENGINE_API int swmm_table_add_point | ( | SWMM_Engine | engine, |
| int | idx, | ||
| double | x, | ||
| double | y | ||
| ) |
Append a data point (x, y) to a table.
For time series, x is in decimal days; for curves, x depends on the curve type (e.g., depth for storage curves).
| engine | Engine handle. |
| idx | Zero-based table index. |
| x | X value (independent variable). |
| y | Y value (dependent variable). |
| SWMM_ENGINE_API int swmm_table_clear | ( | SWMM_Engine | engine, |
| int | idx | ||
| ) |
Remove all data points from a table.
| engine | Engine handle. |
| idx | Zero-based table index. |
| SWMM_ENGINE_API int swmm_table_count | ( | SWMM_Engine | engine | ) |
Get the total number of tables (time series + curves) in the model.
| engine | Engine handle. |
| SWMM_ENGINE_API int swmm_table_get_point | ( | SWMM_Engine | engine, |
| int | idx, | ||
| int | pt_idx, | ||
| double * | x, | ||
| double * | y | ||
| ) |
Get a specific data point from a table.
| engine | Engine handle. | |
| idx | Zero-based table index. | |
| pt_idx | Zero-based point index within the table. | |
| [out] | x | Receives the X value. |
| [out] | y | Receives the Y value. |
| SWMM_ENGINE_API int swmm_table_get_point_count | ( | SWMM_Engine | engine, |
| int | idx, | ||
| int * | count | ||
| ) |
Get the number of data points in a table.
| engine | Engine handle. | |
| idx | Zero-based table index. | |
| [out] | count | Receives the point count. |
| SWMM_ENGINE_API const char * swmm_table_id | ( | SWMM_Engine | engine, |
| int | idx | ||
| ) |
Get the string identifier of a table by index.
| engine | Engine handle. |
| idx | Zero-based table index. |
| SWMM_ENGINE_API int swmm_table_index | ( | SWMM_Engine | engine, |
| const char * | id | ||
| ) |
Look up a table's zero-based index by its string identifier.
| engine | Engine handle. |
| id | Null-terminated table identifier. |
| SWMM_ENGINE_API int swmm_table_lookup | ( | SWMM_Engine | engine, |
| int | idx, | ||
| double | x, | ||
| double * | y | ||
| ) |
Interpolate a Y value from a table for a given X.
Uses cursor-based lookup for efficient sequential access (e.g., during time-stepping through a time series).
| engine | Engine handle. | |
| idx | Zero-based table index. | |
| x | X value to look up. | |
| [out] | y | Receives the interpolated Y value. |
| SWMM_ENGINE_API int swmm_timeseries_add | ( | SWMM_Engine | engine, |
| const char * | id | ||
| ) |
Add a new time series to the model.
| engine | Engine handle (SWMM_STATE_BUILDING). |
| id | Unique null-terminated identifier. |