Skip to main content

ReliabilityCalculator

Struct ReliabilityCalculator 

Source
pub struct ReliabilityCalculator {
    pub customers: Vec<CustomerData>,
    pub events: Vec<InterruptionEvent>,
    pub period_years: f64,
    pub voll_usd_per_mwh: f64,
    pub cemi_n_threshold: usize,
    pub celid_l_threshold_h: f64,
}
Expand description

Main reliability calculator implementing IEEE 1366 distribution indices and Monte Carlo bulk-system adequacy assessment.

§Example

use oxigrid::network::reliability_indices::{
    CustomerData, InterruptionEvent, InterruptionCause, ReliabilityCalculator,
};
let customers = vec![
    CustomerData { id: 0, n_customers: 500, load_kw: 1000.0, feeder_id: 0, substation_id: 0 },
];
let calc = ReliabilityCalculator::new(customers, vec![], 1.0);
let idx  = calc.compute_indices();
assert_eq!(idx.saidi, 0.0);
assert_eq!(idx.asai, 1.0);

Fields§

§customers: Vec<CustomerData>

Customer records for the study area.

§events: Vec<InterruptionEvent>

Interruption events recorded over the observation period.

§period_years: f64

Length of the observation window (years).

§voll_usd_per_mwh: f64

Value of lost load (USD / MWh) used for bulk cost calculation.

§cemi_n_threshold: usize

Threshold N for the CEMI-N index (interruptions per period).

§celid_l_threshold_h: f64

Threshold L for the CELID index (cumulative hours outage per period).

Implementations§

Source§

impl ReliabilityCalculator

Source

pub fn new( customers: Vec<CustomerData>, events: Vec<InterruptionEvent>, period_years: f64, ) -> Self

Create a new calculator with default VOLL (10 000 USD/MWh) and default CEMI-N / CELID thresholds (N = 3, L = 2 h).

Source

pub fn compute_indices(&self) -> ReliabilityIndices

Compute all IEEE 1366-2012 system-level reliability indices.

Returns ReliabilityIndices::default (ASAI = 1) when there are no customers or no events.

Source

pub fn compute_feeder_indices(&self) -> Vec<FeederReliability>

Compute IEEE 1366 indices broken down by feeder.

Each FeederReliability contains indices computed using only the customers and events belonging to that feeder.

Source

pub fn compute_bulk_reliability( &self, units: &[GenerationUnit], peak_load_mw: f64, n_trials: usize, ) -> BulkSystemReliability

Compute bulk system reliability indices via sequential Monte Carlo.

Uses an LCG PRNG (no external rand crate) to determine each unit’s state for n_trials independent hour-samples.

§Arguments
  • units — Generating units in the fleet.
  • peak_load_mw — System peak load (MW) used as the load target.
  • n_trials — Number of Monte Carlo samples (≥ 1000 recommended).
Source

pub fn identify_bad_actors(&self, top_n: usize) -> Vec<(usize, f64)>

Identify the top_n feeders with the highest contribution to system SAIDI.

Returns a vector of (feeder_id, saidi_contribution_h) sorted in descending order of SAIDI contribution.

Source

pub fn compute_improvement_benefit( &self, target_feeder: usize, target_saidi_reduction: f64, ) -> f64

Estimate the system-level SAIDI improvement resulting from reducing a single feeder’s SAIDI contribution by target_saidi_reduction hours.

The improvement is the minimum of the requested reduction and the feeder’s current SAIDI contribution.

Returns 0.0 if the feeder contributes nothing to system SAIDI.

Source

pub fn forecast_reliability( &self, years: usize, trend_pct_per_year: f64, ) -> Vec<ReliabilityIndices>

Project reliability indices into future years using a linear trend.

trend_pct_per_year is the percentage degradation per year applied to SAIDI and SAIFI (positive = worsening, negative = improving).

§Arguments
  • years — Number of future years to project.
  • trend_pct_per_year — Annual percentage change in SAIDI and SAIFI.

Returns a Vec of length years, with index 0 representing year 1.

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

unsafe fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.