Implements the Apollo composite PRN ranging code (5,456,682 chips) from five component sequences (CL, X, A, B, C) combined via majority-vote logic, matching Ken Shirriff's Teensy rangeGenerator.ino bit-for-bit. LFSR taps corrected to produce maximal-length sequences: A: 5-bit, taps [2,0] (x^5+x^2+1, period 31) B: 6-bit, taps [1,0] (x^6+x+1, period 63) C: 7-bit, taps [1,0] (x^7+x+1, period 127) New files: src/apollo/ranging.py -- pure-Python code generator and correlator src/apollo/ranging_source.py -- GR sync_block streaming PRN chips src/apollo/ranging_mod.py -- GR hier_block2 NRZ chip modulator src/apollo/ranging_demod.py -- GR basic_block FFT-based range correlator grc/apollo_ranging_*.block.yml -- GRC block definitions (3 files) examples/ranging_demo.py -- standalone demo with delay simulation
65 lines
1.6 KiB
YAML
65 lines
1.6 KiB
YAML
id: apollo_ranging_demod
|
|
label: Apollo Ranging Demodulator
|
|
category: '[Apollo USB]'
|
|
flags: [python]
|
|
|
|
parameters:
|
|
- id: chip_rate
|
|
label: Chip Rate (Hz)
|
|
dtype: int
|
|
default: '993963'
|
|
- id: sample_rate
|
|
label: Sample Rate (Hz)
|
|
dtype: real
|
|
default: '5120000'
|
|
- id: correlation_length
|
|
label: Correlation Length (samples)
|
|
dtype: int
|
|
default: '100000'
|
|
- id: two_way
|
|
label: Two-Way Ranging
|
|
dtype: bool
|
|
default: 'True'
|
|
options: ['True', 'False']
|
|
option_labels: ['Two-way (ground-SC-ground)', 'One-way']
|
|
|
|
inputs:
|
|
- label: in
|
|
domain: stream
|
|
dtype: float
|
|
|
|
outputs:
|
|
- label: range
|
|
domain: message
|
|
|
|
templates:
|
|
imports: from apollo.ranging_demod import ranging_demod
|
|
make: >-
|
|
apollo.ranging_demod.ranging_demod(
|
|
chip_rate=${chip_rate},
|
|
sample_rate=${sample_rate},
|
|
correlation_length=${correlation_length},
|
|
two_way=${two_way})
|
|
|
|
documentation: |-
|
|
Apollo Ranging Demodulator
|
|
|
|
Correlates received signal against known PRN ranging code to measure
|
|
spacecraft range. Accumulates samples in batches, performs FFT-based
|
|
cross-correlation, and emits range measurement PDUs.
|
|
|
|
Message output (range):
|
|
delay_chips: Measured delay in chip periods
|
|
range_m: Computed range in meters
|
|
correlation_peak: Peak correlation value
|
|
peak_to_avg_ratio: Peak-to-average ratio (signal quality)
|
|
timestamp: Measurement timestamp
|
|
|
|
Parameters:
|
|
chip_rate: Expected PRN chip rate (default 993,963 Hz)
|
|
sample_rate: Input sample rate (default 5.12 MHz)
|
|
correlation_length: Samples per correlation batch (default 100,000)
|
|
two_way: If True, divide range by 2 for round-trip measurement
|
|
|
|
file_format: 1
|