GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
dll_pll_veml_tracking.h
Go to the documentation of this file.
1 /*!
2  * \file dll_pll_veml_tracking.h
3  * \brief Implementation of a code DLL + carrier PLL tracking block.
4  * \author Javier Arribas, 2018. jarribas(at)cttc.es
5  * \author Antonio Ramos, 2018 antonio.ramosdet(at)gmail.com
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
10  *
11  * GNSS-SDR is a software defined Global Navigation
12  * Satellite Systems receiver
13  *
14  * This file is part of GNSS-SDR.
15  *
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 
21 #ifndef GNSS_SDR_DLL_PLL_VEML_TRACKING_H
22 #define GNSS_SDR_DLL_PLL_VEML_TRACKING_H
23 
25 #include "dll_pll_conf.h"
26 #include "exponential_smoother.h"
27 #include "tracking_FLL_PLL_filter.h" // for PLL/FLL filter
28 #include "tracking_loop_filter.h" // for DLL filter
29 #include <boost/circular_buffer.hpp>
30 #include <gnuradio/block.h> // for block
31 #include <gnuradio/gr_complex.h> // for gr_complex
32 #include <gnuradio/types.h> // for gr_vector_int, gr_vector...
33 #include <pmt/pmt.h> // for pmt_t
34 #include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
35 #include <cstddef> // for size_t
36 #include <cstdint> // for int32_t
37 #include <fstream> // for ofstream
38 #include <string> // for string
39 #include <typeinfo> // for typeid
40 #include <utility> // for pair
41 #if GNURADIO_USES_STD_POINTERS
42 #include <memory>
43 #else
44 #include <boost/shared_ptr.hpp>
45 #endif
46 
47 class Gnss_Synchro;
49 
50 #if GNURADIO_USES_STD_POINTERS
51 using dll_pll_veml_tracking_sptr = std::shared_ptr<dll_pll_veml_tracking>;
52 #else
53 using dll_pll_veml_tracking_sptr = boost::shared_ptr<dll_pll_veml_tracking>;
54 #endif
55 
56 
57 dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_);
58 
59 /*!
60  * \brief This class implements a code DLL + carrier PLL tracking block.
61  */
62 class dll_pll_veml_tracking : public gr::block
63 {
64 public:
66 
67  void set_channel(uint32_t channel);
68  void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
69  void start_tracking();
70  void stop_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 dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_);
79  explicit dll_pll_veml_tracking(const Dll_Pll_Conf &conf_);
80 
81  void msg_handler_telemetry_to_trk(const pmt::pmt_t &msg);
82  void do_correlation_step(const gr_complex *input_samples);
83  void run_dll_pll();
84  void check_carrier_phase_coherent_initialization();
85  void update_tracking_vars();
86  void clear_tracking_vars();
87  void save_correlation_results();
88  void log_data();
89  bool cn0_and_tracking_lock_status(double coh_integration_time_s);
90  bool acquire_secondary();
91  int32_t save_matfile() const;
92 
93  Cpu_Multicorrelator_Real_Codes d_multicorrelator_cpu;
94  Cpu_Multicorrelator_Real_Codes d_correlator_data_cpu; // for data channel
95 
96  Dll_Pll_Conf d_trk_parameters;
97 
98  Exponential_Smoother d_cn0_smoother;
99  Exponential_Smoother d_carrier_lock_test_smoother;
100 
101  Tracking_loop_filter d_code_loop_filter;
102  Tracking_FLL_PLL_filter d_carrier_loop_filter;
103 
104  Gnss_Synchro *d_acquisition_gnss_synchro;
105 
106  volk_gnsssdr::vector<float> d_tracking_code;
107  volk_gnsssdr::vector<float> d_data_code;
108  volk_gnsssdr::vector<float> d_local_code_shift_chips;
109  volk_gnsssdr::vector<gr_complex> d_correlator_outs;
110  volk_gnsssdr::vector<gr_complex> d_Prompt_Data;
111  volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
112 
113  boost::circular_buffer<float> d_dll_filt_history;
114  boost::circular_buffer<std::pair<double, double>> d_code_ph_history;
115  boost::circular_buffer<std::pair<double, double>> d_carr_ph_history;
116  boost::circular_buffer<gr_complex> d_Prompt_circular_buffer;
117 
118  const size_t int_type_hash_code = typeid(int).hash_code();
119 
120  double d_signal_carrier_freq;
121  double d_code_period;
122  double d_code_chip_rate;
123  double d_acq_code_phase_samples;
124  double d_acq_carrier_doppler_hz;
125  double d_current_correlation_time_s;
126  double d_carr_phase_error_hz;
127  double d_carr_freq_error_hz;
128  double d_carr_error_filt_hz;
129  double d_code_error_chips;
130  double d_code_error_filt_chips;
131  double d_code_freq_chips;
132  double d_carrier_doppler_hz;
133  double d_acc_carrier_phase_rad;
134  double d_rem_code_phase_chips;
135  double d_T_chip_seconds;
136  double d_T_prn_seconds;
137  double d_T_prn_samples;
138  double d_K_blk_samples;
139  double d_carrier_lock_test;
140  double d_CN0_SNV_dB_Hz;
141  double d_carrier_lock_threshold;
142  double d_carrier_phase_step_rad;
143  double d_carrier_phase_rate_step_rad;
144  double d_code_phase_step_chips;
145  double d_code_phase_rate_step_chips;
146  double d_rem_code_phase_samples;
147 
148  gr_complex *d_Very_Early;
149  gr_complex *d_Early;
150  gr_complex *d_Prompt;
151  gr_complex *d_Late;
152  gr_complex *d_Very_Late;
153 
154  gr_complex d_VE_accu;
155  gr_complex d_E_accu;
156  gr_complex d_P_accu;
157  gr_complex d_P_accu_old;
158  gr_complex d_L_accu;
159  gr_complex d_VL_accu;
160  gr_complex d_P_data_accu;
161 
162  std::string d_secondary_code_string;
163  std::string d_data_secondary_code_string;
164  std::string d_systemName;
165  std::string d_signal_type;
166  std::string d_signal_pretty_name;
167  std::string d_dump_filename;
168 
169  std::ofstream d_dump_file;
170 
171  uint64_t d_sample_counter;
172  uint64_t d_acq_sample_stamp;
173 
174  float *d_prompt_data_shift;
175  float d_rem_carr_phase_rad;
176 
177  int32_t d_symbols_per_bit;
178  int32_t d_preamble_length_symbols;
179  int32_t d_state;
180  int32_t d_correlation_length_ms;
181  int32_t d_n_correlator_taps;
182  int32_t d_current_prn_length_samples;
183  int32_t d_extend_correlation_symbols_count;
184  int32_t d_current_symbol;
185  int32_t d_current_data_symbol;
186  int32_t d_cn0_estimation_counter;
187  int32_t d_carrier_lock_fail_counter;
188  int32_t d_code_lock_fail_counter;
189  int32_t d_code_samples_per_chip; // All signals have 1 sample per chip code except Gal. E1 which has 2 (CBOC disabled) or 12 (CBOC enabled)
190  int32_t d_code_length_chips;
191 
192  uint32_t d_channel;
193  uint32_t d_secondary_code_length;
194  uint32_t d_data_secondary_code_length;
195 
196  bool d_pull_in_transitory;
197  bool d_corrected_doppler;
198  bool d_interchange_iq;
199  bool d_veml;
200  bool d_cloop;
201  bool d_secondary;
202  bool d_dump;
203  bool d_dump_mat;
204  bool d_acc_carrier_phase_initialized;
205  bool d_enable_extended_integration;
206 };
207 
208 #endif // GNSS_SDR_DLL_PLL_VEML_TRACKING_H
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
Highly optimized CPU vector multiTAP correlator class using real-valued local codes.
Class that implements a first-order exponential smoother.
Class that implements carrier wipe-off and correlators.
This class implements a code DLL + carrier PLL tracking block.
Class that contains all the configuration parameters for generic tracking block based on a DLL and a ...
Generic 1st to 3rd order loop filter implementation.
This class implements a generic 1st, 2nd or 3rd order loop filter.
Interface of a hybrid FLL and PLL filter for tracking carrier loop.
Class that implements an exponential smoother.