GNU Radio 3.7.3 C++ API
mpsk_snr_est.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_H
24 #define INCLUDED_DIGITAL_MPSK_SNR_EST_H
25 
26 #include <gnuradio/digital/api.h>
27 #include <gnuradio/gr_complex.h>
28 
29 namespace gr {
30  namespace digital {
31 
32  /*!
33  * \brief A block for computing SNR of a signal.
34  * \ingroup measurement_tools_blk
35  *
36  * \details
37  * Below are some ROUGH estimates of what values of SNR each of
38  * these types of estimators is good for. In general, these offer
39  * a trade-off between accuracy and performance.
40  *
41  * \li SNR_EST_SIMPLE: Simple estimator (>= 7 dB)
42  * \li SNR_EST_SKEW: Skewness-base est (>= 5 dB)
43  * \li SNR_EST_M2M4: 2nd & 4th moment est (>= 1 dB)
44  * \li SNR_EST_SVR: SVR-based est (>= 0dB)
45  */
46  typedef enum {
47  SNR_EST_SIMPLE = 0, // Simple estimator (>= 7 dB)
48  SNR_EST_SKEW, // Skewness-base est (>= 5 dB)
49  SNR_EST_M2M4, // 2nd & 4th moment est (>= 1 dB)
50  SNR_EST_SVR // SVR-based est (>= 0dB)
52 
53  /*! \brief A parent class for SNR estimators, specifically for
54  * M-PSK signals in AWGN channels.
55  * \ingroup snr_blk
56  */
58  {
59  protected:
60  double d_alpha, d_beta;
61 
62  public:
63  /*! Constructor
64  *
65  * Parameters:
66  * \param alpha: the update rate of internal running average
67  * calculations.
68  */
69  mpsk_snr_est(double alpha);
70  virtual ~mpsk_snr_est();
71 
72  //! Get the running-average coefficient
73  double alpha() const;
74 
75  //! Set the running-average coefficient
76  void set_alpha(double alpha);
77 
78  //! Update the current registers
79  virtual int update(int noutput_items,
80  const gr_complex *input);
81 
82  //! Use the register values to compute a new estimate
83  virtual double snr();
84  };
85 
86 
87  //! \brief SNR Estimator using simple mean/variance estimates.
88  /*! \ingroup snr_blk
89  *
90  * A very simple SNR estimator that just uses mean and variance
91  * estimates of an M-PSK constellation. This esimator is quick
92  * and cheap and accurate for high SNR (above 7 dB or so) but
93  * quickly starts to overestimate the SNR at low SNR.
94  */
96  public mpsk_snr_est
97  {
98  private:
99  double d_y1, d_y2;
100 
101  public:
102  /*! Constructor
103  *
104  * Parameters:
105  * \param alpha: the update rate of internal running average
106  * calculations.
107  */
108  mpsk_snr_est_simple(double alpha);
110 
111  int update(int noutput_items,
112  const gr_complex *input);
113  double snr();
114  };
115 
116 
117  //! \brief SNR Estimator using skewness correction.
118  /*! \ingroup snr_blk
119  *
120  * This is an estimator that came from a discussion between Tom
121  * Rondeau and fred harris with no known paper reference. The
122  * idea is that at low SNR, the variance estimations will be
123  * affected because of fold-over around the decision boundaries,
124  * which results in a skewness to the samples. We estimate the
125  * skewness and use this as a correcting term.
126  */
128  public mpsk_snr_est
129  {
130  private:
131  double d_y1, d_y2, d_y3;
132 
133  public:
134  /*! Constructor
135  *
136  * Parameters:
137  * \param alpha: the update rate of internal running average
138  * calculations.
139  */
140  mpsk_snr_est_skew(double alpha);
142 
143  int update(int noutput_items,
144  const gr_complex *input);
145  double snr();
146  };
147 
148 
149  //! \brief SNR Estimator using 2nd and 4th-order moments.
150  /*! \ingroup snr_blk
151  *
152  * An SNR estimator for M-PSK signals that uses 2nd (M2) and 4th
153  * (M4) order moments. This estimator uses knowledge of the
154  * kurtosis of the signal (k_a) and noise (k_w) to make its
155  * estimation. We use Beaulieu's approximations here to M-PSK
156  * signals and AWGN channels such that k_a=1 and k_w=2. These
157  * approximations significantly reduce the complexity of the
158  * calculations (and computations) required.
159  *
160  * Reference:
161  * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
162  * estimation techniques for the AWGN channel," IEEE
163  * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
164  */
166  public mpsk_snr_est
167  {
168  private:
169  double d_y1, d_y2;
170 
171  public:
172  /*! Constructor
173  *
174  * Parameters:
175  * \param alpha: the update rate of internal running average
176  * calculations.
177  */
178  mpsk_snr_est_m2m4(double alpha);
180 
181  int update(int noutput_items,
182  const gr_complex *input);
183  double snr();
184  };
185 
186 
187  //! \brief SNR Estimator using 2nd and 4th-order moments.
188  /*! \ingroup snr_blk
189  *
190  * An SNR estimator for M-PSK signals that uses 2nd (M2) and 4th
191  * (M4) order moments. This estimator uses knowledge of the
192  * kurtosis of the signal (k_a) and noise (k_w) to make its
193  * estimation. In this case, you can set your own estimations for
194  * k_a and k_w, the kurtosis of the signal and noise, to fit this
195  * estimation better to your signal and channel conditions.
196  *
197  * A word of warning: this estimator has not been fully tested or
198  * proved with any amount of rigor. The estimation for M4 in
199  * particular might be ignoring effectf of when k_a and k_w are
200  * different. Use this estimator with caution and a copy of the
201  * reference on hand.
202  *
203  * The digital_mpsk_snr_est_m2m4 assumes k_a and k_w to simplify
204  * the computations for M-PSK and AWGN channels. Use that
205  * estimator unless you have a way to guess or estimate these
206  * values here.
207  *
208  * Original paper:
209  * R. Matzner, "An SNR estimation algorithm for complex baseband
210  * signal using higher order statistics," Facta Universitatis
211  * (Nis), no. 6, pp. 41-52, 1993.
212  *
213  * Reference used in derivation:
214  * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
215  * estimation techniques for the AWGN channel," IEEE
216  * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
217  */
219  public mpsk_snr_est
220  {
221  private:
222  double d_y1, d_y2;
223  double d_ka, d_kw;
224 
225  public:
226  /*! Constructor
227  *
228  * Parameters:
229  * \param alpha: the update rate of internal running average
230  * calculations.
231  * \param ka: estimate of the signal kurtosis (1 for PSK)
232  * \param kw: estimate of the channel noise kurtosis (2 for AWGN)
233  */
234  snr_est_m2m4(double alpha, double ka, double kw);
236 
237  int update(int noutput_items,
238  const gr_complex *input);
239  double snr();
240  };
241 
242 
243  //! \brief Signal-to-Variation Ratio SNR Estimator.
244  /*! \ingroup snr_blk
245  *
246  * This estimator actually comes from an SNR estimator for M-PSK
247  * signals in fading channels, but this implementation is
248  * specifically for AWGN channels. The math was simplified to
249  * assume a signal and noise kurtosis (k_a and k_w) for M-PSK
250  * signals in AWGN. These approximations significantly reduce the
251  * complexity of the calculations (and computations) required.
252  *
253  * Original paper:
254  * A. L. Brandao, L. B. Lopes, and D. C. McLernon, "In-service
255  * monitoring of multipath delay and cochannel interference for
256  * indoor mobile communication systems," Proc. IEEE
257  * Int. Conf. Communications, vol. 3, pp. 1458-1462, May 1994.
258  *
259  * Reference:
260  * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
261  * estimation techniques for the AWGN channel," IEEE
262  * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
263  */
265  public mpsk_snr_est
266  {
267  private:
268  double d_y1, d_y2;
269 
270  public:
271  /*! Constructor
272  *
273  * Parameters:
274  * \param alpha: the update rate of internal running average
275  * calculations.
276  */
277  mpsk_snr_est_svr(double alpha);
279 
280  int update(int noutput_items,
281  const gr_complex *input);
282  double snr();
283  };
284 
285  } /* namespace digital */
286 } /* namespace gr */
287 
288 #endif /* INCLUDED_DIGITAL_MPSK_SNR_EST_H */
double d_beta
Definition: mpsk_snr_est.h:60
SNR Estimator using simple mean/variance estimates.
Definition: mpsk_snr_est.h:95
snr_est_type_t
A block for computing SNR of a signal.
Definition: mpsk_snr_est.h:46
Definition: mpsk_snr_est.h:48
Definition: mpsk_snr_est.h:47
A parent class for SNR estimators, specifically for M-PSK signals in AWGN channels.
Definition: mpsk_snr_est.h:57
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:30
Definition: mpsk_snr_est.h:49
~mpsk_snr_est_simple()
Definition: mpsk_snr_est.h:109
Signal-to-Variation Ratio SNR Estimator.
Definition: mpsk_snr_est.h:264
std::complex< float > gr_complex
Definition: gr_complex.h:27
SNR Estimator using skewness correction.
Definition: mpsk_snr_est.h:127
SNR Estimator using 2nd and 4th-order moments.
Definition: mpsk_snr_est.h:165
Definition: mpsk_snr_est.h:50
SNR Estimator using 2nd and 4th-order moments.
Definition: mpsk_snr_est.h:218
~mpsk_snr_est_svr()
Definition: mpsk_snr_est.h:278
~mpsk_snr_est_m2m4()
Definition: mpsk_snr_est.h:179
~snr_est_m2m4()
Definition: mpsk_snr_est.h:235
~mpsk_snr_est_skew()
Definition: mpsk_snr_est.h:141