GNU Radio 3.6.5 C++ API

digital_impl_mpsk_snr_est.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2011 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 #ifndef INCLUDED_DIGITAL_IMPL_MPSK_SNR_EST_H
00023 #define INCLUDED_DIGITAL_IMPL_MPSK_SNR_EST_H
00024 
00025 #include <digital_api.h>
00026 #include <gr_sync_block.h>
00027 
00028 //! Enum for the type of SNR estimator to select
00029 /*! \ingroup snr_blk
00030  *  \anchor ref_snr_est_types
00031  *
00032  * Below are some ROUGH estimates of what values of SNR each of these
00033  * types of estimators is good for. In general, these offer a
00034  * trade-off between accuracy and performance.
00035  *
00036  * \li SNR_EST_SIMPLE:  Simple estimator (>= 7 dB)
00037  * \li SNR_EST_SKEW:    Skewness-base est (>= 5 dB)
00038  * \li SNR_EST_M2M4:    2nd & 4th moment est (>= 1 dB)
00039  * \li SNR_EST_SVR:     SVR-based est (>= 0dB)
00040 */
00041 enum snr_est_type_t {
00042   SNR_EST_SIMPLE = 0,   // Simple estimator (>= 7 dB)
00043   SNR_EST_SKEW,         // Skewness-base est (>= 5 dB)
00044   SNR_EST_M2M4,         // 2nd & 4th moment est (>= 1 dB)
00045   SNR_EST_SVR           // SVR-based est (>= 0dB)
00046 };
00047 
00048 /*! \brief A parent class for SNR estimators, specifically for M-PSK
00049  *  signals in AWGN channels.
00050  *  \ingroup snr_blk
00051  */
00052 class DIGITAL_API digital_impl_mpsk_snr_est
00053 {
00054  protected:
00055   double d_alpha, d_beta;
00056 
00057  public:
00058   /*! Constructor
00059    *
00060    *  Parameters:
00061    *  \param alpha: the update rate of internal running average
00062    *  calculations.
00063    */
00064   digital_impl_mpsk_snr_est(double alpha);
00065   virtual ~digital_impl_mpsk_snr_est();
00066 
00067   //! Get the running-average coefficient
00068   double alpha() const;
00069 
00070   //! Set the running-average coefficient
00071   void set_alpha(double alpha);
00072 
00073   //! Update the current registers
00074   virtual int update(int noutput_items,
00075                      const gr_complex *in);
00076 
00077   //! Use the register values to compute a new estimate
00078   virtual double snr();
00079 };
00080 
00081   
00082 //! \brief SNR Estimator using simple mean/variance estimates.
00083 /*! \ingroup snr_blk
00084  *
00085  *  A very simple SNR estimator that just uses mean and variance
00086  *  estimates of an M-PSK constellation. This esimator is quick and
00087  *  cheap and accurate for high SNR (above 7 dB or so) but quickly
00088  *  starts to overestimate the SNR at low SNR.
00089  */
00090 class DIGITAL_API digital_impl_mpsk_snr_est_simple :
00091   public digital_impl_mpsk_snr_est
00092 {
00093  private:
00094   double d_y1, d_y2;
00095   
00096  public:
00097   /*! Constructor
00098    *
00099    *  Parameters:
00100    *  \param alpha: the update rate of internal running average
00101    *  calculations.
00102    */
00103   digital_impl_mpsk_snr_est_simple(double alpha);
00104   ~digital_impl_mpsk_snr_est_simple() {}
00105 
00106   int update(int noutput_items,
00107              const gr_complex *in);
00108   double snr();
00109 };
00110 
00111 
00112 //! \brief SNR Estimator using skewness correction.
00113 /*!  \ingroup snr_blk
00114  *
00115  *  This is an estimator that came from a discussion between Tom
00116  *  Rondeau and fred harris with no known paper reference. The idea is
00117  *  that at low SNR, the variance estimations will be affected because
00118  *  of fold-over around the decision boundaries, which results in a
00119  *  skewness to the samples. We estimate the skewness and use this as
00120  *  a correcting term.
00121  */
00122 class DIGITAL_API digital_impl_mpsk_snr_est_skew :
00123   public digital_impl_mpsk_snr_est
00124 {
00125  private:
00126   double d_y1, d_y2, d_y3;
00127   
00128  public:
00129   /*! Constructor
00130    *
00131    *  Parameters:
00132    *  \param alpha: the update rate of internal running average
00133    *  calculations.
00134    */
00135   digital_impl_mpsk_snr_est_skew(double alpha);
00136   ~digital_impl_mpsk_snr_est_skew() {}
00137 
00138   int update(int noutput_items,
00139              const gr_complex *in);
00140   double snr();
00141 };
00142 
00143 
00144 //! \brief SNR Estimator using 2nd and 4th-order moments.
00145 /*! \ingroup snr_blk
00146  *
00147  *  An SNR estimator for M-PSK signals that uses 2nd (M2) and 4th (M4)
00148  *  order moments. This estimator uses knowledge of the kurtosis of
00149  *  the signal (k_a) and noise (k_w) to make its estimation. We use
00150  *  Beaulieu's approximations here to M-PSK signals and AWGN channels
00151  *  such that k_a=1 and k_w=2. These approximations significantly
00152  *  reduce the complexity of the calculations (and computations)
00153  *  required.
00154  *
00155  *  Reference:
00156  *  D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
00157  *  estimation techniques for the AWGN channel," IEEE
00158  *  Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
00159  */
00160 class DIGITAL_API digital_impl_mpsk_snr_est_m2m4 :
00161   public digital_impl_mpsk_snr_est
00162 {
00163  private:
00164   double d_y1, d_y2;
00165   
00166  public:
00167   /*! Constructor
00168    *
00169    *  Parameters:
00170    *  \param alpha: the update rate of internal running average
00171    *  calculations.
00172    */
00173   digital_impl_mpsk_snr_est_m2m4(double alpha);
00174   ~digital_impl_mpsk_snr_est_m2m4() {}
00175 
00176   int update(int noutput_items,
00177              const gr_complex *in);
00178   double snr();
00179 };
00180 
00181 
00182 //! \brief SNR Estimator using 2nd and 4th-order moments.
00183 /*!  \ingroup snr_blk
00184  *
00185  *  An SNR estimator for M-PSK signals that uses 2nd (M2) and 4th (M4)
00186  *  order moments. This estimator uses knowledge of the kurtosis of
00187  *  the signal (k_a) and noise (k_w) to make its estimation. In this
00188  *  case, you can set your own estimations for k_a and k_w, the
00189  *  kurtosis of the signal and noise, to fit this estimation better to
00190  *  your signal and channel conditions.
00191  *
00192  *  A word of warning: this estimator has not been fully tested or
00193  *  proved with any amount of rigor. The estimation for M4 in
00194  *  particular might be ignoring effectf of when k_a and k_w are
00195  *  different. Use this estimator with caution and a copy of the
00196  *  reference on hand.
00197  *
00198  *  The digital_mpsk_snr_est_m2m4 assumes k_a and k_w to simplify the
00199  *  computations for M-PSK and AWGN channels. Use that estimator
00200  *  unless you have a way to guess or estimate these values here.
00201  *
00202  *  Original paper: 
00203  *  R. Matzner, "An SNR estimation algorithm for complex baseband
00204  *  signal using higher order statistics," Facta Universitatis
00205  *  (Nis), no. 6, pp. 41-52, 1993.
00206  *
00207  *  Reference used in derivation:
00208  *  D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
00209  *  estimation techniques for the AWGN channel," IEEE
00210  *  Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
00211  */
00212 class DIGITAL_API digital_impl_snr_est_m2m4 :
00213   public digital_impl_mpsk_snr_est
00214 {
00215  private:
00216   double d_y1, d_y2;
00217   double d_ka, d_kw;
00218   
00219  public:
00220   /*! Constructor
00221    *
00222    *  Parameters:
00223    *  \param alpha: the update rate of internal running average
00224    *  calculations.
00225    *  \param ka: estimate of the signal kurtosis (1 for PSK)
00226    *  \param kw: estimate of the channel noise kurtosis (2 for AWGN)
00227    */
00228   digital_impl_snr_est_m2m4(double alpha, double ka, double kw);
00229   ~digital_impl_snr_est_m2m4() {}
00230 
00231   int update(int noutput_items,
00232              const gr_complex *in);
00233   double snr();
00234 };
00235 
00236 
00237 //! \brief Signal-to-Variation Ratio SNR Estimator.
00238 /*! \ingroup snr_blk
00239  *
00240  *  This estimator actually comes from an SNR estimator for M-PSK
00241  *  signals in fading channels, but this implementation is
00242  *  specifically for AWGN channels. The math was simplified to assume
00243  *  a signal and noise kurtosis (k_a and k_w) for M-PSK signals in
00244  *  AWGN. These approximations significantly reduce the complexity of
00245  *  the calculations (and computations) required.
00246  *
00247  *  Original paper:
00248  *  A. L. Brandao, L. B. Lopes, and D. C. McLernon, "In-service
00249  *  monitoring of multipath delay and cochannel interference for
00250  *  indoor mobile communication systems," Proc. IEEE
00251  *  Int. Conf. Communications, vol. 3, pp. 1458-1462, May 1994.
00252  *
00253  *  Reference:
00254  *  D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
00255  *  estimation techniques for the AWGN channel," IEEE
00256  *  Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
00257  */
00258 class DIGITAL_API digital_impl_mpsk_snr_est_svr :
00259   public digital_impl_mpsk_snr_est
00260 {
00261  private:
00262   double d_y1, d_y2;
00263   
00264  public:
00265   /*! Constructor
00266    *
00267    *  Parameters:
00268    *  \param alpha: the update rate of internal running average
00269    *  calculations.
00270    */
00271   digital_impl_mpsk_snr_est_svr(double alpha);
00272   ~digital_impl_mpsk_snr_est_svr() {}
00273 
00274   int update(int noutput_items,
00275              const gr_complex *in);
00276   double snr();
00277 };
00278 
00279 #endif /* INCLUDED_DIGITAL_IMPL_MPSK_SNR_EST_H */