GNU Radio Manual and C++ API Reference  3.7.13.4
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  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_DIGITAL_COSTAS_LOOP_CC_H
24 #define INCLUDED_DIGITAL_COSTAS_LOOP_CC_H
25 
26 #include <gnuradio/digital/api.h>
28 #include <gnuradio/sync_block.h>
29 
30 namespace gr {
31  namespace digital {
32 
33  /*!
34  * \brief A Costas loop carrier recovery module.
35  * \ingroup synchronizers_blk
36  *
37  * \details
38  * The Costas loop locks to the center frequency of a signal and
39  * downconverts it to baseband.
40  *
41  * \li When order=2: used for BPSK where the real part of the
42  * output signal is the baseband BPSK signal and the imaginary
43  * part is the error signal.
44  *
45  * \li When order=4: can be used for QPSK where both I and Q (real
46  * and imaginary) are outputted.
47  *
48  * \li When order=8: used for 8PSK.
49  *
50  * More details can be found online:
51  *
52  * J. Feigin, "Practical Costas loop design: Designing a simple
53  * and inexpensive BPSK Costas loop carrier recovery circuit," RF
54  * signal processing, pp. 20-36, 2002.
55  *
56  * http://rfdesign.com/images/archive/0102Feigin20.pdf
57  *
58  * The Costas loop can have two output streams:
59  * \li stream 1 (required) is the baseband I and Q;
60  * \li stream 2 (optional) is the normalized frequency of the loop
61  *
62  * There is a single optional message input:
63  * \li noise: A noise floor estimate used to calculate the SNR of a sample.
64  */
66  : virtual public sync_block,
67  virtual public blocks::control_loop
68  {
69  public:
70  // gr::digital::costas_loop_cc::sptr
71  typedef boost::shared_ptr<costas_loop_cc> sptr;
72 
73  /*!
74  * Make a Costas loop carrier recovery block.
75  *
76  * \param loop_bw internal 2nd order loop bandwidth (~ 2pi/100)
77  * \param order the loop order, either 2, 4, or 8
78  * \param use_snr Use or ignore SNR estimates (from noise message port)
79  * in measurements; also uses tanh instead of slicing.
80  */
81  static sptr make(float loop_bw, int order, bool use_snr=false);
82 
83  /*!
84  * Returns the current value of the loop error.
85  */
86  virtual float error() const = 0;
87  };
88 
89  } /* namespace digital */
90 } /* namespace gr */
91 
92 #endif /* INCLUDED_DIGITAL_COSTAS_LOOP_CC_H */
A Costas loop carrier recovery module.
Definition: costas_loop_cc.h:65
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:30
boost::shared_ptr< costas_loop_cc > sptr
Definition: costas_loop_cc.h:71
Include this header to use the message passing features.
Definition: logger.h:695
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
A second-order control loop implementation class.
Definition: control_loop.h:61