GNSS-SDR  0.0.19
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  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
17  * This file is part of GNSS-SDR.
18  *
19  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
20  * SPDX-License-Identifier: GPL-3.0-or-later
21  *
22  * -----------------------------------------------------------------------------
23  */
24 
25 #ifndef GNSS_SDR_GLONASS_L1_CA_DLL_PLL_TRACKING_CC_H
26 #define GNSS_SDR_GLONASS_L1_CA_DLL_PLL_TRACKING_CC_H
27 
28 #include "cpu_multicorrelator.h"
29 #include "gnss_block_interface.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 
39 
40 /** \addtogroup Tracking
41  * \{ */
42 /** \addtogroup Tracking_gnuradio_blocks
43  * \{ */
44 
45 
47 
48 using glonass_l1_ca_dll_pll_tracking_cc_sptr = gnss_shared_ptr<Glonass_L1_Ca_Dll_Pll_Tracking_cc>;
49 
50 glonass_l1_ca_dll_pll_tracking_cc_sptr
51 glonass_l1_ca_dll_pll_make_tracking_cc(
52  int64_t fs_in, uint32_t vector_length,
53  bool dump,
54  const std::string& dump_filename,
55  float pll_bw_hz,
56  float dll_bw_hz,
57  float early_late_space_chips);
58 
59 
60 /*!
61  * \brief This class implements a DLL + PLL tracking loop block
62  */
63 class Glonass_L1_Ca_Dll_Pll_Tracking_cc : public gr::block
64 {
65 public:
67 
68  void set_channel(uint32_t channel);
69  void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
70  void start_tracking();
71 
72  int general_work(int noutput_items, gr_vector_int& ninput_items,
73  gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
74 
75  void forecast(int noutput_items, gr_vector_int& ninput_items_required);
76 
77 private:
78  friend glonass_l1_ca_dll_pll_tracking_cc_sptr
79  glonass_l1_ca_dll_pll_make_tracking_cc(
80  int64_t fs_in, uint32_t vector_length,
81  bool dump,
82  const std::string& dump_filename,
83  float pll_bw_hz,
84  float dll_bw_hz,
85  float early_late_space_chips);
86 
88  int64_t fs_in, uint32_t vector_length,
89  bool dump,
90  const std::string& dump_filename,
91  float pll_bw_hz,
92  float dll_bw_hz,
93  float early_late_space_chips);
94 
95  void check_carrier_phase_coherent_initialization();
96 
97  int32_t save_matfile() const;
98 
99  volk_gnsssdr::vector<gr_complex> d_ca_code;
100  volk_gnsssdr::vector<float> d_local_code_shift_chips;
101  volk_gnsssdr::vector<gr_complex> d_correlator_outs;
102  volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
103 
104  Cpu_Multicorrelator multicorrelator_cpu;
105 
106  // PLL and DLL filter library
107  Tracking_2nd_DLL_filter d_code_loop_filter;
108  Tracking_2nd_PLL_filter d_carrier_loop_filter;
109 
110  Gnss_Synchro* d_acquisition_gnss_synchro;
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  // tracking configuration vars
120  int64_t d_fs_in;
121  int64_t d_glonass_freq_ch;
122  double d_early_late_spc_chips;
123  uint32_t d_vector_length;
124  uint32_t d_channel;
125 
126  // remaining code phase and carrier phase between tracking loops
127  double d_rem_code_phase_samples;
128  double d_rem_code_phase_chips;
129  float d_rem_carr_phase_rad;
130 
131  // acquisition
132  double d_acq_code_phase_samples;
133  double d_acq_carrier_doppler_hz;
134 
135  // tracking vars
136  double d_code_freq_chips;
137  double d_code_phase_step_chips;
138  double d_carrier_doppler_hz;
139  double d_carrier_doppler_phase_step_rad;
140  double d_carrier_frequency_hz;
141  double d_carrier_phase_step_rad;
142  double d_acc_carrier_phase_rad;
143  double d_code_phase_samples;
144 
145  // correlator
146  int32_t d_n_correlator_taps;
147 
148  // PRN period in samples
149  int32_t d_current_prn_length_samples;
150 
151  // processing samples counters
152  uint64_t d_sample_counter;
153  uint64_t d_acq_sample_stamp;
154 
155  // CN0 estimation and lock detector
156  double d_carrier_lock_test;
157  double d_CN0_SNV_dB_Hz;
158  double d_carrier_lock_threshold;
159  int32_t d_carrier_lock_fail_counter;
160  int32_t d_cn0_estimation_counter;
161 
162  // control vars
163  bool d_enable_tracking;
164  bool d_pull_in;
165  bool d_acc_carrier_phase_initialized;
166 
167  bool d_dump;
168 };
169 
170 
171 /** \} */
172 /** \} */
173 #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:38
This interface represents a GNSS block.
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.