GNSS-SDR  0.0.14
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  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10  * This file is part of GNSS-SDR.
11  *
12  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
13  * SPDX-License-Identifier: GPL-3.0-or-later
14  *
15  * -----------------------------------------------------------------------------
16  */
17 
18 #ifndef GNSS_SDR_DLL_PLL_VEML_TRACKING_H
19 #define GNSS_SDR_DLL_PLL_VEML_TRACKING_H
20 
22 #include "dll_pll_conf.h"
23 #include "exponential_smoother.h"
24 #include "gnss_block_interface.h"
25 #include "tracking_FLL_PLL_filter.h" // for PLL/FLL filter
26 #include "tracking_loop_filter.h" // for DLL filter
27 #include <boost/circular_buffer.hpp>
28 #include <gnuradio/block.h> // for block
29 #include <gnuradio/gr_complex.h> // for gr_complex
30 #include <gnuradio/types.h> // for gr_vector_int, gr_vector...
31 #include <pmt/pmt.h> // for pmt_t
32 #include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
33 #include <cstddef> // for size_t
34 #include <cstdint> // for int32_t
35 #include <fstream> // for ofstream
36 #include <string> // for string
37 #include <typeinfo> // for typeid
38 #include <utility> // for pair
39 
40 /** \addtogroup Tracking
41  * \{ */
42 /** \addtogroup Tracking_gnuradio_blocks tracking_gr_blocks
43  * GNU Radio blocks for GNSS signal tracking.
44  * \{ */
45 
46 
47 class Gnss_Synchro;
49 
50 using dll_pll_veml_tracking_sptr = gnss_shared_ptr<dll_pll_veml_tracking>;
51 
52 dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_);
53 
54 /*!
55  * \brief This class implements a code DLL + carrier PLL tracking block.
56  */
57 class dll_pll_veml_tracking : public gr::block
58 {
59 public:
61 
62  void set_channel(uint32_t channel);
63  void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
64  void start_tracking();
65  void stop_tracking();
66 
67  int general_work(int noutput_items, gr_vector_int &ninput_items,
68  gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
69 
70  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
71 
72 private:
73  friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_);
74  explicit dll_pll_veml_tracking(const Dll_Pll_Conf &conf_);
75 
76  void msg_handler_telemetry_to_trk(const pmt::pmt_t &msg);
77  void do_correlation_step(const gr_complex *input_samples);
78  void run_dll_pll();
79  void check_carrier_phase_coherent_initialization();
80  void update_tracking_vars();
81  void clear_tracking_vars();
82  void save_correlation_results();
83  void log_data();
84  bool cn0_and_tracking_lock_status(double coh_integration_time_s);
85  bool acquire_secondary();
86  int32_t save_matfile() const;
87 
88  Cpu_Multicorrelator_Real_Codes d_multicorrelator_cpu;
89  Cpu_Multicorrelator_Real_Codes d_correlator_data_cpu; // for data channel
90 
91  Dll_Pll_Conf d_trk_parameters;
92 
93  Exponential_Smoother d_cn0_smoother;
94  Exponential_Smoother d_carrier_lock_test_smoother;
95 
96  Tracking_loop_filter d_code_loop_filter;
97  Tracking_FLL_PLL_filter d_carrier_loop_filter;
98 
99  Gnss_Synchro *d_acquisition_gnss_synchro;
100 
101  volk_gnsssdr::vector<float> d_tracking_code;
102  volk_gnsssdr::vector<float> d_data_code;
103  volk_gnsssdr::vector<float> d_local_code_shift_chips;
104  volk_gnsssdr::vector<gr_complex> d_correlator_outs;
105  volk_gnsssdr::vector<gr_complex> d_Prompt_Data;
106  volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
107 
108  boost::circular_buffer<float> d_dll_filt_history;
109  boost::circular_buffer<std::pair<double, double>> d_code_ph_history;
110  boost::circular_buffer<std::pair<double, double>> d_carr_ph_history;
111  boost::circular_buffer<gr_complex> d_Prompt_circular_buffer;
112 
113  const size_t int_type_hash_code = typeid(int).hash_code();
114 
115  double d_signal_carrier_freq;
116  double d_code_period;
117  double d_code_chip_rate;
118  double d_acq_code_phase_samples;
119  double d_acq_carrier_doppler_hz;
120  double d_current_correlation_time_s;
121  double d_carr_phase_error_hz;
122  double d_carr_freq_error_hz;
123  double d_carr_error_filt_hz;
124  double d_code_error_chips;
125  double d_code_error_filt_chips;
126  double d_code_freq_chips;
127  double d_carrier_doppler_hz;
128  double d_acc_carrier_phase_rad;
129  double d_rem_code_phase_chips;
130  double d_T_chip_seconds;
131  double d_T_prn_seconds;
132  double d_T_prn_samples;
133  double d_K_blk_samples;
134  double d_carrier_lock_test;
135  double d_CN0_SNV_dB_Hz;
136  double d_carrier_lock_threshold;
137  double d_carrier_phase_step_rad;
138  double d_carrier_phase_rate_step_rad;
139  double d_code_phase_step_chips;
140  double d_code_phase_rate_step_chips;
141  double d_rem_code_phase_samples;
142 
143  gr_complex *d_Very_Early;
144  gr_complex *d_Early;
145  gr_complex *d_Prompt;
146  gr_complex *d_Late;
147  gr_complex *d_Very_Late;
148 
149  gr_complex d_VE_accu;
150  gr_complex d_E_accu;
151  gr_complex d_P_accu;
152  gr_complex d_P_accu_old;
153  gr_complex d_L_accu;
154  gr_complex d_VL_accu;
155  gr_complex d_P_data_accu;
156 
157  std::string d_secondary_code_string;
158  std::string d_data_secondary_code_string;
159  std::string d_systemName;
160  std::string d_signal_type;
161  std::string d_signal_pretty_name;
162  std::string d_dump_filename;
163 
164  std::ofstream d_dump_file;
165 
166  uint64_t d_sample_counter;
167  uint64_t d_acq_sample_stamp;
168 
169  float *d_prompt_data_shift;
170  float d_rem_carr_phase_rad;
171 
172  int32_t d_symbols_per_bit;
173  int32_t d_preamble_length_symbols;
174  int32_t d_state;
175  int32_t d_correlation_length_ms;
176  int32_t d_n_correlator_taps;
177  int32_t d_current_prn_length_samples;
178  int32_t d_extend_correlation_symbols_count;
179  int32_t d_current_symbol;
180  int32_t d_current_data_symbol;
181  int32_t d_cn0_estimation_counter;
182  int32_t d_carrier_lock_fail_counter;
183  int32_t d_code_lock_fail_counter;
184  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)
185  int32_t d_code_length_chips;
186 
187  uint32_t d_channel;
188  uint32_t d_secondary_code_length;
189  uint32_t d_data_secondary_code_length;
190 
191  bool d_pull_in_transitory;
192  bool d_corrected_doppler;
193  bool d_interchange_iq;
194  bool d_veml;
195  bool d_cloop;
196  bool d_secondary;
197  bool d_dump;
198  bool d_dump_mat;
199  bool d_acc_carrier_phase_initialized;
200  bool d_enable_extended_integration;
201 };
202 
203 
204 /** \} */
205 /** \} */
206 #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:38
This interface represents a GNSS block.
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.