OpenSWMM Engine  6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
Loading...
Searching...
No Matches
openswmm::gage Namespace Reference

Classes

struct  GageState
 
struct  PrecipSplit
 Result of splitting a gage's precipitation for one subcatchment. More...
 

Enumerations

enum class  RainType : int {
  INTENSITY = 0 ,
  VOLUME = 1 ,
  CUMULATIVE = 2
}
 

Functions

double convertRainfall (double raw_value, GageState &state)
 Convert raw rainfall value based on rain type.
 
PrecipSplit splitPrecip (const SimulationContext &ctx, std::size_t sub)
 Split a subcatchment's gage precipitation into rain and snow.
 
void updatePastRain (GageState &state, double current_time)
 Update past n-hour rainfall accumulation.
 
double getPastRain (const GageState &state, int hours)
 Get past n-hour rainfall total.
 
void updateAllGages (SimulationContext &ctx, double current_time)
 Process all gages for one timestep.
 
double getReportRainfall (const SimulationContext &ctx, int gage_idx, double report_date)
 Query a gage's rainfall at a specific report date.
 

Variables

constexpr double ONE_SECOND = 1.1574074e-5
 One second in days.
 
constexpr int MAXPASTRAIN = 48
 Max past hours tracked.
 

Enumeration Type Documentation

◆ RainType

enum class openswmm::gage::RainType : int
strong
Enumerator
INTENSITY 
VOLUME 
CUMULATIVE 

Function Documentation

◆ convertRainfall()

double openswmm::gage::convertRainfall ( double raw_value,
GageState & state )

Convert raw rainfall value based on rain type.

Parameters
raw_valueRaw value from timeseries.
stateGage state (for accumulators, factors).
Returns
Rainfall intensity (project units/sec).

◆ getPastRain()

double openswmm::gage::getPastRain ( const GageState & state,
int hours )

Get past n-hour rainfall total.

Parameters
stateGage state.
hoursNumber of past hours (1 to MAXPASTRAIN).
Returns
Cumulative rainfall over past n hours (project depth units).

◆ getReportRainfall()

double openswmm::gage::getReportRainfall ( const SimulationContext & ctx,
int gage_idx,
double report_date )

Query a gage's rainfall at a specific report date.

Matches legacy gage_setReportRainfall(): queries the gage's timeseries at the report time without advancing the cursor. Returns rainfall in user units (in/hr or mm/hr).

Parameters
ctxSimulation context.
gage_idxGage index.
report_dateAbsolute OADate (days since 12/30/1899) to query.
Returns
Rainfall rate in user units (in/hr or mm/hr).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ splitPrecip()

PrecipSplit openswmm::gage::splitPrecip ( const SimulationContext & ctx,
std::size_t sub )

Split a subcatchment's gage precipitation into rain and snow.

The single source of truth for the rain/snow split, mirroring legacy gage_getPrecip() (gage.c:513-523) and adding the subcatchment-level scale factors. Applies, in order:

  • the IgnoreSnowmelt guard and the temperature test
  • the gage snow catch factor (SCF) on the snow branch
  • the subcatchment rain/snow scale factors
  • conversion to internal units (ft/sec)

Both the snowpack path (SWMMEngine) and the plain runoff path (RunoffSolver) MUST route through this. They previously duplicated the logic and drifted: the snowpack path dropped the SCF entirely and the runoff path performed no split at all.

API/forcing overrides are applied by the CALLER, after this returns — they are absolute injections and are deliberately not scaled.

Parameters
ctxSimulation context (gages, subcatchments, climate, options).
subSubcatchment index.
Returns
Rainfall and snowfall in ft/sec. Zero if the subcatchment has no gage.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateAllGages()

void openswmm::gage::updateAllGages ( SimulationContext & ctx,
double current_time )

Process all gages for one timestep.

Parameters
ctxSimulation context (gages + timeseries accessed).
current_timeCurrent simulation time (seconds).
Here is the call graph for this function:

◆ updatePastRain()

void openswmm::gage::updatePastRain ( GageState & state,
double current_time )

Update past n-hour rainfall accumulation.

Parameters
state[in/out] Gage state.
current_timeCurrent simulation time (seconds from start).

Variable Documentation

◆ MAXPASTRAIN

int openswmm::gage::MAXPASTRAIN = 48
constexpr

Max past hours tracked.

◆ ONE_SECOND

double openswmm::gage::ONE_SECOND = 1.1574074e-5
constexpr

One second in days.