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
+21
View File
@@ -79,6 +79,27 @@ class PpsModelTests(unittest.TestCase):
1000.0 * np.median(np.abs(timing_error)),
)
def test_fractional_code_phase_is_applied_to_capture_counter(self):
_, _, epochs = make_simulation(70.0)
mature = [epoch for epoch in epochs if epoch.transmit_true_s >= 50.0]
applied_s = np.asarray(
[
(
epoch.reference_tracking_tick_raw
- epoch.reference_tracking_tick
)
/ TRACKING_HZ
for epoch in mature
]
)
self.assertGreater(np.max(applied_s), 40.0e-9)
self.assertTrue(np.all(applied_s >= 0.0))
self.assertTrue(np.all(applied_s <= 64.0e-9))
# The integer mailbox can represent the correction only on the 8 ns
# PPS grid; the model must use the same nearest-tick quantization.
applied_ticks = applied_s * TRACKING_HZ
self.assertLess(np.max(np.abs(applied_ticks - np.rint(applied_ticks))), 1.0e-9)
def test_timestamped_pi_rejects_apb_latency_as_phase(self):
_, tracking, epochs = make_simulation(70.0)
config = PIConfig(natural_frequency_hz=0.035, damping=0.9, max_slew_ppm=20.0)