OpenSWMM Engine  6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
Loading...
Searching...
No Matches
Runtime Forcing API
Collaboration diagram for Runtime Forcing API:

Functions

SWMM_ENGINE_API int swmm_forcing_node_lat_inflow (SWMM_Engine engine, int idx, double value, int mode, int persist)
 Force a lateral inflow at a node.
 
SWMM_ENGINE_API int swmm_forcing_node_head_boundary (SWMM_Engine engine, int idx, double value, int mode, int persist)
 Force a head boundary at an outfall node.
 
SWMM_ENGINE_API int swmm_forcing_node_quality (SWMM_Engine engine, int node_idx, int pollutant_idx, double mass_rate, int mode, int persist)
 Force a quality mass flux at a node.
 
SWMM_ENGINE_API int swmm_forcing_link_flow (SWMM_Engine engine, int idx, double value, int mode, int persist)
 Force a flow in a link.
 
SWMM_ENGINE_API int swmm_forcing_link_setting (SWMM_Engine engine, int idx, double value, int mode, int persist)
 Force a control setting on a link (pump, orifice, weir, outlet).
 
SWMM_ENGINE_API int swmm_forcing_link_quality (SWMM_Engine engine, int link_idx, int pollutant_idx, double value, int mode, int persist)
 Force pollutant quality on a link.
 
SWMM_ENGINE_API int swmm_forcing_subcatch_rainfall (SWMM_Engine engine, int idx, double value, int mode, int persist)
 Force rainfall on a subcatchment (bypasses gage lookup).
 
SWMM_ENGINE_API int swmm_forcing_subcatch_evap (SWMM_Engine engine, int idx, double value, int mode, int persist)
 Prescribe a potential evapotranspiration (PET) rate on a subcatchment.
 
SWMM_ENGINE_API int swmm_forcing_subcatch_snowfall (SWMM_Engine engine, int idx, double value, int mode, int persist)
 Prescribe snowfall on a subcatchment.
 
SWMM_ENGINE_API int swmm_climate_get_evap_rate (SWMM_Engine engine, double *value)
 Get the current climate-derived evaporation rate.
 
SWMM_ENGINE_API int swmm_forcing_climate_temperature (SWMM_Engine engine, double value, int mode, int persist)
 Prescribe the air temperature used for snowmelt and temperature-derived evaporation.
 
SWMM_ENGINE_API int swmm_climate_get_temperature (SWMM_Engine engine, double *value)
 Get the current air temperature (read-only).
 
SWMM_ENGINE_API int swmm_forcing_climate_wind (SWMM_Engine engine, double value, int mode, int persist)
 Prescribe the wind speed used in rain-on-snow melt.
 
SWMM_ENGINE_API int swmm_climate_get_wind_speed (SWMM_Engine engine, double *value)
 Get the current wind speed (read-only).
 
SWMM_ENGINE_API int swmm_forcing_climate_evap (SWMM_Engine engine, double value, int mode, int persist)
 Prescribe the system-wide evaporation rate.
 
SWMM_ENGINE_API int swmm_climate_set_dry_only (SWMM_Engine engine, int flag)
 Set the evaporation DRY_ONLY option at runtime.
 
SWMM_ENGINE_API int swmm_climate_get_dry_only (SWMM_Engine engine, int *flag)
 Get the evaporation DRY_ONLY option.
 
SWMM_ENGINE_API int swmm_forcing_gage_rainfall (SWMM_Engine engine, int idx, double value, int mode, int persist)
 Force rainfall on a rain gage (affects all linked subcatchments).
 
SWMM_ENGINE_API int swmm_forcing_clear (SWMM_Engine engine, int type, int idx)
 Clear forcing on a specific element and channel.
 
SWMM_ENGINE_API int swmm_forcing_clear_all (SWMM_Engine engine)
 Clear ALL forcings on ALL elements.
 

Detailed Description

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License

Function Documentation

◆ swmm_climate_get_dry_only()

SWMM_ENGINE_API int swmm_climate_get_dry_only ( SWMM_Engine engine,
int * flag )

Get the evaporation DRY_ONLY option.

Parameters
engineEngine handle.
[out]flagReceives 0/1.
Returns
SWMM_OK or error code.

◆ swmm_climate_get_evap_rate()

SWMM_ENGINE_API int swmm_climate_get_evap_rate ( SWMM_Engine engine,
double * value )

Get the current climate-derived evaporation rate.

