GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
corr_est_cc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_DIGITAL_CORR_EST_CC_CC_H
12 #define INCLUDED_DIGITAL_CORR_EST_CC_CC_H
13 
14 #include <gnuradio/digital/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace digital {
19 
20 /*!
21  * \brief Correlate stream with a pre-defined sequence and estimate peak
22  * \ingroup synchronizers_blk
23  *
24  * \details
25  * Input:
26  * \li Stream of complex samples.
27  *
28  * Output:
29  * \li Output stream that just passes the input complex samples
30  * \li tag 'phase_est': estimate of phase offset
31  * \li tag 'time_est': estimate of symbol timing offset
32  * \li tag 'corr_est': the correlation value of the estimates
33  * \li tag 'amp_est': 1 over the estimated amplitude
34  * \li tag 'corr_start': the start sample of the correlation and the value
35  *
36  * \li Optional 2nd output stream providing the advanced correlator output
37  *
38  * This block is designed to search for a sync word by correlation
39  * and uses the results of the correlation to get a time and phase
40  * offset estimate. These estimates are passed downstream as
41  * stream tags for use by follow-on synchronization blocks.
42  *
43  * The sync word is provided as a set of symbols after being
44  * filtered by a baseband matched filter.
45  *
46  * The phase_est tag can be used by downstream blocks to adjust
47  * their phase estimator/correction loops, and is currently
48  * implemented by the gr::digital::costas_loop_cc block.
49  *
50  * The time_est tag can be used to adjust the sampling timing
51  * estimate of any downstream synchronization blocks and is
52  * currently implemented by the gr::digital::pfb_clock_sync_ccf
53  * block.
54  *
55  * The caller must provide a "time_est" and "phase_est" tag
56  * marking delay from the start of the correlated signal segment,
57  * in order to mark the proper point in the sync word for
58  * downstream synchronization blocks. Generally this block cannot
59  * know where the actual sync word symbols are located relative to
60  * "corr_start", given that some modulations have pulses with
61  * intentional ISI. The user should manually examine the primary
62  * output and the "corr_start" tag position to determine the
63  * required tag delay settings for the particular modulation,
64  * sync word, and downstream blocks used.
65  *
66  * For a discussion of the properties of complex correlations,
67  * with respect to signal processing, see:
68  * Marple, Jr., S. L., "Estimating Group Delay and Phase Delay
69  * via Discrete-Time 'Analytic' Cross-Correlation, _IEEE_Transcations_
70  * _on_Signal_Processing_, Volume 47, No. 9, September 1999
71  *
72  */
73 typedef enum {
76 } tm_type;
77 
78 class DIGITAL_API corr_est_cc : virtual public sync_block
79 {
80 public:
81  typedef std::shared_ptr<corr_est_cc> sptr;
82 
83  /*!
84  * Make a block that correlates against the \p symbols vector
85  * and outputs a phase and symbol timing estimate.
86  *
87  * \param symbols Set of symbols to correlate against (e.g., a
88  * sync word).
89  * \param sps Samples per symbol
90  * \param mark_delay tag marking delay in samples after the
91  * corr_start tag
92  * \param threshold Threshold of correlator.
93  * The meaning of this parameter depends on the threshold
94  * method used. For DYNAMIC threshold method, this
95  * parameter is actually 1 - Probability of False
96  * Alarm (under some inaccurate assumptions). The
97  * code performs the check
98  * |r[k]|^2 + |r[k+1]|^2 <> -log(1-threshold)*2*E,
99  * where r[k] is the correlated incoming signal,
100  * and E is the average sample energy of the
101  * correlated signal. For ABSOLUTE threshold method,
102  * this parameter sets the threshold to a fraction
103  * of the maximum squared autocorrelation. The code
104  * performs the check |r[k]|^2 <> threshold * R^2,
105  * where R is the precomputed max autocorrelation
106  * of the given sync word. Default is 0.9
107  * \param threshold_method Method for computing threshold.
108  */
109  static sptr make(const std::vector<gr_complex>& symbols,
110  float sps,
111  unsigned int mark_delay,
112  float threshold = 0.9,
113  tm_type threshold_method = THRESHOLD_ABSOLUTE);
114 
115  virtual std::vector<gr_complex> symbols() const = 0;
116  virtual void set_symbols(const std::vector<gr_complex>& symbols) = 0;
117 
118  virtual unsigned int mark_delay() const = 0;
119  virtual void set_mark_delay(unsigned int mark_delay) = 0;
120 
121  virtual float threshold() const = 0;
122  virtual void set_threshold(float threshold) = 0;
123 };
124 
125 } // namespace digital
126 } // namespace gr
127 
128 #endif /* INCLUDED_DIGITAL_CORR_EST_CC_H */
Definition: corr_est_cc.h:79
virtual unsigned int mark_delay() const =0
virtual void set_mark_delay(unsigned int mark_delay)=0
static sptr make(const std::vector< gr_complex > &symbols, float sps, unsigned int mark_delay, float threshold=0.9, tm_type threshold_method=THRESHOLD_ABSOLUTE)
virtual float threshold() const =0
std::shared_ptr< corr_est_cc > sptr
Definition: corr_est_cc.h:81
virtual void set_symbols(const std::vector< gr_complex > &symbols)=0
virtual std::vector< gr_complex > symbols() const =0
virtual void set_threshold(float threshold)=0
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:18
tm_type
Correlate stream with a pre-defined sequence and estimate peak.
Definition: corr_est_cc.h:73
@ THRESHOLD_ABSOLUTE
Definition: corr_est_cc.h:75
@ THRESHOLD_DYNAMIC
Definition: corr_est_cc.h:74
GNU Radio logging wrapper.
Definition: basic_block.h:29