The BeiDou DNAV and GLONASS GNAV decoders find from the sign of the
preamble (or time mark) correlation that the carrier loop is locked
180 degrees off and invert the symbols they decode, but they never set
Flag_PLL_180_deg_phase_locked, so the flag that reaches the
observables is the one the tracking block set.
Keep the sign of the last frame that passed its CRC check and, as the
GPS and Galileo decoders do, report it in
Flag_PLL_180_deg_phase_locked and add half a cycle to the carrier
phase while it is set.
The new unit tests feed BeiDou D1 subframes and GLONASS strings,
normal and inverted, to the decoders and check the reported flag and
carrier phase, a polarity change, and a GLONASS string that fails its
Hamming check.
Signed-off-by: Oleksandr Suvorov <cryosay@gmail.com>
Initialize both candidate totals to zero and sum the absolute residuals
from every satellite. Add six-satellite ordering and four-observation
noiseless regression tests to the PVT test suite.
Fixesgnss-sdr/gnss-sdr#1000
Signed-off-by: daoyyy7777 <354528186+daoyyy7777@users.noreply.github.com>
Extend the change of the previous merge to the remaining tracking
blocks: kf_tracking and gps_l1_ca_gaussian_tracking_cc (binary dump and
.mat file; records grow from 96 to 100 bytes), and the GPS L1 C/A and
Galileo E1 TCP connector and GPS L1 C/A GPU blocks (records grow from 88
to 92 bytes). The Galileo E1 TCP connector block accumulated the carrier
phase in a float, which is now a double.
Update the KF readers in utils/matlab and utils/python accordingly.
Tracking_Dump_Reader now takes the record layout, since the FPGA and
Gaussian tests read dumps that lack the TOW and WN fields (and, for the
Gaussian block, have the carrier noise variance in place of the code
frequency rate) with the dll_pll_veml_tracking layout.
Add a CHANGELOG entry.
Resolve the conflicts with the deterministic processing mode: keep the
deterministic loss-of-lock dispatch together with the "forced" suffix in
the loss-of-lock log line, and convert the two deterministic telemetry
fault paths in dll_pll_veml_tracking and kf_tracking, which still forced
the loss of lock by writing 200000 into the carrier lock fail counter,
to d_force_loss_of_lock.
Remove the conflict markers left in docs/CHANGELOG.md by the merge of
the deterministic branch, and add a CHANGELOG entry for this fix.
Add a deterministic processing mode for recorded signals
Processing the same file twice was not repeatable, even with
Acquisition_XX.blocking=true: the control thread started searches,
assigned satellites and applied channel events at whatever sample
each block had reached, and the PVT and observables applied each
other's messages whenever they arrived.
With GNSS-SDR.deterministic=true (default: false), events and
messages carry the sample at which they happened, the control
thread handles channel events in sample order, and their effects
take place a fixed lookahead later (deterministic_lookahead_ms,
default 100 ms). A gate at the Signal Conditioner output keeps the
stream within that horizon, blocks take their stamped messages at
the start of each work call, maintenance runs on signal time
(deterministic_tick_ms), and the receiver stops once the whole
input has reached the PVT. Dumps, RINEX, NMEA, KML, GPX and GeoJSON
outputs are then bit-identical from run to run on the same machine
(same FFTW wisdom and VOLK configuration), whatever the CPU load.
Supported: all file sources (throttled or not, including LabSat,
EVK1029 and ION), all acquisitions except assisted and FPGA, and
the DLL/PLL VEML, KF and Gaussian trackers. Live front ends, HAS
and NTRIP corrections, strict OSNMA, Galileo E6 with the TOW map,
GNSS assistance and visibility-aware search are refused.
The Monitor is fed from the Observables, which since ed5a75e31 fill
channels without a valid time reference with their latest tracking
data. That never worked in Galileo E6-only configurations: the GPS L1
C/A, GPS L5, Galileo, BeiDou D1/D2 and BeiDou B1C telemetry decoders
produced no output until they decoded the time of week, so the
Observables never received E6 tracking data. The GLONASS, GPS L2C,
BeiDou B2a and SBAS decoders already forwarded every symbol with
Flag_valid_word unset; now all telemetry decoders do. Dumps,
telemetry_to_trk and nav-data monitor messages are still issued only
with a valid time of week.
The tracking-only entries also had fs set to 0, which gnss-sdr-monitor
takes as an empty channel, hiding SBAS channels. fs is now kept, with
the validity flags still unset; the PVT only uses observations with
Flag_valid_pseudorange.
As a side effect, the secondary-band acquisition assistance can use a
primary-band channel as soon as its tracking locks, instead of after
its time of week is decoded. The Galileo F/NAV test sink now records
the first item with a valid word.
Alternative to PR #1122, without new options or changes to tracking
and to the PVT time-of-week reset handling. Related to #1018.
log_data() in dll_pll_veml_tracking and dll_pll_veml_tracking_fpga casts
d_acc_carrier_phase_rad, a double, to float before writing it to the
binary dump, and save_matfile() reads it back as a float. The
accumulated phase grows by 2*pi times the Doppler shift every second
(about 31400 rad/s at 5 kHz), so it reaches 1e6 rad after about 30 s of
tracking at 5 kHz, or under 3 minutes at 1 kHz. The float spacing is
0.0625 rad at 1e6 rad, 0.25 rad at 3e6 rad and 1 rad at 1e7 rad. At
3e6 rad, for instance, the phase difference between two 1 ms epochs of
the dump is only known to within +/-0.25 rad, about 40 Hz in frequency
terms. The phase used by the receiver (Gnss_Synchro::Carrier_phase_rads)
is a double and is not affected; only the dump is.
Write the field as a double, and read it back as a double in
save_matfile(), so that the .mat file also holds a double.
This changes the dump record layout. The field keeps its position but
grows from 4 to 8 bytes, so a record is now 112 bytes long in
dll_pll_veml_tracking (it was 108) and 100 bytes long in
dll_pll_veml_tracking_fpga (it was 96). The readers of this format are
updated accordingly: Tracking_Dump_Reader, used by the unit tests, and
dll_pll_veml_read_tracking_dump in utils/matlab and utils/python.
Signed-off-by: ObvMamut <obvmamut@proton.me>
Two fail-safes in the tracking blocks force a loss of lock: the bit or
secondary code synchronization time limit
(bit_synchronization_time_limit_s), and the telemetry fault message sent
by the telemetry decoders. Both did it by writing a large value into
d_carrier_lock_fail_counter (300000 and 200000, respectively) and
relying on the lock check to find it above max_carrier_lock_fail. When
max_carrier_lock_fail is configured above those values, neither
fail-safe drops the channel: unless the lock detectors drop it for
other reasons, a channel that never achieves bit synchronization keeps
tracking past the time limit, and a channel whose telemetry decoder
reports a fault keeps tracking.
Replace the magic counter values with a d_force_loss_of_lock flag. Both
fail-safes set it, cn0_and_tracking_lock_status() declares the loss of
lock when it is set, whatever the lock fail counters, and it is cleared
when the loss of lock is declared and when a new tracking attempt
starts. The loss-of-lock log line now says when the loss was forced,
since the counter values no longer show it.
The same change is applied to dll_pll_veml_tracking,
dll_pll_veml_tracking_fpga and kf_tracking, the three blocks that used
this pattern.
Add two tests to trk_test that set max_carrier_lock_fail = 1000000 and
check that a telemetry fault and the synchronization time limit still
drop the channel.
Signed-off-by: ObvMamut <obvmamut@proton.me>
A one-code-period PCPS window starts at an arbitrary code phase, so a
secondary-code or data sign transition at the code epoch inside it
splits the correlation peak up to +-0.74/T away from the true Doppler.
For GPS L5 (the I5 NH10 code changes sign at 6 of every 10 epochs),
about 40 % of the acquisitions started tracking 250-900 Hz off. The
1 ms Costas loop then either held a false lock at exactly +-500 Hz
(lock test 0.97, C/N0 3.9 dB low, secondary-code sync impossible)
until bit_synchronization_time_limit_s, or never locked and lost lock
a few seconds after pull-in.
After a positive decision, refine_doppler() despreads the dwells with
the replica aligned to the detected code epoch, scores the two sides
of the epoch under both sign hypotheses (summed non-coherently over
dwells), and re-estimates the Doppler over +-1/T around the grid peak.
It only runs on positive acquisitions, so its cost is negligible, also
with the CUDA grid. It applies to every pcps_acquisition search over
one code period without bit_transition_flag. The new
Acquisition_XX.refine_doppler parameter (default true) disables it.
Replace the fixed 20 ms limit on SignalConditioner.batch_size_ms and
max_batch_latency_ms. A configured batch is accepted if it is no longer
than the automatic one (min(10 ms, observable_interval_ms)), or if the
buffer it needs (whole batches, with room for one on top of the largest
reader window) fits the alignment budget: the signal time channels can
trail the receiver clock before the observables miss epochs. Batches
are also limited to 4 MiB, since GNU Radio allocates two of them on
each side of the batching block.
At observable_interval_ms=20 and 4 MSps gr_complex this allows about
90 ms instead of 20 ms. At 5 ms it now rejects batches that the old
limit let through. In automatic mode, an explicit max_batch_latency_ms
sets the batch size, so that batch gets the same check. Defaults are
unchanged.
Select batch targets from sample rate, latency and memory limits, and
consumer buffer requirements. Replace eligible pass-through stages before
channel fan-out without machine-specific profiles or configuration edits.
Preserve samples and tags across partial batches, deadlines, and EOF.
Handle conditioned output ports consistently and clean up stream and
message connections on disconnect or connection failure.
If the multi-channel fixture setup fails on thread 0 (no CUDA device,
or out of device memory at high channel counts), thread 0 skips and
returns before the timed loop. Google Benchmark then releases the other
threads from the start barrier, and they call compute_grid() on engines
that were never created, which crashes the whole benchmark binary.
Add a ready flag that setup() sets only on success. Every thread checks
it at the top of the timed loop, which is the first point where threads
1..N-1 can see the outcome of the setup, and skips the run instead.
Also add the missing <string> include for the fixture's error member.
The existing cases time a single engine, but each acquisition block owns
its own engine and CUDA stream, so the figure that bounds how many
channels can search at once is the aggregate rate with several engines
resident on the device.
Add bm_pcps_grid_cuda_channels, which gives every benchmark thread its
own engine, wipe-off grid and output buffers, and sweeps 1 to 8 threads.
Rate counters are summed across threads and are fed the iteration count
already totaled over threads, so kAvgThreads yields the aggregate device
rate and a 1/channels scale yields the per-channel rate; both were
checked against the reported per-thread time.
On a Jetson Orin Nano at 4000 samples and 41 Doppler bins the aggregate
rate is 2757, 3839, 5943 and 5307 dwells/s for 1, 2, 4 and 8 channels,
so the device saturates at about four concurrent channels.
Signed-off-by: Phillip Vu <36169227+phillipvu@users.noreply.github.com>
Covers the exact configuration the fix is for: GNSS-SDR.internal_fs_sps
not a multiple of 1 kHz (4000123 Hz), coherent_integration_time_ms (4)
spanning more than one code period (GPS L1 C/A's own code period is
1 ms), and max_dwells (5) > 1. Asserts a successful acquisition and
checks the reported Doppler/delay against the known synthetic signal's
truth, with tolerances the dwell-boundary drift this fix addresses
would clearly exceed.
Registering it in acq_test (tests/CMakeLists.txt) surfaced that the
target had apparently never actually linked successfully in this
environment before: it links FirFilter/SignalGenerator/GenSignalSource
but was missing input_filter_adapters/signal_generator_adapters/
signal_source_adapters, and separately hit a Linux-only undefined
libboost_thread symbol inside the system's packaged
libgnuradio-runtime.so, fixed with the standard
--copy-dt-needed-entries linker workaround (guarded to Linux only).
Neither is specific to this new test; fixing them was necessary to
build and run the suite at all, and the rest of acq_test (20 tests
total) now passes too.
Preserve the candidate anchor until its expected confirmation point.
Replace it only after confirmation is missed, preventing payload
correlations from repeatedly displacing a valid preamble.