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