pub struct SogiPll { /* private fields */ }Expand description
Second-Order Generalized Integrator Phase-Locked Loop (SOGI-PLL).
Implements orthogonal signal generation ($v_\alpha, v_\beta$) from a single-phase input $v(t)$ and tracks fundamental frequency and phase in real-time.
Discretized using trapezoidal (Tustin) integration for zero frequency warping at the center frequency.
Implementations§
Source§impl SogiPll
impl SogiPll
Sourcepub fn new(
center_freq_hz: f32,
sample_rate_hz: f32,
k_sogi: f32,
kp: f32,
ki: f32,
) -> Self
pub fn new( center_freq_hz: f32, sample_rate_hz: f32, k_sogi: f32, kp: f32, ki: f32, ) -> Self
Creates a new SOGI-PLL tuned to center_freq_hz at sample_rate_hz.
k_sogi: SOGI damping factor (default1.414).kp: Loop filter proportional gain (e.g.60.0).ki: Loop filter integral gain (e.g.1400.0).
Sourcepub fn process(&mut self, input: f32) -> f32
pub fn process(&mut self, input: f32) -> f32
Process a single input sample and return the tracked instantaneous phase $\theta \in [-\pi, \pi]$.
Sourcepub fn frequency_hz(&self) -> f32
pub fn frequency_hz(&self) -> f32
Returns the estimated fundamental frequency in Hz.
Sourcepub fn orthogonal_components(&self) -> (f32, f32)
pub fn orthogonal_components(&self) -> (f32, f32)
Returns the filtered orthogonal components (v_alpha, v_beta).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SogiPll
impl RefUnwindSafe for SogiPll
impl Send for SogiPll
impl Sync for SogiPll
impl Unpin for SogiPll
impl UnsafeUnpin for SogiPll
impl UnwindSafe for SogiPll
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
Mutably borrows from an owned value. Read more