GNU Radio 3.5.3.2 C++ API
gr_probe_mpsk_snr_c.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008 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 #ifndef INCLUDED_GR_PROBE_MPSK_SNR_C_H
23 #define INCLUDED_GR_PROBE_MPSK_SNR_C_H
24 
25 #include <gr_core_api.h>
26 #include <gr_sync_block.h>
27 
30 
32 gr_make_probe_mpsk_snr_c(double alpha = 0.0001);
33 
34 /*!
35  * Compute the estimate SNR of an MPSK signal using the Squared Signal
36  * to Noise Variance (SNV) technique.
37  *
38  * This technique assumes an AWGN channel.
39  *
40  * \param alpha Mean and variance smoothing filter constant
41  * \ingroup sink_blk
42  *
43  * Compute the running average of the signal mean and noise variance.
44  * The estimated signal mean, noise variance, and SNR are available
45  * via accessors.
46  *
47  * This SNR estimator is inaccurate below about 7dB SNR.
48  *
49  */
51 {
52  double d_alpha;
53  double d_beta;
54  double d_signal_mean;
55  double d_noise_variance;
56 
57  // Factory function returning shared pointer of this class
59  gr_make_probe_mpsk_snr_c(double alpha);
60 
61  // Private constructor
62  gr_probe_mpsk_snr_c(double alpha);
63 
64 public:
66 
67  int work (int noutput_items,
68  gr_vector_const_void_star &input_items,
69  gr_vector_void_star &output_items);
70 
71  // Return the estimated signal mean
72  double signal_mean() const { return d_signal_mean; }
73 
74  // Return the estimated noise variance
75  double noise_variance() const { return d_noise_variance; }
76 
77  // Return the estimated signal-to-noise ratio in decibels
78  double snr() const;
79 
80  void set_alpha(double alpha);
81 };
82 
83 #endif /* INCLUDED_GR_PROBE_MPSK_SNR_C_H */