GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
pcps_cccwsr_acquisition_cc.h
Go to the documentation of this file.
1 /*!
2  * \file pcps_cccwsr_acquisition_cc.h
3  * \brief This class implements a Parallel Code Phase Search acquisition
4  * with Coherent Channel Combining With Sign Recovery scheme.
5  * \author Marc Molina, 2013. marc.molina.pena(at)gmail.com
6  *
7  * D.Borio, C.O'Driscoll, G.Lachapelle, "Coherent, Noncoherent and
8  * Differentially Coherent Combining Techniques for Acquisition of
9  * New Composite GNSS Signals", IEEE Transactions On Aerospace and
10  * Electronic Systems vol. 45 no. 3, July 2009, section IV
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_PCPS_CCCWSR_ACQUISITION_CC_H
24 #define GNSS_SDR_PCPS_CCCWSR_ACQUISITION_CC_H
25 
26 #include "acq_conf.h"
28 #include "channel_fsm.h"
29 #include "gnss_sdr_fft.h"
30 #include "gnss_synchro.h"
31 #include <gnuradio/block.h>
32 #include <gnuradio/gr_complex.h>
33 #include <fstream>
34 #include <memory>
35 #include <string>
36 #include <utility>
37 #include <vector>
38 
39 /** \addtogroup Acquisition
40  * \{ */
41 /** \addtogroup Acq_gnuradio_blocks
42  * \{ */
43 
44 
46 
47 using pcps_cccwsr_acquisition_cc_sptr = gnss_shared_ptr<pcps_cccwsr_acquisition_cc>;
48 
49 pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc(const Acq_Conf& conf);
50 
51 /*!
52  * \brief This class implements a Parallel Code Phase Search Acquisition with
53  * Coherent Channel Combining With Sign Recovery scheme.
54  */
56 {
57 public:
58  /*!
59  * \brief Default destructor.
60  */
62 
63  /*!
64  * \brief Set acquisition/tracking common Gnss_Synchro object pointer
65  * to exchange synchronization data between acquisition and tracking blocks.
66  * \param p_gnss_synchro Satellite information shared by the processing blocks.
67  */
68  inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override
69  {
70  d_gnss_synchro = p_gnss_synchro;
71  }
72 
73  /*!
74  * \brief Returns the maximum peak of grid search.
75  */
76  inline uint32_t mag() const override
77  {
78  return d_mag;
79  }
80 
81  /*!
82  * \brief Sets local code for CCCWSR acquisition algorithm.
83  * \param data_code - Pointer to the data PRN code.
84  * \param pilot_code - Pointer to the pilot PRN code.
85  */
86  void set_local_code(std::complex<float>* code_data, std::complex<float>* code_pilot) override;
87 
88  /*!
89  * \brief Starts acquisition algorithm, turning from standby mode to
90  * active mode
91  * \param active - bool that activates/deactivates the block.
92  */
93  inline void set_active(bool active) override
94  {
95  if (!active)
96  {
97  d_state = 0;
98  }
99 
100  d_active = active;
101  }
102 
103  /*!
104  * \brief Set acquisition channel unique ID
105  * \param channel - receiver channel.
106  */
107  inline void set_channel(uint32_t channel) override
108  {
109  d_channel = channel;
110  }
111 
112  /*!
113  * \brief Set channel fsm associated to this acquisition instance
114  */
115  inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
116  {
117  d_channel_fsm = std::move(channel_fsm);
118  }
119 
120  /*!
121  * \brief Coherent Channel Combining With Sign Recovery Acquisition signal processing.
122  */
123  int general_work(int noutput_items, gr_vector_int& ninput_items,
124  gr_vector_const_void_star& input_items,
125  gr_vector_void_star& output_items) override;
126 
127 private:
128  friend pcps_cccwsr_acquisition_cc_sptr
129  pcps_cccwsr_make_acquisition_cc(const Acq_Conf& conf);
130 
131  explicit pcps_cccwsr_acquisition_cc(const Acq_Conf& conf);
132 
133  void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift, int32_t doppler_offset);
134 
135  std::ofstream d_dump_file;
136  std::string d_satellite_str;
137  const Acq_Conf d_acq_params;
138 
139  Gnss_Synchro* d_gnss_synchro;
140 
141  int64_t d_fs_in;
142  uint64_t d_sample_counter;
143 
144  float d_mag;
145  float d_input_power;
146  float d_test_statistics;
147 
148  int32_t d_state;
149  uint32_t d_doppler_resolution;
150  uint32_t d_well_count;
151  const uint32_t d_fft_size;
152  uint32_t d_num_doppler_bins;
153  uint32_t d_code_phase;
154  uint32_t d_channel;
155 
156  bool d_active;
157 
158  std::weak_ptr<ChannelFsm> d_channel_fsm;
159 
160  std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
161  std::unique_ptr<gnss_fft_complex_rev> d_ifft;
162 
163  std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
164  std::vector<gr_complex> d_fft_code_data;
165  std::vector<gr_complex> d_fft_code_pilot;
166  std::vector<gr_complex> d_data_correlation;
167  std::vector<gr_complex> d_pilot_correlation;
168  std::vector<gr_complex> d_correlation_plus;
169  std::vector<gr_complex> d_correlation_minus;
170  std::vector<float> d_magnitude;
171 };
172 
173 
174 /** \} */
175 /** \} */
176 #endif // GNSS_SDR_PCPS_CCCWSR_ACQUISITION_CC_H
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
Coherent Channel Combining With Sign Recovery Acquisition signal processing.
Helper file for FFT interface.
Header file of the interface to an acquisition implementation GNSS block.
void set_local_code(std::complex< float > *code_data, std::complex< float > *code_pilot) override
Sets local code for CCCWSR acquisition algorithm.
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) override
Set acquisition/tracking common Gnss_Synchro object pointer to exchange synchronization data between ...
Class that contains all the configuration parameters for generic acquisition block based on the PCPS ...
Interface of the State Machine for channel.
void set_channel_fsm(std::weak_ptr< ChannelFsm > channel_fsm) override
Set channel fsm associated to this acquisition instance.
void set_channel(uint32_t channel) override
Set acquisition channel unique ID.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
This class implements a Parallel Code Phase Search Acquisition with Coherent Channel Combining With S...
void set_active(bool active) override
Starts acquisition algorithm, turning from standby mode to active mode.
uint32_t mag() const override
Returns the maximum peak of grid search.
~pcps_cccwsr_acquisition_cc()
Default destructor.
This abstract class represents an interface to an acquisition GNSS block.
Interface of the Gnss_Synchro class.