1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

use of the :2 decimator in the GPS L1/Galileo E1 frequency band

added methods to the L1 and E1 FPGA acquisition classes for the unit tests to be able to control the doppler sweep from the SW instead of the HW. In this way we can produce more detailed results.
This commit is contained in:
Marc Majoral 2018-10-04 17:49:09 +02:00
parent df3caf5c2b
commit 2826dd21d3
9 changed files with 95 additions and 18 deletions

View File

@ -59,8 +59,9 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
float downsampling_factor = configuration_->property("GNSS-SDR.downsampling_factor", 1.0);
float downsampling_factor = configuration_->property("GNSS-SDR.downsampling_factor", 2.0);
acq_parameters.downsampling_factor = downsampling_factor;
//fs_in = fs_in/2.0; // downampling filter
//printf("fs_in pre downsampling = %ld\n", fs_in);

View File

@ -61,7 +61,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
float downsampling_factor = configuration_->property("GNSS-SDR.downsampling_factor", 1.0);
float downsampling_factor = configuration_->property("GNSS-SDR.downsampling_factor", 2.0);
acq_parameters.downsampling_factor = downsampling_factor;
//fs_in = fs_in/2.0; // downampling filter
//printf("fs_in pre downsampling = %ld\n", fs_in);

View File

@ -75,8 +75,10 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) : gr::block(
d_test_statistics = 0.0;
d_channel = 0U;
d_gnss_synchro = 0;
d_single_doppler_flag = false;
d_downsampling_factor = acq_parameters.downsampling_factor;
printf("downsampling_factor = %f\n", d_downsampling_factor);
d_select_queue_Fpga = acq_parameters.select_queue_Fpga;
//printf("zzzz acq_parameters.code_length = %d\n", acq_parameters.code_length);
//printf("zzzz acq_parameters.samples_per_ms = %d\n", acq_parameters.samples_per_ms);
@ -300,10 +302,21 @@ void pcps_acquisition_fpga::set_active(bool active)
// temp_d_input_power = d_input_power;
d_input_power = (d_input_power - d_mag) / (d_fft_size - 1);
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * (d_doppler_index - 1);
int32_t doppler;
if (d_single_doppler_flag == false)
{
doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * (d_doppler_index - 1);
//doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * (d_doppler_index); // this is the wrong one
}
else
{
doppler = static_cast<int32_t>(acq_parameters.doppler_max);
}
//d_gnss_synchro->Acq_delay_samples = static_cast<double>(2*(indext % (2*acq_parameters.samples_per_code)));
//printf("acq gnuradioblock doppler = %d\n", doppler);
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
d_sample_counter = initial_sample;
@ -311,13 +324,21 @@ void pcps_acquisition_fpga::set_active(bool active)
{
if (d_downsampling_factor > 1)
{
//printf("yes here\n");
d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_downsampling_factor*(indext % acq_parameters.samples_per_code));
d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 81*0.5*d_downsampling_factor; // delay due to the downsampling filter in the acquisition
d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 81*0.25*d_downsampling_factor; // delay due to the downsampling filter in the acquisition
//d_gnss_synchro->Acq_delay_samples = static_cast<double>(2*(indext % acq_parameters.samples_per_code));
//d_gnss_synchro->Acq_delay_samples = static_cast<double>(2*(indext));
//d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter*2 - 81;
//d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % acq_parameters.samples_per_code);
//d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
}
else
{
d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % acq_parameters.samples_per_code);
d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; // delay due to the downsampling filter in the acquisition
//d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter - 40; // delay due to the downsampling filter in the acquisition
//d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 81*0.5*d_downsampling_factor;
}
}
else
@ -364,6 +385,10 @@ void pcps_acquisition_fpga::set_active(bool active)
// printf("##### debug_doppler_index = %d\n",debug_doppler_index);
send_positive_acquisition();
d_state = 0; // Positive acquisition
//printf("acq d_gnss_synchro->Acq_delay_samples = %f\n: ",d_gnss_synchro->Acq_delay_samples);
//printf("acq d_gnss_synchro->Acq_samplestamp_samples = %d\n", (unsigned int) d_gnss_synchro->Acq_samplestamp_samples);
}
else
{
@ -390,6 +415,7 @@ int pcps_acquisition_fpga::general_work(int noutput_items __attribute__((unused)
void pcps_acquisition_fpga::set_single_doppler_flag(unsigned int single_doppler_flag)
{
acquisition_fpga->set_single_doppler_flag(single_doppler_flag);
d_single_doppler_flag = true;
}
// this function is only used for the unit tests

View File

@ -126,7 +126,7 @@ private:
float d_downsampling_factor;
uint32_t d_select_queue_Fpga;
bool d_single_doppler_flag;
public:

View File

@ -327,7 +327,7 @@ void fpga_acquisition::set_doppler_sweep(uint32_t num_sweeps)
d_map_base[3] = phase_step_rad_int;
// repeat the calculation with the doppler step
doppler = 0;
doppler = static_cast<int32_t>(d_doppler_step);
phase_step_rad = GPS_TWO_PI * (doppler) / static_cast<float>(d_fs_in);
phase_step_rad_real = phase_step_rad / (GPS_TWO_PI / 2);
//printf("AAA phase_step_rad_real for doppler step = %f\n", phase_step_rad_real);

View File

@ -76,6 +76,7 @@ public:
{
//printf("acq lib set doppler max called\n");
d_doppler_max = doppler_max;
//printf("set acq lib d_doppler_max = %d\n", (int) d_doppler_max);
}
/*!
@ -86,6 +87,7 @@ public:
{
//printf("acq lib set doppler step called\n");
d_doppler_step = doppler_step;
//printf("set acq lib d_doppler_step = %d\n", (int) d_doppler_step);
}
/*!

View File

@ -1258,10 +1258,10 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
{
// normal operation
uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples - current_synchro_data.Acq_delay_samples) / d_correlation_length_samples);
//uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples*2 - current_synchro_data.Acq_delay_samples*2) / d_correlation_length_samples);
//uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples*2 - current_synchro_data.Acq_delay_samples*2 + 40) / d_correlation_length_samples);
//printf("333333 num_frames = %d\n", num_frames);
absolute_samples_offset = static_cast<uint64_t>(current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames * d_correlation_length_samples);
//uint64_t absolute_samples_offset = static_cast<uint64_t>(current_synchro_data.Acq_delay_samples*2 + current_synchro_data.Acq_samplestamp_samples*2 + num_frames * d_correlation_length_samples);
//absolute_samples_offset = static_cast<uint64_t>(current_synchro_data.Acq_delay_samples*2 + current_synchro_data.Acq_samplestamp_samples*2 -40 + num_frames * d_correlation_length_samples);
//printf("333333 absolute_samples_offset = %llu\n", absolute_samples_offset);
}
else

View File

@ -518,8 +518,10 @@ bool HybridObservablesTestFpga::acquire_signal()
std::string System_and_Signal;
//create the correspondign acquisition block according to the desired tracking signal
printf("AAAAAAAAAAAAAAAAAAAAA\n");
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0)
{
printf("AAAAAAAAAAAAAAAAAAAAA2222\n");
tmp_gnss_synchro.System = 'G';
std::string signal = "1C";
signal.copy(tmp_gnss_synchro.Signal, 2, 0);
@ -614,6 +616,7 @@ bool HybridObservablesTestFpga::acquire_signal()
throw(std::exception());
}
printf("BBBBBBBBBBBBBBBBBBBBBBBBBB\n");
//acquisition->set_gnss_synchro(&tmp_gnss_synchro);
//acquisition->set_channel(0);
//acquisition->set_doppler_max(config->property("Acquisition.doppler_max", FLAGS_external_signal_acquisition_doppler_max_hz));
@ -654,6 +657,7 @@ bool HybridObservablesTestFpga::acquire_signal()
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0)
{
printf("BBBBBBBBBBBBBBBBBBBBBBBBBB2222222222\n");
top_block->msg_connect(acquisition_GpsL1Ca_Fpga->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
}
else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0)
@ -694,7 +698,7 @@ bool HybridObservablesTestFpga::acquire_signal()
}
setup_fpga_switch_obs_test();
printf("CCCCCCCCCCCCCCCCCCCCCCCCCCCC\n");
if (test_observables_doppler_control_in_sw == 0)
{
@ -844,9 +848,11 @@ bool HybridObservablesTestFpga::acquire_signal()
}
else
{
printf("DDDDDDDDDDDDDDDDDDDDDDDDD\n");
unsigned int code_length;
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0)
{
printf("DDDDDDDDDDDDDDDDDDDDDDDDD22222222222\n");
code_length = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
}
else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0)
@ -863,12 +869,17 @@ bool HybridObservablesTestFpga::acquire_signal()
code_length = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L5i_CODE_RATE_HZ / static_cast<double>(GPS_L5i_CODE_LENGTH_CHIPS))));
}
printf("DDDDDDD3 code_length = %d\n", code_length);
float nbits = ceilf(log2f((float)code_length));
unsigned int fft_size = pow(2, nbits);
unsigned int nsamples_total = fft_size;
printf("EEEEEEEEEEEEEEEEEEEEE nbits = %f nsamples_total = %d\n", nbits, fft_size);
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0)
{
printf("EEEEEEEEEEEEEEEEEEEEEEE2\n");
acquisition_GpsL1Ca_Fpga->set_single_doppler_flag(1);
}
else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0)
@ -907,9 +918,18 @@ bool HybridObservablesTestFpga::acquire_signal()
uint32_t doppler_index_iteration;
int doppler_shift_selected;
int doppler_num = 0;
//printf("FFFFFFFFFFFFFFFFFFFFFFFFF PRN= %d\n", PRN);
//printf("acq_doppler_max = %d acq_doppler_step = %d", acq_doppler_max, acq_doppler_step);
// debug
//acq_doppler_step = 250;
//int dummyflag;
//printf("PRN = %d type a number \n", PRN);
//std::cin >> dummyflag;
for (int doppler_shift = -acq_doppler_max;doppler_shift <= acq_doppler_max;doppler_shift = doppler_shift + acq_doppler_step)
{
//printf("main loop doppler_shift = %d\n", doppler_shift);
tmp_gnss_synchro.PRN = PRN;
pthread_mutex_lock(&mutex_obs_test);
@ -979,6 +999,10 @@ bool HybridObservablesTestFpga::acquire_signal()
{
printf("ERROR cannot create DMA Process\n");
}
// else
// {
// printf("$$$$$$$$$$$$44 CREATED DMA PROCESS\n");
// }
msg_rx->rx_message = 0;
top_block->start();
@ -1063,9 +1087,16 @@ bool HybridObservablesTestFpga::acquire_signal()
if (test_statistics > threshold)
{
std::cout << " " << PRN << " ";
//doppler_measurements_map.insert(std::pair<int, double>(PRN, static_cast<double>(doppler_shift_selected)));
//code_delay_measurements_map.insert(std::pair<int, double>(PRN, static_cast<double>(max_index % nsamples_total)));
//acq_samplestamp_map.insert(std::pair<int, double>(PRN, initial_sample)); // should be 0 (first sample upon which acq starts is always 0 in this case)
tmp_gnss_synchro.Acq_doppler_hz = doppler_shift_selected;
tmp_gnss_synchro.Acq_delay_samples = max_index;
tmp_gnss_synchro.Acq_samplestamp_samples = initial_sample; // delay due to the downsampling filter in the acquisition
gnss_synchro_vec.push_back(tmp_gnss_synchro);
}
else
@ -1951,7 +1982,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
std::cout << "Estimated Initial Doppler " << gnss_synchro_vec.at(n).Acq_doppler_hz
<< " [Hz], estimated Initial code delay " << gnss_synchro_vec.at(n).Acq_delay_samples << " [Samples]"
<< " Acquisition SampleStamp is " << gnss_synchro_vec.at(n).Acq_samplestamp_samples << std::endl;
gnss_synchro_vec.at(n).Acq_samplestamp_samples = 0;
//gnss_synchro_vec.at(n).Acq_samplestamp_samples = 0; // caution ! samplestamp_samples may not zero if doppler runs inside the FPGA
}
}
@ -1959,6 +1990,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0)
{
code_length = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
printf("000000000000 code_length = %d\n", code_length);
}
else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0)
{
@ -1976,7 +2008,8 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
float nbits = ceilf(log2f((float)code_length));
unsigned int fft_size = pow(2, nbits);
printf("000000000000 nbits = %f\n", nbits);
printf("000000000000 fft_size = %d\n", fft_size);
std::vector<std::shared_ptr<TrackingInterface>> tracking_ch_vec;
std::vector<std::shared_ptr<TelemetryDecoderInterface>> tlm_ch_vec;
@ -2066,7 +2099,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
top_block->connect(observables->get_right_block(), n, null_sink_vec.at(n), 0);
}
//connect sample counter and timmer to the last channel in observables block (extra channel)
top_block->connect(samp_counter, 0, observables->get_left_block(), tracking_ch_vec.size());
//top_block->connect(samp_counter, 0, observables->get_left_block(), tracking_ch_vec.size());
//file_source->seek(2 * FLAGS_skip_samples, 0); //skip head. ibyte, two bytes per complex sample
}) << "Failure connecting the blocks.";
@ -2074,6 +2107,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
// create acquisition class such that a global Reset is produced for all the HW and the sample counters are reset to 0
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0)
{
printf("111111111111\n");
std::shared_ptr<GpsL1CaPcpsAcquisitionFpga> acquisition_Fpga;
acquisition_Fpga = std::make_shared<GpsL1CaPcpsAcquisitionFpga>(config.get(), "Acquisition", 0, 0);
}
@ -2111,6 +2145,8 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
args.skip_used_samples = 0;
//}
printf("2222222222222 CREATE PROCES\n");
printf("%s\n", file.c_str());
if (pthread_create(&thread_DMA, NULL, handler_DMA_obs_test, (void *)&args) < 0)
{
printf("ERROR cannot create DMA Process\n");
@ -2121,13 +2157,13 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
{
tracking_ch_vec.at(n)->start_tracking();
}
printf("222222222222222222 bis\n");
pthread_mutex_lock(&mutex_obs_test);
send_samples_start_obs_test = 1;
pthread_mutex_unlock(&mutex_obs_test);
top_block->start();
printf("33333333333333333333 top block started\n");
@ -2141,8 +2177,12 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
// wait for the child DMA process to finish
pthread_join(thread_DMA, NULL);
printf("444444444444 CHILD PROCESS FINISHED\n");
top_block->stop();
printf("55555555555 TOP BLOCK STOPPED\n");
// send more samples to unblock the tracking process in case it was waiting for samples
args.file = file;
//if (test_observables_skip_samples_already_used == 1 && test_observables_doppler_control_in_sw == 1)
@ -2155,11 +2195,14 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
// args.skip_used_samples = 0;
//}
args.nsamples_tx = TEST_OBS_NSAMPLES_FINAL;
printf("666666666 CREATE PROCESS TO SEND EXTRA SAMPLES\n");
if (pthread_create(&thread_DMA, NULL, handler_DMA_obs_test, (void *)&args) < 0)
{
printf("ERROR cannot create DMA Process\n");
}
pthread_join(thread_DMA, NULL);
printf("777777777 PROCESS FINISHED \n");
pthread_mutex_lock(&mutex_obs_test);
send_samples_start_obs_test = 0;
pthread_mutex_unlock(&mutex_obs_test);

View File

@ -1102,6 +1102,8 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
float max_magnitude = 0.0;
uint64_t initial_sample = 0;
float power_sum = 0;
float peak_to_power = 0;
float test_statistics;
uint32_t doppler_index = 0;
if (show_results_table == 1)
@ -1118,14 +1120,17 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
fw_fft_scaling_factor = result_table[PRN][doppler_num][3];
doppler_num = doppler_num + 1;
std::cout << "Doppler shift " << doppler_shift << std::endl;
std::cout << "==================== Doppler shift " << doppler_shift << std::endl;
std::cout << "Max magnitude = " << max_magnitude << "Power sum = " << power_sum << std::endl;
std::cout << "FFT total scaling factor = " << total_fft_scaling_factor << " FW FFT scaling factor = " << fw_fft_scaling_factor << std::endl;
peak_to_power = max_magnitude/power_sum;
power_sum = (power_sum - max_magnitude) / (fft_size - 1);
float test_statistics = (max_magnitude / power_sum);
std::cout << "test_statistics = " << test_statistics << std::endl;
test_statistics = (max_magnitude / power_sum);
std::cout << "peak to power = " << peak_to_power << " test_statistics = " << test_statistics << std::endl;
}
int dummy_val;
std::cout << "Enter a value to continue";
std::cin >> dummy_val;
}
}