mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 20:50:33 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into acq_performance
This commit is contained in:
commit
4b74936715
@ -60,6 +60,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
|
@ -65,6 +65,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
|
||||
}
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||
acq_parameters.doppler_max = doppler_max_;
|
||||
|
@ -61,6 +61,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
|
@ -60,6 +60,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
|
@ -62,6 +62,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
|
@ -62,6 +62,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
|
||||
|
@ -61,6 +61,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
|
||||
|
@ -123,6 +123,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
|
||||
grid_ = arma::fmat();
|
||||
d_step_two = false;
|
||||
d_dump_number = 0;
|
||||
d_dump_channel = acq_parameters.dump_channel;
|
||||
}
|
||||
|
||||
|
||||
@ -363,7 +364,7 @@ void pcps_acquisition::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_bins)};
|
||||
matvar_t* matvar = Mat_VarCreate("grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0);
|
||||
matvar_t* matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
@ -407,6 +408,10 @@ void pcps_acquisition::dump_results(int effective_fft_size)
|
||||
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);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
Mat_Close(matfp);
|
||||
}
|
||||
}
|
||||
@ -510,7 +515,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
||||
}
|
||||
}
|
||||
// Record results to file if required
|
||||
if (acq_parameters.dump)
|
||||
if (acq_parameters.dump and d_channel == d_dump_channel)
|
||||
{
|
||||
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size);
|
||||
}
|
||||
@ -579,7 +584,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
||||
}
|
||||
}
|
||||
// Record results to file if required
|
||||
if (acq_parameters.dump)
|
||||
if (acq_parameters.dump and d_channel == d_dump_channel)
|
||||
{
|
||||
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size);
|
||||
}
|
||||
@ -653,7 +658,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
||||
}
|
||||
d_worker_active = false;
|
||||
// Record results to file if required
|
||||
if (acq_parameters.dump)
|
||||
if (acq_parameters.dump and d_channel == d_dump_channel)
|
||||
{
|
||||
pcps_acquisition::dump_results(effective_fft_size);
|
||||
}
|
||||
|
@ -125,6 +125,7 @@ private:
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
arma::fmat grid_;
|
||||
long int d_dump_number;
|
||||
unsigned int d_dump_channel;
|
||||
|
||||
public:
|
||||
~pcps_acquisition();
|
||||
|
@ -48,5 +48,6 @@ Acq_Conf::Acq_Conf()
|
||||
blocking = false;
|
||||
make_2_steps = false;
|
||||
dump_filename = "";
|
||||
dump_channel = 0;
|
||||
it_size = sizeof(char);
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
bool blocking;
|
||||
bool make_2_steps;
|
||||
std::string dump_filename;
|
||||
unsigned int dump_channel;
|
||||
size_t it_size;
|
||||
|
||||
Acq_Conf();
|
||||
|
@ -160,6 +160,7 @@ void GpsL1CaPcpsAcquisitionTest::init()
|
||||
config->set_property("Acquisition_1C.dump", "false");
|
||||
}
|
||||
config->set_property("Acquisition_1C.dump_filename", "./tmp-acq-gps1/acquisition");
|
||||
config->set_property("Acquisition_1C.dump_channel", "1");
|
||||
config->set_property("Acquisition_1C.threshold", "0.00001");
|
||||
config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max));
|
||||
config->set_property("Acquisition_1C.doppler_step", std::to_string(doppler_step));
|
||||
|
@ -163,7 +163,8 @@ void GpsL2MPcpsAcquisitionTest::init()
|
||||
{
|
||||
config->set_property("Acquisition_2S.dump", "false");
|
||||
}
|
||||
config->set_property("Acquisition_2S.dump_filename", "./tmp-acq-gps2/acquisition");
|
||||
config->set_property("Acquisition_2S.dump_filename", "./tmp-acq-gps2/acquisition_test");
|
||||
config->set_property("Acquisition_2S.dump_channel", "1");
|
||||
config->set_property("Acquisition_2S.threshold", "0.001");
|
||||
config->set_property("Acquisition_2S.doppler_max", std::to_string(doppler_max));
|
||||
config->set_property("Acquisition_2S.doppler_step", std::to_string(doppler_step));
|
||||
@ -175,11 +176,11 @@ void GpsL2MPcpsAcquisitionTest::init()
|
||||
void GpsL2MPcpsAcquisitionTest::plot_grid()
|
||||
{
|
||||
//load the measured values
|
||||
std::string basename = "./tmp-acq-gps2/acquisition_G_2S";
|
||||
std::string basename = "./tmp-acq-gps2/acquisition_test_G_2S";
|
||||
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(floor(static_cast<double>(sampling_frequency_hz) / (GPS_L2_M_CODE_RATE_HZ / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS))));
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code);
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code, 1);
|
||||
if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
|
||||
std::vector<int> *doppler = &acq_dump.doppler;
|
||||
|
@ -43,7 +43,7 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
matvar_t* var_ = Mat_VarRead(matfile, "grid");
|
||||
matvar_t* var_ = Mat_VarRead(matfile, "acq_grid");
|
||||
if (var_ == NULL)
|
||||
{
|
||||
std::cout << "¡¡¡Unreachable grid variable into Acquisition dump file!!!" << std::endl;
|
||||
@ -109,15 +109,20 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
positive_acq = *static_cast<int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "PRN");
|
||||
PRN = *static_cast<int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
std::vector<std::vector<float> >::iterator it1;
|
||||
std::vector<float>::iterator it2;
|
||||
float* aux = static_cast<float*>(var_->data);
|
||||
int k = 0;
|
||||
float normalization_factor = std::pow(d_samples_per_code, 4) * input_power;
|
||||
for (it1 = mag.begin(); it1 != mag.end(); it1++)
|
||||
{
|
||||
for (it2 = it1->begin(); it2 != it1->end(); it2++)
|
||||
{
|
||||
*it2 = static_cast<float>(aux[k]) / input_power;
|
||||
*it2 = static_cast<float>(aux[k]) / normalization_factor;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
@ -128,6 +133,49 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
}
|
||||
|
||||
|
||||
acquisition_dump_reader::acquisition_dump_reader(const std::string& basename,
|
||||
int channel,
|
||||
int execution)
|
||||
{
|
||||
unsigned int sat_ = 0;
|
||||
unsigned int doppler_max_ = 0;
|
||||
unsigned int doppler_step_ = 0;
|
||||
unsigned int samples_per_code_ = 0;
|
||||
|
||||
mat_t* matfile = Mat_Open(d_dump_filename.c_str(), MAT_ACC_RDONLY);
|
||||
if (matfile != NULL)
|
||||
{
|
||||
matvar_t* var_ = Mat_VarRead(matfile, "doppler_max");
|
||||
doppler_max_ = *static_cast<unsigned int*>(var_->data);
|
||||
Mat_VarFree(var_);
|
||||
|
||||
var_ = Mat_VarRead(matfile, "doppler_step");
|
||||
doppler_step_ = *static_cast<unsigned int*>(var_->data);
|
||||
Mat_VarFree(var_);
|
||||
|
||||
var_ = Mat_VarRead(matfile, "PRN");
|
||||
sat_ = *static_cast<int*>(var_->data);
|
||||
Mat_VarFree(var_);
|
||||
|
||||
var_ = Mat_VarRead(matfile, "grid");
|
||||
samples_per_code_ = var_->dims[0];
|
||||
Mat_VarFree(var_);
|
||||
|
||||
Mat_Close(matfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl;
|
||||
}
|
||||
acquisition_dump_reader(basename,
|
||||
sat_,
|
||||
doppler_max_,
|
||||
doppler_step_,
|
||||
samples_per_code_,
|
||||
channel,
|
||||
execution);
|
||||
}
|
||||
|
||||
acquisition_dump_reader::acquisition_dump_reader(const std::string& basename,
|
||||
unsigned int sat,
|
||||
unsigned int doppler_max,
|
||||
@ -148,6 +196,7 @@ acquisition_dump_reader::acquisition_dump_reader(const std::string& basename,
|
||||
threshold = 0.0;
|
||||
positive_acq = 0;
|
||||
sample_counter = 0;
|
||||
PRN = 0;
|
||||
d_num_doppler_bins = static_cast<unsigned int>(ceil(static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step)));
|
||||
std::vector<std::vector<float> > mag_aux(d_num_doppler_bins, std::vector<float>(d_samples_per_code));
|
||||
mag = mag_aux;
|
||||
|
@ -45,7 +45,13 @@ public:
|
||||
unsigned int samples_per_code,
|
||||
int channel = 0,
|
||||
int execution = 1);
|
||||
|
||||
acquisition_dump_reader(const std::string& basename,
|
||||
int channel = 0,
|
||||
int execution = 1);
|
||||
|
||||
~acquisition_dump_reader();
|
||||
|
||||
bool read_binary_acq();
|
||||
|
||||
std::vector<int> doppler;
|
||||
@ -57,6 +63,7 @@ public:
|
||||
float input_power;
|
||||
float threshold;
|
||||
int positive_acq;
|
||||
unsigned int PRN;
|
||||
long unsigned int sample_counter;
|
||||
|
||||
private:
|
||||
|
@ -107,7 +107,8 @@ xlabel('Doppler shift / Hz')
|
||||
ylabel('Test statistics')
|
||||
title(['Fixed code delay to ' num2str((d_max - 1) / n_fft * n_chips) ' chips'])
|
||||
subplot(2,1,2)
|
||||
plot(delay, grid(:, f_max))
|
||||
normalization = (d_samples_per_code^4) * input_power;
|
||||
plot(delay, acq_grid(:, f_max)./normalization)
|
||||
xlim([min(delay) max(delay)])
|
||||
xlabel('Code delay / chips')
|
||||
ylabel('Test statistics')
|
||||
|
Loading…
Reference in New Issue
Block a user