GNU Radio 3.7.1 C++ API
ofdm_equalizer_base.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /* Copyright 2012 Free Software Foundation, Inc.
00003  * 
00004  * This file is part of GNU Radio
00005  * 
00006  * GNU Radio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3, or (at your option)
00009  * any later version.
00010  * 
00011  * GNU Radio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with GNU Radio; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef INCLUDED_DIGITAL_OFDM_EQUALIZER_BASE_H
00023 #define INCLUDED_DIGITAL_OFDM_EQUALIZER_BASE_H
00024 
00025 #include <gnuradio/digital/api.h>
00026 #include <gnuradio/tags.h>
00027 #include <gnuradio/gr_complex.h>
00028 #include <boost/enable_shared_from_this.hpp>
00029 
00030 namespace gr {
00031   namespace digital {
00032 
00033     /* \brief Base class for implementation details of frequency-domain OFDM equalizers.
00034      * \ingroup ofdm_blk
00035      * \ingroup equalizers_blk
00036      */
00037     class DIGITAL_API ofdm_equalizer_base
00038       : public boost::enable_shared_from_this<ofdm_equalizer_base>
00039     {
00040      protected:
00041       int d_fft_len;
00042       int d_carr_offset;
00043 
00044      public:
00045       typedef boost::shared_ptr<ofdm_equalizer_base> sptr;
00046 
00047       ofdm_equalizer_base(int fft_len);
00048       virtual ~ofdm_equalizer_base();
00049 
00050       //! Reset the channel information state knowledge
00051       virtual void reset() = 0;
00052       //! Set the carrier offset in integer multiples
00053       void set_carrier_offset(int offset) { d_carr_offset = offset; };
00054       virtual void equalize(
00055                       gr_complex *frame,
00056                       int n_sym,
00057                       const std::vector<gr_complex> &initial_taps = std::vector<gr_complex>(),
00058                       const std::vector<tag_t> &tags = std::vector<tag_t>()) = 0;
00059       //! Return the current channel state
00060       virtual void get_channel_state(std::vector<gr_complex> &taps) = 0;
00061       int fft_len() { return d_fft_len; };
00062       sptr base() { return shared_from_this(); };
00063     };
00064 
00065 
00066     /* \brief Base class for implementation details of 1-dimensional OFDM FDEs which use pilot tones.
00067      * \ingroup digital
00068      *
00069      */
00070     class DIGITAL_API ofdm_equalizer_1d_pilots : public ofdm_equalizer_base
00071     {
00072      protected:
00073       //! If \p d_occupied_carriers[k][l] is true, symbol k, carrier l is carrying data.
00074       //  (this is a different format than occupied_carriers!)
00075       std::vector<bool> d_occupied_carriers;
00076       //! If \p d_pilot_carriers[k][l] is true, symbol k, carrier l is carrying data.
00077       //  (this is a different format than pilot_carriers!)
00078       std::vector<std::vector<bool> > d_pilot_carriers;
00079       //! If \p d_pilot_carriers[k][l] is true, d_pilot_symbols[k][l] is its tx'd value.
00080       //  (this is a different format than pilot_symbols!)
00081       std::vector<std::vector<gr_complex> > d_pilot_symbols;
00082       //! In case the frame doesn't begin with OFDM symbol 0, this is the index of the first symbol
00083       int d_symbols_skipped;
00084       //! The current position in the set of pilot symbols
00085       int d_pilot_carr_set;
00086       //! Vector of length d_fft_len saving the current channel state (on the occupied carriers)
00087       std::vector<gr_complex> d_channel_state;
00088 
00089      public:
00090       typedef boost::shared_ptr<ofdm_equalizer_1d_pilots> sptr;
00091 
00092       ofdm_equalizer_1d_pilots(
00093           int fft_len,
00094           const std::vector<std::vector<int> > &occupied_carriers,
00095           const std::vector<std::vector<int> > &pilot_carriers,
00096           const std::vector<std::vector<gr_complex> > &pilot_symbols,
00097           int symbols_skipped,
00098           bool input_is_shifted);
00099       ~ofdm_equalizer_1d_pilots();
00100 
00101       void reset();
00102       void get_channel_state(std::vector<gr_complex> &taps);
00103     };
00104 
00105   } /* namespace digital */
00106 } /* namespace gr */
00107 
00108 #endif /* INCLUDED_DIGITAL_OFDM_EQUALIZER_BASE_H */
00109