TrackingLoopFilters.jl
Loop filters for GNSS tracking algorithms.
Installation
pkg> add TrackingLoopFiltersQuick Start
using TrackingLoopFilters
using Unitful: Hz, s
# Create a loop filter
lf = ThirdOrderBilinearLF()
# Process discriminator output
output, next_lf = filter_loop(lf, δθ, Δt, bandwidth)API Reference
TrackingLoopFilters.TrackingLoopFilters — Module
TrackingLoopFiltersA Julia package implementing loop filters for GNSS tracking algorithms.
Provides first, second, and third order loop filters with boxcar and bilinear implementations. All filters support Unitful quantities for type-safe calculations.
Exported Types
FirstOrderLF: First order loop filter (stateless)SecondOrderBilinearLF: Second order bilinear loop filterSecondOrderBoxcarLF: Second order boxcar loop filterThirdOrderBilinearLF: Third order bilinear loop filterThirdOrderBoxcarLF: Third order boxcar loop filterThirdOrderAssistedBilinearLF: Third order bilinear loop filter with second order assistance
Exported Functions
propagate: Propagate the loop filter stateget_filtered_output: Get the filtered output for the current statefilter_loop: Combined propagate and get output in one call
TrackingLoopFilters.AbstractFirstOrderLF — Type
abstract type AbstractFirstOrderLF <: AbstractLoopFilterAbstract base type for first order loop filters.
TrackingLoopFilters.AbstractLoopFilter — Type
abstract type AbstractLoopFilterAbstract base type for all loop filters.
TrackingLoopFilters.AbstractSecondOrderLF — Type
abstract type AbstractSecondOrderLF <: AbstractLoopFilterAbstract base type for second order loop filters.
TrackingLoopFilters.AbstractThirdOrderAssistedLF — Type
abstract type AbstractThirdOrderAssistedLF <: AbstractLoopFilterAbstract base type for assisted third order loop filters.
TrackingLoopFilters.AbstractThirdOrderLF — Type
abstract type AbstractThirdOrderLF <: AbstractLoopFilterAbstract base type for third order loop filters.
TrackingLoopFilters.FirstOrderLF — Type
struct FirstOrderLF <: TrackingLoopFilters.AbstractFirstOrderLFFirst order loop filter (proportional only).
A stateless filter that provides proportional gain without integration. The natural frequency scaling factor is 4.0.
Example
lf = FirstOrderLF()
output, next_lf = filter_loop(lf, δθ, Δt, bandwidth)TrackingLoopFilters.SecondOrderBilinearLF — Type
struct SecondOrderBilinearLF{T} <: TrackingLoopFilters.AbstractSecondOrderLFSecond order bilinear loop filter.
Uses bilinear transformation for improved frequency response. The natural frequency scaling factor is 1.89.
x::Any: Frequency state estimate
Example
lf = SecondOrderBilinearLF()
output, next_lf = filter_loop(lf, δθ, Δt, bandwidth)TrackingLoopFilters.SecondOrderBilinearLF — Method
SecondOrderBilinearLF()Construct a second order bilinear loop filter with zero initial state.
TrackingLoopFilters.SecondOrderBoxcarLF — Type
struct SecondOrderBoxcarLF{T} <: TrackingLoopFilters.AbstractSecondOrderLFSecond order boxcar loop filter.
Uses boxcar (rectangular) integration for simpler implementation. The natural frequency scaling factor is 1.89.
x::Any: Frequency state estimate
Example
lf = SecondOrderBoxcarLF()
output, next_lf = filter_loop(lf, δθ, Δt, bandwidth)TrackingLoopFilters.SecondOrderBoxcarLF — Method
SecondOrderBoxcarLF()Construct a second order boxcar loop filter with zero initial state.
TrackingLoopFilters.ThirdOrderAssistedBilinearLF — Type
struct ThirdOrderAssistedBilinearLF{T1, T2} <: TrackingLoopFilters.AbstractThirdOrderAssistedLFThird order bilinear loop filter with second order assistance.
Combines a third order bilinear loop with a second order assisted loop for improved tracking performance. Accepts a two-element discriminator input vector [δθ_high, δθ_low].
x1::Any: Frequency state estimatex2::Any: Frequency rate state estimate
Example
lf = ThirdOrderAssistedBilinearLF()
output, next_lf = filter_loop(lf, [δθ_high, δθ_low], Δt, bandwidth)TrackingLoopFilters.ThirdOrderAssistedBilinearLF — Method
ThirdOrderAssistedBilinearLF()Construct a third order assisted bilinear loop filter with zero initial state.
TrackingLoopFilters.ThirdOrderBilinearLF — Type
struct ThirdOrderBilinearLF{T1, T2} <: TrackingLoopFilters.AbstractThirdOrderLFThird order bilinear loop filter.
Uses bilinear transformation for improved frequency response. The natural frequency scaling factor is 1.2.
x1::Any: Frequency state estimatex2::Any: Frequency rate state estimate
Example
lf = ThirdOrderBilinearLF()
output, next_lf = filter_loop(lf, δθ, Δt, bandwidth)TrackingLoopFilters.ThirdOrderBilinearLF — Method
ThirdOrderBilinearLF()Construct a third order bilinear loop filter with zero initial state.
TrackingLoopFilters.ThirdOrderBoxcarLF — Type
struct ThirdOrderBoxcarLF{T1, T2} <: TrackingLoopFilters.AbstractThirdOrderLFThird order boxcar loop filter.
Uses boxcar (rectangular) integration for simpler implementation. The natural frequency scaling factor is 1.2.
x1::Any: Frequency state estimatex2::Any: Frequency rate state estimate
Example
lf = ThirdOrderBoxcarLF()
output, next_lf = filter_loop(lf, δθ, Δt, bandwidth)TrackingLoopFilters.ThirdOrderBoxcarLF — Method
ThirdOrderBoxcarLF()Construct a third order boxcar loop filter with zero initial state.
TrackingLoopFilters.filter_loop — Method
filter_loop(state, δθ, Δt, bandwidth)
Propagate the loop filter state and return both the filtered output and next state.
This is a convenience function that combines propagate and get_filtered_output into a single call.
Arguments
state: Current loop filter stateδθ: Phase discriminator output (dimensionless for standard filters, vector for assisted)Δt: Integration timebandwidth: Loop bandwidth
Returns
output: Filtered frequency estimatenext_state: Propagated loop filter state
TrackingLoopFilters.get_filtered_output — Method
get_filtered_output(state, δθ, Δt, bandwidth)
Calculate the filtered output for the first order loop filter.
Computes ω₀ * δθ where ω₀ = bandwidth * 4.0.
Arguments
state: Current loop filter stateδθ: Phase discriminator outputΔt: Integration timebandwidth: Loop bandwidth
Returns
Filtered frequency estimate.
TrackingLoopFilters.get_filtered_output — Method
get_filtered_output(state, δθ, Δt, bandwidth)
Calculate the filtered output for the second order bilinear loop filter.
Computes x + (√2 * ω₀ + ω₀² * Δt / 2) * δθ.
Arguments
state: Current loop filter stateδθ: Phase discriminator outputΔt: Integration timebandwidth: Loop bandwidth
Returns
Filtered frequency estimate.
TrackingLoopFilters.get_filtered_output — Method
get_filtered_output(state, δθ, Δt, bandwidth)
Calculate the filtered output for the second order boxcar loop filter.
Computes x + √2 * ω₀ * δθ.
Arguments
state: Current loop filter stateδθ: Phase discriminator outputΔt: Integration timebandwidth: Loop bandwidth
Returns
Filtered frequency estimate.
TrackingLoopFilters.get_filtered_output — Method
get_filtered_output(state, δθ, Δt, bandwidth)
Calculate the filtered output for the assisted third order bilinear loop filter.
Combines outputs from the third order loop and second order assisted loop.
Arguments
state: Current loop filter stateδθ: Two-element vector[δθ_high, δθ_low]with high and low order discriminator outputsΔt: Integration timebandwidth: Loop bandwidth
Returns
Filtered frequency estimate.
TrackingLoopFilters.get_filtered_output — Method
get_filtered_output(state, δθ, Δt, bandwidth)
Calculate the filtered output for the third order bilinear loop filter.
Arguments
state: Current loop filter stateδθ: Phase discriminator outputΔt: Integration timebandwidth: Loop bandwidth
Returns
Filtered frequency estimate.
TrackingLoopFilters.get_filtered_output — Method
get_filtered_output(state, δθ, Δt, bandwidth)
Calculate the filtered output for the third order boxcar loop filter.
Arguments
state: Current loop filter stateδθ: Phase discriminator outputΔt: Integration timebandwidth: Loop bandwidth
Returns
Filtered frequency estimate.
TrackingLoopFilters.propagate — Method
propagate(state, δθ, Δt, bandwidth)
Propagate the first order loop filter state.
Since the first order filter is stateless, this returns the input state unchanged.
Arguments
state: Current loop filter stateδθ: Phase discriminator outputΔt: Integration timebandwidth: Loop bandwidth
Returns
The unchanged loop filter state.
TrackingLoopFilters.propagate — Method
propagate(state, δθ, Δt, bandwidth)
Propagate the second order loop filter state.
Updates the frequency state estimate using x_next = x + Δt * ω₀² * δθ.
Arguments
state: Current loop filter stateδθ: Phase discriminator outputΔt: Integration timebandwidth: Loop bandwidth
Returns
New loop filter state with updated frequency estimate.
TrackingLoopFilters.propagate — Method
propagate(state, δθ, Δt, bandwidth)
Propagate the assisted third order loop filter state.
Updates both frequency and frequency rate state estimates using dual discriminator inputs.
Arguments
state: Current loop filter stateδθ: Two-element vector[δθ_high, δθ_low]with high and low order discriminator outputsΔt: Integration timebandwidth: Loop bandwidth
Returns
New loop filter state with updated estimates.
TrackingLoopFilters.propagate — Method
propagate(state, δθ, Δt, bandwidth)
Propagate the third order loop filter state.
Updates both frequency and frequency rate state estimates.
Arguments
state: Current loop filter stateδθ: Phase discriminator outputΔt: Integration timebandwidth: Loop bandwidth
Returns
New loop filter state with updated estimates.