From c14fed8b64b992374574600122d5b7904a633119 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 1 May 2016 09:19:30 +0200 Subject: [PATCH] Samll fixes in tests. Dump flags set to false --- .../galileo_e1_dll_pll_veml_tracking_test.cc | 2 +- ...ileo_e1_pcps_ambiguous_acquisition_test.cc | 4 +- ...cps_acquisition_gsoc2014_gensource_test.cc | 361 +++--------------- .../gnss_block/galileo_e5a_tracking_test.cc | 2 +- .../gps_l2_m_dll_pll_tracking_test.cc | 17 +- 5 files changed, 70 insertions(+), 316 deletions(-) diff --git a/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc b/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc index 6b2afe099..b275b157d 100644 --- a/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc @@ -88,7 +88,7 @@ void GalileoE1DllPllVemlTrackingInternalTest::init() config->set_property("GNSS-SDR.internal_fs_hz", "8000000"); config->set_property("Tracking_Galileo.item_type", "gr_complex"); - config->set_property("Tracking_Galileo.dump", "true"); + config->set_property("Tracking_Galileo.dump", "false"); config->set_property("Tracking_Galileo.dump_filename", "../data/veml_tracking_ch_"); config->set_property("Tracking_Galileo.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking"); config->set_property("Tracking_Galileo.early_late_space_chips", "0.15"); diff --git a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc index 7312e0240..c20e181b3 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -68,7 +68,6 @@ private: public: int rx_message; ~GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx(); //!< Default destructor - }; @@ -101,6 +100,7 @@ GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::GalileoE1PcpsAmbiguousAcquisitionT rx_message = 0; } + GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::~GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx() {} @@ -240,7 +240,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) 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->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events")); + top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); }) << "Failure connecting the blocks of acquisition test." << std::endl; acquisition->init(); diff --git a/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index 7d80480be..1be587c60 100644 --- a/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -254,7 +254,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1() config->set_property("SignalSource.data_flag", "false"); config->set_property("SignalSource.BW_BB", "0.97"); - config->set_property("SignalSource.dump", "true"); + config->set_property("SignalSource.dump", "false"); config->set_property("SignalSource.dump_filename", "../data/signal_source.dat"); config->set_property("InputFilter.implementation", "Fir_Filter"); @@ -291,7 +291,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1() config->set_property("Acquisition_Galileo.doppler_step", "250"); // config->set_property("Acquisition_Galileo.doppler_step", "500"); config->set_property("Acquisition_Galileo.bit_transition_flag", "false"); - config->set_property("Acquisition_Galileo.dump", "true"); + config->set_property("Acquisition_Galileo.dump", "false"); config->set_property("SignalSource.dump_filename", "../data/acquisition.dat"); } @@ -337,7 +337,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_2() config->set_property("Acquisition_Galileo.doppler_max", "10000"); config->set_property("Acquisition_Galileo.doppler_step", "250"); config->set_property("Acquisition_Galileo.bit_transition_flag", "false"); - config->set_property("Acquisition_Galileo.dump", "true"); + config->set_property("Acquisition_Galileo.dump", "false"); config->set_property("SignalSource.dump_filename", "../data/acquisition.dat"); } @@ -424,7 +424,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_3() config->set_property("SignalSource.data_flag", "true"); config->set_property("SignalSource.BW_BB", "0.97"); - config->set_property("SignalSource.dump", "true"); + config->set_property("SignalSource.dump", "false"); config->set_property("SignalSource.dump_filename", "../data/signal_source.dat"); config->set_property("InputFilter.implementation", "Fir_Filter"); @@ -459,7 +459,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_3() config->set_property("Acquisition_Galileo.doppler_max", "10000"); config->set_property("Acquisition_Galileo.doppler_step", "250"); config->set_property("Acquisition_Galileo.bit_transition_flag", "false"); - config->set_property("Acquisition_Galileo.dump", "true"); + config->set_property("Acquisition_Galileo.dump", "false"); config->set_property("SignalSource.dump_filename", "../data/acquisition.dat"); } @@ -558,22 +558,20 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::process_message() } } + void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::stop_queue() { stop = true; } -/* + + TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, Instantiate) { config_1(); -// acquisition = new GalileoE5aPilot_3msAcquisition(config.get(), "Acquisition", 1, 1, queue); - acquisition = new GalileoE5a3msNoncoherentIQAcquisition(config.get(), "Acquisition", 1, 1, queue); - - delete acquisition; - + acquisition = std::make_shared(config.get(), "Acquisition", 1, 1, queue); } - */ -/* + + TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) { config_1(); @@ -582,10 +580,10 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) struct timeval tv; long long int begin = 0; long long int end = 0; - //acquisition = new GalileoE5aPcpsAcquisition(config.get(), "Acquisition", 1, 1, queue); - //acquisition = new GalileoE5aPilot_3msAcquisition(config.get(), "Acquisition", 1, 1, queue); - acquisition = new GalileoE5a3msNoncoherentIQAcquisition(config.get(), "Acquisition", 1, 1, queue); - + acquisition = std::make_shared(config.get(), "Acquisition", 1, 1, queue); + boost::shared_ptr msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue); + queue = gr::msg_queue::make(0); + top_block = gr::make_top_block("Acquisition test"); ASSERT_NO_THROW( { acquisition->connect(top_block); @@ -593,6 +591,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 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."<< std::endl; EXPECT_NO_THROW( { @@ -604,10 +603,8 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) }) << "Failure running the top_block."<< std::endl; std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl; - - delete acquisition; } - */ + /* TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, SOURCEValidation) { @@ -653,14 +650,9 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM) config_1(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - //int nsamples = floor(fs_in*integration_time_ms*1e-3); acquisition = std::make_shared(config.get(), "Acquisition", 1, 1, queue); boost::shared_ptr msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue); - //unsigned int skiphead_sps = 28000+32000; // 32 Msps - // unsigned int skiphead_sps = 0; - // unsigned int skiphead_sps = 84000; - ASSERT_NO_THROW( { acquisition->set_channel(0); }) << "Failure setting channel."<< std::endl; @@ -698,27 +690,31 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM) signal_source->connect(top_block); top_block->connect(signal_source->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." << std::endl; + }) << "Failure connecting the blocks of acquisition test." << std::endl; acquisition->reset(); acquisition->init(); + // USING SIGNAL FROM FILE SOURCE - /* - ASSERT_NO_THROW( { - //noiseless sim - //std::string file = "/home/marc/E5a_acquisitions/sim_32M_sec94_PRN11_long.dat"; - // real - std::string file = "/home/marc/E5a_acquisitions/32MS_complex.dat"; + //unsigned int skiphead_sps = 28000+32000; // 32 Msps + // unsigned int skiphead_sps = 0; + // unsigned int skiphead_sps = 84000; - 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); - - gr::blocks::skiphead::sptr skip_head = gr::blocks::skiphead::make(sizeof(gr_complex), skiphead_sps); - top_block->connect(file_source, 0, skip_head, 0); - top_block->connect(skip_head, 0, acquisition->get_left_block(), 0); - -// top_block->connect(file_source, 0, acquisition->get_left_block(), 0); - }) << "Failure connecting the blocks of acquisition test." << std::endl; */ + // ASSERT_NO_THROW( { + // //noiseless sim + // //std::string file = "/home/marc/E5a_acquisitions/sim_32M_sec94_PRN11_long.dat"; + // // real + // std::string file = "/home/marc/E5a_acquisitions/32MS_complex.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); + // + // gr::blocks::skiphead::sptr skip_head = gr::blocks::skiphead::make(sizeof(gr_complex), skiphead_sps); + // top_block->connect(file_source, 0, skip_head, 0); + // top_block->connect(skip_head, 0, acquisition->get_left_block(), 0); + // + // // top_block->connect(file_source, 0, acquisition->get_left_block(), 0); + // }) << "Failure connecting the blocks of acquisition test." << std::endl; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -730,34 +726,14 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM) { case 0: { - gnss_synchro.PRN = 19; //real - //gnss_synchro.PRN = 11; //sim - //break; + gnss_synchro.PRN = 19; // present + } + case 1: + { + gnss_synchro.PRN = 11; } - // case 1: - // { - // gnss_synchro.PRN = 11; - // break; - // } - // case 2: - // { - // gnss_synchro.PRN = 12; - // break; - // } - // case 3: - // { - // gnss_synchro.PRN = 20; - // break; - // } } - // if (i == 0) - // { - // gnss_synchro.PRN = 11;// This satellite is visible - // } - // else if (i == 1) - // { - // gnss_synchro.PRN = 19; // This satellite is not visible - // } + start_queue(); acquisition->reset(); @@ -776,245 +752,22 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM) //std::cout << gnss_synchro.Acq_delay_samples << "acq delay" <set_channel(0); - }) << "Failure setting channel."<< std::endl; - - ASSERT_NO_THROW( { - acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; - - ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max."<< std::endl; - - ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step."<< std::endl; - - ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold."<< std::endl; - - ASSERT_NO_THROW( { - acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block."<< std::endl; - - acquisition->init(); - - ASSERT_NO_THROW( { - //std::string path = std::string(TEST_PATH); - //std::string file = "/home/marc/E5a_acquisitions/signal_source_5X_primary.dat"; - //std::string file = "/home/marc/E5a_acquisitions/Tiered_sink_4sat_stup4.dat"; - //std::string file = "/home/marc/E5a_acquisitions/Tiered_4sat_down_upsampled12M_stup2.dat"; - //std::string file = "/home/marc/E5a_acquisitions/Tiered_stup4_down-upsampl12.dat"; - //std::string file = "/home/marc/E5a_acquisitions/Tiered_sim_4sat_stup4_2s_up.dat"; -// std::string file = "/home/marc/E5a_acquisitions/Tiered_sink_4sat_setup5_down-upsampled12M.dat"; - std::string file = "/home/marc/E5a_acquisitions/32Ms_complex.dat"; - //std::string file = "/home/marc/E5a_acquisitions/galileo_E5_8M_r2_upsampled_12.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); - gr::blocks::skiphead::sptr skip_head = gr::blocks::skiphead::make(sizeof(gr_complex), skiphead_sps); - - top_block->connect(file_source, 0, skip_head, 0); - top_block->connect(skip_head, 0, acquisition->get_left_block(), 0); - }) << "Failure connecting the blocks of acquisition test." << std::endl; - - for (unsigned int i = 0; i < 5; i++) - { - init(); - - switch (i) - { - case 0: - gnss_synchro.PRN = 10; - break; - case 1: - gnss_synchro.PRN = 19; - break; - case 2: - gnss_synchro.PRN = 12; - break; - case 3: - gnss_synchro.PRN = 20; - break; - case 4: - gnss_synchro.PRN = 11; - break; - } - - acquisition->set_local_code(); - - start_queue(); - - EXPECT_NO_THROW( { - top_block->run(); // Start threads and wait - }) << "Failure running he top_block."<< std::endl; - - } - - delete acquisition; -} - */ -/* -TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, FourSatsGen) -{ - config_3(); - - int nsamples = floor(fs_in*integration_time_ms*1e-3); -// acquisition = new GalileoE5aPcpsAcquisition(config.get(), "Acquisition", 1, 1, queue); - acquisition = new GalileoE5aPilot_3msAcquisition(config.get(), "Acquisition", 1, 1, queue); - ASSERT_NO_THROW( { - acquisition->set_channel(0); - }) << "Failure setting channel."<< std::endl; - - ASSERT_NO_THROW( { - acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; - - ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max."<< std::endl; - - ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step."<< std::endl; - - ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold."<< std::endl; - - ASSERT_NO_THROW( { - acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block."<< std::endl; - - acquisition->init(); - - ASSERT_NO_THROW( { - std::string filename_ = "../data/Tiered_sink_4sat.dat"; - boost::shared_ptr file_sink_; - - 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, queue); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); - signal_source->connect(top_block); - // - file_sink_=gr::blocks::file_sink::make(sizeof(gr_complex), filename_.c_str()); - - top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); - top_block->connect(signal_source->get_right_block(), 0, file_sink_, 0); - - }) << "Failure connecting the blocks of acquisition test." << std::endl; - -// ASSERT_NO_THROW( { -// //std::string path = std::string(TEST_PATH); -// //std::string file = "/home/marc/E5a_acquisitions/signal_source_5X_primary.dat"; -// std::string file = "/home/marc/E5a_acquisitions/Tiered_sink_test.dat"; -// //std::string file = "/home/marc/E5a_acquisitions/galileo_E5_8M_r2_upsampled_12.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); -// }) << "Failure connecting the blocks of acquisition test." << std::endl; - - // all satellite visibles but with different CN0 - for (unsigned int i = 0; i < 4; i++) - { - init(); - sat=i; - - switch (i) - { - case 0: - gnss_synchro.PRN = 11; - break; - case 1: - gnss_synchro.PRN = 12; - break; - case 2: - gnss_synchro.PRN = 19; - break; - case 3: - gnss_synchro.PRN = 20; - break; - } - - acquisition->set_local_code(); - - start_queue(); - - EXPECT_NO_THROW( { - top_block->run(); // Start threads and wait - }) << "Failure running he top_block."<< std::endl; - - switch (i) - { - case 0: - //EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; - if (message == 1) - { - std::cout << gnss_synchro.Acq_delay_samples << "acq delay" <set_property("GNSS-SDR.internal_fs_hz", "32000000"); config->set_property("Tracking_Galileo.item_type", "gr_complex"); - config->set_property("Tracking_Galileo.dump", "true"); + config->set_property("Tracking_Galileo.dump", "false"); config->set_property("Tracking_Galileo.dump_filename", "../data/e5a_tracking_ch_"); config->set_property("Tracking_Galileo.implementation", "Galileo_E5a_DLL_PLL_Tracking"); config->set_property("Tracking_Galileo.early_late_space_chips", "0.5"); diff --git a/src/tests/gnss_block/gps_l2_m_dll_pll_tracking_test.cc b/src/tests/gnss_block/gps_l2_m_dll_pll_tracking_test.cc index 7faa1a130..3e08f22d8 100644 --- a/src/tests/gnss_block/gps_l2_m_dll_pll_tracking_test.cc +++ b/src/tests/gnss_block/gps_l2_m_dll_pll_tracking_test.cc @@ -77,10 +77,12 @@ GpsL2MDllPllTrackingTest_msg_rx_sptr GpsL2MDllPllTrackingTest_msg_rx_make() void GpsL2MDllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg) { - try { - long int message=pmt::to_long(msg); - rx_message=message; - }catch(boost::bad_any_cast& e) + try + { + long int message = pmt::to_long(msg); + rx_message = message; + } + catch(boost::bad_any_cast& e) { LOG(WARNING) << "msg_handler_telemetry Bad any cast!\n"; rx_message = 0; @@ -88,9 +90,8 @@ void GpsL2MDllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg) } GpsL2MDllPllTrackingTest_msg_rx::GpsL2MDllPllTrackingTest_msg_rx() : - gr::block("GpsL2MDllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) + gr::block("GpsL2MDllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { - this->message_port_register_in(pmt::mp("events")); this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL2MDllPllTrackingTest_msg_rx::msg_handler_events, this, _1)); rx_message = 0; @@ -138,7 +139,7 @@ void GpsL2MDllPllTrackingTest::init() config->set_property("GNSS-SDR.internal_fs_hz", "5000000"); config->set_property("Tracking_2S.item_type", "gr_complex"); - config->set_property("Tracking_2S.dump", "true"); + config->set_property("Tracking_2S.dump", "false"); config->set_property("Tracking_2S.dump_filename", "../data/L2m_tracking_ch_"); config->set_property("Tracking_2S.implementation", "GPS_L2_M_DLL_PLL_Tracking"); config->set_property("Tracking_2S.early_late_space_chips", "0.5"); @@ -188,7 +189,7 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults) top_block->connect(file_source, 0, valve, 0); top_block->connect(valve, 0, tracking->get_left_block(), 0); top_block->connect(tracking->get_right_block(), 0, sink, 0); - top_block->msg_connect(tracking->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events")); + top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); }) << "Failure connecting the blocks of tracking test." << std::endl; tracking->start_tracking();