mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-01 07:43:04 +00:00
Merge branch 'next' of https://github.com/mmajoral/gnss-sdr into fpga_extended_coherent_integration
This commit is contained in:
@@ -203,7 +203,6 @@ signed int GalileoE1Pcps8msAmbiguousAcquisition::mag()
|
||||
void GalileoE1Pcps8msAmbiguousAcquisition::init()
|
||||
{
|
||||
acquisition_cc_->init();
|
||||
//set_local_code();
|
||||
}
|
||||
|
||||
|
||||
@@ -215,8 +214,10 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
std::array<char, 3> Signal_{};
|
||||
Signal_[0] = gnss_synchro_->Signal[0];
|
||||
Signal_[1] = gnss_synchro_->Signal[1];
|
||||
Signal_[2] = '\0';
|
||||
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
@@ -232,7 +232,6 @@ signed int GalileoE1PcpsAmbiguousAcquisition::mag()
|
||||
void GalileoE1PcpsAmbiguousAcquisition::init()
|
||||
{
|
||||
acquisition_->init();
|
||||
//set_local_code();
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +245,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
|
||||
|
||||
if (acquire_pilot_ == true)
|
||||
{
|
||||
//set local signal generator to Galileo E1 pilot component (1C)
|
||||
// set local signal generator to Galileo E1 pilot component (1C)
|
||||
std::array<char, 3> pilot_signal = {{'1', 'C', '\0'}};
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
@@ -261,8 +260,10 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
std::array<char, 3> Signal_{};
|
||||
Signal_[0] = gnss_synchro_->Signal[0];
|
||||
Signal_[1] = gnss_synchro_->Signal[1];
|
||||
Signal_[2] = '\0';
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code_span, Signal_,
|
||||
|
||||
@@ -76,7 +76,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
|
||||
This may be a bug, but acquisition also work by variying the folding factor at va-
|
||||
lues different that the expressed in the paper. In adition, it is important to point
|
||||
out that by making the folding factor smaller we were able to get QuickSync work with
|
||||
Galileo. Future work should be directed to test this asumption statistically.*/
|
||||
Galileo. Future work should be directed to test this assumption statistically.*/
|
||||
|
||||
//folding_factor_ = static_cast<unsigned int>(ceil(sqrt(log2(code_length_))));
|
||||
folding_factor_ = configuration_->property(role + ".folding_factor", 2);
|
||||
@@ -237,7 +237,6 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::mag()
|
||||
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::init()
|
||||
{
|
||||
acquisition_cc_->init();
|
||||
//set_local_code();
|
||||
}
|
||||
|
||||
|
||||
@@ -249,8 +248,10 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
std::array<char, 3> Signal_{};
|
||||
Signal_[0] = gnss_synchro_->Signal[0];
|
||||
Signal_[1] = gnss_synchro_->Signal[1];
|
||||
Signal_[2] = '\0';
|
||||
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
@@ -207,7 +207,6 @@ signed int GalileoE1PcpsTongAmbiguousAcquisition::mag()
|
||||
void GalileoE1PcpsTongAmbiguousAcquisition::init()
|
||||
{
|
||||
acquisition_cc_->init();
|
||||
//set_local_code();
|
||||
}
|
||||
|
||||
|
||||
@@ -219,8 +218,10 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
std::array<char, 3> Signal_{};
|
||||
Signal_[0] = gnss_synchro_->Signal[0];
|
||||
Signal_[1] = gnss_synchro_->Signal[1];
|
||||
Signal_[2] = '\0';
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ void GalileoE5aPcpsAcquisition::init()
|
||||
void GalileoE5aPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> signal_;
|
||||
std::array<char, 3> signal_{};
|
||||
signal_[0] = '5';
|
||||
signal_[2] = '\0';
|
||||
|
||||
|
||||
@@ -56,8 +56,9 @@
|
||||
#include <volk/volk.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <algorithm> // for fill_n, min
|
||||
#include <cmath> // for floor, fmod, rint, ceil
|
||||
#include <cstring> // for memcpy
|
||||
#include <array>
|
||||
#include <cmath> // for floor, fmod, rint, ceil
|
||||
#include <cstring> // for memcpy
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
@@ -455,56 +456,56 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t dims[2] = {static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_bins)};
|
||||
matvar_t* matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0);
|
||||
std::array<size_t, 2> dims{static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_bins)};
|
||||
matvar_t* matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), grid_.memptr(), 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
dims[0] = static_cast<size_t>(1);
|
||||
dims[1] = static_cast<size_t>(1);
|
||||
matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims, &acq_parameters.doppler_max, 0);
|
||||
matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &acq_parameters.doppler_max, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_doppler_step, 0);
|
||||
matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_doppler_step, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("d_positive_acq", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_positive_acq, 0);
|
||||
matvar = Mat_VarCreate("d_positive_acq", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_positive_acq, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
auto aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
|
||||
matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0);
|
||||
matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
aux = static_cast<float>(d_gnss_synchro->Acq_delay_samples);
|
||||
matvar = Mat_VarCreate("acq_delay_samples", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0);
|
||||
matvar = Mat_VarCreate("acq_delay_samples", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("test_statistic", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_test_statistics, 0);
|
||||
matvar = Mat_VarCreate("test_statistic", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_test_statistics, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("threshold", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_threshold, 0);
|
||||
matvar = Mat_VarCreate("threshold", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_threshold, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("input_power", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_input_power, 0);
|
||||
matvar = Mat_VarCreate("input_power", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_input_power, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("sample_counter", MAT_C_UINT64, MAT_T_UINT64, 1, dims, &d_sample_counter, 0);
|
||||
matvar = Mat_VarCreate("sample_counter", MAT_C_UINT64, MAT_T_UINT64, 1, dims.data(), &d_sample_counter, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_gnss_synchro->PRN, 0);
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 1, dims.data(), &d_gnss_synchro->PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("num_dwells", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_num_noncoherent_integrations_counter, 0);
|
||||
matvar = Mat_VarCreate("num_dwells", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_num_noncoherent_integrations_counter, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
@@ -512,18 +513,18 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
|
||||
{
|
||||
dims[0] = static_cast<size_t>(effective_fft_size);
|
||||
dims[1] = static_cast<size_t>(d_num_doppler_bins_step2);
|
||||
matvar = Mat_VarCreate("acq_grid_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, narrow_grid_.memptr(), 0);
|
||||
matvar = Mat_VarCreate("acq_grid_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), narrow_grid_.memptr(), 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
dims[0] = static_cast<size_t>(1);
|
||||
dims[1] = static_cast<size_t>(1);
|
||||
matvar = Mat_VarCreate("doppler_step_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &acq_parameters.doppler_step2, 0);
|
||||
matvar = Mat_VarCreate("doppler_step_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &acq_parameters.doppler_step2, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
aux = d_doppler_center_step_two - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0)) * acq_parameters.doppler_step2;
|
||||
matvar = Mat_VarCreate("doppler_grid_narrow_min", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0);
|
||||
matvar = Mat_VarCreate("doppler_grid_narrow_min", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <volk/volk.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <algorithm> // std::rotate, std::fill_n
|
||||
#include <array>
|
||||
#include <sstream>
|
||||
|
||||
#if HAS_STD_FILESYSTEM
|
||||
@@ -512,7 +513,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
|
||||
{
|
||||
/*!
|
||||
* TODO: High sensitivity acquisition algorithm:
|
||||
* State Mechine:
|
||||
* State Machine:
|
||||
* S0. StandBy. If d_active==1 -> S1
|
||||
* S1. ComputeGrid. Perform the FFT acqusition doppler and delay grid.
|
||||
* Accumulate the search grid matrix (#doppler_bins x #fft_size)
|
||||
@@ -673,52 +674,52 @@ void pcps_acquisition_fine_doppler_cc::dump_results(int effective_fft_size)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t dims[2] = {static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_points)};
|
||||
matvar_t *matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0);
|
||||
std::array<size_t, 2> dims{static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_points)};
|
||||
matvar_t *matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), grid_.memptr(), 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
dims[0] = static_cast<size_t>(1);
|
||||
dims[1] = static_cast<size_t>(1);
|
||||
matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_config_doppler_max, 0);
|
||||
matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_config_doppler_max, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_doppler_step, 0);
|
||||
matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_doppler_step, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("d_positive_acq", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_positive_acq, 0);
|
||||
matvar = Mat_VarCreate("d_positive_acq", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_positive_acq, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
auto aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
|
||||
matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0);
|
||||
matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
aux = static_cast<float>(d_gnss_synchro->Acq_delay_samples);
|
||||
matvar = Mat_VarCreate("acq_delay_samples", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0);
|
||||
matvar = Mat_VarCreate("acq_delay_samples", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("test_statistic", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_test_statistics, 0);
|
||||
matvar = Mat_VarCreate("test_statistic", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_test_statistics, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("threshold", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_threshold, 0);
|
||||
matvar = Mat_VarCreate("threshold", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_threshold, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
aux = 0.0;
|
||||
matvar = Mat_VarCreate("input_power", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0);
|
||||
matvar = Mat_VarCreate("input_power", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("sample_counter", MAT_C_UINT64, MAT_T_UINT64, 1, dims, &d_sample_counter, 0);
|
||||
matvar = Mat_VarCreate("sample_counter", MAT_C_UINT64, MAT_T_UINT64, 1, dims.data(), &d_sample_counter, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_gnss_synchro->PRN, 0);
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 1, dims.data(), &d_gnss_synchro->PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief This funciton triggers a HW reset of the FPGA PL.
|
||||
* \brief This function triggers a HW reset of the FPGA PL.
|
||||
*/
|
||||
void reset_acquisition(void);
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
|
||||
{
|
||||
/*!
|
||||
* TODO: High sensitivity acquisition algorithm:
|
||||
* State Mechine:
|
||||
* State Machine:
|
||||
* S0. StandBy. If d_active==1 -> S1
|
||||
* S1. GetAssist. Define search grid with assistance information. Reset grid matrix -> S2
|
||||
* S2. ComputeGrid. Perform the FFT acqusition doppler and delay grid.
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <volk/volk.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
#include <sstream>
|
||||
@@ -311,26 +312,26 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
||||
|
||||
case 1:
|
||||
{
|
||||
/* initialize acquisition implementing the QuickSync algorithm*/
|
||||
// initialize acquisition implementing the QuickSync algorithm
|
||||
//DLOG(INFO) << "START CASE 1";
|
||||
int32_t doppler;
|
||||
uint32_t indext = 0;
|
||||
float magt = 0.0;
|
||||
const auto* in = reinterpret_cast<const gr_complex*>(input_items[0]); //Get the input samples pointer
|
||||
const auto* in = reinterpret_cast<const gr_complex*>(input_items[0]); // Get the input samples pointer
|
||||
|
||||
auto* in_temp = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
auto* in_temp_folded = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
/*Create a signal to store a signal of size 1ms, to perform correlation
|
||||
in time. No folding on this data is required*/
|
||||
// Create a signal to store a signal of size 1ms, to perform correlation
|
||||
// in time. No folding on this data is required
|
||||
auto* in_1code = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
/*Stores the values of the correlation output between the local code
|
||||
and the signal with doppler shift corrected */
|
||||
// Stores the values of the correlation output between the local code
|
||||
// and the signal with doppler shift corrected
|
||||
auto* corr_output = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
/*Stores a copy of the folded version of the signal.This is used for
|
||||
the FFT operations in future steps of execution*/
|
||||
// Stores a copy of the folded version of the signal.This is used for
|
||||
// the FFT operations in future steps of execution*/
|
||||
// gr_complex in_folded[d_fft_size];
|
||||
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
|
||||
|
||||
@@ -354,35 +355,34 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
||||
<< d_samples_per_code * d_folding_factor;
|
||||
|
||||
|
||||
/* 1- Compute the input signal power estimation. This operation is
|
||||
being performed in a signal of size nxp */
|
||||
// 1- Compute the input signal power estimation. This operation is
|
||||
// being performed in a signal of size nxp
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude, in, d_samples_per_code * d_folding_factor);
|
||||
volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_samples_per_code * d_folding_factor);
|
||||
d_input_power /= static_cast<float>(d_samples_per_code * d_folding_factor);
|
||||
|
||||
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||
{
|
||||
/*Ensure that the signal is going to start with all samples
|
||||
at zero. This is done to avoid over acumulation when performing
|
||||
the folding process to be stored in d_fft_if->get_inbuf()*/
|
||||
// Ensure that the signal is going to start with all samples
|
||||
// at zero. This is done to avoid over acumulation when performing
|
||||
// the folding process to be stored in d_fft_if->get_inbuf()
|
||||
d_signal_folded = new gr_complex[d_fft_size]();
|
||||
memcpy(d_fft_if->get_inbuf(), d_signal_folded, sizeof(gr_complex) * (d_fft_size));
|
||||
|
||||
/*Doppler search steps and then multiplication of the incoming
|
||||
signal with the doppler wipeoffs to eliminate frequency offset
|
||||
*/
|
||||
// Doppler search steps and then multiplication of the incoming
|
||||
// signal with the doppler wipeoffs to eliminate frequency offset
|
||||
doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
|
||||
|
||||
/*Perform multiplication of the incoming signal with the
|
||||
complex exponential vector. This removes the frequency doppler
|
||||
shift offset*/
|
||||
// Perform multiplication of the incoming signal with the
|
||||
// complex exponential vector. This removes the frequency doppler
|
||||
// shift offset
|
||||
volk_32fc_x2_multiply_32fc(in_temp, in,
|
||||
d_grid_doppler_wipeoffs[doppler_index],
|
||||
d_samples_per_code * d_folding_factor);
|
||||
|
||||
/*Perform folding of the carrier wiped-off incoming signal. Since
|
||||
superlinear method is being used the folding factor in the
|
||||
incoming raw data signal is of d_folding_factor^2*/
|
||||
// Perform folding of the carrier wiped-off incoming signal. Since
|
||||
// superlinear method is being used the folding factor in the
|
||||
// incoming raw data signal is of d_folding_factor^2
|
||||
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor * d_folding_factor); i++)
|
||||
{
|
||||
std::transform((in_temp + i * d_fft_size),
|
||||
@@ -392,28 +392,26 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
||||
std::plus<gr_complex>());
|
||||
}
|
||||
|
||||
/* 3- Perform the FFT-based convolution (parallel time search)
|
||||
Compute the FFT of the carrier wiped--off incoming signal*/
|
||||
// 3- Perform the FFT-based convolution (parallel time search)
|
||||
// Compute the FFT of the carrier wiped--off incoming signal
|
||||
d_fft_if->execute();
|
||||
|
||||
/*Multiply carrier wiped--off, Fourier transformed incoming
|
||||
signal with the local FFT'd code reference using SIMD
|
||||
operations with VOLK library*/
|
||||
// Multiply carrier wiped--off, Fourier transformed incoming
|
||||
// signal with the local FFT'd code reference using SIMD
|
||||
// operations with VOLK library
|
||||
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(),
|
||||
d_fft_if->get_outbuf(), d_fft_codes, d_fft_size);
|
||||
|
||||
/* compute the inverse FFT of the aliased signal*/
|
||||
// compute the inverse FFT of the aliased signal
|
||||
d_ifft->execute();
|
||||
|
||||
/* Compute the magnitude and get the maximum value with its
|
||||
index position*/
|
||||
// Compute the magnitude and get the maximum value with its
|
||||
// index position
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude_folded,
|
||||
d_ifft->get_outbuf(), d_fft_size);
|
||||
|
||||
/* Normalize the maximum value to correct the scale factor
|
||||
introduced by FFTW*/
|
||||
//volk_32f_s32f_multiply_32f_a(d_magnitude_folded,d_magnitude_folded,
|
||||
// (1 / (fft_normalization_factor * fft_normalization_factor)), d_fft_size);
|
||||
// Normalize the maximum value to correct the scale factor
|
||||
// introduced by FFTW
|
||||
volk_gnsssdr_32f_index_max_32u(&indext, d_magnitude_folded, d_fft_size);
|
||||
|
||||
magt = d_magnitude_folded[indext] / (fft_normalization_factor * fft_normalization_factor);
|
||||
@@ -425,19 +423,18 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
||||
{
|
||||
d_mag = magt;
|
||||
|
||||
/* In case that d_bit_transition_flag = true, we compare the potentially
|
||||
new maximum test statistics (d_mag/d_input_power) with the value in
|
||||
d_test_statistics. When the second dwell is being processed, the value
|
||||
of d_mag/d_input_power could be lower than d_test_statistics (i.e,
|
||||
the maximum test statistics in the previous dwell is greater than
|
||||
current d_mag/d_input_power). Note that d_test_statistics is not
|
||||
restarted between consecutive dwells in multidwell operation.*/
|
||||
// In case that d_bit_transition_flag = true, we compare the potentially
|
||||
// new maximum test statistics (d_mag/d_input_power) with the value in
|
||||
// d_test_statistics. When the second dwell is being processed, the value
|
||||
// of d_mag/d_input_power could be lower than d_test_statistics (i.e,
|
||||
// the maximum test statistics in the previous dwell is greater than
|
||||
// current d_mag/d_input_power). Note that d_test_statistics is not
|
||||
// restarted between consecutive dwells in multidwell operation.
|
||||
if (d_test_statistics < (d_mag / d_input_power) || !d_bit_transition_flag)
|
||||
{
|
||||
uint32_t detected_delay_samples_folded = 0;
|
||||
detected_delay_samples_folded = (indext % d_samples_per_code);
|
||||
gr_complex complex_acumulator[100];
|
||||
//gr_complex complex_acumulator[d_folding_factor];
|
||||
std::array<gr_complex, 100> complex_acumulator{};
|
||||
|
||||
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor); i++)
|
||||
{
|
||||
@@ -446,16 +443,16 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
||||
|
||||
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor); i++)
|
||||
{
|
||||
/*Copy a signal of 1 code length into suggested buffer.
|
||||
The copied signal must have doppler effect corrected*/
|
||||
// Copy a signal of 1 code length into suggested buffer.
|
||||
// The copied signal must have doppler effect corrected*/
|
||||
memcpy(in_1code, &in_temp[d_possible_delay[i]],
|
||||
sizeof(gr_complex) * (d_samples_per_code));
|
||||
|
||||
/*Perform multiplication of the unmodified local
|
||||
generated code with the incoming signal with doppler
|
||||
effect corrected and accumulates its value. This
|
||||
is indeed correlation in time for an specific value
|
||||
of a shift*/
|
||||
// Perform multiplication of the unmodified local
|
||||
// generated code with the incoming signal with doppler
|
||||
// effect corrected and accumulates its value. This
|
||||
// is indeed correlation in time for an specific value
|
||||
// of a shift
|
||||
volk_32fc_x2_multiply_32fc(corr_output, in_1code, d_code, d_samples_per_code);
|
||||
|
||||
for (int32_t j = 0; j < d_samples_per_code; j++)
|
||||
@@ -463,28 +460,27 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
||||
complex_acumulator[i] += (corr_output[j]);
|
||||
}
|
||||
}
|
||||
/*Obtain maximun value of correlation given the possible delay selected */
|
||||
volk_32fc_magnitude_squared_32f(d_corr_output_f, complex_acumulator, d_folding_factor);
|
||||
// Obtain maximum value of correlation given the possible delay selected
|
||||
volk_32fc_magnitude_squared_32f(d_corr_output_f, complex_acumulator.data(), d_folding_factor);
|
||||
volk_gnsssdr_32f_index_max_32u(&indext, d_corr_output_f, d_folding_factor);
|
||||
|
||||
/*Now save the real code phase in the gnss_syncro block for use in other stages*/
|
||||
// Now save the real code phase in the gnss_syncro block for use in other stages
|
||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_possible_delay[indext]);
|
||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||
d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
|
||||
d_gnss_synchro->Acq_doppler_step = d_doppler_step;
|
||||
|
||||
/* 5- Compute the test statistics and compare to the threshold d_test_statistics = 2 * d_fft_size * d_mag / d_input_power;*/
|
||||
// 5- Compute the test statistics and compare to the threshold d_test_statistics = 2 * d_fft_size * d_mag / d_input_power;
|
||||
d_test_statistics = d_mag / d_input_power;
|
||||
//delete complex_acumulator;
|
||||
}
|
||||
}
|
||||
|
||||
// Record results to file if required
|
||||
if (d_dump)
|
||||
{
|
||||
/*Since QuickSYnc performs a folded correlation in frequency by means
|
||||
of the FFT, it is essential to also keep the values obtained from the
|
||||
possible delay to show how it is maximize*/
|
||||
// Since QuickSYnc performs a folded correlation in frequency by means
|
||||
// of the FFT, it is essential to also keep the values obtained from the
|
||||
// possible delay to show how it is maximize
|
||||
std::stringstream filename;
|
||||
std::streamsize n = sizeof(float) * (d_fft_size); // complex file write
|
||||
filename.str("");
|
||||
@@ -492,7 +488,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
||||
<< "_" << d_gnss_synchro->Signal << "_sat_"
|
||||
<< d_gnss_synchro->PRN << "_doppler_" << doppler << ".dat";
|
||||
d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary);
|
||||
d_dump_file.write(reinterpret_cast<char*>(d_magnitude_folded), n); //write directly |abs(x)|^2 in this Doppler bin?
|
||||
d_dump_file.write(reinterpret_cast<char*>(d_magnitude_folded), n); // write directly |abs(x)|^2 in this Doppler bin?
|
||||
d_dump_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* \file acq_conf.cc
|
||||
* \brief Class that contains all the configuration parameters for generic
|
||||
* acquisition block based on the PCPS algoritm.
|
||||
* acquisition block based on the PCPS algorithm.
|
||||
* \author Carles Fernandez, 2018. cfernandez(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* \file acq_conf.h
|
||||
* \brief Class that contains all the configuration parameters for generic
|
||||
* acquisition block based on the PCPS algoritm.
|
||||
* acquisition block based on the PCPS algorithm.
|
||||
* \author Carles Fernandez, 2018. cfernandez(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
|
||||
@@ -121,7 +121,7 @@ private:
|
||||
int32_t d_fd; // driver descriptor
|
||||
volatile uint32_t *d_map_base; // driver memory map
|
||||
uint32_t *d_all_fft_codes; // memory that contains all the code ffts
|
||||
uint32_t d_vector_length; // number of samples incluing padding and number of ms
|
||||
uint32_t d_vector_length; // number of samples including padding and number of ms
|
||||
uint32_t d_excludelimit;
|
||||
uint32_t d_nsamples_total; // number of samples including padding
|
||||
uint32_t d_nsamples; // number of samples not including padding
|
||||
|
||||
Reference in New Issue
Block a user