gr_mpsk_receiver_cc.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2004,2007 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 
00023 #ifndef INCLUDED_GR_MPSK_RECEIVER_CC_H
00024 #define INCLUDED_GR_MPSK_RECEIVER_CC_H
00025 
00026 #include <gr_block.h>
00027 #include <gr_complex.h>
00028 #include <fstream>
00029 
00030 class gri_mmse_fir_interpolator_cc;
00031 
00032 class gr_mpsk_receiver_cc;
00033 typedef boost::shared_ptr<gr_mpsk_receiver_cc> gr_mpsk_receiver_cc_sptr;
00034 
00035 // public constructor
00036 gr_mpsk_receiver_cc_sptr 
00037 gr_make_mpsk_receiver_cc (unsigned int M, float theta, 
00038                           float alpha, float beta,
00039                           float fmin, float fmax,
00040                           float mu, float gain_mu, 
00041                           float omega, float gain_omega, float omega_rel);
00042 
00071 class gr_mpsk_receiver_cc : public gr_block
00072 {
00073  public:
00074   ~gr_mpsk_receiver_cc ();
00075   void forecast(int noutput_items, gr_vector_int &ninput_items_required);
00076   int general_work (int noutput_items,
00077                     gr_vector_int &ninput_items,
00078                     gr_vector_const_void_star &input_items,
00079                     gr_vector_void_star &output_items);
00080 
00081 
00082   // Member functions related to the symbol tracking portion of the receiver
00084   float mu() const { return d_mu;}
00085 
00087   float omega() const { return d_omega;}
00088 
00090   float gain_mu() const { return d_gain_mu;}
00091 
00093   float gain_omega() const { return d_gain_omega;}
00094 
00096   void set_mu (float mu) { d_mu = mu; }
00097   
00099   void set_omega (float omega) { 
00100     d_omega = omega;
00101     d_min_omega = omega*(1.0 - d_omega_rel);
00102     d_max_omega = omega*(1.0 + d_omega_rel);
00103   }
00104 
00106   void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
00107 
00109   void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
00110 
00111 
00112 
00113   // Member function related to the phase/frequency tracking portion of the receiver
00115   float alpha() const { return d_alpha; }
00116   
00118   float beta() const { return d_beta; }
00119 
00121   float freq() const { return d_freq; }
00122 
00124   float phase() const { return d_phase; }
00125 
00127   void set_alpha(float alpha) { d_alpha = alpha; }
00128   
00130   void set_beta(float beta) { d_beta = beta; }
00131 
00133   void set_freq(float freq) { d_freq = freq; }
00134 
00136   void set_phase(float phase) { d_phase = phase; }
00137 
00138 
00139 protected:
00140 
00159   gr_mpsk_receiver_cc (unsigned int M, float theta, 
00160                        float alpha, float beta,
00161                        float fmin, float fmax,
00162                        float mu, float gain_mu, 
00163                        float omega, float gain_omega, float omega_rel);
00164 
00165   void make_constellation();
00166   void mm_sampler(const gr_complex symbol);
00167   void mm_error_tracking(gr_complex sample);
00168   void phase_error_tracking(gr_complex sample);
00169 
00170 
00185   float phase_error_detector_generic(gr_complex sample) const; // generic for M but more costly
00186 
00197   float phase_error_detector_bpsk(gr_complex sample) const;    // optimized for BPSK
00198 
00208   float phase_error_detector_qpsk(gr_complex sample) const;
00209 
00210 
00211 
00222   unsigned int decision_generic(gr_complex sample) const;
00223 
00224 
00235   unsigned int decision_bpsk(gr_complex sample) const;
00236   
00237 
00248   unsigned int decision_qpsk(gr_complex sample) const;
00249 
00250   private:
00251   unsigned int d_M;
00252   float        d_theta;
00253 
00254   // Members related to carrier and phase tracking
00255   float d_alpha;
00256   float d_beta;
00257   float d_freq, d_max_freq, d_min_freq;
00258   float d_phase;
00259 
00270   unsigned int (gr_mpsk_receiver_cc::*d_decision)(gr_complex sample) const; // pointer to decision function
00271 
00272 
00273   std::vector<gr_complex> d_constellation;
00274   unsigned int d_current_const_point;
00275 
00276   // Members related to symbol timing
00277   float d_mu, d_gain_mu;
00278   float d_omega, d_gain_omega, d_omega_rel, d_max_omega, d_min_omega;
00279   gr_complex d_p_2T, d_p_1T, d_p_0T;
00280   gr_complex d_c_2T, d_c_1T, d_c_0T;
00281 
00290   float (gr_mpsk_receiver_cc::*d_phase_error_detector)(gr_complex sample) const;
00291 
00292 
00294   gri_mmse_fir_interpolator_cc  *d_interp;
00295   
00297   static const unsigned int DLLEN = 8;
00298   
00300   gr_complex d_dl[2*DLLEN] __attribute__ ((aligned(8)));
00301   
00303   unsigned int d_dl_idx;
00304 
00305   friend gr_mpsk_receiver_cc_sptr
00306   gr_make_mpsk_receiver_cc (unsigned int M, float theta,
00307                             float alpha, float beta,
00308                             float fmin, float fmax,
00309                             float mu, float gain_mu, 
00310                             float omega, float gain_omega, float omega_rel);
00311 };
00312 
00313 #endif

Generated on Thu Mar 5 09:01:11 2009 for GNU Radio 3.1.3 by  doxygen 1.5.8