GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
fll_band_edge_cc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2009,2011,2012 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_FLL_BAND_EDGE_CC_H
24 #define INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H
25 
27 #include <gnuradio/digital/api.h>
28 #include <gnuradio/sync_block.h>
29 
30 namespace gr {
31 namespace digital {
32 
33 /*!
34  * \brief Frequency Lock Loop using band-edge filters
35  * \ingroup synchronizers_blk
36  *
37  * \details
38  * The frequency lock loop derives a band-edge filter that covers
39  * the upper and lower bandwidths of a digitally-modulated
40  * signal. The bandwidth range is determined by the excess
41  * bandwidth (e.g., rolloff factor) of the modulated signal. The
42  * placement in frequency of the band-edges is determined by the
43  * oversampling ratio (number of samples per symbol) and the
44  * excess bandwidth. The size of the filters should be fairly
45  * large so as to average over a number of symbols.
46  *
47  * The FLL works by filtering the upper and lower band edges into
48  * x_u(t) and x_l(t), respectively. These are combined to form
49  * cc(t) = x_u(t) + x_l(t) and ss(t) = x_u(t) - x_l(t). Combining
50  * these to form the signal e(t) = Re{cc(t) \\times ss(t)^*}
51  * (where ^* is the complex conjugate) provides an error signal at
52  * the DC term that is directly proportional to the carrier
53  * frequency. We then make a second-order loop using the error
54  * signal that is the running average of e(t).
55  *
56  * In practice, the above equation can be simplified by just
57  * comparing the absolute value squared of the output of both
58  * filters: abs(x_l(t))^2 - abs(x_u(t))^2 = norm(x_l(t)) -
59  * norm(x_u(t)).
60  *
61  * In theory, the band-edge filter is the derivative of the
62  * matched filter in frequency, (H_be(f) = frac{H(f)}{df}). In
63  * practice, this comes down to a quarter sine wave at the point
64  * of the matched filter's rolloff (if it's a raised-cosine, the
65  * derivative of a cosine is a sine). Extend this sine by another
66  * quarter wave to make a half wave around the band-edges is
67  * equivalent in time to the sum of two sinc functions. The
68  * baseband filter for the band edges is therefore derived from
69  * this sum of sincs. The band edge filters are then just the
70  * baseband signal modulated to the correct place in
71  * frequency. All of these calculations are done in the
72  * 'design_filter' function.
73  *
74  * Note: We use FIR filters here because the filters have to have
75  * a flat phase response over the entire frequency range to allow
76  * their comparisons to be valid.
77  *
78  * It is very important that the band edge filters be the
79  * derivatives of the pulse shaping filter, and that they be
80  * linear phase. Otherwise, the variance of the error will be very
81  * large.
82  */
83 class DIGITAL_API fll_band_edge_cc : virtual public sync_block,
84  virtual public blocks::control_loop
85 {
86 public:
87  // gr::digital::fll_band_edge_cc::sptr
88  typedef boost::shared_ptr<fll_band_edge_cc> sptr;
89 
90  /*!
91  * Make an FLL block.
92  *
93  * \param samps_per_sym (float) number of samples per symbol
94  * \param rolloff (float) Rolloff (excess bandwidth) of signal filter
95  * \param filter_size (int) number of filter taps to generate
96  * \param bandwidth (float) Loop bandwidth
97  */
98  static sptr
99  make(float samps_per_sym, float rolloff, int filter_size, float bandwidth);
100 
101  /*******************************************************************
102  SET FUNCTIONS
103  *******************************************************************/
104 
105  /*!
106  * \brief Set the number of samples per symbol
107  *
108  * Set's the number of samples per symbol the system should
109  * use. This value is used to calculate the filter taps and will
110  * force a recalculation.
111  *
112  * \param sps (float) new samples per symbol
113  */
114  virtual void set_samples_per_symbol(float sps) = 0;
115 
116  /*!
117  * \brief Set the rolloff factor of the shaping filter
118  *
119  * This sets the rolloff factor that is used in the pulse
120  * shaping filter and is used to calculate the filter
121  * taps. Changing this will force a recalculation of the filter
122  * taps.
123  *
124  * This should be the same value that is used in the
125  * transmitter's pulse shaping filter. It must be between 0 and
126  * 1 and is usually between 0.2 and 0.5 (where 0.22 and 0.35 are
127  * commonly used values).
128  *
129  * \param rolloff (float) new shaping filter rolloff factor [0,1]
130  */
131  virtual void set_rolloff(float rolloff) = 0;
132 
133  /*!
134  * \brief Set the number of taps in the filter
135  *
136  * This sets the number of taps in the band-edge
137  * filters. Setting this will force a recalculation of the
138  * filter taps.
139  *
140  * This should be about the same number of taps used in the
141  * transmitter's shaping filter and also not very large. A large
142  * number of taps will result in a large delay between input and
143  * frequency estimation, and so will not be as accurate. Between
144  * 30 and 70 taps is usual.
145  *
146  * \param filter_size (float) number of taps in the filters
147  */
148  virtual void set_filter_size(int filter_size) = 0;
149 
150  /*******************************************************************
151  GET FUNCTIONS
152  *******************************************************************/
153 
154  /*!
155  * \brief Returns the number of sampler per symbol used for the filter
156  */
157  virtual float samples_per_symbol() const = 0;
158 
159  /*!
160  * \brief Returns the rolloff factor used for the filter
161  */
162  virtual float rolloff() const = 0;
163 
164  /*!
165  * \brief Returns the number of taps of the filter
166  */
167  virtual int filter_size() const = 0;
168 
169  /*!
170  * Print the taps to screen.
171  */
172  virtual void print_taps() = 0;
173 };
174 
175 } /* namespace digital */
176 } /* namespace gr */
177 
178 #endif /* INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H */
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:30
boost::shared_ptr< fll_band_edge_cc > sptr
Definition: fll_band_edge_cc.h:88
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
Frequency Lock Loop using band-edge filters.
Definition: fll_band_edge_cc.h:83
A second-order control loop implementation class.
Definition: control_loop.h:61