Skip to main content

LoadingDirection

Struct LoadingDirection 

Source
pub struct LoadingDirection {
    pub d_p: Vec<f64>,
    pub d_q: Vec<f64>,
}
Expand description

Per-bus (Δp, Δq) in per-unit: the injection change per unit of λ.

s_spec(λ) = s_base + λ · Δs, so λ = 0 is the base case and λ = 1 is the base case plus one full direction.

Fields§

§d_p: Vec<f64>

Indexed by Bus::idx.

§d_q: Vec<f64>

Implementations§

Source§

impl LoadingDirection

Source

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

The default: Δp_i = p_spec_i, Δq_i = q_spec_i at every bus that is a net consumer (p_spec < 0), zero elsewhere. Constant power factor, generation held at schedule.

The slack picks up both the load increase and the incremental losses. Its own entry is irrelevant either way — a slack bus contributes no P equation, so nothing in the augmented system ever reads it — but at high λ its output can become physically absurd. That is a property of the scenario, not a defect; scale_loads_with_pickup is the realistic alternative.

Source

pub fn scale_buses(buses: &[Bus], subset: &[usize]) -> Self

scale_loads restricted to subset: a local or zonal stress direction rather than a system-wide one.

Source

pub fn scale_loads_with_pickup(buses: &[Bus], weights: &[f64]) -> Self

scale_loads, with the active-power pickup shared over weights instead of dumped on the slack: Δp_gen,i = −ŵ_i · Σ_j Δp_load,j, with ŵ normalized over the supplied weights.

This is the analytic equivalent of running DistributedSlack inside the corrector, and the analytic form is required rather than merely cheaper. That loop moves p_spec as a function of the solved state; such a dependence is invisible to ∂g/∂λ, so running it inside the corrector would silently corrupt the tangent — the one vector continuation needs exact. Its effect is exactly linear in λ, so folding it into Δp is both faithful and free.

Weights at slack buses are dropped: a slack has no P equation, so a share allocated to it would vanish and the pickup would no longer sum to the load increase.

Source

pub fn explicit(d_p: Vec<f64>, d_q: Vec<f64>) -> Self

A study direction from a market or scenario tool, taken as given.

Source

pub fn to_target(buses: &[Bus], p_target: &[f64], q_target: &[f64]) -> Self

MATPOWER’s base-case-to-target-case form: Δ = target − base.

Source

pub fn zero(n: usize) -> Self

Source

pub fn total_active_load_increase(&self) -> f64

Σ over net consumers of −Δp_i: the per-unit load increase per unit of λ, and the multiplier behind the reported margin.

Counts only the consuming half, so a direction with generation pickup reports the same margin as the same load ramp without it — the margin is how much more load the system carries, not how much more the machines produce.

Source

pub fn is_empty(&self) -> bool

True when nothing moves — a direction that would make continuation a no-op, and a caller mistake worth refusing rather than looping over.

Trait Implementations§

Source§

impl Clone for LoadingDirection

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LoadingDirection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for LoadingDirection

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LoadingDirection

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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