File async_dsss_receiver_core.h¶
FileList > async_dsss_receiver > async_dsss_receiver_core.h
Go to the source code of this file
Composed continuous DSSS receiver: Acquisition -> hand-off -> CarrierAcquisition refine -> carrier_nda/Dll/RateConverter/ MpskReceiver track, one object. More...
#include "doppler/RateConverter/RateConverter_core.h"#include "doppler/correlator/correlator_core.h"#include "doppler/carrier_acq/carrier_acq_core.h"#include "doppler/cic/cic_core.h"#include "doppler/carrier_nda/carrier_nda_core.h"#include "doppler/ppe/ppe_core.h"#include "doppler/costas/costas_core.h"#include "doppler/dll/dll_core.h"#include "doppler/dp_state.h"#include "doppler/hbdecim/hbdecim_core.h"#include "doppler/lockdet/lockdet_core.h"#include "doppler/mpsk_receiver/mpsk_receiver_core.h"#include "doppler/resamp/resamp_core.h"#include "doppler/resample/resample_core.h"#include "doppler/dp_complex.h"#include <stdbool.h>#include <stddef.h>#include "doppler/psd/psd_core.h"#include "doppler/detection/detection_core.h"#include "doppler/spectral/spectral_core.h"#include "doppler/fft/fft_core.h"#include "doppler/acc_trace/acc_trace_core.h"#include "doppler/doppler_channel/doppler_channel_core.h"#include "doppler/dp_tlm/dp_tlm_core.h"#include "doppler/loop_filter/loop_filter_core.h"#include "doppler/state_filter/state_filter_core.h"#include "doppler/ccsds/ccsds_415.h"#include "doppler/correlation/correlation_core.h"
Classes¶
| Type | Name |
|---|---|
| struct | async_dsss_receiver_extra_t The receiver's own fields in its state blob, after the envelope and before the children. |
| struct | async_dsss_receiver_fine_t |
| struct | async_dsss_receiver_status_t One consistent picture of what the receiver is doing, by value. |
| struct | dp_async_dsss_receiver_state_t Composed receiver state. |
Public Types¶
| Type | Name |
|---|---|
| enum | async_dsss_rx_state_t |
Public Functions¶
| Type | Name |
|---|---|
| double | dp_async_dsss_receiver_carrier_bn (double cn0_dbhz, double chip_rate, size_t code_len) The pre-despread carrier loop's bandwidth at a design C/N0: the loop-SNR rule (async-dsss-receiver.md §1.3), no wider than ASYNC_DSSS_RX_BN_CARRIER. |
| uint32_t | dp_async_dsss_receiver_carrier_lock_n_noncoh (double cn0_dbhz, double chip_rate, size_t code_len, size_t segments) The pre-despread carrier lock's non-coherent count at a design C/N0: the updates one lock decision sums. |
| double | dp_async_dsss_receiver_carrier_phase_var (double cn0_dbhz, double chip_rate, size_t code_len, size_t segments) The pre-despread carrier loop's phase variance at a design C/N0, the one the carrier lock is sized at. |
| int | dp_async_dsss_receiver_configure_chain_raw (dp_async_dsss_receiver_state_t * state, size_t segments, size_t sps, int n) Pin the live-tracking despread/resample/demod grid directly. The escape hatch for the composition-specific knob: segments (the live Dll's tracking parameter) andsps /n (MpskReceiver's samples and terminal outputs per symbol) are independently overridable, still bridged by a freshly-sizedRateConverter and never coupled to each other. While searching/refining it re-pins the grid used to build the next tracking chain; once tracking it rebuildsdll /rc /rx in place, allocating every replacement before adopting it, and re-seeds the rebuilt chain from the whole carrier loop 1 plus loop 2's integrator, the sum status() reports so a retune keeps the signal it was tracking. |
| void | dp_async_dsss_receiver_configure_lock_raw (dp_async_dsss_receiver_state_t * state, double up_thresh, double down_thresh, size_t n_looks, double alpha, uint32_t n_up, uint32_t n_down) Re-tune the live-tracking Dll's code-lock detector directly. Forwards to dp_dll_configure_lock_raw() on the live tracking Dll (the one behindget_code_locked() ), NOT the refine-stage collection Dll. It retunes the Dll the receiver holds now; every chain build (a seed, the hand-over, reset() or configure_chain_raw()) replaces that Dll with a freshly sized one, so call it once tracking. The detector is the hysteretic lockdet over the DLL's per-N-look CFAR statistic — the levels and verify counts trade declare latency against false-alarm rate. |
| int | dp_async_dsss_receiver_configure_search_raw (dp_async_dsss_receiver_state_t * state, size_t doppler_bins, size_t n_noncoh) Pin the embedded search's grid directly. Forwards to dp_correlator_configure_search_raw() __ the escape hatch under this object'ssymbol_rate -driven auto-sizing, for a power user who wants a specific(doppler_bins, n_noncoh) . The pin replaces the whole auto-sized grid, the window-tiled search included. Only meaningful while searching; the search does not run again until the nextreset() . |
| dp_async_dsss_receiver_state_t * | dp_async_dsss_receiver_create (const uint8_t * code, size_t code_len, double chip_rate, double symbol_rate, double sample_rate, int m, double cn0_dbhz, double pfa, double pd, double doppler_uncertainty, size_t segments, size_t sps, int differential, double refine_max_error_db, size_t refine_samples_per_symbol, double refine_design_margin_db, size_t refine_n_fft, size_t refine_zero_pad, bool refine_sequential, size_t refine_max_n_blocks, double carrier_freq_hz, double lost_confirm_s, bool reacquire, double code_only_s, double doppler_rate, bool refine) Create an AsyncDsssReceiver in the searching state. |
| dp_async_dsss_receiver_state_t * | dp_async_dsss_receiver_create_ccsds415 (const uint8_t * code, size_t code_len, double carrier_freq_hz, double lost_confirm_s, bool refine, const char ** why) The receiver at the CCSDS 415.1-B-1 specification point ( doppler/ccsds/ccsds_415.h ): the Ccsds415Receiver view. |
| void | dp_async_dsss_receiver_destroy (dp_async_dsss_receiver_state_t * state) Destroy a receiver and release every child. |
| int | dp_async_dsss_receiver_fine_design (double cn0_dbhz, double chip_rate, size_t code_len, double p_flip, double symbol_rate, int m, size_t refine_segments, double e_hz, double rate_hz_s, double eps_chip, double block_s, double pfa, double p_ho, size_t max_blocks, async_dsss_receiver_fine_t * out) Design the fine hand-over at a design point: K, the dwell and its rates. |
| double | dp_async_dsss_receiver_get_car_last_error (const dp_async_dsss_receiver_state_t * state) The pre-despread carrier loop's last phase error (rad): the residual carrier phase LOOP 1 (which de-rotates before the Dll) is not nulling, as its loop filter takes it carrier_nda's discriminator divided by its slope (carrier_nda_loop_error() ), so radians near lock. The ".car.e" probe is the raw discriminator, twice this. |
| dp_lockdet_rule_t | dp_async_dsss_receiver_get_car_lock_rule (const dp_async_dsss_receiver_state_t * state) The carrier loop's lock rule; see dp_async_dsss_receiver_get_sym_lock_rule() . |
| double | dp_async_dsss_receiver_get_car_nco_freq (const dp_async_dsss_receiver_state_t * state) LOOP 1 (the pre-despread carrier loop) output = NCO frequency command, cycles/sample of the front-end (chip_rate*spc) rate. |
| size_t | dp_async_dsss_receiver_get_carrier_lock_n_noncoh (const dp_async_dsss_receiver_state_t * state) The carrier lock's non-coherent count this receiver was built with, dp_async_dsss_receiver_carrier_lock_n_noncoh() at its cn0_dbhz . |
| double | dp_async_dsss_receiver_get_chip_phase (const dp_async_dsss_receiver_state_t * state) The code phase, chips, at the sample after the last one fed, in the Dll's instantaneous convention the mirror of dp_correlator_hit_t::code_phase's correlation-lag convention (dp_correlator_build_handoff() ). Tracking, it is the live Dll's phase carried over the partial period the chain holds (it runs whole periods), so it names the same sample a search's picks are carried to at any sample rate (#3063). While refining there is no live Dll: it is the seed's phase advanced by the clock dilation since, the phase the hand-over starts the live chain from. |
| double | dp_async_dsss_receiver_get_cn0_dbhz_est (const dp_async_dsss_receiver_state_t * state) The seed's C/N0 estimate, dB-Hz, unchanged until reset(). |
| dp_lockdet_rule_t | dp_async_dsss_receiver_get_code_lock_rule (const dp_async_dsss_receiver_state_t * state) The code loop's lock rule; see dp_async_dsss_receiver_get_sym_lock_rule() . |
| int | dp_async_dsss_receiver_get_code_locked (const dp_async_dsss_receiver_state_t * state) _Binary code-lock flag from the live tracking Dll's own verify-counted (pfa-tuned) lock detector — the fundamental DSSS "am I |
| despreading" lock, de-chattered by up/down hysteresis._ | |
| double | dp_async_dsss_receiver_get_code_rate (const dp_async_dsss_receiver_state_t * state) The Dll's code rate, chips per nominal chip (~1.0 at lock), without the carrier aid; a coasting Dll reports its held rate. |
| size_t | dp_async_dsss_receiver_get_coherent_bins (const dp_async_dsss_receiver_state_t * state) The searcher's slow-time depth D: epochs per coherent dwell. |
| size_t | dp_async_dsss_receiver_get_consumed (const dp_async_dsss_receiver_state_t * state) Inputs the last dp_async_dsss_receiver_steps() call took: its x_len , or 0 when it held its input back. |
| dp_lockdet_rule_t | dp_async_dsss_receiver_get_demod_lock_rule (const dp_async_dsss_receiver_state_t * state) The demodulator's carrier lock rule; see dp_async_dsss_receiver_get_sym_lock_rule() . |
| dp_lockdet_rule_t | dp_async_dsss_receiver_get_demod_sync_lock_rule (const dp_async_dsss_receiver_state_t * state) The demodulator's timing lock rule; see dp_async_dsss_receiver_get_sym_lock_rule() . |
| double | dp_async_dsss_receiver_get_doppler_hz (const dp_async_dsss_receiver_state_t * state) The HAND-OVER's Doppler, Hz: what the live chain was built from, frozen for the track's whole tenure the seed's while refining, the refine's estimate from the hand-over on. It does not follow the carrier: under a 400 Hz/s ramp it is 400 Hz stale a second later. Where the emitter is now is status().doppler_hz, a field of the same name with the other meaning. |
| int | dp_async_dsss_receiver_get_handover_source (const dp_async_dsss_receiver_state_t * state) Which estimate the live chain's Doppler came from: ASYNC_DSSS_RX_HO_NONE until a hand-over, then _SEED, _DATA or _FINE (the refine's choice), or _SEED at the seed itself with refine false; NONE again at the next seed that refines. |
| double | dp_async_dsss_receiver_get_lock (const dp_async_dsss_receiver_state_t * state) The carrier lock statistic of the MpskReceiver this receiver tracks with: the EMA of its M-th-power lock signal, near 1 when locked and near 0 on noise. |
| double | dp_async_dsss_receiver_get_lock_metric (const dp_async_dsss_receiver_state_t * state) Symbol-lock metric = SNR-weighted EMA of (I^2-Q^2)/(I^2+Q^2) = cos(2*phi) over the emitted symbols (locked -> ~+1). Drives locked . |
| double | dp_async_dsss_receiver_get_lock_threshold (const dp_async_dsss_receiver_state_t * state) The lock-metric threshold locked is declared strictly above (0.5, ASYNC_DSSS_RX_LOCK_UP); exposed alongside lock_metric for engineering debug. |
| int | dp_async_dsss_receiver_get_locked (const dp_async_dsss_receiver_state_t * state) The receiver's symbol-lock flag: a hysteretic detector over get_lock_metric(), declared after 30 consecutive symbols strictly above get_lock_threshold() (0.5) and dropped after 15 consecutive symbols strictly below 0.3 (ASYNC_DSSS_RX_LOCK_N_UP, _UP, _N_DOWN and _DOWN, fixed at create). The flag the release rule and a pool's holder act on. |
| int | dp_async_dsss_receiver_get_lost (const dp_async_dsss_receiver_state_t * state) 1 once the release rule has fired: both lock flags were down, continuously, for longer than lost_confirm_s while tracking an emitter that left, or a seed that never locked. The loops have stopped and samples are consumed and discarded; the holder releases the assignment and calls reset(). 0 in every other state, and always 0 withlost_confirm_s = 0 . |
| double | dp_async_dsss_receiver_get_mpsk_last_error (const dp_async_dsss_receiver_state_t * state) MpskReceiver carrier phase discriminator (rad): the residual carrier phase LOOP 2 (post-despread) is not nulling. |
| int | dp_async_dsss_receiver_get_n (const dp_async_dsss_receiver_state_t * state) MpskReceiver's terminal outputs per symbol (even, 2..8). |
| size_t | dp_async_dsss_receiver_get_n_exclusions (const dp_async_dsss_receiver_state_t * state) Code phases set_exclusions() holds. |
| double | dp_async_dsss_receiver_get_nco_freq (const dp_async_dsss_receiver_state_t * state) The MpskReceiver's carrier NCO command, its loop filter's whole output, cycles/sample at its input rate ( sps * symbol_rate ). Its mean tracks a Doppler ramp with no lag (unlike get_norm_freq()); its variance is the carrier loop's stress. |
| double | dp_async_dsss_receiver_get_norm_freq (const dp_async_dsss_receiver_state_t * state) The post-despread carrier the MpskReceiver tracks: its centre plus its loop's integrator, cycles/sample at its input rate ( sps * symbol_rate ). Lags a Doppler ramp by the Type-II ramp error. |
| size_t | dp_async_dsss_receiver_get_rank (const dp_async_dsss_receiver_state_t * state) Which surviving peak of a dwell the search takes; 0 = the strongest. Set with dp_async_dsss_receiver_set_rank() . |
| int | dp_async_dsss_receiver_get_refining (const dp_async_dsss_receiver_state_t * state) 1 while refining: the CarrierAcquisition dwell; 0 in every other state. |
| size_t | dp_async_dsss_receiver_get_segments (const dp_async_dsss_receiver_state_t * state) The live-tracking Dll's partial correlations per code period. |
| double | dp_async_dsss_receiver_get_settle_time (const dp_async_dsss_receiver_state_t * state) Symbols a track emits before its demodulator has settled: where a steady-state measurement of a track's symbols may start. |
| size_t | dp_async_dsss_receiver_get_sps (const dp_async_dsss_receiver_state_t * state) MpskReceiver's samples per symbol. |
| void | dp_async_dsss_receiver_get_state (const dp_async_dsss_receiver_state_t * state, void * blob) Serialize the receiver: its own fields, then each child, then the carrier carry (live samples, zero-padded to tsamps). |
| dp_lockdet_rule_t | dp_async_dsss_receiver_get_sym_lock_rule (const dp_async_dsss_receiver_state_t * state) The rules behind the receiver's five lock decisions, each its levels and verify counts ( dp_lockdet_rule_t ), for a caller that draws a lock statistic beside the line it is decided against. |
| int | dp_async_dsss_receiver_get_threads (const dp_async_dsss_receiver_state_t * state) Workers the searcher runs, the calling thread included; 1 = serial. Set with dp_async_dsss_receiver_set_threads() . |
| int | dp_async_dsss_receiver_get_tracking (const dp_async_dsss_receiver_state_t * state) 1 once the live tracking chain is built and demodulating; 0 in every other state. |
| void | dp_async_dsss_receiver_reset (dp_async_dsss_receiver_state_t * state) Return to the searching state. Resets the embedded search and rebuilds the refine-stage chain and the live tracking chain back to their placeholder seed (phase 0, no Doppler). A receiver that has locked cannot be "reset back to tracking the same signal," only back to searching every object's reset() semantics in this codebase. |
| int | dp_async_dsss_receiver_seed (dp_async_dsss_receiver_state_t * state, double chip_phase, double doppler_hz_est, double cn0_dbhz_est) Take a detection from outside and start refining from it. |
| int | dp_async_dsss_receiver_seed_ok (const dp_async_dsss_receiver_state_t * state, double chip_phase, double doppler_hz_est) The seed domain: whether (chip_phase, doppler_hz_est) is onedp_async_dsss_receiver_seed() accepts, and one a live receiver can hold. |
| int | dp_async_dsss_receiver_set_exclusions (dp_async_dsss_receiver_state_t * state, const double * phases, size_t phases_len) Code phases the search must not take: signals another receiver already tracks. |
| int | dp_async_dsss_receiver_set_rank (dp_async_dsss_receiver_state_t * state, size_t rank) Take the rank-th surviving peak of a dwell, not the strongest. |
| int | dp_async_dsss_receiver_set_refine_min_blocks (dp_async_dsss_receiver_state_t * state, size_t n_blocks) Floor the refine's dwell at n_blocks , whatever the detection sizing asks (docs/design/async-dsss-receiver-measurements.md §12.16, #1265). |
| int | dp_async_dsss_receiver_set_state (dp_async_dsss_receiver_state_t * state, const void * blob) Restore a blob written by dp_async_dsss_receiver_get_state() . |
| int | dp_async_dsss_receiver_set_telemetry (dp_async_dsss_receiver_state_t * state, dp_tlm_t * tlm, const char * prefix, uint32_t decim) Attach (or detach) a telemetry context across the receiver's loops, and register the receiver's own lifecycle and symbol-lock decision. |
| int | dp_async_dsss_receiver_set_threads (dp_async_dsss_receiver_state_t * state, int n) Set the workers the searcher fans its Doppler tiles across. |
| size_t | dp_async_dsss_receiver_state_bytes (const dp_async_dsss_receiver_state_t * state) Size in bytes of the blob dp_async_dsss_receiver_get_state() writes. |
| async_dsss_receiver_status_t | dp_async_dsss_receiver_status (const dp_async_dsss_receiver_state_t * state) Read the status record, by value: the state; where the emitter is now (the live carrier), its chip phase, code rate and C/N0; the five lock flags with the symbol-lock metric and threshold; both carrier residuals; and the two clocks in input samples (since the state was entered; both flags down without a break). |
| size_t | dp_async_dsss_receiver_steps (dp_async_dsss_receiver_state_t * state, const float _Complex * x, size_t x_len, float _Complex * out, size_t max_out) Stream raw cf32 samples; emit demodulated symbols once tracking. |
| size_t | dp_async_dsss_receiver_steps_max_out (dp_async_dsss_receiver_state_t * state, size_t x_len) The capacity that lets the next steps() call on x_len samples deliver everything it can: the symbols held, plus the most the call can produce. |
Macros¶
| Type | Name |
|---|---|
| define | ASYNC_DSSS_RECEIVER_STATE_MAGIC [**DP\_FOURCC**](dp__state_8h.md#define-dp_fourcc) ('A', 'D', 'R', 'X')Envelope magic ("ADRX") identifying an AsyncDsssReceiver blob. |
| define | ASYNC_DSSS_RECEIVER_STATE_VERSION 24u /\* v24: the held symbols' store (#2469); v23: the fine hand-over's buffer and count (ho\_src 3); v22: the pre-despread carrier loop is carrier\_nda ('CNDA' children for car and car\_held); v21: the squared-stream refine estimator reverted, its fields gone (79fa50cfe); v20: no threads, the search's own blob carries set\_threads()'s request (#3055); v19: the squared-stream refine estimator (§4.7); v18: the exclusions' and picks' samples; v17: the refine hand-over's ring (#2974); v16: the search child is the correlator's search flavor ('CORL', #2752 3.4b); v15: pooled, search-only picks; v14: the search resampler and its origin; v13: rank, exclusions; v12: samples\_in, the dwell alignment, threads; v11: no cell mode; v10: the dll children grew (output level, #2495); v9: refine\_min\_blocks; v8: refused\_hits; v7: no hand-off flavor; v6: the cell pull-in \*/Layout version of the AsyncDsssReceiver blob (history below). |
| define | ASYNC_DSSS_RX_BN_CARRIER 0.04 |
| define | ASYNC_DSSS_RX_CARRIER_LOOP_SNR_DB 20.0 |
| define | ASYNC_DSSS_RX_CARRIER_PULLIN_HZ (bn, chip_rate, code_len) ((bn) \* (chip\_rate) / (2.0 \* (double)(code\_len))) |
| define | ASYNC_DSSS_RX_CAR_DEN_ALPHA (1.0 / 256.0) |
| define | ASYNC_DSSS_RX_CAR_LOCK_PD 0.99 |
| define | ASYNC_DSSS_RX_CAR_LOCK_PFA 1e-3 |
| define | ASYNC_DSSS_RX_CAR_LOOP_DELAY (segments) (2.0 - 1.0 / (double)(segments)) |
| define | ASYNC_DSSS_RX_DEMOD_BN_CARRIER 0.01 |
| define | ASYNC_DSSS_RX_DEMOD_BN_TIMING 0.005 |
| define | ASYNC_DSSS_RX_DEMOD_LOCK_THRESH 0.3 |
| define | ASYNC_DSSS_RX_DEMOD_RRC_BETA 0.35 |
| define | ASYNC_DSSS_RX_DEMOD_RRC_SPAN 8 |
| define | ASYNC_DSSS_RX_DEMOD_ZETA 0.707 |
| define | ASYNC_DSSS_RX_DLL_BN 0.002 |
| define | ASYNC_DSSS_RX_DLL_SPACING 0.5 |
| define | ASYNC_DSSS_RX_DLL_ZETA 0.707 |
| define | ASYNC_DSSS_RX_FINE_P_HO 0.99 |
| define | ASYNC_DSSS_RX_HO_DATA 2The hand-over took the data-template estimator's. |
| define | ASYNC_DSSS_RX_HO_FINE 3The hand-over took the fine estimate: the refine's squared pair sums located by PolynomialPhaseEstimator, divided by M. |
| define | ASYNC_DSSS_RX_HO_NONE 0Where the last hand-over's Doppler came from (".ho_src" and dp_async_dsss_receiver_get_handover_source() ): none since the last seed (searching or refining), the seed's own (with refine false, where the seed is the hand-over; or the refine gave up, or its estimates failed the hand-over's checks), CarrierAcquisition's (§4.7), or the fine estimate's. |
| define | ASYNC_DSSS_RX_HO_SEED 1The hand-over took the seed's own Doppler. |
| define | ASYNC_DSSS_RX_LOCK_DOWN 0.3 |
| define | ASYNC_DSSS_RX_LOCK_DWELL 30u |
| define | ASYNC_DSSS_RX_LOCK_N_DOWN 15u |
| define | ASYNC_DSSS_RX_LOCK_N_UP 30u |
| define | ASYNC_DSSS_RX_LOCK_UP 0.5 |
| define | ASYNC_DSSS_RX_MAX_EXCLUSIONS 64u |
| define | ASYNC_DSSS_RX_MAX_PEAKS 16u |
| define | ASYNC_DSSS_RX_NO_REFINE_MIN_BINS (bn) ((size\_t)ceil (1.0 / (bn) - 1e-9)) |
| define | ASYNC_DSSS_RX_REFINE_DLL_SPACING 0.5 |
| define | ASYNC_DSSS_RX_REFINE_MIN_BLOCKS 7u |
Detailed Description¶
Unlike DsssReceiver, which goes straight from an acquisition hit to tracking on the hit's coarse Doppler estimate, this object refines the estimate between the two, closing the low-Es/N0 pull-in gap a coarse-only estimate leaves at large static Doppler offsets. Its design of record is docs/design/async-dsss-receiver.md: the receiver (§1-§4) and its place in an AsyncDsssPool (§5-§9). The despreader, the states and the release under it are docs/design/async-dsss-receiver.md. Its states are the ASYNC_DSSS_RX_* values below, also status().state:
- searching (the start): samples feed the embedded continuous search (the
Correlatorflavor). A hit is made into a seed bydp_correlator_build_handoff()and taken throughdp_async_dsss_receiver_seed(), and the unconsumed tail of the same call goes straight on. The refine chain is a FROZEN carrier wipe (costas_wipeoff()at the coarse estimate,costas_update()never called) feeding a collectionDllwhosedp_dll_lookback_segments(refine_max_error_db)windows oversample each epoch the asynchronous data's residual carrier rides a ~symbol_rate-wide spectrum a single per-epoch dump would alias (seerefine_max_error_dbondp_async_dsss_receiver_create()) then aRateConvertertoCarrierAcquisition's rate, thenCarrierAcquisitionitself. - refining: samples feed the refine chain until
CarrierAcquisitionis ready or gives up; then the live tracking chain is built FRESH, from the hand-off's chip phase advanced by the clock dilation over the refine (not wherever the refine-stageDlldrifted) and the refined on a give-up, the seed's Doppler. It starts at the refine's estimate of where it stopped,ceil(k * period)samples from the hand-off (k whole code periods, the fraction carried in its phase), on the same input sample at any chunking (doppler#2974). The refine decides up to its chain's lag past that estimate, so the receiver keeps its last refine samples in a ring sized at create for that lag (refine_hist_cap, from dp_RateConverter_get_count_lag()), and the start is read from it when it is behind the call. A start the input has not reached yet is waited for, the receiver still refining. A start older than the ring holds starts the live chain at the first whole period the ring still holds, the same at any chunking. Withrefine_sequentialthat is the ordinary hand-over: an estimator that fires early leaves its block count short of the fine dwell, so the start it estimates lies behind the ring. Without it no geometry measured reaches it (0 of 1,089 noise geometries, docs/design/async-dsss-receiver-measurements/fallback-454049484/). The ring is held for the receiver's lifetime up to ~38 KiB (Gold-1023 at 2 samples a chip) and carried in every blob, a pool member's included. - tracking: the pre-despread carrier loop (
carrier_nda_wipeoff/carrier_nda_update) ->Dll->RateConverter->MpskReceiver. The carrier loop is carrier_nda at M = 2. It updates once a code period on the Dll's despread window sum (adr_track_period()): the look-back's window does not span a data transition, and its M = 2 errorIm(w^2)removes the data with no sign decision. The error is divided by the window's signal power (the unit denominator: the averaged|w|^2less the Dll's window noise), and the lock is the ratio of sums ofI^2 - Q^2overI^2 + Q^2on blocks sized by det_ratio_block_len() (docs/design/async-dsss-receiver.md, "The loop's lock statistic"). It removes the coupled Doppler (offset and 500 Hz/s ramp) before despreading, soMpskReceiveris left a small residual. A pure PLL: no FLL. - lost: the emitter is gone. Without
reacquire, entered from tracking when BOTH lock flags have been down, without a break, for longer thanlost_confirm_s(docs/design/async-dsss-receiver.md §10, §11.2); the loops stop and samples are discarded untilreset().lost_confirm_s = 0(the default) never enters it. Withreacquirethe release is symbol lock alone and returns the receiver to searching instead, so it never reads lost (docs/design/async-dsss-receiver.md §10). While the confirm interval runs the loops HOLD what they settled on with both flags up rather than run on noise (dp_dll_set_coast(); docs/design/async-dsss-receiver.md §10; docs/design/async-dsss-receiver-measurements.md §12.19, doppler#1271), so a departed emitter's receiver stands where the emitter left it, and neither sweeps onto a neighbour's code nor restarts its release clock on one it followed. One flag down is a degrade: reported, and the loops run, which is what rides out two live emitters crossing each other's code phase.
dp_async_dsss_receiver_seed() hands a searching receiver a detection from outside: the record its own hit would have produced (a hit is a seed the object makes for itself). It refuses on a receiver that already holds one, so a hold is never silently overwritten.
The refine and track stages share ONE carrier-wipe scratch/carry buffer set (car_wiped_buf/car_carry_buf/car_carry_len, sized tsamps = code_len*spc); they never run concurrently. The carry holds 0..tsamps-1 live samples (a full period is processed at once, and set_state refuses tsamps); the blob packs its fixed tsamps region last, the live samples then zeros.
// 3 Mcps, 2,100 sym/s, BPSK at 2 samples a chip; a one-epoch search.
const double chip_rate = 3.0e6;
const double symbol_rate = 2100.0;
const double sample_rate = 6.0e6; // 2 samples a chip
const int m = 2; // BPSK
const double cn0_dbhz = 55.0;
const double pfa = 1e-3;
const double pd = 0.9;
const double doppler_uncertainty = 100.0; // Hz, one-sided
const size_t segments = 4, sps = 8;
const int differential = 0;
const double refine_max_error_db = 0.5; // the refine_* tuning
const size_t refine_sps = 4, refine_n_fft = 64, refine_zero_pad = 8;
const double refine_margin_db = 14.0;
const bool refine_sequential = false;
const size_t refine_max_blocks = 100000;
const double carrier_freq_hz = 0.0; // 0 = aiding off
const double lost_confirm_s = 0.0; // 0 = never lost
const bool reacquire = false; // lost waits for reset()
const double code_only_s = 0.0; // no window: D = 1
const double doppler_rate = 0.0;
const bool refine = true; // D = 1 needs the refine
dp_async_dsss_receiver_state_t *rx = dp_async_dsss_receiver_create (
code, code_len, chip_rate, symbol_rate, sample_rate, m, cn0_dbhz, pfa,
pd, doppler_uncertainty, segments, sps, differential,
refine_max_error_db, refine_sps, refine_margin_db, refine_n_fft,
refine_zero_pad, refine_sequential, refine_max_blocks, carrier_freq_hz,
lost_confirm_s, reacquire, code_only_s, doppler_rate, refine);
float _Complex syms[4096];
size_t n = dp_async_dsss_receiver_steps(rx, x, x_len, syms, 4096);
dp_async_dsss_receiver_destroy(rx);
Public Types Documentation¶
enum async_dsss_rx_state_t¶
enum async_dsss_rx_state_t {
ASYNC_DSSS_RX_SEARCHING = 0,
ASYNC_DSSS_RX_REFINING = 1,
ASYNC_DSSS_RX_TRACKING = 2,
ASYNC_DSSS_RX_IDLE = 3,
ASYNC_DSSS_RX_LOST = 4
};
The state machine's values (state below, also the first byte of a serialized blob's extra record). Searching -> refining -> tracking, and seed() puts a searching receiver at refining; lost is reached from tracking by the release rule and left only by reset(). With reacquire the release skips lost and goes straight back to searching.
Public Functions Documentation¶
function dp_async_dsss_receiver_carrier_bn¶
The pre-despread carrier loop's bandwidth at a design C/N0: the loop-SNR rule (async-dsss-receiver.md §1.3), no wider than ASYNC_DSSS_RX_BN_CARRIER.
The loop updates once a code period, T = code_len / chip_rate, on a coherent sum whose SNR is rho = C/N0 T. Its loop SNR, counting the M = 2 detector's squaring loss S_L = 1 / (1 + 1/(2 rho)), is rho S_L / (2 bn), so ASYNC_DSSS_RX_CARRIER_LOOP_SNR_DB of it asks bn <= rho S_L / 200. The bandwidth is that, or ASYNC_DSSS_RX_BN_CARRIER where the rule allows more: the rule is a ceiling, and the release's 0.04 is the widest the loop has been designed at. At the 415.1-B-1 floor (C/N0 38.77 dB-Hz) it is 0.00993 at 2.2 GHz and 0.00744 at 2.8 GHz: 31.2 / 29.8 Hz of loop noise bandwidth (bn / T) and an acquisition bound of 15.6 / 14.9 Hz (ASYNC_DSSS_RX_CARRIER_PULLIN_HZ), the two carriers differing only through the squaring loss. create() sizes the receiver's carrier loop with it, at cn0_dbhz.
Parameters:
cn0_dbhzDesign C/N0, dB-Hz.chip_rateChips per second, > 0.code_lenChips a code period, > 0.
Returns:
The bandwidth, per update.
#include "doppler/async_dsss_receiver/async_dsss_receiver_core.h"
#include <stdio.h>
int main (void)
{
double chip = 2.2e9 * 31.0 / 21216.0; // 415.1-B-1 at 2.2 GHz
printf ("%.4f\n", dp_async_dsss_receiver_carrier_bn (38.77, chip, 1023));
printf ("%.2f\n", dp_async_dsss_receiver_carrier_bn (70.0, chip, 1023));
return 0; // prints 0.0099 then 0.04
}
function dp_async_dsss_receiver_carrier_lock_n_noncoh¶
The pre-despread carrier lock's non-coherent count at a design C/N0: the updates one lock decision sums.
uint32_t dp_async_dsss_receiver_carrier_lock_n_noncoh (
double cn0_dbhz,
double chip_rate,
size_t code_len,
size_t segments
)
The lock is the ratio of sums of I^2 - Q^2 over I^2 + Q^2 over a run of updates (one a code period), decided against its exact threshold at Pfa ASYNC_DSSS_RX_CAR_LOCK_PFA. The count is the least whose decision detects at Pd ASYNC_DSSS_RX_CAR_LOCK_PD (dp_det_ratio_block_len()) at the update SNR gamma = C/N0 T and the loop's phase variance, dp_async_dsss_receiver_carrier_phase_var(): at the bandwidth the loop delivers at its detector delay, wider than the rule's by that delay. At the 415.1-B-1 floor (C/N0 38.77 dB-Hz), 4 segments, it is 34 at 2.2 GHz and 43 at 2.8 GHz. It grows fast as C/N0 falls: 712 at 30 dB-Hz at 2.8 GHz. 0 when the design's update SNR, C/N0 x T, is too low for any count up to CARRIER_NDA_BLOCK_MAX_LEN to reach Pd, and dp_async_dsss_receiver_create() refuses that design: raise cn0_dbhz.
Parameters:
cn0_dbhzDesign C/N0, dB-Hz.chip_rateChips per second, > 0.code_lenChips a code period, > 0.segmentsThe Dll's segments a code period (create()'s), >= 1.
Returns:
The count, updates; 0 as above, for an update SNR that is not finite and positive, or for segments 0.
function dp_async_dsss_receiver_carrier_phase_var¶
The pre-despread carrier loop's phase variance at a design C/N0, the one the carrier lock is sized at.
double dp_async_dsss_receiver_carrier_phase_var (
double cn0_dbhz,
double chip_rate,
size_t code_len,
size_t segments
)
B_d (1 + 1/(2 gamma)) / gamma rad^2, gamma = C/N0 T the update's SNR and B_d the bandwidth the loop delivers: the rule's bandwidth (dp_async_dsss_receiver_carrier_bn()) through dp_loop_filter_init()'s gains at the detector delay ASYNC_DSSS_RX_CAR_LOOP_DELAY(segments) and unit slope (dp_state_filter_loop_bandwidth()). The unit denominator's error, divided by its slope, has variance (1 + 1/(2 gamma)) / (2 gamma) an update, and the closed loop passes 2 B_d of it. At the 415.1-B-1 floor and 4 segments B_d is 1.059 / 1.044 times the rule's at 2.2 / 2.8 GHz, where the rule's alone gives 1/200 rad^2. Its callers: dp_async_dsss_receiver_carrier_lock_n_noncoh(), which sizes the lock at it; validate_async_dsss_receiver_pullin design's # carrier_lock and # carrier_lock_segments, which print it; and the design page's carrier-lock section, which quotes it.
Parameters:
cn0_dbhzDesign C/N0, dB-Hz.chip_rateChips per second, > 0.code_lenChips a code period, > 0.segmentsThe Dll's segments a code period, >= 1.
Returns:
The variance, rad^2; NaN for an update SNR that is not finite and positive, segments 0, or a loop not stable at that delay.
function dp_async_dsss_receiver_configure_chain_raw¶
Pin the live-tracking despread/resample/demod grid directly. The escape hatch for the composition-specific knob: segments (the live Dll's tracking parameter) andsps /n (MpskReceiver's samples and terminal outputs per symbol) are independently overridable, still bridged by a freshly-sizedRateConverter and never coupled to each other. While searching/refining it re-pins the grid used to build the next tracking chain; once tracking it rebuildsdll /rc /rx in place, allocating every replacement before adopting it, and re-seeds the rebuilt chain from the whole carrier loop 1 plus loop 2's integrator, the sum status() reports so a retune keeps the signal it was tracking.
int dp_async_dsss_receiver_configure_chain_raw (
dp_async_dsss_receiver_state_t * state,
size_t segments,
size_t sps,
int n
)
The new grid is checked as create() checked the first, before anything is rebuilt, and refused with the receiver left on its prior grid: the Dll's domain at segments, sps >= 2, a symbol period of at most 2^20 Dll partials, which the Dll's aid would otherwise refuse mid-build (doppler#2103), and an n MpskReceiver would refuse (#2421). Still an abort: an allocation failure in the rebuild (doppler#2112).
Parameters:
stateMust be non-NULL.segmentsLive-tracking Dll segments per code period.spsMpskReceiver samples per symbol (the resample target), >= 2.nMpskReceiver's terminal outputs per symbol (m_out): inside dp_ratesync_m_ok() (even, 2..8) and at mostspsmpsk_rx_m_out_ok(), the rule create()'s own derivednsatisfies, so get_n() always re-applies (doppler#2650). It need not dividesps.
Returns:
0 on success, -1 on a grid refused as above.
>>> import numpy as np
>>> from doppler.dsss import AsyncDsssReceiver
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> rx = AsyncDsssReceiver(code, chip_rate=3.069e6, symbol_rate=2700.0,
... sample_rate=6.138e6, doppler_uncertainty=500.0)
>>> rx.configure_chain_raw(segments=6, sps=8, n=8) # re-pin the chain
>>> rx.segments # tracking grid updated in place
6
function dp_async_dsss_receiver_configure_lock_raw¶
Re-tune the live-tracking Dll's code-lock detector directly. Forwards to dp_dll_configure_lock_raw() on the live tracking Dll (the one behindget_code_locked() ), NOT the refine-stage collection Dll. It retunes the Dll the receiver holds now; every chain build (a seed, the hand-over, reset() or configure_chain_raw()) replaces that Dll with a freshly sized one, so call it once tracking. The detector is the hysteretic lockdet over the DLL's per-N-look CFAR statistic — the levels and verify counts trade declare latency against false-alarm rate.
void dp_async_dsss_receiver_configure_lock_raw (
dp_async_dsss_receiver_state_t * state,
double up_thresh,
double down_thresh,
size_t n_looks,
double alpha,
uint32_t n_up,
uint32_t n_down
)
The rule this replaces is sized when the chain is built, from rates the application chooses, by the detection module and not here: the non-coherent count by dp_det_n_noncoh() (at the detection and false-alarm probabilities, and the design C/N0) and the drop count by dp_det_verify_count() (at its miss probability and false-drop budget), handed to dp_dll_configure_lock(). The values are set in adr_build_track_chain() (async_dsss_receiver_core.c); this header does not restate them.
Parameters:
stateMust be non-NULL.up_threshCFAR-statistic level to declare code lock (hit when the statistic exceeds it).down_threshLevel below which a look is a miss; choose <=up_threshfor level hysteresis.n_looksLooks per decision — the DLL's non-coherent integration depth feeding one statistic.alphaEMA smoothing coefficient on the lock statistic (0..1); smaller is smoother/slower.n_upConsecutive hits required to declare lock.n_downConsecutive misses required to drop lock.>>> import numpy as np >>> from doppler.dsss import AsyncDsssReceiver >>> from doppler.wfm import Gold >>> code = np.asarray(Gold().generate(1023)).astype(np.uint8) >>> rx = AsyncDsssReceiver(code, chip_rate=3.069e6, symbol_rate=2700.0, ... sample_rate=6.138e6, doppler_uncertainty=500.0) >>> rx.configure_lock_raw(up_thresh=0.4, down_thresh=0.2, n_looks=20, ... alpha=0.1, n_up=5, n_down=3) >>> rx.tracking # replaced at the next chain build 0
function dp_async_dsss_receiver_configure_search_raw¶
Pin the embedded search's grid directly. Forwards to dp_correlator_configure_search_raw() __ the escape hatch under this object'ssymbol_rate -driven auto-sizing, for a power user who wants a specific(doppler_bins, n_noncoh) . The pin replaces the whole auto-sized grid, the window-tiled search included. Only meaningful while searching; the search does not run again until the nextreset() .
int dp_async_dsss_receiver_configure_search_raw (
dp_async_dsss_receiver_state_t * state,
size_t doppler_bins,
size_t n_noncoh
)
Parameters:
stateMust be non-NULL.doppler_binsThe coherent depth to pin, in[1, reps]: 1, as the receiver's continuous engine hasreps = 1.n_noncohNon-coherent looks accumulated per grid cell (1..256); more looks buys sensitivity at the cost of dwell, replacing the auto-sized count.
Returns:
0 on success; DP_ERR_INVALID on an invalid grid, DP_ERR_MEMORY on a failed allocation (see dp_correlator_configure_search_raw).
>>> import numpy as np
>>> from doppler.dsss import AsyncDsssReceiver
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> rx = AsyncDsssReceiver(code, chip_rate=3.069e6, symbol_rate=2700.0,
... sample_rate=6.138e6, doppler_uncertainty=500.0)
>>> rx.configure_search_raw(doppler_bins=1, n_noncoh=16) # pin it
>>> rx.refining # still searching, on the pinned grid
0
function dp_async_dsss_receiver_create¶
Create an AsyncDsssReceiver in the searching state.
dp_async_dsss_receiver_state_t * dp_async_dsss_receiver_create (
const uint8_t * code,
size_t code_len,
double chip_rate,
double symbol_rate,
double sample_rate,
int m,
double cn0_dbhz,
double pfa,
double pd,
double doppler_uncertainty,
size_t segments,
size_t sps,
int differential,
double refine_max_error_db,
size_t refine_samples_per_symbol,
double refine_design_margin_db,
size_t refine_n_fft,
size_t refine_zero_pad,
bool refine_sequential,
size_t refine_max_n_blocks,
double carrier_freq_hz,
double lost_confirm_s,
bool reacquire,
double code_only_s,
double doppler_rate,
bool refine
)
Only code/chip_rate/symbol_rate describe the signal itself. The refine_* defaults are sized to close the specification's 4-5 dB, 500 Hz/s combined scenario as they are; a power user can override each one.
Parameters:
codeSpreading code, one 0/1 chip per element (0 -> +1, 1 -> -1 BPSK; only the low bit is used, so pass 0/1, not +/-1).code_lenChips incode.chip_rateChip rate, Hz.symbol_rateData-symbol rate, Hz: finite, > 0, at mostchip_rate, and at most 2^20 Dll partials per symbol atsegments.sample_rateThe rate of the samples pushed, Hz: any ratio tochip_rateof at least one, or 0 for two samples a chip (the default). Refine and tracking run at this rate. The search runs at it too when one code period is a whole number of samples (dp_correlator_search_period()); a fractional period is resampled, for the search alone, to a power of two.mPSK order, 2/4/8; default 2 (BPSK).cn0_dbhzDesign C/N0, dB-Hz; default 55.0 feeds BOTH the embedded search's own sizing AND (derated byrefine_design_margin_db) CarrierAcquisition'sdesign_snr.pfaAcquisition false-alarm target; default 1e-3. Also CarrierAcquisition's ownpfa.pdAcquisition detection-probability target; default 0.9. Also CarrierAcquisition's ownpd.doppler_uncertaintyOne-sided Doppler search half-range, Hz; default 100.0.segmentsLive-tracking Dll's own segments; default 4.spsMpskReceiver's samples/symbol; default 8.differentialMpskReceiver's differential demap; default 0 (coherent). It acts in MpskReceiver's bits(), which this object does not offer, so steps()' symbols are the same either way (#2471).refine_max_error_dbMax tolerable async-lookback correlation-power loss driving the refine-stage collection Dll's coherent-I&D window count via dp_dll_lookback_segments(). Oversampling the epoch is required for the asynchronous data: the residual carrier rides a ~symbol_rate-wide data-modulated spectrum, so segments>1 (default yields 11 at tsamps=2046) samples it above Nyquist; segments=1 undersamples and aliases it. Default 0.5.refine_samples_per_symbolCarrierAcquisition's own operating rate = this * symbol_rate; default 4.refine_design_margin_dbEmpirical derating of cn0_dbhz before CarrierAcquisition's design_snr; default 14.0.refine_n_fftCarrierAcquisition's own block size; default 64.refine_zero_padCarrierAcquisition's own zero_pad; default 8.refine_sequentialCarrierAcquisition's sequential mode; default false its early per-block test fires on far too little averaging at the specification's Es/N0 floor (as few as 4 blocks, 150-200+ Hz off), so false waits the full design_snr-derived dwell.refine_max_n_blocksCarrierAcquisition's give-up cap in sequential mode, and the cap on the dwell in either mode; default 100000.carrier_freq_hzNominal RF carrier frequency, Hz, enabling carrier->code aiding; 0.0 (default) = off. When > 0, the coupled code-rate Doppler (carrier_offset/carrier_freq) is fed to the tracking Dll via dp_dll_set_rate_aid() so the code loop rides a dilated clock the discriminator alone can't pull in at low SNR. Set to the receiver's own downlink RF frequency for a physically-coupled Doppler capture. Coupled, it is above half the sample rate (dp_correlator_carrier_freq_ok()).lost_confirm_sRelease rule: both lock flags down, continuously, for longer than this many seconds puts the receiver in the lost state (see get_lost()). Size it past the longest fade the link must ride. The clock also runs from the first tracking sample, when neither flag is up yet, so a hand-off that never locks within the interval is released the same way as an emitter that leaves. Default 0.0 = never the exit is then reset().reacquireRelease on symbol lock alone, and search again by itself. With it set, the release clock counts samples of tracking with the SYMBOL lock flag down (code lock is not consulted), and when it passes lost_confirm_s the receiver resets itself to searching instead of entering lost: it never waits for reset(). A pool of receivers that are always online uses it. The clock runs from the first tracking sample, as above, so a track that never locks (a noise false alarm) is released too; size lost_confirm_s past the pull-in time to symbol lock, or a slow lock is released before it comes. Requires a lost_confirm_s of at least one input sample, since a release that never fires would never search again; a blob in the lost state is refused by set_state(). Default false: the release rule above.code_only_sSeconds of code-only signal the waveform holds at any chip phase (a symbol-free window; design async-dsss-receiver.md §2.3), >= 0 and finite. The receiver hands its searchercode_only_epochs = floor(code_only_s * chip_rate / code_len) - 1(at least 1), and the searcher's slow-time depth follows:coherent_bins = D, at most(code_only_epochs + 1)/2, rounded down to a 7-smooth length (dp_correlator_create_continuous()). Default 0: no window, D = 1.doppler_rateDoppler rate in Hz/s, >= 0 and finite, that the slow-time depth is bounded against: at mostf_epoch / sqrt(2 * doppler_rate)epochs (dp_correlator_create_continuous()). Default 0: the window is the only bound.refineWhether a seed refines its Doppler before tracking. True (the default): a seed enters refining, CarrierAcquisition estimates the residual over its dwell, and tracking starts from the refined Doppler (therefine_*parameters). False: a seed builds the tracking chain at once, at the seed's own sample, from the seed's code phase and Doppler; the receiver goes from searching (or idle) to tracking and never reads refining, and therefine_*parameters are unused. The Doppler handed over is the search's: the block's mean, within one Doppler row of it, since the peak is one of the rows bracketing it and at a near tie noise decides which, not always the nearer one; so within a row plusdoppler_ratetimes half the dwell (coherent_binscode periods) of the Doppler at the hand-over sample. Past half a row, the carrier loop meets it outside its budgeted edge, and its lock time is the pull-in's, not the budget's (the design page, §2.3). False is sized on the nearer row: it is accepted only while half the search's Doppler row,chip_rate / (2 * code_len * coherent_bins), is inside the carrier loop's acquisition bound, ASYNC_DSSS_RX_CARRIER_PULLIN_HZ: that iscoherent_bins >= ASYNC_DSSS_RX_NO_REFINE_MIN_BINS(bn), withbnthe receiver's carrier bandwidth (dp_async_dsss_receiver_carrier_bn()): 25 at 0.04, at any chip rate. A receiver configured outside it (a one-epoch search, D = 1, among them) is refused, and a blob in the refining state is refused by set_state(). The name is a placeholder (async-dsss-receiver.md §4.4).
Returns:
A new receiver, searching; NULL on an invalid argument, including reacquire with a lost_confirm_s under one sample, refine false with coherent_bins under 25, and a symbol shorter than a code period (symbol_rate * code_len > chip_rate): the pre-despread carrier loop forms its error, once a code period, from one coherent sum over the code-period window the Dll's look-back picks (dp_dll_get_window_sum()), which is free of data transitions only while a symbol spans a code period (async-dsss-receiver.md §4.4).
>>> import numpy as np
>>> from doppler.dsss import AsyncDsssReceiver
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> rx = AsyncDsssReceiver(code, chip_rate=3.069e6, symbol_rate=2700.0,
... sample_rate=6.138e6, doppler_uncertainty=500.0)
>>> (rx.tracking, rx.refining, rx.lost) # searching
(0, 0, 0)
With `refine` false a seed goes straight to tracking; that needs a
search at least 1 / bn code periods deep (bn the carrier loop's;
ASYNC_DSSS_RX_NO_REFINE_MIN_BINS), here a 0.1 s code-only window:
>>> fast = AsyncDsssReceiver(code, chip_rate=3.069e6, symbol_rate=2700.0,
... sample_rate=6.138e6, doppler_uncertainty=500.0,
... code_only_s=0.1, refine=False)
>>> fast.coherent_bins
150
>>> fast.seed(chip_phase=512.25, doppler_hz_est=-150.0, cn0_dbhz_est=48.0)
>>> (fast.tracking, fast.refining, fast.doppler_hz)
(1, 0, -150.0)
>>> try: # one epoch deep: refused
... AsyncDsssReceiver(code, chip_rate=3.069e6, symbol_rate=2700.0,
... sample_rate=6.138e6, refine=False)
... except ValueError:
... print("refused")
refused
function dp_async_dsss_receiver_create_ccsds415¶
The receiver at the CCSDS 415.1-B-1 specification point ( doppler/ccsds/ccsds_415.h ): theCcsds415Receiver view.
dp_async_dsss_receiver_state_t * dp_async_dsss_receiver_create_ccsds415 (
const uint8_t * code,
size_t code_len,
double carrier_freq_hz,
double lost_confirm_s,
bool refine,
const char ** why
)
dp_async_dsss_receiver_create() with the arguments dp_ccsds_415_rx() fills, the one table of them. The point's chip rate at carrier_freq_hz (dp_ccsds_415_chip_rate()), its 3,000 symbols a second and 11 MSa/s, its +/-1,500 Hz search, its Doppler rate R_env, the code-only opening of a frame as the gap, and a carrier lock designed at the floor's C/N0 (Es/N0 4 dB) whatever level the signal arrives at, since a receiver is built once, for its weakest signal. It is the receiver the harnesses measure at this point (docs/design/async-dsss-receiver-measurements.md).
Parameters:
codeThe mission's spreading code, one chip a byte (0/1): 1,023 chips, the point's Gold code length. Any other length is refused.code_lenIts length; must be DP_CCSDS_415_SF.carrier_freq_hzThe carrier, F_fwd: 2.2 to 2.8 GHz at the point. It sets the chip rate and the carrier loop's code aid. Built from DP_CCSDS_415_RX_FC_MIN to DP_CCSDS_415_RX_FC_MAX.lost_confirm_sBoth flags down for longer than this enters lost (0: never), as on the full create.refineThe refine stage on (true) or off.whySet to the refusal's sentence; may be NULL.
Returns:
The receiver, or NULL with why set: dp_ccsds_415_rx()'s refusals (the code's length, the carrier's window, lost_confirm_s).
>>> import numpy as np
>>> from doppler.dsss import Ccsds415Receiver
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023), np.uint8)
>>> rx = Ccsds415Receiver(code, carrier_freq_hz=2.2e9)
>>> Ccsds415Receiver(code[:511])
Traceback (most recent call last):
...
ValueError: the code must be 1,023 chips: the point's Gold code ...
function dp_async_dsss_receiver_destroy¶
Destroy a receiver and release every child.
Parameters:
stateMay be NULL.
function dp_async_dsss_receiver_fine_design¶
Design the fine hand-over at a design point: K, the dwell and its rates.
int dp_async_dsss_receiver_fine_design (
double cn0_dbhz,
double chip_rate,
size_t code_len,
double p_flip,
double symbol_rate,
int m,
size_t refine_segments,
double e_hz,
double rate_hz_s,
double eps_chip,
double block_s,
double pfa,
double p_ho,
size_t max_blocks,
async_dsss_receiver_fine_t * out
)
One pair sum's SNR is g = (gamma/K) rho^2/kappa (1 - eps)^2 sinc^2(e T / K), with gamma = C/N0 T (T a code period), the replica's rho^2/kappa from the code's share of sign-changing boundaries p_flip (rho = 1 - p/4, kappa = 1 - p/3), the code error eps chips and the carrier error e Hz. Squared (M = 2) it is gamma_sq = c^2 g^2 / (4 g + 2 + v g^2), where a sum straddles a symbol edge with probability q = T symbol_rate / K, c = 1 - q/3 and v = 1 - 0.4 q - c^2. Over a dwell of D refine blocks of block_s seconds the estimate sees n_s = K D block_s / T sums at rho = n_s gamma_sq, through PolynomialPhaseEstimator's Kaiser window (50 dB), whose peak-bin share p and variance ratio eta are computed from the window itself. A wrong peak is (n_s - 1)/2 exp(-p rho/2). The check refuses the right one with 1 - Q1(sqrt(2 p rho), sqrt(2 ln(n_s/pfa))). The dwell is the least D at which the two sum to at most 1 - p_ho.
The rate axis. A carrier changing at rate_hz_s Hz/s puts a chirp of M rate (T/K)^2 cycles a sum squared on the tone. Over the dwell found above, the window's coherent sum loses chirp_loss_db at max_rate 0. The axis turns on exactly when that loss would leave the dwell short of p_ho; the estimator then searches that half-span, its rows (PolynomialPhaseEstimator's own grid at the buffer's length) join the union bound and the check's cells, and the dwell is designed again with them. Derived, not a threshold.
At the 415.1-B-1 floor (C/N0 38.77 dB-Hz, Gold-1023, 3,000 symbols a second, refine_segments 10, e 3,000 Hz, eps 0.25, blocks of 5.33 ms, pfa 1e-3) K is 5 and the dwell is 39 blocks at 2.2 GHz and 42 at 2.8 GHz, at p_ho 0.99; 29 / 32 at 0.9 and 47 / 51 at 0.999, with no rate.
Parameters:
cn0_dbhzDesign C/N0, dB-Hz.chip_rateChips a second, > 0.code_lenChips a code period, > 0.p_flipThe code's share of sign-changing chip boundaries, from 0 to 1.symbol_rateData symbols a second, > 0.mConstellation order; the loss law is M = 2's.refine_segmentsThe refine Dll's dumps a code period.e_hzThe seed's design carrier error bound, Hz.rate_hz_sThe carrier rate the receiver is designed to, Hz/s, >= 0 (its doppler_rate).eps_chipThe design code error, chips, in [0, 1).block_sOne refine block, seconds.pfaThe check's false-alarm rate, in (0, 1).p_hoThe hand-over's probability, in (0, 1).max_blocksThe longest dwell to consider.outReceives the design.
Returns:
DP_OK; DP_ERR_INVALID for M other than 2, an argument out of range, no divisor of refine_segments that covers e_hz, or no dwell up to max_blocks that reaches p_ho.
function dp_async_dsss_receiver_get_car_last_error¶
The pre-despread carrier loop's last phase error (rad): the residual carrier phase LOOP 1 (which de-rotates before the Dll) is not nulling, as its loop filter takes it carrier_nda's discriminator divided by its slope (carrier_nda_loop_error() ), so radians near lock. The ".car.e" probe is the raw discriminator, twice this.
Parameters:
stateMust be non-NULL.
Returns:
Phase error, radians.
function dp_async_dsss_receiver_get_car_lock_rule¶
The carrier loop's lock rule; see dp_async_dsss_receiver_get_sym_lock_rule() .
dp_lockdet_rule_t dp_async_dsss_receiver_get_car_lock_rule (
const dp_async_dsss_receiver_state_t * state
)
Parameters:
stateMust be non-NULL.
Returns:
The rule.
function dp_async_dsss_receiver_get_car_nco_freq¶
LOOP 1 (the pre-despread carrier loop) output = NCO frequency command, cycles/sample of the front-end (chip_rate*spc) rate.
Parameters:
stateMust be non-NULL.
Returns:
NCO command, cycles/sample at chip_rate * spc.
function dp_async_dsss_receiver_get_carrier_lock_n_noncoh¶
The carrier lock's non-coherent count this receiver was built with, dp_async_dsss_receiver_carrier_lock_n_noncoh() at itscn0_dbhz .
size_t dp_async_dsss_receiver_get_carrier_lock_n_noncoh (
const dp_async_dsss_receiver_state_t * state
)
A decision sums that many updates, one a code period, and the flag declares after dp_det_verify_count(ASYNC_DSSS_RX_CAR_LOCK_PFA, 1e-6) decisions in a row: so the carrier flag's least time to declare is the count times the code period times that declare count, which the application holds against its own lock-time allocation.
Parameters:
stateMust be non-NULL.
Returns:
The count, updates (never 0: create() refuses that).
function dp_async_dsss_receiver_get_chip_phase¶
The code phase, chips, at the sample after the last one fed, in the Dll's instantaneous convention the mirror of dp_correlator_hit_t::code_phase's correlation-lag convention (dp_correlator_build_handoff() ). Tracking, it is the live Dll's phase carried over the partial period the chain holds (it runs whole periods), so it names the same sample a search's picks are carried to at any sample rate (#3063). While refining there is no live Dll: it is the seed's phase advanced by the clock dilation since, the phase the hand-over starts the live chain from.
Parameters:
stateMust be non-NULL.
Returns:
Code phase, chips.
function dp_async_dsss_receiver_get_cn0_dbhz_est¶
The seed's C/N0 estimate, dB-Hz, unchanged until reset().
Parameters:
stateMust be non-NULL.
Returns:
C/N0, dB-Hz; 0 after create and reset().
function dp_async_dsss_receiver_get_code_lock_rule¶
The code loop's lock rule; see dp_async_dsss_receiver_get_sym_lock_rule() .
dp_lockdet_rule_t dp_async_dsss_receiver_get_code_lock_rule (
const dp_async_dsss_receiver_state_t * state
)
Parameters:
stateMust be non-NULL.
Returns:
The rule.
function dp_async_dsss_receiver_get_code_locked¶
Binary code-lock flag from the live tracking Dll's own verify-counted (pfa-tuned) lock detector — the fundamental DSSS "am I despreading" lock, de-chattered by up/down hysteresis.
This is the flag 415.1-B-1 §7.4.1's "short-code PN lock" names: its acquisition requirement, PN lock with probability at least 0.9 within 20 s of the signal's arrival, anywhere in +/-1,500 Hz of best lock, is read on it (validate_async_dsss_receiver_pullin). Its full sweep (docs/design/async-dsss-receiver-measurements/final-9ce208250/) locks every draw within 20 s: in the static cells, 60 of 60, a 95% Wilson lower limit of 0.94, so the requirement is demonstrated there; in the +/-11 Hz/s cells, 26 to 34 of as many, lower limits 0.87 to 0.90, so it is not refuted. Its --check asserts not refuted, on one draw.
Parameters:
stateMust be non-NULL.
Returns:
1 while code lock is declared, else 0.
function dp_async_dsss_receiver_get_code_rate¶
The Dll's code rate, chips per nominal chip (~1.0 at lock), without the carrier aid; a coasting Dll reports its held rate.
Parameters:
stateMust be non-NULL.
Returns:
Code rate, chips per nominal chip.
function dp_async_dsss_receiver_get_coherent_bins¶
The searcher's slow-time depth D: epochs per coherent dwell.
Derived at create from code_only_s and doppler_rate (dp_async_dsss_receiver_create()); 1 without a code-only window. Every restarted search reset(), a release with reacquire, a refused hand-over, configure_search_raw() starts its next dwell on a multiple of D * code_len * spc input samples counted from create: the receiver discards input up to that boundary first, at most one block. Receivers fed the same stream from create therefore search on the same block grid.
Parameters:
stateMust be non-NULL.
Returns:
D, >= 1.
>>> import numpy as np
>>> from doppler.dsss import AsyncDsssReceiver
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> rx = AsyncDsssReceiver(code, chip_rate=3.069e6, symbol_rate=2700.0,
... sample_rate=6.138e6, doppler_uncertainty=500.0)
>>> rx.coherent_bins # no code-only window
1
>>> rx = AsyncDsssReceiver(code, chip_rate=3.069e6, symbol_rate=2700.0,
... sample_rate=6.138e6, doppler_uncertainty=500.0,
... code_only_s=0.0627)
>>> rx.coherent_bins # 187 epochs: 94, run 7-smooth
90
function dp_async_dsss_receiver_get_consumed¶
Inputs the last dp_async_dsss_receiver_steps() call took: itsx_len , or 0 when it held its input back.
Per-call, not in the blob: 0 after create and reset.
Parameters:
stateMust be non-NULL.
Returns:
Input samples the last call consumed.
function dp_async_dsss_receiver_get_demod_lock_rule¶
The demodulator's carrier lock rule; see dp_async_dsss_receiver_get_sym_lock_rule() .
dp_lockdet_rule_t dp_async_dsss_receiver_get_demod_lock_rule (
const dp_async_dsss_receiver_state_t * state
)
Parameters:
stateMust be non-NULL.
Returns:
The rule.
function dp_async_dsss_receiver_get_demod_sync_lock_rule¶
The demodulator's timing lock rule; see dp_async_dsss_receiver_get_sym_lock_rule() .
dp_lockdet_rule_t dp_async_dsss_receiver_get_demod_sync_lock_rule (
const dp_async_dsss_receiver_state_t * state
)
Parameters:
stateMust be non-NULL.
Returns:
The rule.
function dp_async_dsss_receiver_get_doppler_hz¶
The HAND-OVER's Doppler, Hz: what the live chain was built from, frozen for the track's whole tenure the seed's while refining, the refine's estimate from the hand-over on. It does not follow the carrier: under a 400 Hz/s ramp it is 400 Hz stale a second later. Where the emitter is now is status().doppler_hz, a field of the same name with the other meaning.
Parameters:
stateMust be non-NULL.
Returns:
Doppler, Hz; 0 after create, reset() or a refused hand-over.
function dp_async_dsss_receiver_get_handover_source¶
Which estimate the live chain's Doppler came from: ASYNC_DSSS_RX_HO_NONE until a hand-over, then _SEED, _DATA or _FINE (the refine's choice), or _SEED at the seed itself with refine false; NONE again at the next seed that refines.
Parameters:
stateMust be non-NULL.
Returns:
One of the ASYNC_DSSS_RX_HO_* values.
function dp_async_dsss_receiver_get_lock¶
The carrier lock statistic of the MpskReceiver this receiver tracks with: the EMA of its M-th-power lock signal, near 1 when locked and near 0 on noise.
Parameters:
stateMust be non-NULL.
Returns:
The MpskReceiver's lock statistic.
function dp_async_dsss_receiver_get_lock_metric¶
Symbol-lock metric = SNR-weighted EMA of (I^2-Q^2)/(I^2+Q^2) = cos(2*phi) over the emitted symbols (locked -> ~+1). Drives locked .
Parameters:
stateMust be non-NULL.
Returns:
The metric, in -1..+1; reset when the track chain is built.
function dp_async_dsss_receiver_get_lock_threshold¶
The lock-metric threshold locked is declared strictly above (0.5, ASYNC_DSSS_RX_LOCK_UP); exposed alongside lock_metric for engineering debug.
Parameters:
stateMust be non-NULL.
Returns:
The up threshold, 0.5.
function dp_async_dsss_receiver_get_locked¶
The receiver's symbol-lock flag: a hysteretic detector over get_lock_metric(), declared after 30 consecutive symbols strictly above get_lock_threshold() (0.5) and dropped after 15 consecutive symbols strictly below 0.3 (ASYNC_DSSS_RX_LOCK_N_UP, _UP, _N_DOWN and _DOWN, fixed at create). The flag the release rule and a pool's holder act on.
Parameters:
stateMust be non-NULL.
Returns:
1 while symbol lock is declared, else 0.
function dp_async_dsss_receiver_get_lost¶
1 once the release rule has fired: both lock flags were down, continuously, for longer than lost_confirm_s while tracking an emitter that left, or a seed that never locked. The loops have stopped and samples are consumed and discarded; the holder releases the assignment and calls reset(). 0 in every other state, and always 0 withlost_confirm_s = 0 .
Parameters:
stateMust be non-NULL.
Returns:
1 in the lost state, else 0.
function dp_async_dsss_receiver_get_mpsk_last_error¶
MpskReceiver carrier phase discriminator (rad): the residual carrier phase LOOP 2 (post-despread) is not nulling.
Parameters:
stateMust be non-NULL.
Returns:
Phase error, radians.
function dp_async_dsss_receiver_get_n¶
MpskReceiver's terminal outputs per symbol (even, 2..8).
Parameters:
stateMust be non-NULL.
Returns:
Outputs per symbol; set at create or by configure_chain_raw().
function dp_async_dsss_receiver_get_n_exclusions¶
Code phases set_exclusions() holds.
Parameters:
stateMust be non-NULL.
Returns:
Count, 0 to ASYNC_DSSS_RX_MAX_EXCLUSIONS.
function dp_async_dsss_receiver_get_nco_freq¶
The MpskReceiver's carrier NCO command, its loop filter's whole output, cycles/sample at its input rate ( sps * symbol_rate ). Its mean tracks a Doppler ramp with no lag (unlike get_norm_freq()); its variance is the carrier loop's stress.
Parameters:
stateMust be non-NULL.
Returns:
NCO command, cycles/sample at sps * symbol_rate.
function dp_async_dsss_receiver_get_norm_freq¶
The post-despread carrier the MpskReceiver tracks: its centre plus its loop's integrator, cycles/sample at its input rate ( sps * symbol_rate ). Lags a Doppler ramp by the Type-II ramp error.
Parameters:
stateMust be non-NULL.
Returns:
Carrier frequency, cycles/sample at sps * symbol_rate.
function dp_async_dsss_receiver_get_rank¶
Which surviving peak of a dwell the search takes; 0 = the strongest. Set with dp_async_dsss_receiver_set_rank() .
Parameters:
stateMust be non-NULL.
Returns:
The rank, 0 to ASYNC_DSSS_RX_MAX_PEAKS - 1.
function dp_async_dsss_receiver_get_refining¶
1 while refining: the CarrierAcquisition dwell; 0 in every other state.
Parameters:
stateMust be non-NULL.
Returns:
1 in the refining state, else 0.
function dp_async_dsss_receiver_get_segments¶
The live-tracking Dll's partial correlations per code period.
Parameters:
stateMust be non-NULL.
Returns:
Segments; set at create or by configure_chain_raw().
function dp_async_dsss_receiver_get_settle_time¶
Symbols a track emits before its demodulator has settled: where a steady-state measurement of a track's symbols may start.
The demodulator's own figure, dp_mpsk_receiver_get_settle_time(), at the bandwidths this receiver builds it with (ASYNC_DSSS_RX_DEMOD_BN_TIMING, ASYNC_DSSS_RX_DEMOD_BN_CARRIER and ASYNC_DSSS_RX_DEMOD_ZETA): 778.5 symbols. Counted from the first symbol a track emits, which is the hand-over, since nothing is emitted while the receiver searches and refines; a track taken up after a release starts the count again. The symbol lock (locked) declares inside this span, while the demodulator's timing is still pulling in, so a decode scored from the flag counts the pull-in's errors.
Parameters:
stateMust be non-NULL.
Returns:
Symbols, from the first one of a track.
function dp_async_dsss_receiver_get_sps¶
MpskReceiver's samples per symbol.
Parameters:
stateMust be non-NULL.
Returns:
Samples per symbol; set at create or by configure_chain_raw().
function dp_async_dsss_receiver_get_state¶
Serialize the receiver: its own fields, then each child, then the carrier carry (live samples, zero-padded to tsamps).
Scratch buffers, the telemetry attachment and the refine_periods diagnostic are not carried.
Parameters:
stateMust be non-NULL.blobCaller-owned buffer of at least dp_async_dsss_receiver_state_bytes() bytes.
function dp_async_dsss_receiver_get_sym_lock_rule¶
The rules behind the receiver's five lock decisions, each its levels and verify counts ( dp_lockdet_rule_t ), for a caller that draws a lock statistic beside the line it is decided against.
dp_lockdet_rule_t dp_async_dsss_receiver_get_sym_lock_rule (
const dp_async_dsss_receiver_state_t * state
)
- sym: the symbol-lock decision (
locked) on the lock metric, always ASYNC_DSSS_RX_LOCK_UP / _DOWN / _N_UP / _N_DOWN; telemetry ".sym.lock"; - car: the pre-despread carrier loop's decision on its lock metric (dp_carrier_nda_get_lock_rule()); ".car.lock";
- code: the Dll's decision on its statistic R (dp_dll_get_lock_rule()), as configure_lock_raw() last retuned it on the Dll held now; ".code.lock";
- demod, demod_sync: the demodulator's carrier and timing decisions (dp_mpsk_receiver_get_lock_rule(), _get_sync_lock_rule()); ".demod.lock" and ".demod.sync.lock".
The tracking chain is rebuilt at every seed, so read them after the hand-over; each rebuild sets the same rules.
Parameters:
stateMust be non-NULL.
Returns:
The rule.
function dp_async_dsss_receiver_get_threads¶
Workers the searcher runs, the calling thread included; 1 = serial. Set with dp_async_dsss_receiver_set_threads() .
Parameters:
stateMust be non-NULL.
Returns:
The embedded search's thread count, >= 1.
function dp_async_dsss_receiver_get_tracking¶
1 once the live tracking chain is built and demodulating; 0 in every other state.
Parameters:
stateMust be non-NULL.
Returns:
1 in the tracking state, else 0.
function dp_async_dsss_receiver_reset¶
Return to the searching state. Resets the embedded search and rebuilds the refine-stage chain and the live tracking chain back to their placeholder seed (phase 0, no Doppler). A receiver that has locked cannot be "reset back to tracking the same signal," only back to searching every object's reset() semantics in this codebase.
Parameters:
stateMust be non-NULL.>>> import numpy as np >>> from doppler.dsss import AsyncDsssReceiver >>> from doppler.wfm import Gold >>> code = np.asarray(Gold().generate(1023)).astype(np.uint8) >>> rx = AsyncDsssReceiver(code, chip_rate=3.069e6, symbol_rate=2700.0, ... sample_rate=6.138e6, doppler_uncertainty=500.0) >>> rx.reset() # abort any lock, hunt from scratch >>> (rx.tracking, rx.refining, rx.chip_phase) # all cleared (0, 0, 0.0)
function dp_async_dsss_receiver_seed¶
Take a detection from outside and start refining from it.
int dp_async_dsss_receiver_seed (
dp_async_dsss_receiver_state_t * state,
double chip_phase,
double doppler_hz_est,
double cn0_dbhz_est
)
The hand-off of docs/design/async-dsss-receiver.md §2.2: the three numbers a searcher's hit carries that this receiver uses dp_correlator_handoff_t's chip_phase, doppler_hz_est and cn0_dbhz_est exactly as its own hit would have produced them (steps() calls this on its own hit). chip_phase is the code's instantaneous phase in chips, Dll's convention, at the FIRST sample of the next steps() call; dp_correlator_build_handoff() makes it from a hit's lag. The refine chain is rebuilt from the seed and the state becomes refining; the unconsumed tail is the caller's to feed.
Refused (DP_ERR_INVALID, nothing changes) on a receiver that is not waiting for one refining, tracking or lost because "assigned once" is a property of the object, not of the caller's bookkeeping; reset() releases it. Accepted while searching: an outside hit simply beats the receiver's own. Also refused outside the seed domain, dp_async_dsss_receiver_seed_ok().
Parameters:
stateMust be non-NULL.chip_phaseCode phase at the next sample, chips, in[0, code_len).doppler_hz_estCoarse Doppler estimate, Hz (the refine stage sharpens it).cn0_dbhz_estThe hit's C/N0 estimate, dB-Hz; reported back by get_cn0_dbhz_est(), unchanged until reset().
Returns:
DP_OK, or DP_ERR_INVALID when refused.
>>> import numpy as np
>>> from doppler.dsss import AsyncDsssReceiver
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> rx = AsyncDsssReceiver(code, chip_rate=3.069e6,
... symbol_rate=2700.0, sample_rate=6.138e6)
>>> rx.seed(chip_phase=512.25, doppler_hz_est=-1500.0,
... cn0_dbhz_est=48.0)
>>> (rx.refining, rx.doppler_hz, rx.cn0_dbhz_est)
(1, -1500.0, 48.0)
Already assigned -- refused until reset():
>>> rx.seed(0.0, 0.0, 48.0) # doctest: +ELLIPSIS
Traceback (most recent call last):
...
ValueError: seed refused: ...
>>> rx.reset()
A chip phase must be inside the code, `[0, code_len)`:
>>> rx.seed(1023.0, 0.0, 48.0) # doctest: +ELLIPSIS
Traceback (most recent call last):
...
ValueError: seed refused: ...
function dp_async_dsss_receiver_seed_ok¶
The seed domain: whether (chip_phase, doppler_hz_est) is onedp_async_dsss_receiver_seed() accepts, and one a live receiver can hold.
int dp_async_dsss_receiver_seed_ok (
const dp_async_dsss_receiver_state_t * state,
double chip_phase,
double doppler_hz_est
)
chip_phase must be finite and inside [0, code_len), and doppler_hz_est must be strictly inside (-fs/2, fs/2), where fs is chip_rate * spc. A Doppler at or past half the sample rate is not reportable (dp_correlator_carrier_freq_ok() relies on this bound), and a seed there sent the hand-off's phase to NaN (doppler#2103).
seed() refuses by this predicate, set_state() restores the seed fields only inside it, the searching receiver's hit path does not seed from a hit it fails, and the hand-over holds the REFINED Doppler to it too: a seed in range whose residual carries it to or past fs/2 is refused at the hand-over, counted in refused_hits, and the receiver searches again (idle, in a pool, for the pool's search to re-seed) rather than track a Doppler it cannot report. It reads only the receiver's fixed config (code length, chip rate, spc), so any receiver built from the same config gives the same answer.
Parameters:
stateMust be non-NULL.chip_phaseCode phase, chips.doppler_hz_estDoppler estimate, Hz.
Returns:
1 inside the seed domain, 0 outside it (a NaN is outside).
function dp_async_dsss_receiver_set_exclusions¶
Code phases the search must not take: signals another receiver already tracks.
int dp_async_dsss_receiver_set_exclusions (
dp_async_dsss_receiver_state_t * state,
const double * phases,
size_t phases_len
)
Replaces the list. A peak within one chip, circularly, of any of them is dropped from a dwell's list at any Doppler, before ranking (set_rank()). Phases are chips in status().chip_phase's convention, at the sample after the last one fed when they are set, and are folded into [0, code_len); a dwell decided calls later carries them from that sample to its own. An empty list (the default) excludes nothing. A tracking receiver is not affected: the list applies to its next search. A mutator's value, so it travels in the state blob (#2022).
Parameters:
stateMust be non-NULL.phasesCode phases, chips; finite. May be NULL whenphases_lenis 0.phases_lenAt most ASYNC_DSSS_RX_MAX_EXCLUSIONS.
Returns:
DP_OK; DP_ERR_INVALID (list unchanged) on a non-finite phase or too many.
>>> import numpy as np
>>> from doppler.dsss import AsyncDsssReceiver
>>> rx = AsyncDsssReceiver(code=[1, 0, 1, 1, 0, 0, 1], chip_rate=1e6,
... symbol_rate=1e6 / 28.0, sample_rate=4e6, cn0_dbhz=60.0)
>>> rx.set_exclusions(np.array([2.5, 9.0])) # 9 folds to 2
>>> rx.n_exclusions
2
function dp_async_dsss_receiver_set_rank¶
Take the rank-th surviving peak of a dwell, not the strongest.
The searcher reports up to ASYNC_DSSS_RX_MAX_PEAKS peaks per dwell, strongest first. The receiver drops every peak within one chip (circularly) of a stronger one, so one signal's neighbouring cells hold one place; then every peak a stronger signal's own sidelobes could explain; then every peak within one chip of an excluded code phase (set_exclusions()). The survivors are ranked from 0. A dwell with no peak at this rank hands nothing off and the search goes on.
The sidelobe rule, per cell: a strong signal's list also holds its code's Doppler-offset sidelobes, up to dp_correlator_dsl_db() below it and hundreds of chips from its phase (design acq-surface.md §8). A peak counts as a second signal only if its test_stat exceeds what the stronger signals' sidelobes can read AT ITS CELL by more than the detector's own gate (dp_correlator_gate_stat()). Each stronger signal reads its statistic on its own lag (dp_correlator_hit_t::test_stat_peak) times the code's cross-ambiguity from it to this cell (dp_correlator_sidelobe_ratio()), which reaches dp_correlator_dsl_db() only at the worst cells. The bound is the strongest of these; on a deep block (get_coherent_bins() > 1) it is the sum over the stronger signals on the peak's own Doppler row, modulo the epoch rate, when that is larger, since their fixed sidelobes can stack on one cell, and each is floored at dp_correlator_dsl_db() until a strong signal's data splatter is modelled (doppler#2730). So the range does not narrow with the number of signals on the air (doppler#2554), and a sidelobe passes only when the noise on it alone would have cleared the gate, the rate the search already runs at. A second signal is taken well past dp_correlator_dsl_db() below a stronger one at most cells: on a one-epoch search, measured, in every stream to 10 dB below and in a fifth of them at 20 dB (design async-dsss-receiver.md §7.2, the near-far limit). The model is one clean code period: when a data transition falls inside the stronger signal's epoch common, 55% of epochs at the specification's 1.8 epochs a symbol its sidelobes read far above it at some cells (20.4 dB at one, measured by native/validation/acq_emitter_floor.c), and only the gate stands between them and a false second signal. Over the operating range the gate held (the near-far sweep, data on both, took no sidelobe); past it, or on a one-epoch search of a much stronger signal, it is not bounded (doppler#2734). Searchers that share a stream and its block grid (get_coherent_bins()) and hold ranks 0..k-1 therefore take k different signals in one dwell. Takes effect at the next dwell. A mutator's value, so it travels in the state blob (#2022).
Parameters:
stateMust be non-NULL.rank0 (the strongest, the default) to ASYNC_DSSS_RX_MAX_PEAKS - 1.
Returns:
DP_OK; DP_ERR_INVALID (rank unchanged) past the list.
>>> from doppler.dsss import AsyncDsssReceiver
>>> rx = AsyncDsssReceiver(code=[1, 0, 1, 1, 0, 0, 1], chip_rate=1e6,
... symbol_rate=1e6 / 28.0, sample_rate=4e6, cn0_dbhz=60.0)
>>> rx.set_rank(1)
>>> rx.rank
1
function dp_async_dsss_receiver_set_refine_min_blocks¶
Floor the refine's dwell at n_blocks , whatever the detection sizing asks (docs/design/async-dsss-receiver-measurements.md §12.16, #1265).
int dp_async_dsss_receiver_set_refine_min_blocks (
dp_async_dsss_receiver_state_t * state,
size_t n_blocks
)
CarrierAcquisition's dwell is sized for DETECTION at the derated C/N0 (cn0_dbhz - refine_design_margin_db), so it shortens as the C/N0 rises two blocks at 45 dB-Hz with the shipped margin while the noise of the estimate it hands the tracking chain does not shorten with it: 210 Hz at two blocks against a chain that pulls in from a few hundred, so one hand-over in sixty landed outside and tracked the code with the carrier never locked. Seven blocks (42 ms, the default and the floor dwell of docs/design/async-dsss-receiver-measurements.md §12.10) hold the estimate to 77 Hz. Applied to the next refine chain built a receiver already refining keeps its dwell. A mutator's value, so it travels in the state blob (#2022). n_blocks of 0 removes the floor; the value is clamped by refine_max_n_blocks where that cap is lower.
Parameters:
stateMust be non-NULL.n_blocksThe floor, blocks.
Returns:
DP_OK.
>>> from doppler.dsss import AsyncDsssReceiver
>>> rx = AsyncDsssReceiver(code=[1, 0, 1, 1, 0, 0, 1], chip_rate=1e6,
... symbol_rate=1e6 / 28.0, sample_rate=4e6, cn0_dbhz=60.0)
>>> rx.refine_min_blocks # the default floor
7
>>> rx.set_refine_min_blocks(12)
>>> rx.refine_min_blocks
12
function dp_async_dsss_receiver_set_state¶
Restore a blob written by dp_async_dsss_receiver_get_state() .
The envelope, the layout keys (segments, sps, n, refine_segments), the state value, the seed, rank, exclusions and thread count are all checked before any child is decoded; a refusal there changes nothing. The children are then restored in order, so a child that rejects its sub-blob leaves the children before it already restored. Restores set_threads()'s value by calling dp_correlator_set_threads().
Parameters:
stateMust be non-NULL; built with the same configuration.blobA blob produced by dp_async_dsss_receiver_get_state().
Returns:
DP_OK, or DP_ERR_INVALID if the blob is refused.
function dp_async_dsss_receiver_set_telemetry¶
Attach (or detach) a telemetry context across the receiver's loops, and register the receiver's own lifecycle and symbol-lock decision.
int dp_async_dsss_receiver_set_telemetry (
dp_async_dsss_receiver_state_t * state,
dp_tlm_t * tlm,
const char * prefix,
uint32_t decim
)
The receiver reports under the prefix, once per steps() call that carries samples, after the call, so on the time axis at the stamp the caller set for that block (dp_tlm_set_now()): * "<prefix>.state" where the call left the receiver, the ASYNC_DSSS_RX_* value: 0 searching, 1 refining, 2 tracking, 3 idle (a pooled receiver holding nothing), 4 lost (status().state); * "<prefix>.handover_hz" the Doppler the chain was built from, Hz (dp_async_dsss_receiver_get_doppler_hz()): 0 before a seed, the seed's while refining, the refined value from the hand-over on, and 0 again after a refused hand-over or a reset(), which return the receiver to searching (idle in a pool). A record is a float, so it resolves about 0.5 Hz near 5 MHz. Not the live carrier: status().doppler_hz reads that, and ".car.freq" and ".car.nco" are the carrier loop's own view of it, in cycles a sample at the input rate, so times chip_rate * spc for Hz; * "<prefix>.refused" the hits refused as seeds so far (status().refused_hits); * "<prefix>.ho_src" which estimate the live chain was built from, an ASYNC_DSSS_RX_HO_* value (0 none since the seed, 1 the seed's, 2 the data template's, 3 the fine estimate's); * "<prefix>.ref_fine.hz", ".snr_db", ".n" the fine hand-over's estimate (Hz, against the seed), its peak-to-mean and its sums, once at the refine's decision, whether or not its check passed; * "<prefix>.cn0" the seed's C/N0 estimate, dB-Hz (status().cn0_dbhz_est): constant over a tenure, since the receiver keeps no running estimate while tracking; * "<prefix>.phase.car" the pre-despread carrier NCO's phase at the call's FIRST sample, cycles in [0, 1) (dp_carrier_nda_get_nco_phase_ahead() past the samples the chain still carries), exact: the loop steers only at a period's end. The phase of the tracking chain; while searching or refining it is the placeholder chain's, and ".state" says which; * "<prefix>.phase.code" the code NCO's prompt phase at the call's first sample, chips (dp_dll_get_code_phase_ahead()), exact to within a code-loop update inside the carried samples. It is the code NCO's word, the START of a sample's dwell; the Dll takes its prompt at the dwell's CENTRE, half an increment later (dll_tap_base(), nco_dwell_center(): the zero-order-hold rule). So a prompt on the continuous code phase reads here half a sample BEFORE it (0.5 chip_rate / fs chips), with no correlation lost measured in the pull-in captures, -0.186 chip at 2.69 samples a chip (0.500 sample) and -0.148 at 3.42 (0.505).
The two phases are stamped at the call's first sample, which is the stamp the caller set (dp_tlm_set_now()) for this block, so a caller who knows the transmitted carrier and code phase at that sample subtracts them for the loops' true errors the stress the discriminator outputs ".car.e" and ".code.e" only estimate.
Feed blocks of about a code period, as the examples do, and these read as a time series of the lifecycle: when the search hit, how long the refine took, what it handed over, when the release came.
Each loop reports under the prefix, at its own update rate:
* "<prefix>.car" the chip-domain carrier loop (dp_carrier_nda_set_telemetry(): ".lock", ".e", ".freq", ".locked", ".nco"; ".e" is the raw discriminator, slope 2, so twice the phase error in radians near lock, and ".lock" the last block's ratio of sums), once per carrier update: once a code period, except while it coasts, when loop 1 is held;
* "<prefix>.code" the code loop (dp_dll_set_telemetry(): ".e", ".rate", ".lock", ".locked", ".nco", and the lock statistic's two terms ".prompt_amp" and ".offset_pwr"), once per code period (with the symbol aid on, the last steer held);
* "<prefix>.code.steer" the code loop's filter at each steer of the symbol aid (dp_dll_set_steer_telemetry(): ".e", ".prop", ".integ", ".ctrl", ".aid"), the loop's own cadence;
* "<prefix>.demod" the symbol-domain demodulator (dp_mpsk_receiver_set_telemetry(): its lock, its carrier and timing loops, the symbols, its AGC), once per recovered symbol (the AGC's pair once per gain update), and the timing loop's two filter terms beside them, ".demod.sync.prop" and ".demod.sync.integ" (dp_ratesync_loop_set_filter_telemetry());
* "<prefix>.acq" the acquisition engine (dp_correlator_set_telemetry()), once per decided dwell;
* "<prefix>.rc" the rate converter between the code loop and the demodulator (dp_RateConverter_set_telemetry()). It reports only an AGC, and this receiver builds it without one, so it registers no probes;
* "<prefix>.sym.lock" and "<prefix>.sym.locked" the receiver's own symbol-lock metric (dp_async_dsss_receiver_get_lock_metric()) and its decision (dp_async_dsss_receiver_get_locked()), the one its users act on, once per emitted symbol; "<prefix>.sym.num" and "<prefix>.sym.den", the metric's two EMAs (their ratio is ".sym.lock"), on the same symbols;
* "<prefix>.sym.t" where each emitted symbol's strobe sits on the INPUT clock, once per emitted symbol beside ".sym.lock": the record's stamp is the call's first sample (as every once-a-call probe here), and the value the samples past it, so the time is n + value and reads negative by the chain's delay. It names the symbol's CONTENT an I&D symbol's centre through the demodulator's strobe, the rate converter's group delay and the code loop's partials placed between its NCO's wraps, so it follows everything the code and timing loops steer. On a noiseless scene it is on the sent symbols to under 0.002 symbol rms and its mean to one input sample (test_async_dsss_receiver_core.c, _test_sym_t_on_the_truth). Read-only: the symbols and every other record are the same attached or not. Not in the blob: after dp_async_dsss_receiver_set_state() it reads NaN until the next seed rebuilds the chain, as does a symbol from the first code period after a build, before the code NCO has wrapped twice to place its partials between;
* "<prefix>.ref" the refine's estimator, the data template's (dp_carrier_acq_set_telemetry(): ".stat", ".thr", ".hz", ".n", ".ready"), once per tested block while refining.
* "<prefix>.state", "<prefix>.handover_hz", "<prefix>.refused", "<prefix>.ho_src", "<prefix>.cn0", "<prefix>.phase.car" and "<prefix>.phase.code" the lifecycle (an async_dsss_rx_state_t), the Doppler the chain was built from (Hz), the refused hits, the hand-over's source (ASYNC_DSSS_RX_HO_*), the seed's C/N0 (dB-Hz) and the loops' NCO phases (cycles, chips) at the call's first sample, once per steps() call;
* "<prefix>.had_lock", "<prefix>.coast" and "<prefix>.hold" the loop control the receiver decides once a code period from the code and symbol flags, each 0 or 1: whether both have been up together since the seed (from then on the loops coast rather than run free), whether this period coasts (both down: the carrier restored to its hold point and frozen, the code loop dead-reckoning one decision drives both loops), and whether this period re-marked the hold point (both up); once per code period while tracking;
* "<prefix>.release" the release clock: how long both flags have been down (the symbol flag alone with reacquire), as a fraction of the confirm interval, so the receiver is released once it passes 1; 0 while a flag is up and when there is no release rule. Once per steps() call.
The carrier and code loops report their filters two ways: ".car.freq" and ".code.rate" (and the demodulator's ".demod.car.freq") are the integrators, each loop's frequency memory, which a coast holds; ".car.nco", ".code.nco" and ".demod.car.nco" are the complete commands the NCOs run at, the proportional term (and the code loop's carrier aid) included. ".demod.sync.rate" is the timing loop's output, and ".e" is each discriminator's input to its filter.
The attachment is a REQUEST kept on the receiver: every seed rebuilds the tracking chain, and the rebuilt loops are attached again under the same names (so the same probe ids). Records are therefore continuous across re-seeds, and a reset keeps the attachment too.
Setup path, never hot; the context is borrowed and must outlive the attachment, and the receiver must step on one thread (SPSC rules in dp_tlm/dp_tlm_core.h). Passing NULL detaches every loop.
Parameters:
stateMust be non-NULL.tlmTelemetry context to attach, or NULL to detach.prefixProbe-name prefix; NULL means "rx".decimEmit every decim-th event on each probe; >= 1.
Returns:
DP_OK, or DP_ERR_INVALID on decim 0, a prefix too long for some probe's name refused before anything registers on tlm, because the loops are first attached to a scratch context that finds the refusal or a probe table with no room for every probe (found the same way, from the names the scratch holds); DP_ERR_MEMORY when the attach cannot allocate, its scratch context or a loop's own (the searcher builds one). Every refusal leaves tlm's table untouched and the receiver as it was: detached, or still on its previous context under its previous prefix.
>>> import numpy as np
>>> from doppler.dsss import AsyncDsssReceiver
>>> from doppler.telemetry import Telemetry
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> rx = AsyncDsssReceiver(code, chip_rate=3.069e6, symbol_rate=2700.0,
... sample_rate=6.138e6, doppler_uncertainty=500.0)
>>> tlm = Telemetry(1 << 12)
>>> rx.set_telemetry(tlm, "rx")
>>> sorted(p for p in tlm.probe_names if p.startswith(("rx.car",
... "rx.code")))
['rx.car.e', 'rx.car.freq', 'rx.car.lock', 'rx.car.locked', 'rx.car.nco', 'rx.code.e', 'rx.code.lock', 'rx.code.locked', 'rx.code.nco', 'rx.code.offset_pwr', 'rx.code.prompt_amp', 'rx.code.rate', 'rx.code.steer.aid', 'rx.code.steer.ctrl', 'rx.code.steer.e', 'rx.code.steer.integ', 'rx.code.steer.prop']
>>> sorted(p for p in tlm.probe_names if p.startswith(("rx.s", "rx.h",
... "rx.refu")))
['rx.had_lock', 'rx.handover_hz', 'rx.ho_src', 'rx.hold', 'rx.refused', 'rx.state', 'rx.sym.den', 'rx.sym.lock', 'rx.sym.locked', 'rx.sym.num', 'rx.sym.t']
>>> sorted(p for p in tlm.probe_names if p.startswith(("rx.ph", "rx.cn")))
['rx.cn0', 'rx.phase.car', 'rx.phase.code']
>>> sorted(p for p in tlm.probe_names if p.startswith("rx.ref"))
['rx.ref.hz', 'rx.ref.n', 'rx.ref.ready', 'rx.ref.stat', 'rx.ref.thr', 'rx.ref_fine.hz', 'rx.ref_fine.n', 'rx.ref_fine.snr_db', 'rx.refused']
>>> rx.set_telemetry(None, "rx") # detach
function dp_async_dsss_receiver_set_threads¶
Set the workers the searcher fans its Doppler tiles across.
Forwards to dp_correlator_set_threads() on the receiver's searcher. The search is bit-identical at every count, so this changes the cost of a steps() call and nothing about its output. A pool that steps its receivers in parallel sets each one to 1. A mutator's value, so it travels in the state blob (#2022), in one place: the searcher's own blob, as the request, which dp_correlator_set_state() applies through dp_correlator_set_threads(). A pool's 1 restores as 1 everywhere; a writer's 0 restores as 0, which the reader runs on its own online cores. Setup path; not while another thread is inside steps().
Parameters:
stateMust be non-NULL.nThread count; 0 = online cores, 1 = serial.
Returns:
DP_OK. The count actually running is dp_async_dsss_receiver_get_threads(); a searcher with one Doppler tile always runs 1.
>>> from doppler.dsss import AsyncDsssReceiver
>>> rx = AsyncDsssReceiver(code=[1, 0, 1, 1, 0, 0, 1], chip_rate=1e6,
... symbol_rate=1e6 / 28.0, sample_rate=4e6, cn0_dbhz=60.0)
>>> rx.set_threads(1)
>>> rx.threads
1
function dp_async_dsss_receiver_state_bytes¶
Size in bytes of the blob dp_async_dsss_receiver_get_state() writes.
Envelope + async_dsss_receiver_extra_t + every child's blob + a fixed tsamps-sample carry region + the hand-over ring (refine_hist_cap samples); fixed for a given configuration.
Parameters:
stateMust be non-NULL.
Returns:
Blob size, bytes.
function dp_async_dsss_receiver_status¶
Read the status record, by value: the state; where the emitter is now (the live carrier), its chip phase, code rate and C/N0; the five lock flags with the symbol-lock metric and threshold; both carrier residuals; and the two clocks in input samples (since the state was entered; both flags down without a break).
async_dsss_receiver_status_t dp_async_dsss_receiver_status (
const dp_async_dsss_receiver_state_t * state
)
Cheap and allocation-free: every field is a read of live state. The one-at-a-time getters report the same fields, doppler_hz apart (see the record), and the three loop flags past locked are published here alone; this is the face a controller reads. No timestamp: the clocks are in input samples, and the holder, which owns the sample clock, stamps the record.
Parameters:
stateMust be non-NULL.
Returns:
The record, by value.
>>> import numpy as np
>>> from doppler.dsss import AsyncDsssReceiver
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> rx = AsyncDsssReceiver(code, chip_rate=3.069e6,
... symbol_rate=2700.0, sample_rate=6.138e6)
>>> st = rx.status()
>>> (st.state, st.doppler_hz, st.code_locked, st.locked) # searching
(0, 0.0, 0, 0)
>>> (st.carrier_locked, st.demod_carrier_locked, st.sync_locked)
(0, 0, 0)
>>> rx.seed(chip_phase=100.0, doppler_hz_est=-250.0, cn0_dbhz_est=50.0)
>>> st = rx.status()
>>> (st.state, round(st.doppler_hz, 6), st.cn0_dbhz_est) # refining
(1, -250.0, 50.0)
>>> _ = rx.steps(np.zeros(2046, np.complex64))
>>> rx.status().state_samples # since seed
2046
function dp_async_dsss_receiver_steps¶
Stream raw cf32 samples; emit demodulated symbols once tracking.
size_t dp_async_dsss_receiver_steps (
dp_async_dsss_receiver_state_t * state,
const float _Complex * x,
size_t x_len,
float _Complex * out,
size_t max_out
)
No symbol is dropped while the code loop stays within its rate headroom (dp_dll_steps_max_out(): twice nominal); a loop past it, as one acquiring can be, drops partials inside the Dll, before they reach this receiver. Symbols held by an earlier call are delivered first, in order. A call consumes its input only when nothing stays held after that and its symbols fit: P(x_len) (see dp_async_dsss_receiver_steps_max_out()) is at most the room left in out plus the store, which holds what one call of a code period can produce. What does not fit in out is held for the next call. A call that cannot consume returns what it delivered and takes nothing: dp_async_dsss_receiver_get_consumed() reads 0, and the caller calls again with the same x. A C caller that sizes out below dp_async_dsss_receiver_steps_max_out() for a call longer than a code period meets this every time, so it must check consumed() or size out from that function, as the Python binding does.
Drives the state machine. It emits nothing while searching or refining (an empty return is normal, not an error): a hit seeds the frozen-carrier refine chain, CarrierAcquisition sharpens the coarse Doppler estimate, and only once it is ready (or gives up) is the live tracking chain built and demodulation begins. A hit inside a call hands the rest of the call straight to the refine chain, so no sample is dropped there; at the refine's end, what the refine did not consume of the last call goes on to the live chain. Accepts any block size; state carries across calls, so a capture can be fed in frames of any length with no seam. Lost (after the release rule fires) consumes the samples and emit nothing, so the feeding loop is the same in every state; while tracking, the release clock runs on the two lock flags after every call, or on the symbol lock flag alone with reacquire (see lost_confirm_s). Tracking emits symbols whether or not they are data: a noise false alarm can reach tracking and emit until the release rule lets it go or, at the default lost_confirm_s of 0, until reset() and symbol lock (locked) is what says the symbols are a signal's, so read it rather than the count (#2439). Under the specification's coupled offset + 500 Hz/s Doppler ramp the pre-despread carrier loop removes the full carrier dynamics before the code loop, so the recovered constellation lands cleanly on the BPSK real axis.
Parameters:
stateMust be non-NULL.xInput cf32 samples.x_lenNumber of input samples.outOutput symbols; caller providesmax_outcapacity.max_outOutput capacity. steps() never writes past it; symbols past it are held and delivered by the next call. dp_async_dsss_receiver_steps_max_out() forx_lenis always enough.
Returns:
Number of symbols written: held ones first, then this call's; 0 while searching, refining or lost with nothing held, or before a full symbol's worth of input.
>>> import numpy as np
>>> from doppler.dsss import AsyncDsssReceiver
>>> from doppler.wfm import Gold
>>> sf, chip, sym, spc = 1023, 3.069e6, 2700.0, 2
>>> fs, te, tsym = chip * spc, sf * spc, chip * spc / sym
>>> code = np.asarray(Gold().generate(sf)).astype(np.uint8)
>>> csign = np.where(code & 1, -1.0, 1.0)
>>> rng = np.random.default_rng(21)
>>> n = int(600 * tsym) + 4 * te # 600 async BPSK symbols
>>> idx = np.arange(n)
>>> data = (rng.integers(0, 2, 604) * 2 - 1).astype(float)
>>> si = np.clip((idx / tsym).astype(int), 0, 603)
>>> t = idx / fs
DSSS chips on a carrier sweeping at 500 Hz/s — the ramp the async
receiver has to track:
>>> sig = (data[si] * csign[(idx // spc) % sf]
... * np.exp(1j * 2 * np.pi * 0.5 * 500.0 * t * t))
>>> cn0 = 20.0 + 10 * np.log10(sym) # Es/N0 = 20 dB
>>> sigma = np.sqrt(fs / 10 ** (cn0 / 10))
>>> pre = 5 * te # noise-only lead-in
>>> noise = (sigma / np.sqrt(2)) * (rng.standard_normal(pre + n)
... + 1j * rng.standard_normal(pre + n))
>>> x = (np.concatenate([np.zeros(pre), sig]).astype(np.complex64)
... + noise.astype(np.complex64))
>>> rx = AsyncDsssReceiver(
... code, chip_rate=chip, symbol_rate=sym, sample_rate=fs,
... cn0_dbhz=cn0, doppler_uncertainty=500.0)
>>> syms = [rx.steps(x[p:p + te]) for p in range(0, len(x) - te, te)]
>>> syms = np.concatenate([s for s in syms if len(s)])
>>> rx.tracking # searched, refined, now tracking
1
>>> len(syms) > 300 # symbols recovered under the ramp
True
Nearly all the energy lands on I, so the BPSK phase is resolved:
>>> bool(np.mean(syms.real**2) > 10 * np.mean(syms.imag**2))
True
function dp_async_dsss_receiver_steps_max_out¶
The capacity that lets the next steps() call on x_len samples deliver everything it can: the symbols held, plus the most the call can produce.
size_t dp_async_dsss_receiver_steps_max_out (
dp_async_dsss_receiver_state_t * state,
size_t x_len
)
Sized to this, a call never holds and never refuses its input (dp_async_dsss_receiver_steps()), which is how the Python binding calls it. The most a call can produce, P(x_len), is bounded by the chain's structure, not by the nominal rate:
- the call runs at most
x_len + Hsamples through the tracking chain,H = max(tsamps - 1, refine_hist_cap, srch_hist_cap): the carry, or at a hand-over the refine ring's tail or the search history's; - the live Dll emits at most dp_dll_steps_max_out() of them, its own bound, which carries its rate headroom;
- the RateConverter emits at most
ceil(ratio x n) + 1ofnpartials (ratio = sps x symbol_rate / (segments x chip_rate / code_len), fixed by configuration), and MpskReceiver at most one symbol per input; - a hand-over rebuilds the Dll and the RateConverter with fresh phases, one more close and one more output:
ceil(segments x ratio) + 1. A call holds at most one: the release clock runs once a call, at its end, and the call returns after it, so no call can release, search, refine and hand over again.
So P(x_len) = ceil(ratio x dp_dll_steps_max_out(dll, x_len + H)) + 1 + ceil(segments x ratio) + 1. It is 0 in a state that cannot reach the chain within a call: a search-only receiver (dp_async_dsss_receiver_set_search_only()) reports its hits and never seeds, a pooled receiver waits idle for a seed given between calls, and lost leaves only through reset(); so such a receiver consumes into any out, 0 included. A Debug build holds the bound to the chain: a call that produces more than it aborts (#2469).
Parameters:
stateMust be non-NULL.x_lenInput samples the call will be given.
Returns:
Held symbols plus P(x_len); SIZE_MAX if that overflows.
Macro Definition Documentation¶
define ASYNC_DSSS_RECEIVER_STATE_MAGIC¶
Envelope magic ("ADRX") identifying an AsyncDsssReceiver blob.
define ASYNC_DSSS_RECEIVER_STATE_VERSION¶
Layout version of the AsyncDsssReceiver blob (history below).
#define ASYNC_DSSS_RECEIVER_STATE_VERSION `24u /* v24: the held symbols' store (#2469); v23: the fine hand-over's buffer and count (ho_src 3); v22: the pre-despread carrier loop is carrier_nda ('CNDA' children for car and car_held); v21: the squared-stream refine estimator reverted, its fields gone (79fa50cfe); v20: no threads, the search's own blob carries set_threads()'s request (#3055); v19: the squared-stream refine estimator (§4.7); v18: the exclusions' and picks' samples; v17: the refine hand-over's ring (#2974); v16: the search child is the correlator's search flavor ('CORL', #2752 3.4b); v15: pooled, search-only picks; v14: the search resampler and its origin; v13: rank, exclusions; v12: samples_in, the dwell alignment, threads; v11: no cell mode; v10: the dll children grew (output level, #2495); v9: refine_min_blocks; v8: refused_hits; v7: no hand-off flavor; v6: the cell pull-in */`
define ASYNC_DSSS_RX_BN_CARRIER¶
The widest bandwidth the pre-despread carrier loop takes, per update (a code period): the receiver's own is dp_async_dsss_receiver_carrier_bn() at its design C/N0, which is this value wherever the loop-SNR rule allows it and narrower where it does not. The refine stage's frozen carrier (a Costas whose update is never called) reads only its seed frequency and update length.
0.04 is the widest the loop has been designed at: tracking the specification's 500 Hz/s ramp with a per-period Type-II loop needs the bandwidth to keep the velocity lag (~ramp/omega_n^2) small, and at the design C/N0's rule the loop is narrower. bn is the closed loop's noise bandwidth (carrier_nda divides out its detector's slope, #3224). No FLL.
define ASYNC_DSSS_RX_CARRIER_LOOP_SNR_DB¶
The pre-despread carrier loop's least loop SNR at the design C/N0, dB (async-dsss-receiver.md §1.3): rho S_L / (2 bn) with rho = C/N0 T the update's SNR and S_L = 1 / (1 + 1/(2 rho)) the M = 2 detector's squaring loss, which the 20 dB counts, so bn <= rho S_L / 200.
define ASYNC_DSSS_RX_CARRIER_PULLIN_HZ¶
#define ASYNC_DSSS_RX_CARRIER_PULLIN_HZ (
bn,
chip_rate,
code_len
) `((bn) * (chip_rate) / (2.0 * (double)(code_len)))`
The pre-despread carrier loop's acquisition bound, Hz, at bn: half its noise bandwidth, B_L / 2 = bn / (2 T) (0.5 bn an update), T a code period; 97.8 Hz at 5 Mcps over Gold-1023 and bn 0.04. Empirical: a frequency step inside it pulls a second-order loop in within its normal lock time, about 5 / bn updates; past it the lock time is the pull-in's and grows (the lock-time rows of sweep-1b7312b09, on carrier_nda). It is not the no-slip reach, which the same sweep measures lower, 0.25 B_L at the 4 dB floor (unit form): a step at this bound may slip while it pulls in, and slips during pull-in are allowed.
define ASYNC_DSSS_RX_CAR_DEN_ALPHA¶
The pre-despread carrier loop's unit denominator: the EMA weight an update of the window sum's power (docs/design/async-dsss-receiver.md, "The averaging length": 81 / 64 ms at the floor, 10 to 12 times the loop's memory).
define ASYNC_DSSS_RX_CAR_LOCK_PD¶
The carrier block lock's detection probability a block at the design C/N0, the code lock's.
define ASYNC_DSSS_RX_CAR_LOCK_PFA¶
The carrier block lock's false-alarm rate a block, the code lock's.
define ASYNC_DSSS_RX_CAR_LOOP_DELAY¶
The pre-despread carrier loop's detector delay, updates, at segments Dll segments a code period: 2 - 1/segments, a worst case and not a typical value. It is the delay of dp_state_filter_loop_bandwidth()'s model, past that model's own one-update loop (at delay 0 a control reaches the next update's detector). Two terms, each a bound:
* the window's age at the update, under one update: the loop updates once a code period, at the period's end, on the window the Dll's look-back picked, and that window ends at most a period before the update (less than 1; the lag instrument's lag.epoch_T, the Dll's code phase at the update in periods, reads it);
* the look-back's borrow: the window may start in the previous period, by at most segments - 1 of its segments chunks (the candidate loop in dll_core.c, best_widx <= w - 1), so at most (segments - 1)/segments of a period. Their sum is under 1 + (segments - 1)/segments = 2 - 1/segments: 1.75 at the receiver's 4. The carrier lock is sized at the loop's delivered bandwidth at this delay (the delay widens it). dp_async_dsss_receiver_carrier_lock_n_noncoh().
define ASYNC_DSSS_RX_DEMOD_BN_CARRIER¶
MpskReceiver's carrier-loop bn, normalised to the symbol rate.
define ASYNC_DSSS_RX_DEMOD_BN_TIMING¶
MpskReceiver's timing-loop bn, normalised to the symbol rate.
define ASYNC_DSSS_RX_DEMOD_LOCK_THRESH¶
MpskReceiver's carrier lock threshold.
define ASYNC_DSSS_RX_DEMOD_RRC_BETA¶
MpskReceiver's RRC roll-off argument (unused by its I&D pulse).
define ASYNC_DSSS_RX_DEMOD_RRC_SPAN¶
MpskReceiver's RRC span argument, symbols (unused by its I&D pulse).
define ASYNC_DSSS_RX_DEMOD_ZETA¶
MpskReceiver's carrier-loop damping factor.
define ASYNC_DSSS_RX_DLL_BN¶
The Dll's bn, per epoch whatever the steer rate (the symbol-period aid steers once per symbol and keeps bn per epoch): DsssReceiver's value, narrower than dp_dll_create()'s default 0.01 for noise immunity at the low-Es/N0 floor.
define ASYNC_DSSS_RX_DLL_SPACING¶
The tracking Dll's early-late spacing, chips.
define ASYNC_DSSS_RX_DLL_ZETA¶
Damping factor of both Dlls (the tracker and the refine collector).
define ASYNC_DSSS_RX_FINE_P_HO¶
The fine hand-over's probability, the dwell's target: a design choice, 0.99 (docs/design/async-dsss-receiver.md, "The dwell, derived").
define ASYNC_DSSS_RX_HO_DATA¶
The hand-over took the data-template estimator's.
define ASYNC_DSSS_RX_HO_FINE¶
The hand-over took the fine estimate: the refine's squared pair sums located by PolynomialPhaseEstimator, divided by M.
define ASYNC_DSSS_RX_HO_NONE¶
Where the last hand-over's Doppler came from (".ho_src" and dp_async_dsss_receiver_get_handover_source() ): none since the last seed (searching or refining), the seed's own (with refine false, where the seed is the hand-over; or the refine gave up, or its estimates failed the hand-over's checks), CarrierAcquisition's (§4.7), or the fine estimate's.
define ASYNC_DSSS_RX_HO_SEED¶
The hand-over took the seed's own Doppler.
define ASYNC_DSSS_RX_LOCK_DOWN¶
Lock metric locked must be strictly below to count down.
define ASYNC_DSSS_RX_LOCK_DWELL¶
Symbol-lock metric EMA dwell, symbols (EMA weight 1/dwell).
define ASYNC_DSSS_RX_LOCK_N_DOWN¶
Consecutive symbols below LOCK_DOWN that drop locked.
define ASYNC_DSSS_RX_LOCK_N_UP¶
Consecutive symbols above LOCK_UP that declare locked.
define ASYNC_DSSS_RX_LOCK_UP¶
Lock metric locked must be strictly above to count up.
define ASYNC_DSSS_RX_MAX_EXCLUSIONS¶
Most code phases dp_async_dsss_receiver_set_exclusions() holds: one per signal another receiver tracks.
define ASYNC_DSSS_RX_MAX_PEAKS¶
Peaks the searcher reports per dwell (dp_correlator_set_max_peaks()): the list the receiver filters by exclusion, de-duplicates and ranks (dp_async_dsss_receiver_set_rank()). A rank is below this.
define ASYNC_DSSS_RX_NO_REFINE_MIN_BINS¶
The least search depth, coherent_bins, a receiver built with refine false takes at carrier bandwidth bn: half the search's Doppler row, chip_rate / (2 * code_len * coherent_bins), is then inside ASYNC_DSSS_RX_CARRIER_PULLIN_HZ, which is coherent_bins >= 1 / bn at any chip rate (async-dsss-receiver.md §4.4): the ceiling of 1 / bn, a reciprocal within 1e-9 of a whole number taken as that number (so bn 0.04 asks 25, and 1/25.4 asks 26).
define ASYNC_DSSS_RX_REFINE_DLL_SPACING¶
The refine-stage collection Dll's early-late spacing, chips.
define ASYNC_DSSS_RX_REFINE_MIN_BLOCKS¶
Default floor on the refine's dwell, blocks: the floor dwell of docs/design/async-dsss-receiver-measurements.md §12.10 (77 Hz of estimate noise at 45 dB-Hz); see dp_async_dsss_receiver_set_refine_min_blocks().
The documentation for this class was generated from the following file native/inc/doppler/async_dsss_receiver/async_dsss_receiver_core.h