Class Clock¶
Defined in File clock.h
Inheritance Relationships¶
Base Type¶
public lupnt::Device(Class Device)
Class Documentation¶
-
class Clock : public lupnt::Device¶
Onboard clock device: tracks a clock-bias state (bias, drift, drift-rate) using a
ClockDynamicsmodel and exposes the agent’s current “true” time viaRead.Attached to a satellite/rover/ground-station
Agent(e.g. as the"clock"device) and used byClockDynamics/JointOrbitClockDynamicsto propagate clock error states for measurement simulation (pseudorange/ carrier-phase clock-bias terms inmeasurements/) and by navigation filters as the truth/reference against which receiver clock states are estimated.Public Functions
-
Clock()¶
-
Real Read(Real t)¶
Propagate the clock state from its last-read time to
tand return the resulting clock time (true timetplus the current clock bias, converted frombias_unit_to seconds) [s].Called whenever a device/measurement model needs the agent’s clock reading instead of true simulation time (e.g. when generating timestamped GNSS measurements). Internally advances
state_viaClockDynamics::Propagate(orPropagateWithRelativityifuse_relativity_is enabled, usingBuildRelativityContext) from the previously storedtime_tot, updatestime_ = t, and adds the propagated bias (converted to seconds viaClockDynamics::BiasUnitsToSeconds) tot.- Parameters:
t – Simulation (true) time to read the clock at [s]; must be
>=the time of the previousRead/currenttime_- Returns:
Clock-reading time =
t + bias[s]
-
virtual void Step(Real t) override¶
Clock device step; currently a no-op (clock propagation happens lazily in
Read).
-
void SetModel(ClockModel model)¶
Set the clock noise/drift model (e.g.
USO,CSAC,RAFS) and propagate it to the underlyingClockDynamics.
-
inline ClockModel GetModel() const¶
Get the configured clock noise/drift model.
-
inline void SetState(const ClockState3 &state)¶
Set the clock-bias state (bias, drift, drift-rate) and refresh its unit labels via
ApplyClockStateUnits.
-
inline ClockState3 GetState() const¶
Get the current clock-bias state (bias, drift, drift-rate), in units given by
GetClockBiasUnit.
-
inline void SetTime(Real time)¶
Set the clock’s internal last-propagated time [s] (does not propagate the state).
-
inline Real GetTime() const¶
Get the clock’s internal last-propagated time [s] (the time argument of the most recent
Readcall).
-
void SetClockBiasUnit(ClockBiasUnit unit)¶
Set the unit (seconds, range-equivalent meters, or kilometers) in which the clock-bias state is represented, and propagate it to the underlying
ClockDynamics.
-
inline ClockBiasUnit GetClockBiasUnit() const¶
Get the unit in which the clock-bias state is represented.
-
inline void SetUseRelativity(bool use_relativity)¶
Enable/disable general-relativistic clock-rate corrections (gravitational frequency shift + special-relativistic time dilation) in
Read, viaClockDynamics::PropagateWithRelativity.
-
inline bool GetUseRelativity() const¶
Whether relativistic clock-rate corrections are applied in
Read.
-
inline void SetRelativityCenterBody(BodyId center_body)¶
Set the central body (e.g.
BodyId::EARTH) whose gravitational potential and inertial frame define the relativistic clock-rate correction computed inBuildRelativityContext.
-
inline BodyId GetRelativityCenterBody() const¶
Get the relativity center body (see
SetRelativityCenterBody).
-
inline bool HasRelativityCenterBody() const¶
Whether a relativity center body has been explicitly set; if false,
BuildRelativityContextfalls back to the frame center of the agent’s state at the propagation end time.
-
inline void ClearRelativityCenterBody()¶
Clear a previously-set relativity center body (see
HasRelativityCenterBody).
-
inline void SetRelativityUnits(const UnitSystem &units)¶
Set the unit system (e.g. SI) used to look up the relativity center body’s physical constants (GM, speed of light) in
BuildRelativityContext.
-
inline UnitSystem GetRelativityUnits() const¶
Get the unit system used for relativity-related physical constants.
-
void SetDynamics(Ptr<ClockDynamics> dynamics)¶
Replace the underlying
ClockDynamicsmodel, propagating the current clock model and bias unit to it.
-
inline ClockDynamics *GetDynamics() const¶
Get a raw (non-owning) pointer to the underlying
ClockDynamics.
Get a shared pointer to the underlying
ClockDynamics.
-
virtual void Log(Real time) override¶
Log the clock’s current time and bias-state components (with unit-aware names, e.g.
"<name>/state/b_s") to the simulation’sDataLoggeroutput. OverridesDevice::Log.
-
Clock()¶