Skip to main content

PreparedDcStudy

Struct PreparedDcStudy 

Source
pub struct PreparedDcStudy<'a> { /* private fields */ }
Expand description

Prepared DC solve model for a network.

This caches the validated topology, one reduced B’ / KLU kernel per AC island, and the global branch / bus metadata so callers can run solve(), compute_ptdf(), and compute_lodf() without rebuilding the sparse model each time. Single-island and multi-island networks share the same public API.

Implementations§

Source§

impl<'a> PreparedDcStudy<'a>

Source

pub fn new(network: &'a Network) -> Result<Self, DcError>

Prepare a reusable DC model for a network.

Source

pub fn new_unchecked(network: &'a Network) -> Result<Self, DcError>

Prepare a reusable DC model for a structurally valid derived topology.

This constructor is intended for advanced/internal workflows such as exact post-contingency fallback, where a valid base network may split into islands that no longer retain an explicit slack designation. It still validates structural integrity, but it intentionally skips the public DC solve contract that requires exactly one slack bus per connected component.

Source

pub fn solve(&mut self, opts: &DcPfOptions) -> Result<DcPfSolution, DcError>

Solve DC power flow using the prepared model.

Source

pub fn run_analysis( &mut self, request: &DcAnalysisRequest, ) -> Result<DcAnalysisResult, DcError>

Compute the canonical DC power flow + analysis workflow over one prepared study.

Source

pub fn compute_ptdf( &mut self, monitored_branch_indices: &[usize], ) -> Result<PtdfRows, DcError>

Compute PTDF rows for the given monitored branches using single-slack semantics.

Source

pub fn compute_loss_sensitivities_adjoint( &mut self, theta: &[f64], ) -> Result<Vec<f64>, DcError>

Compute DC marginal loss sensitivities without materializing a loss PTDF.

This returns the same single-slack-gauge vector as Σ_l 2 * r_l * flow_l * PTDF[l, bus], but evaluates that product with one sparse adjoint solve per island instead of a dense branch-by-bus PTDF cache. theta is indexed by the network’s internal bus order.

Source

pub fn compute_ptdf_request( &mut self, request: &PtdfRequest, ) -> Result<PtdfRows, DcError>

Compute PTDF rows from an explicit PtdfRequest.

Source

pub fn compute_ptdf_with_options( &mut self, monitored_branch_indices: &[usize], bus_indices: Option<&[usize]>, options: &DcSensitivityOptions, ) -> Result<PtdfRows, DcError>

Source

pub fn compute_otdf( &mut self, monitored_branch_indices: &[usize], outage_branch_indices: &[usize], ) -> Result<OtdfResult, DcError>

Compute OTDF for the given monitored and outage branches using single-slack semantics.

Source

pub fn compute_otdf_request( &mut self, request: &OtdfRequest, ) -> Result<OtdfResult, DcError>

Compute OTDF from an explicit OtdfRequest.

Source

pub fn lodf_columns(&mut self) -> LodfColumnBuilder<'_, 'a>

Create a lazily-evaluated LODF column builder backed by this prepared model.

Source

pub fn n2_lodf_columns( &mut self, monitored_branch_indices: &[usize], candidate_outage_branch_indices: &[usize], ) -> Result<N2LodfColumnBuilder<'_, 'a>, DcError>

Create a lazily-evaluated N-2 LODF column builder backed by this prepared model.

Source

pub fn compute_lodf( &mut self, monitored_branch_indices: &[usize], outage_branch_indices: &[usize], ) -> Result<LodfResult, DcError>

Compute rectangular LODF for the given monitored and outage branch sets.

Source

pub fn compute_lodf_request( &mut self, request: &LodfRequest, ) -> Result<LodfResult, DcError>

Compute LODF from an explicit LodfRequest.

Source

pub fn compute_lodf_pairs( &mut self, monitored_branch_indices: &[usize], outage_branch_indices: &[usize], ) -> Result<LodfPairs, DcError>

Compute selected LODF entries as a sparse pair map.

The returned map is keyed as (monitored_branch_idx, outage_branch_idx).

Source

pub fn compute_lodf_matrix( &mut self, branches: &[usize], ) -> Result<LodfMatrixResult, DcError>

Compute a dense all-pairs LODF matrix for the given branch set.

Source

pub fn compute_lodf_matrix_request( &mut self, request: &LodfMatrixRequest, ) -> Result<LodfMatrixResult, DcError>

Compute a dense all-pairs LODF matrix from an explicit LodfMatrixRequest.

Source

pub fn compute_n2_lodf( &mut self, outage_pair: (usize, usize), monitored_branch_indices: &[usize], ) -> Result<N2LodfResult, DcError>

Compute N-2 LODF for a single simultaneous double-outage pair.

Source

pub fn compute_n2_lodf_request( &mut self, request: &N2LodfRequest, ) -> Result<N2LodfResult, DcError>

Compute N-2 LODF from an explicit N2LodfRequest.

Source

pub fn compute_n2_lodf_batch( &mut self, outage_pairs: &[(usize, usize)], monitored_branch_indices: &[usize], ) -> Result<N2LodfBatchResult, DcError>

Compute batched N-2 LODF for multiple simultaneous double-outage pairs.

Source

pub fn compute_n2_lodf_batch_request( &mut self, request: &N2LodfBatchRequest, ) -> Result<N2LodfBatchResult, DcError>

Compute batched N-2 LODF from an explicit N2LodfBatchRequest.

Auto Trait Implementations§

§

impl<'a> Freeze for PreparedDcStudy<'a>

§

impl<'a> RefUnwindSafe for PreparedDcStudy<'a>

§

impl<'a> Send for PreparedDcStudy<'a>

§

impl<'a> !Sync for PreparedDcStudy<'a>

§

impl<'a> Unpin for PreparedDcStudy<'a>

§

impl<'a> UnsafeUnpin for PreparedDcStudy<'a>

§

impl<'a> UnwindSafe for PreparedDcStudy<'a>

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

Source§

fn by_ref(&self) -> &T

Source§

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

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more