2014-07-07 19:06:26 +00:00
|
|
|
/*!
|
2014-08-05 00:01:37 +00:00
|
|
|
* \file galileo_e5a_noncoherent_iq_acquisition_caf_cc.h
|
2014-07-07 19:06:26 +00:00
|
|
|
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
|
|
|
|
* Galileo E5a data and pilot Signals
|
|
|
|
* \author Marc Sales, 2014. marcsales92(at)gmail.com
|
2014-08-05 00:01:37 +00:00
|
|
|
* \based on work from:
|
2016-05-02 21:46:30 +00:00
|
|
|
* <ul>
|
2014-08-05 00:01:37 +00:00
|
|
|
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
|
|
|
|
* <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
|
|
|
* <li> Marc Molina, 2013. marc.molina.pena@gmail.com
|
|
|
|
* </ul>
|
2014-07-07 19:06:26 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2014-07-07 19:06:26 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2014-07-07 19:06:26 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H
|
|
|
|
#define GNSS_SDR_GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2019-03-20 14:13:17 +00:00
|
|
|
#include "channel_fsm.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "gnss_synchro.h"
|
2014-07-07 19:06:26 +00:00
|
|
|
#include <gnuradio/block.h>
|
|
|
|
#include <gnuradio/fft/fft.h>
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <gnuradio/gr_complex.h>
|
|
|
|
#include <fstream>
|
2019-06-30 10:51:23 +00:00
|
|
|
#include <memory>
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <string>
|
2019-04-22 11:03:01 +00:00
|
|
|
#include <utility>
|
2019-07-23 16:54:32 +00:00
|
|
|
#include <vector>
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2014-08-05 00:01:37 +00:00
|
|
|
class galileo_e5a_noncoherentIQ_acquisition_caf_cc;
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2019-02-11 12:02:18 +00:00
|
|
|
using galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr = boost::shared_ptr<galileo_e5a_noncoherentIQ_acquisition_caf_cc>;
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2019-07-01 19:54:52 +00:00
|
|
|
galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(
|
|
|
|
unsigned int sampled_ms,
|
2018-03-03 01:03:39 +00:00
|
|
|
unsigned int max_dwells,
|
2018-08-10 18:34:03 +00:00
|
|
|
unsigned int doppler_max, int64_t fs_in,
|
2018-03-03 01:03:39 +00:00
|
|
|
int samples_per_ms, int samples_per_code,
|
|
|
|
bool bit_transition_flag,
|
|
|
|
bool dump,
|
2019-09-13 06:56:37 +00:00
|
|
|
const std::string& dump_filename,
|
2018-03-03 01:03:39 +00:00
|
|
|
bool both_signal_components_,
|
|
|
|
int CAF_window_hz_,
|
|
|
|
int Zero_padding_);
|
2014-07-07 19:06:26 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief This class implements a Parallel Code Phase Search Acquisition.
|
|
|
|
*
|
|
|
|
* Check \ref Navitec2012 "An Open Source Galileo E1 Software Receiver",
|
|
|
|
* Algorithm 1, for a pseudocode description of this implementation.
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
class galileo_e5a_noncoherentIQ_acquisition_caf_cc : public gr::block
|
2014-07-07 19:06:26 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/*!
|
|
|
|
* \brief Default destructor.
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
~galileo_e5a_noncoherentIQ_acquisition_caf_cc();
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Set acquisition/tracking common Gnss_Synchro object pointer
|
|
|
|
* to exchange synchronization data between acquisition and tracking blocks.
|
|
|
|
* \param p_gnss_synchro Satellite information shared by the processing blocks.
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
|
|
|
{
|
|
|
|
d_gnss_synchro = p_gnss_synchro;
|
|
|
|
}
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Returns the maximum peak of grid search.
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
inline unsigned int mag() const
|
|
|
|
{
|
|
|
|
return d_mag;
|
|
|
|
}
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Initializes acquisition algorithm.
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
void init();
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Sets local code for PCPS acquisition algorithm.
|
|
|
|
* \param code - Pointer to the PRN code.
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
void set_local_code(std::complex<float>* code, std::complex<float>* codeQ);
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Starts acquisition algorithm, turning from standby mode to
|
|
|
|
* active mode
|
|
|
|
* \param active - bool that activates/deactivates the block.
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
inline void set_active(bool active)
|
|
|
|
{
|
|
|
|
d_active = active;
|
|
|
|
}
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief If set to 1, ensures that acquisition starts at the
|
|
|
|
* first available sample.
|
|
|
|
* \param state - int=1 forces start of acquisition
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
void set_state(int state);
|
2015-02-10 18:30:15 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Set acquisition channel unique ID
|
|
|
|
* \param channel - receiver channel.
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
inline void set_channel(unsigned int channel)
|
|
|
|
{
|
|
|
|
d_channel = channel;
|
|
|
|
}
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2019-03-20 14:13:17 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Set channel fsm associated to this acquisition instance
|
|
|
|
*/
|
2019-04-09 15:39:48 +00:00
|
|
|
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm)
|
2019-03-20 14:13:17 +00:00
|
|
|
{
|
2019-04-22 11:03:01 +00:00
|
|
|
d_channel_fsm = std::move(channel_fsm);
|
2019-03-20 14:13:17 +00:00
|
|
|
}
|
2019-04-22 11:03:01 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Set statistics threshold of PCPS algorithm.
|
|
|
|
* \param threshold - Threshold for signal detection (check \ref Navitec2012,
|
|
|
|
* Algorithm 1, for a definition of this threshold).
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
inline void set_threshold(float threshold)
|
|
|
|
{
|
|
|
|
d_threshold = threshold;
|
|
|
|
}
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Set maximum Doppler grid search
|
|
|
|
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
inline void set_doppler_max(unsigned int doppler_max)
|
|
|
|
{
|
|
|
|
d_doppler_max = doppler_max;
|
|
|
|
}
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Set Doppler steps for the grid search
|
|
|
|
* \param doppler_step - Frequency bin of the search grid [Hz].
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
inline void set_doppler_step(unsigned int doppler_step)
|
|
|
|
{
|
|
|
|
d_doppler_step = doppler_step;
|
|
|
|
}
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
/*!
|
2019-04-22 11:03:01 +00:00
|
|
|
* \brief Parallel Code Phase Search Acquisition signal processing.
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
|
|
|
gr_vector_const_void_star& input_items,
|
|
|
|
gr_vector_void_star& output_items);
|
2019-07-01 19:54:52 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr
|
|
|
|
galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(
|
|
|
|
unsigned int sampled_ms,
|
|
|
|
unsigned int max_dwells,
|
|
|
|
unsigned int doppler_max, int64_t fs_in,
|
|
|
|
int samples_per_ms, int samples_per_code,
|
|
|
|
bool bit_transition_flag,
|
|
|
|
bool dump,
|
2019-09-13 06:56:37 +00:00
|
|
|
const std::string& dump_filename,
|
2019-07-01 19:54:52 +00:00
|
|
|
bool both_signal_components_,
|
|
|
|
int CAF_window_hz_,
|
|
|
|
int Zero_padding_);
|
|
|
|
|
|
|
|
galileo_e5a_noncoherentIQ_acquisition_caf_cc(
|
|
|
|
unsigned int sampled_ms,
|
|
|
|
unsigned int max_dwells,
|
|
|
|
unsigned int doppler_max, int64_t fs_in,
|
|
|
|
int samples_per_ms, int samples_per_code,
|
|
|
|
bool bit_transition_flag,
|
|
|
|
bool dump,
|
2019-09-13 06:56:37 +00:00
|
|
|
const std::string& dump_filename,
|
2019-07-01 19:54:52 +00:00
|
|
|
bool both_signal_components_,
|
|
|
|
int CAF_window_hz_,
|
|
|
|
int Zero_padding_);
|
|
|
|
|
|
|
|
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
|
|
|
int doppler_offset);
|
|
|
|
|
|
|
|
float estimate_input_power(gr_complex* in);
|
|
|
|
|
|
|
|
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
|
|
|
int64_t d_fs_in;
|
|
|
|
int d_samples_per_ms;
|
|
|
|
int d_sampled_ms;
|
|
|
|
int d_samples_per_code;
|
|
|
|
unsigned int d_doppler_resolution;
|
|
|
|
float d_threshold;
|
|
|
|
std::string d_satellite_str;
|
|
|
|
unsigned int d_doppler_max;
|
|
|
|
unsigned int d_doppler_step;
|
|
|
|
unsigned int d_max_dwells;
|
|
|
|
unsigned int d_well_count;
|
|
|
|
unsigned int d_fft_size;
|
|
|
|
uint64_t d_sample_counter;
|
2019-07-23 16:54:32 +00:00
|
|
|
std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
|
2019-07-01 19:54:52 +00:00
|
|
|
unsigned int d_num_doppler_bins;
|
2019-07-23 16:54:32 +00:00
|
|
|
std::vector<gr_complex> d_fft_code_I_A;
|
|
|
|
std::vector<gr_complex> d_fft_code_I_B;
|
|
|
|
std::vector<gr_complex> d_fft_code_Q_A;
|
|
|
|
std::vector<gr_complex> d_fft_code_Q_B;
|
|
|
|
std::vector<gr_complex> d_inbuffer;
|
2019-07-01 19:54:52 +00:00
|
|
|
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
|
|
|
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
|
|
|
Gnss_Synchro* d_gnss_synchro;
|
|
|
|
unsigned int d_code_phase;
|
|
|
|
float d_doppler_freq;
|
|
|
|
float d_mag;
|
2019-07-23 16:54:32 +00:00
|
|
|
std::vector<float> d_magnitudeIA;
|
|
|
|
std::vector<float> d_magnitudeIB;
|
|
|
|
std::vector<float> d_magnitudeQA;
|
|
|
|
std::vector<float> d_magnitudeQB;
|
2019-07-01 19:54:52 +00:00
|
|
|
float d_input_power;
|
|
|
|
float d_test_statistics;
|
|
|
|
bool d_bit_transition_flag;
|
|
|
|
std::ofstream d_dump_file;
|
|
|
|
bool d_active;
|
|
|
|
int d_state;
|
|
|
|
bool d_dump;
|
|
|
|
bool d_both_signal_components;
|
|
|
|
int d_CAF_window_hz;
|
2019-07-23 16:54:32 +00:00
|
|
|
std::vector<float> d_CAF_vector;
|
|
|
|
std::vector<float> d_CAF_vector_I;
|
|
|
|
std::vector<float> d_CAF_vector_Q;
|
2019-07-01 19:54:52 +00:00
|
|
|
unsigned int d_channel;
|
|
|
|
std::string d_dump_filename;
|
|
|
|
unsigned int d_buffer_count;
|
|
|
|
unsigned int d_gr_stream_buffer;
|
2014-07-07 19:06:26 +00:00
|
|
|
};
|
2019-07-01 19:54:52 +00:00
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H
|