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.
Stores the seasonal mean, standard deviation, and standardized AR lag
coefficients loaded from inflow_seasonal_stats.parquet and
inflow_ar_coefficients.parquet. These are the raw input-facing values.
AR coefficients are stored standardized by seasonal std (dimensionless ψ*,
direct Yule-Walker output). The residual_std_ratio field carries the ratio
σ_m / s_m so that downstream crates can recover the runtime residual std as
std_m3s * residual_std_ratio without re-deriving it from the coefficients.
The optional annual field activates the PAR(p)-A extension; when None,
the classical PAR(p) model is in effect.
The performance-adapted view (PrecomputedPar) is built from these
parameters once at solver initialisation and belongs to downstream solver crates.
§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: i32Stage (0-based index within System::stages) this model applies to.
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 for the PAR(p)-A extension.
None — classical PAR(p) model; no annual term is applied.
Some(AnnualComponent { ... }) — the PAR(p)-A extension is active for
this (hydro, stage); all three sub-fields (coefficient, mean_m3s,
std_m3s) are guaranteed to be present. See AnnualComponent for
field details and the mathematical role of each value.
Implementations§
Trait Implementations§
Source§impl Clone for InflowModel
impl Clone for InflowModel
Source§fn clone(&self) -> InflowModel
fn clone(&self) -> InflowModel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more