![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
C API implementation — external inflows, DWF, RDII. More...
#include "openswmm_api_common.hpp"#include "../../../include/openswmm/engine/openswmm_inflows.h"#include "../data/InflowData.hpp"#include <algorithm>#include <cstring>#include <string>#include <vector>Functions | |
| SWMM_ENGINE_API int | swmm_ext_inflow_add (SWMM_Engine engine, int node_idx, const char *constituent, const char *ts_name, const char *type, double m_factor, double s_factor, double baseline, const char *pattern) |
| Add an external inflow to a node. | |
| SWMM_ENGINE_API int | swmm_ext_inflow_get (SWMM_Engine engine, int entry_idx, int *node_idx, char *constituent_buf, int constituent_buflen, char *ts_buf, int ts_buflen, char *type_buf, int type_buflen, double *m_factor, double *s_factor, double *baseline, char *pattern_buf, int pattern_buflen) |
| Read back an external inflow entry by index. | |
| SWMM_ENGINE_API int | swmm_ext_inflow_remove (SWMM_Engine engine, int entry_idx) |
| Remove an external inflow entry by index. | |
| SWMM_ENGINE_API int | swmm_dwf_add (SWMM_Engine engine, int node_idx, const char *constituent, double avg_value, const char *pat1, const char *pat2, const char *pat3, const char *pat4) |
| Add a dry weather flow component to a node. | |
| SWMM_ENGINE_API int | swmm_dwf_get (SWMM_Engine engine, int entry_idx, int *node_idx, char *constituent_buf, int constituent_buflen, double *avg_value, char *pat1_buf, int pat1_buflen, char *pat2_buf, int pat2_buflen, char *pat3_buf, int pat3_buflen, char *pat4_buf, int pat4_buflen) |
| Read back a dry weather flow entry by index. | |
| SWMM_ENGINE_API int | swmm_dwf_remove (SWMM_Engine engine, int entry_idx) |
| Remove a DWF entry by index. Subsequent entries shift down. | |
| SWMM_ENGINE_API int | swmm_rdii_add (SWMM_Engine engine, int node_idx, const char *uh_name, double area) |
| Add RDII inflow to a node using a unit hydrograph. | |
| SWMM_ENGINE_API int | swmm_rdii_get (SWMM_Engine engine, int entry_idx, int *node_idx, char *uh_buf, int buflen, double *area) |
| Read back an RDII assignment by entry index. | |
| SWMM_ENGINE_API int | swmm_rdii_remove (SWMM_Engine engine, int entry_idx) |
| Remove an RDII entry by index. Subsequent entries shift down. | |
| SWMM_ENGINE_API int | swmm_hydrograph_add (SWMM_Engine engine, const char *uh_name, int month, int response, double r, double t, double k, double dmax, double drecov, double dinit) |
| Add a unit hydrograph parameter line. | |
| SWMM_ENGINE_API int | swmm_hydrograph_get (SWMM_Engine engine, int entry_idx, char *uh_buf, int buflen, int *month, int *response, double *r, double *t, double *k, double *dmax, double *drecov, double *dinit) |
| Read back a hydrograph parameter entry by index. | |
| SWMM_ENGINE_API int | swmm_hydrograph_count (SWMM_Engine engine) |
| Count parameter entries in the model. | |
| SWMM_ENGINE_API int | swmm_hydrograph_add_gage (SWMM_Engine engine, const char *uh_name, const char *gage_name) |
| Assign a rain gage to a unit hydrograph group. | |
| SWMM_ENGINE_API int | swmm_hydrograph_get_gage (SWMM_Engine engine, int entry_idx, char *uh_buf, int uh_buflen, char *gage_buf, int gage_buflen) |
| Read back a UH-to-gage assignment by index. | |
| SWMM_ENGINE_API int | swmm_hydrograph_gage_count (SWMM_Engine engine) |
| Count UH-to-gage assignments. | |
| SWMM_ENGINE_API int | swmm_hydrograph_group_count (SWMM_Engine engine) |
| Count the unique unit-hydrograph group names defined. | |
| SWMM_ENGINE_API int | swmm_hydrograph_group_id (SWMM_Engine engine, int idx, char *buf, int buflen) |
| Read back the name of a unit-hydrograph group by its zero-based index. | |
| SWMM_ENGINE_API int | swmm_rdii_decay_add (SWMM_Engine engine, const char *uh_name, int response, double k_dep, double k_0, double k_T, double T_ref, double theta_rec, double T_freeze) |
| Add an exponential-decay parameter row for a (UH, response) pair. | |
| SWMM_ENGINE_API int | swmm_rdii_decay_get (SWMM_Engine engine, int entry_idx, char *uh_buf, int buflen, int *response, double *k_dep, double *k_0, double *k_T, double *T_ref, double *theta_rec, double *T_freeze) |
| Read back an exponential-decay parameter row by index. | |
| SWMM_ENGINE_API int | swmm_rdii_decay_count (SWMM_Engine engine) |
| Count exponential-decay parameter rows. | |
| SWMM_ENGINE_API int | swmm_hydrograph_set_rtk (SWMM_Engine engine, const char *uh_name, int month, int response, double r, double t, double k) |
| Upsert R/T/K parameters for one (group, month, response) row. | |
| SWMM_ENGINE_API int | swmm_hydrograph_set_ia (SWMM_Engine engine, const char *uh_name, int month, int response, double dmax, double drecov, double dinit) |
| Upsert linear-IA parameters for one (group, month, response) row. | |
| SWMM_ENGINE_API int | swmm_hydrograph_remove_entry (SWMM_Engine engine, const char *uh_name, int month, int response) |
| Remove one parameter entry by (group, month, response). | |
| SWMM_ENGINE_API int | swmm_hydrograph_remove_group (SWMM_Engine engine, const char *uh_name) |
| Remove an entire UH group: parameter rows + gage assignment + [RDII_DECAY] rows + [RDII] node assignments referencing the group. | |
| SWMM_ENGINE_API int | swmm_hydrograph_clear_group_months (SWMM_Engine engine, const char *uh_name) |
| Bulk-clear every per-month parameter row for a group, leaving any existing month=-1 (ALL) row intact. | |
| SWMM_ENGINE_API int | swmm_hydrograph_set_gage (SWMM_Engine engine, const char *uh_name, const char *gage_name) |
| Set, replace, or clear the rain gage assigned to a UH group. | |
| SWMM_ENGINE_API int | swmm_hydrograph_group_rename (SWMM_Engine engine, int idx, const char *new_id) |
| Rename a UH group, propagating the new name to parameter rows, gage assignments, [RDII_DECAY] rows, and [RDII] node assignments. | |
| SWMM_ENGINE_API int | swmm_rdii_decay_set (SWMM_Engine engine, const char *uh_name, int response, double k_dep, double k_0, double k_T, double T_ref, double theta_rec, double T_freeze) |
| Upsert exponential-decay parameters for one (group, response) row. | |
| SWMM_ENGINE_API int | swmm_rdii_decay_remove (SWMM_Engine engine, const char *uh_name, int response) |
| Remove the exponential-decay row for one (group, response) pair. | |
| SWMM_ENGINE_API int | swmm_ext_inflow_count (SWMM_Engine engine) |
| Get the total number of external inflows defined. | |
| SWMM_ENGINE_API int | swmm_dwf_count (SWMM_Engine engine) |
| Get the total number of dry weather flow entries defined. | |
| SWMM_ENGINE_API int | swmm_rdii_count (SWMM_Engine engine) |
| Get the total number of RDII entries defined. | |
C API implementation — external inflows, DWF, RDII.
| SWMM_ENGINE_API int swmm_dwf_add | ( | SWMM_Engine | engine, |
| int | node_idx, | ||
| const char * | constituent, | ||
| double | avg_value, | ||
| const char * | pat1, | ||
| const char * | pat2, | ||
| const char * | pat3, | ||
| const char * | pat4 | ||
| ) |
Add a dry weather flow component to a node.
Dry weather flow represents the base sanitary flow entering the system at a node, modulated by up to four time patterns.
| engine | Engine handle. |
| node_idx | Zero-based index of the receiving node. |
| constituent | Constituent name ("FLOW" or a pollutant name). |
| avg_value | Average DWF value. |
| pat1 | Monthly time pattern name (NULL for none). |
| pat2 | Daily time pattern name (NULL for none). |
| pat3 | Hourly time pattern name (NULL for none). |
| pat4 | Weekend time pattern name (NULL for none). |
| SWMM_ENGINE_API int swmm_dwf_count | ( | SWMM_Engine | engine | ) |
Get the total number of dry weather flow entries defined.
| engine | Engine handle. |
| SWMM_ENGINE_API int swmm_dwf_get | ( | SWMM_Engine | engine, |
| int | entry_idx, | ||
| int * | node_idx, | ||
| char * | constituent_buf, | ||
| int | constituent_buflen, | ||
| double * | avg_value, | ||
| char * | pat1_buf, | ||
| int | pat1_buflen, | ||
| char * | pat2_buf, | ||
| int | pat2_buflen, | ||
| char * | pat3_buf, | ||
| int | pat3_buflen, | ||
| char * | pat4_buf, | ||
| int | pat4_buflen | ||
| ) |
Read back a dry weather flow entry by index.
| engine | Engine handle. |
| entry_idx | Zero-based entry index (0..swmm_dwf_count()-1). |
| node_idx | [out] Receiving node index. |
| constituent_buf | [out] Constituent name (NUL-terminated). |
| constituent_buflen | Size of constituent_buf. |
| avg_value | [out] Average value. |
| pat1_buf | [out] Monthly pattern name (NUL-terminated; empty if none). |
| pat1_buflen | Size of pat1_buf. |
| pat2_buf | [out] Daily pattern name. |
| pat2_buflen | Size of pat2_buf. |
| pat3_buf | [out] Hourly pattern name. |
| pat3_buflen | Size of pat3_buf. |
| pat4_buf | [out] Weekend pattern name. |
| pat4_buflen | Size of pat4_buf. |
| SWMM_ENGINE_API int swmm_dwf_remove | ( | SWMM_Engine | engine, |
| int | entry_idx | ||
| ) |
Remove a DWF entry by index. Subsequent entries shift down.
| engine | Engine handle. |
| entry_idx | Zero-based entry index (0..swmm_dwf_count()-1). |
| SWMM_ENGINE_API int swmm_ext_inflow_add | ( | SWMM_Engine | engine, |
| int | node_idx, | ||
| const char * | constituent, | ||
| const char * | ts_name, | ||
| const char * | type, | ||
| double | m_factor, | ||
| double | s_factor, | ||
| double | baseline, | ||
| const char * | pattern | ||
| ) |
Add an external inflow to a node.
External inflows define time-varying flows or pollutant loads applied at a node, optionally driven by a time series, with scaling, baseline, and pattern modifiers.
| engine | Engine handle. |
| node_idx | Zero-based index of the receiving node. |
| constituent | Constituent name ("FLOW" for flow, or a pollutant name). |
| ts_name | Time series name (NULL or "" for constant baseline only). |
| type | Inflow type: "FLOW", "CONCEN", or "MASS". |
| m_factor | Multiplier applied to the time series values. |
| s_factor | Scale factor (unit conversion). |
| baseline | Constant baseline value added to the time series. |
| pattern | Time pattern name (NULL or "" for none). |
| SWMM_ENGINE_API int swmm_ext_inflow_count | ( | SWMM_Engine | engine | ) |
Get the total number of external inflows defined.
| engine | Engine handle. |
| SWMM_ENGINE_API int swmm_ext_inflow_get | ( | SWMM_Engine | engine, |
| int | entry_idx, | ||
| int * | node_idx, | ||
| char * | constituent_buf, | ||
| int | constituent_buflen, | ||
| char * | ts_buf, | ||
| int | ts_buflen, | ||
| char * | type_buf, | ||
| int | type_buflen, | ||
| double * | m_factor, | ||
| double * | s_factor, | ||
| double * | baseline, | ||
| char * | pattern_buf, | ||
| int | pattern_buflen | ||
| ) |
Read back an external inflow entry by index.
The model stores external inflows as a flat SoA, indexed 0..swmm_ext_inflow_count()-1. To list a single node's inflows, iterate all entries and filter by node_idx.
| engine | Engine handle. |
| entry_idx | Zero-based entry index. |
| node_idx | [out] Receiving node index. |
| constituent_buf | [out] Constituent name buffer (NUL-terminated). |
| constituent_buflen | Size of constituent_buf. |
| ts_buf | [out] Time series name buffer (NUL-terminated; empty if none). |
| ts_buflen | Size of ts_buf. |
| type_buf | [out] Inflow type buffer (NUL-terminated; "FLOW"/"CONCEN"/"MASS"). |
| type_buflen | Size of type_buf. |
| m_factor | [out] Multiplier factor. |
| s_factor | [out] Scale factor. |
| baseline | [out] Baseline value. |
| pattern_buf | [out] Pattern name buffer (NUL-terminated; empty if none). |
| pattern_buflen | Size of pattern_buf. |
| SWMM_ENGINE_API int swmm_ext_inflow_remove | ( | SWMM_Engine | engine, |
| int | entry_idx | ||
| ) |
Remove an external inflow entry by index.
Entries with index > entry_idx shift down by one. Callers holding cached indices must re-resolve via swmm_ext_inflow_count() / iteration.
| engine | Engine handle. |
| entry_idx | Zero-based entry index (0..swmm_ext_inflow_count()-1). |
| SWMM_ENGINE_API int swmm_hydrograph_add | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| int | month, | ||
| int | response, | ||
| double | r, | ||
| double | t, | ||
| double | k, | ||
| double | dmax, | ||
| double | drecov, | ||
| double | dinit | ||
| ) |
Add a unit hydrograph parameter line.
| engine | Engine handle. |
| uh_name | Unit hydrograph group name. |
| month | 0..11 = JAN..DEC, or -1 for ALL months. |
| response | 0 = SHORT, 1 = MEDIUM, 2 = LONG. |
| r | Fraction of rainfall volume that becomes RDII. |
| t | Time to peak (hours). |
| k | Ratio of recession-limb time to time-to-peak (>= 0). Base time = t * (1 + k); the falling limb spans k * t hours. |
| dmax | Maximum initial-abstraction depth (project depth units; 0 if unused). |
| drecov | Linear-model IA recovery rate (project depth/day; 0 if unused or if [RDII_DECAY] is configured). |
| dinit | Initial IA already used at start of simulation (project depth units; 0 if unused). |
| SWMM_ENGINE_API int swmm_hydrograph_add_gage | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| const char * | gage_name | ||
| ) |
Assign a rain gage to a unit hydrograph group.
| engine | Engine handle. |
| uh_name | Unit hydrograph group name. |
| gage_name | Rain gage name. |
| SWMM_ENGINE_API int swmm_hydrograph_clear_group_months | ( | SWMM_Engine | engine, |
| const char * | uh_name | ||
| ) |
Bulk-clear every per-month parameter row for a group, leaving any existing month=-1 (ALL) row intact.
Used by the editor when the user switches from per-season to ALL. Single pass — avoids the O(n^2) cost of repeated swmm_hydrograph_remove_entry calls.
| SWMM_ENGINE_API int swmm_hydrograph_count | ( | SWMM_Engine | engine | ) |
Count parameter entries in the model.
| SWMM_ENGINE_API int swmm_hydrograph_gage_count | ( | SWMM_Engine | engine | ) |
Count UH-to-gage assignments.
| SWMM_ENGINE_API int swmm_hydrograph_get | ( | SWMM_Engine | engine, |
| int | entry_idx, | ||
| char * | uh_buf, | ||
| int | buflen, | ||
| int * | month, | ||
| int * | response, | ||
| double * | r, | ||
| double * | t, | ||
| double * | k, | ||
| double * | dmax, | ||
| double * | drecov, | ||
| double * | dinit | ||
| ) |
Read back a hydrograph parameter entry by index.
| engine | Engine handle. |
| entry_idx | Zero-based index (0..swmm_hydrograph_count()-1). |
| uh_buf | [out] UH group name buffer (NUL-terminated). |
| buflen | Size of uh_buf. |
| month | [out] Month code (-1, or 0..11). |
| response | [out] Response code (0..2). |
| r | [out] Rainfall fraction. |
| t | [out] Time to peak (hours). |
| k | [out] Recession ratio. |
| dmax | [out] IA max depth. |
| drecov | [out] Linear IA recovery rate. |
| dinit | [out] Initial IA used. |
| SWMM_ENGINE_API int swmm_hydrograph_get_gage | ( | SWMM_Engine | engine, |
| int | entry_idx, | ||
| char * | uh_buf, | ||
| int | uh_buflen, | ||
| char * | gage_buf, | ||
| int | gage_buflen | ||
| ) |
Read back a UH-to-gage assignment by index.
| engine | Engine handle. |
| entry_idx | Zero-based index (0..swmm_hydrograph_gage_count()-1). |
| uh_buf | [out] UH group name (NUL-terminated). |
| uh_buflen | Size of uh_buf. |
| gage_buf | [out] Rain gage name (NUL-terminated). |
| gage_buflen | Size of gage_buf. |
| SWMM_ENGINE_API int swmm_hydrograph_group_count | ( | SWMM_Engine | engine | ) |
Count the unique unit-hydrograph group names defined.
A unit-hydrograph "group" is identified by name; the engine stores one entry per (group, month, response). This count is the number of distinct group names across all parameter entries, useful for enumerating groups in a UI without manually de-duplicating the per-entry list.
| engine | Engine handle. |
| SWMM_ENGINE_API int swmm_hydrograph_group_id | ( | SWMM_Engine | engine, |
| int | idx, | ||
| char * | buf, | ||
| int | buflen | ||
| ) |
Read back the name of a unit-hydrograph group by its zero-based index.
Groups are enumerated in first-occurrence order across the parameter entry list (matches the order in which they appear in the [HYDROGRAPHS] section of the input file).
| engine | Engine handle. |
| idx | Zero-based group index (0..swmm_hydrograph_group_count()-1). |
| buf | [out] Caller-allocated buffer to receive the group name. |
| buflen | Size of buf in bytes. |
| SWMM_ENGINE_API int swmm_hydrograph_group_rename | ( | SWMM_Engine | engine, |
| int | idx, | ||
| const char * | new_id | ||
| ) |
Rename a UH group, propagating the new name to parameter rows, gage assignments, [RDII_DECAY] rows, and [RDII] node assignments.
| engine | Engine handle. |
| idx | Zero-based group index (0..swmm_hydrograph_group_count()-1). |
| new_id | New group name (non-null, non-empty, must not already exist). |
| SWMM_ENGINE_API int swmm_hydrograph_remove_entry | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| int | month, | ||
| int | response | ||
| ) |
Remove one parameter entry by (group, month, response).
Idempotent — returns SWMM_OK whether or not a matching row exists. Indices shift, so any UI must look up entries by key rather than caching indices across calls.
| SWMM_ENGINE_API int swmm_hydrograph_remove_group | ( | SWMM_Engine | engine, |
| const char * | uh_name | ||
| ) |
Remove an entire UH group: parameter rows + gage assignment + [RDII_DECAY] rows + [RDII] node assignments referencing the group.
| SWMM_ENGINE_API int swmm_hydrograph_set_gage | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| const char * | gage_name | ||
| ) |
Set, replace, or clear the rain gage assigned to a UH group.
| engine | Engine handle. |
| uh_name | Unit hydrograph group name (non-null, non-empty). |
| gage_name | Rain gage name, or NULL/empty to clear an existing assignment. |
| SWMM_ENGINE_API int swmm_hydrograph_set_ia | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| int | month, | ||
| int | response, | ||
| double | dmax, | ||
| double | drecov, | ||
| double | dinit | ||
| ) |
Upsert linear-IA parameters for one (group, month, response) row.
| engine | Engine handle. |
| uh_name | Unit hydrograph group name (non-null, non-empty). |
| month | 0..11 = JAN..DEC, or -1 for ALL. |
| response | 0 = SHORT, 1 = MEDIUM, 2 = LONG. |
| dmax | Maximum initial-abstraction depth. |
| drecov | Linear IA recovery rate. |
| dinit | Initial IA already used. |
| SWMM_ENGINE_API int swmm_hydrograph_set_rtk | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| int | month, | ||
| int | response, | ||
| double | r, | ||
| double | t, | ||
| double | k | ||
| ) |
Upsert R/T/K parameters for one (group, month, response) row.
| engine | Engine handle. |
| uh_name | Unit hydrograph group name (non-null, non-empty). |
| month | 0..11 = JAN..DEC, or -1 for ALL. |
| response | 0 = SHORT, 1 = MEDIUM, 2 = LONG. |
| r | Rainfall fraction. |
| t | Time to peak (hours). |
| k | Recession-limb-to-peak-time ratio (>= 0). Base time = t * (1 + k). |
| SWMM_ENGINE_API int swmm_rdii_add | ( | SWMM_Engine | engine, |
| int | node_idx, | ||
| const char * | uh_name, | ||
| double | area | ||
| ) |
Add RDII inflow to a node using a unit hydrograph.
Associates a node with a unit hydrograph group and its sewershed area to compute rainfall-dependent infiltration/inflow.
| engine | Engine handle. |
| node_idx | Zero-based index of the receiving node. |
| uh_name | Unit hydrograph group name. |
| area | Sewershed area in project area units. |
| SWMM_ENGINE_API int swmm_rdii_count | ( | SWMM_Engine | engine | ) |
Get the total number of RDII entries defined.
| engine | Engine handle. |
| SWMM_ENGINE_API int swmm_rdii_decay_add | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| int | response, | ||
| double | k_dep, | ||
| double | k_0, | ||
| double | k_T, | ||
| double | T_ref, | ||
| double | theta_rec, | ||
| double | T_freeze | ||
| ) |
Add an exponential-decay parameter row for a (UH, response) pair.
| engine | Engine handle. |
| uh_name | Unit hydrograph group name (must match a [HYDROGRAPHS] entry). |
| response | 0 = SHORT, 1 = MEDIUM, 2 = LONG. |
| k_dep | Depletion rate (1/project-depth-unit) — temperature-independent. |
| k_0 | Base recovery rate (1/hr) — gravity drainage / capillary. |
| k_T | Thermal recovery rate at T_ref (1/hr) — ET-driven drying. |
| T_ref | Reference temperature (deg C) for the thermal term. |
| theta_rec | Temperature sensitivity (1/deg C) of the thermal term. |
| T_freeze | Recovery is suppressed when air temperature <= T_freeze (deg C). |
| SWMM_ENGINE_API int swmm_rdii_decay_count | ( | SWMM_Engine | engine | ) |
Count exponential-decay parameter rows.
| SWMM_ENGINE_API int swmm_rdii_decay_get | ( | SWMM_Engine | engine, |
| int | entry_idx, | ||
| char * | uh_buf, | ||
| int | buflen, | ||
| int * | response, | ||
| double * | k_dep, | ||
| double * | k_0, | ||
| double * | k_T, | ||
| double * | T_ref, | ||
| double * | theta_rec, | ||
| double * | T_freeze | ||
| ) |
Read back an exponential-decay parameter row by index.
| engine | Engine handle. |
| entry_idx | Zero-based index (0..swmm_rdii_decay_count()-1). |
| uh_buf | [out] UH group name (NUL-terminated). |
| buflen | Size of uh_buf. |
| response | [out] Response code (0..2). |
| k_dep | [out] Depletion rate. |
| k_0 | [out] Base recovery rate. |
| k_T | [out] Thermal recovery rate. |
| T_ref | [out] Reference temperature. |
| theta_rec | [out] Temperature sensitivity. |
| T_freeze | [out] Frozen-ground threshold. |
| SWMM_ENGINE_API int swmm_rdii_decay_remove | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| int | response | ||
| ) |
Remove the exponential-decay row for one (group, response) pair.
Idempotent — returns SWMM_OK whether or not a matching row exists.
| SWMM_ENGINE_API int swmm_rdii_decay_set | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| int | response, | ||
| double | k_dep, | ||
| double | k_0, | ||
| double | k_T, | ||
| double | T_ref, | ||
| double | theta_rec, | ||
| double | T_freeze | ||
| ) |
Upsert exponential-decay parameters for one (group, response) row.
Same upsert contract as swmm_hydrograph_set_rtk. Use swmm_rdii_decay_remove to delete a row (existence of a row IS the "active" flag in the engine model).
| SWMM_ENGINE_API int swmm_rdii_get | ( | SWMM_Engine | engine, |
| int | entry_idx, | ||
| int * | node_idx, | ||
| char * | uh_buf, | ||
| int | buflen, | ||
| double * | area | ||
| ) |
Read back an RDII assignment by entry index.
| engine | Engine handle. |
| entry_idx | Zero-based index into the RDII assignment list (0..swmm_rdii_count()-1). |
| node_idx | [out] Receiving node index. |
| uh_buf | [out] Buffer to receive the unit hydrograph name (NUL-terminated, truncated if too small). |
| buflen | Size of uh_buf in bytes. |
| area | [out] Sewershed area in project area units. |
| SWMM_ENGINE_API int swmm_rdii_remove | ( | SWMM_Engine | engine, |
| int | entry_idx | ||
| ) |
Remove an RDII entry by index. Subsequent entries shift down.
| engine | Engine handle. |
| entry_idx | Zero-based entry index (0..swmm_rdii_count()-1). |