GNU Radio 3.6.4 C++ API
digital_clock_recovery_mm_cc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2011 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_CLOCK_RECOVERY_MM_CC_H
24 #define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H
25 
26 #include <digital_api.h>
27 #include <gr_block.h>
28 #include <gr_complex.h>
29 #include <gr_math.h>
30 
32 
35 
36 // public constructor
39  float mu, float gain_mu,
40  float omega_relative_limit=0.001);
41 
42 /*!
43  * \brief Mueller and Müller (M&M) based clock recovery block with complex input, complex output.
44  * \ingroup sync_blk
45  * \ingroup digital
46  *
47  * This implements the Mueller and Müller (M&M) discrete-time
48  * error-tracking synchronizer.
49  *
50  * The complex version here is based on:
51  * Modified Mueller and Muller clock recovery circuit
52  * Based:
53  * G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller
54  * and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22
55  * June 1995, pp. 1032 - 1033.
56  */
58 {
59  public:
61  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
62  int general_work (int noutput_items,
63  gr_vector_int &ninput_items,
64  gr_vector_const_void_star &input_items,
65  gr_vector_void_star &output_items);
66  float mu() const { return d_mu;}
67  float omega() const { return d_omega;}
68  float gain_mu() const { return d_gain_mu;}
69  float gain_omega() const { return d_gain_omega;}
70  void set_verbose (bool verbose) { d_verbose = verbose; }
71 
72  void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
73  void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
74  void set_mu (float mu) { d_mu = mu; }
75  void set_omega (float omega) {
76  d_omega = omega;
77  d_min_omega = omega*(1.0 - d_omega_relative_limit);
78  d_max_omega = omega*(1.0 + d_omega_relative_limit);
79  d_omega_mid = 0.5*(d_min_omega+d_max_omega);
80  }
81 
82 protected:
83  digital_clock_recovery_mm_cc (float omega, float gain_omega,
84  float mu, float gain_mu,
85  float omega_relative_limi);
86 
87  private:
88  float d_mu;
89  float d_omega;
90  float d_gain_omega;
91  float d_min_omega; // minimum allowed omega
92  float d_max_omega; // maximum allowed omeg
93  float d_omega_relative_limit; // used to compute min and max omega
94  float d_omega_mid;
95  float d_gain_mu;
96  gr_complex d_last_sample;
98  bool d_verbose;
99 
100  gr_complex d_p_2T;
101  gr_complex d_p_1T;
102  gr_complex d_p_0T;
103 
104  gr_complex d_c_2T;
105  gr_complex d_c_1T;
106  gr_complex d_c_0T;
107 
108  gr_complex slicer_0deg (gr_complex sample);
109  gr_complex slicer_45deg (gr_complex sample);
110 
112  digital_make_clock_recovery_mm_cc (float omega, float gain_omega,
113  float mu, float gain_mu,
114  float omega_relative_limit);
115 };
116 
117 #endif