Skip to content

File async_dsss_pool_core.h

FileList > async_dsss_pool > async_dsss_pool_core.h

Go to the source code of this file

AsyncDsssPool N AsyncDsssReceivers on one stream under a controller (docs/design/async-dsss-receiver.md §5-§8).More...

  • #include "doppler/clib_common.h"
  • #include "doppler/jm_perf.h"
  • #include "doppler/dp_parallel.h"
  • #include "doppler/dp_state.h"
  • #include "doppler/dp_tlm/dp_tlm_core.h"
  • #include "doppler/async_dsss_receiver/async_dsss_receiver_core.h"
  • #include "doppler/dll/dll_core.h"
  • #include "doppler/costas/costas_core.h"
  • #include "doppler/RateConverter/RateConverter_core.h"
  • #include "doppler/mpsk_receiver/mpsk_receiver_core.h"
  • #include "doppler/cic/cic_core.h"
  • #include "doppler/resample/resample_core.h"
  • #include "doppler/psd/psd_core.h"
  • #include "doppler/detection/detection_core.h"
  • #include "doppler/spectral/spectral_core.h"
  • #include "doppler/doppler_channel/doppler_channel_core.h"
  • #include "doppler/correlator/correlator_core.h"
  • #include "doppler/fft/fft_core.h"
  • #include "doppler/acc_trace/acc_trace_core.h"
  • #include "doppler/carrier_acq/carrier_acq_core.h"
  • #include "doppler/resamp/resamp_core.h"
  • #include "doppler/hbdecim/hbdecim_core.h"
  • #include "doppler/carrier_nda/carrier_nda_core.h"
  • #include "doppler/ppe/ppe_core.h"
  • #include "doppler/correlation/correlation_core.h"

Classes

Type Name
struct dp_async_dsss_pool_state_t
AsyncDsssPool state.

Public Functions

