GNU Radio Manual and C++ API Reference  3.10.9.1
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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_CHANNELS_CHANNEL_MODEL2_H
12 #define INCLUDED_CHANNELS_CHANNEL_MODEL2_H
13 
14 #include <gnuradio/channels/api.h>
15 #include <gnuradio/hier_block2.h>
16 #include <gnuradio/types.h>
17 
18 namespace gr {
19 namespace channels {
20 
21 /*!
22  * \brief Basic channel simulator allowing time-varying frequency
23  * and timing inputs.
24  * \ingroup channel_models_blk
25  *
26  * \details
27  * This block implements a basic channel model simulator that can
28  * be used to help evaluate, design, and test various signals,
29  * waveforms, and algorithms.
30  *
31  * This model allows the user to set the voltage of an AWGN noise
32  * source (\p noise_voltage), an initial timing offset (\p
33  * epsilon), and a seed (\p noise_seed) to randomize the AWGN
34  * noise source.
35  *
36  * Multipath can be approximated in this model by using a FIR
37  * filter representation of a multipath delay profile with the
38  * parameter \p taps.
39  *
40  * Unlike gr::channels::channel_model, this block is designed to
41  * enable time-varying frequency and timing offsets.
42  * * Port 0: input signal to be run through the channel.
43  * * Port 1: frequency function. A constant value between -0.5 and
44  * 0.5 here will turn into a constant frequency offset
45  * from -fs/2 to fs/2 (where fs is the sample rate).
46  * * Port 2: timing offset function. Sets the resampling rate of
47  * the channel model. A constant value here produces
48  * that value as the timing offset, so a constant 1.0
49  * input stream is the same as not having a timing
50  * offset.
51  *
52  * Since the models for frequency and timing offset may vary and
53  * what we are trying to model may be different for different
54  * simulations, we provide the time-varying nature as an input
55  * function that is user-defined. If only constant frequency and
56  * timing offsets are required, it is easier and less expensive to
57  * use gr::channels::channel_model.
58  */
59 class CHANNELS_API channel_model2 : virtual public hier_block2
60 {
61 public:
62  // gr::channels::channel_model2::sptr
63  typedef std::shared_ptr<channel_model2> sptr;
64 
65  /*! \brief Build the channel simulator.
66  *
67  * \param noise_voltage The AWGN noise level as a voltage (to be
68  * calculated externally to meet, say, a
69  * desired SNR).
70  * \param epsilon The initial sample timing offset to emulate the
71  * different rates between the sample clocks of
72  * the transmitter and receiver. 1.0 is no difference.
73  * \param taps Taps of a FIR filter to emulate a multipath delay profile.
74  * \param noise_seed A random number generator seed for the noise source.
75  * \param block_tags If true, tags will not be able to propagate through this block.
76  */
77  static sptr make(double noise_voltage = 0.0,
78  double epsilon = 1.0,
79  const std::vector<gr_complex>& taps = std::vector<gr_complex>(1, 0),
80  double noise_seed = 0,
81  bool block_tags = false);
82 
83  virtual void set_noise_voltage(double noise_voltage) = 0;
84  virtual void set_taps(const std::vector<gr_complex>& taps) = 0;
85  virtual void set_timing_offset(double epsilon) = 0;
86 
87  virtual double noise_voltage() const = 0;
88  virtual std::vector<gr_complex> taps() const = 0;
89  virtual double timing_offset() const = 0;
90 };
91 
92 } /* namespace channels */
93 } /* namespace gr */
94 
95 #endif /* INCLUDED_CHANNELS_CHANNEL_MODEL2_H */
Basic channel simulator allowing time-varying frequency and timing inputs.
Definition: channel_model2.h:60
virtual void set_noise_voltage(double noise_voltage)=0
virtual std::vector< gr_complex > taps() const =0
virtual double timing_offset() const =0
virtual void set_timing_offset(double epsilon)=0
virtual double noise_voltage() const =0
virtual void set_taps(const std::vector< gr_complex > &taps)=0
static sptr make(double noise_voltage=0.0, double epsilon=1.0, const std::vector< gr_complex > &taps=std::vector< gr_complex >(1, 0), double noise_seed=0, bool block_tags=false)
Build the channel simulator.
std::shared_ptr< channel_model2 > sptr
Definition: channel_model2.h:63
Hierarchical container class for gr::block's and gr::hier_block2's.
Definition: hier_block2.h:34
#define CHANNELS_API
Definition: gr-channels/include/gnuradio/channels/api.h:18
static constexpr float taps[NSTEPS+1][NTAPS]
Definition: interpolator_taps.h:9
GNU Radio logging wrapper.
Definition: basic_block.h:29