GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
glonass_l2_ca_dll_pll_tracking_cc.h
Go to the documentation of this file.
1 /*!
2  * \file glonass_l2_ca_dll_pll_tracking_cc.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  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
15  * This file is part of GNSS-SDR.
16  *
17  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
18  * SPDX-License-Identifier: GPL-3.0-or-later
19  *
20  * -----------------------------------------------------------------------------
21  */
22 
23 #ifndef GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H
24 #define GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H
25 
26 #include "cpu_multicorrelator.h"
27 #include "gnss_block_interface.h"
28 #include "gnss_synchro.h"
31 #include <gnuradio/block.h>
32 #include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
33 #include <fstream>
34 #include <map>
35 #include <string>
36 
37 /** \addtogroup Tracking
38  * \{ */
39 /** \addtogroup Tracking_gnuradio_blocks
40  * \{ */
41 
42 
44 
45 using glonass_l2_ca_dll_pll_tracking_cc_sptr = gnss_shared_ptr<Glonass_L2_Ca_Dll_Pll_Tracking_cc>;
46 
47 glonass_l2_ca_dll_pll_tracking_cc_sptr
48 glonass_l2_ca_dll_pll_make_tracking_cc(
49  int64_t fs_in, uint32_t vector_length,
50  bool dump,
51  const std::string& dump_filename,
52  float pll_bw_hz,
53  float dll_bw_hz,
54  float early_late_space_chips);
55 
56 
57 /*!
58  * \brief This class implements a DLL + PLL tracking loop block
59  */
60 class Glonass_L2_Ca_Dll_Pll_Tracking_cc : public gr::block
61 {
62 public:
64 
65  void set_channel(uint32_t channel);
66  void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
67  void start_tracking();
68 
69  int general_work(int noutput_items, gr_vector_int& ninput_items,
70  gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
71 
72  void forecast(int noutput_items, gr_vector_int& ninput_items_required);
73 
74 private:
75  friend glonass_l2_ca_dll_pll_tracking_cc_sptr
76  glonass_l2_ca_dll_pll_make_tracking_cc(
77  int64_t fs_in, uint32_t vector_length,
78  bool dump,
79  const std::string& dump_filename,
80  float pll_bw_hz,
81  float dll_bw_hz,
82  float early_late_space_chips);
83 
85  int64_t fs_in, uint32_t vector_length,
86  bool dump,
87  const std::string& dump_filename,
88  float pll_bw_hz,
89  float dll_bw_hz,
90  float early_late_space_chips);
91 
92  void check_carrier_phase_coherent_initialization();
93 
94  int32_t save_matfile() const;
95 
96  volk_gnsssdr::vector<gr_complex> d_ca_code;
97  volk_gnsssdr::vector<gr_complex> d_correlator_outs;
98  volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
99  volk_gnsssdr::vector<float> d_local_code_shift_chips;
100 
101  Cpu_Multicorrelator multicorrelator_cpu;
102 
103  // PLL and DLL filter library
104  Tracking_2nd_DLL_filter d_code_loop_filter;
105  Tracking_2nd_PLL_filter d_carrier_loop_filter;
106 
107  // file dump
108  std::string d_dump_filename;
109  std::ofstream d_dump_file;
110 
111  std::map<std::string, std::string> systemName;
112  std::string sys;
113 
114  Gnss_Synchro* d_acquisition_gnss_synchro;
115 
116  // tracking configuration vars
117  int64_t d_fs_in;
118  int64_t d_glonass_freq_ch;
119  double d_early_late_spc_chips;
120  uint32_t d_vector_length;
121  uint32_t d_channel;
122 
123  // remaining code phase and carrier phase between tracking loops
124  double d_rem_code_phase_samples;
125  double d_rem_code_phase_chips;
126  float d_rem_carr_phase_rad;
127 
128  // acquisition
129  double d_acq_code_phase_samples;
130  double d_acq_carrier_doppler_hz;
131 
132  // correlator
133  int32_t d_n_correlator_taps;
134 
135  // tracking vars
136  double d_code_freq_chips;
137  double d_code_phase_step_chips;
138  double d_carrier_doppler_hz;
139  double d_carrier_doppler_phase_step_rad;
140  double d_carrier_frequency_hz;
141  double d_carrier_phase_step_rad;
142  double d_acc_carrier_phase_rad;
143  double d_code_phase_samples;
144 
145  // PRN period in samples
146  int32_t d_current_prn_length_samples;
147 
148  // processing samples counters
149  uint64_t d_sample_counter;
150  uint64_t d_acq_sample_stamp;
151 
152  // CN0 estimation and lock detector
153  double d_carrier_lock_test;
154  double d_CN0_SNV_dB_Hz;
155  double d_carrier_lock_threshold;
156  int32_t d_cn0_estimation_counter;
157  int32_t d_carrier_lock_fail_counter;
158 
159  // control vars
160  bool d_enable_tracking;
161  bool d_pull_in;
162  bool d_acc_carrier_phase_initialized;
163 
164  bool d_dump;
165 };
166 
167 
168 /** \} */
169 /** \} */
170 #endif // GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H
High optimized CPU vector multiTAP correlator class.
Interface of a 2nd order PLL filter for carrier tracking loop.
This class implements a 2nd order DLL filter for code tracking loop.
Class that implements carrier wipe-off and correlators.
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.
This class implements a 2nd order PLL filter for carrier tracking loop.
This class implements a DLL + PLL tracking loop block.
Interface of a 2nd order DLL filter for code tracking loop.
Interface of the Gnss_Synchro class.