Skip to main content

InflowModel

Struct InflowModel 

Source
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,
}
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 performance-adapted view (PrecomputedParLp) 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

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,
};
assert_eq!(model.ar_order(), 2);
assert_eq!(model.ar_coefficients.len(), 2);
assert!((model.residual_std_ratio - 0.85).abs() < f64::EPSILON);

Fields§

§hydro_id: EntityId

Hydro plant this model belongs to.

§stage_id: i32

Stage (0-based index within System::stages) this model applies to.

§mean_m3s: f64

Seasonal mean inflow μ in m³/s.

§std_m3s: f64

Seasonal 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: f64

Ratio 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).

Implementations§

Source§

impl InflowModel

Source

pub fn ar_order(&self) -> usize

AR model order p (number of lags). Zero means white-noise inflow.

Trait Implementations§

Source§

impl Clone for InflowModel

Source§

fn clone(&self) -> InflowModel

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InflowModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for InflowModel

Source§

fn eq(&self, other: &InflowModel) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for InflowModel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.