pub struct DcBatchSolver { /* private fields */ }Expand description
Solves many DC scenarios over one shared topology.
let scenarios: Vec<Scenario> = (0..10_000)
.map(|k| Scenario::new(vec![BusOverride::new(3).p(-0.1 * k as f64)]))
.collect();
let batch = DcBatchSolver::new();
let results = batch
.solve(&buses, &lines, &transformers, DcOptions::default(), &scenarios)
.unwrap();
assert_eq!(results.len(), 10_000);Implementations§
Source§impl DcBatchSolver
impl DcBatchSolver
Sourcepub fn with_threads(threads: usize) -> Result<Self, BatchError>
pub fn with_threads(threads: usize) -> Result<Self, BatchError>
Uses a dedicated pool of exactly threads workers, built once here and
reused by every solve call.
pub fn threads(&self) -> usize
Sourcepub fn solve(
&self,
buses_template: &[Bus],
lines: &[Line],
transformers: &[Transformer],
opts: DcOptions,
scenarios: &[Scenario],
) -> Result<Vec<DcBatchResult>, BatchError>
pub fn solve( &self, buses_template: &[Bus], lines: &[Line], transformers: &[Transformer], opts: DcOptions, scenarios: &[Scenario], ) -> Result<Vec<DcBatchResult>, BatchError>
Solves every scenario, returning one DcBatchResult each in
scenario order regardless of thread count.
Each scenario starts from buses_template with its own overrides
applied, so scenarios never influence one another.
BusOverride::voltage_mag is ignored: DC has no magnitude state to
set. BusOverride::q_spec is ignored too, for the same reason.
Errors only for input that cannot be interpreted — an out-of-range bus,
a branch outage, or a network whose reduced B is singular. A scenario
cannot “fail to converge”, since nothing iterates.
Sourcepub fn islands(
buses_template: &[Bus],
lines: &[Line],
transformers: &[Transformer],
opts: DcOptions,
) -> Vec<DcIslandReport>
pub fn islands( buses_template: &[Bus], lines: &[Line], transformers: &[Transformer], opts: DcOptions, ) -> Vec<DcIslandReport>
The base solve’s per-island breakdown, in the order
DcBatchResult::slack_pickup indexes.
Computed from the template, so it is the same for every scenario — island membership depends on topology, which a bus override cannot change.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DcBatchSolver
impl !UnwindSafe for DcBatchSolver
impl Freeze for DcBatchSolver
impl Send for DcBatchSolver
impl Sync for DcBatchSolver
impl Unpin for DcBatchSolver
impl UnsafeUnpin for DcBatchSolver
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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