![]() |
GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
|
Histogram-based navigation data bit synchronizer. More...
#include <bit_synchronizer.h>
Classes | |
| struct | Config |
| Configuration parameters for HistogramBitSynchronizer. More... | |
Public Member Functions | |
| HistogramBitSynchronizer (const Config &cfg) | |
| Construct a histogram bit synchronizer with the provided configuration. | |
| void | reset () |
| Reset the synchronizer state. | |
| bool | update (const std::complex< float > &prompt, bool tracking_quality_ok) |
| Update the synchronizer once per epoch. | |
| bool | locked () const |
| Query whether the synchronizer has achieved lock. | |
| int | edge_phase () const |
| Get the estimated bit edge phase bin. | |
| bool | is_edge_epoch (std::int64_t k) const |
| Predict whether a given epoch index corresponds to a bit edge. | |
| int | bins () const |
| Return the number of histogram bins. | |
| const std::vector< int > & | get_histogram () const |
| Access the internal histogram (read-only). | |
| std::int64_t | get_total_events () const |
| Total number of detected transition events accumulated into the histogram. | |
| std::int64_t | get_epoch_count () const |
| Total number of epochs processed by update(). | |
| int | epochs_until_next_edge () const |
| Return the number of epochs until the next predicted navigation bit edge. | |
Histogram-based navigation data bit synchronizer.
Definition at line 34 of file bit_synchronizer.h.
|
inlineexplicit |
Construct a histogram bit synchronizer with the provided configuration.
Initializes internal counters and allocates the histogram with bins() entries, all set to zero.
| cfg | Configuration parameters. |
Definition at line 148 of file bit_synchronizer.h.
References bins().
| int HistogramBitSynchronizer::bins | ( | ) | const |
Return the number of histogram bins.
Derived from the bit period and epoch duration, e.g.: bins = bit_period_ms / epoch_ms
Referenced by HistogramBitSynchronizer().
|
inline |
Get the estimated bit edge phase bin.
The edge phase is expressed as an integer histogram bin index in the range [0, bins()-1] when locked. The interpretation is “which epoch phase within the bit period is most likely to contain a navigation bit transition.”
Definition at line 213 of file bit_synchronizer.h.
| int HistogramBitSynchronizer::epochs_until_next_edge | ( | ) | const |
Return the number of epochs until the next predicted navigation bit edge.
When the synchronizer is locked, this function computes the forward distance (in epochs) from the most recently processed epoch to the next epoch that is aligned with the estimated bit-edge phase.
The result is expressed modulo the bit period and has the following meaning:
The computation is based on the internal epoch counter advanced by update(), assuming that update() is called once per epoch with a constant cadence equal to Config::epoch_ms.
If the synchronizer is not locked, or if the configuration yields an invalid number of bins, this function returns -1.
|
inline |
Total number of epochs processed by update().
This counter increments once per call to update(), regardless of whether a transition is detected or whether tracking_quality_ok is true.
Definition at line 264 of file bit_synchronizer.h.
|
inline |
Access the internal histogram (read-only).
Each entry counts how many detected candidate transitions occurred at the corresponding phase bin within the bit period.
Definition at line 247 of file bit_synchronizer.h.
|
inline |
Total number of detected transition events accumulated into the histogram.
Definition at line 254 of file bit_synchronizer.h.
| bool HistogramBitSynchronizer::is_edge_epoch | ( | std::int64_t | k | ) | const |
Predict whether a given epoch index corresponds to a bit edge.
For a given epoch index k (0-based), this function returns true when k is aligned with the currently estimated edge phase (i.e., the predicted transition epoch), and false otherwise.
If not locked, this always returns false.
| k | Epoch index (0-based, consistent with the caller's epoch counting). |
k is the predicted edge epoch; false otherwise.
|
inline |
Query whether the synchronizer has achieved lock.
Definition at line 202 of file bit_synchronizer.h.
| void HistogramBitSynchronizer::reset | ( | ) |
Reset the synchronizer state.
Clears the histogram and all internal counters/flags, returning the instance to the pre-lock state:
| bool HistogramBitSynchronizer::update | ( | const std::complex< float > & | prompt, |
| bool | tracking_quality_ok ) |
Update the synchronizer once per epoch.
This method should be called at a fixed cadence defined by Config::epoch_ms
The method:
| prompt | Prompt correlator output for the current epoch. |
| tracking_quality_ok | Indicates whether tracking quality is sufficient to trust the prompt sample for transition detection (e.g., code/carrier lock metrics). |