GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
glonass_l1_ca_dll_pll_c_aid_tracking_sc.h
Go to the documentation of this file.
1 /*!
2  * \file glonass_l1_ca_dll_pll_c_aid_tracking_sc.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_C_AID_TRACKING_SC_H
26 #define GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_SC_H
27 
29 #include "glonass_l1_signal_replica.h"
30 #include "gnss_block_interface.h"
31 #include "gnss_synchro.h"
34 #include <gnuradio/block.h>
35 #include <volk_gnsssdr/volk_gnsssdr.h>
36 #include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
37 #include <deque>
38 #include <fstream>
39 #include <map>
40 #include <string>
41 
42 
43 /** \addtogroup Tracking
44  * \{ */
45 /** \addtogroup Tracking_gnuradio_blocks
46  * \{ */
47 
48 
50 
51 using glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr = gnss_shared_ptr<glonass_l1_ca_dll_pll_c_aid_tracking_sc>;
52 
53 glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr
54 glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(
55  int64_t fs_in, uint32_t vector_length,
56  bool dump,
57  const std::string& dump_filename,
58  float pll_bw_hz,
59  float dll_bw_hz,
60  float pll_bw_narrow_hz,
61  float dll_bw_narrow_hz,
62  int32_t extend_correlation_ms,
63  float early_late_space_chips);
64 
65 
66 /*!
67  * \brief This class implements a DLL + PLL tracking loop block
68  */
70 {
71 public:
73 
74  void set_channel(uint32_t channel);
75  void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
76  void start_tracking();
77 
78  int general_work(int noutput_items, gr_vector_int& ninput_items,
79  gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
80 
81  void forecast(int noutput_items, gr_vector_int& ninput_items_required);
82 
83 private:
84  friend glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr
85  glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(
86  int64_t fs_in, uint32_t vector_length,
87  bool dump,
88  const std::string& dump_filename,
89  float pll_bw_hz,
90  float dll_bw_hz,
91  float pll_bw_narrow_hz,
92  float dll_bw_narrow_hz,
93  int32_t extend_correlation_ms,
94  float early_late_space_chips);
95 
97  int64_t fs_in, uint32_t vector_length,
98  bool dump,
99  const std::string& dump_filename,
100  float pll_bw_hz,
101  float dll_bw_hz,
102  float pll_bw_narrow_hz,
103  float dll_bw_narrow_hz,
104  int32_t extend_correlation_ms,
105  float early_late_space_chips);
106 
107  void msg_handler_preamble_index(const pmt::pmt_t& msg);
108 
109  void check_carrier_phase_coherent_initialization();
110 
111  int32_t save_matfile() const;
112 
113  volk_gnsssdr::vector<gr_complex> d_ca_code;
114  volk_gnsssdr::vector<lv_16sc_t> d_ca_code_16sc;
115  volk_gnsssdr::vector<float> d_local_code_shift_chips;
116  volk_gnsssdr::vector<lv_16sc_t> d_correlator_outs_16sc;
117  volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
118 
119  Cpu_Multicorrelator_16sc multicorrelator_cpu_16sc;
120 
121  // PLL and DLL filter library
122  Tracking_2nd_DLL_filter d_code_loop_filter;
123  Tracking_FLL_PLL_filter d_carrier_loop_filter;
124 
125  // symbol history to detect bit transition
126  std::deque<lv_16sc_t> d_E_history;
127  std::deque<lv_16sc_t> d_P_history;
128  std::deque<lv_16sc_t> d_L_history;
129 
130  Gnss_Synchro* d_acquisition_gnss_synchro;
131 
132  // file dump
133  std::string d_dump_filename;
134  std::ofstream d_dump_file;
135 
136  std::map<std::string, std::string> systemName;
137  std::string sys;
138 
139  // tracking configuration vars
140  int64_t d_fs_in;
141  int64_t d_glonass_freq_ch;
142  double d_early_late_spc_chips;
143  uint32_t d_vector_length;
144  uint32_t d_channel;
145  int32_t d_n_correlator_taps;
146 
147  // remaining code phase and carrier phase between tracking loops
148  double d_rem_code_phase_samples;
149  double d_rem_code_phase_chips;
150  double d_rem_carrier_phase_rad;
151  int32_t d_rem_code_phase_integer_samples;
152 
153  // acquisition
154  double d_acq_code_phase_samples;
155  double d_acq_carrier_doppler_hz;
156 
157  // tracking vars
158  float d_dll_bw_hz;
159  float d_pll_bw_hz;
160  float d_dll_bw_narrow_hz;
161  float d_pll_bw_narrow_hz;
162  double d_code_freq_chips;
163  double d_code_phase_step_chips;
164  double d_carrier_doppler_hz;
165  double d_carrier_frequency_hz;
166  double d_carrier_frequency_old_hz;
167  double d_carrier_phase_step_rad;
168  double d_acc_carrier_phase_cycles;
169  double d_code_phase_samples;
170  double d_pll_to_dll_assist_secs_Ti;
171  double d_carr_phase_error_secs_Ti;
172  double d_code_error_chips_Ti;
173  double d_preamble_timestamp_samples;
174  double d_code_error_filt_chips_s;
175  double d_code_error_filt_chips_Ti;
176  int32_t d_extend_correlation_ms;
177 
178  // Integration period in samples
179  int32_t d_correlation_length_samples;
180 
181  // processing samples counters
182  uint64_t d_sample_counter;
183  uint64_t d_acq_sample_stamp;
184 
185  // CN0 estimation and lock detector
186  int32_t d_cn0_estimation_counter;
187  double d_carrier_lock_test;
188  double d_CN0_SNV_dB_Hz;
189  double d_carrier_lock_threshold;
190  int32_t d_carrier_lock_fail_counter;
191 
192  bool d_enable_extended_integration;
193  bool d_preamble_synchronized;
194 
195  // control vars
196  bool d_enable_tracking;
197  bool d_pull_in;
198  bool d_acc_carrier_phase_initialized;
199 
200  bool d_dump;
201 };
202 
203 
204 /** \} */
205 /** \} */
206 #endif // GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_SC_H
This class implements a 2nd order DLL filter for code tracking loop.
This class implements a hybrid FLL and PLL filter for tracking carrier loop.
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.
Interface of a 2nd order DLL filter for code tracking loop.
Class that implements carrier wipe-off and correlators.
Interface of a hybrid FLL and PLL filter for tracking carrier loop.
This class implements a DLL + PLL tracking loop block.
Highly optimized CPU vector multiTAP correlator class for lv_16sc_t (short int complex) ...
Interface of the Gnss_Synchro class.