GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
costas_loop_cc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006,2011,2012,2014 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_COSTAS_LOOP_CC_H
12 #define INCLUDED_DIGITAL_COSTAS_LOOP_CC_H
13 
15 #include <gnuradio/digital/api.h>
16 #include <gnuradio/sync_block.h>
17 
18 namespace gr {
19 namespace digital {
20 
21 /*!
22  * \brief A Costas loop carrier recovery module.
23  * \ingroup synchronizers_blk
24  *
25  * \details
26  * The Costas loop locks to the center frequency of a signal and
27  * downconverts it to baseband.
28  *
29  * \li When order=2: used for BPSK where the real part of the
30  * output signal is the baseband BPSK signal and the imaginary
31  * part is the error signal.
32  *
33  * \li When order=4: can be used for QPSK where both I and Q (real
34  * and imaginary) are outputted.
35  *
36  * \li When order=8: used for 8PSK.
37  *
38  * More details can be found online:
39  *
40  * J. Feigin, "Practical Costas loop design: Designing a simple
41  * and inexpensive BPSK Costas loop carrier recovery circuit," RF
42  * signal processing, pp. 20-36, 2002.
43  *
44  * http://rfdesign.com/images/archive/0102Feigin20.pdf
45  *
46  * The Costas loop can have two output streams:
47  * \li stream 1 (required) is the baseband I and Q;
48  * \li stream 2 (optional) is the normalized frequency of the loop
49  *
50  * There is a single optional message input:
51  * \li noise: A noise floor estimate used to calculate the SNR of a sample.
52  */
53 class DIGITAL_API costas_loop_cc : virtual public sync_block,
54  virtual public blocks::control_loop
55 {
56 public:
57  // gr::digital::costas_loop_cc::sptr
58  typedef std::shared_ptr<costas_loop_cc> sptr;
59 
60  /*!
61  * Make a Costas loop carrier recovery block.
62  *
63  * \param loop_bw internal 2nd order loop bandwidth (~ 2pi/100)
64  * \param order the loop order, either 2, 4, or 8
65  * \param use_snr Use or ignore SNR estimates (from noise message port)
66  * in measurements; also uses tanh instead of slicing.
67  */
68  static sptr make(float loop_bw, unsigned int order, bool use_snr = false);
69 
70  /*!
71  * Returns the current value of the loop error.
72  */
73  virtual float error() const = 0;
74 };
75 
76 } /* namespace digital */
77 } /* namespace gr */
78 
79 #endif /* INCLUDED_DIGITAL_COSTAS_LOOP_CC_H */
A second-order control loop implementation class.
Definition: control_loop.h:51
A Costas loop carrier recovery module.
Definition: costas_loop_cc.h:55
virtual float error() const =0
static sptr make(float loop_bw, unsigned int order, bool use_snr=false)
std::shared_ptr< costas_loop_cc > sptr
Definition: costas_loop_cc.h:58
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
GNU Radio logging wrapper.
Definition: basic_block.h:29