Skip to main content

Layout

Struct Layout 

Source
pub struct Layout {
    pub non_slack_idx: Vec<usize>,
    pub pq_idx: Vec<usize>,
    pub n_angle: usize,
    pub n_unknowns: usize,
    pub n_buses: usize,
}
Expand description

The Newton unknown layout, derived once per segment.

Reproduces solver::newton_raphson_cached’s ordering exactly — every non-slack bus contributes an angle unknown in bus order, then every PQ bus a magnitude unknown — because the corrector’s mismatch vector and the augmented Jacobian’s rows must agree with it term for term.

Fields§

§non_slack_idx: Vec<usize>§pq_idx: Vec<usize>§n_angle: usize§n_unknowns: usize§n_buses: usize

Implementations§

Source§

impl Layout

Source

pub fn analyze(buses: &[Bus]) -> Self

Source

pub fn embed(&self, from: &Layout, t: &[f64]) -> Vec<f64>

Re-expresses a tangent written in from’s layout in this one.

A PV → PQ switch grows the unknown count by one, so the tangent that was steering the walk no longer even has the right length — but it still carries the direction of travel, which is the part that matters. Mapping it bus by bus (the newly-freed magnitude gets a zero component) gives the next tangent solve a bordering row that points the right way, so the walk continues forward across the event instead of doubling back.

Source

pub fn get(&self, buses: &[Bus], lambda: f64, k: usize) -> f64

The value of unknown k, with k == n_unknowns meaning λ itself.

Source

pub fn add(&self, buses: &mut [Bus], k: usize, delta: f64)

Adds delta to unknown k. λ is the caller’s own scalar, so k == n_unknowns is handled by the caller rather than here.

Source

pub fn direction_rows(&self, d_p: &[f64], d_q: &[f64]) -> Vec<f64>

Δs in Newton row order: Δp on every non-slack P row, Δq on every PQ Q row. The same layout as the mismatch vector, which is what lets the λ column be appended row-for-row.

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

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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