GNU Radio 3.7.1 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2011,2012 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_LMS_DD_EQUALIZER_CC_H 00024 #define INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H 00025 00026 #include <gnuradio/digital/api.h> 00027 #include <gnuradio/sync_decimator.h> 00028 #include <gnuradio/digital/constellation.h> 00029 00030 namespace gr { 00031 namespace digital { 00032 00033 /*! 00034 * \brief Least-Mean-Square Decision Directed Equalizer (complex in/out) 00035 * \ingroup equalizers_blk 00036 * 00037 * \details 00038 * This block implements an LMS-based decision-directed equalizer. 00039 * It uses a set of weights, w, to correlate against the inputs, 00040 * u, and a decisions is then made from this output. The error in 00041 * the decision is used to update the weight vector. 00042 * 00043 * y[n] = conj(w[n]) u[n] 00044 * d[n] = decision(y[n]) 00045 * e[n] = d[n] - y[n] 00046 * w[n+1] = w[n] + mu u[n] conj(e[n]) 00047 * 00048 * Where mu is a gain value (between 0 and 1 and usualy small, 00049 * around 0.001 - 0.01. 00050 * 00051 * This block uses the digital_constellation object for making the 00052 * decision from y[n]. Create the constellation object for 00053 * whatever constellation is to be used and pass in the object. 00054 * In Python, you can use something like: 00055 * 00056 * self.constellation = digital.constellation_qpsk() 00057 * 00058 * To create a QPSK constellation (see the digital_constellation 00059 * block for more details as to what constellations are available 00060 * or how to create your own). You then pass the object to this 00061 * block as an sptr, or using "self.constellation.base()". 00062 * 00063 * The theory for this algorithm can be found in Chapter 9 of: 00064 * S. Haykin, Adaptive Filter Theory, Upper Saddle River, NJ: 00065 * Prentice Hall, 1996. 00066 */ 00067 class DIGITAL_API lms_dd_equalizer_cc : 00068 virtual public sync_decimator 00069 { 00070 protected: 00071 virtual gr_complex error(const gr_complex &out) = 0; 00072 virtual void update_tap(gr_complex &tap, const gr_complex &in) = 0; 00073 00074 public: 00075 // gr::digital::lms_dd_equalizer_cc::sptr 00076 typedef boost::shared_ptr<lms_dd_equalizer_cc> sptr; 00077 00078 /*! 00079 * Make an LMS decision-directed equalizer 00080 * 00081 * \param num_taps Numer of taps in the equalizer (channel size) 00082 * \param mu Gain of the update loop 00083 * \param sps Number of samples per symbol of the input signal 00084 * \param cnst A constellation derived from class 00085 * 'constellation'. Use base() method to get a shared pointer to 00086 * this base class type. 00087 */ 00088 static sptr make(int num_taps, 00089 float mu, int sps, 00090 constellation_sptr cnst); 00091 00092 virtual void set_taps(const std::vector<gr_complex> &taps) = 0; 00093 virtual std::vector<gr_complex> taps() const = 0; 00094 virtual float gain() const = 0; 00095 virtual void set_gain(float mu) = 0; 00096 }; 00097 00098 } /* namespace digital */ 00099 } /* namespace gr */ 00100 00101 #endif /* INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H */