![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Heat-configuration C API (phase H6a). More...
#include "openswmm_api_common.hpp"#include <cmath>#include <charconv>#include <array>#include <optional>#include <utility>#include <string>#include <vector>#include "../../../include/openswmm/engine/openswmm_heat.h"#include "../transport/components/HeatModule/HeatComponent.hpp"#include "../transport/components/HeatFluxModules/HeatOverrides.hpp"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. | |
| SWMM_ENGINE_API int | swmm_heat_ground_source_configured (SWMM_Engine engine, int *configured) |
| Exact authoring state for the new channel ground selector. Clear restores the absent/default PRESCRIBED choice; both operations are pre-run only. | |
| SWMM_ENGINE_API int | swmm_heat_clear_ground_source (SWMM_Engine engine) |
| Restore the absent/default prescribed channel ground-source choice. | |
| SWMM_ENGINE_API int | swmm_heat_get_sediment (SWMM_Engine engine, int param, double *value) |
Read a [SEDIMENT_EXCHANGE] GLOBAL parameter. | |
| SWMM_ENGINE_API int | swmm_heat_set_sediment (SWMM_Engine engine, int param, double value) |
Write a [SEDIMENT_EXCHANGE] GLOBAL parameter. | |
| SWMM_ENGINE_API int | swmm_heat_get_sediment_ground_timeseries (SWMM_Engine engine, char *buf, int buflen) |
| Ground-temperature timeseries name; empty when the constant spelling is in force. | |
| SWMM_ENGINE_API int | swmm_heat_set_sediment_ground_timeseries (SWMM_Engine engine, const char *name) |
Drive the ground temperature from a [TIMESERIES]; NULL or "" returns to the constant value. | |
| SWMM_ENGINE_API int | swmm_heat_element_override_count (SWMM_Engine engine, int *count) |
| Number of per-element override rows (radiative and sediment). | |
| SWMM_ENGINE_API int | swmm_heat_get_element_override (SWMM_Engine engine, int index, int *attr, int *scope, char *name, int name_len, double *value) |
| Read one override row. Any out-pointer may be NULL. | |
| SWMM_ENGINE_API int | swmm_heat_set_element_override (SWMM_Engine engine, int attr, int scope, const char *name, double value) |
Add or update the override for (attr, scope, name). | |
| SWMM_ENGINE_API int | swmm_heat_remove_element_override (SWMM_Engine engine, int index) |
| Remove one override row by index. | |
| SWMM_ENGINE_API int | swmm_heat_get_effective_element (SWMM_Engine engine, int attr, int scope, const char *name, double *value, int *source, char *source_name, int source_name_len) |
| Read the effective property for a named NODE, LINK or CELL2D. Source is GLOBAL=0, TAG=1, NODE=2, LINK=3, air temperature=4, ground series=5, CELL2D=6 or MESH_TAG=7. CELL2D names use one-based native cell IDs. Dynamic temperatures return NaN; source_name identifies the tag/series. This reports configuration precedence, independent of process activation. | |
| SWMM_ENGINE_API int | swmm_hydrothermal_edit_atomic (SWMM_Engine engine, SWMM_HydrothermalEdit edit, void *user) |
| Apply one synchronous hydrothermal configuration transaction with rollback. | |
| SWMM_ENGINE_API int | swmm_heat_get_dry_policy (SWMM_Engine engine, int *policy) |
| Dry policy: HOLD=0, AIR=1, DEFAULT=2. | |
| SWMM_ENGINE_API int | swmm_heat_set_dry_policy (SWMM_Engine engine, int policy) |
| Select the reported temperature policy for dry water elements. | |
| SWMM_ENGINE_API int | swmm_heat_sediment_temperature_configured (SWMM_Engine engine, int param, int *configured) |
| Authored status and reset for ground/initial bed temperature. | |
| SWMM_ENGINE_API int | swmm_heat_clear_sediment_temperature (SWMM_Engine engine, int param) |
| Reset one authored sediment temperature to inherited/default behavior. | |
| SWMM_ENGINE_API int | swmm_heat_get_lid_material (SWMM_Engine engine, double values[4]) |
| Read-only LID material assumptions: water conductivity, soil conductivity, soil density, soil specific heat, all SI. | |
| SWMM_ENGINE_API int | swmm_heat_clear_solar_site (SWMM_Engine engine) |
| Remove explicit shared solar coordinates and their provenance. | |
| SWMM_ENGINE_API SWMM_HeatSnapshot | swmm_heat_snapshot_create (SWMM_Engine engine) |
| Allocate a reusable heat authoring snapshot for an editable engine. | |
| SWMM_ENGINE_API int | swmm_heat_snapshot_restore (SWMM_Engine engine, SWMM_HeatSnapshot snapshot) |
| Restore a reusable heat authoring snapshot to its original engine. | |
| SWMM_ENGINE_API void | swmm_heat_snapshot_destroy (SWMM_HeatSnapshot snapshot) |
| Release a heat authoring snapshot. | |
| SWMM_ENGINE_API SWMM_ConfigSnapshot | swmm_config_snapshot_create (SWMM_Engine engine) |
| Allocate a reusable complete hydrothermal authoring snapshot. | |
| SWMM_ENGINE_API int | swmm_config_snapshot_restore (SWMM_Engine engine, SWMM_ConfigSnapshot opaque) |
| Restore complete hydrothermal authoring configuration atomically. | |
| SWMM_ENGINE_API void | swmm_config_snapshot_destroy (SWMM_ConfigSnapshot snapshot) |
| Release a config authoring snapshot. | |
| SWMM_ENGINE_API int | swmm_heat_get_authoring_flags (SWMM_Engine engine, unsigned *flags) |
| Authoring provenance bits: configured=1, shared site=2, explicit latitude/longitude/timezone/elevation=4/8/16/32. | |
Heat-configuration C API (phase H6a).
Every setter here enforces the SAME range rule the model.heat parser does, and enforces it the same way: refuse, do not clamp. Two entry points into one configuration that disagree about what is legal is how a deck and a GUI come to describe different models, and the parser's rule is the older one.
| SWMM_ENGINE_API SWMM_ConfigSnapshot swmm_config_snapshot_create | ( | SWMM_Engine | engine | ) |
Allocate a reusable complete hydrothermal authoring snapshot.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| SWMM_ENGINE_API void swmm_config_snapshot_destroy | ( | SWMM_ConfigSnapshot | snapshot | ) |
Release a config authoring snapshot.
| [in] | snapshot | Owned snapshot of the matching type; NULL is safe. |
| SWMM_ENGINE_API int swmm_config_snapshot_restore | ( | SWMM_Engine | engine, |
| SWMM_ConfigSnapshot | snapshot ) |
Restore complete hydrothermal authoring configuration atomically.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | snapshot | Required live snapshot produced by swmm_config_snapshot_create() for this exact engine identity. The snapshot remains valid and reusable after restore. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| SWMM_ENGINE_API int swmm_heat_clear_ground_source | ( | SWMM_Engine | engine | ) |
Restore the absent/default prescribed channel ground-source choice.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| SWMM_ENGINE_API int swmm_heat_clear_sediment_temperature | ( | SWMM_Engine | engine, |
| int | param ) |
Reset one authored sediment temperature to inherited/default behavior.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | param | SWMM_HEAT_SED_GROUND_TEMPERATURE or SWMM_HEAT_SED_INITIAL_TEMPERATURE. |
| SWMM_ENGINE_API int swmm_heat_clear_solar_site | ( | SWMM_Engine | engine | ) |
Remove explicit shared solar coordinates and their provenance.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | source | SWMM_HeatSourceKind code, in [0,6]. |
| SWMM_ENGINE_API int swmm_heat_element_override_count | ( | SWMM_Engine | engine, |
| int * | count ) |
Number of per-element override rows (radiative and sediment).
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | count | Required destination for the current override-row count. |
| SWMM_ENGINE_API int swmm_heat_get_authoring_flags | ( | SWMM_Engine | engine, |
| unsigned * | flags ) |
Authoring provenance bits: configured=1, shared site=2, explicit latitude/longitude/timezone/elevation=4/8/16/32.
Exact pre-run memento for heat settings, 2D heat/GW/aquifer authoring, their shared site and component registrations. Callers must check their authoring identity before Undo. It owns no engine; the caller must ensure the original engine is still open before restoring. Destroy is safe after closing the engine.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | flags | Required result destination: bitwise provenance flags listed above. |
| SWMM_ENGINE_API int swmm_heat_get_cloud | ( | SWMM_Engine | engine, |
| int | param, | ||
| double * | value ) |
Read one [CLOUD_COVER] parameter.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | param | SWMM_HeatCloudParam selector. |
| [out] | value | Required destination; units and allowed range follow the selected enum member. |
| SWMM_ENGINE_API int swmm_heat_get_cloud_configured | ( | SWMM_Engine | engine, |
| int * | configured ) |
Is a [CLOUD_COVER] section in effect?
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | configured | Required result destination: 1 for authored cloud cover, otherwise 0. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | buf | Required writable string destination, safely truncated with a trailing NUL. |
| [in] | buflen | Positive capacity in bytes including the terminator. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | fraction | Required result destination: last resolved dimensionless cloud fraction in [0,1]. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | wm2 | Required result destination: last resolved incoming shortwave in W/m2. |
| SWMM_ENGINE_API int swmm_heat_get_dry_policy | ( | SWMM_Engine | engine, |
| int * | policy ) |
Dry policy: HOLD=0, AIR=1, DEFAULT=2.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | policy | Required result destination: HOLD=0, AIR=1 or DEFAULT=2. |
| SWMM_ENGINE_API int swmm_heat_get_effective_element | ( | SWMM_Engine | engine, |
| int | attr, | ||
| int | scope, | ||
| const char * | name, | ||
| double * | value, | ||
| int * | source, | ||
| char * | source_name, | ||
| int | source_name_len ) |
Read the effective property for a named NODE, LINK or CELL2D. Source is GLOBAL=0, TAG=1, NODE=2, LINK=3, air temperature=4, ground series=5, CELL2D=6 or MESH_TAG=7. CELL2D names use one-based native cell IDs. Dynamic temperatures return NaN; source_name identifies the tag/series. This reports configuration precedence, independent of process activation.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | attr | SWMM_HeatAttr selector; sediment attributes cannot use NODE scope. |
| [in] | scope | NODE, LINK or CELL2D. |
| [in] | name | Required existing element identifier; CELL2D uses a decimal one-based ID. |
| [out] | value | Required effective-value destination; units follow the attribute. |
| [out] | source | Required origin code destination from the list above. |
| [out] | source_name | Optional source description, copied only when capacity is positive. |
| [in] | source_name_len | Source-name byte capacity; positive capacity safely truncates with NUL. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | source | SWMM_HeatSourceKind code [0,6]. |
| [in] | node | Zero-based existing node index. |
| [out] | temp_c | Required resolved-temperature destination in degrees Celsius. |
| SWMM_ENGINE_API int swmm_heat_get_element_override | ( | SWMM_Engine | engine, |
| int | index, | ||
| int * | attr, | ||
| int * | scope, | ||
| char * | name, | ||
| int | name_len, | ||
| double * | value ) |
Read one override row. Any out-pointer may be NULL.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | index | Zero-based element-override row index. |
| [out] | attr | Optional SWMM_HeatAttr destination. |
| [out] | scope | Optional SWMM_HeatOverrideScope destination. |
| [out] | name | Optional name destination; copied only for positive name_len, safely truncated with NUL. |
| [in] | name_len | Capacity in bytes; nonpositive capacity skips the string. |
| [out] | value | Optional authored value, with units from its attribute. |
| SWMM_ENGINE_API int swmm_heat_get_enabled | ( | SWMM_Engine | engine, |
| int * | enabled ) |
Is [OPTIONS] HEAT_TRANSPORT on?
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | enabled | Required result destination: 1 when HEAT_TRANSPORT is enabled, otherwise 0. |
| SWMM_ENGINE_API int swmm_heat_get_lid_material | ( | SWMM_Engine | engine, |
| double | values[4] ) |
Read-only LID material assumptions: water conductivity, soil conductivity, soil density, soil specific heat, all SI.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | values | Required array of four doubles: water conductivity W/(m K), soil conductivity W/(m K), soil density kg/m3, and soil specific heat J/(kg K). |
| SWMM_ENGINE_API int swmm_heat_get_module | ( | SWMM_Engine | engine, |
| int | module, | ||
| int * | on ) |
Read one [HEAT_FLUXES] module toggle.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | module | SWMM_HeatFluxModule selector. |
| [out] | on | Required destination; zero disables, nonzero enables. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | index | Zero-based NODE override row index. |
| [out] | source | Optional source-kind destination. |
| [out] | node | Optional zero-based node-index destination. |
| [out] | temp_c | Optional temperature destination in degrees Celsius. |
| SWMM_ENGINE_API int swmm_heat_get_radiative | ( | SWMM_Engine | engine, |
| int | param, | ||
| double * | value ) |
Read one [RADIATIVE_FLUXES] parameter.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | param | SWMM_HeatRadiativeParam selector. |
| [out] | value | Required destination; units and allowed range follow the selected enum member. |
| SWMM_ENGINE_API int swmm_heat_get_sediment | ( | SWMM_Engine | engine, |
| int | param, | ||
| double * | value ) |
Read a [SEDIMENT_EXCHANGE] GLOBAL parameter.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | param | SWMM_HeatSedimentParam selector. |
| [out] | value | Required destination; units and allowed range follow the selected enum member. |
| SWMM_ENGINE_API int swmm_heat_get_sediment_ground_timeseries | ( | SWMM_Engine | engine, |
| char * | buf, | ||
| int | buflen ) |
Ground-temperature timeseries name; empty when the constant spelling is in force.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | buf | Required writable string destination, safely truncated with a trailing NUL. |
| [in] | buflen | Positive capacity in bytes including the terminator. |
| SWMM_ENGINE_API int swmm_heat_get_shortwave_mode | ( | SWMM_Engine | engine, |
| int * | mode ) |
Read the incoming-shortwave mode (SWMM_HeatShortwaveMode).
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | mode | Required result destination: SWMM_HeatShortwaveMode code. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | buf | Required writable string destination, safely truncated with a trailing NUL. |
| [in] | buflen | Positive capacity in bytes including the terminator. |
| SWMM_ENGINE_API int swmm_heat_get_solar | ( | SWMM_Engine | engine, |
| int | param, | ||
| double * | value ) |
Read one [SOLAR_RADIATION] parameter.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | param | SWMM_HeatSolarParam selector. |
| [out] | value | Required destination; units and allowed range follow the selected enum member. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | sited | Required result destination: 1 for a shared explicit site or both explicit heat latitude/longitude, otherwise 0. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | source | SWMM_HeatSourceKind code, in [0,6]. |
| [out] | configured | Required result, 1 for an authored global row or 0 for its default. |
| 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).
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | source | SWMM_HeatSourceKind code, in [0,6]. |
| [out] | temp_c | Required temperature destination in degrees Celsius. |
| SWMM_ENGINE_API int swmm_heat_ground_source_configured | ( | SWMM_Engine | engine, |
| int * | configured ) |
Exact authoring state for the new channel ground selector. Clear restores the absent/default PRESCRIBED choice; both operations are pre-run only.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | configured | Required result destination: 1 for an explicit channel ground-source selection, otherwise 0. |
| SWMM_ENGINE_API int swmm_heat_node_override_count | ( | SWMM_Engine | engine, |
| int * | count ) |
Number of NODE-scope override rows.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | count | Required destination for the current override-row count. |
| SWMM_ENGINE_API int swmm_heat_remove_element_override | ( | SWMM_Engine | engine, |
| int | index ) |
Remove one override row by index.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | index | Zero-based override row to erase; later rows shift down. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | index | Zero-based override row to erase; later rows shift down. |
| SWMM_ENGINE_API int swmm_heat_sediment_temperature_configured | ( | SWMM_Engine | engine, |
| int | param, | ||
| int * | configured ) |
Authored status and reset for ground/initial bed temperature.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | param | SWMM_HEAT_SED_GROUND_TEMPERATURE or SWMM_HEAT_SED_INITIAL_TEMPERATURE. |
| [out] | configured | Required result, 1 for explicitly authored temperature or 0 for inheritance. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | param | SWMM_HeatCloudParam selector. |
| [in] | value | New value; units and allowed range follow the selected enum member. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | name | Required nonempty existing model time-series name; resolved during this call. |
| SWMM_ENGINE_API int swmm_heat_set_dry_policy | ( | SWMM_Engine | engine, |
| int | policy ) |
Select the reported temperature policy for dry water elements.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | policy | HOLD=0, AIR=1 or DEFAULT=2; other values are refused. |
| SWMM_ENGINE_API int swmm_heat_set_element_override | ( | SWMM_Engine | engine, |
| int | attr, | ||
| int | scope, | ||
| const char * | name, | ||
| double | value ) |
Add or update the override for (attr, scope, name).
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | attr | SWMM_HeatAttr selector. |
| [in] | scope | TAG, NODE, LINK, CELL2D or MESH_TAG; GROUND_SOURCE permits TAG/LINK only. |
| [in] | name | Required nonempty copied identifier/tag; CELL2D is a one-based native cell ID. |
| [in] | value | New value with the selected attribute's units/range. |
| SWMM_ENGINE_API int swmm_heat_set_module | ( | SWMM_Engine | engine, |
| int | module, | ||
| int | on ) |
Write one [HEAT_FLUXES] module toggle.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | module | SWMM_HeatFluxModule selector. |
| [in] | on | New value; zero disables, nonzero enables. |
| 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]. | [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | source | DWF or EXTERNAL_INFLOW source code. |
| [in] | node | Zero-based existing node index. |
| [in] | temp_c | Finite new value in [-50,100] in degrees Celsius. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | param | SWMM_HeatRadiativeParam selector. |
| [in] | value | New value; units and allowed range follow the selected enum member. |
| SWMM_ENGINE_API int swmm_heat_set_sediment | ( | SWMM_Engine | engine, |
| int | param, | ||
| double | value ) |
Write a [SEDIMENT_EXCHANGE] GLOBAL parameter.
param. Temperatures mark the value as stated so the writer keeps it.| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | param | SWMM_HeatSedimentParam selector. |
| [in] | value | New value; units and allowed range follow the selected enum member. |
| SWMM_ENGINE_API int swmm_heat_set_sediment_ground_timeseries | ( | SWMM_Engine | engine, |
| const char * | name ) |
Drive the ground temperature from a [TIMESERIES]; NULL or "" returns to the constant value.
name is not a timeseries of the model.| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | name | Optional copied series name; NULL or empty clears the binding. |
| SWMM_ENGINE_API int swmm_heat_set_shortwave_mode | ( | SWMM_Engine | engine, |
| int | mode ) |
Set the incoming-shortwave mode.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | mode | SWMM_HEAT_SW_CONSTANT, SWMM_HEAT_SW_TIMESERIES or SWMM_HEAT_SW_COMPUTED. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | name | Required nonempty existing model time-series name; resolved during this call. |
| SWMM_ENGINE_API int swmm_heat_set_solar | ( | SWMM_Engine | engine, |
| int | param, | ||
| double | value ) |
Write one [SOLAR_RADIATION] parameter.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | param | SWMM_HeatSolarParam selector. |
| [in] | value | New value; units and allowed range follow the selected enum member. |
| 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.| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | source | SWMM_HeatSourceKind code, in [0,6]. |
| [in] | temp_c | Finite source temperature in [-50,100] degrees Celsius. |
| SWMM_ENGINE_API SWMM_HeatSnapshot swmm_heat_snapshot_create | ( | SWMM_Engine | engine | ) |
Allocate a reusable heat authoring snapshot for an editable engine.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| SWMM_ENGINE_API void swmm_heat_snapshot_destroy | ( | SWMM_HeatSnapshot | snapshot | ) |
Release a heat authoring snapshot.
| [in] | snapshot | Owned snapshot of the matching type; NULL is safe. |
| SWMM_ENGINE_API int swmm_heat_snapshot_restore | ( | SWMM_Engine | engine, |
| SWMM_HeatSnapshot | snapshot ) |
Restore a reusable heat authoring snapshot to its original engine.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | snapshot | Required live snapshot produced by swmm_heat_snapshot_create() for this exact engine identity. The snapshot remains valid and reusable after restore. |
| 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.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [out] | count | Required destination for the current fixed seven-source extent. |
| SWMM_ENGINE_API int swmm_hydrothermal_edit_atomic | ( | SWMM_Engine | engine, |
| SWMM_HydrothermalEdit | edit, | ||
| void * | user ) |
Apply one synchronous hydrothermal configuration transaction with rollback.
| [in] | engine | Borrowed live engine handle; not retained by this call. |
| [in] | edit | Required synchronous callback, called once with engine and user; return SWMM_OK to commit, another status to restore the captured configuration. |
| [in,out] | user | Opaque caller-owned context forwarded unchanged; may be NULL. |