GNU Radio 3.5.1 C++ API
digital_clock_recovery_mm_cc.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2004,2011 Free Software Foundation, Inc.
00004  *
00005  * This file is part of GNU Radio
00006  *
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  *
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H
00024 #define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H
00025 
00026 #include <digital_api.h>
00027 #include <gr_block.h>
00028 #include <gr_complex.h>
00029 #include <gr_math.h>
00030 
00031 class gri_mmse_fir_interpolator_cc;
00032 
00033 class digital_clock_recovery_mm_cc;
00034 typedef boost::shared_ptr<digital_clock_recovery_mm_cc> digital_clock_recovery_mm_cc_sptr;
00035 
00036 // public constructor
00037 DIGITAL_API digital_clock_recovery_mm_cc_sptr 
00038 digital_make_clock_recovery_mm_cc (float omega, float gain_omega,
00039                                    float mu, float gain_mu,
00040                                    float omega_relative_limit=0.001);
00041 
00042 /*!
00043  * \brief Mueller and Müller (M&M) based clock recovery block with complex input, complex output.
00044  * \ingroup sync_blk
00045  * \ingroup digital
00046  *
00047  * This implements the Mueller and Müller (M&M) discrete-time
00048  * error-tracking synchronizer.
00049  *
00050  * The complex version here is based on:
00051  * Modified Mueller and Muller clock recovery circuit
00052  * Based:
00053  *    G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller
00054  *    and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22
00055  *    June 1995, pp. 1032 - 1033.
00056  */
00057 class DIGITAL_API digital_clock_recovery_mm_cc : public gr_block
00058 {
00059  public:
00060   ~digital_clock_recovery_mm_cc ();
00061   void forecast(int noutput_items, gr_vector_int &ninput_items_required);
00062   int general_work (int noutput_items,
00063                     gr_vector_int &ninput_items,
00064                     gr_vector_const_void_star &input_items,
00065                     gr_vector_void_star &output_items);
00066   float mu() const { return d_mu;}
00067   float omega() const { return d_omega;}
00068   float gain_mu() const { return d_gain_mu;}
00069   float gain_omega() const { return d_gain_omega;}
00070   void set_verbose (bool verbose) { d_verbose = verbose; }
00071 
00072   void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
00073   void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
00074   void set_mu (float mu) { d_mu = mu; }
00075   void set_omega (float omega) { 
00076     d_omega = omega;
00077     d_min_omega = omega*(1.0 - d_omega_relative_limit);
00078     d_max_omega = omega*(1.0 + d_omega_relative_limit);
00079     d_omega_mid = 0.5*(d_min_omega+d_max_omega);
00080   }
00081 
00082 protected:
00083   digital_clock_recovery_mm_cc (float omega, float gain_omega,
00084                                 float mu, float gain_mu,
00085                                 float omega_relative_limi);
00086 
00087  private:
00088   float                         d_mu;
00089   float                         d_omega;
00090   float                         d_gain_omega;
00091   float                         d_min_omega;            // minimum allowed omega
00092   float                         d_max_omega;            // maximum allowed omeg
00093   float                         d_omega_relative_limit; // used to compute min and max omega
00094   float                         d_omega_mid;
00095   float                         d_gain_mu;
00096   gr_complex                    d_last_sample;
00097   gri_mmse_fir_interpolator_cc  *d_interp;
00098   bool                          d_verbose;
00099 
00100   gr_complex                    d_p_2T;
00101   gr_complex                    d_p_1T;
00102   gr_complex                    d_p_0T;
00103 
00104   gr_complex                    d_c_2T;
00105   gr_complex                    d_c_1T;
00106   gr_complex                    d_c_0T;
00107 
00108   gr_complex slicer_0deg (gr_complex sample);
00109   gr_complex slicer_45deg (gr_complex sample);
00110 
00111   friend DIGITAL_API digital_clock_recovery_mm_cc_sptr
00112   digital_make_clock_recovery_mm_cc (float omega, float gain_omega,
00113                                      float mu, float gain_mu, 
00114                                      float omega_relative_limit);
00115 };
00116 
00117 #endif