GNU Radio 3.7.1 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2009,2012,2013 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_MODEL2_H 00024 #define INCLUDED_CHANNELS_CHANNEL_MODEL2_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 model2 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. 00041 * 00042 * This model allows the user to set the voltage of an AWGN noise 00043 * source, an initial timing offset, and a noise seed to randomize 00044 * the AWGN noise source. 00045 * 00046 * Multipath can be approximated in this model by using a FIR 00047 * filter representation of a multipath delay profile. 00048 * 00049 * Unlike gr::channels::channel_model, this block is designed to 00050 * enable time-varying frequency and timing offsets. 00051 * * Port 0: input signal to be run through the channel. 00052 * * Port 1: frequency function. A constant value between -0.5 and 00053 * 0.5 here will turn into a constant frequency offset 00054 * from -fs/2 to fs/2 (where fs is the sample rate). 00055 * * Port 2: timing offset function. Sets the resampling rate of 00056 * the channel model. A constant value here produces 00057 * that value as the timing offset, so a constant 1.0 00058 * input stream is the same as not having a timing 00059 * offset. 00060 * 00061 * Since the models for frequency and timing offset may vary and 00062 * what we are trying to model may be different for different 00063 * simulations, we provide the time-varying nature as an input 00064 * function that is user-defined. If only constant frequency and 00065 * timing offsets are required, it is easier and less expensive to 00066 * use gr::channels::channel_model. 00067 */ 00068 class CHANNELS_API channel_model2 : virtual public hier_block2 00069 { 00070 public: 00071 // gr::channels::channel_model2::sptr 00072 typedef boost::shared_ptr<channel_model2> sptr; 00073 00074 /*! \brief Build the channel simulator. 00075 * 00076 * \param noise_voltage The AWGN noise level as a voltage (to be 00077 * calculated externally to meet, say, a 00078 * desired SNR). 00079 * \param epsilon The initial sample timing offset to emulate the 00080 * different rates between the sample clocks of 00081 * the transmitter and receiver. 1.0 is no difference. 00082 * \param taps Taps of a FIR filter to emulate a multipath delay profile. 00083 * \param noise_seed A random number generator seed for the noise source. 00084 */ 00085 static sptr make(double noise_voltage=0.0, 00086 double epsilon=1.0, 00087 const std::vector<gr_complex> &taps=std::vector<gr_complex>(1,1), 00088 double noise_seed=0); 00089 00090 virtual void set_noise_voltage(double noise_voltage) = 0; 00091 virtual void set_taps(const std::vector<gr_complex> &taps) = 0; 00092 virtual void set_timing_offset(double epsilon) = 0; 00093 00094 virtual double noise_voltage() const = 0; 00095 virtual std::vector<gr_complex> taps() const = 0; 00096 virtual double timing_offset() const = 0; 00097 }; 00098 00099 } /* namespace channels */ 00100 } /* namespace gr */ 00101 00102 #endif /* INCLUDED_CHANNELS_CHANNEL_MODEL2_H */