mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-15 11:45:47 +00:00
Introduce volk:gnsssdr::vector
The usual benefits of using objects as opposed to pointers (RAII) + the type information is manifest (no void* pointers) The best of both worlds: automatic destruction, aligned memory
This commit is contained in:
parent
e0ef72eb75
commit
b1166de1a0
@ -76,12 +76,11 @@ target_link_libraries(acquisition_gr_blocks
|
||||
Gnuradio::runtime
|
||||
Gnuradio::fft
|
||||
Volk::volk
|
||||
Volkgnsssdr::volkgnsssdr
|
||||
PRIVATE
|
||||
Gflags::gflags
|
||||
Glog::glog
|
||||
Matio::matio
|
||||
Volkgnsssdr::volkgnsssdr
|
||||
|
||||
)
|
||||
|
||||
target_include_directories(acquisition_gr_blocks
|
||||
|
@ -135,9 +135,9 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
|
||||
acq_parameters.max_dwells = 1; // Activation of acq_parameters.bit_transition_flag invalidates the value of acq_parameters.max_dwells
|
||||
}
|
||||
|
||||
d_tmp_buffer = std::vector<float>(d_fft_size);
|
||||
d_fft_codes = std::vector<std::complex<float>>(d_fft_size);
|
||||
d_input_signal = std::vector<std::complex<float>>(d_fft_size);
|
||||
d_tmp_buffer = volk_gnsssdr::vector<float>(d_fft_size);
|
||||
d_fft_codes = volk_gnsssdr::vector<std::complex<float>>(d_fft_size);
|
||||
d_input_signal = volk_gnsssdr::vector<std::complex<float>>(d_fft_size);
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
|
||||
@ -147,10 +147,10 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
|
||||
|
||||
d_gnss_synchro = nullptr;
|
||||
d_worker_active = false;
|
||||
d_data_buffer = std::vector<std::complex<float>>(d_consumed_samples);
|
||||
d_data_buffer = volk_gnsssdr::vector<std::complex<float>>(d_consumed_samples);
|
||||
if (d_cshort)
|
||||
{
|
||||
d_data_buffer_sc = std::vector<lv_16sc_t>(d_consumed_samples);
|
||||
d_data_buffer_sc = volk_gnsssdr::vector<lv_16sc_t>(d_consumed_samples);
|
||||
}
|
||||
grid_ = arma::fmat();
|
||||
narrow_grid_ = arma::fmat();
|
||||
@ -304,16 +304,16 @@ void pcps_acquisition::init()
|
||||
// Create the carrier Doppler wipeoff signals
|
||||
if (d_grid_doppler_wipeoffs.empty())
|
||||
{
|
||||
d_grid_doppler_wipeoffs = std::vector<std::vector<std::complex<float>>>(d_num_doppler_bins, std::vector<std::complex<float>>(d_fft_size));
|
||||
d_grid_doppler_wipeoffs = volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>>(d_num_doppler_bins, volk_gnsssdr::vector<std::complex<float>>(d_fft_size));
|
||||
}
|
||||
if (acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two.empty()))
|
||||
{
|
||||
d_grid_doppler_wipeoffs_step_two = std::vector<std::vector<std::complex<float>>>(d_num_doppler_bins_step2, std::vector<std::complex<float>>(d_fft_size));
|
||||
d_grid_doppler_wipeoffs_step_two = volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>>(d_num_doppler_bins_step2, volk_gnsssdr::vector<std::complex<float>>(d_fft_size));
|
||||
}
|
||||
|
||||
if (d_magnitude_grid.empty())
|
||||
{
|
||||
d_magnitude_grid = std::vector<std::vector<float>>(d_num_doppler_bins, std::vector<float>(d_fft_size));
|
||||
d_magnitude_grid = volk_gnsssdr::vector<volk_gnsssdr::vector<float>>(d_num_doppler_bins, volk_gnsssdr::vector<float>(d_fft_size));
|
||||
}
|
||||
|
||||
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||
|
@ -62,17 +62,17 @@
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/block.h>
|
||||
#include <gnuradio/fft/fft.h>
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <gnuradio/thread/thread.h> // for scoped_lock
|
||||
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
||||
#include <gsl/gsl> // for Guidelines Support Library
|
||||
#include <volk/volk_complex.h> // for lv_16sc_t
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <gnuradio/thread/thread.h> // for scoped_lock
|
||||
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
||||
#include <gsl/gsl> // for Guidelines Support Library
|
||||
#include <volk/volk_complex.h> // for lv_16sc_t
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <complex>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class Gnss_Synchro;
|
||||
class pcps_acquisition;
|
||||
@ -243,14 +243,14 @@ private:
|
||||
float d_test_statistics;
|
||||
float d_doppler_center_step_two;
|
||||
std::string d_dump_filename;
|
||||
std::vector<std::vector<float>> d_magnitude_grid;
|
||||
std::vector<float> d_tmp_buffer;
|
||||
std::vector<std::complex<float>> d_input_signal;
|
||||
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
|
||||
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs_step_two;
|
||||
std::vector<std::complex<float>> d_fft_codes;
|
||||
std::vector<std::complex<float>> d_data_buffer;
|
||||
std::vector<lv_16sc_t> d_data_buffer_sc;
|
||||
volk_gnsssdr::vector<volk_gnsssdr::vector<float>> d_magnitude_grid;
|
||||
volk_gnsssdr::vector<float> d_tmp_buffer;
|
||||
volk_gnsssdr::vector<std::complex<float>> d_input_signal;
|
||||
volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
|
||||
volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>> d_grid_doppler_wipeoffs_step_two;
|
||||
volk_gnsssdr::vector<std::complex<float>> d_fft_codes;
|
||||
volk_gnsssdr::vector<std::complex<float>> d_data_buffer;
|
||||
volk_gnsssdr::vector<lv_16sc_t> d_data_buffer_sc;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
|
@ -325,6 +325,7 @@ install(
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_alloc.h
|
||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_prefs.h
|
||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_complex.h
|
||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_common.h
|
||||
|
@ -0,0 +1,84 @@
|
||||
/*!
|
||||
* \file volk_gnsssdr_alloc.h
|
||||
* \author Carles Fernandez, 2019. cfernandez(at)cttc.es
|
||||
* \brief C++11 allocator using volk_gnsssdr_malloc and volk_gnsssdr_free.
|
||||
* Based on https://github.com/gnuradio/volk/pull/284/ by @hcab14
|
||||
*
|
||||
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_VOLK_GNSSSDR_ALLOC_H
|
||||
#define INCLUDED_VOLK_GNSSSDR_ALLOC_H
|
||||
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
#include <new>
|
||||
#include <vector>
|
||||
|
||||
namespace volk_gnsssdr
|
||||
{
|
||||
/*!
|
||||
* \brief C++11 allocator using volk_gnsssdr_malloc and volk_gnsssdr_free
|
||||
*
|
||||
* \details
|
||||
* adapted from https://en.cppreference.com/w/cpp/named_req/Alloc
|
||||
*/
|
||||
template <class T>
|
||||
struct alloc
|
||||
{
|
||||
typedef T value_type;
|
||||
|
||||
alloc() = default;
|
||||
|
||||
template <class U>
|
||||
constexpr alloc(alloc<U> const&) noexcept {}
|
||||
|
||||
T* allocate(std::size_t n)
|
||||
{
|
||||
if (n > std::numeric_limits<std::size_t>::max() / sizeof(T)) throw std::bad_alloc();
|
||||
|
||||
if (auto p = static_cast<T*>(volk_gnsssdr_malloc(n * sizeof(T), volk_gnsssdr_get_alignment())))
|
||||
return p;
|
||||
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
void deallocate(T* p, std::size_t) noexcept { volk_gnsssdr_free(p); }
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
bool operator==(alloc<T> const&, alloc<U> const&) { return true; }
|
||||
|
||||
template <class T, class U>
|
||||
bool operator!=(alloc<T> const&, alloc<U> const&) { return false; }
|
||||
|
||||
|
||||
/*!
|
||||
* \brief type alias for std::vector using volk_gnsssdr::alloc
|
||||
*
|
||||
* \details
|
||||
* example code:
|
||||
* volk_gnsssdr::vector<float> v(100); // vector using volk_gnsssdr_malloc, volk_gnsssdr_free
|
||||
*/
|
||||
template <class T>
|
||||
using vector = std::vector<T, alloc<T> >;
|
||||
|
||||
} // namespace volk_gnsssdr
|
||||
|
||||
#endif // INCLUDED_VOLK_GNSSSDR_ALLOC_H
|
@ -68,6 +68,7 @@
|
||||
#include <iostream> // for cout, cerr
|
||||
#include <map>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
|
||||
#if HAS_STD_FILESYSTEM
|
||||
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||
@ -352,7 +353,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the sinboc(1,1) replica sampled 2x/chip
|
||||
d_tracking_code = static_cast<float *>(volk_gnsssdr_malloc(2 * d_code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_tracking_code.resize(2 * d_code_length_chips);
|
||||
// correlator outputs (scalar)
|
||||
if (d_veml)
|
||||
{
|
||||
@ -365,9 +366,8 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
|
||||
d_n_correlator_taps = 3;
|
||||
}
|
||||
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
|
||||
d_correlator_outs.resize(d_n_correlator_taps);
|
||||
d_local_code_shift_chips.resize(d_n_correlator_taps);
|
||||
// map memory pointers of correlator outputs
|
||||
if (d_veml)
|
||||
{
|
||||
@ -414,11 +414,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
|
||||
// Extra correlator for the data component
|
||||
correlator_data_cpu.init(2 * trk_parameters.vector_length, 1);
|
||||
correlator_data_cpu.set_high_dynamics_resampler(trk_parameters.high_dyn);
|
||||
d_data_code = static_cast<float *>(volk_gnsssdr_malloc(2 * d_code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
}
|
||||
else
|
||||
{
|
||||
d_data_code = nullptr;
|
||||
d_data_code.resize(2 * d_code_length_chips);
|
||||
}
|
||||
|
||||
// --- Initializations ---
|
||||
@ -440,13 +436,13 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(trk_parameters.cn0_samples);
|
||||
d_Prompt_buffer = volk_gnsssdr::vector<gr_complex>(trk_parameters.cn0_samples);
|
||||
d_carrier_lock_test = 1.0;
|
||||
d_CN0_SNV_dB_Hz = 0.0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_code_lock_fail_counter = 0;
|
||||
d_carrier_lock_threshold = trk_parameters.carrier_lock_th;
|
||||
d_Prompt_Data = static_cast<gr_complex *>(volk_gnsssdr_malloc(sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_Prompt_Data.resize(1);
|
||||
d_cn0_smoother = Exponential_Smoother();
|
||||
d_cn0_smoother.set_alpha(trk_parameters.cn0_smoother_alpha);
|
||||
|
||||
@ -580,24 +576,24 @@ void dll_pll_veml_tracking::start_tracking()
|
||||
|
||||
if (systemName == "GPS" and signal_type == "1C")
|
||||
{
|
||||
gps_l1_ca_code_gen_float(gsl::span<float>(d_tracking_code, 2 * d_code_length_chips), d_acquisition_gnss_synchro->PRN, 0);
|
||||
gps_l1_ca_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
|
||||
}
|
||||
else if (systemName == "GPS" and signal_type == "2S")
|
||||
{
|
||||
gps_l2c_m_code_gen_float(gsl::span<float>(d_tracking_code, 2 * d_code_length_chips), d_acquisition_gnss_synchro->PRN);
|
||||
gps_l2c_m_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN);
|
||||
}
|
||||
else if (systemName == "GPS" and signal_type == "L5")
|
||||
{
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
gps_l5q_code_gen_float(gsl::span<float>(d_tracking_code, 2 * d_code_length_chips), d_acquisition_gnss_synchro->PRN);
|
||||
gps_l5i_code_gen_float(gsl::span<float>(d_data_code, 2 * d_code_length_chips), d_acquisition_gnss_synchro->PRN);
|
||||
gps_l5q_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN);
|
||||
gps_l5i_code_gen_float(d_data_code, d_acquisition_gnss_synchro->PRN);
|
||||
d_Prompt_Data[0] = gr_complex(0.0, 0.0);
|
||||
correlator_data_cpu.set_local_code_and_taps(d_code_length_chips, d_data_code, d_prompt_data_shift);
|
||||
correlator_data_cpu.set_local_code_and_taps(d_code_length_chips, d_data_code.data(), d_prompt_data_shift);
|
||||
}
|
||||
else
|
||||
{
|
||||
gps_l5i_code_gen_float(gsl::span<float>(d_tracking_code, 2 * d_code_length_chips), d_acquisition_gnss_synchro->PRN);
|
||||
gps_l5i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN);
|
||||
}
|
||||
}
|
||||
else if (systemName == "Galileo" and signal_type == "1B")
|
||||
@ -605,21 +601,21 @@ void dll_pll_veml_tracking::start_tracking()
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
std::array<char, 3> pilot_signal = {{'1', 'C', '\0'}};
|
||||
galileo_e1_code_gen_sinboc11_float(gsl::span<float>(d_tracking_code, 2 * d_code_length_chips), pilot_signal, d_acquisition_gnss_synchro->PRN);
|
||||
galileo_e1_code_gen_sinboc11_float(gsl::span<float>(d_data_code, 2 * d_code_length_chips), Signal_, d_acquisition_gnss_synchro->PRN);
|
||||
galileo_e1_code_gen_sinboc11_float(d_tracking_code, pilot_signal, d_acquisition_gnss_synchro->PRN);
|
||||
galileo_e1_code_gen_sinboc11_float(d_data_code, Signal_, d_acquisition_gnss_synchro->PRN);
|
||||
d_Prompt_Data[0] = gr_complex(0.0, 0.0);
|
||||
correlator_data_cpu.set_local_code_and_taps(d_code_samples_per_chip * d_code_length_chips, d_data_code, d_prompt_data_shift);
|
||||
correlator_data_cpu.set_local_code_and_taps(d_code_samples_per_chip * d_code_length_chips, d_data_code.data(), d_prompt_data_shift);
|
||||
}
|
||||
else
|
||||
{
|
||||
galileo_e1_code_gen_sinboc11_float(gsl::span<float>(d_tracking_code, 2 * d_code_length_chips), Signal_, d_acquisition_gnss_synchro->PRN);
|
||||
galileo_e1_code_gen_sinboc11_float(d_tracking_code, Signal_, d_acquisition_gnss_synchro->PRN);
|
||||
}
|
||||
}
|
||||
else if (systemName == "Galileo" and signal_type == "5X")
|
||||
{
|
||||
auto *aux_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(sizeof(gr_complex) * d_code_length_chips, volk_gnsssdr_get_alignment()));
|
||||
volk_gnsssdr::vector<gr_complex> aux_code(d_code_length_chips);
|
||||
std::array<char, 3> signal_type_ = {{'5', 'X', '\0'}};
|
||||
galileo_e5_a_code_gen_complex_primary(gsl::span<gr_complex>(aux_code, d_code_length_chips), d_acquisition_gnss_synchro->PRN, signal_type_);
|
||||
galileo_e5_a_code_gen_complex_primary(aux_code, d_acquisition_gnss_synchro->PRN, signal_type_);
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
d_secondary_code_string = const_cast<std::string *>(&GALILEO_E5A_Q_SECONDARY_CODE[d_acquisition_gnss_synchro->PRN - 1]);
|
||||
@ -629,7 +625,7 @@ void dll_pll_veml_tracking::start_tracking()
|
||||
d_data_code[i] = aux_code[i].real(); // the same because it is generated the full signal (E5aI + E5aQ)
|
||||
}
|
||||
d_Prompt_Data[0] = gr_complex(0.0, 0.0);
|
||||
correlator_data_cpu.set_local_code_and_taps(d_code_length_chips, d_data_code, d_prompt_data_shift);
|
||||
correlator_data_cpu.set_local_code_and_taps(d_code_length_chips, d_data_code.data(), d_prompt_data_shift);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -638,11 +634,10 @@ void dll_pll_veml_tracking::start_tracking()
|
||||
d_tracking_code[i] = aux_code[i].real();
|
||||
}
|
||||
}
|
||||
volk_gnsssdr_free(aux_code);
|
||||
}
|
||||
else if (systemName == "Beidou" and signal_type == "B1")
|
||||
{
|
||||
beidou_b1i_code_gen_float(gsl::span<float>(d_tracking_code, 2 * d_code_length_chips), d_acquisition_gnss_synchro->PRN, 0);
|
||||
beidou_b1i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
|
||||
// GEO Satellites use different secondary code
|
||||
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
|
||||
{
|
||||
@ -675,7 +670,7 @@ void dll_pll_veml_tracking::start_tracking()
|
||||
|
||||
else if (systemName == "Beidou" and signal_type == "B3")
|
||||
{
|
||||
beidou_b3i_code_gen_float(gsl::span<float>(d_tracking_code, 2 * d_code_length_chips), d_acquisition_gnss_synchro->PRN, 0);
|
||||
beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
|
||||
// Update secondary code settings for geo satellites
|
||||
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
|
||||
{
|
||||
@ -706,8 +701,8 @@ void dll_pll_veml_tracking::start_tracking()
|
||||
}
|
||||
}
|
||||
|
||||
multicorrelator_cpu.set_local_code_and_taps(d_code_samples_per_chip * d_code_length_chips, d_tracking_code, d_local_code_shift_chips);
|
||||
std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
multicorrelator_cpu.set_local_code_and_taps(d_code_samples_per_chip * d_code_length_chips, d_tracking_code.data(), d_local_code_shift_chips.data());
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_code_lock_fail_counter = 0;
|
||||
@ -765,7 +760,7 @@ dll_pll_veml_tracking::~dll_pll_veml_tracking()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
if (d_dump_mat)
|
||||
@ -781,20 +776,15 @@ dll_pll_veml_tracking::~dll_pll_veml_tracking()
|
||||
}
|
||||
try
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_tracking_code);
|
||||
volk_gnsssdr_free(d_Prompt_Data);
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
volk_gnsssdr_free(d_data_code);
|
||||
correlator_data_cpu.free();
|
||||
}
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -907,7 +897,7 @@ void dll_pll_veml_tracking::do_correlation_step(const gr_complex *input_samples)
|
||||
{
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, input_samples);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), input_samples);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(
|
||||
d_rem_carr_phase_rad,
|
||||
d_carrier_phase_step_rad, d_carrier_phase_rate_step_rad,
|
||||
@ -919,7 +909,7 @@ void dll_pll_veml_tracking::do_correlation_step(const gr_complex *input_samples)
|
||||
// DATA CORRELATOR (if tracking tracks the pilot signal)
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
correlator_data_cpu.set_input_output_vectors(d_Prompt_Data, input_samples);
|
||||
correlator_data_cpu.set_input_output_vectors(d_Prompt_Data.data(), input_samples);
|
||||
correlator_data_cpu.Carrier_wipeoff_multicorrelator_resampler(
|
||||
d_rem_carr_phase_rad,
|
||||
d_carrier_phase_step_rad, d_carrier_phase_rate_step_rad,
|
||||
@ -1019,7 +1009,7 @@ void dll_pll_veml_tracking::run_dll_pll()
|
||||
|
||||
void dll_pll_veml_tracking::clear_tracking_vars()
|
||||
{
|
||||
std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
d_Prompt_Data[0] = gr_complex(0.0, 0.0);
|
||||
@ -1166,11 +1156,11 @@ void dll_pll_veml_tracking::save_correlation_results()
|
||||
{
|
||||
if (d_data_secondary_code_string->at(d_current_data_symbol) == '0')
|
||||
{
|
||||
d_P_data_accu += *d_Prompt_Data;
|
||||
d_P_data_accu += d_Prompt_Data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
d_P_data_accu -= *d_Prompt_Data;
|
||||
d_P_data_accu -= d_Prompt_Data[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1193,7 +1183,7 @@ void dll_pll_veml_tracking::save_correlation_results()
|
||||
{
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
d_P_data_accu += *d_Prompt_Data;
|
||||
d_P_data_accu += d_Prompt_Data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1208,7 +1198,7 @@ void dll_pll_veml_tracking::save_correlation_results()
|
||||
{
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
d_P_data_accu = *d_Prompt_Data;
|
||||
d_P_data_accu = d_Prompt_Data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1245,8 +1235,8 @@ void dll_pll_veml_tracking::log_data()
|
||||
uint64_t tmp_long_int;
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
prompt_I = d_Prompt_Data->real();
|
||||
prompt_Q = d_Prompt_Data->imag();
|
||||
prompt_I = d_Prompt_Data.data()->real();
|
||||
prompt_Q = d_Prompt_Data.data()->imag();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -38,16 +38,16 @@
|
||||
#include "tracking_FLL_PLL_filter.h" // for PLL/FLL filter
|
||||
#include "tracking_loop_filter.h" // for DLL filter
|
||||
#include <boost/circular_buffer.hpp>
|
||||
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
|
||||
#include <gnuradio/block.h> // for block
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <gnuradio/types.h> // for gr_vector_int, gr_vector...
|
||||
#include <pmt/pmt.h> // for pmt_t
|
||||
#include <cstdint> // for int32_t
|
||||
#include <fstream> // for string, ofstream
|
||||
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
|
||||
#include <gnuradio/block.h> // for block
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <gnuradio/types.h> // for gr_vector_int, gr_vector...
|
||||
#include <pmt/pmt.h> // for pmt_t
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <cstdint> // for int32_t
|
||||
#include <fstream> // for string, ofstream
|
||||
#include <string>
|
||||
#include <utility> // for pair
|
||||
#include <vector>
|
||||
|
||||
class Gnss_Synchro;
|
||||
class dll_pll_veml_tracking;
|
||||
@ -123,9 +123,9 @@ private:
|
||||
int32_t d_correlation_length_ms;
|
||||
int32_t d_n_correlator_taps;
|
||||
|
||||
float *d_tracking_code;
|
||||
float *d_data_code;
|
||||
float *d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<float> d_tracking_code;
|
||||
volk_gnsssdr::vector<float> d_data_code;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
float *d_prompt_data_shift;
|
||||
Cpu_Multicorrelator_Real_Codes multicorrelator_cpu;
|
||||
Cpu_Multicorrelator_Real_Codes correlator_data_cpu; // for data channel
|
||||
@ -135,7 +135,7 @@ private:
|
||||
Implement this functionality inside multicorrelator class
|
||||
as an enhancement to increase the performance
|
||||
*/
|
||||
gr_complex *d_correlator_outs;
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs;
|
||||
gr_complex *d_Very_Early;
|
||||
gr_complex *d_Early;
|
||||
gr_complex *d_Prompt;
|
||||
@ -155,7 +155,7 @@ private:
|
||||
gr_complex d_VL_accu;
|
||||
|
||||
gr_complex d_P_data_accu;
|
||||
gr_complex *d_Prompt_Data;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_Data;
|
||||
|
||||
double d_code_phase_step_chips;
|
||||
double d_code_phase_rate_step_chips;
|
||||
@ -207,7 +207,7 @@ private:
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
boost::circular_buffer<gr_complex> d_Prompt_circular_buffer;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
Exponential_Smoother d_cn0_smoother;
|
||||
Exponential_Smoother d_carrier_lock_test_smoother;
|
||||
// file dump
|
||||
|
@ -309,9 +309,8 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
|
||||
d_n_correlator_taps = 3;
|
||||
}
|
||||
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
|
||||
d_correlator_outs.reserve(d_n_correlator_taps);
|
||||
d_local_code_shift_chips.reserve(d_n_correlator_taps);
|
||||
// map memory pointers of correlator outputs
|
||||
if (d_veml)
|
||||
{
|
||||
@ -370,13 +369,13 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(trk_parameters.cn0_samples);
|
||||
d_Prompt_buffer = volk_gnsssdr::vector<gr_complex>(trk_parameters.cn0_samples);
|
||||
d_carrier_lock_test = 1.0;
|
||||
d_CN0_SNV_dB_Hz = 0.0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_code_lock_fail_counter = 0;
|
||||
d_carrier_lock_threshold = trk_parameters.carrier_lock_th;
|
||||
d_Prompt_Data = static_cast<gr_complex *>(volk_gnsssdr_malloc(sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_Prompt_Data.reserve(1);
|
||||
d_cn0_smoother = Exponential_Smoother();
|
||||
d_cn0_smoother.set_alpha(trk_parameters.cn0_smoother_alpha);
|
||||
if (d_code_period > 0.0)
|
||||
@ -458,7 +457,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
|
||||
int32_t *ca_codes = trk_parameters.ca_codes;
|
||||
int32_t *data_codes = trk_parameters.data_codes;
|
||||
multicorrelator_fpga = std::make_shared<Fpga_Multicorrelator_8sc>(d_n_correlator_taps, device_name, dev_file_num, num_prev_assigned_ch, ca_codes, data_codes, d_code_length_chips, trk_parameters.track_pilot, d_code_samples_per_chip);
|
||||
multicorrelator_fpga->set_output_vectors(d_correlator_outs, d_Prompt_Data);
|
||||
multicorrelator_fpga->set_output_vectors(d_correlator_outs.data(), d_Prompt_Data.data());
|
||||
d_sample_counter_next = 0ULL;
|
||||
|
||||
d_corrected_doppler = false;
|
||||
@ -531,7 +530,7 @@ dll_pll_veml_tracking_fpga::~dll_pll_veml_tracking_fpga()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
if (d_dump_mat)
|
||||
@ -547,14 +546,11 @@ dll_pll_veml_tracking_fpga::~dll_pll_veml_tracking_fpga()
|
||||
}
|
||||
try
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_Prompt_Data);
|
||||
multicorrelator_fpga->free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -766,7 +762,7 @@ void dll_pll_veml_tracking_fpga::run_dll_pll()
|
||||
|
||||
void dll_pll_veml_tracking_fpga::clear_tracking_vars()
|
||||
{
|
||||
std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
d_Prompt_Data[0] = gr_complex(0.0, 0.0);
|
||||
@ -917,16 +913,16 @@ void dll_pll_veml_tracking_fpga::save_correlation_results()
|
||||
{
|
||||
if (d_data_secondary_code_string->at(d_current_data_symbol) == '0')
|
||||
{
|
||||
d_P_data_accu += *d_Prompt_Data;
|
||||
d_P_data_accu += d_Prompt_Data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
d_P_data_accu -= *d_Prompt_Data;
|
||||
d_P_data_accu -= d_Prompt_Data[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
d_P_data_accu += *d_Prompt_Data;
|
||||
d_P_data_accu += d_Prompt_Data[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -955,7 +951,7 @@ void dll_pll_veml_tracking_fpga::save_correlation_results()
|
||||
{
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
d_P_data_accu += *d_Prompt_Data;
|
||||
d_P_data_accu += d_Prompt_Data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -970,7 +966,7 @@ void dll_pll_veml_tracking_fpga::save_correlation_results()
|
||||
{
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
d_P_data_accu = *d_Prompt_Data;
|
||||
d_P_data_accu = d_Prompt_Data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1007,8 +1003,8 @@ void dll_pll_veml_tracking_fpga::log_data()
|
||||
uint64_t tmp_long_int;
|
||||
if (trk_parameters.track_pilot)
|
||||
{
|
||||
prompt_I = d_Prompt_Data->real();
|
||||
prompt_Q = d_Prompt_Data->imag();
|
||||
prompt_I = d_Prompt_Data.data()->real();
|
||||
prompt_Q = d_Prompt_Data.data()->imag();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1406,7 +1402,7 @@ void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
}
|
||||
}
|
||||
|
||||
std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_code_lock_fail_counter = 0;
|
||||
@ -1441,7 +1437,7 @@ void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
d_code_loop_filter.set_update_interval(d_code_period);
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
multicorrelator_fpga->set_local_code_and_taps(d_local_code_shift_chips, d_prompt_data_shift, d_acquisition_gnss_synchro->PRN);
|
||||
multicorrelator_fpga->set_local_code_and_taps(d_local_code_shift_chips.data(), d_prompt_data_shift, d_acquisition_gnss_synchro->PRN);
|
||||
|
||||
d_pull_in_transitory = true;
|
||||
|
||||
|
@ -37,17 +37,17 @@
|
||||
#include "tracking_FLL_PLL_filter.h" // for PLL/FLL filter
|
||||
#include "tracking_loop_filter.h" // for DLL filter
|
||||
#include <boost/circular_buffer.hpp>
|
||||
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
|
||||
#include <gnuradio/block.h> // for block
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <gnuradio/types.h> // for gr_vector_int, gr_vector...
|
||||
#include <pmt/pmt.h> // for pmt_t
|
||||
#include <cstdint> // for int32_t
|
||||
#include <fstream> // for string, ofstream
|
||||
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
|
||||
#include <gnuradio/block.h> // for block
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <gnuradio/types.h> // for gr_vector_int, gr_vector...
|
||||
#include <pmt/pmt.h> // for pmt_t
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <cstdint> // for int32_t
|
||||
#include <fstream> // for string, ofstream
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility> // for pair
|
||||
#include <vector>
|
||||
|
||||
class Fpga_Multicorrelator_8sc;
|
||||
class Gnss_Synchro;
|
||||
@ -152,10 +152,10 @@ private:
|
||||
int32_t d_correlation_length_ms;
|
||||
int32_t d_n_correlator_taps;
|
||||
|
||||
float *d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
float *d_prompt_data_shift;
|
||||
std::shared_ptr<Fpga_Multicorrelator_8sc> multicorrelator_fpga;
|
||||
gr_complex *d_correlator_outs;
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs;
|
||||
gr_complex *d_Very_Early;
|
||||
gr_complex *d_Early;
|
||||
gr_complex *d_Prompt;
|
||||
@ -175,7 +175,7 @@ private:
|
||||
gr_complex d_VL_accu;
|
||||
|
||||
gr_complex d_P_data_accu;
|
||||
gr_complex *d_Prompt_Data;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_Data;
|
||||
|
||||
double d_code_phase_step_chips;
|
||||
double d_code_phase_rate_step_chips;
|
||||
@ -228,7 +228,7 @@ private:
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
boost::circular_buffer<gr_complex> d_Prompt_circular_buffer;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
Exponential_Smoother d_cn0_smoother;
|
||||
Exponential_Smoother d_carrier_lock_test_smoother;
|
||||
// file dump
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <algorithm> // for fill_n
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
@ -116,15 +117,12 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the sinboc(1,1) replica sampled 2x/chip
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc((2 * GALILEO_E1_B_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code.reserve(2 * GALILEO_E1_B_CODE_LENGTH_CHIPS);
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 5; // Very-Early, Early, Prompt, Late, Very-Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_correlator_outs.reserve(d_n_correlator_taps);
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
// map memory pointers of correlator outputs
|
||||
d_Very_Early = &d_correlator_outs[0];
|
||||
d_Early = &d_correlator_outs[1];
|
||||
@ -132,7 +130,7 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||
d_Late = &d_correlator_outs[3];
|
||||
d_Very_Late = &d_correlator_outs[4];
|
||||
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips.reserve(d_n_correlator_taps);
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = -d_very_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = -d_early_late_spc_chips;
|
||||
@ -163,7 +161,7 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(FLAGS_cn0_samples);
|
||||
d_Prompt_buffer = volk_gnsssdr::vector<gr_complex>(FLAGS_cn0_samples);
|
||||
d_carrier_lock_test = 1;
|
||||
d_CN0_SNV_dB_Hz = 0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@ -192,18 +190,15 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking()
|
||||
std::memcpy(Signal_.data(), d_acquisition_gnss_synchro->Signal, 3);
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (2 samples per chip)
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<gr_complex>(d_ca_code, (2 * GALILEO_E1_B_CODE_LENGTH_CHIPS)),
|
||||
galileo_e1_code_gen_complex_sampled(d_ca_code,
|
||||
Signal_,
|
||||
false,
|
||||
d_acquisition_gnss_synchro->PRN,
|
||||
2 * GALILEO_E1_CODE_CHIP_RATE_CPS,
|
||||
0);
|
||||
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(2 * GALILEO_E1_B_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(2 * GALILEO_E1_B_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_rem_code_phase_samples = 0.0;
|
||||
@ -239,20 +234,17 @@ Galileo_E1_Tcp_Connector_Tracking_cc::~Galileo_E1_Tcp_Connector_Tracking_cc()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
d_tcp_com.close_tcp_connection(d_port);
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,7 +327,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), in);
|
||||
|
||||
double carr_phase_step_rad = GALILEO_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
double code_phase_step_half_chips = (2.0 * d_code_freq_chips) / (static_cast<double>(d_fs_in));
|
||||
@ -457,9 +449,9 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri
|
||||
}
|
||||
else
|
||||
{
|
||||
*d_Early = gr_complex(0, 0);
|
||||
*d_Prompt = gr_complex(0, 0);
|
||||
*d_Late = gr_complex(0, 0);
|
||||
*d_Early = gr_complex(0.0, 0.0);
|
||||
*d_Prompt = gr_complex(0.0, 0.0);
|
||||
*d_Late = gr_complex(0.0, 0.0);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
|
||||
// When tracking is disabled an array of 1's is sent to maintain the TCP connection
|
||||
boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> tx_variables_array = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}};
|
||||
|
@ -43,11 +43,10 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "tcp_communication.h"
|
||||
#include <gnuradio/block.h>
|
||||
#include <volk/volk.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class Galileo_E1_Tcp_Connector_Tracking_cc;
|
||||
@ -123,7 +122,7 @@ private:
|
||||
float d_early_late_spc_chips;
|
||||
float d_very_early_late_spc_chips;
|
||||
|
||||
gr_complex *d_ca_code;
|
||||
volk_gnsssdr::vector<gr_complex> d_ca_code;
|
||||
|
||||
gr_complex *d_Very_Early;
|
||||
gr_complex *d_Early;
|
||||
@ -141,8 +140,8 @@ private:
|
||||
float d_acq_carrier_doppler_hz;
|
||||
|
||||
// correlator
|
||||
float *d_local_code_shift_chips;
|
||||
gr_complex *d_correlator_outs;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs;
|
||||
Cpu_Multicorrelator multicorrelator_cpu;
|
||||
|
||||
// tracking vars
|
||||
@ -167,7 +166,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int32_t d_cn0_estimation_counter;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
float d_carrier_lock_test;
|
||||
float d_CN0_SNV_dB_Hz;
|
||||
float d_carrier_lock_threshold;
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <matio.h>
|
||||
#include <pmt/pmt.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
@ -55,6 +56,7 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#define CN0_ESTIMATION_SAMPLES 10
|
||||
@ -143,16 +145,14 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code.reserve(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_correlator_outs.reserve(d_n_correlator_taps);
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_local_code_shift_chips.reserve(d_n_correlator_taps);
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
@ -176,7 +176,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(FLAGS_cn0_samples);
|
||||
d_Prompt_buffer.reserve(FLAGS_cn0_samples);
|
||||
d_carrier_lock_test = 1;
|
||||
d_CN0_SNV_dB_Hz = 0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@ -274,13 +274,10 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
glonass_l1_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code, GLONASS_L1_CA_CODE_LENGTH_CHIPS), 0);
|
||||
glonass_l1_ca_code_gen_complex(d_ca_code, 0);
|
||||
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_rem_code_phase_samples = 0.0;
|
||||
@ -318,7 +315,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::~glonass_l1_ca_dll_pll_c_aid_tracking_c
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,14 +341,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::~glonass_l1_ca_dll_pll_c_aid_tracking_c
|
||||
|
||||
try
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -601,7 +595,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
@ -819,7 +813,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
|
||||
{
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
d_correlator_outs[n] = gr_complex(0.0, 0.0);
|
||||
}
|
||||
|
||||
current_synchro_data.System = {'R'};
|
||||
|
@ -46,11 +46,12 @@
|
||||
#include "cpu_multicorrelator.h"
|
||||
#include <gnuradio/block.h>
|
||||
#include <pmt/pmt.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <deque>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class glonass_l1_ca_dll_pll_c_aid_tracking_cc;
|
||||
|
||||
@ -123,9 +124,9 @@ private:
|
||||
double d_early_late_spc_chips;
|
||||
int32_t d_n_correlator_taps;
|
||||
|
||||
gr_complex* d_ca_code;
|
||||
float* d_local_code_shift_chips;
|
||||
gr_complex* d_correlator_outs;
|
||||
volk_gnsssdr::vector<gr_complex> d_ca_code;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs;
|
||||
Cpu_Multicorrelator multicorrelator_cpu;
|
||||
|
||||
// remaining code phase and carrier phase between tracking loops
|
||||
@ -181,7 +182,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int32_t d_cn0_estimation_counter;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
double d_carrier_lock_test;
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <matio.h>
|
||||
#include <pmt/pmt.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
@ -54,6 +55,7 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#define CN0_ESTIMATION_SAMPLES 10
|
||||
@ -139,19 +141,16 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code.reserve(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
d_ca_code_16sc.reserve(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
|
||||
d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0, 0);
|
||||
}
|
||||
d_correlator_outs_16sc.reserve(d_n_correlator_taps);
|
||||
std::fill_n(d_correlator_outs_16sc.begin(), d_n_correlator_taps, lv_cmake(0, 0));
|
||||
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips.reserve(d_n_correlator_taps);
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
@ -175,7 +174,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(FLAGS_cn0_samples);
|
||||
d_Prompt_buffer.reserve(FLAGS_cn0_samples);
|
||||
d_carrier_lock_test = 1;
|
||||
d_CN0_SNV_dB_Hz = 0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@ -269,10 +268,10 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
glonass_l1_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code, GLONASS_L1_CA_CODE_LENGTH_CHIPS), 0);
|
||||
volk_gnsssdr_32fc_convert_16ic(d_ca_code_16sc, d_ca_code, static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
glonass_l1_ca_code_gen_complex(d_ca_code, 0);
|
||||
volk_gnsssdr_32fc_convert_16ic(d_ca_code_16sc.data(), d_ca_code.data(), static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc, d_local_code_shift_chips);
|
||||
multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc.data(), d_local_code_shift_chips.data());
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_16sc_t(0, 0);
|
||||
@ -486,7 +485,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::~glonass_l1_ca_dll_pll_c_aid_tracking_s
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -511,12 +510,14 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::~glonass_l1_ca_dll_pll_c_aid_tracking_s
|
||||
}
|
||||
}
|
||||
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
volk_gnsssdr_free(d_ca_code_16sc);
|
||||
volk_gnsssdr_free(d_correlator_outs_16sc);
|
||||
|
||||
multicorrelator_cpu_16sc.free();
|
||||
try
|
||||
{
|
||||
multicorrelator_cpu_16sc.free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -594,7 +595,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu_16sc.set_input_output_vectors(d_correlator_outs_16sc, in);
|
||||
multicorrelator_cpu_16sc.set_input_output_vectors(d_correlator_outs_16sc.data(), in);
|
||||
multicorrelator_cpu_16sc.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
|
@ -46,11 +46,11 @@
|
||||
#include "tracking_FLL_PLL_filter.h"
|
||||
#include <gnuradio/block.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <deque>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class glonass_l1_ca_dll_pll_c_aid_tracking_sc;
|
||||
|
||||
@ -123,12 +123,10 @@ private:
|
||||
double d_early_late_spc_chips;
|
||||
int32_t d_n_correlator_taps;
|
||||
|
||||
gr_complex* d_ca_code;
|
||||
lv_16sc_t* d_ca_code_16sc;
|
||||
float* d_local_code_shift_chips;
|
||||
// gr_complex* d_correlator_outs;
|
||||
lv_16sc_t* d_correlator_outs_16sc;
|
||||
// cpu_multicorrelator multicorrelator_cpu;
|
||||
volk_gnsssdr::vector<gr_complex> d_ca_code;
|
||||
volk_gnsssdr::vector<lv_16sc_t> d_ca_code_16sc;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<lv_16sc_t> d_correlator_outs_16sc;
|
||||
Cpu_Multicorrelator_16sc multicorrelator_cpu_16sc;
|
||||
|
||||
// remaining code phase and carrier phase between tracking loops
|
||||
@ -183,7 +181,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int32_t d_cn0_estimation_counter;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
double d_carrier_lock_test;
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <matio.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
@ -53,7 +53,7 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define CN0_ESTIMATION_SAMPLES 10
|
||||
|
||||
@ -111,16 +111,14 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code.reserve(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_correlator_outs.reserve(d_n_correlator_taps);
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_local_code_shift_chips.reserve(d_n_correlator_taps);
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
@ -146,7 +144,7 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc(
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(FLAGS_cn0_samples);
|
||||
d_Prompt_buffer.reserve(FLAGS_cn0_samples);
|
||||
d_carrier_lock_test = 1;
|
||||
d_CN0_SNV_dB_Hz = 0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@ -228,13 +226,10 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
glonass_l1_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code, GLONASS_L1_CA_CODE_LENGTH_CHIPS), 0);
|
||||
glonass_l1_ca_code_gen_complex(d_ca_code, 0);
|
||||
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_rem_code_phase_samples = 0;
|
||||
@ -271,7 +266,7 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::~Glonass_L1_Ca_Dll_Pll_Tracking_cc()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
if (d_dump)
|
||||
@ -296,14 +291,11 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::~Glonass_L1_Ca_Dll_Pll_Tracking_cc()
|
||||
}
|
||||
try
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -556,7 +548,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
@ -658,11 +650,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
|
||||
current_synchro_data.System = {'R'};
|
||||
current_synchro_data.correlation_length_ms = 1;
|
||||
|
@ -44,10 +44,10 @@
|
||||
#include "tracking_2nd_DLL_filter.h"
|
||||
#include "tracking_2nd_PLL_filter.h"
|
||||
#include <gnuradio/block.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Glonass_L1_Ca_Dll_Pll_Tracking_cc;
|
||||
|
||||
@ -124,9 +124,9 @@ private:
|
||||
double d_acq_carrier_doppler_hz;
|
||||
// correlator
|
||||
int32_t d_n_correlator_taps;
|
||||
gr_complex* d_ca_code;
|
||||
float* d_local_code_shift_chips;
|
||||
gr_complex* d_correlator_outs;
|
||||
volk_gnsssdr::vector<gr_complex> d_ca_code;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs;
|
||||
Cpu_Multicorrelator multicorrelator_cpu;
|
||||
|
||||
// tracking vars
|
||||
@ -148,7 +148,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int32_t d_cn0_estimation_counter;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
double d_carrier_lock_test;
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <matio.h>
|
||||
#include <pmt/pmt.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
@ -53,6 +53,7 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#define CN0_ESTIMATION_SAMPLES 10
|
||||
|
||||
@ -140,16 +141,14 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code.reserve(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_correlator_outs.reserve(d_n_correlator_taps);
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_local_code_shift_chips.reserve(d_n_correlator_taps);
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
@ -173,7 +172,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(FLAGS_cn0_samples);
|
||||
d_Prompt_buffer.reserve(FLAGS_cn0_samples);
|
||||
d_carrier_lock_test = 1;
|
||||
d_CN0_SNV_dB_Hz = 0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@ -271,13 +270,10 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
glonass_l2_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code, static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS)), 0);
|
||||
glonass_l2_ca_code_gen_complex(d_ca_code, 0);
|
||||
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_rem_code_phase_samples = 0.0;
|
||||
@ -315,7 +311,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::~glonass_l2_ca_dll_pll_c_aid_tracking_c
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -342,14 +338,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::~glonass_l2_ca_dll_pll_c_aid_tracking_c
|
||||
|
||||
try
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -599,7 +592,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
@ -815,11 +808,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
current_synchro_data.System = {'R'};
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
|
||||
}
|
||||
|
@ -40,15 +40,14 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "tracking_2nd_DLL_filter.h"
|
||||
#include "tracking_FLL_PLL_filter.h"
|
||||
// #include "tracking_loop_filter.h"
|
||||
#include "cpu_multicorrelator.h"
|
||||
#include <gnuradio/block.h>
|
||||
#include <pmt/pmt.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <deque>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class glonass_l2_ca_dll_pll_c_aid_tracking_cc;
|
||||
|
||||
@ -121,9 +120,9 @@ private:
|
||||
double d_early_late_spc_chips;
|
||||
int32_t d_n_correlator_taps;
|
||||
|
||||
gr_complex* d_ca_code;
|
||||
float* d_local_code_shift_chips;
|
||||
gr_complex* d_correlator_outs;
|
||||
volk_gnsssdr::vector<gr_complex> d_ca_code;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs;
|
||||
Cpu_Multicorrelator multicorrelator_cpu;
|
||||
|
||||
// remaining code phase and carrier phase between tracking loops
|
||||
@ -179,7 +178,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int32_t d_cn0_estimation_counter;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
double d_carrier_lock_test;
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <matio.h>
|
||||
#include <pmt/pmt.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
@ -52,6 +53,7 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#define CN0_ESTIMATION_SAMPLES 10
|
||||
|
||||
@ -137,19 +139,16 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code.reserve(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS));
|
||||
d_ca_code_16sc.reserve(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
|
||||
d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0, 0);
|
||||
}
|
||||
d_correlator_outs_16sc.reserve(d_n_correlator_taps);
|
||||
std::fill_n(d_correlator_outs_16sc.begin(), d_n_correlator_taps, lv_cmake(0, 0));
|
||||
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips.reserve(d_n_correlator_taps);
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
@ -173,7 +172,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(FLAGS_cn0_samples);
|
||||
d_Prompt_buffer.reserve(FLAGS_cn0_samples);
|
||||
d_carrier_lock_test = 1;
|
||||
d_CN0_SNV_dB_Hz = 0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@ -267,10 +266,10 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
glonass_l2_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code, static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS)), 0);
|
||||
volk_gnsssdr_32fc_convert_16ic(d_ca_code_16sc, d_ca_code, static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS));
|
||||
glonass_l2_ca_code_gen_complex(d_ca_code, 0);
|
||||
volk_gnsssdr_32fc_convert_16ic(d_ca_code_16sc.data(), d_ca_code.data(), static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc, d_local_code_shift_chips);
|
||||
multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc.data(), d_local_code_shift_chips.data());
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_16sc_t(0, 0);
|
||||
@ -484,7 +483,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::~glonass_l2_ca_dll_pll_c_aid_tracking_s
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,12 +508,14 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::~glonass_l2_ca_dll_pll_c_aid_tracking_s
|
||||
}
|
||||
}
|
||||
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
volk_gnsssdr_free(d_ca_code_16sc);
|
||||
volk_gnsssdr_free(d_correlator_outs_16sc);
|
||||
|
||||
multicorrelator_cpu_16sc.free();
|
||||
try
|
||||
{
|
||||
multicorrelator_cpu_16sc.free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -592,7 +593,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu_16sc.set_input_output_vectors(d_correlator_outs_16sc, in);
|
||||
multicorrelator_cpu_16sc.set_input_output_vectors(d_correlator_outs_16sc.data(), in);
|
||||
multicorrelator_cpu_16sc.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
|
@ -43,12 +43,11 @@
|
||||
#include "tracking_2nd_DLL_filter.h"
|
||||
#include "tracking_FLL_PLL_filter.h"
|
||||
#include <gnuradio/block.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <deque>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class glonass_l2_ca_dll_pll_c_aid_tracking_sc;
|
||||
|
||||
@ -121,12 +120,10 @@ private:
|
||||
double d_early_late_spc_chips;
|
||||
int32_t d_n_correlator_taps;
|
||||
|
||||
gr_complex* d_ca_code;
|
||||
lv_16sc_t* d_ca_code_16sc;
|
||||
float* d_local_code_shift_chips;
|
||||
// gr_complex* d_correlator_outs;
|
||||
lv_16sc_t* d_correlator_outs_16sc;
|
||||
// cpu_multicorrelator multicorrelator_cpu;
|
||||
volk_gnsssdr::vector<gr_complex> d_ca_code;
|
||||
volk_gnsssdr::vector<lv_16sc_t> d_ca_code_16sc;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<lv_16sc_t> d_correlator_outs_16sc;
|
||||
Cpu_Multicorrelator_16sc multicorrelator_cpu_16sc;
|
||||
|
||||
// remaining code phase and carrier phase between tracking loops
|
||||
@ -181,7 +178,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int32_t d_cn0_estimation_counter;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
double d_carrier_lock_test;
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <matio.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
@ -53,6 +53,7 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#define CN0_ESTIMATION_SAMPLES 10
|
||||
|
||||
@ -111,16 +112,14 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code.reserve(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_correlator_outs.reserve(d_n_correlator_taps);
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_local_code_shift_chips.reserve(d_n_correlator_taps);
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
@ -146,7 +145,7 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc(
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(FLAGS_cn0_samples);
|
||||
d_Prompt_buffer.reserve(FLAGS_cn0_samples);
|
||||
d_carrier_lock_test = 1;
|
||||
d_CN0_SNV_dB_Hz = 0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@ -228,13 +227,10 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
glonass_l2_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code, static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS)), 0);
|
||||
glonass_l2_ca_code_gen_complex(d_ca_code, 0);
|
||||
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_rem_code_phase_samples = 0;
|
||||
@ -271,7 +267,7 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::~Glonass_L2_Ca_Dll_Pll_Tracking_cc()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
if (d_dump)
|
||||
@ -296,14 +292,11 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::~Glonass_L2_Ca_Dll_Pll_Tracking_cc()
|
||||
}
|
||||
try
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -556,7 +549,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
@ -658,11 +651,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
|
||||
current_synchro_data.System = {'R'};
|
||||
current_synchro_data.correlation_length_ms = 1;
|
||||
|
@ -42,10 +42,10 @@
|
||||
#include "tracking_2nd_DLL_filter.h"
|
||||
#include "tracking_2nd_PLL_filter.h"
|
||||
#include <gnuradio/block.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Glonass_L2_Ca_Dll_Pll_Tracking_cc;
|
||||
|
||||
@ -122,9 +122,10 @@ private:
|
||||
double d_acq_carrier_doppler_hz;
|
||||
// correlator
|
||||
int32_t d_n_correlator_taps;
|
||||
gr_complex* d_ca_code;
|
||||
float* d_local_code_shift_chips;
|
||||
gr_complex* d_correlator_outs;
|
||||
|
||||
volk_gnsssdr::vector<gr_complex> d_ca_code;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs;
|
||||
Cpu_Multicorrelator multicorrelator_cpu;
|
||||
|
||||
// tracking vars
|
||||
@ -146,7 +147,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int32_t d_cn0_estimation_counter;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
double d_carrier_lock_test;
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <gsl/gsl>
|
||||
#include <matio.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
@ -55,6 +56,7 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
gps_l1_ca_kf_tracking_cc_sptr
|
||||
@ -127,16 +129,14 @@ Gps_L1_Ca_Kf_Tracking_cc::Gps_L1_Ca_Kf_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<float *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code.reserve(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_correlator_outs.reserve(d_n_correlator_taps);
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_local_code_shift_chips.reserve(d_n_correlator_taps);
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
@ -163,7 +163,7 @@ Gps_L1_Ca_Kf_Tracking_cc::Gps_L1_Ca_Kf_Tracking_cc(
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(FLAGS_cn0_samples);
|
||||
d_Prompt_buffer.reserve(FLAGS_cn0_samples);
|
||||
d_carrier_lock_test = 1;
|
||||
d_CN0_SNV_dB_Hz = 0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@ -324,13 +324,10 @@ void Gps_L1_Ca_Kf_Tracking_cc::start_tracking()
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
gps_l1_ca_code_gen_float(gsl::span<float>(d_ca_code, static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(float)), d_acquisition_gnss_synchro->PRN, 0);
|
||||
gps_l1_ca_code_gen_float(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
|
||||
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_rem_code_phase_samples = 0;
|
||||
@ -368,7 +365,7 @@ Gps_L1_Ca_Kf_Tracking_cc::~Gps_L1_Ca_Kf_Tracking_cc()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
if (d_dump)
|
||||
@ -393,14 +390,11 @@ Gps_L1_Ca_Kf_Tracking_cc::~Gps_L1_Ca_Kf_Tracking_cc()
|
||||
}
|
||||
try
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -693,7 +687,7 @@ int Gps_L1_Ca_Kf_Tracking_cc::general_work(int noutput_items __attribute__((unus
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// Perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
|
@ -49,12 +49,12 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "tracking_2nd_DLL_filter.h"
|
||||
#include "tracking_2nd_PLL_filter.h"
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <armadillo>
|
||||
#include <gnuradio/block.h>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Gps_L1_Ca_Kf_Tracking_cc;
|
||||
|
||||
@ -175,9 +175,9 @@ private:
|
||||
double d_acq_carrier_doppler_hz;
|
||||
// correlator
|
||||
int32_t d_n_correlator_taps;
|
||||
float* d_ca_code;
|
||||
float* d_local_code_shift_chips;
|
||||
gr_complex* d_correlator_outs;
|
||||
volk_gnsssdr::vector<float> d_ca_code;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs;
|
||||
Cpu_Multicorrelator_Real_Codes multicorrelator_cpu;
|
||||
|
||||
// tracking vars
|
||||
@ -203,7 +203,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int32_t d_cn0_estimation_counter;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
double d_carrier_lock_test;
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "tracking_discriminators.h"
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
@ -53,8 +53,7 @@
|
||||
#include <utility>
|
||||
|
||||
|
||||
gps_l1_ca_tcp_connector_tracking_cc_sptr
|
||||
gps_l1_ca_tcp_connector_make_tracking_cc(
|
||||
gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_make_tracking_cc(
|
||||
int64_t fs_in,
|
||||
uint32_t vector_length,
|
||||
bool dump,
|
||||
@ -105,21 +104,19 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code.reserve(GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Very-Early, Early, Prompt, Late, Very-Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_correlator_outs.reserve(d_n_correlator_taps);
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
// map memory pointers of correlator outputs
|
||||
d_Early = &d_correlator_outs[0];
|
||||
d_Prompt = &d_correlator_outs[1];
|
||||
d_Late = &d_correlator_outs[2];
|
||||
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips.reserve(d_n_correlator_taps);
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
@ -149,7 +146,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
|
||||
|
||||
// CN0 estimation and lock detector buffers
|
||||
d_cn0_estimation_counter = 0;
|
||||
d_Prompt_buffer = std::vector<gr_complex>(FLAGS_cn0_samples);
|
||||
d_Prompt_buffer.reserve(FLAGS_cn0_samples);
|
||||
d_carrier_lock_test = 1;
|
||||
d_CN0_SNV_dB_Hz = 0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@ -224,13 +221,10 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
|
||||
d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
gps_l1_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code, (GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), d_acquisition_gnss_synchro->PRN, 0);
|
||||
gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
|
||||
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int32_t n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
|
||||
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_rem_code_phase_samples = 0;
|
||||
@ -268,20 +262,17 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::~Gps_L1_Ca_Tcp_Connector_Tracking_cc()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
d_tcp_com.close_tcp_connection(d_port);
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
LOG(WARNING) << "Exception in Tracking block destructor: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,7 +366,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), in);
|
||||
|
||||
double carr_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
double rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in);
|
||||
@ -491,9 +482,9 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib
|
||||
}
|
||||
else
|
||||
{
|
||||
*d_Early = gr_complex(0, 0);
|
||||
*d_Prompt = gr_complex(0, 0);
|
||||
*d_Late = gr_complex(0, 0);
|
||||
*d_Early = gr_complex(0.0, 0.0);
|
||||
*d_Prompt = gr_complex(0.0, 0.0);
|
||||
*d_Late = gr_complex(0.0, 0.0);
|
||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
|
||||
// When tracking is disabled an array of 1's is sent to maintain the TCP connection
|
||||
|
@ -41,10 +41,10 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "tcp_communication.h"
|
||||
#include <gnuradio/block.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class Gps_L1_Ca_Tcp_Connector_Tracking_cc;
|
||||
@ -112,7 +112,7 @@ private:
|
||||
|
||||
double d_code_phase_step_chips;
|
||||
|
||||
gr_complex *d_ca_code;
|
||||
volk_gnsssdr::vector<gr_complex> d_ca_code;
|
||||
|
||||
gr_complex *d_Early;
|
||||
gr_complex *d_Prompt;
|
||||
@ -127,8 +127,8 @@ private:
|
||||
float d_acq_code_phase_samples;
|
||||
float d_acq_carrier_doppler_hz;
|
||||
// correlator
|
||||
float *d_local_code_shift_chips;
|
||||
gr_complex *d_correlator_outs;
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs;
|
||||
Cpu_Multicorrelator multicorrelator_cpu;
|
||||
|
||||
// tracking vars
|
||||
@ -153,7 +153,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int32_t d_cn0_estimation_counter;
|
||||
std::vector<gr_complex> d_Prompt_buffer;
|
||||
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
||||
float d_carrier_lock_test;
|
||||
float d_CN0_SNV_dB_Hz;
|
||||
float d_carrier_lock_threshold;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <armadillo>
|
||||
#include <volk/volk.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <complex>
|
||||
@ -132,3 +133,22 @@ TEST(ConjugateTest, VolkComplexImplementation)
|
||||
volk_gnsssdr_free(input);
|
||||
volk_gnsssdr_free(output);
|
||||
}
|
||||
|
||||
|
||||
TEST(ConjugateTest, VolkComplexImplementationAlloc)
|
||||
{
|
||||
volk_gnsssdr::vector<std::complex<float>> input(FLAGS_size_conjugate_test, std::complex<float>(0.0, 0.0));
|
||||
volk_gnsssdr::vector<std::complex<float>> output(FLAGS_size_conjugate_test);
|
||||
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
volk_32fc_conjugate_32fc(output.data(), input.data(), FLAGS_size_conjugate_test);
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "Conjugate of a " << FLAGS_size_conjugate_test
|
||||
<< "-length complex float vector using VOLK ALLOC finished in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <armadillo>
|
||||
#include <volk/volk.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <complex>
|
||||
@ -45,6 +46,10 @@ TEST(MagnitudeSquaredTest, StandardCComplexImplementation)
|
||||
auto* input = new std::complex<float>[FLAGS_size_magnitude_test];
|
||||
auto* output = new float[FLAGS_size_magnitude_test];
|
||||
unsigned int number = 0;
|
||||
for (number = 0; number < static_cast<unsigned int>(FLAGS_size_magnitude_test); number++)
|
||||
{
|
||||
input[number] = std::complex<float>(0.0, 0.0);
|
||||
}
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
@ -56,7 +61,7 @@ TEST(MagnitudeSquaredTest, StandardCComplexImplementation)
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test
|
||||
<< "-length vector in standard C computed in " << elapsed_seconds.count() * 1e6
|
||||
<< "-length complex vector in standard C computed in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
delete[] input;
|
||||
delete[] output;
|
||||
@ -132,4 +137,24 @@ TEST(MagnitudeSquaredTest, VolkComplexImplementation)
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
}
|
||||
|
||||
// volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_fft_size);
|
||||
|
||||
TEST(MagnitudeSquaredTest, VolkComplexImplementationAlloc)
|
||||
{
|
||||
volk_gnsssdr::vector<std::complex<float>> input(FLAGS_size_magnitude_test); // or: input(FLAGS_size_magnitude_test, std::complex<float>(0.0, 0.0));
|
||||
std::fill_n(input.begin(), FLAGS_size_magnitude_test, std::complex<float>(0.0, 0.0));
|
||||
volk_gnsssdr::vector<float> output(FLAGS_size_magnitude_test);
|
||||
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
volk_32fc_magnitude_squared_32f(output.data(), input.data(), static_cast<unsigned int>(FLAGS_size_magnitude_test));
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test
|
||||
<< "-length vector using VOLK ALLOC computed in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
}
|
||||
|
||||
// volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_fft_size);
|
||||
|
@ -60,8 +60,8 @@ TEST(MultiplyTest, StandardCDoubleImplementation)
|
||||
<< " doubles in standard C finished in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
|
||||
double acc = 0;
|
||||
double expected = 0;
|
||||
double acc = 0.0;
|
||||
double expected = 0.0;
|
||||
for (int i = 0; i < FLAGS_size_multiply_test; i++)
|
||||
{
|
||||
acc += output[i];
|
||||
@ -112,8 +112,8 @@ TEST(MultiplyTest, StandardCComplexImplementation)
|
||||
<< " complex<float> in standard C finished in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
|
||||
std::complex<float> expected(0, 0);
|
||||
std::complex<float> result(0, 0);
|
||||
std::complex<float> expected(0.0, 0.0);
|
||||
std::complex<float> result(0.0, 0.0);
|
||||
for (int i = 0; i < FLAGS_size_multiply_test; i++)
|
||||
{
|
||||
result += output[i];
|
||||
@ -146,7 +146,7 @@ TEST(MultiplyTest, C11ComplexImplementation)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
|
||||
std::complex<float> expected(0, 0);
|
||||
std::complex<float> expected(0.0, 0.0);
|
||||
auto result = std::inner_product(output.begin(), output.end(), output.begin(), expected);
|
||||
ASSERT_EQ(expected, result);
|
||||
}
|
||||
@ -193,14 +193,43 @@ TEST(MultiplyTest, VolkComplexImplementation)
|
||||
auto* mag = static_cast<float*>(volk_gnsssdr_malloc(FLAGS_size_multiply_test * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
volk_32fc_magnitude_32f(mag, output, FLAGS_size_multiply_test);
|
||||
|
||||
auto* result = new float(0);
|
||||
auto* result = new float(0.0);
|
||||
volk_32f_accumulator_s32f(result, mag, FLAGS_size_multiply_test);
|
||||
// Comparing floating-point numbers is tricky.
|
||||
// Due to round-off errors, it is very unlikely that two floating-points will match exactly.
|
||||
// See http://code.google.com/p/googletest/wiki/AdvancedGuide#Floating-Point_Comparison
|
||||
float expected = 0;
|
||||
float expected = 0.0;
|
||||
ASSERT_FLOAT_EQ(expected, result[0]);
|
||||
volk_gnsssdr_free(input);
|
||||
volk_gnsssdr_free(output);
|
||||
volk_gnsssdr_free(mag);
|
||||
}
|
||||
|
||||
|
||||
TEST(MultiplyTest, VolkComplexImplementationAlloc)
|
||||
{
|
||||
volk_gnsssdr::vector<std::complex<float>> input(FLAGS_size_multiply_test, std::complex<float>(0.0, 0.0));
|
||||
volk_gnsssdr::vector<std::complex<float>> output(FLAGS_size_multiply_test);
|
||||
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
volk_32fc_x2_multiply_32fc(output.data(), input.data(), input.data(), FLAGS_size_multiply_test);
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test
|
||||
<< "-length complex float vector using VOLK ALLOC finished in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
volk_gnsssdr::vector<float> mag(FLAGS_size_multiply_test);
|
||||
volk_32fc_magnitude_32f(mag.data(), output.data(), FLAGS_size_multiply_test);
|
||||
|
||||
auto* result = new float(0.0);
|
||||
volk_32f_accumulator_s32f(result, mag.data(), FLAGS_size_multiply_test);
|
||||
// Comparing floating-point numbers is tricky.
|
||||
// Due to round-off errors, it is very unlikely that two floating-points will match exactly.
|
||||
// See http://code.google.com/p/googletest/wiki/AdvancedGuide#Floating-Point_Comparison
|
||||
float expected = 0.0;
|
||||
ASSERT_FLOAT_EQ(expected, result[0]);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <gflags/gflags.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <chrono>
|
||||
#include <complex>
|
||||
#include <random>
|
||||
@ -173,3 +173,96 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime)
|
||||
correlator_pool[n]->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTimeAlloc)
|
||||
{
|
||||
std::chrono::time_point<std::chrono::system_clock> start;
|
||||
std::chrono::time_point<std::chrono::system_clock> end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
int max_threads = FLAGS_cpu_multicorrelator_real_codes_max_threads_test;
|
||||
std::vector<std::thread> thread_pool;
|
||||
std::vector<Cpu_Multicorrelator_Real_Codes*> correlator_pool(max_threads);
|
||||
unsigned int correlation_sizes[3] = {2048, 4096, 8192};
|
||||
double execution_times[3];
|
||||
volk_gnsssdr::vector<float> d_ca_code(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
int d_n_correlator_taps = 3;
|
||||
int d_vector_length = correlation_sizes[2]; // max correlation size to allocate all the necessary memory
|
||||
volk_gnsssdr::vector<gr_complex> in_cpu(2 * d_vector_length);
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs(d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips(d_n_correlator_taps);
|
||||
|
||||
// Set TAPs delay values [chips]
|
||||
float d_early_late_spc_chips = 0.5;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
// --- Perform initializations ------------------------------
|
||||
|
||||
// local code resampler on GPU
|
||||
// generate local reference (1 sample per chip)
|
||||
gps_l1_ca_code_gen_float(d_ca_code, 1, 0);
|
||||
// generate inut signal
|
||||
std::random_device r;
|
||||
std::default_random_engine e1(r());
|
||||
std::uniform_real_distribution<float> uniform_dist(0, 1);
|
||||
for (int n = 0; n < 2 * d_vector_length; n++)
|
||||
{
|
||||
in_cpu[n] = std::complex<float>(uniform_dist(e1), uniform_dist(e1));
|
||||
}
|
||||
|
||||
for (int n = 0; n < max_threads; n++)
|
||||
{
|
||||
correlator_pool[n] = new Cpu_Multicorrelator_Real_Codes();
|
||||
correlator_pool[n]->init(d_vector_length, d_n_correlator_taps);
|
||||
correlator_pool[n]->set_input_output_vectors(d_correlator_outs.data(), in_cpu.data());
|
||||
correlator_pool[n]->set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
|
||||
}
|
||||
|
||||
float d_rem_carrier_phase_rad = 0.0;
|
||||
float d_carrier_phase_step_rad = 0.1;
|
||||
float d_code_phase_step_chips = 0.3;
|
||||
float d_code_phase_rate_step_chips = 0.00001;
|
||||
float d_rem_code_phase_chips = 0.4;
|
||||
|
||||
EXPECT_NO_THROW(
|
||||
for (int correlation_sizes_idx = 0; correlation_sizes_idx < 3; correlation_sizes_idx++) {
|
||||
for (int current_max_threads = 1; current_max_threads < (max_threads + 1); current_max_threads++)
|
||||
{
|
||||
std::cout << "Running " << current_max_threads << " concurrent correlators" << std::endl;
|
||||
start = std::chrono::system_clock::now();
|
||||
// create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
thread_pool.emplace_back(std::thread(run_correlator_cpu_real_codes,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_code_phase_rate_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx]));
|
||||
}
|
||||
// wait the threads to finish they work and destroy the thread objects
|
||||
for (auto& t : thread_pool)
|
||||
{
|
||||
t.join();
|
||||
}
|
||||
thread_pool.clear();
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast<double>(FLAGS_cpu_multicorrelator_real_codes_iterations_test);
|
||||
std::cout << "CPU Multicorrelator (real codes) execution time for length=" << correlation_sizes[correlation_sizes_idx]
|
||||
<< " : " << execution_times[correlation_sizes_idx] << " [s]" << std::endl;
|
||||
}
|
||||
});
|
||||
|
||||
for (int n = 0; n < max_threads; n++)
|
||||
{
|
||||
correlator_pool[n]->free();
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <gflags/gflags.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <chrono>
|
||||
#include <complex>
|
||||
#include <random>
|
||||
@ -168,3 +168,96 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime)
|
||||
correlator_pool[n]->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST(CpuMulticorrelatorTest, MeasureExecutionTimeAlloc)
|
||||
{
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
int max_threads = FLAGS_cpu_multicorrelator_max_threads_test;
|
||||
std::vector<std::thread> thread_pool;
|
||||
std::vector<Cpu_Multicorrelator*> correlator_pool(max_threads);
|
||||
unsigned int correlation_sizes[3] = {2048, 4096, 8192};
|
||||
double execution_times[3];
|
||||
|
||||
int d_n_correlator_taps = 3;
|
||||
int d_vector_length = correlation_sizes[2]; // max correlation size to allocate all the necessary memory
|
||||
|
||||
// allocate host memory
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
volk_gnsssdr::vector<gr_complex> d_ca_code(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
volk_gnsssdr::vector<gr_complex> in_cpu(2 * d_vector_length);
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
volk_gnsssdr::vector<gr_complex> d_correlator_outs(d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||
volk_gnsssdr::vector<float> d_local_code_shift_chips(d_n_correlator_taps);
|
||||
// Set TAPs delay values [chips]
|
||||
float d_early_late_spc_chips = 0.5;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
// -- Perform initializations ------------------------------
|
||||
|
||||
// local code resampler on GPU
|
||||
// generate local reference (1 sample per chip)
|
||||
gps_l1_ca_code_gen_complex(d_ca_code, 1, 0);
|
||||
// generate inut signal
|
||||
std::random_device r;
|
||||
std::default_random_engine e1(r());
|
||||
std::uniform_real_distribution<float> uniform_dist(0, 1);
|
||||
for (int n = 0; n < 2 * d_vector_length; n++)
|
||||
{
|
||||
in_cpu[n] = std::complex<float>(uniform_dist(e1), uniform_dist(e1));
|
||||
}
|
||||
|
||||
for (int n = 0; n < max_threads; n++)
|
||||
{
|
||||
correlator_pool[n] = new Cpu_Multicorrelator();
|
||||
correlator_pool[n]->init(d_vector_length, d_n_correlator_taps);
|
||||
correlator_pool[n]->set_input_output_vectors(d_correlator_outs.data(), in_cpu.data());
|
||||
correlator_pool[n]->set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
|
||||
}
|
||||
|
||||
float d_rem_carrier_phase_rad = 0.0;
|
||||
float d_carrier_phase_step_rad = 0.1;
|
||||
float d_code_phase_step_chips = 0.3;
|
||||
float d_rem_code_phase_chips = 0.4;
|
||||
|
||||
EXPECT_NO_THROW(
|
||||
for (int correlation_sizes_idx = 0; correlation_sizes_idx < 3; correlation_sizes_idx++) {
|
||||
for (int current_max_threads = 1; current_max_threads < (max_threads + 1); current_max_threads++)
|
||||
{
|
||||
std::cout << "Running " << current_max_threads << " concurrent correlators" << std::endl;
|
||||
start = std::chrono::system_clock::now();
|
||||
// create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
thread_pool.push_back(std::thread(run_correlator_cpu,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx]));
|
||||
}
|
||||
// wait the threads to finish they work and destroy the thread objects
|
||||
for (auto& t : thread_pool)
|
||||
{
|
||||
t.join();
|
||||
}
|
||||
thread_pool.clear();
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast<double>(FLAGS_cpu_multicorrelator_iterations_test);
|
||||
std::cout << "CPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx]
|
||||
<< " : " << execution_times[correlation_sizes_idx] << " [s]" << std::endl;
|
||||
}
|
||||
});
|
||||
|
||||
for (int n = 0; n < max_threads; n++)
|
||||
{
|
||||
correlator_pool[n]->free();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user