GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
glonass_l2_ca_dll_pll_tracking_cc.h
Go to the documentation of this file.
1 /*!
2  * \file glonass_l2_ca_dll_pll_tracking_cc.h
3  * \brief Implementation of a code DLL + carrier PLL tracking block
4  * \author Damian Miralles, 2018. dmiralles2009(at)gmail.com
5  *
6  *
7  * Code DLL + carrier PLL according to the algorithms described in:
8  * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
9  * A Software-Defined GPS and Galileo Receiver. A Single-Frequency
10  * Approach, Birkha user, 2007
11  *
12  * -----------------------------------------------------------------------------
13  *
14  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
15  *
16  * GNSS-SDR is a software defined Global Navigation
17  * Satellite Systems receiver
18  *
19  * This file is part of GNSS-SDR.
20  *
21  * SPDX-License-Identifier: GPL-3.0-or-later
22  *
23  * -----------------------------------------------------------------------------
24  */
25 
26 #ifndef GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H
27 #define GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H
28 
29 #include "cpu_multicorrelator.h"
30 #include "gnss_synchro.h"
33 #include <gnuradio/block.h>
34 #include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
35 #include <fstream>
36 #include <map>
37 #include <string>
38 #if GNURADIO_USES_STD_POINTERS
39 #include <memory>
40 #else
41 #include <boost/shared_ptr.hpp>
42 #endif
43 
45 
46 #if GNURADIO_USES_STD_POINTERS
47 using glonass_l2_ca_dll_pll_tracking_cc_sptr = std::shared_ptr<Glonass_L2_Ca_Dll_Pll_Tracking_cc>;
48 #else
49 using glonass_l2_ca_dll_pll_tracking_cc_sptr = boost::shared_ptr<Glonass_L2_Ca_Dll_Pll_Tracking_cc>;
50 #endif
51 
52 glonass_l2_ca_dll_pll_tracking_cc_sptr
53 glonass_l2_ca_dll_pll_make_tracking_cc(
54  int64_t fs_in, uint32_t vector_length,
55  bool dump,
56  const std::string& dump_filename,
57  float pll_bw_hz,
58  float dll_bw_hz,
59  float early_late_space_chips);
60 
61 
62 /*!
63  * \brief This class implements a DLL + PLL tracking loop block
64  */
65 class Glonass_L2_Ca_Dll_Pll_Tracking_cc : public gr::block
66 {
67 public:
69 
70  void set_channel(uint32_t channel);
71  void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
72  void start_tracking();
73 
74  int general_work(int noutput_items, gr_vector_int& ninput_items,
75  gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
76 
77  void forecast(int noutput_items, gr_vector_int& ninput_items_required);
78 
79 private:
80  friend glonass_l2_ca_dll_pll_tracking_cc_sptr
81  glonass_l2_ca_dll_pll_make_tracking_cc(
82  int64_t fs_in, uint32_t vector_length,
83  bool dump,
84  const std::string& dump_filename,
85  float pll_bw_hz,
86  float dll_bw_hz,
87  float early_late_space_chips);
88 
90  int64_t fs_in, uint32_t vector_length,
91  bool dump,
92  const std::string& dump_filename,
93  float pll_bw_hz,
94  float dll_bw_hz,
95  float early_late_space_chips);
96 
97  void check_carrier_phase_coherent_initialization();
98 
99  int32_t save_matfile() const;
100 
101  volk_gnsssdr::vector<gr_complex> d_ca_code;
102  volk_gnsssdr::vector<gr_complex> d_correlator_outs;
103  volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
104  volk_gnsssdr::vector<float> d_local_code_shift_chips;
105 
106  Cpu_Multicorrelator multicorrelator_cpu;
107 
108  // PLL and DLL filter library
109  Tracking_2nd_DLL_filter d_code_loop_filter;
110  Tracking_2nd_PLL_filter d_carrier_loop_filter;
111 
112  // file dump
113  std::string d_dump_filename;
114  std::ofstream d_dump_file;
115 
116  std::map<std::string, std::string> systemName;
117  std::string sys;
118 
119  Gnss_Synchro* d_acquisition_gnss_synchro;
120 
121  // tracking configuration vars
122  int64_t d_fs_in;
123  int64_t d_glonass_freq_ch;
124  double d_early_late_spc_chips;
125  uint32_t d_vector_length;
126  uint32_t d_channel;
127 
128  // remaining code phase and carrier phase between tracking loops
129  double d_rem_code_phase_samples;
130  double d_rem_code_phase_chips;
131  float d_rem_carr_phase_rad;
132 
133  // acquisition
134  double d_acq_code_phase_samples;
135  double d_acq_carrier_doppler_hz;
136 
137  // correlator
138  int32_t d_n_correlator_taps;
139 
140  // tracking vars
141  double d_code_freq_chips;
142  double d_code_phase_step_chips;
143  double d_carrier_doppler_hz;
144  double d_carrier_doppler_phase_step_rad;
145  double d_carrier_frequency_hz;
146  double d_carrier_phase_step_rad;
147  double d_acc_carrier_phase_rad;
148  double d_code_phase_samples;
149 
150  // PRN period in samples
151  int32_t d_current_prn_length_samples;
152 
153  // processing samples counters
154  uint64_t d_sample_counter;
155  uint64_t d_acq_sample_stamp;
156 
157  // CN0 estimation and lock detector
158  double d_carrier_lock_test;
159  double d_CN0_SNV_dB_Hz;
160  double d_carrier_lock_threshold;
161  int32_t d_cn0_estimation_counter;
162  int32_t d_carrier_lock_fail_counter;
163 
164  // control vars
165  bool d_enable_tracking;
166  bool d_pull_in;
167  bool d_acc_carrier_phase_initialized;
168 
169  bool d_dump;
170 };
171 
172 #endif // GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H
High optimized CPU vector multiTAP correlator class.
Interface of a 2nd order PLL filter for carrier tracking loop.
This class implements a 2nd order DLL filter for code tracking loop.
Class that implements carrier wipe-off and correlators.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:33
This class implements a 2nd order PLL filter for carrier tracking loop.
This class implements a DLL + PLL tracking loop block.
Interface of a 2nd order DLL filter for code tracking loop.
Interface of the Gnss_Synchro class.