GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
The Free & Open Software Radio Ecosystem
symbol_sync_cc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright (C) 2017 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_SYMBOL_SYNC_CC_H
12 #define INCLUDED_DIGITAL_SYMBOL_SYNC_CC_H
13 
14 #include <gnuradio/block.h>
15 #include <gnuradio/digital/api.h>
19 
20 namespace gr {
21 namespace digital {
22 
23 /*!
24  * \brief Symbol Synchronizer block with complex input, complex output.
25  * \ingroup synchronizers_blk
26  *
27  * \details
28  * This implements a discrete-time error-tracking synchronizer.
29  *
30  * For this block to work properly, the input stream must meet the
31  * following requirements:
32  *
33  * 1. if not using the PFB Matched Filter interpolator, and using
34  * a non-CPM timing error detector, the input pulses must have peaks
35  * (not flat), which usually can be implemented by using a matched
36  * filter before this block.
37  *
38  * 2. for decision directed timing error detectors, the input pulses
39  * should nominally match the normalized slicer constellation, which
40  * is normalized to an average symbol magnitude of 1.0 over the entire
41  * constellation.
42  */
43 class DIGITAL_API symbol_sync_cc : virtual public block
44 {
45 public:
46  // gr::digital::symbol_sync_cc::sptr
47  typedef std::shared_ptr<symbol_sync_cc> sptr;
48 
49  /*!
50  * Make a Symbol Synchronizer block.
51  *
52  * \details
53  * This implements a discrete-time error-tracking synchronizer.
54  *
55  * For this block to work properly, the input stream must meet the
56  * following requirements:
57  *
58  * 1. if not using the PFB Matched Filter interpolator, and using
59  * a non-CPM timing error detector, the input pulses must have peaks
60  * (not flat), which usually can be implemented by using a matched
61  * filter before this block.
62  *
63  * 2. for decision directed timing error detectors, the input pulses
64  * should nominally match the normalized slicer constellation, which
65  * is normalized to an average symbol magnitude of 1.0 over the entire
66  * constellation.
67  *
68  * \param detector_type
69  * The enumerated type of timing error detector to use.
70  * See enum ted_type for a list of possible types.
71  *
72  * \param sps
73  * User specified nominal clock period in samples per symbol.
74  *
75  * \param loop_bw
76  * Approximate normailzed loop bandwidth of the symbol clock tracking
77  * loop. It should nominally be close to 0, but greater than 0. If
78  * unsure, start with a number around 2*pi*0.040, and experiment to find
79  * the value that works best for your situation.
80  *
81  * \param damping_factor
82  * Damping factor of the symbol clock tracking loop.
83  * Damping < 1.0f is an under-damped loop.
84  * Damping = 1.0f/sqrt(2.0f) is a maximally flat loop response.
85  * Damping = 1.0f is a critically-damped loop.
86  * Damping > 1.0f is an over-damped loop.
87  *
88  * \param ted_gain
89  * Expected gain of the timing error detector, given the TED in use
90  * and the anticipated input amplitude, pulse shape, and Es/No.
91  * This value is the slope of the TED's S-curve at timing offset tau = 0.
92  * This value is normally computed by the user analytically or by
93  * simulation in a tool outside of GNURadio.
94  * This value must be correct for the loop filter gains to be computed
95  * properly from the desired input loop bandwidth and damping factor.
96  *
97  * \param max_deviation
98  * Maximum absolute deviation of the average clock period estimate
99  * from the user specified nominal clock period in samples per symbol.
100  *
101  * \param osps
102  * The number of output samples per symbol (default=1).
103  *
104  * \param slicer
105  * A constellation obj shared pointer that will be used by
106  * decision directed timing error detectors to make decisions.
107  * I.e. the timing error detector will use this constellation
108  * as a slicer, if the particular algorithm needs sliced
109  * symbols.
110  *
111  * \param interp_type
112  * The enumerated type of interpolating resampler to use.
113  * See the interpolating resampler type enum for a list of possible types.
114  *
115  * \param n_filters
116  * The number of arms in the polyphase filterbank of the interpolating
117  * resampler, if using an interpolating resampler that uses a PFB.
118  *
119  * \param taps
120  * The prototype filter for the polyphase filterbank of the interpolating
121  * resampler, if using an interpolating resampler that uses a PFB.
122  */
123  static sptr make(enum ted_type detector_type,
124  float sps,
125  float loop_bw,
126  float damping_factor = 1.0f,
127  float ted_gain = 1.0f,
128  float max_deviation = 1.5f,
129  int osps = 1,
130  constellation_sptr slicer = constellation_sptr(),
131  ir_type interp_type = IR_MMSE_8TAP,
132  int n_filters = 128,
133  const std::vector<float>& taps = std::vector<float>());
134 
135  /*!
136  * \brief Returns the normalized approximate loop bandwidth.
137  *
138  * \details
139  * See the documentation for set_loop_bandwidth() for more details.
140  *
141  * Note that if set_alpha() or set_beta() were called to directly
142  * set gains, the value returned by this method will be inaccurate/stale.
143  */
144  virtual float loop_bandwidth() const = 0;
145 
146  /*!
147  * \brief Returns the loop damping factor.
148  *
149  * \details
150  * See the documentation for set_damping_factor() for more details.
151  *
152  * Note that if set_alpha() or set_beta() were called to directly
153  * set gains, the value returned by this method will be inaccurate/stale.
154  */
155  virtual float damping_factor() const = 0;
156 
157  /*!
158  * \brief Returns the user provided expected gain of the Timing Error
159  * Detector.
160  *
161  * \details
162  * See the documentation for set_ted_gain() for more details.
163  */
164  virtual float ted_gain() const = 0;
165 
166  /*!
167  * \brief Returns the PI filter proportional gain, alpha.
168  *
169  * \details
170  * See the documentation for set_alpha() for more details.
171  */
172  virtual float alpha() const = 0;
173 
174  /*!
175  * \brief Returns the PI filter integral gain, beta.
176  *
177  * \details
178  * See the documentation for set_beta() for more details.
179  */
180  virtual float beta() const = 0;
181 
182  /*!
183  * \brief Set the normalized approximate loop bandwidth.
184  *
185  * \details
186  * Set the normalized approximate loop bandwidth.
187  * Useful values are usually close to 0.0, e.g. 2*pi*0.045.
188  *
189  * It should be a small positive number, corresponding to the normalized
190  * natural radian frequency of the loop as digital low-pass filter that is
191  * filtering the clock phase/timing error.
192  *
193  * Technically this parameter corresponds to the natural radian frequency
194  * of the 2nd order loop transfer function (scaled by Fs),
195  * which is the radius of the pole locations in the s-plane of an
196  * underdamped analog 2nd order system.
197  *
198  * The input parameter corresponds to omega_n_norm in the following
199  * relation:
200  *
201  * omega_n_norm = omega_n*T = 2*pi*f_n*T = 2*pi*f_n_norm
202  *
203  * where T is the period of the clock being estimated by this
204  * clock tracking loop, and omega_n is the natural radian frequency
205  * of the 2nd order loop transfer function.
206  *
207  * When a new loop bandwidth is set, the gains, alpha and beta,
208  * of the loop are automatically recalculated.
209  *
210  * \param omega_n_norm normalized approximate loop bandwidth
211  */
212  virtual void set_loop_bandwidth(float omega_n_norm) = 0;
213 
214  /*!
215  * \brief Set the loop damping factor.
216  *
217  * \details
218  * Set the damping factor of the loop.
219  * Damping in the range (0.0, 1.0) yields an under-damped loop.
220  * Damping in the range (1.0, Inf) yields an over-damped loop.
221  * Damping equal to 1.0 yields a crtically-damped loop.
222  * Damping equal to 1.0/sqrt(2.0) yields a maximally flat
223  * loop filter response.
224  *
225  * Damping factor of the 2nd order loop transfer function.
226  * When a new damping factor is set, the gains, alpha and beta,
227  * of the loop are automatically recalculated.
228  *
229  * \param zeta loop damping factor
230  */
231  virtual void set_damping_factor(float zeta) = 0;
232 
233  /*!
234  * \brief Set the expected gain of the Timing Error Detector.
235  *
236  * \details
237  * Sets the expected gain of the timing error detector, given the TED in
238  * use and the anticipated input amplitude, pulse shape, and Es/No.
239  * This value is the slope of the TED's S-curve at timing offset tau = 0.
240  * This value is normally computed by the user analytically or by
241  * simulation in a tool outside of GNURadio.
242  * This value must be correct for the loop filter gains to be computed
243  * properly from the desired input loop bandwidth and damping factor.
244  *
245  * When a new ted_gain is set, the gains, alpha and beta,
246  * of the loop are automatically recalculated.
247  *
248  * \param ted_gain expected gain of the timing error detector
249  */
250  virtual void set_ted_gain(float ted_gain) = 0;
251 
252  /*!
253  * \brief Set the PI filter proportional gain, alpha.
254  *
255  * \details
256  * Sets the PI filter proportional gain, alpha.
257  * This gain directly mutliplies the clock phase/timing error
258  * term in the PI filter when advancing the loop.
259  * It most directly affects the instantaneous clock period estimate,
260  * T_inst, and instantaneous clock phase estimate, tau.
261  *
262  * This value would normally be adjusted by setting the loop
263  * bandwidth and damping factor. However,
264  * it can be set here directly if desired.
265  *
266  * Setting this parameter directly is probably only feasible if
267  * the user is directly observing the estimates of average clock
268  * period and instantaneous clock period over time in response to
269  * an impulsive change in the input stream (i.e. watching the loop
270  * transient behavior at the start of a data burst).
271  *
272  * \param alpha PI filter proportional gain
273  */
274  virtual void set_alpha(float alpha) = 0;
275 
276  /*!
277  * \brief Set the PI filter integral gain, beta.
278  *
279  * \details
280  * Sets the PI filter integral gain, beta.
281  * This gain is used when integrating the clock phase/timing error
282  * term in the PI filter when advancing the loop.
283  * It most directly affects the average clock period estimate,
284  * T_avg.
285  *
286  * This value would normally be adjusted by setting the loop
287  * bandwidth and damping factor. However,
288  * it can be set here directly if desired.
289  *
290  * Setting this parameter directly is probably only feasible if
291  * the user is directly observing the estimates of average clock
292  * period and instantaneous clock period over time in response to
293  * an impulsive change in the input stream (i.e. watching the loop
294  * transient behavior at the start of a data burst).
295  *
296  * \param beta PI filter integral gain
297  */
298  virtual void set_beta(float beta) = 0;
299 };
300 
301 } /* namespace digital */
302 } /* namespace gr */
303 
304 #endif /* INCLUDED_DIGITAL_SYMBOL_SYNC_CC_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:60
Symbol Synchronizer block with complex input, complex output.
Definition: symbol_sync_cc.h:44
static sptr make(enum ted_type detector_type, float sps, float loop_bw, float damping_factor=1.0f, float ted_gain=1.0f, float max_deviation=1.5f, int osps=1, constellation_sptr slicer=constellation_sptr(), ir_type interp_type=IR_MMSE_8TAP, int n_filters=128, const std::vector< float > &taps=std::vector< float >())
virtual void set_damping_factor(float zeta)=0
Set the loop damping factor.
virtual float loop_bandwidth() const =0
Returns the normalized approximate loop bandwidth.
virtual void set_alpha(float alpha)=0
Set the PI filter proportional gain, alpha.
virtual float damping_factor() const =0
Returns the loop damping factor.
virtual void set_ted_gain(float ted_gain)=0
Set the expected gain of the Timing Error Detector.
virtual float beta() const =0
Returns the PI filter integral gain, beta.
std::shared_ptr< symbol_sync_cc > sptr
Definition: symbol_sync_cc.h:47
virtual void set_beta(float beta)=0
Set the PI filter integral gain, beta.
virtual void set_loop_bandwidth(float omega_n_norm)=0
Set the normalized approximate loop bandwidth.
virtual float alpha() const =0
Returns the PI filter proportional gain, alpha.
virtual float ted_gain() const =0
Returns the user provided expected gain of the Timing Error Detector.
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:18
static constexpr float taps[NSTEPS+1][NTAPS]
Definition: interpolator_taps.h:9
ted_type
Definition: timing_error_detector_type.h:18
ir_type
Definition: interpolating_resampler_type.h:18
@ IR_MMSE_8TAP
Definition: interpolating_resampler_type.h:20
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:29