GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
probe_mpsk_snr_est_c.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_PROBE_MPSK_SNR_EST_C_H
12 #define INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_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 probe for computing SNR of a PSK signal.
23  * \ingroup measurement_tools_blk
24  *
25  * \details
26  * This is a probe block (a sink) that can be used to monitor and
27  * retrieve estimations of the signal SNR. This probe is designed
28  * for use with M-PSK signals especially. The type of estimator is
29  * specified as the \p type parameter in the constructor. The
30  * estimators tend to trade off performance for accuracy, although
31  * experimentation should be done to figure out the right approach
32  * for a given implementation. Further, the current set of
33  * estimators are designed and proven theoretically under AWGN
34  * conditions; some amount of error should be assumed and/or
35  * estimated for real channel conditions.
36  *
37  * The block has three output message ports that will emit a
38  * message every msg_samples number of samples. These message
39  * ports are:
40  * \li snr: the current SNR estimate (in dB)
41  * \li signal: the current signal power estimate (in dBx)
42  * \li noise: the current noise power estimate (in dBx)
43  *
44  * Some calibration is required to convert dBx of the signal and
45  * noise power estimates to real measurements, such as dBm.
46  *
47  * The estimator is normally placed before clock recovery.
48  */
50 {
51 public:
52  // gr::digital::probe_mpsk_snr_est_c::sptr
53  typedef std::shared_ptr<probe_mpsk_snr_est_c> sptr;
54 
55  /*! Make an MPSK SNR probe.
56  *
57  * Parameters:
58  *
59  * \param type: the type of estimator to use see
60  * gr::digital::snr_est_type_t for details about the types.
61  * \param msg_nsamples: [not implemented yet] after this many
62  * samples, a message containing the SNR (key='snr') will be sent
63  * \param alpha: the update rate of internal running average
64  * calculations. Needs to be between 0 and 1, where higher value
65  * adjusts faster to new data.
66  */
67  static sptr make(snr_est_type_t type, int msg_nsamples = 10000, double alpha = 0.001);
68 
69  //! Return the estimated signal-to-noise ratio in decibels
70  virtual double snr() = 0;
71 
72  //! Return the estimated signal power in decibels
73  virtual double signal() = 0;
74 
75  //! Return the estimated noise power in decibels
76  virtual double noise() = 0;
77 
78  //! Return the type of estimator in use
79  virtual snr_est_type_t type() const = 0;
80 
81  //! Return how many samples between SNR messages
82  virtual int msg_nsample() const = 0;
83 
84  //! Get the running-average coefficient
85  virtual double alpha() const = 0;
86 
87  //! Set type of estimator to use
88  virtual void set_type(snr_est_type_t t) = 0;
89 
90  //! Set the number of samples between SNR messages
91  virtual void set_msg_nsample(int n) = 0;
92 
93  //! Set the running-average coefficient
94  virtual void set_alpha(double alpha) = 0;
95 };
96 
97 } /* namespace digital */
98 } /* namespace gr */
99 
100 #endif /* INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H */
A probe for computing SNR of a PSK signal.
Definition: probe_mpsk_snr_est_c.h:50
virtual snr_est_type_t type() const =0
Return the type of estimator in use.
virtual void set_msg_nsample(int n)=0
Set the number of samples between SNR messages.
virtual double signal()=0
Return the estimated signal power in decibels.
static sptr make(snr_est_type_t type, int msg_nsamples=10000, double alpha=0.001)
virtual double noise()=0
Return the estimated noise power in decibels.
virtual double alpha() const =0
Get the running-average coefficient.
virtual int msg_nsample() const =0
Return how many samples between SNR messages.
std::shared_ptr< probe_mpsk_snr_est_c > sptr
Definition: probe_mpsk_snr_est_c.h:53
virtual double snr()=0
Return the estimated signal-to-noise ratio in decibels.
virtual void set_alpha(double alpha)=0
Set the running-average coefficient.
virtual void set_type(snr_est_type_t t)=0
Set type of estimator to use.
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