GNU Radio Manual and C++ API Reference  3.8.5.0
The Free & Open Software Radio Ecosystem
mpsk_snr_est_cc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2011,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_DIGITAL_MPSK_SNR_EST_CC_H
24 #define INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H
25 
26 #include <gnuradio/digital/api.h>
28 #include <gnuradio/sync_block.h>
29 
30 namespace gr {
31 namespace digital {
32 
33 /*!
34  * \brief A block for computing SNR of a signal.
35  * \ingroup measurement_tools_blk
36  *
37  * \details
38  * This block can be used to monitor and retrieve estimations of
39  * the signal SNR. It is designed to work in a flowgraph and
40  * passes all incoming data along to its output.
41  *
42  * The block is designed for use with M-PSK signals
43  * especially. The type of estimator is specified as the \p type
44  * parameter in the constructor. The estimators tend to trade off
45  * performance for accuracy, although experimentation should be
46  * done to figure out the right approach for a given
47  * implementation. Further, the current set of estimators are
48  * designed and proven theoretically under AWGN conditions; some
49  * amount of error should be assumed and/or estimated for real
50  * channel conditions.
51  *
52  * The estimator is normally placed before clock recovery.
53  */
54 class DIGITAL_API mpsk_snr_est_cc : virtual public sync_block
55 {
56 public:
57  // gr::digital::mpsk_snr_est_cc::sptr
58  typedef boost::shared_ptr<mpsk_snr_est_cc> sptr;
59 
60  /*! Factory function returning shared pointer of this class
61  *
62  * \param type: the type of estimator to use gr::digital::snr_est_type_t
63  * "snr_est_type_t" for details about the available types
64  * \param tag_nsamples: after this many samples, a tag containing
65  * the SNR (key='snr') will be sent
66  * \param alpha: the update rate of internal running average
67  * calculations. Needs to be between 0 and 1, where higher value
68  * adjusts faster to new data.
69  */
70  static sptr make(snr_est_type_t type, int tag_nsamples = 10000, double alpha = 0.001);
71 
72  //! Return the estimated signal-to-noise ratio in decibels
73  virtual double snr() = 0;
74 
75  //! Return the type of estimator in use
76  virtual snr_est_type_t type() const = 0;
77 
78  //! Return how many samples between SNR tags
79  virtual int tag_nsample() const = 0;
80 
81  //! Get the running-average coefficient
82  virtual double alpha() const = 0;
83 
84  //! Set type of estimator to use
85  virtual void set_type(snr_est_type_t t) = 0;
86 
87  //! Set the number of samples between SNR tags
88  virtual void set_tag_nsample(int n) = 0;
89 
90  //! Set the running-average coefficient
91  virtual void set_alpha(double alpha) = 0;
92 };
93 
94 } /* namespace digital */
95 } /* namespace gr */
96 
97 #endif /* INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H */
snr_est_type_t
A block for computing SNR of a signal.
Definition: mpsk_snr_est.h:46
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:30
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:46
boost::shared_ptr< mpsk_snr_est_cc > sptr
Definition: mpsk_snr_est_cc.h:58
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
A block for computing SNR of a signal.
Definition: mpsk_snr_est_cc.h:54