OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm_inflows_impl.cpp File Reference

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>
Include dependency graph for openswmm_inflows_impl.cpp:

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.
 

Detailed Description

C API implementation — external inflows, DWF, RDII.

See also
include/openswmm/engine/openswmm_inflows.h
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License

Function Documentation

◆ swmm_dwf_add()

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.

Parameters
engineEngine handle.
node_idxZero-based index of the receiving node.
constituentConstituent name ("FLOW" or a pollutant name).
avg_valueAverage DWF value.
pat1Monthly time pattern name (NULL for none).
pat2Daily time pattern name (NULL for none).
pat3Hourly time pattern name (NULL for none).
pat4Weekend time pattern name (NULL for none).
Returns
SWMM_OK on success, or an error code.

◆ swmm_dwf_count()

SWMM_ENGINE_API int swmm_dwf_count ( SWMM_Engine  engine)

Get the total number of dry weather flow entries defined.

Parameters
engineEngine handle.
Returns
Number of DWF entries, or -1 on error.

◆ swmm_dwf_get()

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.

Parameters
engineEngine handle.
entry_idxZero-based entry index (0..swmm_dwf_count()-1).
node_idx[out] Receiving node index.
constituent_buf[out] Constituent name (NUL-terminated).
constituent_buflenSize of constituent_buf.
avg_value[out] Average value.
pat1_buf[out] Monthly pattern name (NUL-terminated; empty if none).
pat1_buflenSize of pat1_buf.
pat2_buf[out] Daily pattern name.
pat2_buflenSize of pat2_buf.
pat3_buf[out] Hourly pattern name.
pat3_buflenSize of pat3_buf.
pat4_buf[out] Weekend pattern name.
pat4_buflenSize of pat4_buf.
Returns
SWMM_OK on success, or an error code.

◆ swmm_dwf_remove()

SWMM_ENGINE_API int swmm_dwf_remove ( SWMM_Engine  engine,
int  entry_idx 
)

Remove a DWF entry by index. Subsequent entries shift down.

Parameters
engineEngine handle.
entry_idxZero-based entry index (0..swmm_dwf_count()-1).
Returns
SWMM_OK on success, or an error code.

◆ swmm_ext_inflow_add()

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.

Parameters
engineEngine handle.
node_idxZero-based index of the receiving node.
constituentConstituent name ("FLOW" for flow, or a pollutant name).
ts_nameTime series name (NULL or "" for constant baseline only).
typeInflow type: "FLOW", "CONCEN", or "MASS".
m_factorMultiplier applied to the time series values.
s_factorScale factor (unit conversion).
baselineConstant baseline value added to the time series.
patternTime pattern name (NULL or "" for none).
Returns
SWMM_OK on success, or an error code.

◆ swmm_ext_inflow_count()

SWMM_ENGINE_API int swmm_ext_inflow_count ( SWMM_Engine  engine)

Get the total number of external inflows defined.

Parameters
engineEngine handle.
Returns
Number of external inflows, or -1 on error.

◆ swmm_ext_inflow_get()

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.

Parameters
engineEngine handle.
entry_idxZero-based entry index.
node_idx[out] Receiving node index.
constituent_buf[out] Constituent name buffer (NUL-terminated).
constituent_buflenSize of constituent_buf.
ts_buf[out] Time series name buffer (NUL-terminated; empty if none).
ts_buflenSize of ts_buf.
type_buf[out] Inflow type buffer (NUL-terminated; "FLOW"/"CONCEN"/"MASS").
type_buflenSize 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_buflenSize of pattern_buf.
Returns
SWMM_OK on success, or an error code.

◆ swmm_ext_inflow_remove()

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.

Parameters
engineEngine handle.
entry_idxZero-based entry index (0..swmm_ext_inflow_count()-1).
Returns
SWMM_OK on success, or an error code.

◆ swmm_hydrograph_add()

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.

Parameters
engineEngine handle.
uh_nameUnit hydrograph group name.
month0..11 = JAN..DEC, or -1 for ALL months.
response0 = SHORT, 1 = MEDIUM, 2 = LONG.
rFraction of rainfall volume that becomes RDII.
tTime to peak (hours).
kRatio of recession-limb time to time-to-peak (>= 0). Base time = t * (1 + k); the falling limb spans k * t hours.
dmaxMaximum initial-abstraction depth (project depth units; 0 if unused).
drecovLinear-model IA recovery rate (project depth/day; 0 if unused or if [RDII_DECAY] is configured).
dinitInitial IA already used at start of simulation (project depth units; 0 if unused).
Returns
SWMM_OK on success, or an error code.

◆ swmm_hydrograph_add_gage()

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.

Parameters
engineEngine handle.
uh_nameUnit hydrograph group name.
gage_nameRain gage name.
Returns
SWMM_OK on success, or an error code.

◆ swmm_hydrograph_clear_group_months()

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.

Returns
SWMM_OK on success, or an error code.

◆ swmm_hydrograph_count()

SWMM_ENGINE_API int swmm_hydrograph_count ( SWMM_Engine  engine)

Count parameter entries in the model.

Returns
Number of parameter lines, or -1 on error.

◆ swmm_hydrograph_gage_count()

SWMM_ENGINE_API int swmm_hydrograph_gage_count ( SWMM_Engine  engine)

Count UH-to-gage assignments.

Returns
Number of assignments, or -1 on error.

