PLL

Struct PLL 

Source
pub struct PLL {
    pub ba: [Q32<32>; 3],
}
Expand description

Type-2, order-3 sampled phase, discrete time PLL

This PLL tracks the frequency and phase of an input signal with respect to the sampling clock. The open loop transfer function is type 2 (DC double integrator) from input phase to output phase.

The transfer functions (for phase and frequency) contain an additional zero at Nyquist.

The PLL locks to any frequency (i.e. it locks to the alias in the first Nyquist zone) and is stable for any numerically valid gain (in units of the sample rate: 7e-5 to 5e-2). It has a single parameter that determines the loop bandwidth. The gains can be changed freely between updates.

All math is naturally wrapping 32 bit integer. Phase and frequency are understood modulo that overflow in the first Nyquist zone. Expressing the IIR equations in other ways (e.g. single (T)-DF-{I,II} biquad/IIR) would break on overflow (i.e. every cycle).

There are no floating point rounding errors. The integer quantization/truncation error is fed back (first order noise shaping).

This PLL clamps phase wraps accumulated during (frequency) lock acquisition.

The phase detector is symmetric (additive): the loop filter has negative gain. The output will compensate the input phase: it will settle to the complement. The output phase increment (the loop filter output, the frequency) is the negative of the input increment.

Fields§

§ba: [Q32<32>; 3]

Lead lag coefficients

f0 += b0*y0 + b1*y1 + a1*f1

Implementations§

Source§

impl PLL

Source

pub fn from_zpk(zero: f32, pole: f32, gain: f32) -> Self

Return Pll from zero/pole/gain

Source

pub fn from_bandwidth(bw: f32, split: f32) -> Self

Given a crossover, create a PLL

About 1.5 dB peaking, 62 deg phase margin for split=4

Trait Implementations§

Source§

impl Clone for PLL

Source§

fn clone(&self) -> PLL

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PLL

Source§

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

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

impl Default for PLL

Source§

fn default() -> PLL

Returns the “default value” for a type. Read more
Source§

impl SplitProcess<Wrapping<i32>, Wrapping<i32>, PLLState> for PLL

Source§

fn process(&self, state: &mut PLLState, x: W<i32>) -> W<i32>

Process an input into an output Read more
§

fn block(&self, state: &mut S, x: &[X], y: &mut [Y])

Process a block of inputs Read more

Auto Trait Implementations§

§

impl Freeze for PLL

§

impl RefUnwindSafe for PLL

§

impl Send for PLL

§

impl Sync for PLL

§

impl Unpin for PLL

§

impl UnwindSafe for PLL

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.