diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index f2060aebb..f9712824c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -46,7 +46,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( { configuration_ = configuration; std::string default_item_type = "gr_complex"; - std::string default_dump_filename = "../data/acquisition.dat"; + std::string default_dump_filename = "./data/acquisition.dat"; DLOG(INFO) << "role " << role; diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index 8d1afe8ab..3627a38af 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -510,6 +510,10 @@ public: Gnuplot& plot_xy_err(const X &x, const Y &y, const E &dy, const std::string &title = ""); + template + Gnuplot& plot_grid3d(const X &x, const Y &y, const E &mag, + const std::string &title = ""); + /// plot x,y,z triples: x y z /// from file Gnuplot& plotfile_xyz(const std::string &filename, @@ -804,6 +808,63 @@ Gnuplot& Gnuplot::plot_xy_err(const X &x, } +//------------------------------------------------------------------------------ +// +// Plots a 3d grid +// +template +Gnuplot& Gnuplot::plot_grid3d(const X &x, + const Y &y, + const E &mag, + const std::string &title) +{ + if (x.size() == 0 || y.size() == 0 ) + { + throw GnuplotException("std::vectors too small"); + return *this; + } + std::ofstream tmp; + std::string name = create_tmpfile(tmp); + if (name == "") + return *this; + + // + // write the data to file + // + for (unsigned int i = 0; i < x.size(); i++) + { + for (unsigned int k = 0; k < y.size(); k++) + { + tmp << static_cast(x.at(i)) << " " << static_cast(y.at(k)) << " " << mag.at(i).at(k) << std::endl; + } + tmp.flush(); + } + + tmp.close(); + + std::ostringstream cmdstr; + cmdstr << "set ticslevel 0\n"; + cmdstr << "set hidden3d\n"; + cmdstr << "unset colorbox\n"; + cmdstr << "set border 5\n"; + cmdstr << "unset ztics\n"; + + cmdstr << " splot \"" << name << "\" u 1:2:3"; + + if (title == "") + cmdstr << " notitle with " << pstyle << " palette"; + else + cmdstr << " title \"" << title << "\" with " << pstyle << " palette"; + cmdstr << "\n"; + + // + // Do the actual plot + // + cmd(cmdstr.str()); + + return *this; +} + //------------------------------------------------------------------------------ // // Plots a 3d graph from a list of doubles: x y z diff --git a/src/tests/common-files/test_flags.h b/src/tests/common-files/test_flags.h index fac307f84..a8bac06a6 100644 --- a/src/tests/common-files/test_flags.h +++ b/src/tests/common-files/test_flags.h @@ -39,6 +39,7 @@ DEFINE_string(gnuplot_executable, "", "Gnuplot binary path"); #endif +DEFINE_bool(plot_acq_grid, false, "Plots acquisition grid with gnuplot"); DEFINE_int32(plot_decimate, 1, "Decimate plots"); #endif diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 048abefea..c139216e5 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -341,7 +341,6 @@ int StaticPositionSystemTest::configure_receiver() // Set Acquisition config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); config->set_property("Acquisition_1C.item_type", "gr_complex"); - config->set_property("Acquisition_1C.if", std::to_string(zero)); config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); config->set_property("Acquisition_1C.threshold", std::to_string(threshold)); config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max)); @@ -356,7 +355,6 @@ int StaticPositionSystemTest::configure_receiver() config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); //config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_C_Aid_Tracking"); config->set_property("Tracking_1C.item_type", "gr_complex"); - config->set_property("Tracking_1C.if", std::to_string(zero)); config->set_property("Tracking_1C.dump", "false"); config->set_property("Tracking_1C.dump_filename", "./tracking_ch_"); config->set_property("Tracking_1C.pll_bw_hz", std::to_string(pll_bw_hz)); @@ -630,6 +628,7 @@ void StaticPositionSystemTest::print_results(const std::vector & east, g2.cmd("set yrange [-" + std::to_string(range_3d) + ":" + std::to_string(range_3d) + "]"); g2.cmd("set zrange [-" + std::to_string(range_3d) + ":" + std::to_string(range_3d) + "]"); g2.cmd("set view equal xyz"); + g2.cmd("set ticslevel 0"); g2.cmd("set style fill transparent solid 0.30 border\n set parametric\n set urange [0:2.0*pi]\n set vrange [-pi/2:pi/2]\n r = " + std::to_string(ninty_sas) + @@ -640,7 +639,7 @@ void StaticPositionSystemTest::print_results(const std::vector & east, g2.savetopdf("Position_test_3D"); g2.showonscreen(); // window output } - catch (GnuplotException ge) + catch (const GnuplotException & ge) { std::cout << ge.what() << std::endl; } diff --git a/src/tests/unit-tests/arithmetic/fft_length_test.cc b/src/tests/unit-tests/arithmetic/fft_length_test.cc index f8ea83d22..27f076dc4 100644 --- a/src/tests/unit-tests/arithmetic/fft_length_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_length_test.cc @@ -96,7 +96,6 @@ TEST(FFTLengthTest, MeasureExecutionTime) powers_of_two.push_back(d_fft_size); execution_times_powers_of_two.push_back(exec_time / 1e-3); } - } ); @@ -141,7 +140,7 @@ TEST(FFTLengthTest, MeasureExecutionTime) g2.savetopdf("FFT_execution_times", 18); g2.showonscreen(); // window output } - catch (GnuplotException ge) + catch (const GnuplotException & ge) { std::cout << ge.what() << std::endl; } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc index ccaa8c2af..9d6f79c8e 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc @@ -238,15 +238,14 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_1() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition"); - config->set_property("Acquisition.threshold", "0.2"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); + config->set_property("Acquisition_1B.max_dwells", "1"); + config->set_property("Acquisition_1B.threshold", "0.2"); + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "250"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -324,15 +323,14 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_2() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition"); - config->set_property("Acquisition.pfa", "0.1"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); + config->set_property("Acquisition_1B.max_dwells", "1"); + config->set_property("Acquisition_1B.pfa", "0.1"); + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "250"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -421,43 +419,43 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::stop_queue() TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1); } TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) { - int nsamples = floor(fs_in*integration_time_ms*1e-3); + int nsamples = floor(fs_in * integration_time_ms * 1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds(0); + std::chrono::duration elapsed_seconds(0.0); config_1(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); @@ -466,14 +464,14 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -485,33 +483,33 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1, queue); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1, queue); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -523,7 +521,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) 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."; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -546,7 +544,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); @@ -574,33 +572,33 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb config_2(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -612,7 +610,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb 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::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; @@ -637,7 +635,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); if (i == 0) { diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc index cda844b61..0f484fdba 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc @@ -241,17 +241,16 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.bit_transition_flag","false"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); - config->set_property("Acquisition.threshold", "0.1"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1B.max_dwells", "1"); + config->set_property("Acquisition_1B.bit_transition_flag","false"); + config->set_property("Acquisition_1B.threshold", "0.1"); + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "250"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -267,7 +266,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2() expected_delay_chips = 600; expected_doppler_hz = 750; - max_doppler_error_hz = 2/(3*integration_time_ms*1e-3); + max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3); max_delay_error_chips = 0.50; num_of_realizations = 100; @@ -331,17 +330,16 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.bit_transition_flag","false"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); - config->set_property("Acquisition.pfa", "0.1"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1B.max_dwells", "1"); + config->set_property("Acquisition_1B.bit_transition_flag","false"); + config->set_property("Acquisition_1B.pfa", "0.1"); + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "250"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -424,7 +422,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::stop_queue() TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); } @@ -438,7 +436,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) queue = gr::msg_queue::make(0); config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -449,14 +447,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -467,33 +465,33 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -505,7 +503,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) 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."; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -528,7 +526,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); if (i == 0) { @@ -553,33 +551,33 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi config_2(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -591,7 +589,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi 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::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; @@ -616,7 +614,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc index 55cda548c..ae587a1b3 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -158,17 +158,16 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::init() signal.copy(gnss_synchro.Signal, 2, 0); gnss_synchro.PRN = 11; + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", "4"); - config->set_property("Acquisition.dump", "false"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); - config->set_property("Acquisition.threshold", "0.1"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "125"); - config->set_property("Acquisition.repeat_satellite", "false"); - config->set_property("Acquisition0.cboc", "true"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", "4"); + config->set_property("Acquisition_1B.dump", "false"); + config->set_property("Acquisition_1B.threshold", "0.1"); + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "125"); + config->set_property("Acquisition_1B.repeat_satellite", "false"); + config->set_property("Acquisition_1B.cboc", "true"); } @@ -205,7 +204,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::stop_queue() TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate) { init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str()); } @@ -221,7 +220,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue); @@ -232,14 +231,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -258,27 +257,27 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults) ASSERT_NO_THROW( { acquisition->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.00001)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00001)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 250)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 250)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; ASSERT_NO_THROW( { std::string path = std::string(TEST_PATH); @@ -288,7 +287,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults) 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")); - }) << "Failure connecting the blocks of acquisition test." << std::endl; + }) << "Failure connecting the blocks of acquisition test."; ASSERT_NO_THROW( { start_queue(); @@ -296,14 +295,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults) acquisition->init(); acquisition->reset(); acquisition->set_state(1); - }) << "Failure starting acquisition" << std::endl; + }) << "Failure starting acquisition"; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc index 46518b583..0f8c36cdf 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -47,8 +47,11 @@ #include "gnss_sdr_valve.h" #include "gnss_signal.h" #include "gnss_synchro.h" - +#include "gnuplot_i.h" +#include "test_flags.h" +#include "acquisition_dump_reader.h" #include "galileo_e1_pcps_ambiguous_acquisition.h" +#include "Galileo_E1.h" // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx; @@ -115,18 +118,23 @@ protected: config = std::make_shared(); item_size = sizeof(gr_complex); gnss_synchro = Gnss_Synchro(); + doppler_max = 10000; + doppler_step = 250; } ~GalileoE1PcpsAmbiguousAcquisitionTest() {} void init(); + void plot_grid(); gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; Gnss_Synchro gnss_synchro; size_t item_size; + unsigned int doppler_max; + unsigned int doppler_step; }; @@ -134,28 +142,92 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::init() { gnss_synchro.Channel_ID = 0; gnss_synchro.System = 'E'; - std::string signal = "1C"; + std::string signal = "1B"; signal.copy(gnss_synchro.Signal, 2, 0); gnss_synchro.PRN = 1; + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", "4"); - config->set_property("Acquisition.dump", "false"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); - config->set_property("Acquisition.threshold", "0.0001"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.repeat_satellite", "false"); - config->set_property("Acquisition1.cboc", "true"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", "4"); + if(FLAGS_plot_acq_grid == true) + { + config->set_property("Acquisition_1B.dump", "true"); + } + else + { + config->set_property("Acquisition_1B.dump", "false"); + } + config->set_property("Acquisition_1B.dump_filename", "./tmp-acq-gal1/acquisition.dat"); + config->set_property("Acquisition_1B.threshold", "0.0001"); + config->set_property("Acquisition_1B.doppler_max", std::to_string(doppler_max)); + config->set_property("Acquisition_1B.doppler_step", std::to_string(doppler_step)); + config->set_property("Acquisition_1B.repeat_satellite", "false"); + config->set_property("Acquisition_1B.cboc", "true"); } +void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() +{ + //load the measured values + std::string basename = "./tmp-acq-gal1/acquisition_E_1B"; + unsigned int sat = static_cast(gnss_synchro.PRN); + + unsigned int samples_per_code = static_cast(round(4000000 / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); // !! + acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code); + + if(!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl; + + std::vector * doppler = &acq_dump.doppler; + std::vector * samples = &acq_dump.samples; + std::vector > * mag = &acq_dump.mag; + + const std::string gnuplot_executable(FLAGS_gnuplot_executable); + if(gnuplot_executable.empty()) + { + std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE," << std::endl; + std::cout << "gnuplot has not been found in your system." << std::endl; + std::cout << "Test results will not be plotted." << std::endl; + } + else + { + std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl; + try + { + boost::filesystem::path p(gnuplot_executable); + boost::filesystem::path dir = p.parent_path(); + std::string gnuplot_path = dir.native(); + Gnuplot::set_GNUPlotPath(gnuplot_path); + + Gnuplot g1("lines"); + g1.set_title("Galileo E1b/c signal acquisition for satellite PRN #" + std::to_string(gnss_synchro.PRN)); + g1.set_xlabel("Doppler [Hz]"); + g1.set_ylabel("Sample"); + //g1.cmd("set view 60, 105, 1, 1"); + g1.plot_grid3d(*doppler, *samples, *mag); + + g1.savetops("Galileo_E1_acq_grid"); + g1.savetopdf("Galileo_E1_acq_grid"); + g1.showonscreen(); + } + catch (const GnuplotException & ge) + { + std::cout << ge.what() << std::endl; + } + } + std::string data_str = "./tmp-acq-gal1"; + if (boost::filesystem::exists(data_str)) + { + boost::filesystem::remove_all(data_str); + } +} + + + TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate) { init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); } @@ -169,7 +241,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); gr::msg_queue::sptr queue = gr::msg_queue::make(0); init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make(); @@ -180,14 +252,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -197,37 +269,47 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); + if(FLAGS_plot_acq_grid == true) + { + std::string data_str = "./tmp-acq-gal1"; + if (boost::filesystem::exists(data_str)) + { + boost::filesystem::remove_all(data_str); + } + boost::filesystem::create_directory(data_str); + } + double expected_delay_samples = 2920; //18250; double expected_doppler_hz = -632; init(); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW( { acquisition->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 1e-9)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 1e-9)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", doppler_max)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 250)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", doppler_step)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; ASSERT_NO_THROW( { std::string path = std::string(TEST_PATH); @@ -236,7 +318,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) 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")); - }) << "Failure connecting the blocks of acquisition test." << std::endl; + }) << "Failure connecting the blocks of acquisition test."; acquisition->set_local_code(); acquisition->init(); @@ -248,7 +330,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; @@ -263,5 +345,10 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.175) << "Delay error exceeds the expected value: 0.175 chips"; + + if(FLAGS_plot_acq_grid == true) + { + plot_grid(); + } } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc index e73ee9912..ba4c01e2d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc @@ -242,16 +242,16 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_1() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.if", "0"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition"); - config->set_property("Acquisition.threshold", "0.7"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1B.max_dwells", "1"); + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.threshold", "0.7"); + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "250"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -331,16 +331,15 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_2() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition"); - config->set_property("Acquisition.threshold", "0.00215"); // Pfa,a = 0.1 - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1B.max_dwells", "1"); + config->set_property("Acquisition_1B.threshold", "0.00215"); // Pfa,a = 0.1 + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "250"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -425,7 +424,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::stop_queue() TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); } @@ -440,7 +439,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); @@ -451,14 +450,14 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block."<< std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -469,33 +468,33 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max."<< std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step."<< std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.00001)); - }) << "Failure setting threshold."<< std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00001)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block."<< std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); acquisition->reset(); @@ -508,7 +507,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) 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."; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -532,7 +531,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); @@ -552,12 +551,12 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) #ifdef OLD_BOOST ASSERT_NO_THROW( { ch_thread.timed_join(boost::posix_time::seconds(1)); - }) << "Failure while waiting the queue to stop" << std::endl; + }) << "Failure while waiting the queue to stop"; #endif #ifndef OLD_BOOST ASSERT_NO_THROW( { ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); - }) << "Failure while waiting the queue to stop" << std::endl; + }) << "Failure while waiting the queue to stop"; #endif } } @@ -568,33 +567,33 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili config_2(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max."<< std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step."<< std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.00215)); - }) << "Failure setting threshold."<< std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00215)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block."<< std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); acquisition->reset(); @@ -607,7 +606,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili 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::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; @@ -635,7 +634,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block."<< std::endl; + }) << "Failure running the top_block."; stop_queue(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index 5e9b4d92d..b6cb14a8a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -260,18 +260,17 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_1() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.bit_transition_flag","false"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition"); - config->set_property("Acquisition.threshold", "1"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.folding_factor", "2"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1B.max_dwells", "1"); + config->set_property("Acquisition_1B.bit_transition_flag","false"); + config->set_property("Acquisition_1B.threshold", "1"); + config->set_property("Acquisition_1Bdoppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "250"); + config->set_property("Acquisition_1B.folding_factor", "2"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -355,18 +354,17 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_2() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.bit_transition_flag","false"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition"); - config->set_property("Acquisition.threshold", std::to_string(FLAGS_e1_value_threshold)); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "125"); - config->set_property("Acquisition.folding_factor", "2"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1B.max_dwells", "1"); + config->set_property("Acquisition_1B.bit_transition_flag","false"); + config->set_property("Acquisition_1B.threshold", std::to_string(FLAGS_e1_value_threshold)); + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "125"); + config->set_property("Acquisition_1B.folding_factor", "2"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -446,18 +444,17 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_3() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.bit_transition_flag","false"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition"); - config->set_property("Acquisition.threshold", "0.2"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "125"); - config->set_property("Acquisition.folding_factor", "4"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1B.max_dwells", "1"); + config->set_property("Acquisition_1B.bit_transition_flag","false"); + config->set_property("Acquisition_1B.threshold", "0.2"); + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "125"); + config->set_property("Acquisition_1B.folding_factor", "4"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -551,7 +548,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::stop_queue() TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); } @@ -567,7 +564,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun) config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); @@ -580,14 +577,14 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { begin = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - begin; - }) << "Failure running the top_block."<< std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; LOG(INFO) << "----end connect and run test-----"; @@ -602,33 +599,33 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(0); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max."<< std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 125)); - }) << "Failure setting doppler_step."<< std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 125)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->set_threshold(1); - }) << "Failure setting threshold."<< std::endl; + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); acquisition->reset(); @@ -641,7 +638,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul 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."; // i = 0 --> satellite in acquisition is visible @@ -666,7 +663,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block."<< std::endl; + }) << "Failure running the top_block."; stop_queue(); @@ -693,33 +690,33 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max."<< std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { acquisition->set_doppler_step(50); - }) << "Failure setting doppler_step."<< std::endl; + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->set_threshold(5); - }) << "Failure setting threshold."<< std::endl; + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); acquisition->reset(); @@ -732,7 +729,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul 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."; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -757,7 +754,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); if (i == 0) @@ -781,33 +778,33 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max."<< std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step."<< std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold."<< std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -819,7 +816,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul 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::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; @@ -846,7 +843,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc index 4c7fd42d6..fa1d5dc60 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc @@ -246,17 +246,16 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_1() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition_Galileo.item_type", "gr_complex"); - config->set_property("Acquisition_Galileo.if", "0"); - config->set_property("Acquisition_Galileo.coherent_integration_time_ms", + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition_Galileo.tong_init_val", "1"); - config->set_property("Acquisition_Galileo.tong_max_val", "8"); - config->set_property("Acquisition_Galileo.implementation", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition"); - config->set_property("Acquisition_Galileo.threshold", "0.3"); - config->set_property("Acquisition_Galileo.doppler_max", "10000"); - config->set_property("Acquisition_Galileo.doppler_step", "250"); - config->set_property("Acquisition_Galileo.dump", "false"); + config->set_property("Acquisition_1B.tong_init_val", "1"); + config->set_property("Acquisition_1B.tong_max_val", "8"); + config->set_property("Acquisition_1B.threshold", "0.3"); + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "250"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -336,17 +335,16 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_2() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition_Galileo.item_type", "gr_complex"); - config->set_property("Acquisition_Galileo.if", "0"); - config->set_property("Acquisition_Galileo.coherent_integration_time_ms", + config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition"); + config->set_property("Acquisition_1B.item_type", "gr_complex"); + config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition_Galileo.tong_init_val", "1"); - config->set_property("Acquisition_Galileo.tong_max_val", "8"); - config->set_property("Acquisition_Galileo.implementation", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition"); - config->set_property("Acquisition_Galileo.threshold", "0.00028"); // Pfa,a = 0.1 - config->set_property("Acquisition_Galileo.doppler_max", "10000"); - config->set_property("Acquisition_Galileo.doppler_step", "250"); - config->set_property("Acquisition_Galileo.dump", "false"); + config->set_property("Acquisition_1B.tong_init_val", "1"); + config->set_property("Acquisition_1B.tong_max_val", "8"); + config->set_property("Acquisition_1B.threshold", "0.00028"); // Pfa,a = 0.1 + config->set_property("Acquisition_1B.doppler_max", "10000"); + config->set_property("Acquisition_1B.doppler_step", "250"); + config->set_property("Acquisition_1B.dump", "false"); } @@ -431,7 +429,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::stop_queue() TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); } @@ -440,11 +438,11 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) { int nsamples = floor(fs_in*integration_time_ms*1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds(0); + std::chrono::duration elapsed_seconds(0.0); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); ASSERT_NO_THROW( { @@ -453,14 +451,14 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, 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); - }) << "Failure connecting the blocks of acquisition test." << std::endl; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -471,33 +469,33 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { acquisition->set_doppler_max(5000); - }) << "Failure setting doppler_max." << std::endl; + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { acquisition->set_doppler_step(100); - }) << "Failure setting doppler_step." << std::endl; + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->set_threshold(0.01); - }) << "Failure setting threshold." << std::endl; + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->reset(); acquisition->init(); @@ -510,7 +508,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) 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."; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -534,7 +532,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); @@ -560,33 +558,33 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro config_2(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.00028)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00028)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -598,7 +596,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro 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::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; @@ -623,7 +621,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index de4508341..86f2f85b3 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -257,15 +257,13 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); + config->set_property("Acquisition_5X.implementation", "Galileo_E5a_Noncoherent_IQ_Acquisition_CAF"); config->set_property("Acquisition_5X.item_type", "gr_complex"); - config->set_property("Acquisition_5X.if", "0"); config->set_property("Acquisition_5X.coherent_integration_time_ms", std::to_string(integration_time_ms)); config->set_property("Acquisition_5X.max_dwells", "1"); config->set_property("Acquisition_5X.CAF_window_hz",std::to_string(CAF_window_hz)); config->set_property("Acquisition_5X.Zero_padding",std::to_string(Zero_padding)); - - config->set_property("Acquisition_5X.implementation", "Galileo_E5a_Noncoherent_IQ_Acquisition_CAF"); config->set_property("Acquisition_5X.pfa","0.003"); // config->set_property("Acquisition_5X.threshold", "0.01"); config->set_property("Acquisition_5X.doppler_max", "10000"); @@ -298,12 +296,11 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_2() config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(fs_in)); + config->set_property("Acquisition_5X.implementation", "Galileo_E5a_PCPS_Acquisition"); config->set_property("Acquisition_5X.item_type", "gr_complex"); - config->set_property("Acquisition_5X.if", "0"); config->set_property("Acquisition_5X.coherent_integration_time_ms", std::to_string(integration_time_ms)); config->set_property("Acquisition_5X.max_dwells", "1"); - config->set_property("Acquisition_5X.implementation", "Galileo_E5a_PCPS_Acquisition"); config->set_property("Acquisition_5X.threshold", "0.1"); config->set_property("Acquisition_5X.doppler_max", "10000"); config->set_property("Acquisition_5X.doppler_step", "250"); @@ -530,7 +527,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::stop_queue() TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, Instantiate) { config_1(); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 1); } @@ -541,7 +538,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) int nsamples = 21000*3; std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 1); 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"); @@ -553,14 +550,14 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block."<< std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -571,32 +568,32 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM) config_1(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 1); boost::shared_ptr msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(0); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { acquisition->set_doppler_max(config->property("Acquisition_5X.doppler_max", 5000)); - }) << "Failure setting doppler_max."<< std::endl; + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { acquisition->set_doppler_step(config->property("Acquisition_5X.doppler_step", 100)); - }) << "Failure setting doppler_step."<< std::endl; + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->set_threshold(config->property("Acquisition_5X.threshold", 0.0001)); - }) << "Failure setting threshold."<< std::endl; + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block."<< std::endl; + }) << "Failure connecting acquisition to the top_block."; // USING THE SIGNAL GENERATOR @@ -609,7 +606,7 @@ 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."; acquisition->reset(); acquisition->init(); @@ -641,7 +638,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block."<< std::endl; + }) << "Failure running the top_block."; stop_queue(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc index a4a6ec153..6243fb8bf 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc @@ -244,17 +244,16 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_1() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition"); + config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Acquisition.threshold", "0.8"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.bit_transition_flag", "false"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1C.max_dwells", "1"); + config->set_property("Acquisition_1C.threshold", "0.8"); + config->set_property("Acquisition_1C.doppler_max", "10000"); + config->set_property("Acquisition_1C.doppler_step", "250"); + config->set_property("Acquisition_1C.bit_transition_flag", "false"); + config->set_property("Acquisition_1C.dump", "false"); } @@ -332,17 +331,16 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_2() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition"); + config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Acquisition.pfa", "0.1"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.bit_transition_flag", "false"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1C.max_dwells", "1"); + config->set_property("Acquisition_1C.pfa", "0.1"); + config->set_property("Acquisition_1C.doppler_max", "10000"); + config->set_property("Acquisition_1C.doppler_step", "250"); + config->set_property("Acquisition_1C.bit_transition_flag", "false"); + config->set_property("Acquisition_1C.dump", "false"); } @@ -439,7 +437,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); config_1(); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1); + acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { @@ -449,14 +447,14 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block."<< std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; @@ -470,33 +468,33 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1); + acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { acquisition->set_doppler_max(10000); - }) << "Failure setting doppler_max."<< std::endl; + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { acquisition->set_doppler_step(500); - }) << "Failure setting doppler_step."<< std::endl; + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->set_threshold(0.5); - }) << "Failure setting threshold."<< std::endl; + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); - }) << "Failure connecting acquisition to the top_block."<< std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -507,7 +505,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) 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); - }) << "Failure connecting the blocks of acquisition test." << std::endl; + }) << "Failure connecting the blocks of acquisition test."; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -530,7 +528,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block."<< std::endl; + }) << "Failure running the top_block."; if (i == 0) { @@ -548,12 +546,12 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) #ifdef OLD_BOOST ASSERT_NO_THROW( { ch_thread.timed_join(boost::posix_time::seconds(1)); - }) << "Failure while waiting the queue to stop" << std::endl; + }) << "Failure while waiting the queue to stop"; #endif #ifndef OLD_BOOST ASSERT_NO_THROW( { ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); - }) << "Failure while waiting the queue to stop" << std::endl; + }) << "Failure while waiting the queue to stop"; #endif } @@ -566,33 +564,33 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) config_2(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1); + acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max."<< std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step."<< std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold."<< std::endl; + acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); - }) << "Failure connecting acquisition to the top_block."<< std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -603,7 +601,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) 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); - }) << "Failure connecting the blocks of acquisition test." << std::endl; + }) << "Failure connecting the blocks of acquisition test." ; std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; @@ -628,7 +626,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block."<< std::endl; + }) << "Failure running the top_block."; if (i == 0) { @@ -643,12 +641,12 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) #ifdef OLD_BOOST ASSERT_NO_THROW( { ch_thread.timed_join(boost::posix_time::seconds(1)); - }) << "Failure while waiting the queue to stop" << std::endl; + }) << "Failure while waiting the queue to stop"; #endif #ifndef OLD_BOOST ASSERT_NO_THROW( { ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); - }) << "Failure while waiting the queue to stop" << std::endl; + }) << "Failure while waiting the queue to stop"; #endif } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc index 76aedce64..41a6dad97 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,9 @@ #include "in_memory_configuration.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" +#include "gnuplot_i.h" +#include "test_flags.h" +#include "acquisition_dump_reader.h" #include "gps_l1_ca_pcps_acquisition.h" @@ -114,18 +118,23 @@ protected: config = std::make_shared(); item_size = sizeof(gr_complex); gnss_synchro = Gnss_Synchro(); + doppler_max = 5000; + doppler_step = 100; } ~GpsL1CaPcpsAcquisitionTest() {} void init(); + void plot_grid(); gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; Gnss_Synchro gnss_synchro; size_t item_size; + unsigned int doppler_max; + unsigned int doppler_step; }; @@ -137,23 +146,86 @@ void GpsL1CaPcpsAcquisitionTest::init() signal.copy(gnss_synchro.Signal, 2, 0); gnss_synchro.PRN = 1; config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", "1"); - config->set_property("Acquisition.dump", "false"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Acquisition.threshold", "0.00001"); - config->set_property("Acquisition.doppler_max", "5000"); - config->set_property("Acquisition.doppler_step", "500"); - config->set_property("Acquisition.repeat_satellite", "false"); - //config->set_property("Acquisition.pfa", "0.0"); + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition"); + config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.coherent_integration_time_ms", "1"); + if(FLAGS_plot_acq_grid == true) + { + config->set_property("Acquisition_1C.dump", "true"); + } + else + { + config->set_property("Acquisition_1C.dump", "false"); + } + config->set_property("Acquisition_1C.dump_filename", "./tmp-acq-gps1/acquisition.dat"); + 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)); + config->set_property("Acquisition_1C.repeat_satellite", "false"); + //config->set_property("Acquisition_1C.pfa", "0.0"); +} + + +void GpsL1CaPcpsAcquisitionTest::plot_grid() +{ + //load the measured values + std::string basename = "./tmp-acq-gps1/acquisition_G_1C"; + unsigned int sat = static_cast(gnss_synchro.PRN); + + unsigned int samples_per_code = static_cast(round(4000000 / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); // !! + acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code); + + if(!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl; + + std::vector *doppler = &acq_dump.doppler; + std::vector *samples = &acq_dump.samples; + std::vector > *mag = &acq_dump.mag; + + const std::string gnuplot_executable(FLAGS_gnuplot_executable); + if(gnuplot_executable.empty()) + { + std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE," << std::endl; + std::cout << "gnuplot has not been found in your system." << std::endl; + std::cout << "Test results will not be plotted." << std::endl; + } + else + { + std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl; + try + { + boost::filesystem::path p(gnuplot_executable); + boost::filesystem::path dir = p.parent_path(); + std::string gnuplot_path = dir.native(); + Gnuplot::set_GNUPlotPath(gnuplot_path); + + Gnuplot g1("lines"); + g1.set_title("GPS L1 C/A signal acquisition for satellite PRN #" + std::to_string(gnss_synchro.PRN)); + g1.set_xlabel("Doppler [Hz]"); + g1.set_ylabel("Sample"); + //g1.cmd("set view 60, 105, 1, 1"); + g1.plot_grid3d(*doppler, *samples, *mag); + + g1.savetops("GPS_L1_acq_grid"); + g1.savetopdf("GPS_L1_acq_grid"); + g1.showonscreen(); + } + catch (const GnuplotException & ge) + { + std::cout << ge.what() << std::endl; + } + } + std::string data_str = "./tmp-acq-gps1"; + if (boost::filesystem::exists(data_str)) + { + boost::filesystem::remove_all(data_str); + } } TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate) { init(); - boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition", 1, 1); + boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1C", 1, 1); } @@ -167,7 +239,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); init(); - boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition", 1, 1); + boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW( { @@ -178,14 +250,14 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -194,7 +266,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds(0); + std::chrono::duration elapsed_seconds(0.0); top_block = gr::make_top_block("Acquisition test"); double expected_delay_samples = 524; @@ -202,32 +274,42 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) init(); - std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + if(FLAGS_plot_acq_grid == true) + { + std::string data_str = "./tmp-acq-gps1"; + if (boost::filesystem::exists(data_str)) + { + boost::filesystem::remove_all(data_str); + } + boost::filesystem::create_directory(data_str); + } + + std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { acquisition->set_threshold(0.001); - }) << "Failure setting threshold." << std::endl; + }) << "Failure setting threshold."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(5000); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(doppler_max); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(100); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(doppler_step); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; ASSERT_NO_THROW( { std::string path = std::string(TEST_PATH); @@ -236,7 +318,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) 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")); - }) << "Failure connecting the blocks of acquisition test." << std::endl; + }) << "Failure connecting the blocks of acquisition test."; acquisition->set_local_code(); acquisition->set_state(1); // Ensure that acquisition starts at the first sample @@ -247,7 +329,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; @@ -259,4 +341,9 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips"; + + if(FLAGS_plot_acq_grid == true) + { + plot_grid(); + } } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc index ecf841a7c..985e7d16e 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc @@ -259,19 +259,17 @@ void GpsL1CaPcpsAcquisitionTestFpga::init() signal.copy(gnss_synchro.Signal, 2, 0); gnss_synchro.PRN = 1; config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); - config->set_property("Acquisition.item_type", "cshort"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", "1"); - config->set_property("Acquisition.dump", "false"); - config->set_property("Acquisition.implementation", - "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Acquisition.threshold", "0.001"); - config->set_property("Acquisition.doppler_max", "5000"); - config->set_property("Acquisition.doppler_step", "500"); - config->set_property("Acquisition.repeat_satellite", "false"); - config->set_property("Acquisition.pfa", "0.0"); - config->set_property("Acquisition.select_queue_Fpga", "0"); - config->set_property("Acquisition.devicename", "/dev/uio0"); + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition"); + config->set_property("Acquisition_1C.item_type", "cshort"); + config->set_property("Acquisition_1C.coherent_integration_time_ms", "1"); + config->set_property("Acquisition_1C.dump", "false"); + config->set_property("Acquisition_1C.threshold", "0.001"); + config->set_property("Acquisition_1C.doppler_max", "5000"); + config->set_property("Acquisition_1C.doppler_step", "500"); + config->set_property("Acquisition_1C.repeat_satellite", "false"); + config->set_property("Acquisition_1C.pfa", "0.0"); + config->set_property("Acquisition_1C.select_queue_Fpga", "0"); + config->set_property("Acquisition_1C.devicename", "/dev/uio0"); } @@ -279,7 +277,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, Instantiate) { init(); boost::shared_ptr acquisition = - boost::make_shared(config.get(), "Acquisition", 0, 1); + boost::make_shared(config.get(), "Acquisition_1C", 0, 1); } @@ -294,39 +292,39 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults) init(); std::shared_ptr < GpsL1CaPcpsAcquisitionFpga > acquisition = - std::make_shared < GpsL1CaPcpsAcquisitionFpga > (config.get(), "Acquisition", 0, 1); + std::make_shared < GpsL1CaPcpsAcquisitionFpga > (config.get(), "Acquisition_1C", 0, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionTestFpga_msg_rx_make(); ASSERT_NO_THROW( { acquisition->set_channel(1); - })<< "Failure setting channel." << std::endl; + })<< "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - })<< "Failure setting gnss_synchro." << std::endl; + })<< "Failure setting gnss_synchro."; ASSERT_NO_THROW( { acquisition->set_threshold(0.1); - })<< "Failure setting threshold." << std::endl; + })<< "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->set_doppler_max(10000); - })<< "Failure setting doppler_max." << std::endl; + })<< "Failure setting doppler_max."; ASSERT_NO_THROW( { acquisition->set_doppler_step(250); - })<< "Failure setting doppler_step." << std::endl; + })<< "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->connect(top_block); - })<< "Failure connecting acquisition to the top_block." << std::endl; + })<< "Failure connecting acquisition to the top_block."; // uncomment the next line to load the file from the current directory std::string file = "./GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat"; @@ -349,7 +347,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults) top_block->connect(file_source, 0, throttle_block, 0); top_block->connect(throttle_block, 0, null_sink, 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." ; acquisition->set_state(1); // Ensure that acquisition starts at the first state acquisition->init(); @@ -366,7 +364,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults) top_block->wait(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - })<< "Failure running the top_block." << std::endl; + })<< "Failure running the top_block."; t3.join(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc index adb069ca7..1d070e69d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc @@ -240,17 +240,16 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_1() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_OpenCl_Acquisition"); + config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_OpenCl_Acquisition"); - config->set_property("Acquisition.threshold", "0.8"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.bit_transition_flag", "false"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1C.max_dwells", "1"); + config->set_property("Acquisition_1C.threshold", "0.8"); + config->set_property("Acquisition_1C.doppler_max", "10000"); + config->set_property("Acquisition_1C.doppler_step", "250"); + config->set_property("Acquisition_1C.bit_transition_flag", "false"); + config->set_property("Acquisition_1C.dump", "false"); } @@ -328,17 +327,16 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_2() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_OpenCl_Acquisition"); + config->set_property("Acquisition_1C.item_type", "gr_complex"); config->set_property("Acquisition.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_OpenCl_Acquisition"); - config->set_property("Acquisition.pfa", "0.1"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.bit_transition_flag", "false"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1C.max_dwells", "1"); + config->set_property("Acquisition_1C.pfa", "0.1"); + config->set_property("Acquisition_1C.doppler_max", "10000"); + config->set_property("Acquisition_1C.doppler_step", "250"); + config->set_property("Acquisition_1C.bit_transition_flag", "false"); + config->set_property("Acquisition_1C.dump", "false"); } @@ -423,7 +421,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::stop_queue() TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, Instantiate) { config_1(); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); } @@ -434,7 +432,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun) std::chrono::duration elapsed_seconds(0); config_1(); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { @@ -444,14 +442,14 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -466,27 +464,27 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults) ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -498,7 +496,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults) 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."; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -521,7 +519,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; if (i == 0) { @@ -544,32 +542,32 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie { config_2(); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -581,7 +579,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie 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::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; @@ -606,7 +604,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; if (i == 0) { diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc index bdbeffa10..02d44029a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc @@ -255,17 +255,16 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_1() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition"); + config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition"); - config->set_property("Acquisition.threshold", "250"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.bit_transition_flag", "false"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1C.max_dwells", "1"); + config->set_property("Acquisition_1C.threshold", "250"); + config->set_property("Acquisition_1C.doppler_max", "10000"); + config->set_property("Acquisition_1C.doppler_step", "250"); + config->set_property("Acquisition_1C.bit_transition_flag", "false"); + config->set_property("Acquisition_1C.dump", "false"); } @@ -347,17 +346,16 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_2() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition"); + config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "1"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition"); - config->set_property("Acquisition.threshold", std::to_string(FLAGS_value_threshold)); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "100"); - config->set_property("Acquisition.bit_transition_flag", "false"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1C.max_dwells", "1"); + config->set_property("Acquisition_1C.threshold", std::to_string(FLAGS_value_threshold)); + config->set_property("Acquisition_1C.doppler_max", "10000"); + config->set_property("Acquisition_1C.doppler_step", "100"); + config->set_property("Acquisition_1C.bit_transition_flag", "false"); + config->set_property("Acquisition_1C.dump", "false"); } @@ -439,17 +437,16 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_3() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition"); + config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.max_dwells", "2"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition"); - config->set_property("Acquisition.threshold", "0.01"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.bit_transition_flag", "false"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1C.max_dwells", "2"); + config->set_property("Acquisition_1C.threshold", "0.01"); + config->set_property("Acquisition_1C.doppler_max", "10000"); + config->set_property("Acquisition_1C.doppler_step", "250"); + config->set_property("Acquisition_1C.bit_transition_flag", "false"); + config->set_property("Acquisition_1C.dump", "false"); } @@ -537,7 +534,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::stop_queue() TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, Instantiate) { config_1(); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); } @@ -545,13 +542,13 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun) { int nsamples = floor(fs_in * integration_time_ms * 1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds(0); + std::chrono::duration elapsed_seconds(0.0); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); config_1(); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); ASSERT_NO_THROW( { acquisition->connect(top_block); @@ -560,14 +557,14 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block."<< std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -578,32 +575,32 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { acquisition->set_doppler_max(10000); - }) << "Failure setting doppler_max."<< std::endl; + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { acquisition->set_doppler_step(250); - }) << "Failure setting doppler_step."<< std::endl; + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->set_threshold(100); - }) << "Failure setting threshold."<< std::endl; + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block."<< std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); acquisition->reset(); @@ -616,7 +613,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults) 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."; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -642,7 +639,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); @@ -672,32 +669,32 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise config_1(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { acquisition->set_doppler_max(10000); - }) << "Failure setting doppler_max."<< std::endl; + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { acquisition->set_doppler_step(250); - }) << "Failure setting doppler_step."<< std::endl; + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->set_threshold(100); - }) << "Failure setting threshold." << std::endl; + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); acquisition->reset(); @@ -710,7 +707,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise 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."; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -736,7 +733,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); @@ -764,32 +761,20 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili config_2(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel."<< std::endl; + }) << "Failure setting channel."; 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; */ + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block."<< std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); acquisition->reset(); @@ -802,7 +787,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili 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::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; @@ -829,7 +814,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc index b4275a582..cfff6ff70 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc @@ -240,17 +240,16 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_1() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); + config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); - config->set_property("Acquisition.threshold", "0.8"); - config->set_property("Acquisition.tong_init_val", "1"); - config->set_property("Acquisition.tong_max_val", "8"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1C.threshold", "0.8"); + config->set_property("Acquisition_1C.tong_init_val", "1"); + config->set_property("Acquisition_1C.tong_max_val", "8"); + config->set_property("Acquisition_1C.doppler_max", "10000"); + config->set_property("Acquisition_1C.doppler_step", "250"); + config->set_property("Acquisition_1C.dump", "false"); } @@ -328,17 +327,16 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_2() config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.coherent_integration_time_ms", + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); + config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); - config->set_property("Acquisition.threshold", "0.00108"); // Pfa,a = 0.1 - config->set_property("Acquisition.tong_init_val", "1"); - config->set_property("Acquisition.tong_max_val", "8"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "250"); - config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition_1C.threshold", "0.00108"); // Pfa,a = 0.1 + config->set_property("Acquisition_1C.tong_init_val", "1"); + config->set_property("Acquisition_1C.tong_max_val", "8"); + config->set_property("Acquisition_1C.doppler_max", "10000"); + config->set_property("Acquisition_1C.doppler_step", "250"); + config->set_property("Acquisition_1C.dump", "false"); } @@ -422,7 +420,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::stop_queue() TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, Instantiate) { config_1(); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); } @@ -435,7 +433,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun) queue = gr::msg_queue::make(0); config_1(); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { @@ -445,14 +443,14 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun) 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; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -464,32 +462,32 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -501,7 +499,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) 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."; // i = 0 --> satellite in acquisition is visible // i = 1 --> satellite in acquisition is not visible @@ -525,7 +523,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); @@ -552,32 +550,32 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) config_2(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000)); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500)); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold." << std::endl; + acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0)); + }) << "Failure setting threshold."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); @@ -589,7 +587,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) 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::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; @@ -614,7 +612,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) EXPECT_NO_THROW( { top_block->run(); // Start threads and wait - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; stop_queue(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc index 69b36f01c..04480d7c8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -49,6 +50,9 @@ #include "in_memory_configuration.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" +#include "gnuplot_i.h" +#include "test_flags.h" +#include "acquisition_dump_reader.h" #include "gps_l2_m_pcps_acquisition.h" #include "GPS_L2C.h" @@ -70,7 +74,6 @@ private: public: int rx_message; ~GpsL2MPcpsAcquisitionTest_msg_rx(); //!< Default destructor - }; GpsL2MPcpsAcquisitionTest_msg_rx_sptr GpsL2MPcpsAcquisitionTest_msg_rx_make() @@ -114,8 +117,10 @@ protected: factory = std::make_shared(); config = std::make_shared(); item_size = sizeof(gr_complex); - sampling_freqeuncy_hz = 0; + sampling_frequency_hz = 5000000; nsamples = 0; + doppler_max = 3000; + doppler_step = 125; gnss_synchro = Gnss_Synchro(); } @@ -123,6 +128,7 @@ protected: {} void init(); + void plot_grid(); gr::msg_queue::sptr queue; gr::top_block_sptr top_block; @@ -130,8 +136,10 @@ protected: std::shared_ptr config; Gnss_Synchro gnss_synchro; size_t item_size; - int sampling_freqeuncy_hz; + int sampling_frequency_hz; int nsamples; + unsigned int doppler_max; + unsigned int doppler_step; }; @@ -140,22 +148,83 @@ void GpsL2MPcpsAcquisitionTest::init() gnss_synchro.Channel_ID = 0; gnss_synchro.System = 'G'; std::string signal = "2S"; - //strncpy(gnss_synchro.Signal, signal.c_str(), 3); std::memcpy(static_cast(gnss_synchro.Signal), signal.c_str(), 3); // copy string into synchro char array: 2 char + null gnss_synchro.Signal[2] = 0; // make sure that string length is only two characters gnss_synchro.PRN = 7; - sampling_freqeuncy_hz = 5000000; - nsamples = round(static_cast(sampling_freqeuncy_hz) * GPS_L2_M_PERIOD) * 2; - config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_freqeuncy_hz)); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.dump", "false"); - config->set_property("Acquisition.implementation", "GPS_L2_M_PCPS_Acquisition"); - config->set_property("Acquisition.threshold", "0.001"); - config->set_property("Acquisition.doppler_max", "5000"); - config->set_property("Acquisition.doppler_step", "100"); - config->set_property("Acquisition.repeat_satellite", "false"); + nsamples = round(static_cast(sampling_frequency_hz) * GPS_L2_M_PERIOD) * 2; + config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_frequency_hz)); + config->set_property("Acquisition_2S.implementation", "GPS_L2_M_PCPS_Acquisition"); + config->set_property("Acquisition_2S.item_type", "gr_complex"); + if(FLAGS_plot_acq_grid == true) + { + config->set_property("Acquisition_2S.dump", "true"); + } + else + { + config->set_property("Acquisition_2S.dump", "false"); + } + config->set_property("Acquisition_2S.dump_filename", "./tmp-acq-gps2/acquisition.dat"); + 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)); + config->set_property("Acquisition_2S.repeat_satellite", "false"); +} + + +void GpsL2MPcpsAcquisitionTest::plot_grid() +{ + //load the measured values + std::string basename = "./tmp-acq-gps2/acquisition_G_2S"; + unsigned int sat = static_cast(gnss_synchro.PRN); + + unsigned int samples_per_code = static_cast(floor(sampling_frequency_hz / (GPS_L2_M_CODE_RATE_HZ / GPS_L2_M_CODE_LENGTH_CHIPS)) - 1000); // !! + acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code); + + if(!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl; + + std::vector *doppler = &acq_dump.doppler; + std::vector *samples = &acq_dump.samples; + std::vector > *mag = &acq_dump.mag; + + const std::string gnuplot_executable(FLAGS_gnuplot_executable); + if(gnuplot_executable.empty()) + { + std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE," << std::endl; + std::cout << "gnuplot has not been found in your system." << std::endl; + std::cout << "Test results will not be plotted." << std::endl; + } + else + { + std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl; + try + { + boost::filesystem::path p(gnuplot_executable); + boost::filesystem::path dir = p.parent_path(); + std::string gnuplot_path = dir.native(); + Gnuplot::set_GNUPlotPath(gnuplot_path); + + Gnuplot g1("lines"); + g1.set_title("GPS L2CM signal acquisition for satellite PRN #" + std::to_string(gnss_synchro.PRN)); + g1.set_xlabel("Doppler [Hz]"); + g1.set_ylabel("Sample"); + //g1.cmd("set view 60, 105, 1, 1"); + g1.plot_grid3d(*doppler, *samples, *mag); + + g1.savetops("GPS_L2CM_acq_grid"); + g1.savetopdf("GPS_L2CM_acq_grid"); + g1.showonscreen(); + } + catch (const GnuplotException & ge) + { + std::cout << ge.what() << std::endl; + } + } + std::string data_str = "./tmp-acq-gps2"; + if (boost::filesystem::exists(data_str)) + { + boost::filesystem::remove_all(data_str); + } } @@ -163,7 +232,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, Instantiate) { init(); queue = gr::msg_queue::make(0); - std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 1); } @@ -175,24 +244,23 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun) queue = gr::msg_queue::make(0); init(); - std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 1); ASSERT_NO_THROW( { acquisition->connect(top_block); - boost::shared_ptr source = gr::analog::sig_source_c::make(sampling_freqeuncy_hz, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); + boost::shared_ptr source = gr::analog::sig_source_c::make(sampling_frequency_hz, gr::analog::GR_SIN_WAVE, 2000, 1, gr_complex(0)); 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); boost::shared_ptr msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make(); - - }) << "Failure connecting the blocks of acquisition test." << std::endl; + }) << "Failure connecting the blocks of acquisition test."; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -206,33 +274,44 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) queue = gr::msg_queue::make(0); double expected_delay_samples = 1;//2004; double expected_doppler_hz = 1200;//3000; + + if(FLAGS_plot_acq_grid == true) + { + std::string data_str = "./tmp-acq-gps2"; + if (boost::filesystem::exists(data_str)) + { + boost::filesystem::remove_all(data_str); + } + boost::filesystem::create_directory(data_str); + } + init(); - std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 1); boost::shared_ptr msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW( { acquisition->set_channel(1); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { acquisition->set_threshold(0.001); - }) << "Failure setting threshold." << std::endl; + }) << "Failure setting threshold."; ASSERT_NO_THROW( { - acquisition->set_doppler_max(5000); - }) << "Failure setting doppler_max." << std::endl; + acquisition->set_doppler_max(doppler_max); + }) << "Failure setting doppler_max."; ASSERT_NO_THROW( { - acquisition->set_doppler_step(10); - }) << "Failure setting doppler_step." << std::endl; + acquisition->set_doppler_step(doppler_step); + }) << "Failure setting doppler_step."; ASSERT_NO_THROW( { acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block." << std::endl; + }) << "Failure connecting acquisition to the top_block."; ASSERT_NO_THROW( { std::string path = std::string(TEST_PATH); @@ -249,22 +328,21 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) top_block->connect(file_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; + }) << "Failure connecting the blocks of acquisition test."; ASSERT_NO_THROW( { acquisition->set_local_code(); acquisition->set_state(1); // Ensure that acquisition starts at the first sample acquisition->init(); - }) << "Failure set_state and init acquisition test" << std::endl; + }) << "Failure set_state and init acquisition test"; EXPECT_NO_THROW( { start = std::chrono::system_clock::now(); top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; - //unsigned long int Acq_samplestamp_samples = gnss_synchro.Acq_samplestamp_samples; std::cout << "Acquisition process runtime duration: " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; std::cout << "gnss_synchro.Acq_doppler_hz = " << gnss_synchro.Acq_doppler_hz << " Hz" << std::endl; @@ -276,6 +354,11 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) float delay_error_chips = static_cast(delay_error_samples * 1023 / 4000); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); - EXPECT_LE(doppler_error_hz, 200) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; + EXPECT_LE(doppler_error_hz, 200) << "Doppler error exceeds the expected value: 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips"; + + if(FLAGS_plot_acq_grid == true) + { + plot_grid(); + } } diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt index 0ee8ec658..14c2f5bd2 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt +++ b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt @@ -18,6 +18,7 @@ set(SIGNAL_PROCESSING_TESTING_LIB_SOURCES + acquisition_dump_reader.cc tracking_dump_reader.cc tlm_dump_reader.cc observables_dump_reader.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc new file mode 100644 index 000000000..8e16812df --- /dev/null +++ b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc @@ -0,0 +1,106 @@ +/*! + * \file acquisition_dump_reader.cc + * \brief Helper file for unit testing + * \author Carles Fernandez-Prades, 2017. cfernandez(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#include +#include "acquisition_dump_reader.h" + +bool acquisition_dump_reader::read_binary_acq() +{ + std::complex* aux = new std::complex[1]; + for(unsigned int i = 0; i < d_num_doppler_bins; i++) + { + try + { + std::ifstream ifs; + ifs.exceptions( std::ifstream::failbit | std::ifstream::badbit ); + ifs.open(d_dump_filenames.at(i).c_str(), std::ios::in | std::ios::binary); + d_dump_files.at(i).swap(ifs); + if (d_dump_files.at(i).is_open()) + { + for(unsigned int k = 0; k < d_samples_per_code; k++) + { + d_dump_files.at(i).read(reinterpret_cast(&aux[0]), sizeof(std::complex)); + mag.at(i).at(k) = std::abs(*aux) / std::pow(d_samples_per_code, 2); + } + } + else + { + std::cout << "File " << d_dump_filenames.at(i).c_str() << " not found." << std::endl; + delete[] aux; + return false; + } + d_dump_files.at(i).close(); + } + catch (const std::ifstream::failure &e) + { + std::cout << e.what() << std::endl; + delete[] aux; + return false; + } + } + delete[] aux; + return true; +} + + +acquisition_dump_reader::acquisition_dump_reader(const std::string & basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code) +{ + d_basename = basename; + d_sat = sat; + d_doppler_max = doppler_max; + d_doppler_step = doppler_step; + d_samples_per_code = samples_per_code; + d_num_doppler_bins = static_cast(ceil( static_cast(static_cast(d_doppler_max) - static_cast(-d_doppler_max)) / static_cast(d_doppler_step))); + std::vector > mag_aux(d_num_doppler_bins, std::vector(d_samples_per_code)); + mag = mag_aux; + for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) + { + doppler.push_back(-static_cast(d_doppler_max) + d_doppler_step * doppler_index); + d_dump_filenames.push_back(d_basename + "_sat_" + std::to_string(d_sat) + "_doppler_" + std::to_string(doppler.at(doppler_index)) + ".dat"); + std::ifstream ifs; + d_dump_files.push_back(std::move(ifs)); + } + for (unsigned int k = 0; k < d_samples_per_code; k++) + { + samples.push_back(k); + } +} + + +acquisition_dump_reader::~acquisition_dump_reader() +{ + for(unsigned int i = 0; i < d_num_doppler_bins; i++) + { + if (d_dump_files.at(i).is_open() == true) + { + d_dump_files.at(i).close(); + } + } +} diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h new file mode 100644 index 000000000..02c75ea66 --- /dev/null +++ b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h @@ -0,0 +1,61 @@ +/*! + * \file acquisition_dump_reader.h + * \brief Helper file for unit testing + * \author Carles Fernandez-Prades, 2017. cfernandez(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_ACQUISITION_DUMP_READER_H +#define GNSS_SDR_ACQUISITION_DUMP_READER_H + +#include +#include +#include +#include + +class acquisition_dump_reader +{ +public: + acquisition_dump_reader(const std::string & basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code); + ~acquisition_dump_reader(); + bool read_binary_acq(); + + std::vector doppler; + std::vector samples; + std::vector > mag; + +private: + std::string d_basename; + unsigned int d_sat; + unsigned int d_doppler_max; + unsigned int d_doppler_step; + unsigned int d_samples_per_code; + unsigned int d_num_doppler_bins; + std::vector d_dump_filenames; + std::vector d_dump_files; +}; + +#endif // GNSS_SDR_ACQUISITION_DUMP_READER_H diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc index 648938146..47832b888 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc @@ -34,16 +34,16 @@ bool observables_dump_reader::read_binary_obs() { try { - for(int i = 0; i < n_channels; i++) - { - d_dump_file.read(reinterpret_cast(&RX_time[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&TOW_at_current_symbol_s[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&Carrier_Doppler_hz[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&Acc_carrier_phase_hz[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&Pseudorange_m[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&PRN[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&valid[i]), sizeof(double)); - } + for(int i = 0; i < n_channels; i++) + { + d_dump_file.read(reinterpret_cast(&RX_time[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&TOW_at_current_symbol_s[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&Carrier_Doppler_hz[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&Acc_carrier_phase_hz[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&Pseudorange_m[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&PRN[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&valid[i]), sizeof(double)); + } } catch (const std::ifstream::failure &e) { diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc index 368b1ee27..1ff2c67e3 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc @@ -32,7 +32,8 @@ bool tracking_dump_reader::read_binary_obs() { - try { + try + { d_dump_file.read(reinterpret_cast(&abs_E), sizeof(float)); d_dump_file.read(reinterpret_cast(&abs_P), sizeof(float)); d_dump_file.read(reinterpret_cast(&abs_L), sizeof(float)); diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc index 2a6d7830a..8b4bcb07b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc @@ -34,16 +34,16 @@ bool true_observables_reader::read_binary_obs() { try { - for(int i = 0; i < 12; i++) - { - d_dump_file.read(reinterpret_cast(&gps_time_sec[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&doppler_l1_hz), sizeof(double)); - d_dump_file.read(reinterpret_cast(&acc_carrier_phase_l1_cycles[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&dist_m[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&true_dist_m[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&carrier_phase_l1_cycles[i]), sizeof(double)); - d_dump_file.read(reinterpret_cast(&prn[i]), sizeof(double)); - } + for(int i = 0; i < 12; i++) + { + d_dump_file.read(reinterpret_cast(&gps_time_sec[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&doppler_l1_hz), sizeof(double)); + d_dump_file.read(reinterpret_cast(&acc_carrier_phase_l1_cycles[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&dist_m[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&true_dist_m[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&carrier_phase_l1_cycles[i]), sizeof(double)); + d_dump_file.read(reinterpret_cast(&prn[i]), sizeof(double)); + } } catch (const std::ifstream::failure &e) { diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index 546bf600a..d9b02fdbb 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -379,9 +379,9 @@ void HybridObservablesTest::check_results_carrier_phase( ASSERT_LT(error_var_ch1, 1e-2); ASSERT_LT(max_error_ch1, 5e-2); ASSERT_GT(min_error_ch1, -5e-2); - } + void HybridObservablesTest::check_results_code_psudorange( arma::vec & true_ch0_dist_m, arma::vec & true_ch1_dist_m, @@ -401,8 +401,6 @@ void HybridObservablesTest::check_results_code_psudorange( arma::vec delta_true_dist_m = true_ch0_dist_interp-true_ch1_dist_interp; arma::vec delta_measured_dist_m = measuded_ch0_Pseudorange_m-measuded_ch1_Pseudorange_m; - - //2. RMSE arma::vec err; @@ -467,7 +465,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { throw std::exception(); }; - }) << "Failure opening true observables file" << std::endl; + }) << "Failure opening true observables file"; true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN2)); @@ -477,7 +475,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { throw std::exception(); }; - }) << "Failure opening true observables file" << std::endl; + }) << "Failure opening true observables file"; top_block = gr::make_top_block("Telemetry_Decoder test"); std::shared_ptr tracking_ch0 = std::make_shared(config.get(), "Tracking_1C", 1, 1); @@ -494,14 +492,14 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { throw std::exception(); }; - })<< "Failure reading true observables file" << std::endl; + }) << "Failure reading true observables file"; ASSERT_NO_THROW({ if (true_obs_data_ch1.read_binary_obs() == false) { throw std::exception(); }; - }) << "Failure reading true observables file" << std::endl; + }) << "Failure reading true observables file"; //restart the epoch counter true_obs_data_ch0.restart(); @@ -529,7 +527,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) tlm_ch0->set_satellite(Gnss_Satellite(std::string("GPS"),gnss_synchro_ch0.PRN)); tlm_ch1->set_satellite(Gnss_Satellite(std::string("GPS"),gnss_synchro_ch1.PRN)); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; boost::shared_ptr tlm_msg_rx_ch1 = HybridObservablesTest_tlm_msg_rx_make(); boost::shared_ptr tlm_msg_rx_ch2 = HybridObservablesTest_tlm_msg_rx_make(); @@ -540,17 +538,17 @@ TEST_F(HybridObservablesTest, ValidationOfResults) ASSERT_NO_THROW( { tracking_ch0->set_channel(gnss_synchro_ch0.Channel_ID); tracking_ch1->set_channel(gnss_synchro_ch1.Channel_ID); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { tracking_ch0->set_gnss_synchro(&gnss_synchro_ch0); tracking_ch1->set_gnss_synchro(&gnss_synchro_ch1); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { tracking_ch0->connect(top_block); tracking_ch1->connect(top_block); - }) << "Failure connecting tracking to the top_block." << std::endl; + }) << "Failure connecting tracking to the top_block."; ASSERT_NO_THROW( { std::string file = "./" + filename_raw_data; @@ -574,7 +572,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) top_block->connect(observables->get_right_block(), 0, sink_ch0, 0); top_block->connect(observables->get_right_block(), 1, sink_ch1, 0); - }) << "Failure connecting the blocks." << std::endl; + }) << "Failure connecting the blocks."; tracking_ch0->start_tracking(); tracking_ch1->start_tracking(); @@ -584,7 +582,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; //check results //load the true values @@ -596,7 +594,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { throw std::exception(); }; - }) << "Failure opening true observables file" << std::endl; + }) << "Failure opening true observables file"; long int nepoch = true_observables.num_epochs(); @@ -637,7 +635,6 @@ TEST_F(HybridObservablesTest, ValidationOfResults) epoch_counter++; } - }); //read measured values @@ -647,7 +644,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { throw std::exception(); }; - }) << "Failure opening dump observables file" << std::endl; + }) << "Failure opening dump observables file"; nepoch = estimated_observables.num_epochs(); std::cout << "Measured observation epochs=" << nepoch << std::endl; diff --git a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc index c75139ff6..5799a7beb 100644 --- a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc @@ -170,7 +170,6 @@ GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::~GpsL1CADllPllTelemetryDecoderTest class GpsL1CATelemetryDecoderTest: public ::testing::Test { - public: std::string generator_binary; std::string p1; @@ -357,7 +356,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) { throw std::exception(); }; - }) << "Failure opening true observables file" << std::endl; + }) << "Failure opening true observables file"; top_block = gr::make_top_block("Telemetry_Decoder test"); std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_1C", 1, 1); @@ -371,7 +370,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) { throw std::exception(); }; - })<< "Failure reading true observables file" << std::endl; + }) << "Failure reading true observables file"; //restart the epoch counter true_obs_data.restart(); @@ -388,15 +387,15 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) ASSERT_NO_THROW( { tracking->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { tracking->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { tracking->connect(top_block); - }) << "Failure connecting tracking to the top_block." << std::endl; + }) << "Failure connecting tracking to the top_block."; ASSERT_NO_THROW( { std::string file = "./" + filename_raw_data; @@ -409,7 +408,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) top_block->connect(tracking->get_right_block(), 0, tlm->get_left_block(), 0); top_block->connect(tlm->get_right_block(), 0, sink, 0); top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); - }) << "Failure connecting the blocks." << std::endl; + }) << "Failure connecting the blocks."; tracking->start_tracking(); @@ -418,7 +417,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; //check results //load the true values @@ -449,7 +448,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) { throw std::exception(); }; - }) << "Failure opening telemetry dump file" << std::endl; + }) << "Failure opening telemetry dump file"; nepoch = tlm_dump.num_epochs(); std::cout << "Measured observation epochs=" << nepoch << std::endl; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc index 4de9eb7ed..ea9740b90 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc @@ -87,21 +87,21 @@ void GalileoE1DllPllVemlTrackingInternalTest::init() gnss_synchro.PRN = 11; config->set_property("GNSS-SDR.internal_fs_sps", "8000000"); - config->set_property("Tracking_Galileo.item_type", "gr_complex"); - 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"); - config->set_property("Tracking_Galileo.very_early_late_space_chips", "0.6"); - config->set_property("Tracking_Galileo.pll_bw_hz", "30.0"); - config->set_property("Tracking_Galileo.dll_bw_hz", "2.0"); + config->set_property("Tracking_1B.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking"); + config->set_property("Tracking_1B.item_type", "gr_complex"); + config->set_property("Tracking_1B.dump", "false"); + config->set_property("Tracking_1B.dump_filename", "../data/veml_tracking_ch_"); + config->set_property("Tracking_1B.early_late_space_chips", "0.15"); + config->set_property("Tracking_1B.very_early_late_space_chips", "0.6"); + config->set_property("Tracking_1B.pll_bw_hz", "30.0"); + config->set_property("Tracking_1B.dll_bw_hz", "2.0"); } TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate) { init(); - auto tracking = factory->GetBlock(config, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); + auto tracking = factory->GetBlock(config, "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str()); } @@ -117,16 +117,16 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) top_block = gr::make_top_block("Tracking test"); // Example using smart pointers and the block factory - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); ASSERT_NO_THROW( { tracking->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { tracking->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { tracking->connect(top_block); @@ -136,8 +136,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, tracking->get_left_block(), 0); top_block->connect(tracking->get_right_block(), 0, sink, 0); - - }) << "Failure connecting the blocks of tracking test." << std::endl; + }) << "Failure connecting the blocks of tracking test."; tracking->start_tracking(); @@ -146,7 +145,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) top_block->run(); //Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -165,7 +164,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults) top_block = gr::make_top_block("Tracking test"); // Example using smart pointers and the block factory - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); // gnss_synchro.Acq_delay_samples = 1753; // 4 Msps @@ -176,15 +175,15 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults) ASSERT_NO_THROW( { tracking->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { tracking->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { tracking->connect(top_block); - }) << "Failure connecting tracking to the top_block." << std::endl; + }) << "Failure connecting tracking to the top_block."; ASSERT_NO_THROW( { std::string path = std::string(TEST_PATH); @@ -198,7 +197,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults) top_block->connect(skip_head, 0, valve, 0); top_block->connect(valve, 0, tracking->get_left_block(), 0); top_block->connect(tracking->get_right_block(), 0, sink, 0); - }) << "Failure connecting the blocks of tracking test." << std::endl; + }) << "Failure connecting the blocks of tracking test."; tracking->start_tracking(); @@ -207,7 +206,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults) top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Tracked " << num_samples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc index 974f4193e..5aed31f4a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc @@ -81,22 +81,22 @@ void GalileoE5aTrackingTest::init() { gnss_synchro.Channel_ID = 0; gnss_synchro.System = 'E'; - std::string signal = "5Q"; + std::string signal = "5X"; signal.copy(gnss_synchro.Signal, 2, 0); gnss_synchro.PRN = 11; config->set_property("GNSS-SDR.internal_fs_sps", "32000000"); - config->set_property("Tracking_Galileo.item_type", "gr_complex"); - 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"); - config->set_property("Tracking_Galileo.order", "2"); - config->set_property("Tracking_Galileo.pll_bw_hz_init","20.0"); - config->set_property("Tracking_Galileo.pll_bw_hz", "5"); - config->set_property("Tracking_Galileo.dll_bw_hz_init","2.0"); - config->set_property("Tracking_Galileo.dll_bw_hz", "2"); - config->set_property("Tracking_Galileo.ti_ms", "1"); + config->set_property("Tracking_5X.implementation", "Galileo_E5a_DLL_PLL_Tracking"); + config->set_property("Tracking_5X.item_type", "gr_complex"); + config->set_property("Tracking_5X.dump", "false"); + config->set_property("Tracking_5X.dump_filename", "../data/e5a_tracking_ch_"); + config->set_property("Tracking_5X.early_late_space_chips", "0.5"); + config->set_property("Tracking_5X.order", "2"); + config->set_property("Tracking_5X.pll_bw_hz_init","20.0"); + config->set_property("Tracking_5X.pll_bw_hz", "5"); + config->set_property("Tracking_5X.dll_bw_hz_init","2.0"); + config->set_property("Tracking_5X.dll_bw_hz", "2"); + config->set_property("Tracking_5X.ti_ms", "1"); } @@ -105,13 +105,13 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); int fs_in = 32000000; - int nsamples = 32000000*5; + int nsamples = 32000000 * 5; init(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Tracking test"); // Example using smart pointers and the block factory - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking", "Galileo_E5a_DLL_PLL_Tracking", 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_5X", "Galileo_E5a_DLL_PLL_Tracking", 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); //REAL @@ -123,15 +123,15 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults) ASSERT_NO_THROW( { tracking->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { tracking->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { tracking->connect(top_block); - }) << "Failure connecting tracking to the top_block." << std::endl; + }) << "Failure connecting tracking to the top_block."; ASSERT_NO_THROW( { gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); @@ -140,8 +140,7 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults) top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, tracking->get_left_block(), 0); top_block->connect(tracking->get_right_block(), 0, sink, 0); - - }) << "Failure connecting the blocks of tracking test." << std::endl; + }) << "Failure connecting the blocks of tracking test."; tracking->start_tracking(); @@ -150,7 +149,7 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults) top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc index c10280c44..32d0388cf 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc @@ -555,7 +555,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g2.showonscreen(); // window output } - catch (GnuplotException ge) + catch (const GnuplotException & ge) { std::cout << ge.what() << std::endl; } diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index 1bd317a95..43442611f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -465,7 +465,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) { throw std::exception(); }; - })<< "Failure opening true observables file" << std::endl; + }) << "Failure opening true observables file"; top_block = gr::make_top_block("Tracking test"); std::shared_ptr tracking = std::make_shared (config.get(), "Tracking_1C", 1, 1); @@ -479,7 +479,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) { throw std::exception(); }; - })<< "Failure reading true observables file" << std::endl; + }) << "Failure reading true observables file"; //restart the epoch counter true_obs_data.restart(); @@ -497,24 +497,24 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) ASSERT_NO_THROW( { tracking->set_channel(gnss_synchro.Channel_ID); - })<< "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { tracking->set_gnss_synchro(&gnss_synchro); - })<< "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { tracking->connect(top_block); - })<< "Failure connecting tracking to the top_block." << std::endl; + }) << "Failure connecting tracking to the top_block."; ASSERT_NO_THROW( { gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); 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")); - })<< "Failure connecting the blocks of tracking test." << std::endl; + }) << "Failure connecting the blocks of tracking test."; tracking->start_tracking(); @@ -533,7 +533,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) tracking->reset();// unlock the channel end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - })<< "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; // wait until child thread terminates t.join(); @@ -568,7 +568,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) { throw std::exception(); }; - })<< "Failure opening tracking dump file" << std::endl; + }) << "Failure opening tracking dump file"; nepoch = trk_dump.num_epochs(); std::cout << "Measured observation epochs=" << nepoch << std::endl; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc index 220543ffd..bc750c062 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc @@ -155,9 +155,9 @@ void GpsL2MDllPllTrackingTest::init() TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds(0); + std::chrono::duration elapsed_seconds(0.0); int fs_in = 5000000; - int nsamples = fs_in*9; + int nsamples = fs_in * 9; init(); queue = gr::msg_queue::make(0); @@ -171,15 +171,15 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults) ASSERT_NO_THROW( { tracking->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel." << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW( { tracking->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW( { tracking->connect(top_block); - }) << "Failure connecting tracking to the top_block." << std::endl; + }) << "Failure connecting tracking to the top_block."; ASSERT_NO_THROW( { //gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); @@ -193,7 +193,7 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults) 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")); - }) << "Failure connecting the blocks of tracking test." << std::endl; + }) << "Failure connecting the blocks of tracking test."; tracking->start_tracking(); @@ -202,7 +202,7 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults) top_block->run(); // Start threads and wait end = std::chrono::system_clock::now(); elapsed_seconds = end - start; - }) << "Failure running the top_block." << std::endl; + }) << "Failure running the top_block."; // TODO: Verify tracking results std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc index a240ac09d..a1c904b02 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc @@ -57,10 +57,10 @@ TEST(TrackingLoopFilterTest, FirstOrderLoop) float result = 0.0; for( unsigned int i = 0; i < sample_data.size(); ++i ) - { - result = theFilter.apply( sample_data[i] ); - EXPECT_FLOAT_EQ( result, sample_data[i]*g1 ); - } + { + result = theFilter.apply( sample_data[i] ); + EXPECT_FLOAT_EQ( result, sample_data[i]*g1 ); + } } @@ -88,10 +88,10 @@ TEST(TrackingLoopFilterTest, FirstOrderLoopWithLastIntegrator) float result = 0.0; for( unsigned int i = 0; i < sample_data.size(); ++i ) - { - result = theFilter.apply( sample_data[i] ); - EXPECT_NEAR( result, expected_out[i], 1e-4 ); - } + { + result = theFilter.apply( sample_data[i] ); + EXPECT_NEAR( result, expected_out[i], 1e-4 ); + } } @@ -120,10 +120,10 @@ TEST(TrackingLoopFilterTest, SecondOrderLoop) float result = 0.0; for( unsigned int i = 0; i < sample_data.size(); ++i ) - { - result = theFilter.apply( sample_data[i] ); - EXPECT_NEAR( result, expected_out[i], 1e-4 ); - } + { + result = theFilter.apply( sample_data[i] ); + EXPECT_NEAR( result, expected_out[i], 1e-4 ); + } } @@ -151,10 +151,10 @@ TEST(TrackingLoopFilterTest, SecondOrderLoopWithLastIntegrator) float result = 0.0; for( unsigned int i = 0; i < sample_data.size(); ++i ) - { - result = theFilter.apply( sample_data[i] ); - EXPECT_NEAR( result, expected_out[i], 1e-4 ); - } + { + result = theFilter.apply( sample_data[i] ); + EXPECT_NEAR( result, expected_out[i], 1e-4 ); + } } @@ -182,10 +182,10 @@ TEST(TrackingLoopFilterTest, ThirdOrderLoop) float result = 0.0; for( unsigned int i = 0; i < sample_data.size(); ++i ) - { - result = theFilter.apply( sample_data[i] ); - EXPECT_NEAR( result, expected_out[i], 1e-4 ); - } + { + result = theFilter.apply( sample_data[i] ); + EXPECT_NEAR( result, expected_out[i], 1e-4 ); + } } @@ -213,10 +213,10 @@ TEST(TrackingLoopFilterTest, ThirdOrderLoopWithLastIntegrator) float result = 0.0; for( unsigned int i = 0; i < sample_data.size(); ++i ) - { - result = theFilter.apply( sample_data[i] ); - EXPECT_NEAR( result, expected_out[i], 1e-4 ); - } + { + result = theFilter.apply( sample_data[i] ); + EXPECT_NEAR( result, expected_out[i], 1e-4 ); + } }