pub struct InflowModel {
pub hydro_id: EntityId,
pub stage_id: i32,
pub mean_m3s: f64,
pub std_m3s: f64,
pub ar_coefficients: Vec<f64>,
pub residual_std_ratio: f64,
pub annual: Option<AnnualComponent>,
}Expand description
Raw PAR(p) model parameters for a single (hydro, stage) pair.
Raw input-facing values loaded from inflow_seasonal_stats.parquet and
inflow_ar_coefficients.parquet; see each field for units and standardization.
§Two planes
The fields split into two planes. The conditioning plane — mean_m3s
(μ_m) and std_m3s (s_m), both m³/s — carries the level and magnitude of
the series and may be re-conditioned per study (e.g. a climate scenario
shifting both mean and variability). The dynamics plane —
ar_coefficients (ψ*, standardized) and residual_std_ratio
(r_m = σ_m / s_m), both dimensionless — is the shape of the temporal
dependence, fixed per fit. Runtime re-couples them: ψ = ψ* · s_m / s_{m-ℓ}
and σ_m = s_m · r_m.
The coefficients are standardized by the seasonal std s_m, not the
innovation std σ_m (the two differ whenever r_m varies across seasons). An
externally-fitted model must therefore store ar_coefficients = ψ · s_{m-ℓ} / s_m
and residual_std_ratio = σ_m / s_m against the same s_m it reports in
std_m3s.
§Declaration-order invariance
The System holds a Vec<InflowModel> sorted by (hydro_id, stage_id).
All processing must iterate in that canonical order.
See internal-structures.md §14 and PAR Inflow Model §7.
§Examples
Classical PAR(p) model (no annual component):
use cobre_core::{EntityId, scenario::InflowModel};
let model = InflowModel {
hydro_id: EntityId(1),
stage_id: 3,
mean_m3s: 150.0,
std_m3s: 30.0,
ar_coefficients: vec![0.45, 0.22],
residual_std_ratio: 0.85,
annual: None,
};
assert_eq!(model.ar_order(), 2);
assert_eq!(model.ar_coefficients.len(), 2);
assert!((model.residual_std_ratio - 0.85).abs() < f64::EPSILON);
assert!(model.annual.is_none());PAR(p)-A model with annual component:
use cobre_core::{EntityId, scenario::{AnnualComponent, InflowModel}};
let model = InflowModel {
hydro_id: EntityId(1),
stage_id: 3,
mean_m3s: 150.0,
std_m3s: 30.0,
ar_coefficients: vec![0.45, 0.22],
residual_std_ratio: 0.85,
annual: Some(AnnualComponent {
coefficient: 0.15,
mean_m3s: 90.0,
std_m3s: 12.0,
}),
};
assert_eq!(model.ar_order(), 2);
let ann = model.annual.as_ref().expect("annual present");
assert!((ann.coefficient - 0.15).abs() < f64::EPSILON);Fields§
§hydro_id: EntityIdHydro plant this model belongs to.
stage_id: i32Declared study-stage id this model applies to (not a 0-based index).
mean_m3s: f64Seasonal mean inflow μ in m³/s.
std_m3s: f64Seasonal standard deviation s_m in m³/s (seasonal sample std).
ar_coefficients: Vec<f64>AR lag coefficients [ψ*₁, ψ*₂, …, ψ*ₚ] standardized by seasonal std (dimensionless). These are the direct Yule-Walker output. Length is the AR order p. Empty when p == 0 (white noise).
residual_std_ratio: f64Ratio of residual standard deviation to seasonal standard deviation
(σ_m / s_m). Dimensionless, in (0, 1]. The runtime residual std is
std_m3s * residual_std_ratio. When ar_coefficients is empty
(white noise), this is 1.0 (the AR model explains nothing).
annual: Option<AnnualComponent>Optional annual component; None selects the classical PAR(p) model.
See AnnualComponent.
Implementations§
Trait Implementations§
Source§impl Clone for InflowModel
impl Clone for InflowModel
Source§fn clone(&self) -> InflowModel
fn clone(&self) -> InflowModel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more