OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_heat.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
51
52#ifndef OPENSWMM_HEAT_H
53#define OPENSWMM_HEAT_H
54
55#include "openswmm_engine.h"
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
67
84
96
112
120
121/* ---------------------------------------------------------------- toggles */
122
124SWMM_ENGINE_API int swmm_heat_get_enabled(SWMM_Engine engine, int* enabled);
125
128 int* on);
131 int on);
132
133/* ------------------------------------------------------------- radiative */
134
137 double* value);
148 double value);
149
152 int* mode);
159 int mode);
160
165 const char* name);
166
175 char* buf, int buflen);
176
181 double* wm2);
182
183/* ----------------------------------------------------------------- solar */
184
187 double* value);
193 double value);
194
200
201/* ----------------------------------------------------------------- cloud */
202
205 int* configured);
206
209 double* value);
215 double value);
216
220 const char* name);
221
227 char* buf, int buflen);
228
234
237 double* fraction);
238
239/* -------------------------------------------------------- [HEAT_SOURCES]
240 *
241 * The per-source inlet temperature table: a GLOBAL °C for each of the seven
242 * water sources, plus NODE-scope overrides. Added for the G4g editor, which
243 * cannot round-trip a table the API cannot read.
244 *
245 * Every refusal below mirrors `HeatComponent.cpp`'s parser exactly, so a
246 * value the deck rejects is a value this API rejects, and the two cannot
247 * disagree about what a model contains. Values are REFUSED, never clamped.
248 */
249
260
265
271 double* temp_c);
272
279 double temp_c);
280
285 int source,
286 int* configured);
287
293 int source);
294
297 int* count);
298
301 int* source, int* node,
302 double* temp_c);
303
316 int source, int node,
317 double temp_c);
318
322 int index);
323
330 int source, int node,
331 double* temp_c);
332
333#ifdef __cplusplus
334}
335#endif
336
337#endif /* OPENSWMM_HEAT_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
OpenSWMM Engine — primary transparent C API (master header).
SWMM_ENGINE_API int swmm_heat_clear_cloud(SWMM_Engine engine)
Clear [CLOUD_COVER] entirely — back to clear sky.
Definition openswmm_heat_impl.cpp:437
SWMM_ENGINE_API int swmm_heat_get_effective_source_temp(SWMM_Engine engine, int source, int node, double *temp_c)
The temperature source water actually enters node at (°C) — the NODE override when one exists,...
Definition openswmm_heat_impl.cpp:597
SWMM_ENGINE_API int swmm_heat_get_radiative(SWMM_Engine engine, int param, double *value)
Read one [RADIATIVE_FLUXES] parameter.
Definition openswmm_heat_impl.cpp:127
SWMM_ENGINE_API int swmm_heat_get_cloud_configured(SWMM_Engine engine, int *configured)
Is a [CLOUD_COVER] section in effect?
Definition openswmm_heat_impl.cpp:359
SWMM_ENGINE_API int swmm_heat_clear_source_temp(SWMM_Engine engine, int source)
Return a source to the 20 °C default and mark it unconfigured, so the writer emits no row for it....
Definition openswmm_heat_impl.cpp:513
SWMM_ENGINE_API int swmm_heat_set_radiative(SWMM_Engine engine, int param, double value)
Write one [RADIATIVE_FLUXES] parameter.
Definition openswmm_heat_impl.cpp:146
SWMM_ENGINE_API int swmm_heat_get_module(SWMM_Engine engine, int module, int *on)
Read one [HEAT_FLUXES] module toggle.
Definition openswmm_heat_impl.cpp:92
SWMM_ENGINE_API int swmm_heat_get_cloud_timeseries(SWMM_Engine engine, char *buf, int buflen)
Name of the [TIMESERIES] bound as the cloud-fraction record, or "" when none is bound....
Definition openswmm_heat_impl.cpp:428
SWMM_HeatSolarParam
[SOLAR_RADIATION] parameters (consulted under COMPUTED only).
Definition openswmm_heat.h:98
@ SWMM_HEAT_SOLAR_PRECIP_WATER
Definition openswmm_heat.h:107
@ SWMM_HEAT_SOLAR_LONGITUDE
Definition openswmm_heat.h:100
@ SWMM_HEAT_SOLAR_TURBIDITY_500
Definition openswmm_heat.h:106
@ SWMM_HEAT_SOLAR_TIMEZONE
Definition openswmm_heat.h:101
@ SWMM_HEAT_SOLAR_GROUND_ALBEDO
Definition openswmm_heat.h:109
@ SWMM_HEAT_SOLAR_TURBIDITY_380
Definition openswmm_heat.h:105
@ SWMM_HEAT_SOLAR_ELEVATION
Definition openswmm_heat.h:102
@ SWMM_HEAT_SOLAR_OZONE
Definition openswmm_heat.h:108
@ SWMM_HEAT_SOLAR_LATITUDE
Definition openswmm_heat.h:99
SWMM_ENGINE_API int swmm_heat_set_shortwave_mode(SWMM_Engine engine, int mode)
Set the incoming-shortwave mode.
Definition openswmm_heat_impl.cpp:203
SWMM_ENGINE_API int swmm_heat_set_cloud(SWMM_Engine engine, int param, double value)
Write one [CLOUD_COVER] parameter. Writing any of them marks cloud cover as configured.
Definition openswmm_heat_impl.cpp:383
SWMM_ENGINE_API int swmm_heat_get_solar(SWMM_Engine engine, int param, double *value)
Read one [SOLAR_RADIATION] parameter.
Definition openswmm_heat_impl.cpp:274
SWMM_ENGINE_API int swmm_heat_set_source_temp(SWMM_Engine engine, int source, double temp_c)
Write one source's GLOBAL inlet temperature (°C).
Definition openswmm_heat_impl.cpp:488
SWMM_ENGINE_API int swmm_heat_source_count(SWMM_Engine engine, int *count)
Number of sources the table carries (7). Never fails on a model with no heat configured — the table i...
Definition openswmm_heat_impl.cpp:469
SWMM_ENGINE_API int swmm_heat_set_cloud_timeseries(SWMM_Engine engine, const char *name)
Bind a [TIMESERIES] (by name) as the cloud-fraction record.
Definition openswmm_heat_impl.cpp:413
SWMM_ENGINE_API int swmm_heat_get_shortwave_timeseries(SWMM_Engine engine, char *buf, int buflen)
Name of the [TIMESERIES] bound as the shortwave record, or "" when none is bound. NUL-terminated,...
Definition openswmm_heat_impl.cpp:248
SWMM_ENGINE_API int swmm_heat_node_override_count(SWMM_Engine engine, int *count)
Number of NODE-scope override rows.
Definition openswmm_heat_impl.cpp:527
SWMM_ENGINE_API int swmm_heat_get_current_cloud(SWMM_Engine engine, double *fraction)
Cloud fraction in effect at the CURRENT step, [0,1]. Read-only.
Definition openswmm_heat_impl.cpp:453
SWMM_ENGINE_API int swmm_heat_get_solar_sited(SWMM_Engine engine, int *sited)
Have latitude AND longitude both been explicitly set?
Definition openswmm_heat_impl.cpp:347
SWMM_ENGINE_API int swmm_heat_set_node_override(SWMM_Engine engine, int source, int node, double temp_c)
Add or update the NODE override for (source, node).
Definition openswmm_heat_impl.cpp:551
SWMM_HeatCloudParam
[CLOUD_COVER] parameters.
Definition openswmm_heat.h:114
@ SWMM_HEAT_CLOUD_FRACTION
Definition openswmm_heat.h:115
@ SWMM_HEAT_CLOUD_LW_CLOUD_K
Definition openswmm_heat.h:118
@ SWMM_HEAT_CLOUD_SW_ATTEN_N
Definition openswmm_heat.h:117
@ SWMM_HEAT_CLOUD_SW_ATTEN_K
Definition openswmm_heat.h:116
SWMM_ENGINE_API int swmm_heat_remove_node_override(SWMM_Engine engine, int index)
Remove one NODE override by row index. Later rows shift down, so a caller iterating by index must re-...
Definition openswmm_heat_impl.cpp:583
SWMM_ENGINE_API int swmm_heat_get_current_shortwave(SWMM_Engine engine, double *wm2)
Resolved incoming shortwave at the CURRENT step, W/m², cloud already applied. Read-only: this is stat...
Definition openswmm_heat_impl.cpp:257
SWMM_ENGINE_API int swmm_heat_get_shortwave_mode(SWMM_Engine engine, int *mode)
Read the incoming-shortwave mode (SWMM_HeatShortwaveMode).
Definition openswmm_heat_impl.cpp:194
SWMM_ENGINE_API int swmm_heat_set_module(SWMM_Engine engine, int module, int on)
Write one [HEAT_FLUXES] module toggle.
Definition openswmm_heat_impl.cpp:108
SWMM_HeatSourceKind
[HEAT_SOURCES] water sources. Mirrors openswmm::HeatSource.
Definition openswmm_heat.h:251
@ SWMM_HEAT_SRC_IFACE
Definition openswmm_heat.h:257
@ SWMM_HEAT_SRC_EXTERNAL_INFLOW
Definition openswmm_heat.h:256
@ SWMM_HEAT_SRC_DWF
Definition openswmm_heat.h:253
@ SWMM_HEAT_SRC_INITIAL_STATE
Definition openswmm_heat.h:258
@ SWMM_HEAT_SRC_GW
Definition openswmm_heat.h:254
@ SWMM_HEAT_SRC_RAINFALL
Definition openswmm_heat.h:252
@ SWMM_HEAT_SRC_RDII
Definition openswmm_heat.h:255
SWMM_ENGINE_API int swmm_heat_set_shortwave_timeseries(SWMM_Engine engine, const char *name)
Bind a [TIMESERIES] (by name) as the shortwave record and switch the mode to SWMM_HEAT_SW_TIMESERIES.
Definition openswmm_heat_impl.cpp:232
SWMM_ENGINE_API int swmm_heat_get_source_configured(SWMM_Engine engine, int source, int *configured)
Did the model set this source explicitly, or is it taking the default? The editor needs the distincti...
Definition openswmm_heat_impl.cpp:500
SWMM_HeatRadiativeParam
[RADIATIVE_FLUXES] scalar parameters.
Definition openswmm_heat.h:86
@ SWMM_HEAT_RAD_SHADE_FACTOR
Definition openswmm_heat.h:89
@ SWMM_HEAT_RAD_EMISS_LANDCOVER
Definition openswmm_heat.h:92
@ SWMM_HEAT_RAD_LW_REFLECTION
Definition openswmm_heat.h:94
@ SWMM_HEAT_RAD_EMISS_WATER
Definition openswmm_heat.h:91
@ SWMM_HEAT_RAD_SKY_VIEW
Definition openswmm_heat.h:90
@ SWMM_HEAT_RAD_ATM_EMISS_COEFF
Definition openswmm_heat.h:93
@ SWMM_HEAT_RAD_ALBEDO
Definition openswmm_heat.h:88
@ SWMM_HEAT_RAD_SHORTWAVE
Definition openswmm_heat.h:87
SWMM_HeatFluxModule
Flux modules of heat plan §2, each independently toggleable.
Definition openswmm_heat.h:62
@ SWMM_HEAT_RADIATIVE_EXCHANGE
Definition openswmm_heat.h:64
@ SWMM_HEAT_SURFACE_EXCHANGE
Definition openswmm_heat.h:63
@ SWMM_HEAT_LAYER_CONDUCTION
Definition openswmm_heat.h:65
SWMM_ENGINE_API int swmm_heat_get_source_temp(SWMM_Engine engine, int source, double *temp_c)
Read one source's GLOBAL inlet temperature (°C).
Definition openswmm_heat_impl.cpp:478
SWMM_ENGINE_API int swmm_heat_set_solar(SWMM_Engine engine, int param, double value)
Write one [SOLAR_RADIATION] parameter.
Definition openswmm_heat_impl.cpp:294
SWMM_HeatShortwaveMode
Where incoming shortwave comes from (plan §2.5, D-H6a-3).
Definition openswmm_heat.h:79
@ SWMM_HEAT_SW_COMPUTED
Definition openswmm_heat.h:82
@ SWMM_HEAT_SW_CONSTANT
Definition openswmm_heat.h:80
@ SWMM_HEAT_SW_TIMESERIES
Definition openswmm_heat.h:81
SWMM_ENGINE_API int swmm_heat_get_cloud(SWMM_Engine engine, int param, double *value)
Read one [CLOUD_COVER] parameter.
Definition openswmm_heat_impl.cpp:368
SWMM_ENGINE_API int swmm_heat_get_node_override(SWMM_Engine engine, int index, int *source, int *node, double *temp_c)
Read one NODE override by row index. Any out-pointer may be NULL.
Definition openswmm_heat_impl.cpp:536
SWMM_ENGINE_API int swmm_heat_get_enabled(SWMM_Engine engine, int *enabled)
Is [OPTIONS] HEAT_TRANSPORT on?
Definition openswmm_heat_impl.cpp:85