◆ swmm_hydrograph_get()

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.

Parameters
engineEngine handle.
entry_idxZero-based index (0..swmm_hydrograph_count()-1).
uh_buf[out] UH group name buffer (NUL-terminated).
buflenSize 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.
Returns
SWMM_OK on success, or an error code.

◆ swmm_hydrograph_get_gage()

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.

Parameters
engineEngine handle.
entry_idxZero-based index (0..swmm_hydrograph_gage_count()-1).
uh_buf[out] UH group name (NUL-terminated).
uh_buflenSize of uh_buf.
gage_buf[out] Rain gage name (NUL-terminated).
gage_buflenSize of gage_buf.
Returns
SWMM_OK on success, or an error code.

◆ swmm_hydrograph_group_count()

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.

Parameters
engineEngine handle.
Returns
Number of unique groups, or -1 on error.

◆ swmm_hydrograph_group_id()

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).

Parameters
engineEngine handle.
idxZero-based group index (0..swmm_hydrograph_group_count()-1).
buf[out] Caller-allocated buffer to receive the group name.
buflenSize of buf in bytes.
Returns
SWMM_OK on success, or an error code.

◆ swmm_hydrograph_group_rename()

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.

Parameters
engineEngine handle.
idxZero-based group index (0..swmm_hydrograph_group_count()-1).
new_idNew group name (non-null, non-empty, must not already exist).
Returns
SWMM_OK on success, SWMM_ERR_BADPARAM if new_id is invalid or duplicates an existing group, or another error code.

◆ swmm_hydrograph_remove_entry()

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.

Returns
SWMM_OK on success, or an error code.

◆ swmm_hydrograph_remove_group()

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.

Returns
SWMM_OK on success, or an error code.

◆ swmm_hydrograph_set_gage()

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.

Parameters
engineEngine handle.
uh_nameUnit hydrograph group name (non-null, non-empty).
gage_nameRain gage name, or NULL/empty to clear an existing assignment.
Returns
SWMM_OK on success, or an error code.
Here is the call graph for this function:

◆ swmm_hydrograph_set_ia()

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.

Parameters
engineEngine handle.
uh_nameUnit hydrograph group name (non-null, non-empty).
month0..11 = JAN..DEC, or -1 for ALL.
response0 = SHORT, 1 = MEDIUM, 2 = LONG.
dmaxMaximum initial-abstraction depth.
drecovLinear IA recovery rate.
dinitInitial IA already used.
Returns
SWMM_OK on success, or an error code.

◆ swmm_hydrograph_set_rtk()

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.

Parameters
engineEngine handle.
uh_nameUnit hydrograph group name (non-null, non-empty).
month0..11 = JAN..DEC, or -1 for ALL.
response0 = SHORT, 1 = MEDIUM, 2 = LONG.
rRainfall fraction.
tTime to peak (hours).
kRecession-limb-to-peak-time ratio (>= 0). Base time = t * (1 + k).
Returns
SWMM_OK on success, or an error code.

◆ swmm_rdii_add()

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.

Parameters
engineEngine handle.
node_idxZero-based index of the receiving node.
uh_nameUnit hydrograph group name.
areaSewershed area in project area units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_rdii_count()

SWMM_ENGINE_API int swmm_rdii_count ( SWMM_Engine  engine)

Get the total number of RDII entries defined.

Parameters
engineEngine handle.
Returns
Number of RDII entries, or -1 on error.

◆ swmm_rdii_decay_add()

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.

Parameters
engineEngine handle.
uh_nameUnit hydrograph group name (must match a [HYDROGRAPHS] entry).
response0 = SHORT, 1 = MEDIUM, 2 = LONG.
k_depDepletion rate (1/project-depth-unit) — temperature-independent.
k_0Base recovery rate (1/hr) — gravity drainage / capillary.
k_TThermal recovery rate at T_ref (1/hr) — ET-driven drying.
T_refReference temperature (deg C) for the thermal term.
theta_recTemperature sensitivity (1/deg C) of the thermal term.
T_freezeRecovery is suppressed when air temperature <= T_freeze (deg C).
Returns
SWMM_OK on success, or an error code.

◆ swmm_rdii_decay_count()

SWMM_ENGINE_API int swmm_rdii_decay_count ( SWMM_Engine  engine)

Count exponential-decay parameter rows.

Returns
Number of rows, or -1 on error.

◆ swmm_rdii_decay_get()

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.

Parameters
engineEngine handle.
entry_idxZero-based index (0..swmm_rdii_decay_count()-1).
uh_buf[out] UH group name (NUL-terminated).
buflenSize 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.
Returns
SWMM_OK on success, or an error code.

◆ swmm_rdii_decay_remove()

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.

Returns
SWMM_OK on success, or an error code.

◆ swmm_rdii_decay_set()

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).

Returns
SWMM_OK on success, or an error code.

◆ swmm_rdii_get()

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.

Parameters
engineEngine handle.
entry_idxZero-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).
buflenSize of uh_buf in bytes.
area[out] Sewershed area in project area units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_rdii_remove()

SWMM_ENGINE_API int swmm_rdii_remove ( SWMM_Engine  engine,
int  entry_idx 
)

Remove an RDII entry by index. Subsequent entries shift down.

Parameters
engineEngine handle.
entry_idxZero-based entry index (0..swmm_rdii_count()-1).
Returns
SWMM_OK on success, or an error code.