mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-15 03:35:46 +00:00
Replacing some raw pointers by smart pointers
This commit is contained in:
parent
75aee95bde
commit
6e20c9f8c6
@ -45,9 +45,9 @@
|
||||
#include "in_memory_configuration.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "gnss_synchro.h"
|
||||
|
||||
#include "galileo_e1_dll_pll_veml_tracking.h"
|
||||
|
||||
|
||||
class GalileoE1DllPllVemlTrackingInternalTest: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
@ -55,47 +55,43 @@ protected:
|
||||
{
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Tracking test");
|
||||
factory = new GNSSBlockFactory();
|
||||
config = new InMemoryConfiguration();
|
||||
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
item_size = sizeof(gr_complex);
|
||||
stop = false;
|
||||
message = 0;
|
||||
}
|
||||
|
||||
~GalileoE1DllPllVemlTrackingInternalTest()
|
||||
{
|
||||
delete factory;
|
||||
delete config;
|
||||
}
|
||||
{}
|
||||
|
||||
void init();
|
||||
|
||||
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;
|
||||
bool stop;
|
||||
int message;
|
||||
boost::thread ch_thread;
|
||||
};
|
||||
|
||||
|
||||
void GalileoE1DllPllVemlTrackingInternalTest::init()
|
||||
{
|
||||
gnss_synchro.Channel_ID=0;
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'E';
|
||||
std::string signal = "1B";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
gnss_synchro.PRN=11;
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
gnss_synchro.PRN = 11;
|
||||
|
||||
config->set_property("GNSS-SDR.internal_fs_hz", "8000000");
|
||||
config->set_property("Tracking.item_type", "gr_complex");
|
||||
config->set_property("Tracking.dump", "true");
|
||||
config->set_property("Tracking.dump_filename", "../data/veml_tracking_ch_");
|
||||
config->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_Tracking");
|
||||
config->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking");
|
||||
config->set_property("Tracking.early_late_space_chips", "0.15");
|
||||
config->set_property("Tracking.very_early_late_space_chips", "0.6");
|
||||
config->set_property("Tracking.pll_bw_hz", "30.0");
|
||||
@ -108,45 +104,62 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate)
|
||||
{
|
||||
|
||||
init();
|
||||
GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue);
|
||||
auto tracking = factory->GetBlock(config, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1, queue);
|
||||
EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str());
|
||||
delete tracking;
|
||||
}
|
||||
|
||||
//TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun)
|
||||
//{
|
||||
// int fs_in = 8000000;
|
||||
// int nsamples = 80000000;
|
||||
// struct timeval tv;
|
||||
// long long int begin;
|
||||
// long long int end;
|
||||
//
|
||||
// init();
|
||||
// GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue);
|
||||
//
|
||||
// ASSERT_NO_THROW( {
|
||||
// tracking->connect(top_block);
|
||||
// gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
// gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
// gr_null_sink_sptr sink = gr_make_null_sink(sizeof(Gnss_Synchro));
|
||||
// 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;
|
||||
//
|
||||
// EXPECT_NO_THROW( {
|
||||
// gettimeofday(&tv, NULL);
|
||||
// begin = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
// top_block->run(); // Start threads and wait
|
||||
// gettimeofday(&tv, NULL);
|
||||
// end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
// }) << "Failure running he top_block."<< std::endl;
|
||||
//
|
||||
// delete tracking;
|
||||
// std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
|
||||
//
|
||||
//}
|
||||
|
||||
TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun)
|
||||
{
|
||||
int fs_in = 8000000;
|
||||
int nsamples = 80000000;
|
||||
struct timeval tv;
|
||||
long long int begin;
|
||||
long long int end;
|
||||
init();
|
||||
|
||||
// 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_);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->set_channel_queue(&channel_internal_queue);
|
||||
}) << "Failure setting channel_internal_queue." << std::endl;
|
||||
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->connect(top_block);
|
||||
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));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
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;
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
gettimeofday(&tv, NULL);
|
||||
begin = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
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;
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
|
||||
{
|
||||
@ -158,29 +171,32 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
|
||||
int num_samples = 80000000; // 8 Msps
|
||||
unsigned int skiphead_sps = 8000000; // 8 Msps
|
||||
init();
|
||||
GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue);
|
||||
|
||||
// gnss_synchro.Acq_delay_samples=1753; // 4 Msps
|
||||
// gnss_synchro.Acq_doppler_hz=-9500; // 4 Msps
|
||||
// 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_);
|
||||
|
||||
// gnss_synchro.Acq_delay_samples = 1753; // 4 Msps
|
||||
// gnss_synchro.Acq_doppler_hz = -9500; // 4 Msps
|
||||
gnss_synchro.Acq_delay_samples = 17256; // 8 Msps
|
||||
gnss_synchro.Acq_doppler_hz = -8750; // 8 Msps
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel."<< std::endl;
|
||||
}) << "Failure setting channel." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
||||
}) << "Failure setting gnss_synchro." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->set_channel_queue(&channel_internal_queue);
|
||||
}) << "Failure setting channel_internal_queue."<< std::endl;
|
||||
}) << "Failure setting channel_internal_queue." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block."<< std::endl;
|
||||
}) << "Failure connecting tracking to the top_block." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
std::string path = std::string(TEST_PATH);
|
||||
@ -194,8 +210,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." << std::endl;
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
@ -205,9 +220,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
}) << "Failure running he top_block."<< std::endl;
|
||||
}) << "Failure running the top_block." << std::endl;
|
||||
|
||||
std::cout << "Tracked " << num_samples << " samples in " << (end-begin) << " microseconds" << std::endl;
|
||||
|
||||
delete tracking;
|
||||
std::cout << "Tracked " << num_samples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
||||
}
|
||||
|
@ -61,11 +61,11 @@ protected:
|
||||
item_size = sizeof(gr_complex);
|
||||
stop = false;
|
||||
message = 0;
|
||||
factory = std::make_shared<GNSSBlockFactory>();
|
||||
}
|
||||
|
||||
~GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void init();
|
||||
void config_1();
|
||||
@ -77,8 +77,9 @@ protected:
|
||||
|
||||
gr::msg_queue::sptr queue;
|
||||
gr::top_block_sptr top_block;
|
||||
GalileoE1Pcps8msAmbiguousAcquisition *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;
|
||||
@ -129,7 +130,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::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 = 8;
|
||||
fs_in = 4e6;
|
||||
@ -141,7 +142,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::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));
|
||||
|
||||
@ -154,10 +155,8 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_1()
|
||||
config->set_property("SignalSource.system_0", "E");
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", "44");
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
config->set_property("SignalSource.doppler_Hz_0", std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0", std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.noise_flag", "false");
|
||||
config->set_property("SignalSource.data_flag", "false");
|
||||
@ -184,8 +183,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_1()
|
||||
|
||||
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.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");
|
||||
@ -199,7 +197,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::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 = 8;
|
||||
fs_in = 4e6;
|
||||
@ -211,7 +209,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::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));
|
||||
|
||||
@ -224,10 +222,8 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_2()
|
||||
config->set_property("SignalSource.system_0", "E");
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", "44");
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
config->set_property("SignalSource.doppler_Hz_0", std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0", std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.system_1", "E");
|
||||
config->set_property("SignalSource.PRN_1", "15");
|
||||
@ -272,8 +268,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_2()
|
||||
|
||||
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.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");
|
||||
@ -355,8 +350,6 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::process_message()
|
||||
|
||||
stop_queue();
|
||||
top_block->stop();
|
||||
|
||||
//std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,9 +361,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::stop_queue()
|
||||
TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
acquisition = new GalileoE1Pcps8msAmbiguousAcquisition(config, "Acquisition", 1, 1, queue);
|
||||
delete acquisition;
|
||||
delete config;
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1, queue);
|
||||
}
|
||||
|
||||
TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
@ -382,7 +373,32 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
|
||||
config_1();
|
||||
|
||||
acquisition = new GalileoE1Pcps8msAmbiguousAcquisition(config, "Acquisition", 1, 1, queue);
|
||||
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_);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_channel_queue(&channel_internal_queue);
|
||||
}) << "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;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
||||
}) << "Failure setting threshold." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->connect(top_block);
|
||||
@ -390,7 +406,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, 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);
|
||||
@ -398,60 +414,58 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
end = tv.tv_sec *1e6 + tv.tv_usec;
|
||||
}) << "Failure running he top_block."<< std::endl;
|
||||
}) << "Failure running he top_block." << std::endl;
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
|
||||
|
||||
delete acquisition;
|
||||
delete config;
|
||||
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
{
|
||||
config_1();
|
||||
|
||||
acquisition = new GalileoE1Pcps8msAmbiguousAcquisition(config, "Acquisition", 1, 1, queue);
|
||||
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_);
|
||||
|
||||
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++)
|
||||
{
|
||||
@ -472,80 +486,77 @@ 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." << std::endl;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||
}) << "Failure while waiting the queue to stop" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
delete acquisition;
|
||||
delete config;
|
||||
}
|
||||
|
||||
TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
||||
{
|
||||
config_2();
|
||||
|
||||
acquisition = new GalileoE1Pcps8msAmbiguousAcquisition(config, "Acquisition", 1, 1, queue);
|
||||
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_);
|
||||
|
||||
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++)
|
||||
{
|
||||
@ -569,22 +580,19 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
|
||||
}) << "Failure running the top_block." << std::endl;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
ASSERT_NO_THROW( {
|
||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||
}) << "Failure while waiting the queue to stop" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
delete acquisition;
|
||||
delete config;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user