OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_climate.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
56
57#ifndef OPENSWMM_CLIMATE_H
58#define OPENSWMM_CLIMATE_H
59
60#include "openswmm_engine.h"
61
62#ifdef __cplusplus
63extern "C" {
64#endif
65
67#define SWMM_CLIMATE_MONTHS 12
68
70#define SWMM_CLIMATE_ADC_POINTS 10
71
80
91
99
108
117
118/* =========================================================================
119 * Temperature ([TEMPERATURE])
120 * ========================================================================= */
121
127
129SWMM_ENGINE_API int swmm_climate_get_temp_timeseries(SWMM_Engine engine, char* buf, int buflen);
132
137
144
149
151SWMM_ENGINE_API int swmm_climate_get_latitude(SWMM_Engine engine, double* latitude);
154SWMM_ENGINE_API int swmm_climate_set_latitude(SWMM_Engine engine, double latitude);
155
161
162/* =========================================================================
163 * Evaporation ([EVAPORATION])
164 * ========================================================================= */
165
171
174SWMM_ENGINE_API int swmm_climate_get_evap_monthly(SWMM_Engine engine, double* buf, int count);
177SWMM_ENGINE_API int swmm_climate_set_evap_monthly(SWMM_Engine engine, const double* values, int count);
178
180SWMM_ENGINE_API int swmm_climate_get_evap_timeseries(SWMM_Engine engine, char* buf, int buflen);
183
186SWMM_ENGINE_API int swmm_climate_get_pan_coeff(SWMM_Engine engine, double* buf, int count);
188SWMM_ENGINE_API int swmm_climate_set_pan_coeff(SWMM_Engine engine, const double* values, int count);
189
191SWMM_ENGINE_API int swmm_climate_get_evap_recovery(SWMM_Engine engine, char* buf, int buflen);
193SWMM_ENGINE_API int swmm_climate_set_evap_recovery(SWMM_Engine engine, const char* pattern_id);
194
195/* =========================================================================
196 * Wind speed ([TEMPERATURE] WINDSPEED)
197 * ========================================================================= */
198
204
207SWMM_ENGINE_API int swmm_climate_get_wind_monthly(SWMM_Engine engine, double* buf, int count);
209SWMM_ENGINE_API int swmm_climate_set_wind_monthly(SWMM_Engine engine, const double* values, int count);
210
211/* =========================================================================
212 * Humidity ([TEMPERATURE] HUMIDITY) — heat-model met input
213 * ========================================================================= */
214
220
226
230SWMM_ENGINE_API int swmm_climate_get_humidity_monthly(SWMM_Engine engine, double* buf, int count);
232SWMM_ENGINE_API int swmm_climate_set_humidity_monthly(SWMM_Engine engine, const double* values, int count);
233
235SWMM_ENGINE_API int swmm_climate_get_humidity_timeseries(SWMM_Engine engine, char* buf, int buflen);
238
239/* =========================================================================
240 * Snowmelt globals ([TEMPERATURE] SNOWMELT)
241 * ========================================================================= */
242
244SWMM_ENGINE_API int swmm_climate_get_snow_temp(SWMM_Engine engine, double* divide_temp);
246SWMM_ENGINE_API int swmm_climate_set_snow_temp(SWMM_Engine engine, double divide_temp);
247
253
259
260/* =========================================================================
261 * Areal-depletion curves ([TEMPERATURE] ADC)
262 * ========================================================================= */
263
266SWMM_ENGINE_API int swmm_climate_get_adc_impervious(SWMM_Engine engine, double* buf, int count);
269SWMM_ENGINE_API int swmm_climate_set_adc_impervious(SWMM_Engine engine, const double* values, int count);
270
273SWMM_ENGINE_API int swmm_climate_get_adc_pervious(SWMM_Engine engine, double* buf, int count);
276SWMM_ENGINE_API int swmm_climate_set_adc_pervious(SWMM_Engine engine, const double* values, int count);
277
278/* =========================================================================
279 * Monthly adjustments ([ADJUSTMENTS])
280 * ========================================================================= */
281
284SWMM_ENGINE_API int swmm_climate_get_adjust_temperature(SWMM_Engine engine, double* buf, int count);
286SWMM_ENGINE_API int swmm_climate_set_adjust_temperature(SWMM_Engine engine, const double* values, int count);
287
290SWMM_ENGINE_API int swmm_climate_get_adjust_evaporation(SWMM_Engine engine, double* buf, int count);
292SWMM_ENGINE_API int swmm_climate_set_adjust_evaporation(SWMM_Engine engine, const double* values, int count);
293
296SWMM_ENGINE_API int swmm_climate_get_adjust_rainfall(SWMM_Engine engine, double* buf, int count);
298SWMM_ENGINE_API int swmm_climate_set_adjust_rainfall(SWMM_Engine engine, const double* values, int count);
299
302SWMM_ENGINE_API int swmm_climate_get_adjust_conductivity(SWMM_Engine engine, double* buf, int count);
305SWMM_ENGINE_API int swmm_climate_set_adjust_conductivity(SWMM_Engine engine, const double* values, int count);
306
307#ifdef __cplusplus
308} /* extern "C" */
309#endif
310
311#endif /* OPENSWMM_CLIMATE_H */
#define SWMM_ENGINE_API
Definition openswmm_2d.h:53
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:51
SWMM_ENGINE_API int swmm_climate_set_humidity_timeseries(SWMM_Engine engine, const char *ts_id)
Assign the humidity time-series id and set the source to TIMESERIES.
Definition openswmm_climate_impl.cpp:368
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_PO...
Definition openswmm_climate_impl.cpp:454
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).
Definition openswmm_climate_impl.cpp:98
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.
Definition openswmm_climate_impl.cpp:487
SWMM_ENGINE_API int swmm_climate_set_elevation(SWMM_Engine engine, double elev)
Set the site elevation (project length units).
Definition openswmm_climate_impl.cpp:154
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).
Definition openswmm_climate_impl.cpp:138
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).
Definition openswmm_climate_impl.cpp:245
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).
Definition openswmm_climate_impl.cpp:116
SWMM_ENGINE_API int swmm_climate_get_wind_type(SWMM_Engine engine, int *type)
Get the wind-speed data source (see SWMM_WindType).
Definition openswmm_climate_impl.cpp:280
SWMM_ENGINE_API int swmm_climate_set_humidity_variable(SWMM_Engine engine, int var)
Set the humidity quantity (0..1, see SWMM_HumidityVar).
Definition openswmm_climate_impl.cpp:337
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).
Definition openswmm_climate_impl.cpp:296
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).
Definition openswmm_climate_impl.cpp:448
SWMM_ENGINE_API int swmm_climate_set_latitude(SWMM_Engine engine, double latitude)
Set the site latitude (degrees, -90..90).
Definition openswmm_climate_impl.cpp:169
SWMM_ENGINE_API int swmm_climate_set_neg_melt_ratio(SWMM_Engine engine, double rnm)
Set the negative-melt-coefficient ratio (RNM).
Definition openswmm_climate_impl.cpp:420
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).
Definition openswmm_climate_impl.cpp:287
SWMM_ENGINE_API int swmm_climate_get_elevation(SWMM_Engine engine, double *elev)
Get the site elevation (project length units; for psychrometric constant).
Definition openswmm_climate_impl.cpp:147
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...
Definition openswmm_climate_impl.cpp:131
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).
Definition openswmm_climate_impl.cpp:433
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.
Definition openswmm_climate_impl.cpp:251
SWMM_ENGINE_API int swmm_climate_get_snow_temp(SWMM_Engine engine, double *divide_temp)
Get the snow/rain dividing temperature (project temperature units).
Definition openswmm_climate_impl.cpp:382
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.
Definition openswmm_climate_impl.cpp:501
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....
Definition openswmm_climate_impl.cpp:515
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).
Definition openswmm_climate_impl.cpp:481
SWMM_TempSource
Air-temperature data source (matches [TEMPERATURE]).
Definition openswmm_climate.h:75
@ SWMM_TEMP_FILE
Definition openswmm_climate.h:78
@ SWMM_TEMP_TIMESERIES
Definition openswmm_climate.h:77
@ SWMM_TEMP_NONE
Definition openswmm_climate.h:76
SWMM_HumidityVar
Quantity the HUMIDITY values express.
Definition openswmm_climate.h:112
@ SWMM_HUMIDITY_RELATIVE
Definition openswmm_climate.h:113
@ SWMM_HUMIDITY_DEWPOINT
Definition openswmm_climate.h:114
SWMM_ENGINE_API int swmm_climate_get_evap_type(SWMM_Engine engine, int *type)
Get the evaporation method (see SWMM_EvapType).
Definition openswmm_climate_impl.cpp:197
SWMM_WindType
Wind-speed data source (matches [TEMPERATURE] WINDSPEED).
Definition openswmm_climate.h:95
@ SWMM_WIND_FILE
Definition openswmm_climate.h:97
@ SWMM_WIND_MONTHLY
Definition openswmm_climate.h:96
SWMM_ENGINE_API int swmm_climate_get_humidity_timeseries(SWMM_Engine engine, char *buf, int buflen)
Get the humidity time-series id (empty if none).
Definition openswmm_climate_impl.cpp:360
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.
Definition openswmm_climate_impl.cpp:473
SWMM_ENGINE_API int swmm_climate_get_humidity_type(SWMM_Engine engine, int *type)
Get the humidity data source (see SWMM_HumidityType).
Definition openswmm_climate_impl.cpp:314
SWMM_ENGINE_API int swmm_climate_get_humidity_variable(SWMM_Engine engine, int *var)
Get the humidity quantity (see SWMM_HumidityVar).
Definition openswmm_climate_impl.cpp:330
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).
Definition openswmm_climate_impl.cpp:259
SWMM_ENGINE_API int swmm_climate_set_ati_weight(SWMM_Engine engine, double tipm)
Set the antecedent-temperature-index weight (TIPM).
Definition openswmm_climate_impl.cpp:404
SWMM_ENGINE_API int swmm_climate_set_longitude_correction(SWMM_Engine engine, double minutes)
Set the longitude/solar-time correction (minutes).
Definition openswmm_climate_impl.cpp:185
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; cou...
Definition openswmm_climate_impl.cpp:219
SWMM_EvapType
Evaporation method (matches [EVAPORATION]).
Definition openswmm_climate.h:84
@ SWMM_EVAP_TIMESERIES
Definition openswmm_climate.h:87
@ SWMM_EVAP_MONTHLY
Definition openswmm_climate.h:86
@ SWMM_EVAP_CONSTANT
Definition openswmm_climate.h:85
@ SWMM_EVAP_FILE
Definition openswmm_climate.h:89
@ SWMM_EVAP_TEMPERATURE
Definition openswmm_climate.h:88
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).
Definition openswmm_climate_impl.cpp:89
SWMM_ENGINE_API int swmm_climate_set_evap_type(SWMM_Engine engine, int type)
Set the evaporation method (0..4, see SWMM_EvapType).
Definition openswmm_climate_impl.cpp:204
SWMM_ENGINE_API int swmm_climate_set_humidity_monthly(SWMM_Engine engine, const double *values, int count)
Set the 12 monthly humidity values; count must equal SWMM_CLIMATE_MONTHS.
Definition openswmm_climate_impl.cpp:352
SWMM_HumidityType
Humidity data source (matches [TEMPERATURE] HUMIDITY).
Definition openswmm_climate.h:103
@ SWMM_HUMIDITY_TIMESERIES
Definition openswmm_climate.h:106
@ SWMM_HUMIDITY_MONTHLY
Definition openswmm_climate.h:105
@ SWMM_HUMIDITY_CONSTANT
Definition openswmm_climate.h:104
SWMM_ENGINE_API int swmm_climate_set_snow_temp(SWMM_Engine engine, double divide_temp)
Set the snow/rain dividing temperature (project temperature units).
Definition openswmm_climate_impl.cpp:389
SWMM_ENGINE_API int swmm_climate_set_humidity_type(SWMM_Engine engine, int type)
Set the humidity data source (0..2, see SWMM_HumidityType).
Definition openswmm_climate_impl.cpp:321
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).
Definition openswmm_climate_impl.cpp:227
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.
Definition openswmm_climate_impl.cpp:235
SWMM_ENGINE_API int swmm_climate_get_neg_melt_ratio(SWMM_Engine engine, double *rnm)
Get the negative-melt-coefficient ratio (RNM, 0..1).
Definition openswmm_climate_impl.cpp:413
SWMM_ENGINE_API int swmm_climate_get_ati_weight(SWMM_Engine engine, double *tipm)
Get the antecedent-temperature-index weight (TIPM, 0..1).
Definition openswmm_climate_impl.cpp:397
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).
Definition openswmm_climate_impl.cpp:509
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).
Definition openswmm_climate_impl.cpp:267
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).
Definition openswmm_climate_impl.cpp:495
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).
Definition openswmm_climate_impl.cpp:123
SWMM_ENGINE_API int swmm_climate_get_latitude(SWMM_Engine engine, double *latitude)
Get the site latitude (degrees, for Hargreaves ET / snowmelt).
Definition openswmm_climate_impl.cpp:162
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 ...
Definition openswmm_climate_impl.cpp:178
SWMM_ENGINE_API int swmm_climate_get_temp_source(SWMM_Engine engine, int *source)
Get the air-temperature data source (see SWMM_TempSource).
Definition openswmm_climate_impl.cpp:82
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.
Definition openswmm_climate_impl.cpp:106
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).
Definition openswmm_climate_impl.cpp:213
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.
Definition openswmm_climate_impl.cpp:302
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).
Definition openswmm_climate_impl.cpp:467
SWMM_ENGINE_API int swmm_climate_get_humidity_monthly(SWMM_Engine engine, double *buf, int count)
Get the 12 monthly humidity values (RH % or dew point, per the variable). With the CONSTANT source al...
Definition openswmm_climate_impl.cpp:346
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_...
Definition openswmm_climate_impl.cpp:439
OpenSWMM Engine — primary transparent C API (master header).