![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
C API implementation — transects, streets, inlets, LID controls, LID usage. More...
#include "openswmm_api_common.hpp"#include "../../../include/openswmm/engine/openswmm_infrastructure.h"Functions | |
| SWMM_ENGINE_API int | swmm_transect_add (SWMM_Engine engine, const char *id) |
| Add a new transect for irregular cross-sections. | |
| SWMM_ENGINE_API int | swmm_transect_set_roughness (SWMM_Engine engine, int idx, double n_left, double n_right, double n_channel) |
| Set Manning's roughness for left overbank, right overbank, and channel. | |
| SWMM_ENGINE_API int | swmm_transect_add_station (SWMM_Engine engine, int idx, double station, double elevation) |
| Add a station–elevation data point to a transect. | |
| SWMM_ENGINE_API int | swmm_transect_count (SWMM_Engine engine) |
| Get the total number of transects in the model. | |
| SWMM_ENGINE_API int | swmm_street_add (SWMM_Engine engine, const char *id) |
| Add a new street cross-section definition. | |
| SWMM_ENGINE_API int | swmm_street_set_params (SWMM_Engine engine, int idx, double t_crown, double h_curb, double sx, double n_road, double gutter_depres, double gutter_width, int sides, double back_width, double back_slope, double back_n) |
| Set the geometric parameters for a street cross-section. | |
| SWMM_ENGINE_API int | swmm_street_count (SWMM_Engine engine) |
| Get the total number of street definitions in the model. | |
| SWMM_ENGINE_API int | swmm_inlet_add (SWMM_Engine engine, const char *id, const char *type) |
| Add a new inlet definition. | |
| SWMM_ENGINE_API int | swmm_inlet_set_params (SWMM_Engine engine, int idx, double length, double width, const char *grate_type, double open_area, double splash_veloc) |
| Set the geometric parameters for an inlet. | |
| SWMM_ENGINE_API int | swmm_inlet_count (SWMM_Engine engine) |
| Get the total number of inlet definitions in the model. | |
| SWMM_ENGINE_API int | swmm_lid_add (SWMM_Engine engine, const char *id, int type) |
| Add a new LID (Low Impact Development) control. | |
| SWMM_ENGINE_API int | swmm_lid_set_surface (SWMM_Engine engine, int idx, double storage, double roughness, double slope) |
| Set the surface layer properties for a LID control. | |
| SWMM_ENGINE_API int | swmm_lid_set_soil (SWMM_Engine engine, int idx, double thick, double porosity, double fc, double wp, double ksat, double kslope) |
| Set the soil layer properties for a LID control. | |
| SWMM_ENGINE_API int | swmm_lid_set_storage (SWMM_Engine engine, int idx, double thick, double void_frac, double ksat) |
| Set the storage layer properties for a LID control. | |
| SWMM_ENGINE_API int | swmm_lid_set_drain (SWMM_Engine engine, int idx, double coeff, double expon, double offset) |
| Set the underdrain properties for a LID control. | |
| SWMM_ENGINE_API int | swmm_lid_count (SWMM_Engine engine) |
| Get the total number of LID controls in the model. | |
| SWMM_ENGINE_API int | swmm_lid_usage_add (SWMM_Engine engine, int subcatch_idx, int lid_idx, int number, double area, double width, double init_sat, double from_imperv) |
| Assign a LID control to a subcatchment. | |
C API implementation — transects, streets, inlets, LID controls, LID usage.
| SWMM_ENGINE_API int swmm_inlet_add | ( | SWMM_Engine | engine, |
| const char * | id, | ||
| const char * | type | ||
| ) |
Add a new inlet definition.
| engine | Engine handle (SWMM_STATE_BUILDING). |
| id | Unique null-terminated identifier. |
| type | Inlet type string (e.g., "GRATE", "CURB", "SLOTTED", "CUSTOM"). |
| SWMM_ENGINE_API int swmm_inlet_count | ( | SWMM_Engine | engine | ) |
Get the total number of inlet definitions in the model.
| engine | Engine handle. |
| SWMM_ENGINE_API int swmm_inlet_set_params | ( | SWMM_Engine | engine, |
| int | idx, | ||
| double | length, | ||
| double | width, | ||
| const char * | grate_type, | ||
| double | open_area, | ||
| double | splash_veloc | ||
| ) |
Set the geometric parameters for an inlet.
| engine | Engine handle. |
| idx | Zero-based inlet index. |
| length | Inlet length. |
| width | Inlet width. |
| grate_type | Grate type string (e.g., "P-50", "GENERIC"). |
| open_area | Open area fraction (0–1). |
| splash_veloc | Splash-over velocity threshold. |
| SWMM_ENGINE_API int swmm_lid_add | ( | SWMM_Engine | engine, |
| const char * | id, | ||
| int | type | ||
| ) |
Add a new LID (Low Impact Development) control.
LID types: 0=BIO_CELL, 1=RAIN_GARDEN, 2=GREEN_ROOF, 3=INFIL_TRENCH, 4=PERM_PAVEMENT, 5=RAIN_BARREL, 6=ROOFTOP_DISCONN, 7=VEGETATIVE_SWALE.
| engine | Engine handle (SWMM_STATE_BUILDING). |
| id | Unique null-terminated identifier. |
| type | LID type code. |
| SWMM_ENGINE_API int swmm_lid_count | ( | SWMM_Engine | engine | ) |
Get the total number of LID controls in the model.
| engine | Engine handle. |
| SWMM_ENGINE_API int swmm_lid_set_drain | ( | SWMM_Engine | engine, |
| int | idx, | ||
| double | coeff, | ||
| double | expon, | ||
| double | offset | ||
| ) |
Set the underdrain properties for a LID control.
| engine | Engine handle. |
| idx | Zero-based LID index. |
| coeff | Drain coefficient. |
| expon | Drain exponent. |
| offset | Drain offset height above the storage layer bottom. |
| SWMM_ENGINE_API int swmm_lid_set_soil | ( | SWMM_Engine | engine, |
| int | idx, | ||
| double | thick, | ||
| double | porosity, | ||
| double | fc, | ||
| double | wp, | ||
| double | ksat, | ||
| double | kslope | ||
| ) |
Set the soil layer properties for a LID control.
| engine | Engine handle. |
| idx | Zero-based LID index. |
| thick | Soil thickness. |
| porosity | Soil porosity (fraction). |
| fc | Field capacity (fraction). |
| wp | Wilting point (fraction). |
| ksat | Saturated hydraulic conductivity. |
| kslope | Slope of the conductivity–moisture curve. |
| SWMM_ENGINE_API int swmm_lid_set_storage | ( | SWMM_Engine | engine, |
| int | idx, | ||
| double | thick, | ||
| double | void_frac, | ||
| double | ksat | ||
| ) |
Set the storage layer properties for a LID control.
| engine | Engine handle. |
| idx | Zero-based LID index. |
| thick | Storage layer thickness. |
| void_frac | Void fraction (porosity of gravel/aggregate). |
| ksat | Seepage rate through the storage layer bottom. |
| SWMM_ENGINE_API int swmm_lid_set_surface | ( | SWMM_Engine | engine, |
| int | idx, | ||
| double | storage, | ||
| double | roughness, | ||
| double | slope | ||
| ) |
Set the surface layer properties for a LID control.
| engine | Engine handle. |
| idx | Zero-based LID index. |
| storage | Surface storage depth. |
| roughness | Surface Manning's n. |
| slope | Surface slope (fraction). |
| SWMM_ENGINE_API int swmm_lid_usage_add | ( | SWMM_Engine | engine, |
| int | subcatch_idx, | ||
| int | lid_idx, | ||
| int | number, | ||
| double | area, | ||
| double | width, | ||
| double | init_sat, | ||
| double | from_imperv | ||
| ) |
Assign a LID control to a subcatchment.
Multiple LID units of the same or different types can be assigned to a single subcatchment.
| engine | Engine handle. |
| subcatch_idx | Zero-based subcatchment index. |
| lid_idx | Zero-based LID control index. |
| number | Number of replicate LID units. |
| area | Area of each LID unit in project area units. |
| width | Top width of the overland flow surface per unit. |
| init_sat | Initial saturation of the soil layer (0–1). |
| from_imperv | Fraction of impervious area runoff treated by this LID (0–1). |
| SWMM_ENGINE_API int swmm_street_add | ( | SWMM_Engine | engine, |
| const char * | id | ||
| ) |
Add a new street cross-section definition.
| engine | Engine handle (SWMM_STATE_BUILDING). |
| id | Unique null-terminated identifier. |
| SWMM_ENGINE_API int swmm_street_count | ( | SWMM_Engine | engine | ) |
Get the total number of street definitions in the model.
| engine | Engine handle. |
| SWMM_ENGINE_API int swmm_street_set_params | ( | SWMM_Engine | engine, |
| int | idx, | ||
| double | t_crown, | ||
| double | h_curb, | ||
| double | sx, | ||
| double | n_road, | ||
| double | gutter_depres, | ||
| double | gutter_width, | ||
| int | sides, | ||
| double | back_width, | ||
| double | back_slope, | ||
| double | back_n | ||
| ) |
Set the geometric parameters for a street cross-section.
| engine | Engine handle. |
| idx | Zero-based street index. |
| t_crown | Crown thickness (rise of the crown above the gutter). |
| h_curb | Curb height. |
| sx | Cross slope of the roadway. |
| n_road | Manning's n for the road surface. |
| gutter_depres | Gutter depression depth. |
| gutter_width | Gutter width. |
| sides | Number of sides (1 or 2). |
| back_width | Backing (sidewalk) width. |
| back_slope | Backing slope. |
| back_n | Manning's n for the backing area. |
| SWMM_ENGINE_API int swmm_transect_add | ( | SWMM_Engine | engine, |
| const char * | id | ||
| ) |
Add a new transect for irregular cross-sections.
| engine | Engine handle (SWMM_STATE_BUILDING). |
| id | Unique null-terminated identifier. |
| SWMM_ENGINE_API int swmm_transect_add_station | ( | SWMM_Engine | engine, |
| int | idx, | ||
| double | station, | ||
| double | elevation | ||
| ) |
Add a station–elevation data point to a transect.
Stations must be added in order from left to right across the cross-section.
| engine | Engine handle. |
| idx | Zero-based transect index. |
| station | Horizontal distance (station) from a reference. |
| elevation | Elevation at this station. |
| SWMM_ENGINE_API int swmm_transect_count | ( | SWMM_Engine | engine | ) |
Get the total number of transects in the model.
| engine | Engine handle. |
| SWMM_ENGINE_API int swmm_transect_set_roughness | ( | SWMM_Engine | engine, |
| int | idx, | ||
| double | n_left, | ||
| double | n_right, | ||
| double | n_channel | ||
| ) |
Set Manning's roughness for left overbank, right overbank, and channel.
| engine | Engine handle. |
| idx | Zero-based transect index. |
| n_left | Manning's n for the left overbank. |
| n_right | Manning's n for the right overbank. |
| n_channel | Manning's n for the main channel. |