From c0dd986b95c72c78e35a9cf93b29b66887af96b6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 7 Jun 2018 12:08:42 +0200 Subject: [PATCH] Fix Glonass Acquisition tests Broken by removal of if parameter in Acquisition blocks. Solved by using a Freq_Xlating_Fir_Filter for IF shift --- ...ss_l1_ca_pcps_acquisition_gsoc2017_test.cc | 32 ++++++++++--------- .../glonass_l1_ca_pcps_acquisition_test.cc | 25 +++++++++++++-- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc index 49d381a72..2f7c23a2c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc @@ -46,7 +46,7 @@ #include "glonass_l1_ca_pcps_acquisition.h" #include "signal_generator.h" #include "signal_generator_c.h" -#include "fir_filter.h" +#include "freq_xlating_fir_filter.h" #include "gen_signal_source.h" #include "gnss_sdr_valve.h" #include "boost/shared_ptr.hpp" @@ -226,7 +226,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_1() config->set_property("SignalSource.data_flag", "false"); config->set_property("SignalSource.BW_BB", "0.97"); - config->set_property("InputFilter.implementation", "Fir_Filter"); + config->set_property("InputFilter.implementation", "Freq_Xlating_Fir_Filter"); config->set_property("InputFilter.input_item_type", "gr_complex"); config->set_property("InputFilter.output_item_type", "gr_complex"); config->set_property("InputFilter.taps_item_type", "float"); @@ -244,6 +244,8 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_1() config->set_property("InputFilter.band2_error", "1.0"); config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); + config->set_property("InputFilter.sampling_frequency", std::to_string(fs_in)); + config->set_property("InputFilter.IF", "4000000"); config->set_property("Acquisition.item_type", "gr_complex"); config->set_property("Acquisition.coherent_integration_time_ms", @@ -313,7 +315,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_2() config->set_property("SignalSource.data_flag", "true"); config->set_property("SignalSource.BW_BB", "0.97"); - config->set_property("InputFilter.implementation", "Fir_Filter"); + config->set_property("InputFilter.implementation", "Freq_Xlating_Fir_Filter"); config->set_property("InputFilter.input_item_type", "gr_complex"); config->set_property("InputFilter.output_item_type", "gr_complex"); config->set_property("InputFilter.taps_item_type", "float"); @@ -331,6 +333,8 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_2() config->set_property("InputFilter.band2_error", "1.0"); config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); + config->set_property("InputFilter.sampling_frequency", std::to_string(fs_in)); + config->set_property("InputFilter.IF", "4000000"); config->set_property("Acquisition.item_type", "gr_complex"); config->set_property("Acquisition.coherent_integration_time_ms", @@ -503,12 +507,11 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults) acquisition->init(); ASSERT_NO_THROW({ - boost::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); - signal_source->connect(top_block); - top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + signal_generator->connect(top_block); + top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0); + top_block->connect(filter->get_right_block(), 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."; // i = 0 --> satellite in acquisition is visible @@ -598,12 +601,11 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities) acquisition->init(); ASSERT_NO_THROW({ - boost::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); - signal_source->connect(top_block); - top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + signal_generator->connect(top_block); + top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0); + top_block->connect(filter->get_right_block(), 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."; std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc index 1a015a561..928bef457 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc @@ -46,6 +46,7 @@ #include "in_memory_configuration.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" +#include "freq_xlating_fir_filter.h" #include "glonass_l1_ca_pcps_acquisition.h" @@ -138,6 +139,25 @@ void GlonassL1CaPcpsAcquisitionTest::init() signal.copy(gnss_synchro.Signal, 2, 0); gnss_synchro.PRN = 1; config->set_property("GNSS-SDR.internal_fs_sps", "62314000"); + config->set_property("InputFilter.IF", "9540000"); + config->set_property("InputFilter.input_item_type", "gr_complex"); + config->set_property("InputFilter.output_item_type", "gr_complex"); + config->set_property("InputFilter.taps_item_type", "float"); + config->set_property("InputFilter.number_of_taps", "11"); + config->set_property("InputFilter.number_of_bands", "2"); + config->set_property("InputFilter.band1_begin", "0.0"); + config->set_property("InputFilter.band1_end", "0.97"); + config->set_property("InputFilter.band2_begin", "0.98"); + config->set_property("InputFilter.band2_end", "1.0"); + config->set_property("InputFilter.ampl1_begin", "1.0"); + config->set_property("InputFilter.ampl1_end", "1.0"); + config->set_property("InputFilter.ampl2_begin", "0.0"); + config->set_property("InputFilter.ampl2_end", "0.0"); + config->set_property("InputFilter.band1_error", "1.0"); + config->set_property("InputFilter.band2_error", "1.0"); + config->set_property("InputFilter.filter_type", "bandpass"); + config->set_property("InputFilter.grid_density", "16"); + config->set_property("InputFilter.sampling_frequency", "62314000"); config->set_property("Acquisition_1G.item_type", "gr_complex"); config->set_property("Acquisition_1G.coherent_integration_time_ms", "1"); config->set_property("Acquisition_1G.dump", "true"); @@ -201,7 +221,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ValidationOfResults) double expected_doppler_hz = -9500; init(); std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_1G", 1, 0); - + std::shared_ptr input_filter = std::make_shared(config.get(), "InputFilter", 1, 1); boost::shared_ptr msg_rx = GlonassL1CaPcpsAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW({ @@ -237,7 +257,8 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ValidationOfResults) std::string file = path + "signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat"; const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false); - top_block->connect(file_source, 0, acquisition->get_left_block(), 0); + top_block->connect(file_source, 0, input_filter->get_left_block(), 0); + top_block->connect(input_filter->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); }) << "Failure connecting the blocks of acquisition test.";