1 /* -*- c++ -*- */
2 /*
3  * Copyright 2009,2012 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_CFO_MODEL_H
24 #define INCLUDED_CHANNELS_CFO_MODEL_H
25 
26 #include <gnuradio/channels/api.h>
27 #include <gnuradio/sync_block.h>
28 #include <gnuradio/types.h>
29 
30 namespace gr {
31 namespace channels {
32 
33 /*!
34  * \brief channel simulator
35  * \ingroup channel_models_blk
36  *
37  * \details
38  * This block implements a carrier frequency offset model that
39  * can be used to simulate carrier frequency drift typically from
40  * mixer LO drift on either transmit or receive hardware.
41  *
42  * A clipped gaussian random walk process is used.
43  */
44 class CHANNELS_API cfo_model : virtual public sync_block
45 {
46 public:
47     // gr::channels::cfo_model::sptr
48     typedef boost::shared_ptr<cfo_model> sptr;
49 
50     /*! \brief Build the carrier frequency offset model
51      *
52      * \param sample_rate_hz Sample rate of the input signal in Hz
53      * \param std_dev_hz  Desired standard deviation of the random walk
54                           process every sample in Hz
55      * \param max_dev_hz Maximum carrier frequency deviation in Hz.
56      * \param noise_seed A random number generator seed for the noise source.
57      */
58     static sptr make(double sample_rate_hz,
59                      double std_dev_hz,
60                      double max_dev_hz,
61                      double noise_seed = 0);
62 
63     virtual void set_std_dev(double _dev) = 0;
64     virtual void set_max_dev(double _dev) = 0;
65     virtual void set_samp_rate(double _rate) = 0;
66 
67     virtual double std_dev() const = 0;
68     virtual double max_dev() const = 0;
69     virtual double samp_rate() const = 0;
70 };
71 
72 } /* namespace channels */
73 } /* namespace gr */
74 
75 #endif /* INCLUDED_CHANNELS_CFO_MODEL_H */
76