mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-30 06:52:58 +00:00 
			
		
		
		
	Replacing some raw pointers by smart pointers
This commit is contained in:
		| @@ -120,7 +120,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) | ||||
|  | ||||
|     // Example using smart pointers and the block factory | ||||
|     std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1, queue); | ||||
|     std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_); | ||||
|     std::shared_ptr<GalileoE1DllPllVemlTracking> tracking = std::dynamic_pointer_cast<GalileoE1DllPllVemlTracking>(trk_); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         tracking->set_channel(gnss_synchro.Channel_ID); | ||||
|   | ||||
| @@ -77,7 +77,7 @@ protected: | ||||
|  | ||||
|     gr::msg_queue::sptr queue; | ||||
|     gr::top_block_sptr top_block; | ||||
|     std::shared_ptr<AcquisitionInterface> acquisition; | ||||
|     std::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisition> acquisition; | ||||
|     std::shared_ptr<GNSSBlockFactory> factory; | ||||
|     std::shared_ptr<InMemoryConfiguration> config; | ||||
|     Gnss_Synchro gnss_synchro; | ||||
| @@ -374,7 +374,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|     config_1(); | ||||
|  | ||||
|     std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1, queue); | ||||
|     acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); | ||||
|     acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
| @@ -424,7 +424,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) | ||||
|     config_1(); | ||||
|  | ||||
|     std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1, queue); | ||||
|     acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); | ||||
|     acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
| @@ -513,7 +513,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb | ||||
|     config_2(); | ||||
|  | ||||
|     std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1, queue); | ||||
|     acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); | ||||
|     acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
|   | ||||
| @@ -33,6 +33,7 @@ | ||||
|  | ||||
| #include <ctime> | ||||
| #include <iostream> | ||||
| #include <boost/shared_ptr.hpp> | ||||
| #include <gnuradio/top_block.h> | ||||
| #include <gnuradio/blocks/file_source.h> | ||||
| #include <gnuradio/analog/sig_source_waveform.h> | ||||
| @@ -47,7 +48,6 @@ | ||||
| #include "signal_generator_c.h" | ||||
| #include "fir_filter.h" | ||||
| #include "gen_signal_source.h" | ||||
| #include "boost/shared_ptr.hpp" | ||||
| #include "gnss_sdr_valve.h" | ||||
|  | ||||
|  | ||||
| @@ -428,7 +428,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) | ||||
|     }) << "Failure setting doppler_step."<< std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); | ||||
|         acquisition->set_threshold(config->property("Acquisition.threshold", 0.00001)); | ||||
|     }) << "Failure setting threshold."<< std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|   | ||||
| @@ -35,6 +35,7 @@ | ||||
|  | ||||
| #include <ctime> | ||||
| #include <iostream> | ||||
| #include <boost/shared_ptr.hpp> | ||||
| #include <gnuradio/top_block.h> | ||||
| #include <gnuradio/blocks/file_source.h> | ||||
| #include <gnuradio/analog/sig_source_waveform.h> | ||||
| @@ -52,7 +53,7 @@ | ||||
| #include "fir_filter.h" | ||||
| #include "gen_signal_source.h" | ||||
| #include "gnss_sdr_valve.h" | ||||
| #include "boost/shared_ptr.hpp" | ||||
|  | ||||
|  | ||||
|  | ||||
| class GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test: public ::testing::Test | ||||
| @@ -62,6 +63,7 @@ protected: | ||||
|     { | ||||
|         queue = gr::msg_queue::make(0); | ||||
|         top_block = gr::make_top_block("Acquisition test"); | ||||
|         factory = std::make_shared<GNSSBlockFactory>(); | ||||
|         item_size = sizeof(gr_complex); | ||||
|         stop = false; | ||||
|         message = 0; | ||||
| @@ -81,8 +83,9 @@ protected: | ||||
|  | ||||
|     gr::msg_queue::sptr queue; | ||||
|     gr::top_block_sptr top_block; | ||||
|     GalileoE1PcpsTongAmbiguousAcquisition *acquisition; | ||||
|     InMemoryConfiguration* config; | ||||
|     std::shared_ptr<AcquisitionInterface> acquisition; | ||||
|     std::shared_ptr<GNSSBlockFactory> factory; | ||||
|     std::shared_ptr<InMemoryConfiguration> config; | ||||
|     Gnss_Synchro gnss_synchro; | ||||
|     size_t item_size; | ||||
|     concurrent_queue<int> channel_internal_queue; | ||||
| @@ -133,7 +136,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_1() | ||||
|     gnss_synchro.Channel_ID = 0; | ||||
|     gnss_synchro.System = 'E'; | ||||
|     std::string signal = "1C"; | ||||
|     signal.copy(gnss_synchro.Signal,2,0); | ||||
|     signal.copy(gnss_synchro.Signal, 2, 0); | ||||
|  | ||||
|     integration_time_ms = 4; | ||||
|     fs_in = 4e6; | ||||
| @@ -145,7 +148,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_1() | ||||
|  | ||||
|     num_of_realizations = 1; | ||||
|  | ||||
|     config = new InMemoryConfiguration(); | ||||
|     config = std::make_shared<InMemoryConfiguration>(); | ||||
|  | ||||
|     config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(fs_in)); | ||||
|  | ||||
| @@ -204,7 +207,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_2() | ||||
|     gnss_synchro.Channel_ID = 0; | ||||
|     gnss_synchro.System = 'E'; | ||||
|     std::string signal = "1C"; | ||||
|     signal.copy(gnss_synchro.Signal,2,0); | ||||
|     signal.copy(gnss_synchro.Signal, 2, 0); | ||||
|  | ||||
|     integration_time_ms = 4; | ||||
|     fs_in = 4e6; | ||||
| @@ -216,7 +219,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_2() | ||||
|  | ||||
|     num_of_realizations = 100; | ||||
|  | ||||
|     config = new InMemoryConfiguration(); | ||||
|     config = std::make_shared<InMemoryConfiguration>(); | ||||
|  | ||||
|     config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(fs_in)); | ||||
|  | ||||
| @@ -312,7 +315,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::wait_message() | ||||
|             gettimeofday(&tv, NULL); | ||||
|             end = tv.tv_sec *1e6 + tv.tv_usec; | ||||
|  | ||||
|             mean_acq_time_us += (end-begin); | ||||
|             mean_acq_time_us += (end - begin); | ||||
|  | ||||
|             process_message(); | ||||
|         } | ||||
| @@ -367,9 +370,8 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::stop_queue() | ||||
| TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate) | ||||
| { | ||||
|     config_1(); | ||||
|     acquisition = new GalileoE1PcpsTongAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
|     std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1, queue); | ||||
|     acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); | ||||
| } | ||||
|  | ||||
| TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) | ||||
| @@ -380,7 +382,8 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|     long long int end = 0; | ||||
|  | ||||
|     config_1(); | ||||
|     acquisition = new GalileoE1PcpsTongAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1, queue); | ||||
|     acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
| @@ -388,7 +391,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|         boost::shared_ptr<gr::block> 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." << std::endl; | ||||
|  | ||||
|     EXPECT_NO_THROW( { | ||||
|         gettimeofday(&tv, NULL); | ||||
| @@ -396,43 +399,41 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|         top_block->run(); // Start threads and wait | ||||
|         gettimeofday(&tv, NULL); | ||||
|         end = tv.tv_sec *1e6 + tv.tv_usec; | ||||
|     }) << "Failure running the top_block."<< std::endl; | ||||
|     }) << "Failure running the top_block." << std::endl; | ||||
|  | ||||
|     std::cout <<  "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) | ||||
| { | ||||
|     config_1(); | ||||
|  | ||||
|     acquisition = new GalileoE1PcpsTongAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1, queue); | ||||
|     acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
|     }) << "Failure setting channel."<< std::endl; | ||||
|     }) << "Failure setting channel." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_gnss_synchro(&gnss_synchro); | ||||
|     }) << "Failure setting gnss_synchro."<< std::endl; | ||||
|     }) << "Failure setting gnss_synchro." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel_queue(&channel_internal_queue); | ||||
|     }) << "Failure setting channel_internal_queue."<< std::endl; | ||||
|     }) << "Failure setting channel_internal_queue." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); | ||||
|     }) << "Failure setting doppler_max."<< std::endl; | ||||
|     }) << "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; | ||||
|     }) << "Failure setting doppler_step." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_threshold(config->property("Acquisition.threshold", 0.000001)); | ||||
|     }) << "Failure setting threshold."<< std::endl; | ||||
|     }) << "Failure setting threshold." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
| @@ -442,9 +443,9 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         boost::shared_ptr<GenSignalSource> signal_source; | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config, "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config, "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config, signal_generator, filter, "SignalSource", queue)); | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config.get(), 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; | ||||
| @@ -470,7 +471,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." << std::endl; | ||||
|  | ||||
|             if (i == 0) | ||||
|             { | ||||
| @@ -485,59 +486,57 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) | ||||
|                 EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL."; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) | ||||
| { | ||||
|     config_2(); | ||||
|  | ||||
|     acquisition = new GalileoE1PcpsTongAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1, queue); | ||||
|     acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
|     }) << "Failure setting channel."<< std::endl; | ||||
|     }) << "Failure setting channel." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_gnss_synchro(&gnss_synchro); | ||||
|     }) << "Failure setting gnss_synchro."<< std::endl; | ||||
|     }) << "Failure setting gnss_synchro." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel_queue(&channel_internal_queue); | ||||
|     }) << "Failure setting channel_internal_queue."<< std::endl; | ||||
|     }) << "Failure setting channel_internal_queue." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); | ||||
|     }) << "Failure setting doppler_max."<< std::endl; | ||||
|     }) << "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; | ||||
|     }) << "Failure setting doppler_step." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_threshold(config->property("Acquisition.threshold", 0.00028)); | ||||
|     }) << "Failure setting threshold."<< std::endl; | ||||
|     }) << "Failure setting threshold." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
|     }) << "Failure connecting acquisition to the top_block."<< std::endl; | ||||
|     }) << "Failure connecting acquisition to the top_block." << std::endl; | ||||
|  | ||||
|     acquisition->init(); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         boost::shared_ptr<GenSignalSource> signal_source; | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config, "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config, "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config, signal_generator, filter, "SignalSource", queue)); | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config.get(), 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; | ||||
|  | ||||
|     std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; | ||||
|  | ||||
|     // i = 0 --> sallite in acquisition is visible (prob of detection and prob of detection with wrong estimation) | ||||
|     // i = 0 --> satellite in acquisition is visible (prob of detection and prob of detection with wrong estimation) | ||||
|     // i = 1 --> satellite in acquisition is not visible (prob of false detection) | ||||
|     for (unsigned int i = 0; i < 2; i++) | ||||
|         { | ||||
| @@ -575,7 +574,4 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro | ||||
|                 ch_thread.timed_join(boost::posix_time::seconds(1)); | ||||
|             }) << "Failure while waiting the queue to stop" << std::endl; | ||||
|         } | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|   | ||||
| @@ -80,7 +80,7 @@ protected: | ||||
|     gr::msg_queue::sptr queue; | ||||
|     gr::top_block_sptr top_block; | ||||
|     GpsL1CaPcpsAcquisition *acquisition; | ||||
|     InMemoryConfiguration* config; | ||||
|     std::shared_ptr<InMemoryConfiguration> config; | ||||
|     Gnss_Synchro gnss_synchro; | ||||
|     size_t item_size; | ||||
|     concurrent_queue<int> channel_internal_queue; | ||||
| @@ -143,7 +143,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_1() | ||||
|  | ||||
|     num_of_realizations = 1; | ||||
|  | ||||
|     config = new InMemoryConfiguration(); | ||||
|     config = std::make_shared<InMemoryConfiguration>(); | ||||
|  | ||||
|     config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(fs_in)); | ||||
|  | ||||
| @@ -212,7 +212,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_2() | ||||
|  | ||||
|     num_of_realizations = 100; | ||||
|  | ||||
|     config = new InMemoryConfiguration(); | ||||
|     config = std::make_shared<InMemoryConfiguration>(); | ||||
|  | ||||
|     config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(fs_in)); | ||||
|  | ||||
| @@ -342,7 +342,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::process_message() | ||||
|  | ||||
|             Pd = (double)correct_estimation_counter / (double)num_of_realizations; | ||||
|             Pfa_a = (double)detection_counter / (double)num_of_realizations; | ||||
|             Pfa_p = (double)(detection_counter-correct_estimation_counter) / (double)num_of_realizations; | ||||
|             Pfa_p = (double)(detection_counter - correct_estimation_counter) / (double)num_of_realizations; | ||||
|  | ||||
|             mean_acq_time_us /= num_of_realizations; | ||||
|  | ||||
| @@ -359,9 +359,8 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::stop_queue() | ||||
| TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, Instantiate) | ||||
| { | ||||
|     config_1(); | ||||
|     acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) | ||||
| @@ -372,7 +371,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|     long long int end = 0; | ||||
|  | ||||
|     config_1(); | ||||
|     acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
| @@ -390,17 +389,16 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|         end = tv.tv_sec *1e6 + tv.tv_usec; | ||||
|     }) << "Failure running the top_block."<< std::endl; | ||||
|  | ||||
|     std::cout <<  "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; | ||||
|     std::cout <<  "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl; | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) | ||||
| { | ||||
|     config_1(); | ||||
|  | ||||
|     acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
| @@ -434,14 +432,14 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         boost::shared_ptr<GenSignalSource> signal_source; | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config, "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config, "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config, signal_generator, filter, "SignalSource", queue)); | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config.get(), 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; | ||||
|  | ||||
|     // i = 0 --> sallite in acquisition is visible | ||||
|     // i = 0 --> satellite in acquisition is visible | ||||
|     // i = 1 --> satellite in acquisition is not visible | ||||
|     for (unsigned int i = 0; i < 2; i++) | ||||
|         { | ||||
| @@ -480,14 +478,13 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) | ||||
|         } | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) | ||||
| { | ||||
|     config_2(); | ||||
|  | ||||
|     acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
| @@ -521,16 +518,16 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         boost::shared_ptr<GenSignalSource> signal_source; | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config, "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config, "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config, signal_generator, filter, "SignalSource", queue)); | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config.get(), 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; | ||||
|  | ||||
|     std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; | ||||
|  | ||||
|     // i = 0 --> sallite in acquisition is visible (prob of detection and prob of detection with wrong estimation) | ||||
|     // i = 0 --> satellite in acquisition is visible (prob of detection and prob of detection with wrong estimation) | ||||
|     // i = 1 --> satellite in acquisition is not visible (prob of false detection) | ||||
|     for (unsigned int i = 0; i < 2; i++) | ||||
|         { | ||||
| @@ -551,7 +548,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) | ||||
|  | ||||
|             EXPECT_NO_THROW( { | ||||
|                 top_block->run(); // Start threads and wait | ||||
|             }) << "Failure running he top_block."<< std::endl; | ||||
|             }) << "Failure running the top_block."<< std::endl; | ||||
|  | ||||
|             if (i == 0) | ||||
|             { | ||||
| @@ -566,5 +563,4 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) | ||||
|         } | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|   | ||||
| @@ -55,18 +55,15 @@ protected: | ||||
|     { | ||||
|         queue = gr::msg_queue::make(0); | ||||
|         top_block = gr::make_top_block("Acquisition test"); | ||||
|         factory = new GNSSBlockFactory(); | ||||
|         config = new InMemoryConfiguration(); | ||||
|         factory = std::make_shared<GNSSBlockFactory>(); | ||||
|         config = std::make_shared<InMemoryConfiguration>(); | ||||
|         item_size = sizeof(gr_complex); | ||||
|         stop = false; | ||||
|         message = 0; | ||||
|     } | ||||
|  | ||||
|     ~GpsL1CaPcpsAcquisitionTest() | ||||
|     { | ||||
|         delete factory; | ||||
|         delete config; | ||||
|     } | ||||
|     {} | ||||
|  | ||||
|     void init(); | ||||
|     void start_queue(); | ||||
| @@ -75,8 +72,8 @@ protected: | ||||
|  | ||||
|     gr::msg_queue::sptr queue; | ||||
|     gr::top_block_sptr top_block; | ||||
|     GNSSBlockFactory* factory; | ||||
|     InMemoryConfiguration* config; | ||||
|     std::shared_ptr<GNSSBlockFactory> factory; | ||||
|     std::shared_ptr<InMemoryConfiguration> config; | ||||
|     Gnss_Synchro gnss_synchro; | ||||
|     size_t item_size; | ||||
|     concurrent_queue<int> channel_internal_queue; | ||||
| @@ -134,7 +131,7 @@ void GpsL1CaPcpsAcquisitionTest::stop_queue() | ||||
| TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate) | ||||
| { | ||||
|     init(); | ||||
|     GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|     delete acquisition; | ||||
| } | ||||
|  | ||||
| @@ -147,7 +144,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) | ||||
|     long long int end = 0; | ||||
|  | ||||
|     init(); | ||||
|     GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
| @@ -155,7 +152,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) | ||||
|         boost::shared_ptr<gr::block> 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." << std::endl; | ||||
|  | ||||
|     EXPECT_NO_THROW( { | ||||
|         gettimeofday(&tv, NULL); | ||||
| @@ -163,7 +160,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) | ||||
|         top_block->run(); // Start threads and wait | ||||
|         gettimeofday(&tv, NULL); | ||||
|         end = tv.tv_sec *1000000 + tv.tv_usec; | ||||
|     }) << "Failure running the top_block."<< std::endl; | ||||
|     }) << "Failure running the top_block." << std::endl; | ||||
|  | ||||
|     delete acquisition; | ||||
|     std::cout <<  "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl; | ||||
| @@ -178,7 +175,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) | ||||
|     double expected_delay_samples = 127; | ||||
|     double expected_doppler_hz = -2400; | ||||
|     init(); | ||||
|     GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
| @@ -214,7 +211,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) | ||||
|         const char * file_name = file.c_str(); | ||||
|         gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false); | ||||
|         top_block->connect(file_source, 0, acquisition->get_left_block(), 0); | ||||
|     }) << "Failure connecting the blocks of acquisition test."<< std::endl; | ||||
|     }) << "Failure connecting the blocks of acquisition test." << std::endl; | ||||
|  | ||||
|     start_queue(); | ||||
|  | ||||
| @@ -227,7 +224,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) | ||||
|         top_block->run(); // Start threads and wait | ||||
|         gettimeofday(&tv, NULL); | ||||
|         end = tv.tv_sec*1000000 + tv.tv_usec; | ||||
|     }) << "Failure running the top_block."<< std::endl; | ||||
|     }) << "Failure running the top_block." << std::endl; | ||||
|  | ||||
|     ch_thread.timed_join(boost::posix_time::seconds(1)); | ||||
|  | ||||
|   | ||||
| @@ -84,7 +84,7 @@ protected: | ||||
|     gr::msg_queue::sptr queue; | ||||
|     gr::top_block_sptr top_block; | ||||
|     GpsL1CaPcpsMultithreadAcquisition *acquisition; | ||||
|     InMemoryConfiguration* config; | ||||
|     std::shared_ptr<InMemoryConfiguration> config; | ||||
|     Gnss_Synchro gnss_synchro; | ||||
|     size_t item_size; | ||||
|     concurrent_queue<int> channel_internal_queue; | ||||
| @@ -147,7 +147,7 @@ void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::config_1() | ||||
|  | ||||
|     num_of_realizations = 1; | ||||
|  | ||||
|     config = new InMemoryConfiguration(); | ||||
|     config = std::make_shared<InMemoryConfiguration>(); | ||||
|  | ||||
|     config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(fs_in)); | ||||
|  | ||||
| @@ -216,7 +216,7 @@ void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::config_2() | ||||
|  | ||||
|     num_of_realizations = 100; | ||||
|  | ||||
|     config = new InMemoryConfiguration(); | ||||
|     config = std::make_shared<InMemoryConfiguration>(); | ||||
|  | ||||
|     config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(fs_in)); | ||||
|  | ||||
| @@ -365,9 +365,8 @@ void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::stop_queue() | ||||
| TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, Instantiate) | ||||
| { | ||||
|     config_1(); | ||||
|     acquisition = new GpsL1CaPcpsMultithreadAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsMultithreadAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ConnectAndRun) | ||||
| @@ -378,7 +377,7 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|     long long int end = 0; | ||||
|  | ||||
|     config_1(); | ||||
|     acquisition = new GpsL1CaPcpsMultithreadAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsMultithreadAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
| @@ -386,7 +385,7 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|         boost::shared_ptr<gr::block> 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." << std::endl; | ||||
|  | ||||
|     EXPECT_NO_THROW( { | ||||
|         gettimeofday(&tv, NULL); | ||||
| @@ -394,60 +393,59 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|         top_block->run(); // Start threads and wait | ||||
|         gettimeofday(&tv, NULL); | ||||
|         end = tv.tv_sec *1e6 + tv.tv_usec; | ||||
|     }) << "Failure running the top_block."<< std::endl; | ||||
|     }) << "Failure running the top_block." << std::endl; | ||||
|  | ||||
|     std::cout <<  "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; | ||||
|     std::cout <<  "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl; | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ValidationOfResults) | ||||
| { | ||||
|     config_1(); | ||||
|  | ||||
|     acquisition = new GpsL1CaPcpsMultithreadAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsMultithreadAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
|     }) << "Failure setting channel."<< std::endl; | ||||
|     }) << "Failure setting channel." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_gnss_synchro(&gnss_synchro); | ||||
|     }) << "Failure setting gnss_synchro."<< std::endl; | ||||
|     }) << "Failure setting gnss_synchro." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel_queue(&channel_internal_queue); | ||||
|     }) << "Failure setting channel_internal_queue."<< std::endl; | ||||
|     }) << "Failure setting channel_internal_queue." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); | ||||
|     }) << "Failure setting doppler_max."<< std::endl; | ||||
|     }) << "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; | ||||
|     }) << "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 threshold." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
|     }) << "Failure connecting acquisition to the top_block."<< std::endl; | ||||
|     }) << "Failure connecting acquisition to the top_block." << std::endl; | ||||
|  | ||||
|     acquisition->init(); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         boost::shared_ptr<GenSignalSource> signal_source; | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config, "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config, "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config, signal_generator, filter, "SignalSource", queue)); | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config.get(), 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; | ||||
|  | ||||
|     // i = 0 --> sallite in acquisition is visible | ||||
|     // i = 0 --> satellite in acquisition is visible | ||||
|     // i = 1 --> satellite in acquisition is not visible | ||||
|     for (unsigned int i = 0; i < 2; i++) | ||||
|         { | ||||
| @@ -468,7 +466,7 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ValidationOfResults) | ||||
|  | ||||
|             EXPECT_NO_THROW( { | ||||
|                 top_block->run(); // Start threads and wait | ||||
|             }) << "Failure running he top_block."<< std::endl; | ||||
|             }) << "Failure running the top_block." << std::endl; | ||||
|  | ||||
|             if (i == 0) | ||||
|             { | ||||
| @@ -493,50 +491,50 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ValidationOfResultsProbabi | ||||
| { | ||||
|     config_2(); | ||||
|  | ||||
|     acquisition = new GpsL1CaPcpsMultithreadAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsMultithreadAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
|     }) << "Failure setting channel."<< std::endl; | ||||
|     }) << "Failure setting channel." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_gnss_synchro(&gnss_synchro); | ||||
|     }) << "Failure setting gnss_synchro."<< std::endl; | ||||
|     }) << "Failure setting gnss_synchro." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel_queue(&channel_internal_queue); | ||||
|     }) << "Failure setting channel_internal_queue."<< std::endl; | ||||
|     }) << "Failure setting channel_internal_queue." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); | ||||
|     }) << "Failure setting doppler_max."<< std::endl; | ||||
|     }) << "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; | ||||
|     }) << "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 threshold." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
|     }) << "Failure connecting acquisition to the top_block."<< std::endl; | ||||
|     }) << "Failure connecting acquisition to the top_block." << std::endl; | ||||
|  | ||||
|     acquisition->init(); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         boost::shared_ptr<GenSignalSource> signal_source; | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config, "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config, "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config, signal_generator, filter, "SignalSource", queue)); | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config.get(), 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; | ||||
|  | ||||
|     std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; | ||||
|  | ||||
|     // i = 0 --> sallite in acquisition is visible (prob of detection and prob of detection with wrong estimation) | ||||
|     // i = 0 --> satellite in acquisition is visible (prob of detection and prob of detection with wrong estimation) | ||||
|     // i = 1 --> satellite in acquisition is not visible (prob of false detection) | ||||
|     for (unsigned int i = 0; i < 2; i++) | ||||
|         { | ||||
| @@ -573,5 +571,4 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ValidationOfResultsProbabi | ||||
|         } | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|   | ||||
| @@ -78,7 +78,7 @@ protected: | ||||
|     gr::msg_queue::sptr queue; | ||||
|     gr::top_block_sptr top_block; | ||||
|     GpsL1CaPcpsOpenClAcquisition *acquisition; | ||||
|     InMemoryConfiguration* config; | ||||
|     std::shared_ptr<InMemoryConfiguration> config; | ||||
|     Gnss_Synchro gnss_synchro; | ||||
|     size_t item_size; | ||||
|     concurrent_queue<int> channel_internal_queue; | ||||
| @@ -141,7 +141,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_1() | ||||
|  | ||||
|     num_of_realizations = 1; | ||||
|  | ||||
|     config = new InMemoryConfiguration(); | ||||
|     config = std::make_shared<InMemoryConfiguration>(); | ||||
|  | ||||
|     config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(fs_in)); | ||||
|  | ||||
| @@ -210,7 +210,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_2() | ||||
|  | ||||
|     num_of_realizations = 10; // Change here the number of realizations | ||||
|  | ||||
|     config = new InMemoryConfiguration(); | ||||
|     config = std::make_shared<InMemoryConfiguration>(); | ||||
|  | ||||
|     config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(fs_in)); | ||||
|  | ||||
| @@ -359,9 +359,8 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::stop_queue() | ||||
| TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, Instantiate) | ||||
| { | ||||
|     config_1(); | ||||
|     acquisition = new GpsL1CaPcpsOpenClAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsOpenClAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun) | ||||
| @@ -372,7 +371,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|     long long int end = 0; | ||||
|  | ||||
|     config_1(); | ||||
|     acquisition = new GpsL1CaPcpsOpenClAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsOpenClAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
| @@ -380,63 +379,62 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|         boost::shared_ptr<gr::block> 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." << std::endl; | ||||
|  | ||||
|     EXPECT_NO_THROW( { | ||||
|         gettimeofday(&tv, NULL); | ||||
|         begin = tv.tv_sec *1e6 + tv.tv_usec; | ||||
|         begin = tv.tv_sec * 1e6 + tv.tv_usec; | ||||
|         top_block->run(); // Start threads and wait | ||||
|         gettimeofday(&tv, NULL); | ||||
|         end = tv.tv_sec *1e6 + tv.tv_usec; | ||||
|     }) << "Failure running the top_block."<< std::endl; | ||||
|         end = tv.tv_sec * 1e6 + tv.tv_usec; | ||||
|     }) << "Failure running the top_block." << std::endl; | ||||
|  | ||||
|     std::cout <<  "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl; | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults) | ||||
| { | ||||
|     config_1(); | ||||
|  | ||||
|     acquisition = new GpsL1CaPcpsOpenClAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsOpenClAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
|     }) << "Failure setting channel."<< std::endl; | ||||
|     }) << "Failure setting channel." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_gnss_synchro(&gnss_synchro); | ||||
|     }) << "Failure setting gnss_synchro."<< std::endl; | ||||
|     }) << "Failure setting gnss_synchro." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel_queue(&channel_internal_queue); | ||||
|     }) << "Failure setting channel_internal_queue."<< std::endl; | ||||
|     }) << "Failure setting channel_internal_queue." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); | ||||
|     }) << "Failure setting doppler_max."<< std::endl; | ||||
|     }) << "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; | ||||
|     }) << "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 threshold." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
|     }) << "Failure connecting acquisition to the top_block."<< std::endl; | ||||
|     }) << "Failure connecting acquisition to the top_block." << std::endl; | ||||
|  | ||||
|     acquisition->init(); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         boost::shared_ptr<GenSignalSource> signal_source; | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config, "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config, "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config, signal_generator, filter, "SignalSource", queue)); | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config.get(), 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; | ||||
| @@ -462,7 +460,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." << std::endl; | ||||
|  | ||||
|             if (i == 0) | ||||
|             { | ||||
| @@ -480,50 +478,49 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults) | ||||
|         } | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) | ||||
| { | ||||
|     config_2(); | ||||
|  | ||||
|     acquisition = new GpsL1CaPcpsOpenClAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsOpenClAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
|     }) << "Failure setting channel."<< std::endl; | ||||
|     }) << "Failure setting channel." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_gnss_synchro(&gnss_synchro); | ||||
|     }) << "Failure setting gnss_synchro."<< std::endl; | ||||
|     }) << "Failure setting gnss_synchro." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel_queue(&channel_internal_queue); | ||||
|     }) << "Failure setting channel_internal_queue."<< std::endl; | ||||
|     }) << "Failure setting channel_internal_queue." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); | ||||
|     }) << "Failure setting doppler_max."<< std::endl; | ||||
|     }) << "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; | ||||
|     }) << "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 threshold." << std::endl; | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
|     }) << "Failure connecting acquisition to the top_block."<< std::endl; | ||||
|     }) << "Failure connecting acquisition to the top_block." << std::endl; | ||||
|  | ||||
|     acquisition->init(); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         boost::shared_ptr<GenSignalSource> signal_source; | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config, "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config, "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config, signal_generator, filter, "SignalSource", queue)); | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config.get(), 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; | ||||
| @@ -551,7 +548,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." << std::endl; | ||||
|  | ||||
|             if (i == 0) | ||||
|             { | ||||
| @@ -567,5 +564,4 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie | ||||
|         } | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|   | ||||
| @@ -81,7 +81,7 @@ protected: | ||||
|     gr::msg_queue::sptr queue; | ||||
|     gr::top_block_sptr top_block; | ||||
|     GpsL1CaPcpsTongAcquisition *acquisition; | ||||
|     InMemoryConfiguration* config; | ||||
|     std::shared_ptr<InMemoryConfiguration> config; | ||||
|     Gnss_Synchro gnss_synchro; | ||||
|     size_t item_size; | ||||
|     concurrent_queue<int> channel_internal_queue; | ||||
| @@ -144,7 +144,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_1() | ||||
|  | ||||
|     num_of_realizations = 1; | ||||
|  | ||||
|     config = new InMemoryConfiguration(); | ||||
|     config = std::make_shared<InMemoryConfiguration>(); | ||||
|  | ||||
|     config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(fs_in)); | ||||
|  | ||||
| @@ -213,7 +213,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_2() | ||||
|  | ||||
|     num_of_realizations = 100; | ||||
|  | ||||
|     config = new InMemoryConfiguration(); | ||||
|     config = std::make_shared<InMemoryConfiguration>(); | ||||
|  | ||||
|     config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(fs_in)); | ||||
|  | ||||
| @@ -362,9 +362,8 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::stop_queue() | ||||
| TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, Instantiate) | ||||
| { | ||||
|     config_1(); | ||||
|     acquisition = new GpsL1CaPcpsTongAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsTongAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun) | ||||
| @@ -375,7 +374,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|     long long int end = 0; | ||||
|  | ||||
|     config_1(); | ||||
|     acquisition = new GpsL1CaPcpsTongAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsTongAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->connect(top_block); | ||||
| @@ -395,14 +394,13 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun) | ||||
|  | ||||
|     std::cout <<  "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl; | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) | ||||
| { | ||||
|     config_1(); | ||||
|  | ||||
|     acquisition = new GpsL1CaPcpsTongAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsTongAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
| @@ -436,14 +434,14 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         boost::shared_ptr<GenSignalSource> signal_source; | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config, "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config, "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config, signal_generator, filter, "SignalSource", queue)); | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config.get(), 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; | ||||
|  | ||||
|     // i = 0 --> sallite in acquisition is visible | ||||
|     // i = 0 --> satellite in acquisition is visible | ||||
|     // i = 1 --> satellite in acquisition is not visible | ||||
|     for (unsigned int i = 0; i < 2; i++) | ||||
|         { | ||||
| @@ -482,14 +480,13 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) | ||||
|         } | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|  | ||||
| TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) | ||||
| { | ||||
|     config_2(); | ||||
|  | ||||
|     acquisition = new GpsL1CaPcpsTongAcquisition(config, "Acquisition", 1, 1, queue); | ||||
|     acquisition = new GpsL1CaPcpsTongAcquisition(config.get(), "Acquisition", 1, 1, queue); | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         acquisition->set_channel(1); | ||||
| @@ -523,16 +520,16 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) | ||||
|  | ||||
|     ASSERT_NO_THROW( { | ||||
|         boost::shared_ptr<GenSignalSource> signal_source; | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config, "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config, "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config, signal_generator, filter, "SignalSource", queue)); | ||||
|         SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); | ||||
|         FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1, queue); | ||||
|         signal_source.reset(new GenSignalSource(config.get(), 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; | ||||
|  | ||||
|     std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; | ||||
|  | ||||
|     // i = 0 --> sallite in acquisition is visible (prob of detection and prob of detection with wrong estimation) | ||||
|     // i = 0 --> satellite in acquisition is visible (prob of detection and prob of detection with wrong estimation) | ||||
|     // i = 1 --> satellite in acquisition is not visible (prob of false detection) | ||||
|     for (unsigned int i = 0; i < 2; i++) | ||||
|         { | ||||
| @@ -569,5 +566,4 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) | ||||
|         } | ||||
|  | ||||
|     delete acquisition; | ||||
|     delete config; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez