GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
galileo_pcps_8ms_acquisition_cc.h
Go to the documentation of this file.
1 /*!
2  * \file galileo_pcps_8ms_acquisition_cc.h
3  * \brief This class implements a Parallel Code Phase Search Acquisition for
4  * Galileo E1 signals with coherent integration time = 8 ms (two codes)
5  * \author Marc Molina, 2013. marc.molina.pena(at)gmail.com
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10  * This file is part of GNSS-SDR.
11  *
12  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
13  * SPDX-License-Identifier: GPL-3.0-or-later
14  *
15  * -----------------------------------------------------------------------------
16  */
17 
18 #ifndef GNSS_SDR_PCPS_8MS_ACQUISITION_CC_H
19 #define GNSS_SDR_PCPS_8MS_ACQUISITION_CC_H
20 
21 #include "acq_conf.h"
23 #include "channel_fsm.h"
24 #include "gnss_sdr_fft.h"
25 #include "gnss_synchro.h"
26 #include <gnuradio/block.h>
27 #include <gnuradio/gr_complex.h>
28 #include <fstream>
29 #include <memory>
30 #include <string>
31 #include <utility>
32 #include <vector>
33 
34 /** \addtogroup Acquisition
35  * \{ */
36 /** \addtogroup Acq_gnuradio_blocks
37  * \{ */
38 
39 
41 
42 using galileo_pcps_8ms_acquisition_cc_sptr = gnss_shared_ptr<galileo_pcps_8ms_acquisition_cc>;
43 
44 galileo_pcps_8ms_acquisition_cc_sptr
45 galileo_pcps_8ms_make_acquisition_cc(const Acq_Conf& conf);
46 
47 /*!
48  * \brief This class implements a Parallel Code Phase Search Acquisition for
49  * Galileo E1 signals with coherent integration time = 8 ms (two codes)
50  */
52 {
53 public:
54  /*!
55  * \brief Default destructor.
56  */
58 
59  /*!
60  * \brief Set acquisition/tracking common Gnss_Synchro object pointer
61  * to exchange synchronization data between acquisition and tracking blocks.
62  * \param p_gnss_synchro Satellite information shared by the processing blocks.
63  */
64  inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override
65  {
66  d_gnss_synchro = p_gnss_synchro;
67  }
68 
69  /*!
70  * \brief Returns the maximum peak of grid search.
71  */
72  inline uint32_t mag() const override
73  {
74  return d_mag;
75  }
76 
77  /*!
78  * \brief Sets local code for PCPS acquisition algorithm.
79  * \param code - Pointer to the PRN code.
80  */
81  void set_local_code(std::complex<float>* code) override;
82 
83  /*!
84  * \brief Starts acquisition algorithm, turning from standby mode to
85  * active mode
86  * \param active - bool that activates/deactivates the block.
87  */
88  inline void set_active(bool active) override
89  {
90  if (!active)
91  {
92  d_state = 0;
93  }
94 
95  d_active = active;
96  }
97 
98  /*!
99  * \brief Set acquisition channel unique ID
100  * \param channel - receiver channel.
101  */
102  inline void set_channel(uint32_t channel) override
103  {
104  d_channel = channel;
105  }
106 
107  /*!
108  * \brief Set channel fsm associated to this acquisition instance
109  */
110  inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
111  {
112  d_channel_fsm = std::move(channel_fsm);
113  }
114 
115  /*!
116  * \brief Parallel Code Phase Search Acquisition signal processing.
117  */
118  int general_work(int noutput_items, gr_vector_int& ninput_items,
119  gr_vector_const_void_star& input_items,
120  gr_vector_void_star& output_items) override;
121 
122 private:
123  friend galileo_pcps_8ms_acquisition_cc_sptr
124  galileo_pcps_8ms_make_acquisition_cc(const Acq_Conf& conf);
125 
126  explicit galileo_pcps_8ms_acquisition_cc(const Acq_Conf& conf);
127 
128  void calculate_magnitudes(
129  gr_complex* fft_begin,
130  int32_t doppler_shift,
131  int32_t doppler_offset);
132 
133  std::string d_satellite_str;
134  const Acq_Conf d_acq_params;
135  std::ofstream d_dump_file;
136 
137  Gnss_Synchro* d_gnss_synchro;
138 
139  uint64_t d_sample_counter;
140 
141  float d_mag;
142  float d_input_power;
143  float d_test_statistics;
144  int32_t d_state;
145  uint32_t d_channel;
146  uint32_t d_well_count;
147  const uint32_t d_fft_size;
148  uint32_t d_num_doppler_bins;
149  uint32_t d_code_phase;
150 
151  bool d_active;
152 
153  std::weak_ptr<ChannelFsm> d_channel_fsm;
154  std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
155  std::unique_ptr<gnss_fft_complex_rev> d_ifft;
156 
157  std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
158  std::vector<gr_complex> d_fft_code_A;
159  std::vector<gr_complex> d_fft_code_B;
160  std::vector<float> d_magnitude;
161 };
162 
163 
164 /** \} */
165 /** \} */
166 #endif // GNSS_SDR_PCPS_8MS_ACQUISITION_CC_H
void set_channel_fsm(std::weak_ptr< ChannelFsm > channel_fsm) override
Set channel fsm associated to this acquisition instance.
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.
Helper file for FFT interface.
Header file of the interface to an acquisition implementation GNSS block.
~galileo_pcps_8ms_acquisition_cc()
Default destructor.
Class that contains all the configuration parameters for generic acquisition block based on the PCPS ...
Interface of the State Machine for channel.
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) override
Set acquisition/tracking common Gnss_Synchro object pointer to exchange synchronization data between ...
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
uint32_t 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 class implements a Parallel Code Phase Search Acquisition for Galileo E1 signals with coherent i...
void set_channel(uint32_t channel) override
Set acquisition channel unique ID.
This abstract class represents an interface to an acquisition GNSS block.
void set_local_code(std::complex< float > *code) override
Sets local code for PCPS acquisition algorithm.
Interface of the Gnss_Synchro class.