GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
galileo_e5a_noncoherent_iq_acquisition_caf_cc.h
Go to the documentation of this file.
1 /*!
2  * \file galileo_e5a_noncoherent_iq_acquisition_caf_cc.h
3  * \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
4  * Galileo E5a data and pilot Signals
5  * \author Marc Sales, 2014. marcsales92(at)gmail.com
6  * \based on work from:
7  * <ul>
8  * <li> Javier Arribas, 2011. jarribas(at)cttc.es
9  * <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
10  * <li> Marc Molina, 2013. marc.molina.pena@gmail.com
11  * </ul>
12  *
13  * -----------------------------------------------------------------------------
14  *
15  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
16  * This file is part of GNSS-SDR.
17  *
18  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
19  * SPDX-License-Identifier: GPL-3.0-or-later
20  *
21  * -----------------------------------------------------------------------------
22  */
23 
24 #ifndef GNSS_SDR_GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H
25 #define GNSS_SDR_GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H
26 
27 #include "acq_conf.h"
29 #include "channel_fsm.h"
30 #include "gnss_sdr_fft.h"
31 #include "gnss_synchro.h"
32 #include <gnuradio/block.h>
33 #include <gnuradio/gr_complex.h>
34 #include <fstream>
35 #include <memory>
36 #include <string>
37 #include <utility>
38 #include <vector>
39 
40 /** \addtogroup Acquisition
41  * \{ */
42 /** \addtogroup Acq_gnuradio_blocks
43  * \{ */
44 
45 
47 
48 using galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr = gnss_shared_ptr<galileo_e5a_noncoherentIQ_acquisition_caf_cc>;
49 
50 galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(
51  const Acq_Conf& conf,
52  bool both_signal_components,
53  int CAF_window_hz,
54  int Zero_padding);
55 
56 /*!
57  * \brief This class implements a Parallel Code Phase Search Acquisition.
58  *
59  * Check \ref Navitec2012 "An Open Source Galileo E1 Software Receiver",
60  * Algorithm 1, for a pseudocode description of this implementation.
61  */
63 {
64 public:
65  /*!
66  * \brief Default destructor.
67  */
69 
70  /*!
71  * \brief Set acquisition/tracking common Gnss_Synchro object pointer
72  * to exchange synchronization data between acquisition and tracking blocks.
73  * \param p_gnss_synchro Satellite information shared by the processing blocks.
74  */
75  inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override
76  {
77  d_gnss_synchro = p_gnss_synchro;
78  }
79 
80  /*!
81  * \brief Returns the maximum peak of grid search.
82  */
83  inline unsigned int mag() const override
84  {
85  return d_mag;
86  }
87 
88  /*!
89  * \brief Sets local code for PCPS acquisition algorithm.
90  * \param code - Pointer to the PRN code.
91  */
92  void set_local_code(std::complex<float>* code, std::complex<float>* codeQ) override;
93 
94  /*!
95  * \brief Starts acquisition algorithm, turning from standby mode to
96  * active mode
97  * \param active - bool that activates/deactivates the block.
98  */
99  inline void set_active(bool active) override
100  {
101  if (!active)
102  {
103  d_state = 0;
104  }
105 
106  d_active = active;
107  }
108 
109  /*!
110  * \brief Set acquisition channel unique ID
111  * \param channel - receiver channel.
112  */
113  inline void set_channel(unsigned int channel) override
114  {
115  d_channel = channel;
116  }
117 
118  /*!
119  * \brief Set channel fsm associated to this acquisition instance
120  */
121  inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
122  {
123  d_channel_fsm = std::move(channel_fsm);
124  }
125 
126  /*!
127  * \brief Parallel Code Phase Search Acquisition signal processing.
128  */
129  int general_work(int noutput_items, gr_vector_int& ninput_items,
130  gr_vector_const_void_star& input_items,
131  gr_vector_void_star& output_items) override;
132 
133 private:
134  friend galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr
135  galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(
136  const Acq_Conf& conf,
137  bool both_signal_components,
138  int CAF_window_hz,
139  int Zero_padding);
140 
142  const Acq_Conf& conf,
143  bool both_signal_components,
144  int CAF_window_hz,
145  int Zero_padding);
146 
147  void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
148  int doppler_offset);
149 
150  float estimate_input_power(gr_complex* in);
151 
152  std::string d_satellite_str;
153 
154  const Acq_Conf d_acq_params;
155  std::ofstream d_dump_file;
156 
157  Gnss_Synchro* d_gnss_synchro;
158 
159  uint64_t d_sample_counter;
160 
161  float d_mag;
162  float d_input_power;
163  float d_test_statistics;
164 
165  int d_state;
166  const int d_CAF_window_hz;
167  int d_buffer_count;
168  int d_doppler_resolution;
169  const int d_fft_size;
170  int d_num_doppler_bins;
171  unsigned int d_gr_stream_buffer;
172  unsigned int d_channel;
173  unsigned int d_well_count;
174  unsigned int d_sampled_ms;
175  unsigned int d_code_phase;
176 
177  bool d_active;
178  const bool d_both_signal_components;
179 
180  std::weak_ptr<ChannelFsm> d_channel_fsm;
181  std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
182  std::unique_ptr<gnss_fft_complex_rev> d_ifft;
183 
184  std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
185  std::vector<gr_complex> d_fft_code_I_A;
186  std::vector<gr_complex> d_fft_code_I_B;
187  std::vector<gr_complex> d_fft_code_Q_A;
188  std::vector<gr_complex> d_fft_code_Q_B;
189  std::vector<gr_complex> d_inbuffer;
190  std::vector<float> d_magnitudeIA;
191  std::vector<float> d_magnitudeIB;
192  std::vector<float> d_magnitudeQA;
193  std::vector<float> d_magnitudeQB;
194  std::vector<float> d_CAF_vector;
195  std::vector<float> d_CAF_vector_I;
196  std::vector<float> d_CAF_vector_Q;
197 };
198 
199 
200 /** \} */
201 /** \} */
202 #endif // GNSS_SDR_GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H
Helper file for FFT interface.
Header file of the interface to an acquisition implementation GNSS block.
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, std::complex< float > *codeQ) override
Sets local code for PCPS acquisition algorithm.
Class that contains all the configuration parameters for generic acquisition block based on the PCPS ...
Interface of the State Machine for channel.
unsigned int mag() const override
Returns the maximum peak of grid search.
void set_active(bool active) override
Starts acquisition algorithm, turning from standby mode to active mode.
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.
void set_channel_fsm(std::weak_ptr< ChannelFsm > channel_fsm) override
Set channel fsm associated to this acquisition instance.
void set_channel(unsigned int channel) override
Set acquisition channel unique ID.
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.
~galileo_e5a_noncoherentIQ_acquisition_caf_cc()
Default destructor.
This abstract class represents an interface to an acquisition GNSS block.
Interface of the Gnss_Synchro class.