mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-15 22:57:17 +00:00
Adding initial functional changes for the smart acquisition resampler
This commit is contained in:
@@ -88,14 +88,37 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
acq_parameters.blocking = blocking_;
|
||||
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
||||
acq_parameters.dump_filename = dump_filename_;
|
||||
//--- Find number of samples per spreading code (4 ms) -----------------
|
||||
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS)));
|
||||
|
||||
float samples_per_ms = static_cast<float>(fs_in_) * 0.001;
|
||||
acq_parameters.samples_per_ms = samples_per_ms;
|
||||
acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast<float>(Galileo_E1_CODE_PERIOD_MS);
|
||||
vector_length_ = sampled_ms_ * samples_per_ms;
|
||||
acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false);
|
||||
if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0)
|
||||
{
|
||||
LOG(WARNING) << "Galileo E1 acqisition disabled the automatic resampler feature because its item_type is not set to gr_complex";
|
||||
acq_parameters_.use_automatic_resampler = false;
|
||||
}
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
if (acq_parameters_.fs_in > Galileo_E1_OPT_ACQ_FS_HZ)
|
||||
{
|
||||
acq_parameters_.resampled_fs = Galileo_E1_OPT_ACQ_FS_HZ;
|
||||
acq_parameters_.resampler_ratio = static_cast<float>(acq_parameters_.fs_in) / static_cast<float>(acq_parameters_.resampled_fs);
|
||||
}
|
||||
|
||||
//--- Find number of samples per spreading code (4 ms) -----------------
|
||||
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS)));
|
||||
float samples_per_ms = static_cast<float>(acq_parameters_.resampled_fs) * 0.001;
|
||||
acq_parameters_.samples_per_ms = samples_per_ms;
|
||||
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(Galileo_E1_CODE_PERIOD_MS);
|
||||
vector_length_ = sampled_ms_ * samples_per_ms;
|
||||
}
|
||||
else
|
||||
{
|
||||
//--- Find number of samples per spreading code (4 ms) -----------------
|
||||
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS)));
|
||||
float samples_per_ms = static_cast<float>(fs_in_) * 0.001;
|
||||
acq_parameters_.samples_per_ms = samples_per_ms;
|
||||
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(Galileo_E1_CODE_PERIOD_MS);
|
||||
vector_length_ = sampled_ms_ * samples_per_ms;
|
||||
}
|
||||
if (bit_transition_flag_)
|
||||
{
|
||||
vector_length_ *= 2;
|
||||
@@ -227,13 +250,29 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
|
||||
{
|
||||
//set local signal generator to Galileo E1 pilot component (1C)
|
||||
char pilot_signal[3] = "1C";
|
||||
galileo_e1_code_gen_complex_sampled(code, pilot_signal,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code, pilot_signal,
|
||||
cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code, pilot_signal,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
|
||||
cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_
|
||||
|
||||
#include "acquisition_interface.h"
|
||||
#include "acq_conf.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include "complex_byte_to_float_x2.h"
|
||||
@@ -139,6 +140,7 @@ public:
|
||||
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
Acq_Conf acq_parameters_;
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
gr::blocks::float_to_complex::sptr float_to_complex_;
|
||||
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
|
||||
|
||||
@@ -84,16 +84,44 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
||||
acq_parameters.max_dwells = max_dwells_;
|
||||
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
||||
acq_parameters.dump_filename = dump_filename_;
|
||||
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||
//--- Find number of samples per spreading code -------------------------
|
||||
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
|
||||
acq_parameters.samples_per_ms = static_cast<float>(fs_in_) * 0.001;
|
||||
acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast<float>(GPS_L1_CA_CODE_PERIOD * 1000.0);
|
||||
|
||||
vector_length_ = std::floor(acq_parameters.sampled_ms * acq_parameters.samples_per_ms) * (acq_parameters.bit_transition_flag ? 2 : 1);
|
||||
acq_parameters_.dump_filename = dump_filename_;
|
||||
acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||
acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||
acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||
acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false);
|
||||
if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0)
|
||||
{
|
||||
LOG(WARNING) << "GPS L1 CA acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex";
|
||||
acq_parameters_.use_automatic_resampler = false;
|
||||
}
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
if (acq_parameters_.fs_in > GPS_L1_CA_OPT_ACQ_FS_HZ)
|
||||
{
|
||||
acq_parameters_.resampler_ratio = floor(static_cast<float>(acq_parameters_.fs_in) / GPS_L1_CA_OPT_ACQ_FS_HZ);
|
||||
uint32_t decimation = acq_parameters_.fs_in / GPS_L1_CA_OPT_ACQ_FS_HZ;
|
||||
while (acq_parameters_.fs_in % decimation > 0)
|
||||
{
|
||||
decimation--;
|
||||
};
|
||||
acq_parameters_.resampler_ratio = decimation;
|
||||
acq_parameters_.resampled_fs = acq_parameters_.fs_in / static_cast<int>(acq_parameters_.resampler_ratio);
|
||||
}
|
||||
//--- Find number of samples per spreading code -------------------------
|
||||
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
|
||||
acq_parameters_.samples_per_ms = static_cast<float>(acq_parameters_.resampled_fs) * 0.001;
|
||||
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L1_CA_CODE_PERIOD * 1000.0);
|
||||
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
acq_parameters_.resampled_fs = fs_in_;
|
||||
//--- Find number of samples per spreading code -------------------------
|
||||
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
|
||||
acq_parameters_.samples_per_ms = static_cast<float>(fs_in_) * 0.001;
|
||||
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L1_CA_CODE_PERIOD * 1000.0);
|
||||
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
|
||||
}
|
||||
code_ = new gr_complex[vector_length_];
|
||||
|
||||
if (item_type_ == "cshort")
|
||||
@@ -208,8 +236,14 @@ void GpsL1CaPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::complex<float>* code = new std::complex<float>[code_length_];
|
||||
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
}
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_
|
||||
|
||||
#include "acquisition_interface.h"
|
||||
#include "acq_conf.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include "complex_byte_to_float_x2.h"
|
||||
@@ -144,6 +145,7 @@ public:
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
Acq_Conf acq_parameters_;
|
||||
gr::blocks::float_to_complex::sptr float_to_complex_;
|
||||
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
|
||||
size_t item_size_;
|
||||
|
||||
@@ -283,7 +283,15 @@ bool pcps_acquisition::is_fdma()
|
||||
|
||||
void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq)
|
||||
{
|
||||
float phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.fs_in);
|
||||
float phase_step_rad;
|
||||
if (acq_parameters.use_automatic_resampler)
|
||||
{
|
||||
phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.resampled_fs);
|
||||
}
|
||||
else
|
||||
{
|
||||
phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.fs_in);
|
||||
}
|
||||
float _phase[1];
|
||||
_phase[0] = 0.0;
|
||||
volk_gnsssdr_s32f_sincos_32fc(carrier_vector, -phase_step_rad, _phase, correlator_length_samples);
|
||||
@@ -719,9 +727,19 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
{
|
||||
d_test_statistics = first_vs_second_peak_statistic(indext, doppler, d_num_doppler_bins, acq_parameters.doppler_max, d_doppler_step);
|
||||
}
|
||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code));
|
||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||
d_gnss_synchro->Acq_samplestamp_samples = samp_count;
|
||||
if (acq_parameters.use_automatic_resampler)
|
||||
{
|
||||
//take into account the acquisition resampler ratio
|
||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code)) * acq_parameters.resampler_ratio;
|
||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||
d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast<double>(samp_count) * acq_parameters.resampler_ratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code));
|
||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||
d_gnss_synchro->Acq_samplestamp_samples = samp_count;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -765,10 +783,22 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
{
|
||||
d_test_statistics = first_vs_second_peak_statistic(indext, doppler, d_num_doppler_bins_step2, static_cast<int32_t>(d_doppler_center_step_two - (static_cast<float>(d_num_doppler_bins_step2) / 2.0) * acq_parameters.doppler_step2), acq_parameters.doppler_step2);
|
||||
}
|
||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code));
|
||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||
d_gnss_synchro->Acq_samplestamp_samples = samp_count;
|
||||
d_gnss_synchro->Acq_doppler_step = acq_parameters.doppler_step2;
|
||||
|
||||
if (acq_parameters.use_automatic_resampler)
|
||||
{
|
||||
//take into account the acquisition resampler ratio
|
||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code)) * acq_parameters.resampler_ratio;
|
||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||
d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast<double>(samp_count) * acq_parameters.resampler_ratio);
|
||||
d_gnss_synchro->Acq_doppler_step = acq_parameters.doppler_step2;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code));
|
||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||
d_gnss_synchro->Acq_samplestamp_samples = samp_count;
|
||||
d_gnss_synchro->Acq_doppler_step = acq_parameters.doppler_step2;
|
||||
}
|
||||
}
|
||||
|
||||
lk.lock();
|
||||
@@ -868,6 +898,12 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
}
|
||||
}
|
||||
|
||||
// Called by gnuradio to enable drivers, etc for i/o devices.
|
||||
bool pcps_acquisition::start()
|
||||
{
|
||||
d_sample_counter = 0ULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
|
||||
gr_vector_int& ninput_items, gr_vector_const_void_star& input_items,
|
||||
|
||||
@@ -98,6 +98,9 @@ private:
|
||||
float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
|
||||
float max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, float input_power, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
|
||||
|
||||
bool start();
|
||||
|
||||
|
||||
Acq_Conf acq_parameters;
|
||||
bool d_active;
|
||||
bool d_worker_active;
|
||||
@@ -233,6 +236,7 @@ public:
|
||||
d_doppler_step = doppler_step;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Parallel Code Phase Search Acquisition signal processing.
|
||||
*/
|
||||
|
||||
@@ -53,4 +53,7 @@ Acq_Conf::Acq_Conf()
|
||||
dump_channel = 0U;
|
||||
it_size = sizeof(char);
|
||||
blocking_on_standby = false;
|
||||
use_automatic_resampler = false;
|
||||
resampler_ratio = 1.0;
|
||||
resampled_fs = 0LL;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,9 @@ public:
|
||||
bool blocking;
|
||||
bool blocking_on_standby; // enable it only for unit testing to avoid sample consume on idle status
|
||||
bool make_2_steps;
|
||||
bool use_automatic_resampler;
|
||||
float resampler_ratio;
|
||||
int64_t resampled_fs;
|
||||
std::string dump_filename;
|
||||
uint32_t dump_channel;
|
||||
size_t it_size;
|
||||
|
||||
Reference in New Issue
Block a user