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