Returns the broadcast evaporation rate the engine would apply in the absence of any PET forcing, including monthly adjustments (read-only). Intended for caller-side composition: read this rate, apply your own adjustment logic, and prescribe the result via swmm_forcing_subcatch_evap.

Parameters
engineEngine handle.
[out]valueReceives the rate in user units (in/day US, mm/day SI).
Returns
SWMM_OK or error code.
Here is the call graph for this function:

◆ swmm_climate_get_temperature()

SWMM_ENGINE_API int swmm_climate_get_temperature ( SWMM_Engine engine,
double * value )

Get the current air temperature (read-only).

Parameters
engineEngine handle.
[out]valueReceives the temperature in user units (deg F US, deg C SI).
Returns
SWMM_OK or error code.
Here is the call graph for this function:

◆ swmm_climate_get_wind_speed()

SWMM_ENGINE_API int swmm_climate_get_wind_speed ( SWMM_Engine engine,
double * value )

Get the current wind speed (read-only).

Parameters
engineEngine handle.
[out]valueReceives the wind speed in user units (mph US, km/hr SI).
Returns
SWMM_OK or error code.
Here is the call graph for this function:

◆ swmm_climate_set_dry_only()

SWMM_ENGINE_API int swmm_climate_set_dry_only ( SWMM_Engine engine,
int flag )

Set the evaporation DRY_ONLY option at runtime.

Parameters
engineEngine handle.
flagNonzero suppresses evaporation during rainfall.
Returns
SWMM_OK or error code.

◆ swmm_forcing_clear()

SWMM_ENGINE_API int swmm_forcing_clear ( SWMM_Engine engine,
int type,
int idx )

Clear forcing on a specific element and channel.

Parameters
engineEngine handle.
typeForcing channel (SWMM_ForcingType enum).
idxElement index within that channel.
Returns
SWMM_OK or error code.

◆ swmm_forcing_clear_all()

SWMM_ENGINE_API int swmm_forcing_clear_all ( SWMM_Engine engine)

Clear ALL forcings on ALL elements.

Parameters
engineEngine handle.
Returns
SWMM_OK or error code.

◆ swmm_forcing_climate_evap()

SWMM_ENGINE_API int swmm_forcing_climate_evap ( SWMM_Engine engine,
double value,
int mode,
int persist )

Prescribe the system-wide evaporation rate.

Replaces (OVERRIDE) or augments (ADD) the climate-derived evaporation rate after all sources and monthly adjustments, so it reaches every consumer. Per-subcatchment PET forcing (swmm_forcing_subcatch_evap) still takes precedence on its subcatchment.

Parameters
engineEngine handle.
valueEvaporation rate in user units (in/day US, mm/day SI); must be >= 0 for OVERRIDE.
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.
Here is the call graph for this function:

◆ swmm_forcing_climate_temperature()

SWMM_ENGINE_API int swmm_forcing_climate_temperature ( SWMM_Engine engine,
double value,
int mode,
int persist )

Prescribe the air temperature used for snowmelt and temperature-derived evaporation.

Applied before derived climate quantities (saturation vapor pressure, psychrometric constant, Hargreaves moving average) are computed, so all temperature consumers stay consistent. An OVERRIDE prescription replaces the climate data-source value and bypasses monthly adjustments; ADD augments it.

Parameters
engineEngine handle.
valueAir temperature in user units (deg F US, deg C SI).
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.
Here is the call graph for this function:

◆ swmm_forcing_climate_wind()

SWMM_ENGINE_API int swmm_forcing_climate_wind ( SWMM_Engine engine,
double value,
int mode,
int persist )

Prescribe the wind speed used in rain-on-snow melt.

An OVERRIDE prescription replaces the monthly/climate-file value; ADD augments it.

Parameters
engineEngine handle.
valueWind speed in user units (mph US, km/hr SI). Must be >= 0 for OVERRIDE.
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.
Here is the call graph for this function:

◆ swmm_forcing_gage_rainfall()

SWMM_ENGINE_API int swmm_forcing_gage_rainfall ( SWMM_Engine engine,
int idx,
double value,
int mode,
int persist )

Force rainfall on a rain gage (affects all linked subcatchments).

Parameters
engineEngine handle.
idxGage index.
valueRainfall rate (in/hr for US, mm/hr for SI).
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.

◆ swmm_forcing_link_flow()

SWMM_ENGINE_API int swmm_forcing_link_flow ( SWMM_Engine engine,
int idx,
double value,
int mode,
int persist )

Force a flow in a link.

