GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
pcps_tong_acquisition_cc.h
Go to the documentation of this file.
1/*!
2 * \file pcps_tong_acquisition_cc.h
3 * \brief This class implements a Parallel Code Phase Search Acquisition with
4 * Tong algorithm.
5 * \author Marc Molina, 2013. marc.molina.pena(at)gmail.com
6 *
7 * Acquisition strategy (Kaplan book + CFAR threshold).
8 * <ol>
9 * <li> Compute the input signal power estimation.
10 * <li> Doppler serial search loop.
11 * <li> Perform the FFT-based circular convolution (parallel time search).
12 * <li> Compute the tests statistics for all the cells.
13 * <li> Accumulate the grid of tests statistics with the previous grids.
14 * <li> Record the maximum peak and the associated synchronization parameters.
15 * <li> Compare the maximum averaged test statistics with a threshold.
16 * <li> If the test statistics exceeds the threshold, increment the Tong counter.
17 * <li> Otherwise, decrement the Tong counter.
18 * <li> If the Tong counter is equal to a given maximum value, declare positive
19 * <li> acquisition. If the Tong counter is equa to zero, declare negative
20 * <li> acquisition. Otherwise, process the next block.
21 * </ol>
22 *
23 * Kaplan book: D.Kaplan, J.Hegarty, "Understanding GPS. Principles
24 * and Applications", Artech House, 2006, pp 223-227
25 *
26 * -----------------------------------------------------------------------------
27 *
28 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
29 * This file is part of GNSS-SDR.
30 *
31 * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
32 * SPDX-License-Identifier: GPL-3.0-or-later
33 *
34 * -----------------------------------------------------------------------------
35 */
36
37#ifndef GNSS_SDR_PCPS_TONG_ACQUISITION_CC_H
38#define GNSS_SDR_PCPS_TONG_ACQUISITION_CC_H
39
40#include "acq_conf.h"
42#include "channel_fsm.h"
43#include "gnss_sdr_fft.h"
44#include "gnss_synchro.h"
45#include <gnuradio/block.h>
46#include <gnuradio/gr_complex.h>
47#include <fstream>
48#include <memory> // for weak_ptr
49#include <string>
50#include <utility>
51#include <vector>
52
53/** \addtogroup Acquisition
54 * \{ */
55/** \addtogroup Acq_gnuradio_blocks
56 * \{ */
57
58
60
61using pcps_tong_acquisition_cc_sptr = gnss_shared_ptr<pcps_tong_acquisition_cc>;
62
63pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc(
64 const Acq_Conf& conf,
65 uint32_t tong_init_val,
66 uint32_t tong_max_val,
67 uint32_t tong_max_dwells);
68
69/*!
70 * \brief This class implements a Parallel Code Phase Search Acquisition with
71 * Tong algorithm.
72 */
73class pcps_tong_acquisition_cc : public acquisition_impl_interface
74{
75public:
76 /*!
77 * \brief Default destructor.
78 */
80
81 /*!
82 * \brief Set acquisition/tracking common Gnss_Synchro object pointer
83 * to exchange synchronization data between acquisition and tracking blocks.
84 * \param p_gnss_synchro Satellite information shared by the processing blocks.
85 */
86 inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override
87 {
88 d_gnss_synchro = p_gnss_synchro;
89 }
90
91 /*!
92 * \brief Returns the maximum peak of grid search.
93 */
94 inline uint32_t mag() const override
95 {
96 return d_mag;
97 }
98
99 /*!
100 * \brief Sets local code for TONG acquisition algorithm.
101 * \param code - Pointer to the PRN code.
102 */
103 void set_local_code(std::complex<float>* code) override;
104
105 /*!
106 * \brief Starts acquisition algorithm, turning from standby mode to
107 * active mode
108 * \param active - bool that activates/deactivates the block.
109 */
110 inline void set_active(bool active) override
111 {
112 if (!active)
113 {
114 d_state = 0;
115 }
116
117 d_active = active;
118 }
119
120 /*!
121 * \brief Set acquisition channel unique ID
122 * \param channel - receiver channel.
123 */
124 inline void set_channel(uint32_t channel) override
125 {
126 d_channel = channel;
127 }
128
129 /*!
130 * \brief Set channel fsm associated to this acquisition instance
131 */
132 inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
133 {
134 d_channel_fsm = std::move(channel_fsm);
135 }
136
137 /*!
138 * \brief Parallel Code Phase Search Acquisition signal processing.
139 */
140 int general_work(int noutput_items, gr_vector_int& ninput_items,
141 gr_vector_const_void_star& input_items,
142 gr_vector_void_star& output_items) override;
143
144private:
145 friend pcps_tong_acquisition_cc_sptr
146 pcps_tong_make_acquisition_cc(
147 const Acq_Conf& conf,
148 uint32_t tong_init_val,
149 uint32_t tong_max_val,
150 uint32_t tong_max_dwells);
151
152 pcps_tong_acquisition_cc(
153 const Acq_Conf& conf,
154 uint32_t tong_init_val,
155 uint32_t tong_max_val,
156 uint32_t tong_max_dwells);
157
158 void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift, int32_t doppler_offset);
159
160 std::string d_satellite_str;
161 const Acq_Conf d_acq_params;
162
163 std::ofstream d_dump_file;
164
165 Gnss_Synchro* d_gnss_synchro;
166
167 uint64_t d_sample_counter;
168
169 float d_mag;
170 float d_input_power;
171 float d_test_statistics;
172 int32_t d_state;
173 uint32_t d_channel;
174 uint32_t d_dwell_count;
175 const uint32_t d_tong_init_val;
176 const uint32_t d_tong_max_val;
177 const uint32_t d_tong_max_dwells;
178 uint32_t d_tong_count;
179 const uint32_t d_fft_size;
180 uint32_t d_num_doppler_bins;
181 uint32_t d_code_phase;
182
183 bool d_active;
184
185 std::weak_ptr<ChannelFsm> d_channel_fsm;
186 std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
187 std::unique_ptr<gnss_fft_complex_rev> d_ifft;
188
189 std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
190 std::vector<std::vector<float>> d_grid_data;
191 std::vector<gr_complex> d_fft_codes;
192 std::vector<float> d_magnitude;
193};
194
195
196/** \} */
197/** \} */
198#endif // GNSS_SDR_PCPS_TONG_ACQUISITION_CC_H
Class that contains all the configuration parameters for generic acquisition block based on the PCPS ...
Header file of the interface to an acquisition implementation GNSS block.
Interface of the State Machine for channel.
This is the class that contains the information that is shared by the processing blocks.
This class implements a Parallel Code Phase Search Acquisition with Tong algorithm.
void set_channel_fsm(std::weak_ptr< ChannelFsm > channel_fsm) override
Set channel fsm associated to this acquisition instance.
void set_active(bool active) override
Starts acquisition algorithm, turning from standby mode to active mode.
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override
Parallel Code Phase Search Acquisition signal processing.
~pcps_tong_acquisition_cc()
Default destructor.
uint32_t mag() const override
Returns the maximum peak of grid search.
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) override
Set acquisition/tracking common Gnss_Synchro object pointer to exchange synchronization data between ...
void set_local_code(std::complex< float > *code) override
Sets local code for TONG acquisition algorithm.
void set_channel(uint32_t channel) override
Set acquisition channel unique ID.
Helper file for FFT interface.
Interface of the Gnss_Synchro class.