SatCat5
satcat5::ptp::TrackingController Class Reference

Detailed Description

Clock controller handling coarse and fine discipline.

High-level control for initial acquisition and tracking, applying a chain of ptp::Filter objects to derive the final control signal from a raw series of measurements. See also: "ptp_filters.h". The output is passed to a TrackingClock object.

See also
ptp_tracking.h

Definition at line 89 of file ptp_tracking.h.

#include <ptp_tracking.h>

Inheritance diagram for satcat5::ptp::TrackingController:
[legend]
Collaboration diagram for satcat5::ptp::TrackingController:
[legend]

Public Member Functions

 TrackingController (satcat5::ptp::TrackingClock *clk, satcat5::ptp::Source *source=0)
 Constructor links to a specific TrackingClock target. More...
 
void ptp_ready (const satcat5::ptp::Measurement &data) override
 Event handler for ptp::Callback. More...
 
void add_clock (satcat5::ptp::TrackingClock *clock)
 Add to the list of attached clocks. More...
 
void remove_clock (satcat5::ptp::TrackingClock *clock)
 Remove an item from the list of attached clocks.
 
void add_filter (satcat5::ptp::Filter *filter)
 Add to the chain of processing filters. More...
 
void remove_filter (satcat5::ptp::Filter *filter)
 Remove a filter from the chain, leaving others as-is. More...
 
void reset (bool linear=false)
 Reset tracking filter(s) and begin free-wheeling. More...
 
void reacquire ()
 Indicate to the controller than an external event has happened that should trigger a re-acquisition without fully resetting the system, such as a short disruption of an external reference.
 
void update (const satcat5::ptp::Time &delta)
 Update filter state with a new measurement from the PTP client. More...
 
bool is_locked () const
 Check if the controller is currently locked. More...
 

Protected Types

enum class  LockState { RESET , ACQUIRE , TRACK , LINEAR }
 

Protected Member Functions

s64 coarse (const satcat5::ptp::Time &delta)
 
void filter (u32 elapsed_usec, s64 delta_subns)
 
satcat5::ptp::Time clock_adjust (const satcat5::ptp::Time &amount)
 
void clock_rate (s64 offset)
 
void pps_event (satcat5::ptp::Time &ts, satcat5::ptp::Time &delta) override
 

Protected Attributes

satcat5::util::List< satcat5::ptp::TrackingClockm_clocks
 
satcat5::util::List< satcat5::ptp::Filterm_filters
 
satcat5::util::TimeVal m_tref
 
s64 m_freq_accum
 
u32 m_lock_alarm
 
u32 m_lock_usec
 
satcat5::ptp::TrackingController::LockState m_lock_state
 
satcat5::ptp::Source *const m_source
 

Private Attributes

satcat5::ptp::Callbackm_next
 

Constructor & Destructor Documentation

◆ TrackingController()

TrackingController::TrackingController ( satcat5::ptp::TrackingClock clk,
satcat5::ptp::Source source = 0 
)

Constructor links to a specific TrackingClock target.

Note: It is safe to provide a null TrackingClock pointer.

Definition at line 36 of file ptp_tracking.cc.

Member Function Documentation

◆ add_clock()

void satcat5::ptp::TrackingController::add_clock ( satcat5::ptp::TrackingClock clock)
inline

Add to the list of attached clocks.

All will receive the same frequency adjustments and will be frequency-locked, but only the primary clock (constructor or first add_clock) will be phase-locked.

Definition at line 107 of file ptp_tracking.h.

◆ add_filter()

void satcat5::ptp::TrackingController::add_filter ( satcat5::ptp::Filter filter)
inline

Add to the chain of processing filters.

See also
ptp_filters.h A chain of filters condition raw measurements at the input, deriving the final control signal for the TrackingClock. Filters are added and applied in the same sequence, with each new filter added to the end of the pre-existing chain.

Definition at line 118 of file ptp_tracking.h.

◆ is_locked()

bool satcat5::ptp::TrackingController::is_locked ( ) const
inline

Check if the controller is currently locked.

Note that in linear mode, no lock detection exists and this always returns true.

Definition at line 146 of file ptp_tracking.h.

◆ ptp_ready()

void TrackingController::ptp_ready ( const satcat5::ptp::Measurement data)
overridevirtual

Event handler for ptp::Callback.

This calculates offsetFromMaster and calls "update".

Implements satcat5::ptp::Callback.

Definition at line 48 of file ptp_tracking.cc.

◆ remove_filter()

void satcat5::ptp::TrackingController::remove_filter ( satcat5::ptp::Filter filter)
inline

Remove a filter from the chain, leaving others as-is.

e.g., Starting from A->B->C, removing B results in A->C.

Definition at line 123 of file ptp_tracking.h.

◆ reset()

void TrackingController::reset ( bool  linear = false)

Reset tracking filter(s) and begin free-wheeling.

Parameters
linearDisables nonlinear coarse acquisition.

Definition at line 53 of file ptp_tracking.cc.

◆ update()

void TrackingController::update ( const satcat5::ptp::Time delta)

Update filter state with a new measurement from the PTP client.

Specify the measured clock offset (delta = remote - local). (Call this directly or use the ptp::Callback event handler.)

Definition at line 73 of file ptp_tracking.cc.


The documentation for this class was generated from the following files: