GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
channel_model2.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2009,2012,2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_CHANNELS_CHANNEL_MODEL2_H
24 #define INCLUDED_CHANNELS_CHANNEL_MODEL2_H
25 
26 #include <gnuradio/channels/api.h>
27 #include <gnuradio/hier_block2.h>
28 #include <gnuradio/types.h>
29 
30 namespace gr {
31 namespace channels {
32 
33 /*!
34  * \brief Basic channel simulator allowing time-varying frequency
35  * and timing inputs.
36  * \ingroup channel_models_blk
37  *
38  * \details
39  * This block implements a basic channel model simulator that can
40  * be used to help evaluate, design, and test various signals,
41  * waveforms, and algorithms.
42  *
43  * This model allows the user to set the voltage of an AWGN noise
44  * source (\p noise_voltage), an initial timing offset (\p
45  * epsilon), and a seed (\p noise_seed) to randomize the AWGN
46  * noise source.
47  *
48  * Multipath can be approximated in this model by using a FIR
49  * filter representation of a multipath delay profile with the
50  * parameter \p taps.
51  *
52  * Unlike gr::channels::channel_model, this block is designed to
53  * enable time-varying frequency and timing offsets.
54  * * Port 0: input signal to be run through the channel.
55  * * Port 1: frequency function. A constant value between -0.5 and
56  * 0.5 here will turn into a constant frequency offset
57  * from -fs/2 to fs/2 (where fs is the sample rate).
58  * * Port 2: timing offset function. Sets the resampling rate of
59  * the channel model. A constant value here produces
60  * that value as the timing offset, so a constant 1.0
61  * input stream is the same as not having a timing
62  * offset.
63  *
64  * Since the models for frequency and timing offset may vary and
65  * what we are trying to model may be different for different
66  * simulations, we provide the time-varying nature as an input
67  * function that is user-defined. If only constant frequency and
68  * timing offsets are required, it is easier and less expensive to
69  * use gr::channels::channel_model.
70  */
71 class CHANNELS_API channel_model2 : virtual public hier_block2
72 {
73 public:
74  // gr::channels::channel_model2::sptr
75  typedef boost::shared_ptr<channel_model2> sptr;
76 
77  /*! \brief Build the channel simulator.
78  *
79  * \param noise_voltage The AWGN noise level as a voltage (to be
80  * calculated externally to meet, say, a
81  * desired SNR).
82  * \param epsilon The initial sample timing offset to emulate the
83  * different rates between the sample clocks of
84  * the transmitter and receiver. 1.0 is no difference.
85  * \param taps Taps of a FIR filter to emulate a multipath delay profile.
86  * \param noise_seed A random number generator seed for the noise source.
87  * \param block_tags If true, tags will not be able to propagate through this block.
88  */
89  static sptr make(double noise_voltage = 0.0,
90  double epsilon = 1.0,
91  const std::vector<gr_complex>& taps = std::vector<gr_complex>(1, 1),
92  double noise_seed = 0,
93  bool block_tags = false);
94 
95  virtual void set_noise_voltage(double noise_voltage) = 0;
96  virtual void set_taps(const std::vector<gr_complex>& taps) = 0;
97  virtual void set_timing_offset(double epsilon) = 0;
98 
99  virtual double noise_voltage() const = 0;
100  virtual std::vector<gr_complex> taps() const = 0;
101  virtual double timing_offset() const = 0;
102 };
103 
104 } /* namespace channels */
105 } /* namespace gr */
106 
107 #endif /* INCLUDED_CHANNELS_CHANNEL_MODEL2_H */
Basic channel simulator allowing time-varying frequency and timing inputs.
Definition: channel_model2.h:71
boost::shared_ptr< channel_model2 > sptr
Definition: channel_model2.h:75
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
static const float taps[NSTEPS+1][NTAPS]
Definition: interpolator_taps.h:9
#define CHANNELS_API
Definition: gr-channels/include/gnuradio/channels/api.h:30
Hierarchical container class for gr::block&#39;s and gr::hier_block2&#39;s.
Definition: hier_block2.h:45