GNU Radio 3.6.4.1 C++ API
digital_constellation_receiver_cb.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 
23 #ifndef INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H
24 #define INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H
25 
26 #include <digital_api.h>
27 #include <gr_block.h>
28 #include <digital_constellation.h>
29 #include <gruel/attributes.h>
30 #include <gri_control_loop.h>
31 #include <gr_complex.h>
32 #include <math.h>
33 #include <fstream>
34 
37 
38 // public constructor
41  float loop_bw, float fmin, float fmax);
42 
43 /*!
44  * \brief This block does fine-phase and frequency locking and decision making.
45  * \ingroup sync_blk
46  * \ingroup demod_blk
47  * \ingroup digital
48  *
49  * The phase and frequency synchronization are based on a Costas loop
50  * that finds the error of the incoming signal point compared to its
51  * nearest constellation point. The frequency and phase of the NCO are
52  * updated according to this error.
53  *
54  * The decicision making itself is performed by the appropriate method of the
55  * passed constellation object.
56  *
57  */
58 
60 {
61 public:
62  int general_work (int noutput_items,
63  gr_vector_int &ninput_items,
64  gr_vector_const_void_star &input_items,
65  gr_vector_void_star &output_items);
66 
67 protected:
68 
69  /*!
70  * \brief Constructor to synchronize incoming M-PSK symbols
71  *
72  * \param constellation constellation object for generic demodulation
73  * \param loop_bw Loop bandwidth of the Costas Loop (~ 2pi/100)
74  * \param fmin minimum normalized frequency value the loop can achieve
75  * \param fmax maximum normalized frequency value the loop can achieve
76  *
77  */
79  float loop_bw, float fmin, float fmax);
80 
81  void phase_error_tracking(float phase_error);
82 
83 private:
84  unsigned int d_M;
85 
86  digital_constellation_sptr d_constellation;
87  unsigned int d_current_const_point;
88 
89  //! delay line length.
90  static const unsigned int DLLEN = 8;
91 
92  //! delay line plus some length for overflow protection
93  __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN];
94 
95  //! index to delay line
96  unsigned int d_dl_idx;
97 
100  float loop_bw, float fmin, float fmax);
101 };
102 
103 #endif