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