Parameters
engineEngine handle.
idxLink index.
valueFlow rate (CFS for US, CMS for SI).
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.

◆ swmm_forcing_link_quality()

SWMM_ENGINE_API int swmm_forcing_link_quality ( SWMM_Engine engine,
int link_idx,
int pollutant_idx,
double value,
int mode,
int persist )

Force pollutant quality on a link.

Same semantics as swmm_forcing_node_quality: OVERRIDE sets the link concentration directly (not mass-balanced); ADD injects a mass rate (mass/sec) tracked in the quality mass-balance forcing bucket.

Parameters
engineEngine handle.
link_idxLink index.
pollutant_idxPollutant index.
valueConcentration (OVERRIDE) or mass rate (ADD).
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.

◆ swmm_forcing_link_setting()

SWMM_ENGINE_API int swmm_forcing_link_setting ( SWMM_Engine engine,
int idx,
double value,
int mode,
int persist )

Force a control setting on a link (pump, orifice, weir, outlet).

Parameters
engineEngine handle.
idxLink index.
valueSetting value (0.0–1.0 for fraction open; pump speed).
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.

◆ swmm_forcing_node_head_boundary()

SWMM_ENGINE_API int swmm_forcing_node_head_boundary ( SWMM_Engine engine,
int idx,
double value,
int mode,
int persist )

Force a head boundary at an outfall node.

Parameters
engineEngine handle.
idxNode index (must be OUTFALL type).
valueBoundary head (ft for US, m for SI).
modeSWMM_FORCING_OVERRIDE (only valid mode for head boundary).
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.

◆ swmm_forcing_node_lat_inflow()

SWMM_ENGINE_API int swmm_forcing_node_lat_inflow ( SWMM_Engine engine,
int idx,
double value,
int mode,
int persist )

Force a lateral inflow at a node.

Parameters
engineEngine handle.
idxNode index.
valueLateral inflow rate (CFS for US, CMS for SI).
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.

◆ swmm_forcing_node_quality()

SWMM_ENGINE_API int swmm_forcing_node_quality ( SWMM_Engine engine,
int node_idx,
int pollutant_idx,
double mass_rate,
int mode,
int persist )

Force a quality mass flux at a node.

Parameters
engineEngine handle.
node_idxNode index.
pollutant_idxPollutant index.
mass_rateMass injection rate (mass/sec in concentration units × CFS).
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.

◆ swmm_forcing_subcatch_evap()

SWMM_ENGINE_API int swmm_forcing_subcatch_evap ( SWMM_Engine engine,
int idx,
double value,
int mode,
int persist )

Prescribe a potential evapotranspiration (PET) rate on a subcatchment.

The prescribed rate replaces (OVERRIDE) or augments (ADD) the climate-derived evaporation rate for the subcatchment's surface, LID, and groundwater upper-zone evaporation. An OVERRIDE rate is applied as-is, bypassing the DRY_ONLY option and monthly adjustments. Actual evaporation remains capped by available water, so losses are tracked through the normal runoff continuity totals.

Parameters
engineEngine handle.
idxSubcatchment index.
valuePET rate in user units (in/day for US, mm/day for SI).
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.
Here is the call graph for this function:

◆ swmm_forcing_subcatch_rainfall()

SWMM_ENGINE_API int swmm_forcing_subcatch_rainfall ( SWMM_Engine engine,
int idx,
double value,
int mode,
int persist )

Force rainfall on a subcatchment (bypasses gage lookup).

Parameters
engineEngine handle.
idxSubcatchment index.
valueRainfall rate (in/hr for US, mm/hr for SI).
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.

◆ swmm_forcing_subcatch_snowfall()

SWMM_ENGINE_API int swmm_forcing_subcatch_snowfall ( SWMM_Engine engine,
int idx,
double value,
int mode,
int persist )

Prescribe snowfall on a subcatchment.

The prescribed rate replaces (OVERRIDE) or augments (ADD) the gage-derived, temperature-split snowfall used for snow pack accumulation, plowing, and melt computation. Only meaningful for subcatchments with an assigned snow pack.

Parameters
engineEngine handle.
idxSubcatchment index.
valueSnowfall rate in user units (in/hr for US, mm/hr for SI), as snow water equivalent. Must be >= 0 for OVERRIDE.
modeSWMM_FORCING_OVERRIDE or SWMM_FORCING_ADD.
persistSWMM_FORCING_RESET or SWMM_FORCING_PERSIST.
Returns
SWMM_OK or error code.
Here is the call graph for this function: