OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm_climate_impl.cpp File Reference

C API implementation — climatology configuration get/set. More...

Include dependency graph for openswmm_climate_impl.cpp:

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.
 

Detailed Description

C API implementation — climatology configuration get/set.

Reads/writes the parsed climate configuration held in SimulationOptions (temperature, evaporation, wind, snowmelt globals, areal-depletion curves) and SimulationContext (monthly adjustments). Values are stored verbatim in the project's display units — the internal-unit conversion is applied later by SWMMEngine::initHydrology() — so these accessors are a straight pass-through (no UCF conversion).

See also
include/openswmm/engine/openswmm_climate.h
src/engine/core/SWMMEngine.cpp — initHydrology() propagates this config
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_adc_impervious()

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).

Parameters
countMust equal SWMM_CLIMATE_ADC_POINTS.

◆ swmm_climate_get_adc_pervious()

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).

Parameters
countMust equal SWMM_CLIMATE_ADC_POINTS.

◆ swmm_climate_get_adjust_conductivity()

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).

Parameters
countMust equal SWMM_CLIMATE_MONTHS.

◆ swmm_climate_get_adjust_evaporation()

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).

Parameters
countMust equal SWMM_CLIMATE_MONTHS.

◆ swmm_climate_get_adjust_rainfall()

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).

Parameters
countMust equal SWMM_CLIMATE_MONTHS.

◆ swmm_climate_get_adjust_temperature()

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).

Parameters
countMust equal SWMM_CLIMATE_MONTHS.

◆ swmm_climate_get_ati_weight()

SWMM_ENGINE_API int swmm_climate_get_ati_weight ( SWMM_Engine engine,
double * tipm )

Get the antecedent-temperature-index weight (TIPM, 0..1).

◆ swmm_climate_get_elevation()

SWMM_ENGINE_API int swmm_climate_get_elevation ( SWMM_Engine engine,
double * elev )

Get the site elevation (project length units; for psychrometric constant).

◆ swmm_climate_get_evap_monthly()

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).

Parameters
countMust equal SWMM_CLIMATE_MONTHS.

◆ swmm_climate_get_evap_recovery()

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_climate_get_evap_timeseries()

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_climate_get_evap_type()

SWMM_ENGINE_API int swmm_climate_get_evap_type ( SWMM_Engine engine,
int * type )

Get the evaporation method (see SWMM_EvapType).

◆ swmm_climate_get_latitude()

SWMM_ENGINE_API int swmm_climate_get_latitude ( SWMM_Engine engine,
double * latitude )

Get the site latitude (degrees, for Hargreaves ET / snowmelt).

◆ swmm_climate_get_longitude_correction()

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_climate_get_neg_melt_ratio()

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_climate_get_pan_coeff()

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).

Parameters
countMust equal SWMM_CLIMATE_MONTHS.

◆ swmm_climate_get_snow_temp()

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_climate_get_temp_file_start()

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_climate_get_temp_source()

SWMM_ENGINE_API int swmm_climate_get_temp_source ( SWMM_Engine engine,
int * source )

Get the air-temperature data source (see SWMM_TempSource).

◆ swmm_climate_get_temp_timeseries()

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_climate_get_temp_units()

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_climate_get_wind_monthly()

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).

Parameters
countMust equal SWMM_CLIMATE_MONTHS.

◆ swmm_climate_get_wind_type()

SWMM_ENGINE_API int swmm_climate_get_wind_type ( SWMM_Engine engine,
int * type )

Get the wind-speed data source (see SWMM_WindType).

◆ swmm_climate_set_adc_impervious()

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_climate_set_adc_pervious()

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_climate_set_adjust_conductivity()

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_climate_set_adjust_evaporation()

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_climate_set_adjust_rainfall()

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_climate_set_adjust_temperature()

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_climate_set_ati_weight()

SWMM_ENGINE_API int swmm_climate_set_ati_weight ( SWMM_Engine engine,
double tipm )

Set the antecedent-temperature-index weight (TIPM).

Returns
SWMM_ERR_BADPARAM if outside [0, 1].

◆ swmm_climate_set_elevation()

SWMM_ENGINE_API int swmm_climate_set_elevation ( SWMM_Engine engine,
double elev )

Set the site elevation (project length units).

◆ swmm_climate_set_evap_monthly()

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_climate_set_evap_recovery()

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_climate_set_evap_timeseries()

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_climate_set_evap_type()

SWMM_ENGINE_API int swmm_climate_set_evap_type ( SWMM_Engine engine,
int type )

Set the evaporation method (0..4, see SWMM_EvapType).

Returns
SWMM_ERR_BADPARAM if out of range.

◆ swmm_climate_set_latitude()

SWMM_ENGINE_API int swmm_climate_set_latitude ( SWMM_Engine engine,
double latitude )

Set the site latitude (degrees, -90..90).

Returns
SWMM_ERR_BADPARAM if outside [-90, 90].

◆ swmm_climate_set_longitude_correction()

SWMM_ENGINE_API int swmm_climate_set_longitude_correction ( SWMM_Engine engine,
double minutes )

Set the longitude/solar-time correction (minutes).

◆ swmm_climate_set_neg_melt_ratio()

SWMM_ENGINE_API int swmm_climate_set_neg_melt_ratio ( SWMM_Engine engine,
double rnm )

Set the negative-melt-coefficient ratio (RNM).

Returns
SWMM_ERR_BADPARAM if outside [0, 1].

◆ swmm_climate_set_pan_coeff()

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_climate_set_snow_temp()

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_climate_set_temp_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_climate_set_temp_source()

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).

Returns
SWMM_ERR_BADPARAM if out of range; SWMM_ERR_LIFECYCLE if not editable.

◆ swmm_climate_set_temp_timeseries()

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_climate_set_temp_units()

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).

Returns
SWMM_ERR_BADPARAM if not in {-1,0,1,2}.

◆ swmm_climate_set_wind_monthly()

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_climate_set_wind_type()

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).

Returns
SWMM_ERR_BADPARAM if out of range.