![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
OpenSWMM Engine — Climatology configuration C API. More...
#include "openswmm_engine.h"Go to the source code of this file.
Macros | |
| #define | SWMM_CLIMATE_MONTHS 12 |
| Number of monthly values in a climate monthly table. | |
| #define | SWMM_CLIMATE_ADC_POINTS 10 |
| Number of points in an areal-depletion curve. | |
Typedefs | |
| typedef enum SWMM_TempSource | SWMM_TempSource |
| Air-temperature data source (matches [TEMPERATURE]). | |
| typedef enum SWMM_EvapType | SWMM_EvapType |
| Evaporation method (matches [EVAPORATION]). | |
| typedef enum SWMM_WindType | SWMM_WindType |
| Wind-speed data source (matches [TEMPERATURE] WINDSPEED). | |
Enumerations | |
| enum | SWMM_TempSource { SWMM_TEMP_NONE = 0 , SWMM_TEMP_TIMESERIES = 1 , SWMM_TEMP_FILE = 2 } |
| Air-temperature data source (matches [TEMPERATURE]). More... | |
| enum | SWMM_EvapType { SWMM_EVAP_CONSTANT = 0 , SWMM_EVAP_MONTHLY = 1 , SWMM_EVAP_TIMESERIES = 2 , SWMM_EVAP_TEMPERATURE = 3 , SWMM_EVAP_FILE = 4 } |
| Evaporation method (matches [EVAPORATION]). More... | |
| enum | SWMM_WindType { SWMM_WIND_MONTHLY = 0 , SWMM_WIND_FILE = 1 } |
| Wind-speed data source (matches [TEMPERATURE] WINDSPEED). More... | |
Functions | |
| SWMM_ENGINE_API int | swmm_climate_get_temp_source (SWMM_Engine engine, int *source) |
| Get the air-temperature data source (see SWMM_TempSource). | |
| SWMM_ENGINE_API int | swmm_climate_set_temp_source (SWMM_Engine engine, int source) |
| Set the air-temperature data source (0..2, see SWMM_TempSource). | |
| SWMM_ENGINE_API int | swmm_climate_get_temp_timeseries (SWMM_Engine engine, char *buf, int buflen) |
| Get the temperature time-series id (empty if none). | |
| SWMM_ENGINE_API int | swmm_climate_set_temp_timeseries (SWMM_Engine engine, const char *ts_id) |
| Assign the temperature time-series id and set the source to TIMESERIES. | |
| SWMM_ENGINE_API int | swmm_climate_get_temp_file_start (SWMM_Engine engine, double *date) |
| Get the climate-file start date (DateTime decimal days; 0 = file start). | |
| SWMM_ENGINE_API int | swmm_climate_set_temp_file_start (SWMM_Engine engine, double date) |
| Set the climate-file start date (DateTime decimal days; 0 = file start). | |
| SWMM_ENGINE_API int | swmm_climate_get_temp_units (SWMM_Engine engine, int *units) |
| Get the climate-file temperature units: 0=tenths-degC (C10), 1=degC (C), 2=degF (F); -1 = unspecified (reader's per-format default). | |
| SWMM_ENGINE_API int | swmm_climate_set_temp_units (SWMM_Engine engine, int units) |
| Set the climate-file temperature units (-1, 0, 1, or 2). | |
| SWMM_ENGINE_API int | swmm_climate_get_elevation (SWMM_Engine engine, double *elev) |
| Get the site elevation (project length units; for psychrometric constant). | |
| SWMM_ENGINE_API int | swmm_climate_set_elevation (SWMM_Engine engine, double elev) |
| Set the site elevation (project length units). | |
| SWMM_ENGINE_API int | swmm_climate_get_latitude (SWMM_Engine engine, double *latitude) |
| Get the site latitude (degrees, for Hargreaves ET / snowmelt). | |
| SWMM_ENGINE_API int | swmm_climate_set_latitude (SWMM_Engine engine, double latitude) |
| Set the site latitude (degrees, -90..90). | |
| SWMM_ENGINE_API int | swmm_climate_get_longitude_correction (SWMM_Engine engine, double *minutes) |
| Get the longitude/solar-time correction (minutes; matches the legacy [TEMPERATURE] SNOWMELT field; 0 = use true solar time). | |
| SWMM_ENGINE_API int | swmm_climate_set_longitude_correction (SWMM_Engine engine, double minutes) |
| Set the longitude/solar-time correction (minutes). | |
| SWMM_ENGINE_API int | swmm_climate_get_evap_type (SWMM_Engine engine, int *type) |
| Get the evaporation method (see SWMM_EvapType). | |
| SWMM_ENGINE_API int | swmm_climate_set_evap_type (SWMM_Engine engine, int type) |
| Set the evaporation method (0..4, see SWMM_EvapType). | |
| SWMM_ENGINE_API int | swmm_climate_get_evap_monthly (SWMM_Engine engine, double *buf, int count) |
| Get the 12 monthly evaporation rates (project evap-rate units). | |
| SWMM_ENGINE_API int | swmm_climate_set_evap_monthly (SWMM_Engine engine, const double *values, int count) |
Set the 12 monthly evaporation rates. A CONSTANT method stores the first value across all months; count must equal SWMM_CLIMATE_MONTHS. | |
| SWMM_ENGINE_API int | swmm_climate_get_evap_timeseries (SWMM_Engine engine, char *buf, int buflen) |
| Get the evaporation time-series id (empty if none). | |
| SWMM_ENGINE_API int | swmm_climate_set_evap_timeseries (SWMM_Engine engine, const char *ts_id) |
| Assign the evaporation time-series id and set the method to TIMESERIES. | |
| SWMM_ENGINE_API int | swmm_climate_get_pan_coeff (SWMM_Engine engine, double *buf, int count) |
| Get the 12 monthly pan coefficients (used with the FILE method). | |
| SWMM_ENGINE_API int | swmm_climate_set_pan_coeff (SWMM_Engine engine, const double *values, int count) |
Set the 12 monthly pan coefficients; count must equal SWMM_CLIMATE_MONTHS. | |
| SWMM_ENGINE_API int | swmm_climate_get_evap_recovery (SWMM_Engine engine, char *buf, int buflen) |
| Get the soil-moisture recovery pattern id (empty if none). | |
| SWMM_ENGINE_API int | swmm_climate_set_evap_recovery (SWMM_Engine engine, const char *pattern_id) |
| Set the soil-moisture recovery pattern id (empty string clears it). | |
| SWMM_ENGINE_API int | swmm_climate_get_wind_type (SWMM_Engine engine, int *type) |
| Get the wind-speed data source (see SWMM_WindType). | |
| SWMM_ENGINE_API int | swmm_climate_set_wind_type (SWMM_Engine engine, int type) |
| Set the wind-speed data source (0..1, see SWMM_WindType). | |
| SWMM_ENGINE_API int | swmm_climate_get_wind_monthly (SWMM_Engine engine, double *buf, int count) |
| Get the 12 monthly average wind speeds (project wind-speed units). | |
| SWMM_ENGINE_API int | swmm_climate_set_wind_monthly (SWMM_Engine engine, const double *values, int count) |
Set the 12 monthly average wind speeds; count must equal SWMM_CLIMATE_MONTHS. | |
| SWMM_ENGINE_API int | swmm_climate_get_snow_temp (SWMM_Engine engine, double *divide_temp) |
| Get the snow/rain dividing temperature (project temperature units). | |
| SWMM_ENGINE_API int | swmm_climate_set_snow_temp (SWMM_Engine engine, double divide_temp) |
| Set the snow/rain dividing temperature (project temperature units). | |
| SWMM_ENGINE_API int | swmm_climate_get_ati_weight (SWMM_Engine engine, double *tipm) |
| Get the antecedent-temperature-index weight (TIPM, 0..1). | |
| SWMM_ENGINE_API int | swmm_climate_set_ati_weight (SWMM_Engine engine, double tipm) |
| Set the antecedent-temperature-index weight (TIPM). | |
| SWMM_ENGINE_API int | swmm_climate_get_neg_melt_ratio (SWMM_Engine engine, double *rnm) |
| Get the negative-melt-coefficient ratio (RNM, 0..1). | |
| SWMM_ENGINE_API int | swmm_climate_set_neg_melt_ratio (SWMM_Engine engine, double rnm) |
| Set the negative-melt-coefficient ratio (RNM). | |
| SWMM_ENGINE_API int | swmm_climate_get_adc_impervious (SWMM_Engine engine, double *buf, int count) |
| Get the impervious areal-depletion curve (10 fractions, 0..1). | |
| SWMM_ENGINE_API int | swmm_climate_set_adc_impervious (SWMM_Engine engine, const double *values, int count) |
Set the impervious areal-depletion curve; each fraction in [0, 1]; count must equal SWMM_CLIMATE_ADC_POINTS. | |
| SWMM_ENGINE_API int | swmm_climate_get_adc_pervious (SWMM_Engine engine, double *buf, int count) |
| Get the pervious areal-depletion curve (10 fractions, 0..1). | |
| SWMM_ENGINE_API int | swmm_climate_set_adc_pervious (SWMM_Engine engine, const double *values, int count) |
Set the pervious areal-depletion curve; each fraction in [0, 1]; count must equal SWMM_CLIMATE_ADC_POINTS. | |
| SWMM_ENGINE_API int | swmm_climate_get_adjust_temperature (SWMM_Engine engine, double *buf, int count) |
| Get the 12 monthly temperature adjustments (offsets, project temp units). | |
| SWMM_ENGINE_API int | swmm_climate_set_adjust_temperature (SWMM_Engine engine, const double *values, int count) |
Set the 12 monthly temperature adjustments; count must equal SWMM_CLIMATE_MONTHS. | |
| SWMM_ENGINE_API int | swmm_climate_get_adjust_evaporation (SWMM_Engine engine, double *buf, int count) |
| Get the 12 monthly evaporation adjustment multipliers (1.0 = none). | |
| SWMM_ENGINE_API int | swmm_climate_set_adjust_evaporation (SWMM_Engine engine, const double *values, int count) |
Set the 12 monthly evaporation adjustment multipliers; count must equal SWMM_CLIMATE_MONTHS. | |
| SWMM_ENGINE_API int | swmm_climate_get_adjust_rainfall (SWMM_Engine engine, double *buf, int count) |
| Get the 12 monthly rainfall adjustment multipliers (1.0 = none). | |
| SWMM_ENGINE_API int | swmm_climate_set_adjust_rainfall (SWMM_Engine engine, const double *values, int count) |
Set the 12 monthly rainfall adjustment multipliers; count must equal SWMM_CLIMATE_MONTHS. | |
| SWMM_ENGINE_API int | swmm_climate_get_adjust_conductivity (SWMM_Engine engine, double *buf, int count) |
| Get the 12 monthly hydraulic-conductivity adjustment multipliers (1.0 = none). | |
| SWMM_ENGINE_API int | swmm_climate_set_adjust_conductivity (SWMM_Engine engine, const double *values, int count) |
Set the 12 monthly hydraulic-conductivity adjustment multipliers; values <= 0 are stored as 1.0 (legacy behaviour); count must equal SWMM_CLIMATE_MONTHS. | |
OpenSWMM Engine — Climatology configuration C API.
Read/write accessors for the model's climate configuration — the data parsed from the [TEMPERATURE], [EVAPORATION], [WINDSPEED] (a sub-keyword of [TEMPERATURE]), [ADJUSTMENTS], and the snowmelt globals / areal-depletion curves. This complements the runtime climate forcing API in openswmm_forcing.h, which overrides the live air-temperature / wind / evaporation values while a simulation is RUNNING. The accessors here edit the inputs before a run.
Units: every value is expressed in the project's display units — exactly as it appears in the .inp file. The engine keeps these configuration values verbatim in SimulationOptions / SimulationContext and defers the internal-unit conversion to swmm_engine_initialize(); the accessors here are therefore a straight pass-through (no unit conversion at the boundary).
Setters require an editable lifecycle state (BUILDING or OPENED) and return SWMM_ERR_LIFECYCLE otherwise — once the simulation is initialized the configuration has already been baked into the climate/snow solver state. Getters work in any readable state.
DRY_ONLY is exposed by swmm_climate_get_dry_only / swmm_climate_set_dry_only in openswmm_forcing.h (not duplicated here). The climate temperature/evaporation FILE path is managed via swmm_file_path_get / swmm_file_path_set (SWMM_FILE_CLIMATE_TEMP) in openswmm_model.h.
| #define SWMM_CLIMATE_ADC_POINTS 10 |
Number of points in an areal-depletion curve.
| #define SWMM_CLIMATE_MONTHS 12 |
Number of monthly values in a climate monthly table.
| typedef enum SWMM_EvapType SWMM_EvapType |
Evaporation method (matches [EVAPORATION]).
| typedef enum SWMM_TempSource SWMM_TempSource |
Air-temperature data source (matches [TEMPERATURE]).
| typedef enum SWMM_WindType SWMM_WindType |
Wind-speed data source (matches [TEMPERATURE] WINDSPEED).
| enum SWMM_EvapType |
Evaporation method (matches [EVAPORATION]).
| enum SWMM_TempSource |
| enum SWMM_WindType |
| SWMM_ENGINE_API int swmm_climate_get_adc_impervious | ( | SWMM_Engine | engine, |
| double * | buf, | ||
| int | count ) |
Get the impervious areal-depletion curve (10 fractions, 0..1).
| count | Must equal SWMM_CLIMATE_ADC_POINTS. |
| SWMM_ENGINE_API int swmm_climate_get_adc_pervious | ( | SWMM_Engine | engine, |
| double * | buf, | ||
| int | count ) |
Get the pervious areal-depletion curve (10 fractions, 0..1).
| count | Must equal SWMM_CLIMATE_ADC_POINTS. |
| SWMM_ENGINE_API int swmm_climate_get_adjust_conductivity | ( | SWMM_Engine | engine, |
| double * | buf, | ||
| int | count ) |
Get the 12 monthly hydraulic-conductivity adjustment multipliers (1.0 = none).
| count | Must equal SWMM_CLIMATE_MONTHS. |
| SWMM_ENGINE_API int swmm_climate_get_adjust_evaporation | ( | SWMM_Engine | engine, |
| double * | buf, | ||
| int | count ) |
Get the 12 monthly evaporation adjustment multipliers (1.0 = none).
| count | Must equal SWMM_CLIMATE_MONTHS. |
| SWMM_ENGINE_API int swmm_climate_get_adjust_rainfall | ( | SWMM_Engine | engine, |
| double * | buf, | ||
| int | count ) |
Get the 12 monthly rainfall adjustment multipliers (1.0 = none).
| count | Must equal SWMM_CLIMATE_MONTHS. |
| SWMM_ENGINE_API int swmm_climate_get_adjust_temperature | ( | SWMM_Engine | engine, |
| double * | buf, | ||
| int | count ) |
Get the 12 monthly temperature adjustments (offsets, project temp units).
| count | Must equal SWMM_CLIMATE_MONTHS. |
| SWMM_ENGINE_API int swmm_climate_get_ati_weight | ( | SWMM_Engine | engine, |
| double * | tipm ) |
Get the antecedent-temperature-index weight (TIPM, 0..1).
| SWMM_ENGINE_API int swmm_climate_get_elevation | ( | SWMM_Engine | engine, |
| double * | elev ) |
Get the site elevation (project length units; for psychrometric constant).
| SWMM_ENGINE_API int swmm_climate_get_evap_monthly | ( | SWMM_Engine | engine, |
| double * | buf, | ||
| int | count ) |
Get the 12 monthly evaporation rates (project evap-rate units).
| count | Must equal SWMM_CLIMATE_MONTHS. |
| SWMM_ENGINE_API int swmm_climate_get_evap_recovery | ( | SWMM_Engine | engine, |
| char * | buf, | ||
| int | buflen ) |
Get the soil-moisture recovery pattern id (empty if none).
| SWMM_ENGINE_API int swmm_climate_get_evap_timeseries | ( | SWMM_Engine | engine, |
| char * | buf, | ||
| int | buflen ) |
Get the evaporation time-series id (empty if none).
| SWMM_ENGINE_API int swmm_climate_get_evap_type | ( | SWMM_Engine | engine, |
| int * | type ) |
Get the evaporation method (see SWMM_EvapType).
| SWMM_ENGINE_API int swmm_climate_get_latitude | ( | SWMM_Engine | engine, |
| double * | latitude ) |
Get the site latitude (degrees, for Hargreaves ET / snowmelt).
| SWMM_ENGINE_API int swmm_climate_get_longitude_correction | ( | SWMM_Engine | engine, |
| double * | minutes ) |
Get the longitude/solar-time correction (minutes; matches the legacy [TEMPERATURE] SNOWMELT field; 0 = use true solar time).
| SWMM_ENGINE_API int swmm_climate_get_neg_melt_ratio | ( | SWMM_Engine | engine, |
| double * | rnm ) |
Get the negative-melt-coefficient ratio (RNM, 0..1).
| SWMM_ENGINE_API int swmm_climate_get_pan_coeff | ( | SWMM_Engine | engine, |
| double * | buf, | ||
| int | count ) |
Get the 12 monthly pan coefficients (used with the FILE method).
| count | Must equal SWMM_CLIMATE_MONTHS. |
| SWMM_ENGINE_API int swmm_climate_get_snow_temp | ( | SWMM_Engine | engine, |
| double * | divide_temp ) |
Get the snow/rain dividing temperature (project temperature units).
| SWMM_ENGINE_API int swmm_climate_get_temp_file_start | ( | SWMM_Engine | engine, |
| double * | date ) |
Get the climate-file start date (DateTime decimal days; 0 = file start).
| SWMM_ENGINE_API int swmm_climate_get_temp_source | ( | SWMM_Engine | engine, |
| int * | source ) |
Get the air-temperature data source (see SWMM_TempSource).
| SWMM_ENGINE_API int swmm_climate_get_temp_timeseries | ( | SWMM_Engine | engine, |
| char * | buf, | ||
| int | buflen ) |
Get the temperature time-series id (empty if none).
| SWMM_ENGINE_API int swmm_climate_get_temp_units | ( | SWMM_Engine | engine, |
| int * | units ) |
Get the climate-file temperature units: 0=tenths-degC (C10), 1=degC (C), 2=degF (F); -1 = unspecified (reader's per-format default).
| SWMM_ENGINE_API int swmm_climate_get_wind_monthly | ( | SWMM_Engine | engine, |
| double * | buf, | ||
| int | count ) |
Get the 12 monthly average wind speeds (project wind-speed units).
| count | Must equal SWMM_CLIMATE_MONTHS. |
| SWMM_ENGINE_API int swmm_climate_get_wind_type | ( | SWMM_Engine | engine, |
| int * | type ) |
Get the wind-speed data source (see SWMM_WindType).
| SWMM_ENGINE_API int swmm_climate_set_adc_impervious | ( | SWMM_Engine | engine, |
| const double * | values, | ||
| int | count ) |
Set the impervious areal-depletion curve; each fraction in [0, 1]; count must equal SWMM_CLIMATE_ADC_POINTS.
| SWMM_ENGINE_API int swmm_climate_set_adc_pervious | ( | SWMM_Engine | engine, |
| const double * | values, | ||
| int | count ) |
Set the pervious areal-depletion curve; each fraction in [0, 1]; count must equal SWMM_CLIMATE_ADC_POINTS.
| SWMM_ENGINE_API int swmm_climate_set_adjust_conductivity | ( | SWMM_Engine | engine, |
| const double * | values, | ||
| int | count ) |
Set the 12 monthly hydraulic-conductivity adjustment multipliers; values <= 0 are stored as 1.0 (legacy behaviour); count must equal SWMM_CLIMATE_MONTHS.
| SWMM_ENGINE_API int swmm_climate_set_adjust_evaporation | ( | SWMM_Engine | engine, |
| const double * | values, | ||
| int | count ) |
Set the 12 monthly evaporation adjustment multipliers; count must equal SWMM_CLIMATE_MONTHS.
| SWMM_ENGINE_API int swmm_climate_set_adjust_rainfall | ( | SWMM_Engine | engine, |
| const double * | values, | ||
| int | count ) |
Set the 12 monthly rainfall adjustment multipliers; count must equal SWMM_CLIMATE_MONTHS.
| SWMM_ENGINE_API int swmm_climate_set_adjust_temperature | ( | SWMM_Engine | engine, |
| const double * | values, | ||
| int | count ) |
Set the 12 monthly temperature adjustments; count must equal SWMM_CLIMATE_MONTHS.
| SWMM_ENGINE_API int swmm_climate_set_ati_weight | ( | SWMM_Engine | engine, |
| double | tipm ) |
Set the antecedent-temperature-index weight (TIPM).
| SWMM_ENGINE_API int swmm_climate_set_elevation | ( | SWMM_Engine | engine, |
| double | elev ) |
Set the site elevation (project length units).
| SWMM_ENGINE_API int swmm_climate_set_evap_monthly | ( | SWMM_Engine | engine, |
| const double * | values, | ||
| int | count ) |
Set the 12 monthly evaporation rates. A CONSTANT method stores the first value across all months; count must equal SWMM_CLIMATE_MONTHS.
| SWMM_ENGINE_API int swmm_climate_set_evap_recovery | ( | SWMM_Engine | engine, |
| const char * | pattern_id ) |
Set the soil-moisture recovery pattern id (empty string clears it).
| SWMM_ENGINE_API int swmm_climate_set_evap_timeseries | ( | SWMM_Engine | engine, |
| const char * | ts_id ) |
Assign the evaporation time-series id and set the method to TIMESERIES.
| SWMM_ENGINE_API int swmm_climate_set_evap_type | ( | SWMM_Engine | engine, |
| int | type ) |
Set the evaporation method (0..4, see SWMM_EvapType).
| SWMM_ENGINE_API int swmm_climate_set_latitude | ( | SWMM_Engine | engine, |
| double | latitude ) |
Set the site latitude (degrees, -90..90).
| SWMM_ENGINE_API int swmm_climate_set_longitude_correction | ( | SWMM_Engine | engine, |
| double | minutes ) |
Set the longitude/solar-time correction (minutes).
| SWMM_ENGINE_API int swmm_climate_set_neg_melt_ratio | ( | SWMM_Engine | engine, |
| double | rnm ) |
Set the negative-melt-coefficient ratio (RNM).
| SWMM_ENGINE_API int swmm_climate_set_pan_coeff | ( | SWMM_Engine | engine, |
| const double * | values, | ||
| int | count ) |
Set the 12 monthly pan coefficients; count must equal SWMM_CLIMATE_MONTHS.
| SWMM_ENGINE_API int swmm_climate_set_snow_temp | ( | SWMM_Engine | engine, |
| double | divide_temp ) |
Set the snow/rain dividing temperature (project temperature units).
| SWMM_ENGINE_API int swmm_climate_set_temp_file_start | ( | SWMM_Engine | engine, |
| double | date ) |
Set the climate-file start date (DateTime decimal days; 0 = file start).
| SWMM_ENGINE_API int swmm_climate_set_temp_source | ( | SWMM_Engine | engine, |
| int | source ) |
Set the air-temperature data source (0..2, see SWMM_TempSource).
| SWMM_ENGINE_API int swmm_climate_set_temp_timeseries | ( | SWMM_Engine | engine, |
| const char * | ts_id ) |
Assign the temperature time-series id and set the source to TIMESERIES.
| SWMM_ENGINE_API int swmm_climate_set_temp_units | ( | SWMM_Engine | engine, |
| int | units ) |
Set the climate-file temperature units (-1, 0, 1, or 2).
| SWMM_ENGINE_API int swmm_climate_set_wind_monthly | ( | SWMM_Engine | engine, |
| const double * | values, | ||
| int | count ) |
Set the 12 monthly average wind speeds; count must equal SWMM_CLIMATE_MONTHS.
| SWMM_ENGINE_API int swmm_climate_set_wind_type | ( | SWMM_Engine | engine, |
| int | type ) |
Set the wind-speed data source (0..1, see SWMM_WindType).