feat(pps): add adaptive disciplined timing loop

This commit is contained in:
2026-07-25 17:56:41 +03:00
parent 0f6b3482c5
commit ecbb8d0b68
39 changed files with 4505 additions and 96 deletions
+10 -6
View File
@@ -23,9 +23,9 @@ import numpy as np
C = 299_792_458.0
RF_HZ = 16_368_000.0
RF_HZ = 16_367_981.0
TRACKING_HZ = 125_000_000.0
SAMPLES_PER_CODE = 16_368.0 # samples per millisecond in the C code
SAMPLES_PER_CODE = 16_367.981 # physical RF samples/ms used by the C code
CODE_FREQ_BASIS = 1.023e6
START_OFFSET_MS = 68.802
START_OFFSET_S = START_OFFSET_MS / 1000.0
@@ -139,6 +139,7 @@ class EpochResult:
transmit_true_s: float
reference_arrival_true_s: float
snapshot_ready_true_s: float
reference_tracking_tick_raw: int
reference_tracking_tick: float
reference_abs_sample: float
reference_svid: int
@@ -642,10 +643,12 @@ class ReceiverEpochSimulator:
tracking_tick_continuous = float(self.tracking_clock.ticks_at(raw_event_true_s))
tracking_tick_raw = int(np.floor(tracking_tick_continuous))
# The software correction refers to the code boundary before the raw
# RF edge. Apply the same time displacement to the tracking timestamp.
tracking_tick_corrected = tracking_tick_raw - (
rem / CODE_FREQ_BASIS
) * (TRACKING_HZ / RF_HZ)
# RF edge. The mailbox accepts an integer 125 MHz epoch counter, so
# mirror the C implementation's nearest-tick rounding.
capture_correction_ticks = round(
(rem / CODE_FREQ_BASIS) * (TRACKING_HZ / RF_HZ)
)
tracking_tick_corrected = tracking_tick_raw - capture_correction_ticks
return ChannelMeasurement(
satellite=satellite,
satellite_position_m=satellite.ecef_m.copy(),
@@ -725,6 +728,7 @@ class ReceiverEpochSimulator:
transmit_true_s=transmit_true_s,
reference_arrival_true_s=reference.arrival_true_s,
snapshot_ready_true_s=snapshot_ready,
reference_tracking_tick_raw=reference.tracking_tick_raw,
reference_tracking_tick=reference.tracking_tick_corrected,
reference_abs_sample=reference.corrected_abs_unwrapped,
reference_svid=reference.satellite.svid,