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