![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Heat-transport configuration as an editable surface (phase H6a). More...
#include "openswmm_engine.h"Go to the source code of this file.
Typedefs | |
| typedef enum SWMM_HeatFluxModule | SWMM_HeatFluxModule |
| Flux modules of heat plan §2, each independently toggleable. | |
| typedef enum SWMM_HeatShortwaveMode | SWMM_HeatShortwaveMode |
| Where incoming shortwave comes from (plan §2.5, D-H6a-3). | |
| typedef enum SWMM_HeatRadiativeParam | SWMM_HeatRadiativeParam |
[RADIATIVE_FLUXES] scalar parameters. | |
| typedef enum SWMM_HeatSolarParam | SWMM_HeatSolarParam |
[SOLAR_RADIATION] parameters (consulted under COMPUTED only). | |
| typedef enum SWMM_HeatCloudParam | SWMM_HeatCloudParam |
[CLOUD_COVER] parameters. | |
| typedef enum SWMM_HeatSourceKind | SWMM_HeatSourceKind |
[HEAT_SOURCES] water sources. Mirrors openswmm::HeatSource. | |
Functions | |
| SWMM_ENGINE_API int | swmm_heat_get_enabled (SWMM_Engine engine, int *enabled) |
Is [OPTIONS] HEAT_TRANSPORT on? | |
| SWMM_ENGINE_API int | swmm_heat_get_module (SWMM_Engine engine, int module, int *on) |
Read one [HEAT_FLUXES] module toggle. | |
| SWMM_ENGINE_API int | swmm_heat_set_module (SWMM_Engine engine, int module, int on) |
Write one [HEAT_FLUXES] module toggle. | |
| SWMM_ENGINE_API int | swmm_heat_get_radiative (SWMM_Engine engine, int param, double *value) |
Read one [RADIATIVE_FLUXES] parameter. | |
| SWMM_ENGINE_API int | swmm_heat_set_radiative (SWMM_Engine engine, int param, double value) |
Write one [RADIATIVE_FLUXES] parameter. | |
| SWMM_ENGINE_API int | swmm_heat_get_shortwave_mode (SWMM_Engine engine, int *mode) |
| Read the incoming-shortwave mode (SWMM_HeatShortwaveMode). | |
| SWMM_ENGINE_API int | swmm_heat_set_shortwave_mode (SWMM_Engine engine, int mode) |
| Set the incoming-shortwave mode. | |
| 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. | |
| 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, truncated to buflen. | |
| 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 state, not configuration. 0 before the first step, and whenever radiative exchange is off. | |
| SWMM_ENGINE_API int | swmm_heat_get_solar (SWMM_Engine engine, int param, double *value) |
Read one [SOLAR_RADIATION] parameter. | |
| SWMM_ENGINE_API int | swmm_heat_set_solar (SWMM_Engine engine, int param, double value) |
Write one [SOLAR_RADIATION] parameter. | |
| SWMM_ENGINE_API int | swmm_heat_get_solar_sited (SWMM_Engine engine, int *sited) |
| Have latitude AND longitude both been explicitly set? | |
| SWMM_ENGINE_API int | swmm_heat_get_cloud_configured (SWMM_Engine engine, int *configured) |
Is a [CLOUD_COVER] section in effect? | |
| SWMM_ENGINE_API int | swmm_heat_get_cloud (SWMM_Engine engine, int param, double *value) |
Read one [CLOUD_COVER] parameter. | |
| 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. | |
| 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. | |
| 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. NUL-terminated, truncated to buflen. | |
| SWMM_ENGINE_API int | swmm_heat_clear_cloud (SWMM_Engine engine) |
Clear [CLOUD_COVER] entirely — back to clear sky. | |
| 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. | |
| 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 is a fixed enum extent, not a parsed list. | |
| 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). | |
| 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). | |
| 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 distinction to avoid writing rows a user never asked for. | |
| 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. NODE overrides are untouched — they are separate rows and removing them silently would delete model the caller did not name. | |
| SWMM_ENGINE_API int | swmm_heat_node_override_count (SWMM_Engine engine, int *count) |
| Number of NODE-scope override rows. | |
| 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. | |
| 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). | |
| 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-read the count after removing. | |
| 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, else the GLOBAL value. This is HeatConfigData::source_temp, exposed so a caller reads the same resolution the engine uses rather than re-deriving the precedence and drifting from it. | |
Heat-transport configuration as an editable surface (phase H6a).
The model.heat component configuration — flux-module toggles, [RADIATIVE_FLUXES] parameters, and H6a's [SOLAR_RADIATION] and [CLOUD_COVER] sections — reachable from C. This is the header UNIFIED_PLAN_STATUS_2026-08-29.md §6 names as the blocker on GUI task G4g (heat configuration editor).
openswmm_reactions.h's count/get/add shape, refusing exactly what the parser refuses.openswmm_water_age.h documents.swmm_heat_set_shortwave_mode with SWMM_HEAT_SW_COMPUTED returns SWMM_ERR_BADPARAM unless BOTH latitude and longitude have been set. The engine will not fall back on the [TEMPERATURE] SNOWMELT latitude: that field defaults to 0, so borrowing it would silently model equatorial noon (heat plan §2.5).| typedef enum SWMM_HeatCloudParam SWMM_HeatCloudParam |
[CLOUD_COVER] parameters.
| typedef enum SWMM_HeatFluxModule SWMM_HeatFluxModule |
Flux modules of heat plan §2, each independently toggleable.
| typedef enum SWMM_HeatRadiativeParam SWMM_HeatRadiativeParam |
[RADIATIVE_FLUXES] scalar parameters.
| typedef enum SWMM_HeatShortwaveMode SWMM_HeatShortwaveMode |
Where incoming shortwave comes from (plan §2.5, D-H6a-3).
The three are MUTUALLY EXCLUSIVE in EFFECT — exactly one is read, and there is no precedence ladder behind them.
Switching modes does NOT erase the other modes' settings: a constant stays stored while a timeseries is active, and vice versa, so a GUI can offer three radio buttons without destroying what the user typed under the other two. Only the selected one reaches the model. (A deck cannot express that ambiguity at all — the parser refuses a second SHORTWAVE row outright.)
| typedef enum SWMM_HeatSolarParam SWMM_HeatSolarParam |
[SOLAR_RADIATION] parameters (consulted under COMPUTED only).
| typedef enum SWMM_HeatSourceKind SWMM_HeatSourceKind |
[HEAT_SOURCES] water sources. Mirrors openswmm::HeatSource.
| enum SWMM_HeatCloudParam |
| enum SWMM_HeatFluxModule |
[RADIATIVE_FLUXES] scalar parameters.
Where incoming shortwave comes from (plan §2.5, D-H6a-3).
The three are MUTUALLY EXCLUSIVE in EFFECT — exactly one is read, and there is no precedence ladder behind them.
Switching modes does NOT erase the other modes' settings: a constant stays stored while a timeseries is active, and vice versa, so a GUI can offer three radio buttons without destroying what the user typed under the other two. Only the selected one reaches the model. (A deck cannot express that ambiguity at all — the parser refuses a second SHORTWAVE row outright.)
| Enumerator | |
|---|---|
| SWMM_HEAT_SW_CONSTANT | Fixed W/m². |
| SWMM_HEAT_SW_TIMESERIES | Measured record. |
| SWMM_HEAT_SW_COMPUTED | Solar position + Bird clear-sky. |
| enum SWMM_HeatSolarParam |
[SOLAR_RADIATION] parameters (consulted under COMPUTED only).
| enum SWMM_HeatSourceKind |
[HEAT_SOURCES] water sources. Mirrors openswmm::HeatSource.
| SWMM_ENGINE_API int swmm_heat_clear_cloud | ( | SWMM_Engine | engine | ) |
Clear [CLOUD_COVER] entirely — back to clear sky.
Restores the exact H3 longwave path, not an approximation of it: the cloud factor becomes a literal 1.0 that atmosphericEmissivity short-circuits.
| 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. NODE overrides are untouched — they are separate rows and removing them silently would delete model the caller did not name.
| SWMM_ENGINE_API int swmm_heat_get_cloud | ( | SWMM_Engine | engine, |
| int | param, | ||
| double * | value ) |
Read one [CLOUD_COVER] parameter.
| SWMM_ENGINE_API int swmm_heat_get_cloud_configured | ( | SWMM_Engine | engine, |
| int * | configured ) |
Is a [CLOUD_COVER] section in effect?
| 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. NUL-terminated, truncated to buflen.
The shortwave getter's sibling — see swmm_heat_get_shortwave_timeseries.
| 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.
| 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 state, not configuration. 0 before the first step, and whenever radiative exchange is off.
| 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, else the GLOBAL value. This is HeatConfigData::source_temp, exposed so a caller reads the same resolution the engine uses rather than re-deriving the precedence and drifting from it.
| SWMM_ENGINE_API int swmm_heat_get_enabled | ( | SWMM_Engine | engine, |
| int * | enabled ) |
Is [OPTIONS] HEAT_TRANSPORT on?
| SWMM_ENGINE_API int swmm_heat_get_module | ( | SWMM_Engine | engine, |
| int | module, | ||
| int * | on ) |
Read one [HEAT_FLUXES] module toggle.
| 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.
| SWMM_ENGINE_API int swmm_heat_get_radiative | ( | SWMM_Engine | engine, |
| int | param, | ||
| double * | value ) |
Read one [RADIATIVE_FLUXES] parameter.
| SWMM_ENGINE_API int swmm_heat_get_shortwave_mode | ( | SWMM_Engine | engine, |
| int * | mode ) |
Read the incoming-shortwave mode (SWMM_HeatShortwaveMode).
| 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, truncated to buflen.
The read half swmm_heat_set_shortwave_timeseries never had — an editor could rebind a series but only display "(keep current
series)" for the one already bound (the G4g gap, recorded 2026-08-31). Valid in every mode: the binding survives a switch to CONSTANT or COMPUTED, exactly as the parser's does.
| SWMM_ENGINE_API int swmm_heat_get_solar | ( | SWMM_Engine | engine, |
| int | param, | ||
| double * | value ) |
Read one [SOLAR_RADIATION] parameter.
| SWMM_ENGINE_API int swmm_heat_get_solar_sited | ( | SWMM_Engine | engine, |
| int * | sited ) |
Have latitude AND longitude both been explicitly set?
The precondition for SWMM_HEAT_SW_COMPUTED. A GUI should gate the COMPUTED radio button on this rather than discovering the refusal after the fact.
| 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 distinction to avoid writing rows a user never asked for.
| 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).
| SWMM_ENGINE_API int swmm_heat_node_override_count | ( | SWMM_Engine | engine, |
| int * | count ) |
Number of NODE-scope override rows.
| 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-read the count after removing.
| 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.
| 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.
| SWMM_ENGINE_API int swmm_heat_set_module | ( | SWMM_Engine | engine, |
| int | module, | ||
| int | on ) |
Write one [HEAT_FLUXES] module toggle.
| 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).
source is not DWF or EXTERNAL_INFLOW — the H1 scope rule, refused rather than deferred silently, the same answer the deck gets; if node is out of range; or if temp_c is outside [-50, 100]. | SWMM_ENGINE_API int swmm_heat_set_radiative | ( | SWMM_Engine | engine, |
| int | param, | ||
| double | value ) |
Write one [RADIATIVE_FLUXES] parameter.
Values are REFUSED, not clamped — the parser's rule, so the API and the deck agree. A refused write does not take effect.
| SWMM_ENGINE_API int swmm_heat_set_shortwave_mode | ( | SWMM_Engine | engine, |
| int | mode ) |
Set the incoming-shortwave mode.
| 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.
| SWMM_ENGINE_API int swmm_heat_set_solar | ( | SWMM_Engine | engine, |
| int | param, | ||
| double | value ) |
Write one [SOLAR_RADIATION] parameter.
| 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).
HeatComponent.cpp parse_celsius). REFUSED, not clamped, and a refused write does not take effect. Marks the source configured. | 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 is a fixed enum extent, not a parsed list.