pub struct CurrentFunctional {
pub at: usize,
pub coefficients: Vec<(usize, Complex<f64>)>,
}Expand description
A terminal current as a sparse linear functional of the complex bus voltages, plus the bus whose voltage turns it into a power.
Fields§
§at: usizeThe bus whose voltage forms the power S = V_at · conj(I).
coefficients: Vec<(usize, Complex<f64>)>I = Σ c_k·V_k, as (bus, c).
Duplicate buses are allowed and sum, which is what makes gridoxide’s
half-open branch — represented as a self-loop, so from == to — come
out right, and what lets a node injection concatenate its Y-bus row with
its source and shunt terms instead of merging them.
Implementations§
Source§impl CurrentFunctional
impl CurrentFunctional
Sourcepub fn power(&self, v: &[Complex<f64>]) -> Complex<f64>
pub fn power(&self, v: &[Complex<f64>]) -> Complex<f64>
S = V_at · conj(I), i.e. (P, Q) as one complex number.
Sourcepub fn power_partials(&self, v: &[Complex<f64>], out: &mut Vec<Partial>)
pub fn power_partials(&self, v: &[Complex<f64>], out: &mut Vec<Partial>)
Partials of S with respect to every bus it depends on, appended to
out in coefficient order.
∂S/∂θ_k = −j·V_at·conj(c_k·V_k) + [k = at]·j·S
∂S/∂|V_k| = V_at·conj(c_k·e^{jθ_k}) + [k = at]·S/|V_at|Every coefficient produces an entry, including one whose value is
numerically zero. H’s sparsity pattern has to depend on the topology
alone and not on the state — dropping a zero would shrink the row at a
flat start, where many sin(θ_i − θ_k) vanish exactly, and grow it again
next iteration, invalidating the cached symbolic factorization.
An empty functional produces nothing at all rather than a lone at
entry. Its quantity is identically zero with no dependence on anything,
and a row of structural zeros would defeat
mask_untouched, which is what pins a
genuinely disconnected bus.
Sourcepub fn local_current(&self, v: &[Complex<f64>]) -> Complex<f64>
pub fn local_current(&self, v: &[Complex<f64>]) -> Complex<f64>
I_local = S/|V_at| — see local_current_partials_of.
pub fn current_partials(&self, v: &[Complex<f64>], out: &mut Vec<Partial>)
pub fn local_current_partials(&self, v: &[Complex<f64>], out: &mut Vec<Partial>)
Trait Implementations§
Source§impl Clone for CurrentFunctional
impl Clone for CurrentFunctional
Source§impl Debug for CurrentFunctional
impl Debug for CurrentFunctional
Source§impl PartialEq for CurrentFunctional
impl PartialEq for CurrentFunctional
impl StructuralPartialEq for CurrentFunctional
Auto Trait Implementations§
impl Freeze for CurrentFunctional
impl RefUnwindSafe for CurrentFunctional
impl Send for CurrentFunctional
impl Sync for CurrentFunctional
impl Unpin for CurrentFunctional
impl UnsafeUnpin for CurrentFunctional
impl UnwindSafe for CurrentFunctional
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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