Replace the C stdio calls in the GNSS-SDR.dump_flowgraph code with
std::ofstream. This removes the reliance on <cstdio>, <cstring> and
<cerrno>, which were only included transitively, and closes the file
on every path.
A failure to open or write the file is now reported with a single
warning, and the success message is logged only if the file was
actually written.
With libc++, clang-tidy suggests replacing std::vector<float>(n, 0.0F)
with {n, 0.0F}, which would select the initializer_list constructor.
Return the zero-initialized LLR vector instead.
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.
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.
Contrary to ICD, these satellites actually broadcast B2a (OTA upgraded
in the orbit).
Verified by decoding live signal in realtime configuration.
Signed-off-by: Vladislav P <vladisslav2011@gmail.com>
SatelliteVisibility::PredictedDopplerHz() previously required a live PVT
fix and was only used for a satellite's primary signal
(GNSSFlowgraph::acquisition_manager()). Two extensions:
1. Secondary signals (e.g. GPS L5, Galileo E5a) can now use the same
geometric prediction, opt-in per acquisition role via
<acq role>.alm_ephe_assisted_doppler_narrowing (default false). It's
only reached at all when dual-frequency assist is unavailable or
disabled (GNSS-SDR.assist_dual_frequency_acq=false), and is a distinct,
less-proven Doppler source than that dual-frequency projection, hence
opt-in rather than defaulted on.
2. Before a live fix exists, PredictedDopplerHz() can now predict from the
AGNSS reference position (zero assumed velocity) and the configured
nominal clock offset, opt-in via GNSS-SDR.doppler_prediction_before_fix
(default false). A new PredictedDopplerUncertaintyHz() reports the
Doppler spread implied by GNSS-SDR.receiver_max_velocity_m_s and
GNSS-SDR.clock_frequency_max_error_ppm for this pre-fix case (zero once
a fix exists, since position/velocity/clock are all solved then, not
assumed) -- the caller widens its acquisition Doppler-bin search by this
amount instead of trusting a single, possibly-wrong bin.
Verified against an EVK1029 GPS L5 capture (single-band, so every L5
channel is a secondary signal): with both flags enabled, the almanac-based
prediction narrows acquisition Doppler search before and after the fix,
logged via a new low-noise [alm_ephe_doppler] line; with them left at
their defaults, behavior is unchanged from before this change.
SatelliteVisibility::PredictedDopplerHz() gates its live-fix path on a
freshness check against last_fix_time_s_/last_fix_receiver_time_s_, both of
which are only stamped by SatelliteVisibility::Tick() (called from
GNSSFlowgraph::MaybeUpdateVisibility()).
In ControlThread::event_dispatcher(), acquisition_manager() -- which calls
PredictedDopplerHz() -- ran before MaybeUpdateVisibility() in the same
iteration. Since PVT updates roughly once per second, PredictedDopplerHz()
was therefore always comparing against a timestamp exactly one PVT epoch
stale, failing its own freshness check on every single call once a live
fix existed. The prediction only ever succeeded in the brief window right
after a periodic full visibility recompute happened to re-trigger a fresh
pick synchronously within the same call.
Reordering so MaybeUpdateVisibility() (and therefore Tick()'s stamping)
runs before acquisition_manager() each iteration fixes this: the timestamp
PredictedDopplerHz() checks is always current for the epoch it's
evaluating. acquisition_manager()'s existing "only when idle" gate is
preserved exactly (previously the implicit else of the valid_event check,
now an explicit !valid_event condition).
Verified against an EVK1029 GPS L5 capture with visibility-aware search
and almanac-based Doppler prediction enabled: before this fix, the
prediction log line never appeared after the first fix except in narrow
bursts tied to the ~120s full-recompute interval; after, it fires
continuously for every still-unlocked visible satellite each cycle.
GPS/QZSS UTC model, ionosphere and almanac data are broadcast system-wide
parameters, not specific to the L1 C/A signal -- L5 and L2C channels rely on
the exact same almanac (via the PRN-keyed map PVT and the visibility/
Doppler-assist logic read from) for visibility classification and Doppler
prediction just as much as L1 C/A does.
read_assistance_from_XML() gated the whole GPS ephemeris/UTC/iono/almanac
block on Channels_1C.count/Channels_J1.count alone. A configuration running
only L5 and/or L2C channels (no L1 C/A) never even attempted to load its
almanac, UTC or iono XML files -- not because those files were missing or
invalid, but because the code never asked for them, unconditionally reporting
"Error reading XML files" / "Disabling GNSS assistance" even with perfectly
valid assistance data on disk.
Broaden the gate to also fire when Channels_2S.count (L2C) or
Channels_L5.count is > 0, matching the same OR-together-all-constellation-
signals pattern already used for the Galileo block just below it. The L1 C/A
LNAV ephemeris load stays in this same block; L5/L2C use their own
separately-gated CNAV ephemeris further down, and requesting the LNAV
ephemeris is harmless when no L1 C/A channel exists to use it.
The flowgraph read Acquisition_<signal>.dual_freq_assisted_doppler_narrowing
unconditionally, but GetChannel() instantiates the acquisition block from
Acquisition_<signal><channel> whenever that per-channel role defines an
.implementation, so a receiver configured with per-channel acquisition
roles would have had the flag read from a role the block was never built
from.
Expose get_role_name() from block_factory and use it in
acquisition_manager() to look the property up on the same role the block
was instantiated with, so the opt-out can be set per signal or, with a
per-channel role, per channel.
Acquisition_<signal>.dual_freq_assisted_doppler_narrowing (default
true, preserving current behavior) lets a specific signal's
acquisition be forced back to a full, unaided Doppler search even
while GNSS-SDR.assist_dual_frequency_acq is enabled for the other
signals. Knowingly reintroduces part of what f7948f4af retired under
#1097, under a clearer name -- see PR description for the regression
and spoofing-resilience evidence motivating it.