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