OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_water_age.h File Reference

Water-age source-table CRUD (subplan X5 = water-age plan A6, the minimal GUI-facing subset; TRANSPORT_QUALITY_GUI_PLAN §6 prereq 5). More...

#include "openswmm_engine.h"
Include dependency graph for openswmm_water_age.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef enum SWMM_WaterAgeSource SWMM_WaterAgeSource
 Source pathways (mirrors the engine's WaterAgeSource order — the values are the storage indices, do not renumber).
 

Enumerations

enum  SWMM_WaterAgeSource {
  SWMM_AGE_SRC_RAINFALL = 0 ,
  SWMM_AGE_SRC_DWF = 1 ,
  SWMM_AGE_SRC_GW = 2 ,
  SWMM_AGE_SRC_RDII = 3 ,
  SWMM_AGE_SRC_EXTERNAL_INFLOW = 4 ,
  SWMM_AGE_SRC_IFACE = 5 ,
  SWMM_AGE_SRC_INITIAL_STATE = 6 ,
  SWMM_AGE_SRC_COUNT = 7
}
 Source pathways (mirrors the engine's WaterAgeSource order — the values are the storage indices, do not renumber). More...
 

Functions

SWMM_ENGINE_API int swmm_water_age_get_enabled (SWMM_Engine engine, int *enabled)
 1 if [OPTIONS] WATER_AGE is ON, else 0.
 
SWMM_ENGINE_API int swmm_water_age_get_global_source (SWMM_Engine engine, int source, double *hours)
 GLOBAL age for one source pathway, HOURS (signed per D-NS1).
 
SWMM_ENGINE_API int swmm_water_age_set_global_source (SWMM_Engine engine, int source, double hours)
 Set the GLOBAL age for one source pathway, HOURS.
 
SWMM_ENGINE_API int swmm_water_age_override_count (SWMM_Engine engine, int *count)
 Number of per-node override rows.
 
SWMM_ENGINE_API int swmm_water_age_get_override (SWMM_Engine engine, int index, int *source, int *node_index, double *hours)
 Read override row index (0-based): its source, node index, and HOURS. Row order is stable across edits within a session.
 
SWMM_ENGINE_API int swmm_water_age_set_override (SWMM_Engine engine, int source, int node_index, double hours)
 Add or update the override for (source, node_index), HOURS.
 
SWMM_ENGINE_API int swmm_water_age_remove_override (SWMM_Engine engine, int source, int node_index)
 Remove the override for (source, node_index); BADINDEX if none.
 
SWMM_ENGINE_API int swmm_water_age_save (SWMM_Engine engine, const char *path)
 Write the current table as a [WATER_AGE_SOURCES] component file (the model.age format the waterage component parses) — the GUI editor's save path.
 

Detailed Description

Water-age source-table CRUD (subplan X5 = water-age plan A6, the minimal GUI-facing subset; TRANSPORT_QUALITY_GUI_PLAN §6 prereq 5).

The [WATER_AGE_SOURCES] configuration (waterage component, model.age) as a keyed table: a GLOBAL age per source pathway, plus per-NODE overrides for the DWF and EXTERNAL_INFLOW pathways (the A1a scope rule — other pathways refuse NODE scope, exactly like the parser). Values are HOURS, the config file's unit; negative values are legal — a negative source age EXTRACTS age-volume, clamped so age never goes below zero (D-NS1, subplan §3.1). Edits mutate live engine state (the loaders re-read the table every step, so mid-simulation edits take effect on the next routing step); swmm_water_age_save persists the table to a component file.

The full A6 surface (Python/MCP bindings, node/link age state getters) is deferred — this header is exactly what the GUI's Water Age Sources editor (G3g) binds to.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n Apache-2.0

Typedef Documentation

◆ SWMM_WaterAgeSource

Source pathways (mirrors the engine's WaterAgeSource order — the values are the storage indices, do not renumber).

Enumeration Type Documentation

◆ SWMM_WaterAgeSource

Source pathways (mirrors the engine's WaterAgeSource order — the values are the storage indices, do not renumber).

Enumerator
SWMM_AGE_SRC_RAINFALL 
SWMM_AGE_SRC_DWF 
SWMM_AGE_SRC_GW 
SWMM_AGE_SRC_RDII 
SWMM_AGE_SRC_EXTERNAL_INFLOW 
SWMM_AGE_SRC_IFACE 
SWMM_AGE_SRC_INITIAL_STATE 
SWMM_AGE_SRC_COUNT 

Function Documentation

◆ swmm_water_age_get_enabled()

SWMM_ENGINE_API int swmm_water_age_get_enabled ( SWMM_Engine engine,
int * enabled )

1 if [OPTIONS] WATER_AGE is ON, else 0.

◆ swmm_water_age_get_global_source()

SWMM_ENGINE_API int swmm_water_age_get_global_source ( SWMM_Engine engine,
int source,
double * hours )

GLOBAL age for one source pathway, HOURS (signed per D-NS1).

◆ swmm_water_age_get_override()

SWMM_ENGINE_API int swmm_water_age_get_override ( SWMM_Engine engine,
int index,
int * source,
int * node_index,
double * hours )

Read override row index (0-based): its source, node index, and HOURS. Row order is stable across edits within a session.

◆ swmm_water_age_override_count()

SWMM_ENGINE_API int swmm_water_age_override_count ( SWMM_Engine engine,
int * count )

Number of per-node override rows.

◆ swmm_water_age_remove_override()

SWMM_ENGINE_API int swmm_water_age_remove_override ( SWMM_Engine engine,
int source,
int node_index )

Remove the override for (source, node_index); BADINDEX if none.

◆ swmm_water_age_save()

SWMM_ENGINE_API int swmm_water_age_save ( SWMM_Engine engine,
const char * path )

Write the current table as a [WATER_AGE_SOURCES] component file (the model.age format the waterage component parses) — the GUI editor's save path.

Here is the call graph for this function:

◆ swmm_water_age_set_global_source()

SWMM_ENGINE_API int swmm_water_age_set_global_source ( SWMM_Engine engine,
int source,
double hours )

Set the GLOBAL age for one source pathway, HOURS.

Negative hours are legal (age-volume extraction, D-NS1). Marks the config as present so the engine consumes it.

◆ swmm_water_age_set_override()

SWMM_ENGINE_API int swmm_water_age_set_override ( SWMM_Engine engine,
int source,
int node_index,
double hours )

Add or update the override for (source, node_index), HOURS.

Only SWMM_AGE_SRC_DWF and SWMM_AGE_SRC_EXTERNAL_INFLOW take NODE scope (the parser's A1a rule) — others return SWMM_ERR_BADPARAM. Negative hours are legal (D-NS1).