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