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>
impl<'a> PreparedDcStudy<'a>
Sourcepub fn new(network: &'a Network) -> Result<Self, DcError>
pub fn new(network: &'a Network) -> Result<Self, DcError>
Prepare a reusable DC model for a network.
Sourcepub fn new_unchecked(network: &'a Network) -> Result<Self, DcError>
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.
Sourcepub fn solve(&mut self, opts: &DcPfOptions) -> Result<DcPfSolution, DcError>
pub fn solve(&mut self, opts: &DcPfOptions) -> Result<DcPfSolution, DcError>
Solve DC power flow using the prepared model.
Sourcepub fn run_analysis(
&mut self,
request: &DcAnalysisRequest,
) -> Result<DcAnalysisResult, DcError>
pub fn run_analysis( &mut self, request: &DcAnalysisRequest, ) -> Result<DcAnalysisResult, DcError>
Compute the canonical DC power flow + analysis workflow over one prepared study.
Sourcepub fn compute_ptdf(
&mut self,
monitored_branch_indices: &[usize],
) -> Result<PtdfRows, DcError>
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.
Sourcepub fn compute_loss_sensitivities_adjoint(
&mut self,
theta: &[f64],
) -> Result<Vec<f64>, DcError>
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.
Sourcepub fn compute_ptdf_request(
&mut self,
request: &PtdfRequest,
) -> Result<PtdfRows, DcError>
pub fn compute_ptdf_request( &mut self, request: &PtdfRequest, ) -> Result<PtdfRows, DcError>
Compute PTDF rows from an explicit PtdfRequest.
pub fn compute_ptdf_with_options( &mut self, monitored_branch_indices: &[usize], bus_indices: Option<&[usize]>, options: &DcSensitivityOptions, ) -> Result<PtdfRows, DcError>
Sourcepub fn compute_otdf(
&mut self,
monitored_branch_indices: &[usize],
outage_branch_indices: &[usize],
) -> Result<OtdfResult, DcError>
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.
Sourcepub fn compute_otdf_request(
&mut self,
request: &OtdfRequest,
) -> Result<OtdfResult, DcError>
pub fn compute_otdf_request( &mut self, request: &OtdfRequest, ) -> Result<OtdfResult, DcError>
Compute OTDF from an explicit OtdfRequest.
Sourcepub fn lodf_columns(&mut self) -> LodfColumnBuilder<'_, 'a>
pub fn lodf_columns(&mut self) -> LodfColumnBuilder<'_, 'a>
Create a lazily-evaluated LODF column builder backed by this prepared model.
Sourcepub fn n2_lodf_columns(
&mut self,
monitored_branch_indices: &[usize],
candidate_outage_branch_indices: &[usize],
) -> Result<N2LodfColumnBuilder<'_, 'a>, DcError>
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.
Sourcepub fn compute_lodf(
&mut self,
monitored_branch_indices: &[usize],
outage_branch_indices: &[usize],
) -> Result<LodfResult, DcError>
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.
Sourcepub fn compute_lodf_request(
&mut self,
request: &LodfRequest,
) -> Result<LodfResult, DcError>
pub fn compute_lodf_request( &mut self, request: &LodfRequest, ) -> Result<LodfResult, DcError>
Compute LODF from an explicit LodfRequest.
Sourcepub fn compute_lodf_pairs(
&mut self,
monitored_branch_indices: &[usize],
outage_branch_indices: &[usize],
) -> Result<LodfPairs, DcError>
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).
Sourcepub fn compute_lodf_matrix(
&mut self,
branches: &[usize],
) -> Result<LodfMatrixResult, DcError>
pub fn compute_lodf_matrix( &mut self, branches: &[usize], ) -> Result<LodfMatrixResult, DcError>
Compute a dense all-pairs LODF matrix for the given branch set.
Sourcepub fn compute_lodf_matrix_request(
&mut self,
request: &LodfMatrixRequest,
) -> Result<LodfMatrixResult, DcError>
pub fn compute_lodf_matrix_request( &mut self, request: &LodfMatrixRequest, ) -> Result<LodfMatrixResult, DcError>
Compute a dense all-pairs LODF matrix from an explicit LodfMatrixRequest.
Sourcepub fn compute_n2_lodf(
&mut self,
outage_pair: (usize, usize),
monitored_branch_indices: &[usize],
) -> Result<N2LodfResult, DcError>
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.
Sourcepub fn compute_n2_lodf_request(
&mut self,
request: &N2LodfRequest,
) -> Result<N2LodfResult, DcError>
pub fn compute_n2_lodf_request( &mut self, request: &N2LodfRequest, ) -> Result<N2LodfResult, DcError>
Compute N-2 LODF from an explicit N2LodfRequest.
Sourcepub fn compute_n2_lodf_batch(
&mut self,
outage_pairs: &[(usize, usize)],
monitored_branch_indices: &[usize],
) -> Result<N2LodfBatchResult, DcError>
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.
Sourcepub fn compute_n2_lodf_batch_request(
&mut self,
request: &N2LodfBatchRequest,
) -> Result<N2LodfBatchResult, DcError>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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