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