GNU Radio's BLOCKSTREAM Package
da_carrier_phase_rec_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2017 <+YOU OR YOUR COMPANY+>.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 /*
22 * Data-aided Carrier Phase Recovery Loop
23 *
24 * This module consists is an implementation of a carrier phase recovery loop
25 * that leverages on the knowledge of the preamble portion appended to transmit
26 * frames, reason why it is called "data-aided" (based on known data). The loop
27 * expects to receive symbols corresponding to the full frame (preamble +
28 * payload) in its input. When receiving the preamble, the phase error detector
29 * of the loop constrasts the phase of the incoming symbol with the phase of the
30 * expected preamble symbol that is known a priori (passed as argument to the
31 * block). In contrast, when receiving payload symbols, the error detector
32 * compares the incoming phase with the phase of the "sliced" version of the
33 * incoming symbol, where "sliced" should be understood as the nearest
34 * constellation point. Therefore, over the payload portion of the frame, the
35 * loop operates in "decision-directed" mode, rather than data-aided.
36 *
37 * An important aspect of this implementation is that it resets the loop state
38 * at the beggining of every frame. The motivation for doing so is to avoid the
39 * so-called "cycle slips". The latter happens over the long term, when the loop
40 * that is already locked slowly slips into another stationary state. In case of
41 * carrier phase recovery, cycle slips come from the fact that the loop can
42 * settle in any of the M possible rotations of the constellation, where M is the
43 * constellation order. If noise is too strong, then, it possible that the loop
44 * keeps slipping from one stationary state to the other. In this context, then,
45 * by restarting the loop in the beggining of every frame, there will be less
46 * time for the small errors to accumulate such that a slip occurs. Furthermore,
47 * because the initial transitory of the loop over each frame is based on known
48 * preamble, the loop is expected to be already settled when payload starts for
49 * each frame if the is long enough.
50 *
51 */
52 
53 #ifndef INCLUDED_BLOCKSAT_DA_CARRIER_PHASE_REC_IMPL_H
54 #define INCLUDED_BLOCKSAT_DA_CARRIER_PHASE_REC_IMPL_H
55 
57 
58 namespace gr {
59  namespace blocksat {
60 
62  {
63  private:
64  float d_noise_bw;
65  float d_damp_factor;
66  float d_K1;
67  float d_K2;
68  float d_integrator;
69  int d_i_sym;
70  int d_const_order;
71  float d_nco_phase;
72  char d_preamble_state;
73  bool d_data_aided;
74  bool d_reset_per_frame;
75  std::vector<gr_complex> d_tx_pilots;
76 
77  public:
78  da_carrier_phase_rec_impl(const std::vector<gr_complex> &preamble_syms, float noise_bw, float damp_factor, int M, bool data_aided, bool reset_per_frame);
80 
81  // Where all the action really happens
82  void forecast (int noutput_items, gr_vector_int &ninput_items_required);
83  int general_work(int noutput_items,
84  gr_vector_int &ninput_items,
85  gr_vector_const_void_star &input_items,
86  gr_vector_void_star &output_items);
87 
88  gr_complex slice_symbol(const gr_complex &sample, int M);
89  float set_K1(float zeta, float Bn_Ts);
90  float set_K2(float zeta, float Bn_Ts);
91  };
92 
93  } // namespace blocksat
94 } // namespace gr
95 
96 #endif /* INCLUDED_BLOCKSAT_DA_CARRIER_PHASE_REC_IMPL_H */
float set_K1(float zeta, float Bn_Ts)
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
float set_K2(float zeta, float Bn_Ts)
gr_complex slice_symbol(const gr_complex &sample, int M)
&lt;+description of block+&gt;
Definition: da_carrier_phase_rec.h:36
Definition: da_carrier_phase_rec_impl.h:61
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
da_carrier_phase_rec_impl(const std::vector< gr_complex > &preamble_syms, float noise_bw, float damp_factor, int M, bool data_aided, bool reset_per_frame)