GNU Radio v3.6.2-149-ga6d285d9 C++ API
channel_model.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2009,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_FILTER_CHANNEL_MODEL_H
00024 #define INCLUDED_FILTER_CHANNEL_MODEL_H
00025 
00026 #include <filter/api.h>
00027 #include <gr_hier_block2.h>
00028 #include <gr_types.h>
00029 
00030 namespace gr {
00031   namespace filter {
00032     
00033     /*!
00034      * \brief channel simulator
00035      * \ingroup misc_blk
00036      *
00037      * This block implements a basic channel model simulator that can
00038      * be used to help evaluate, design, and test various signals,
00039      * waveforms, and algorithms. This model allows the user to set
00040      * the voltage of an AWGN noise source, a (normalized) frequency
00041      * offset, a sample timing offset, and a noise seed to randomize
00042      * the AWGN noise source.
00043      *
00044      * Multipath can be approximated in this model by using a FIR
00045      * filter representation of a multipath delay profile..
00046      */
00047     class FILTER_API channel_model : virtual public gr_hier_block2
00048     {
00049     public:
00050       // gr::filter::channel_model::sptr
00051       typedef boost::shared_ptr<channel_model> sptr;
00052 
00053       /*! \brief Build the channel simulator.
00054        *
00055        * \param noise_voltage The AWGN noise level as a voltage (to be
00056        *                      calculated externally to meet, say, a
00057        *                      desired SNR).
00058        * \param frequency_offset The normalized frequency offset. 0 is
00059        *                         no offset; 0.25 would be, for a digital
00060        *                         modem, one quarter of the symbol rate.
00061        * \param epsilon The sample timing offset to emulate the
00062        *                different rates between the sample clocks of
00063        *                the transmitter and receiver. 1.0 is no difference.
00064        * \param taps Taps of a FIR filter to emulate a multipath delay profile.
00065        * \param noise_seed A random number generator seed for the noise source.
00066        */
00067       static sptr make(double noise_voltage=0.0,
00068                                   double frequency_offset=0.0,
00069                                   double epsilon=1.0,
00070                                   const std::vector<gr_complex> &taps=std::vector<gr_complex>(1,1),
00071                                   double noise_seed=0);
00072 
00073       virtual void set_noise_voltage(double noise_voltage) = 0;
00074       virtual void set_frequency_offset(double frequency_offset) = 0;
00075       virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
00076       virtual void set_timing_offset(double epsilon) = 0;
00077 
00078       virtual double noise_voltage() const = 0;
00079       virtual double frequency_offset() const = 0;
00080       virtual std::vector<gr_complex> taps() const = 0;
00081       virtual double timing_offset() const = 0;
00082     };
00083 
00084   } /* namespace filter */
00085 } /* namespace gr */
00086 
00087 #endif /* INCLUDED_FILTER_CHANNEL_MODEL_H */