Type Name
dp_async_dsss_pool_state_t * dp_async_dsss_pool_create (const uint8_t * code, size_t code_len, size_t n_receivers, 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, int threads, bool refine)
Create a pool of n_receivers receivers built alike.
dp_async_dsss_pool_state_t * dp_async_dsss_pool_create_ccsds415 (const uint8_t * code, size_t code_len, size_t n_receivers, double carrier_freq_hz, double lost_confirm_s, int threads, bool refine, const char ** why)
A pool of receivers at the CCSDS 415.1-B-1 specification point ( doppler/ccsds/ccsds_415.h ): theCcsds415Pool view.
void dp_async_dsss_pool_destroy (dp_async_dsss_pool_state_t * state)
Destroy a pool and every receiver.
size_t dp_async_dsss_pool_get_coherent_bins (const dp_async_dsss_pool_state_t * state)
The receivers' slow-time depth D, epochs per coherent block ( dp_async_dsss_receiver_get_coherent_bins() ); alike for all.
void dp_async_dsss_pool_get_state (const dp_async_dsss_pool_state_t * state, void * blob)
Write the state into blob: the clock, the release counts, the thread count (a mutator's value, #2022), the samples carried to the next whole period, the ghost rule's history (each receiver's carriers and code-lock flags over its window), and each receiver's state, and the search's, which carries the exclusions the controller gave it. The last push's symbols do not travel.
int dp_async_dsss_pool_get_threads (const dp_async_dsss_pool_state_t * state)
Workers push() steps the receivers on, the calling thread included: what set_threads() asked for, at most n_receivers, and the online cores for 0.
int dp_async_dsss_pool_ghost_of (const dp_async_dsss_pool_state_t * state, size_t i, size_t j)
Whether receiver j tracks a Doppler-offset sidelobe of receiveri's signal, by the controller's ghost rule (header step 3) over the history it holds now.
size_t dp_async_dsss_pool_push (dp_async_dsss_pool_state_t * state, const float _Complex * x, size_t x_len)
Step every receiver on one block, running the controller at every group of code periods it completes.
dp_async_dsss_receiver_state_t * dp_async_dsss_pool_receiver (const dp_async_dsss_pool_state_t * state, size_t receiver)
Borrow receiver receiver , for C-only configuration: its chain settings (dp_async_dsss_receiver_configure_chain_raw() ), which every chain it builds keeps.
void dp_async_dsss_pool_reset (dp_async_dsss_pool_state_t * state)
Every receiver back to idle and the search to no exclusions; the clock, the release counts, the search's period count and the ghost history back to 0.
int dp_async_dsss_pool_set_state (dp_async_dsss_pool_state_t * state, const void * blob)
Restore the state, whole or not at all. DP_ERR_INVALID on a blob of another object or version, another receiver count, a carry of a group (ASYNC_DSSS_POOL_PERIODS_PER_JOIN periods) or more, a ghost history control() cannot leave (a length past the window, a flag other than 0 or 1, a nonzero entry outside a ring's span, or a history on a receiver not tracking), or a receiver blob its receiver refuses; a refusal leaves the pool and every receiver as they were.
int dp_async_dsss_pool_set_telemetry (dp_async_dsss_pool_state_t * state, dp_tlm_t * tlm, const char * prefix, uint32_t decim)
Attach (or detach) a telemetry context across every receiver.
int dp_async_dsss_pool_set_threads (dp_async_dsss_pool_state_t * state, int n)
Set the workers push() steps the receivers on.
size_t dp_async_dsss_pool_state_bytes (const dp_async_dsss_pool_state_t * state)
Bytes in the blob dp_async_dsss_pool_get_state() writes: the envelope, the pool's own fields, and every receiver's own blob.
async_dsss_receiver_status_t dp_async_dsss_pool_status (const dp_async_dsss_pool_state_t * state, size_t receiver)
Receiver receiver's status, now.
size_t dp_async_dsss_pool_symbols (const dp_async_dsss_pool_state_t * state, size_t receiver, float _Complex * out, size_t max_out)
The symbols receiver receiver emitted during the last push().
size_t dp_async_dsss_pool_symbols_max_out (const dp_async_dsss_pool_state_t * state)
The most symbols symbols() can return: the largest count any receiver emitted during the last push().

Macros

Type Name
define ASYNC_DSSS_POOL_GHOST_EPS_HZ 10.0
define ASYNC_DSSS_POOL_GHOST_LOCK_FRAC 0.2
define ASYNC_DSSS_POOL_GHOST_STILL_HZ 10.0
define ASYNC_DSSS_POOL_GHOST_WINDOW_S 0.2
define ASYNC_DSSS_POOL_MAX_RECEIVERS [**ASYNC\_DSSS\_RX\_MAX\_PEAKS**](async__dsss__receiver__core_8h.md#define-async_dsss_rx_max_peaks)
define ASYNC_DSSS_POOL_NO_RECEIVER (-1)
define ASYNC_DSSS_POOL_PERIODS_PER_JOIN 16u
define ASYNC_DSSS_POOL_STATE_MAGIC [**DP\_FOURCC**](dp__state_8h.md#define-dp_fourcc) ('A', 'D', 'P', 'L')
define ASYNC_DSSS_POOL_STATE_VERSION /* multi line expression */

Detailed Description

The pool owns one search and N receivers that each hold one signal (docs/design/async-dsss-receiver.md §5). A pooled receiver has no search of its own: holding nothing, it is idle (ASYNC_DSSS_RX_IDLE) and costs nothing until the controller seeds it. The search is a receiver in search-only mode (dp_async_dsss_receiver_set_search_only()): it runs the receivers' own pick on each dwell and reports the survivors instead of seeding itself. N idle receivers therefore cost one search, not N.

  • One search, while any receiver is idle. push() feeds each whole code period to the search first, its tiles across the workers, and only while some receiver is idle: with every receiver holding there is nobody to hand a detection to, so it stops, and a fresh search starts on the period one is free.
  • Then the receivers, in parallel. The same periods go to every receiver, one per task on the dp_parallel workers when at least two hold a signal (idle ones cost nothing, so they run inline). A receiver touches only its own state, so the result does not depend on the thread count: one thread and N give the same bytes.
  • Then the controller, serially, once a group of ASYNC_DSSS_POOL_PERIODS_PER_JOIN code periods. A receiver is fed exactly one code period (code_len * sample_rate / chip_rate samples, its floor when that is not whole) per call, the search and the receivers a group of those periods at a time, the workers joined once a group, on the grid of the pool's sample count from create or reset; push() keeps what is left past the last whole group and feeds it with the next push. Every call and every controller step is then a position in the stream, not a call boundary, so any blocking of one stream gives the same receivers, the same releases and the same symbols. The cost is latency: up to one group of a push waits for the next, and a release or a seed comes up to a group's periods less one after the period that called for it. It reads every receiver's status() and:
  • releases the lost. A receiver in the lost state (its release rule fired: the emitter left, or the seed never locked) is reset to idle. With reacquire the receiver does this itself and is never lost.
  • resolves duplicates. Two receivers that hold a signal (refining or tracking) within one chip of each other's code phase, circularly, hold the same signal. The one that keeps it is the one tracking over the one refining, then the one in its state longer (status().state_samples: the first to lock), then the higher status().cn0_dbhz_est the C/N0 the search estimated at its seed, not a live one: the receiver keeps none while tracking then the lower index. The other is reset to idle.
  • releases ghosts. A receiver can take a strong emitter's Doppler-offset sidelobe, hundreds of chips from the emitter's own phase, where the duplicate key cannot see it: it despreads the emitter's own data. Two of its traits give it away together (doppler#2529), each over the same trailing window of ASYNC_DSSS_POOL_GHOST_WINDOW_S of whole code periods, both receivers tracking throughout:

    • its carrier moves in lockstep with a stronger holder's (a higher status().cn0_dbhz_est: stronger at its seed, as the search estimated it, since no receiver keeps a running estimate), a whole nonzero number k of lattice steps away: the carrier delta's mean is within ASYNC_DSSS_POOL_GHOST_EPS_HZ of k times chip_rate / (2 code_len), and its standard deviation below ASYNC_DSSS_POOL_GHOST_STILL_HZ. A sidelobe sits on its parent's carrier a tile away, and the carrier loop, updating once a code period from a squaring combine, reads that modulo half the epoch rate. Two emitters' carriers move apart.
    • its Dll holds code lock in fewer than ASYNC_DSSS_POOL_GHOST_LOCK_FRAC of the window's periods: a sidelobe is not the code's triangle. Neither alone will do: a distinct emitter can co-move with another on the lattice (but holds code lock), and a true track near the floor loses code lock (but its carrier is its own). A ghost on its parent's own carrier (k = 0) is not this rule's: a true emitter sharing a stronger one's carrier looks the same (docs/design/async-dsss-receiver.md §8). It leaves by the loss release when both its lock flags are down, and is held while it decodes its parent's data (its symbol lock up). dp_async_dsss_pool_ghost_of() is the test. The ghost is reset to idle, its ring emptied. Whether the search seeds that cell again is the search's sidelobe rule (dp_async_dsss_receiver_set_rank()): it models one clean code period, and a data transition in the parent's epoch can read its sidelobes far above that, where only the gate stands, so a re-seed is a rate, not excluded (doppler#3263 measures it).
  • seeds the idle receivers. The search's picks of the period just fed, strongest first, go to the idle receivers in index order (dp_async_dsss_receiver_seed()), each with its code phase at the receivers' next sample.

  • sets the search's levers. Every holder's code phase, the ones just seeded included, becomes the search's exclusions (dp_async_dsss_receiver_set_exclusions()), so it never names a signal already held, and its pick count is the receivers still idle (one while none is, when the search is not fed). Both take effect at its next dwell.

  • Reports. status() is a receiver's status now, symbols() the symbols it emitted during the last push(); both are as of the last whole period fed, since the controller runs right after it, so a released receiver never reads lost.

Each restart of the search aligns its dwells to the block grid of the pool's stream (a fresh search is reset at its first period).

Lifecycle: create, then push() any number of times, reset() at any point, destroy.

>>> import numpy as np
>>> from doppler.dsss import AsyncDsssPool
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> pool = AsyncDsssPool(code, n_receivers=3, chip_rate=3.069e6,
...                      symbol_rate=2700.0, sample_rate=6.138e6,
...                      doppler_uncertainty=500.0, threads=1)
>>> pool.n_receivers
3
>>> pool.push(np.zeros(4096, dtype=np.complex64))   # holders: none
0
>>> [pool.status(i).state for i in range(3)]         # all idle
[3, 3, 3]

Public Functions Documentation

function dp_async_dsss_pool_create

Create a pool of n_receivers receivers built alike.

dp_async_dsss_pool_state_t * dp_async_dsss_pool_create (
    const uint8_t * code,
    size_t code_len,
    size_t n_receivers,
    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,
    int threads,
    bool refine
) 

Every parameter after n_receivers and before threads is dp_async_dsss_receiver_create()'s, passed through to each receiver unchanged; see it for each one's meaning, range and default. Each receiver's search engine is then set to one thread.

Parameters:

  • code Spreading code, 0/1 chips.
  • code_len Chips in code.
  • n_receivers Receivers, 1 to ASYNC_DSSS_POOL_MAX_RECEIVERS; the most signals the pool holds at once (default 3).
  • chip_rate Chip rate, Hz.
  • symbol_rate Symbol rate, Hz.
  • sample_rate The rate of the samples pushed, Hz: any ratio to chip_rate of at least one, or 0 for two samples a chip (AsyncDsssReceiver's).
  • m PSK order.
  • cn0_dbhz Design C/N0, dB-Hz.
  • pfa Search false-alarm probability.
  • pd Search detection probability.
  • doppler_uncertainty Doppler search half-range, Hz.
  • segments Dll segments per code period.
  • sps Demodulator samples per symbol.
  • differential Differential detection (nonzero) or coherent.
  • refine_max_error_db Refine stage's allowed loss, dB.
  • refine_samples_per_symbol Refine stage's samples per symbol.
  • refine_design_margin_db Refine stage's design margin, dB.
  • refine_n_fft Refine stage's FFT length.
  • refine_zero_pad Refine stage's zero-pad factor.
  • refine_sequential Refine stage's sequential mode.
  • refine_max_n_blocks Refine stage's block cap.
  • carrier_freq_hz RF carrier for code aiding, Hz; 0 = none.
  • lost_confirm_s The release rule's confirm time, s (default 2.0 here: a pool whose receivers never release never frees one). 0 = never lost.
  • reacquire The receiver's own release-to-search.
  • code_only_s Code-only window, s: sets the slow-time depth D.
  • doppler_rate Doppler rate bound, Hz/s.
  • threads Workers push() steps the receivers on, the calling thread included: 1 = serial, 0 = the online cores (default). The receivers' step uses at most n_receivers of them; the controller's search runs before them on the same request, at most one worker a Doppler tile, with its once-an-epoch stages inline and its once-a-block ones fanned when a block is more than one epoch (async-dsss-receiver.md §5).
  • refine The receivers' own refine: false hands a seed straight to tracking, and is refused, as the receiver refuses it, when the search's depth is under 25 (dp_async_dsss_receiver_create()). Default true.

Returns:

A new pool, every receiver idle; NULL on an invalid argument, or one any receiver refuses.

Note:

Caller must call dp_async_dsss_pool_destroy() when done.

>>> import numpy as np
>>> from doppler.dsss import AsyncDsssPool
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> pool = AsyncDsssPool(code, n_receivers=3, chip_rate=3.069e6,
...                      symbol_rate=2700.0, sample_rate=6.138e6,
...                      doppler_uncertainty=500.0, threads=1)
>>> (pool.n_receivers, pool.threads, pool.coherent_bins)
(3, 1, 1)
>>> AsyncDsssPool(code, n_receivers=17)    # one rank per peak: 16 at most
Traceback (most recent call last):
    ...
ValueError: AsyncDsssPool: refused: ...


function dp_async_dsss_pool_create_ccsds415

A pool of receivers at the CCSDS 415.1-B-1 specification point ( doppler/ccsds/ccsds_415.h ): theCcsds415Pool view.

dp_async_dsss_pool_state_t * dp_async_dsss_pool_create_ccsds415 (
    const uint8_t * code,
    size_t code_len,
    size_t n_receivers,
    double carrier_freq_hz,
    double lost_confirm_s,
    int threads,
    bool refine,
    const char ** why
) 

dp_async_dsss_pool_create() with the arguments dp_ccsds_415_rx() fills, as dp_async_dsss_receiver_create_ccsds415() reads them for one receiver.

Parameters:

  • code The mission's spreading code, one chip a byte (0/1): 1,023 chips. Any other length is refused.
  • code_len Its length; must be DP_CCSDS_415_SF.
  • n_receivers Receivers in the pool, 1 to ASYNC_DSSS_POOL_MAX_RECEIVERS.
  • carrier_freq_hz The carrier, F_fwd: 2.2 to 2.8 GHz at the point; built from DP_CCSDS_415_RX_FC_MIN to DP_CCSDS_415_RX_FC_MAX.
  • lost_confirm_s A receiver whose flags are down longer than this is released, as on the full create.
  • threads Worker threads; 0 is the pool's own choice.
  • refine The refine stage on (true) or off.
  • why Set to the refusal's sentence; may be NULL.

Returns:

The pool, or NULL with why set: dp_ccsds_415_rx()'s refusals, n_receivers out of range, or threads < 0.

>>> import numpy as np
>>> from doppler.dsss import Ccsds415Pool
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023), np.uint8)
>>> pool = Ccsds415Pool(code, n_receivers=2, carrier_freq_hz=2.8e9)
>>> pool.n_receivers
2

function dp_async_dsss_pool_destroy

Destroy a pool and every receiver.

void dp_async_dsss_pool_destroy (
    dp_async_dsss_pool_state_t * state
) 

Parameters:

  • state May be NULL.

function dp_async_dsss_pool_get_coherent_bins

The receivers' slow-time depth D, epochs per coherent block ( dp_async_dsss_receiver_get_coherent_bins() ); alike for all.

size_t dp_async_dsss_pool_get_coherent_bins (
    const dp_async_dsss_pool_state_t * state
) 

Parameters:

  • state Must be non-NULL.

Returns:

D, read from receiver 0.


function dp_async_dsss_pool_get_state

Write the state into blob: the clock, the release counts, the thread count (a mutator's value, #2022), the samples carried to the next whole period, the ghost rule's history (each receiver's carriers and code-lock flags over its window), and each receiver's state, and the search's, which carries the exclusions the controller gave it. The last push's symbols do not travel.

void dp_async_dsss_pool_get_state (
    const dp_async_dsss_pool_state_t * state,
    void * blob
) 

Parameters:


function dp_async_dsss_pool_get_threads

Workers push() steps the receivers on, the calling thread included: what set_threads() asked for, at most n_receivers, and the online cores for 0.

int dp_async_dsss_pool_get_threads (
    const dp_async_dsss_pool_state_t * state
) 

Parameters:

  • state Must be non-NULL.

Returns:

The effective worker count, >= 1.


function dp_async_dsss_pool_ghost_of

Whether receiver j tracks a Doppler-offset sidelobe of receiveri's signal, by the controller's ghost rule (header step 3) over the history it holds now.

int dp_async_dsss_pool_ghost_of (
    const dp_async_dsss_pool_state_t * state,
    size_t i,
    size_t j
) 

Both tests over the last ASYNC_DSSS_POOL_GHOST_WINDOW_S of controller steps: j's carrier minus i's has a mean within ASYNC_DSSS_POOL_GHOST_EPS_HZ of a nonzero multiple of lattice_hz and a standard deviation below ASYNC_DSSS_POOL_GHOST_STILL_HZ, and j held code lock in fewer than ASYNC_DSSS_POOL_GHOST_LOCK_FRAC of those steps. Both must have tracked the whole window. Which of the two is stronger is the controller's question, not this one's.

Parameters:

  • state Must be non-NULL.
  • i The stronger holder.
  • j The candidate ghost.

Returns:

1 if j is i's ghost; 0 otherwise, and for an index past the pool or i equal to j.


function dp_async_dsss_pool_push

Step every receiver on one block, running the controller at every group of code periods it completes.

size_t dp_async_dsss_pool_push (
    dp_async_dsss_pool_state_t * state,
    const float _Complex * x,
    size_t x_len
) 

Hands every whole group of ASYNC_DSSS_POOL_PERIODS_PER_JOIN code periods it completes to the search and every receiver, one period a call (header steps 1 and 2), keeps each one's symbols for symbols(), and after each group releases the lost, resolves duplicates, releases ghosts, seeds the idle receivers and sets the search's levers (step 3). The samples past the last whole group are kept for the next push. Accepts any block size, and state carries across calls: the result is a function of the stream, not of its blocking.

Parameters:

  • state Must be non-NULL.
  • x Input cf32 samples.
  • x_len Number of input samples.

Returns:

The receivers holding a signal (refining or tracking) at the end of the block.

>>> import numpy as np
>>> from doppler.dsss import AsyncDsssPool
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> pool = AsyncDsssPool(code, n_receivers=2, chip_rate=3.069e6,
...                      symbol_rate=2700.0, sample_rate=6.138e6,
...                      doppler_uncertainty=500.0, threads=1)
>>> pool.push(np.zeros(2046, dtype=np.complex64))
0


function dp_async_dsss_pool_receiver

Borrow receiver receiver , for C-only configuration: its chain settings (dp_async_dsss_receiver_configure_chain_raw() ), which every chain it builds keeps.

dp_async_dsss_receiver_state_t * dp_async_dsss_pool_receiver (
    const dp_async_dsss_pool_state_t * state,
    size_t receiver
) 

dp_async_dsss_receiver_configure_lock_raw() retunes only the Dll the receiver holds at the call: every seed and hand-over builds a fresh track chain with the derived lock sizing, so a lock set through the borrow on an idle receiver never reaches a tracking chain, and one set while tracking lasts until the next release. Call it on a tracking receiver, as its own header says, and again after each hand-over.

Not for telemetry: dp_async_dsss_pool_set_telemetry() is the one route that keeps a context to one producer. A borrowed receiver is pooled: it does not search, and the controller seeds it only from the search's picks.

Parameters:

  • state Must be non-NULL.
  • receiver 0 to n_receivers - 1.

Returns:

The receiver, owned by the pool; NULL past the pool.


function dp_async_dsss_pool_reset

Every receiver back to idle and the search to no exclusions; the clock, the release counts, the search's period count and the ghost history back to 0.

void dp_async_dsss_pool_reset (
    dp_async_dsss_pool_state_t * state
) 

Parameters:

  • state Must be non-NULL.
    >>> import numpy as np
    >>> from doppler.dsss import AsyncDsssPool
    >>> from doppler.wfm import Gold
    >>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
    >>> pool = AsyncDsssPool(code, chip_rate=3.069e6, symbol_rate=2700.0,
    ...                      sample_rate=6.138e6, doppler_uncertainty=500.0, threads=1)
    >>> _ = pool.push(np.zeros(2046, dtype=np.complex64))
    >>> pool.samples
    2046
    >>> pool.reset()
    >>> pool.samples
    0
    

function dp_async_dsss_pool_set_state

Restore the state, whole or not at all. DP_ERR_INVALID on a blob of another object or version, another receiver count, a carry of a group (ASYNC_DSSS_POOL_PERIODS_PER_JOIN periods) or more, a ghost history control() cannot leave (a length past the window, a flag other than 0 or 1, a nonzero entry outside a ring's span, or a history on a receiver not tracking), or a receiver blob its receiver refuses; a refusal leaves the pool and every receiver as they were.

int dp_async_dsss_pool_set_state (
    dp_async_dsss_pool_state_t * state,
    const void * blob
) 

Parameters:

Returns:

DP_OK, or DP_ERR_INVALID as above.


function dp_async_dsss_pool_set_telemetry

Attach (or detach) a telemetry context across every receiver.

int dp_async_dsss_pool_set_telemetry (
    dp_async_dsss_pool_state_t * state,
    dp_tlm_t * tlm,
    const char * prefix,
    uint32_t decim
) 

Receiver i reports under "<prefix>.r<i>" exactly as dp_async_dsss_receiver_set_telemetry() describes, on the one context. A context is single-producer, so this needs one producer: it is refused unless push() runs on one worker (get_threads() 1), and while a context is attached set_threads() refuses more. Parallel telemetry, one context per receiver, is doppler#2547.

Whole or nothing: every receiver's names must fit before any registers on tlm (they are first attached to a scratch context), and a refusal leaves the pool on its previous context, or detached. The attachment is a request kept on the pool, so a receiver the controller resets keeps reporting under the same names.

Parameters:

  • state Must be non-NULL.
  • tlm Context to attach, or NULL to detach every receiver.
  • prefix Probe-name prefix; NULL means "pool".
  • decim Emit every decim-th event on each probe; >= 1.

Returns:

DP_OK; DP_ERR_INVALID on more than one worker, decim 0, a prefix too long for a receiver's names, or no room for them.

>>> import numpy as np
>>> from doppler.dsss import AsyncDsssPool
>>> from doppler.telemetry import Telemetry
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> pool = AsyncDsssPool(code, n_receivers=2, chip_rate=3.069e6,
...                      symbol_rate=2700.0, sample_rate=6.138e6,
...                      doppler_uncertainty=500.0, threads=1)
>>> tlm = Telemetry(1 << 16)
>>> pool.set_telemetry(tlm, "pool")
>>> sorted(p for p in tlm.probe_names if p.endswith(".state"))
['pool.r0.state', 'pool.r1.state']


function dp_async_dsss_pool_set_threads

Set the workers push() steps the receivers on.

int dp_async_dsss_pool_set_threads (
    dp_async_dsss_pool_state_t * state,
    int n
) 

The receivers' results do not change with it (header step 2); only the time a push takes does. A mutator's value, so it travels in the state blob (#2022).

Parameters:

  • state Must be non-NULL.
  • n 1 = serial, 0 = the online cores; at most n_receivers run.

Returns:

DP_OK; DP_ERR_INVALID (unchanged) on a negative n, or on one that would run more than one worker while a telemetry context is attached (dp_async_dsss_pool_set_telemetry()).

>>> import numpy as np
>>> from doppler.dsss import AsyncDsssPool
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> pool = AsyncDsssPool(code, n_receivers=2, chip_rate=3.069e6,
...                      symbol_rate=2700.0, sample_rate=6.138e6,
...                      doppler_uncertainty=500.0)
>>> pool.set_threads(1)
>>> pool.threads
1


function dp_async_dsss_pool_state_bytes

Bytes in the blob dp_async_dsss_pool_get_state() writes: the envelope, the pool's own fields, and every receiver's own blob.

size_t dp_async_dsss_pool_state_bytes (
    const dp_async_dsss_pool_state_t * state
) 

Parameters:

  • state Must be non-NULL.

Returns:

The blob size in bytes; it depends on the receiver count, the code period and each receiver's own state size.


function dp_async_dsss_pool_status

Receiver receiver's status, now.

async_dsss_receiver_status_t dp_async_dsss_pool_status (
    const dp_async_dsss_pool_state_t * state,
    size_t receiver
) 

dp_async_dsss_receiver_status() of that receiver, as of the last whole code period fed, after the controller's step on it: a receiver the controller released reads idle. A receiver past the pool returns a zeroed record with state ASYNC_DSSS_POOL_NO_RECEIVER.

Parameters:

  • state Must be non-NULL.
  • receiver 0 to n_receivers - 1.

Returns:

The status record.

>>> import numpy as np
>>> from doppler.dsss import AsyncDsssPool
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> pool = AsyncDsssPool(code, n_receivers=2, chip_rate=3.069e6,
...                      symbol_rate=2700.0, sample_rate=6.138e6,
...                      doppler_uncertainty=500.0, threads=1)
>>> (pool.status(0).state, pool.status(2).state)  # 3 idle; 2 is past
(3, -1)


function dp_async_dsss_pool_symbols

The symbols receiver receiver emitted during the last push().

size_t dp_async_dsss_pool_symbols (
    const dp_async_dsss_pool_state_t * state,
    size_t receiver,
    float _Complex * out,
    size_t max_out
) 

Empty for a receiver that was idle, refining or lost throughout the push, and for a receiver past the pool. Tracking emits symbols whether or not they are a signal's (dp_async_dsss_receiver_steps()): read status().locked for that. A push replaces them, and set_state() and reset() clear them.

Parameters:

  • state Must be non-NULL.
  • receiver 0 to n_receivers - 1.
  • out Output symbols.
  • max_out Capacity of out; the symbols past it are not written.

Returns:

Symbols written.

>>> import numpy as np
>>> from doppler.dsss import AsyncDsssPool
>>> from doppler.wfm import Gold
>>> code = np.asarray(Gold().generate(1023)).astype(np.uint8)
>>> pool = AsyncDsssPool(code, n_receivers=2, chip_rate=3.069e6,
...                      symbol_rate=2700.0, sample_rate=6.138e6,
...                      doppler_uncertainty=500.0, threads=1)
>>> _ = pool.push(np.zeros(2046, dtype=np.complex64))
>>> pool.symbols(0).size                    # idle: nothing yet
0


function dp_async_dsss_pool_symbols_max_out

The most symbols symbols() can return: the largest count any receiver emitted during the last push().

size_t dp_async_dsss_pool_symbols_max_out (
    const dp_async_dsss_pool_state_t * state
) 

Parameters:

  • state Must be non-NULL.

Returns:

The largest per-receiver symbol count from the last push(); 0 before the first push and after reset() or set_state().


Macro Definition Documentation

define ASYNC_DSSS_POOL_GHOST_EPS_HZ

#define ASYNC_DSSS_POOL_GHOST_EPS_HZ `10.0`

How near the lattice the mean carrier delta must sit, Hz.


define ASYNC_DSSS_POOL_GHOST_LOCK_FRAC

#define ASYNC_DSSS_POOL_GHOST_LOCK_FRAC `0.2`

The code-lock fraction a ghost holds below: of the window's steps, the share with status().code_locked set.


define ASYNC_DSSS_POOL_GHOST_STILL_HZ

#define ASYNC_DSSS_POOL_GHOST_STILL_HZ `10.0`

The stillness limit: the carrier delta's standard deviation over the window must be below this, Hz.


define ASYNC_DSSS_POOL_GHOST_WINDOW_S

#define ASYNC_DSSS_POOL_GHOST_WINDOW_S `0.2`

The ghost rule's window, s: the trailing span both its tests read (doppler#2529).


define ASYNC_DSSS_POOL_MAX_RECEIVERS

#define ASYNC_DSSS_POOL_MAX_RECEIVERS `ASYNC_DSSS_RX_MAX_PEAKS`

Most receivers a pool runs: one pick per peak a dwell reports (ASYNC_DSSS_RX_MAX_PEAKS), so every idle receiver can be seeded from one dwell.


define ASYNC_DSSS_POOL_NO_RECEIVER

#define ASYNC_DSSS_POOL_NO_RECEIVER `(-1)`

status().state for a receiver index past the pool: no such receiver.


define ASYNC_DSSS_POOL_PERIODS_PER_JOIN

#define ASYNC_DSSS_POOL_PERIODS_PER_JOIN `16u`

Code periods the receivers step between joins: push() feeds the search and every receiver M periods at a time, on a grid of M periods counted from create or reset, each receiver call still one period, and the controller runs once at the end of each M (async-dsss-receiver.md §5). Joining once a period cost about 18 of the pool's 60 ns a sample at the 415.1-B-1 point (nine receivers tracking, the search running), so fewer joins is the pool's main cost lever. At 16: make bench-ab A=967275d78 (its commit, 3b41f5dd1), the push row at 415.1 with K = 9 and 16 threads: 54 to 43.5 ns a sample at 2.2 GHz and 66 to 43.2 at 2.8 GHz, on one host (the dev box), with a CONFIRM run and no row slower in both. The size is that measurement's, not derived (doppler#2778).


define ASYNC_DSSS_POOL_STATE_MAGIC

#define ASYNC_DSSS_POOL_STATE_MAGIC `DP_FOURCC ('A', 'D', 'P', 'L')`

FourCC type tag ("ADPL") stamped in a pool state blob's header.


define ASYNC_DSSS_POOL_STATE_VERSION

#define ASYNC_DSSS_POOL_STATE_VERSION `/* multi line expression */`

Layout version of the pool state blob; a mismatch is rejected. v4, not 3: 'ADPL' v3 was the cell-receiver pool this one replaced (v0.48.0 - v0.73.0), and v0.74.0 shipped this pool as v2. Each version of a magic names one layout, so this pool steps past every number the magic has carried (#2569; scripts/check_state_versions.py).



The documentation for this class was generated from the following file native/inc/doppler/async_dsss_pool/async_dsss_pool_core.h