![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Rain records, accepted runoff-clock state and read-only report lookups. Context routines require aligned initialized gage/subcatchment arrays, valid project units and ordered finite table x/y pairs unless stated otherwise. State mutations are immediate; serialize updates with reads and use private copies for trials. Only precipitation splits convert rates to internal ft/s. More...
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) |
| Transform one raw rain record with standalone GageState factors. | |
| PrecipSplit | splitPrecip (const SimulationContext &ctx, std::size_t sub) |
| Split a subcatchment's current gage intensity into internal rain and snow. | |
| void | updatePastRain (GageState &state, int time_step) |
| Accumulate a standalone gage's held intensity into completed-hour history. | |
| void | updatePastRain (SimulationContext &ctx, int time_step) |
| Accumulate every gage's current held rate over one accepted runoff step. | |
| double | getPastRain (const GageState &state, int hours) |
| Sum completed hourly depth buckets, excluding the current partial hour. | |
| const Table * | gageRainSeries (const SimulationContext &ctx, int gage_idx) |
| Borrow the actual resolved source table for a gage. | |
| int | gageSeriesRainType (const SimulationContext &ctx, int gage_idx) |
| Select the transform appropriate to resolved source storage. | |
| double | gageUnitsFactor (const SimulationContext &ctx, int gage_idx) |
| Return the source-storage-to-project rainfall depth multiplier. | |
| double | convertGageValue (double raw, int rain_type, double interval_sec, double &cumul_accum, double units_factor, double scale_factor) |
| Transform one source record and apply units then scale factors. | |
| bool | gageIsUsed (const SimulationContext &ctx, int gage_idx) |
| Test whether the model or enabled rainfall mesh consumes a gage. | |
| double | gageNextRainDate (const SimulationContext &ctx, int gage_idx, double t) |
| Read the next runoff-clock rainfall boundary from cached gage state. | |
| double | gageNextRateChange (const SimulationContext &ctx, int gage_idx, double date, double limit) |
| Forecast the end of the current held rain rate without changing source state. | |
| void | updateAllGages (SimulationContext &ctx, double current_time) |
| Advance used gage record state and publish current effective rainfall. | |
| double | getReportRainfall (const SimulationContext &ctx, int gage_idx, double report_date) |
| Query rainfall using the most recently advanced runoff-gage state. | |
| double | getReportRainfallFromSeries (const SimulationContext &ctx, int gage_idx, double report_date) |
| Query report-time source records independently of a later runoff cursor. | |
Variables | |
| constexpr double | ONE_SECOND = 1.1574074e-5 |
| One second in days. | |
| constexpr int | MAXPASTRAIN = 48 |
| Max past hours tracked. | |
Rain records, accepted runoff-clock state and read-only report lookups. Context routines require aligned initialized gage/subcatchment arrays, valid project units and ordered finite table x/y pairs unless stated otherwise. State mutations are immediate; serialize updates with reads and use private copies for trials. Only precipitation splits convert rates to internal ft/s.
|
strong |
| double openswmm::gage::convertGageValue | ( | double | raw, |
| int | rain_type, | ||
| double | interval_sec, | ||
| double & | cumul_accum, | ||
| double | units_factor, | ||
| double | scale_factor ) |
Transform one source record and apply units then scale factors.
| raw | Raw intensity per project hour or interval/cumulative depth, depending on type. | |
| rain_type | Zero intensity, one volume, two cumulative; other integers fall through as raw intensity. No enum/finite validation occurs. | |
| interval_sec | Positive recording seconds for depth transforms; nonpositive interval skips the transform and returns scaled raw, unlike convertRainfall(). | |
| [in,out] | cumul_accum | Previous cumulative raw depth; on a positive-interval cumulative record a decrease resets the counter, otherwise differences it. Retained for other types/invalid intervals. Carry across records in source order. |
| units_factor | Source-depth to project-depth multiplier. | |
| scale_factor | Dimensionless gage scale; no monthly adjustment applied here. |
| double openswmm::gage::convertRainfall | ( | double | raw_value, |
| GageState & | state ) |
Transform one raw rain record with standalone GageState factors.
| raw_value | Intensity in project in/hr or mm/hr, or interval/cumulative depth in project inches/mm according to state.rain_type; caller qualifies finite data. | |
| [in,out] | state | Recording interval seconds and units/scale/monthly factors; only rain_accum changes for CUMULATIVE with a positive interval. A counter decrease starts a new accumulation event. Other rain state fields are retained. |
| bool openswmm::gage::gageIsUsed | ( | const SimulationContext & | ctx, |
| int | gage_idx ) |
Test whether the model or enabled rainfall mesh consumes a gage.
| ctx | Compatible initialized subcatchment, hydrograph-name and optional mesh state. |
| gage_idx | Valid zero-based gage index; no range check is performed here. |
| double openswmm::gage::gageNextRainDate | ( | const SimulationContext & | ctx, |
| int | gage_idx, | ||
| double | t ) |
Read the next runoff-clock rainfall boundary from cached gage state.
| ctx | Compatible state last produced by updateAllGages, with aligned state arrays and table indices; does not advance it. |
| gage_idx | Zero-based gage index; out-of-state-range or unused returns t. |
| t | Finite absolute SWMM query day; comparisons internally use t plus one second. |
| double openswmm::gage::gageNextRateChange | ( | const SimulationContext & | ctx, |
| int | gage_idx, | ||
| double | date, | ||
| double | limit ) |
Forecast the end of the current held rain rate without changing source state.
| ctx | Compatible initialized, current gage state and ordered record tables. |
| gage_idx | Valid zero-based gage with current/next record indices consistent with date; this is a held-state forecast, not an arbitrary historical query. |
| date | Finite exact interval-start SWMM day (no legacy +1-second shift). |
| limit | Finite upper-bound SWMM day at/after date. |
| const Table * openswmm::gage::gageRainSeries | ( | const SimulationContext & | ctx, |
| int | gage_idx ) |
Borrow the actual resolved source table for a gage.
| ctx | Compatible initialized gage source/index arrays and owned table pools. |
| gage_idx | Zero-based gage index; invalid returns null. |
| int openswmm::gage::gageSeriesRainType | ( | const SimulationContext & | ctx, |
| int | gage_idx ) |
Select the transform appropriate to resolved source storage.
| ctx | Compatible initialized source/format/rain_type arrays. |
| gage_idx | Valid zero-based gage index; unchecked. |
| double openswmm::gage::gageUnitsFactor | ( | const SimulationContext & | ctx, |
| int | gage_idx ) |
Return the source-storage-to-project rainfall depth multiplier.
| ctx | Compatible gage source/format arrays and project unit enum. |
| gage_idx | Zero-based gage index; invalid returns one. |
| double openswmm::gage::getPastRain | ( | const GageState & | state, |
| int | hours ) |
Sum completed hourly depth buckets, excluding the current partial hour.
| state | Borrowed standalone history in project inches/mm. |
| hours | Requested completed hours in [1,48]; other values return zero. |
| double openswmm::gage::getReportRainfall | ( | const SimulationContext & | ctx, |
| int | gage_idx, | ||
| double | report_date ) |
Query rainfall using the most recently advanced runoff-gage state.
| ctx | Compatible initialized state/tables/co-gage arrays, borrowed read-only. |
| gage_idx | Valid zero-based gage index, unchecked before several accesses. |
| report_date | Finite absolute SWMM/OLE day; lookup uses a one-second shift. |
| double openswmm::gage::getReportRainfallFromSeries | ( | const SimulationContext & | ctx, |
| int | gage_idx, | ||
| double | report_date ) |
Query report-time source records independently of a later runoff cursor.
| ctx | Compatible initialized gage/table state; st_cur must still be initialized and not NO_STATE even though rate selection searches source timestamps directly. |
| gage_idx | Valid zero-based gage index, unchecked before several accesses. |
| report_date | Supported finite SWMM/OLE day; source search uses date plus one second. |
| PrecipSplit openswmm::gage::splitPrecip | ( | const SimulationContext & | ctx, |
| std::size_t | sub ) |
Split a subcatchment's current gage intensity into internal rain and snow.
| ctx | Compatible initialized arrays, valid units and validated snow parameters; reads climate temperature in F and current effective gage rainfall in project/hour. |
| sub | Valid zero-based subcatchment index; unchecked before array access. |
| void openswmm::gage::updateAllGages | ( | SimulationContext & | ctx, |
| double | current_time ) |
Advance used gage record state and publish current effective rainfall.
| [in,out] | ctx | Compatible initialized model with aligned gage state/source/ forcing arrays, sorted finite resolved tables and coherent co-gage indices. Can initialize used flags, change record/lookahead indices/rates and rainfall; does not update precipitation splits, past-hour history or the simulation date itself. |
| current_time | Finite absolute SWMM/OLE day, not elapsed seconds. Monotonic forward requests are required; the state machine does not rewind. Record marching uses current_time plus one second and retains each lookahead's adjustment factor. Unused gages retain seeded rate. Ignore-rainfall wins before overrides; earlier co-gage rates precede API override, then ordinary source resolution. Final used-gage OVERRIDE/ADD forcing applies after all source reads. Rates remain project/hour; no finite/range validation or transaction rollback occurs here. |
| void openswmm::gage::updatePastRain | ( | GageState & | state, |
| int | time_step ) |
Accumulate a standalone gage's held intensity into completed-hour history.
| [in,out] | state | rainfall is project/hour; past_rain holds completed project depths and partial accumulator holds current-hour depth. Partial interval must be in [0,3600] seconds, normally integer-valued. |
| time_step | Actual accepted runoff duration in integer seconds; nonpositive is a no-op. May span multiple hours. An exactly full hour stays in the partial bucket until a later positive update; completed history excludes it until then. Does not split snow or reset rainfall; caller owns accepted-step invocation. |
| void openswmm::gage::updatePastRain | ( | SimulationContext & | ctx, |
| int | time_step ) |
Accumulate every gage's current held rate over one accepted runoff step.
| [in,out] | ctx | Aligned rainfall/partial/history arrays, including n_gages*48 completed-depth slots. Reads final resolved project/hour rates and changes only history accumulators/intervals; processes unused gages too. |
| time_step | Integer elapsed seconds, nonpositive no-op. Exact-hour rollover matches the standalone overload; no model clock or rainfall update occurs. |
|
constexpr |
Max past hours tracked.
|
constexpr |
One second in days.