GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
gps_l1_ca_pcps_opencl_acquisition.h
Go to the documentation of this file.
1 /*!
2  * \file gps_l1_ca_pcps_opencl_acquisition.h
3  * \brief Adapts an OpenCL PCPS acquisition block to an
4  * AcquisitionInterface for GPS L1 C/A signals
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_GPS_L1_CA_PCPS_OPENCL_ACQUISITION_H
19 #define GNSS_SDR_GPS_L1_CA_PCPS_OPENCL_ACQUISITION_H
20 
21 #include "channel_fsm.h"
22 #include "gnss_synchro.h"
24 #include <gnuradio/blocks/stream_to_vector.h>
25 #include <memory>
26 #include <string>
27 #include <utility>
28 #include <vector>
29 
30 /** \addtogroup Acquisition
31  * \{ */
32 /** \addtogroup Acq_adapters
33  * \{ */
34 
35 
37 
38 /*!
39  * \brief This class adapts an OpenCL PCPS acquisition block to an
40  * AcquisitionInterface for GPS L1 C/A signals
41  */
43 {
44 public:
46  const std::string& role,
47  unsigned int in_streams,
48  unsigned int out_streams);
49 
50  ~GpsL1CaPcpsOpenClAcquisition() = default;
51 
52  inline std::string role() override
53  {
54  return role_;
55  }
56 
57  /*!
58  * \brief Returns "GPS_L1_CA_PCPS_OpenCl_Acquisition"
59  */
60  inline std::string implementation() override
61  {
62  return "GPS_L1_CA_PCPS_OpenCl_Acquisition";
63  }
64 
65  inline size_t item_size() override
66  {
67  return item_size_;
68  }
69 
70  void connect(gr::top_block_sptr top_block) override;
71  void disconnect(gr::top_block_sptr top_block) override;
72  gr::basic_block_sptr get_left_block() override;
73  gr::basic_block_sptr get_right_block() override;
74 
75  /*!
76  * \brief Set acquisition/tracking common Gnss_Synchro object pointer
77  * to efficiently exchange synchronization data between acquisition and
78  * tracking blocks
79  */
80  void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
81 
82  /*!
83  * \brief Set acquisition channel unique ID
84  */
85  inline void set_channel(unsigned int channel) override
86  {
87  channel_ = channel;
88  acquisition_cc_->set_channel(channel_);
89  }
90 
91  /*!
92  * \brief Set channel fsm associated to this acquisition instance
93  */
94  inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
95  {
96  channel_fsm_ = std::move(channel_fsm);
97  acquisition_cc_->set_channel_fsm(channel_fsm_);
98  }
99 
100  /*!
101  * \brief Set statistics threshold of PCPS algorithm
102  */
103  void set_threshold(float threshold) override;
104 
105  /*!
106  * \brief Set maximum Doppler off grid search
107  */
108  void set_doppler_max(unsigned int doppler_max) override;
109 
110  /*!
111  * \brief Set Doppler steps for the grid search
112  */
113  void set_doppler_step(unsigned int doppler_step) override;
114 
115  /*!
116  * \brief Initializes acquisition algorithm.
117  */
118  void init() override;
119 
120  /*!
121  * \brief Sets local code for GPS L1/CA PCPS acquisition algorithm.
122  */
123  void set_local_code() override;
124 
125  /*!
126  * \brief Returns the maximum peak of grid search
127  */
128  signed int mag() override;
129 
130  /*!
131  * \brief Restart acquisition algorithm
132  */
133  void reset() override;
134  void set_state(int state __attribute__((unused))) override{};
135 
136  /*!
137  * \brief Stop running acquisition
138  */
139  void stop_acquisition() override;
140 
141  void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
142 
143  inline bool opencl_ready() const
144  {
145  bool ready = this->acquisition_cc_->opencl_ready();
146  return ready;
147  }
148 
149 private:
150  float calculate_threshold(float pfa) const;
151  const ConfigurationInterface* configuration_;
152  pcps_opencl_acquisition_cc_sptr acquisition_cc_;
153  gr::blocks::stream_to_vector::sptr stream_to_vector_;
154  std::weak_ptr<ChannelFsm> channel_fsm_;
155  std::vector<std::complex<float>> code_;
156  Gnss_Synchro* gnss_synchro_;
157 
158  std::string item_type_;
159  std::string dump_filename_;
160  std::string role_;
161 
162  int64_t fs_in_;
163  size_t item_size_;
164 
165  float threshold_;
166 
167  unsigned int vector_length_;
168  unsigned int code_length_;
169  unsigned int channel_;
170  unsigned int doppler_max_;
171  unsigned int doppler_step_;
172  unsigned int sampled_ms_;
173  unsigned int max_dwells_;
174  unsigned int in_streams_;
175  unsigned int out_streams_;
176  bool bit_transition_flag_;
177  bool dump_;
178 };
179 
180 
181 /** \} */
182 /** \} */
183 #endif // GNSS_SDR_GPS_L1_CA_PCPS_OPENCL_ACQUISITION_H
void set_doppler_step(unsigned int doppler_step) override
Set Doppler steps for the grid search.
void set_local_code() override
Sets local code for GPS L1/CA PCPS acquisition algorithm.
void set_threshold(float threshold) override
Set statistics threshold of PCPS algorithm.
std::string implementation() override
Returns "GPS_L1_CA_PCPS_OpenCl_Acquisition".
Interface of the State Machine for channel.
void set_channel(unsigned int channel) override
Set acquisition channel unique ID.
void reset() override
Restart acquisition algorithm.
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) override
Set acquisition/tracking common Gnss_Synchro object pointer to efficiently exchange synchronization d...
void stop_acquisition() override
Stop running acquisition.
This abstract class represents an interface to an acquisition GNSS block.
signed int mag() override
Returns the maximum peak of grid search.
void set_channel_fsm(std::weak_ptr< ChannelFsm > channel_fsm) override
Set channel fsm associated to this acquisition instance.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
This abstract class represents an interface to configuration parameters.
void set_doppler_max(unsigned int doppler_max) override
Set maximum Doppler off grid search.
void init() override
Initializes acquisition algorithm.
This class implements a Parallel Code Phase Search Acquisition using OpenCL to offload some functions...
This class adapts an OpenCL PCPS acquisition block to an AcquisitionInterface for GPS L1 C/A signals...
Interface of the Gnss_Synchro class.