GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
gps_l1_ca_dll_pll_tracking_gpu_cc.h
Go to the documentation of this file.
1 /*!
2  * \file gps_l1_ca_dll_pll_tracking_gpu_cc.h
3  * \brief Implementation of a code DLL + carrier PLL tracking block, GPU ACCELERATED
4  * \author Javier Arribas, 2015. jarribas(at)cttc.es
5  *
6  * Code DLL + carrier PLL according to the algorithms described in:
7  * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
8  * A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
9  * Birkhauser, 2007
10  *
11  * -----------------------------------------------------------------------------
12  *
13  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
14  *
15  * GNSS-SDR is a software defined Global Navigation
16  * Satellite Systems receiver
17  *
18  * This file is part of GNSS-SDR.
19  *
20  * SPDX-License-Identifier: GPL-3.0-or-later
21  *
22  * -----------------------------------------------------------------------------
23  */
24 
25 #ifndef GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_GPU_CC_H
26 #define GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_GPU_CC_H
27 
28 #include "cuda_multicorrelator.h"
29 #include "gnss_synchro.h"
32 #include <gnuradio/block.h>
33 #include <fstream>
34 #include <map>
35 #include <string>
36 #include <vector>
37 #if GNURADIO_USES_STD_POINTERS
38 #include <memory>
39 #else
40 #include <boost/shared_ptr.hpp>
41 #endif
42 
44 
45 #if GNURADIO_USES_STD_POINTERS
46 typedef std::shared_ptr<Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc>
47  gps_l1_ca_dll_pll_tracking_gpu_cc_sptr;
48 #else
49 typedef boost::shared_ptr<Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc>
50  gps_l1_ca_dll_pll_tracking_gpu_cc_sptr;
51 #end
52 
53 gps_l1_ca_dll_pll_tracking_gpu_cc_sptr
54 gps_l1_ca_dll_pll_make_tracking_gpu_cc(
55  int64_t fs_in,
56  uint32_t vector_length,
57  bool dump,
58  std::string dump_filename,
59  float pll_bw_hz,
60  float dll_bw_hz,
61  float early_late_space_chips);
62 
63 
64 /*!
65  * \brief This class implements a DLL + PLL tracking loop block
66  */
67 class Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc : public gr::block
68 {
69 public:
71 
72  void set_channel(uint32_t channel);
73  void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
74  void start_tracking();
75 
76  int general_work(int noutput_items, gr_vector_int &ninput_items,
77  gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
78 
79  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
80 
81 private:
82  friend gps_l1_ca_dll_pll_tracking_gpu_cc_sptr
83  gps_l1_ca_dll_pll_make_tracking_gpu_cc(
84  int64_t fs_in,
85  uint32_t vector_length,
86  bool dump,
87  std::string dump_filename,
88  float pll_bw_hz,
89  float dll_bw_hz,
90  float early_late_space_chips);
91 
93  int64_t fs_in,
94  uint32_t vector_length,
95  bool dump,
96  std::string dump_filename,
97  float pll_bw_hz,
98  float dll_bw_hz,
99  float early_late_space_chips);
100  void update_local_code();
101  void update_local_carrier();
102  void check_carrier_phase_coherent_initialization();
103 
104  // PLL and DLL filter library
105  Tracking_2nd_DLL_filter d_code_loop_filter;
106  Tracking_FLL_PLL_filter d_carrier_loop_filter;
107 
108  Gnss_Synchro *d_acquisition_gnss_synchro;
109 
110  std::vector<gr_complex> d_Prompt_buffer;
111 
112  // file dump
113  std::string d_dump_filename;
114  std::ofstream d_dump_file;
115 
116  std::map<std::string, std::string> systemName;
117  std::string sys;
118 
119  // tracking configuration vars
120  int64_t d_if_freq;
121  int64_t d_fs_in;
122  double d_early_late_spc_chips;
123  uint32_t d_vector_length;
124  uint32_t d_channel;
125  int32_t d_n_correlator_taps;
126 
127  // GPU HOST PINNED MEMORY IN/OUT VECTORS
128  cuda_multicorrelator *multicorrelator_gpu;
129  gr_complex *in_gpu;
130  gr_complex *d_correlator_outs;
131  gr_complex *d_ca_code;
132  float *d_local_code_shift_chips;
133 
134  gr_complex *d_Early;
135  gr_complex *d_Prompt;
136  gr_complex *d_Late;
137 
138  // remaining code phase and carrier phase between tracking loops
139  double d_rem_code_phase_samples;
140  double d_rem_code_phase_chips;
141  double d_rem_carrier_phase_rad;
142 
143  // acquisition
144  double d_acq_code_phase_samples;
145  double d_acq_carrier_doppler_hz;
146 
147  // tracking vars
148  double d_code_freq_chips;
149  double d_code_phase_step_chips;
150  double d_carrier_doppler_hz;
151  double d_carrier_phase_step_rad;
152  double d_acc_carrier_phase_cycles;
153  double d_code_phase_samples;
154  double d_pll_to_dll_assist_secs_Ti;
155 
156  // Integration period in samples
157  int32_t d_correlation_length_samples;
158 
159  // processing samples counters
160  uint64_t d_sample_counter;
161  uint64_t d_acq_sample_stamp;
162 
163  // CN0 estimation and lock detector
164  double d_carrier_lock_test;
165  double d_CN0_SNV_dB_Hz;
166  double d_carrier_lock_threshold;
167  int32_t d_carrier_lock_fail_counter;
168  int32_t d_cn0_estimation_counter;
169 
170  // control vars
171  bool d_acc_carrier_phase_initialized;
172  bool d_enable_tracking;
173  bool d_pull_in;
174  bool d_dump;
175 };
176 
177 #endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_GPU_CC_H
Class that implements carrier wipe-off and correlators using NVIDIA CUDA GPU accelerators.
This class implements a 2nd order DLL filter for code tracking loop.
This class implements a DLL + PLL tracking loop block.
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.
Highly optimized CUDA GPU vector multiTAP correlator class.
Interface of a hybrid FLL and PLL filter for tracking carrier loop.
Interface of the Gnss_Synchro class.