mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-15 14:47:19 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into kf
This commit is contained in:
@@ -124,7 +124,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
|
||||
g1.savetops("FFT_execution_times_extended");
|
||||
g1.savetopdf("FFT_execution_times_extended", 18);
|
||||
g1.showonscreen(); // window output
|
||||
if (FLAGS_show_plots) g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("linespoints");
|
||||
g2.set_title("FFT execution times for different lengths (up to 2^{14}=16384)");
|
||||
@@ -136,7 +136,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
|
||||
g2.savetops("FFT_execution_times");
|
||||
g2.savetopdf("FFT_execution_times", 18);
|
||||
g2.showonscreen(); // window output
|
||||
if (FLAGS_show_plots) g2.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
|
||||
@@ -209,7 +209,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaPcpsAcquisition)
|
||||
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
|
||||
configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
std::unique_ptr<GNSSBlockFactory> factory;
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 0);
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
EXPECT_STREQ("Acquisition", acquisition->role().c_str());
|
||||
EXPECT_STREQ("GPS_L1_CA_PCPS_Acquisition", acquisition->implementation().c_str());
|
||||
@@ -221,7 +221,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaPcpsQuickSyncAcquisition)
|
||||
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
|
||||
configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
|
||||
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_QuickSync_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_QuickSync_Acquisition", 1, 0);
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
EXPECT_STREQ("Acquisition", acquisition->role().c_str());
|
||||
EXPECT_STREQ("GPS_L1_CA_PCPS_QuickSync_Acquisition", acquisition->implementation().c_str());
|
||||
@@ -232,7 +232,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGalileoE1PcpsQuickSyncAmbiguousAcquisition
|
||||
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
|
||||
configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
|
||||
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
EXPECT_STREQ("Acquisition", acquisition->role().c_str());
|
||||
EXPECT_STREQ("Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", acquisition->implementation().c_str());
|
||||
@@ -244,7 +244,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGalileoE1PcpsAmbiguousAcquisition)
|
||||
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
|
||||
configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
||||
std::unique_ptr<GNSSBlockFactory> factory;
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
EXPECT_STREQ("Acquisition", acquisition->role().c_str());
|
||||
EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str());
|
||||
@@ -323,7 +323,7 @@ TEST(GNSSBlockFactoryTest, InstantiateChannels)
|
||||
configuration->set_property("Channel1.item_type", "gr_complex");
|
||||
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||
std::unique_ptr<GNSSBlockFactory> factory;
|
||||
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = std::move(factory->GetChannels(configuration, queue));
|
||||
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = factory->GetChannels(configuration, queue);
|
||||
EXPECT_EQ(static_cast<unsigned int>(2), channels->size());
|
||||
channels->erase(channels->begin(), channels->end());
|
||||
}
|
||||
|
||||
@@ -233,38 +233,22 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStopHybrid)
|
||||
config->set_property("Tracking_1B15.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking");
|
||||
|
||||
config->set_property("TelemetryDecoder_1C0.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1C0.decimation_factor", "4");
|
||||
config->set_property("TelemetryDecoder_1C1.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1C1.decimation_factor", "4");
|
||||
config->set_property("TelemetryDecoder_1C2.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1C2.decimation_factor", "4");
|
||||
config->set_property("TelemetryDecoder_1C3.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1C3.decimation_factor", "4");
|
||||
config->set_property("TelemetryDecoder_1C4.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1C4.decimation_factor", "4");
|
||||
config->set_property("TelemetryDecoder_1C5.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1C5.decimation_factor", "4");
|
||||
config->set_property("TelemetryDecoder_1C6.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1C6.decimation_factor", "4");
|
||||
config->set_property("TelemetryDecoder_1C7.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1C7.decimation_factor", "4");
|
||||
|
||||
config->set_property("TelemetryDecoder_1B8.implementation", "Galileo_E1B_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1B8.decimation_factor", "1");
|
||||
config->set_property("TelemetryDecoder_1B9.implementation", "Galileo_E1B_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1B9.decimation_factor", "1");
|
||||
config->set_property("TelemetryDecoder_1B10.implementation", "Galileo_E1B_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1B10.decimation_factor", "1");
|
||||
config->set_property("TelemetryDecoder_1B11.implementation", "Galileo_E1B_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1B11.decimation_factor", "1");
|
||||
config->set_property("TelemetryDecoder_1B12.implementation", "Galileo_E1B_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1B12.decimation_factor", "1");
|
||||
config->set_property("TelemetryDecoder_1B13.implementation", "Galileo_E1B_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1B13.decimation_factor", "1");
|
||||
config->set_property("TelemetryDecoder_1B14.implementation", "Galileo_E1B_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1B14.decimation_factor", "1");
|
||||
config->set_property("TelemetryDecoder_1B15.implementation", "Galileo_E1B_Telemetry_Decoder");
|
||||
config->set_property("TelemetryDecoder_1B15.decimation_factor", "1");
|
||||
|
||||
config->set_property("Observables.implementation", "Hybrid_Observables");
|
||||
config->set_property("PVT.implementation", "RTKLIB_PVT");
|
||||
|
||||
@@ -420,7 +420,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::stop_queue()
|
||||
TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -484,7 +484,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1, queue);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0, queue);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -572,7 +572,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
|
||||
config_2();
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
|
||||
@@ -423,7 +423,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::stop_queue()
|
||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
queue = gr::msg_queue::make(0);
|
||||
config_1();
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -466,7 +466,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
config_1();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -551,7 +551,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
|
||||
config_2();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::stop_queue()
|
||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate)
|
||||
{
|
||||
init();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str());
|
||||
}
|
||||
@@ -220,7 +220,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
init();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -251,7 +251,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
init();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
|
||||
|
||||
g1.savetops("Galileo_E1_acq_grid");
|
||||
g1.savetopdf("Galileo_E1_acq_grid");
|
||||
g1.showonscreen();
|
||||
if (FLAGS_show_plots) g1.showonscreen();
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
@@ -227,7 +227,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
|
||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate)
|
||||
{
|
||||
init();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
}
|
||||
|
||||
@@ -241,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<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
|
||||
|
||||
@@ -283,7 +283,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
double expected_doppler_hz = -632;
|
||||
init();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
|
||||
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
|
||||
|
||||
|
||||
@@ -243,7 +243,6 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_1()
|
||||
config->set_property("InputFilter.grid_density", "16");
|
||||
|
||||
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_1B.max_dwells", "1");
|
||||
@@ -424,7 +423,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::stop_queue()
|
||||
TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||
}
|
||||
|
||||
@@ -439,7 +438,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun)
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -468,7 +467,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
config_1();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -567,7 +566,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
|
||||
config_2();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
|
||||
@@ -548,7 +548,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::stop_queue()
|
||||
TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun)
|
||||
|
||||
config_1();
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -599,7 +599,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -690,7 +690,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -778,7 +778,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
|
||||
@@ -426,7 +426,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::stop_queue()
|
||||
TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
config_1();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -466,7 +466,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
config_1();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
@@ -555,7 +555,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
|
||||
config_2();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
|
||||
@@ -409,7 +409,6 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_3()
|
||||
config->set_property("InputFilter.grid_density", "16");
|
||||
|
||||
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");
|
||||
@@ -528,7 +527,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::stop_queue()
|
||||
TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 1);
|
||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -539,7 +538,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun)
|
||||
int nsamples = 21000 * 3;
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 1);
|
||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 0);
|
||||
boost::shared_ptr<GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx> msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue);
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
@@ -569,7 +568,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
|
||||
config_1();
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 1);
|
||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 0);
|
||||
boost::shared_ptr<GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx> msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include "glonass_l1_ca_pcps_acquisition.h"
|
||||
#include "signal_generator.h"
|
||||
#include "signal_generator_c.h"
|
||||
#include "fir_filter.h"
|
||||
#include "freq_xlating_fir_filter.h"
|
||||
#include "gen_signal_source.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "boost/shared_ptr.hpp"
|
||||
@@ -226,7 +226,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_1()
|
||||
config->set_property("SignalSource.data_flag", "false");
|
||||
config->set_property("SignalSource.BW_BB", "0.97");
|
||||
|
||||
config->set_property("InputFilter.implementation", "Fir_Filter");
|
||||
config->set_property("InputFilter.implementation", "Freq_Xlating_Fir_Filter");
|
||||
config->set_property("InputFilter.input_item_type", "gr_complex");
|
||||
config->set_property("InputFilter.output_item_type", "gr_complex");
|
||||
config->set_property("InputFilter.taps_item_type", "float");
|
||||
@@ -244,9 +244,10 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_1()
|
||||
config->set_property("InputFilter.band2_error", "1.0");
|
||||
config->set_property("InputFilter.filter_type", "bandpass");
|
||||
config->set_property("InputFilter.grid_density", "16");
|
||||
config->set_property("InputFilter.sampling_frequency", std::to_string(fs_in));
|
||||
config->set_property("InputFilter.IF", "4000000");
|
||||
|
||||
config->set_property("Acquisition.item_type", "gr_complex");
|
||||
config->set_property("Acquisition.if", "4000000");
|
||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition.max_dwells", "1");
|
||||
@@ -314,7 +315,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_2()
|
||||
config->set_property("SignalSource.data_flag", "true");
|
||||
config->set_property("SignalSource.BW_BB", "0.97");
|
||||
|
||||
config->set_property("InputFilter.implementation", "Fir_Filter");
|
||||
config->set_property("InputFilter.implementation", "Freq_Xlating_Fir_Filter");
|
||||
config->set_property("InputFilter.input_item_type", "gr_complex");
|
||||
config->set_property("InputFilter.output_item_type", "gr_complex");
|
||||
config->set_property("InputFilter.taps_item_type", "float");
|
||||
@@ -332,9 +333,10 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_2()
|
||||
config->set_property("InputFilter.band2_error", "1.0");
|
||||
config->set_property("InputFilter.filter_type", "bandpass");
|
||||
config->set_property("InputFilter.grid_density", "16");
|
||||
config->set_property("InputFilter.sampling_frequency", std::to_string(fs_in));
|
||||
config->set_property("InputFilter.IF", "4000000");
|
||||
|
||||
config->set_property("Acquisition.item_type", "gr_complex");
|
||||
config->set_property("Acquisition.if", "4000000");
|
||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition.max_dwells", "1");
|
||||
@@ -429,7 +431,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::stop_queue()
|
||||
TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0);
|
||||
delete acquisition;
|
||||
}
|
||||
|
||||
@@ -443,7 +445,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ConnectAndRun)
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
config_1();
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx> msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -474,7 +476,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults)
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx> msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -505,12 +507,11 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults)
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
||||
signal_source->connect(top_block);
|
||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||
std::shared_ptr<SignalGenerator> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue);
|
||||
std::shared_ptr<FreqXlatingFirFilter> filter = std::make_shared<FreqXlatingFirFilter>(config.get(), "InputFilter", 1, 1);
|
||||
signal_generator->connect(top_block);
|
||||
top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0);
|
||||
top_block->connect(filter->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
// i = 0 --> satellite in acquisition is visible
|
||||
@@ -569,51 +570,43 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities)
|
||||
config_2();
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx> msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_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;
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step."
|
||||
<< std::endl;
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
||||
}) << "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();
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
||||
signal_source->connect(top_block);
|
||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||
}) << "Failure connecting the blocks of acquisition test."
|
||||
<< std::endl;
|
||||
std::shared_ptr<SignalGenerator> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue);
|
||||
std::shared_ptr<FreqXlatingFirFilter> filter = std::make_shared<FreqXlatingFirFilter>(config.get(), "InputFilter", 1, 1);
|
||||
signal_generator->connect(top_block);
|
||||
top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0);
|
||||
top_block->connect(filter->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "in_memory_configuration.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "freq_xlating_fir_filter.h"
|
||||
#include "glonass_l1_ca_pcps_acquisition.h"
|
||||
|
||||
|
||||
@@ -138,8 +139,26 @@ void GlonassL1CaPcpsAcquisitionTest::init()
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
gnss_synchro.PRN = 1;
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", "62314000");
|
||||
config->set_property("InputFilter.IF", "9540000");
|
||||
config->set_property("InputFilter.input_item_type", "gr_complex");
|
||||
config->set_property("InputFilter.output_item_type", "gr_complex");
|
||||
config->set_property("InputFilter.taps_item_type", "float");
|
||||
config->set_property("InputFilter.number_of_taps", "11");
|
||||
config->set_property("InputFilter.number_of_bands", "2");
|
||||
config->set_property("InputFilter.band1_begin", "0.0");
|
||||
config->set_property("InputFilter.band1_end", "0.97");
|
||||
config->set_property("InputFilter.band2_begin", "0.98");
|
||||
config->set_property("InputFilter.band2_end", "1.0");
|
||||
config->set_property("InputFilter.ampl1_begin", "1.0");
|
||||
config->set_property("InputFilter.ampl1_end", "1.0");
|
||||
config->set_property("InputFilter.ampl2_begin", "0.0");
|
||||
config->set_property("InputFilter.ampl2_end", "0.0");
|
||||
config->set_property("InputFilter.band1_error", "1.0");
|
||||
config->set_property("InputFilter.band2_error", "1.0");
|
||||
config->set_property("InputFilter.filter_type", "bandpass");
|
||||
config->set_property("InputFilter.grid_density", "16");
|
||||
config->set_property("InputFilter.sampling_frequency", "62314000");
|
||||
config->set_property("Acquisition_1G.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1G.if", "9540000");
|
||||
config->set_property("Acquisition_1G.coherent_integration_time_ms", "1");
|
||||
config->set_property("Acquisition_1G.dump", "true");
|
||||
config->set_property("Acquisition_1G.dump_filename", "./acquisition");
|
||||
@@ -155,7 +174,7 @@ void GlonassL1CaPcpsAcquisitionTest::init()
|
||||
TEST_F(GlonassL1CaPcpsAcquisitionTest, Instantiate)
|
||||
{
|
||||
init();
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisition> acquisition = boost::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition_1G", 1, 1);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisition> acquisition = boost::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition_1G", 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +188,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ConnectAndRun)
|
||||
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
init();
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisition> acquisition = boost::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition_1G", 1, 1);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisition> acquisition = boost::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition_1G", 1, 0);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GlonassL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -201,8 +220,8 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
double expected_delay_samples = 31874;
|
||||
double expected_doppler_hz = -9500;
|
||||
init();
|
||||
std::shared_ptr<GlonassL1CaPcpsAcquisition> acquisition = std::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition_1G", 1, 1);
|
||||
|
||||
std::shared_ptr<GlonassL1CaPcpsAcquisition> acquisition = std::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition_1G", 1, 0);
|
||||
std::shared_ptr<FreqXlatingFirFilter> input_filter = std::make_shared<FreqXlatingFirFilter>(config.get(), "InputFilter", 1, 1);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GlonassL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -238,7 +257,8 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
std::string file = path + "signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat";
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
||||
top_block->connect(file_source, 0, input_filter->get_left_block(), 0);
|
||||
top_block->connect(input_filter->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
|
||||
@@ -245,7 +245,6 @@ void GlonassL2CaPcpsAcquisitionTest::config_1()
|
||||
config->set_property("InputFilter.grid_density", "16");
|
||||
|
||||
config->set_property("Acquisition_2G.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_2G.if", "4000000");
|
||||
config->set_property("Acquisition_2G.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_2G.max_dwells", "1");
|
||||
@@ -333,7 +332,6 @@ void GlonassL2CaPcpsAcquisitionTest::config_2()
|
||||
config->set_property("InputFilter.grid_density", "16");
|
||||
|
||||
config->set_property("Acquisition_2G.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_2G.if", "4000000");
|
||||
config->set_property("Acquisition_2G.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_2G.max_dwells", "1");
|
||||
@@ -428,7 +426,7 @@ void GlonassL2CaPcpsAcquisitionTest::stop_queue()
|
||||
TEST_F(GlonassL2CaPcpsAcquisitionTest, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
||||
acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition", 1, 0);
|
||||
delete acquisition;
|
||||
}
|
||||
|
||||
@@ -442,7 +440,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ConnectAndRun)
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
config_1();
|
||||
acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 1);
|
||||
acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0);
|
||||
boost::shared_ptr<GlonassL2CaPcpsAcquisitionTest_msg_rx> msg_rx = GlonassL2CaPcpsAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -473,7 +471,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 1);
|
||||
acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0);
|
||||
boost::shared_ptr<GlonassL2CaPcpsAcquisitionTest_msg_rx> msg_rx = GlonassL2CaPcpsAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -568,7 +566,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResultsProbabilities)
|
||||
config_2();
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 1);
|
||||
acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0);
|
||||
boost::shared_ptr<GlonassL2CaPcpsAcquisitionTest_msg_rx> msg_rx = GlonassL2CaPcpsAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
|
||||
@@ -0,0 +1,900 @@
|
||||
/*!
|
||||
* \file gps_l1_acq_performance_test.cc
|
||||
* \brief This class implements an acquisition performance test
|
||||
* \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.cat
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "test_flags.h"
|
||||
#include "signal_generator_flags.h"
|
||||
#include "tracking_true_obs_reader.h"
|
||||
#include "true_observables_reader.h"
|
||||
#include "display.h"
|
||||
#include "gnuplot_i.h"
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <gnuradio/top_block.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
DEFINE_string(config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test.");
|
||||
DEFINE_string(acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used.");
|
||||
|
||||
DEFINE_int32(acq_test_doppler_max, 5000, "Maximum Doppler, in Hz");
|
||||
DEFINE_int32(acq_test_doppler_step, 125, "Doppler step, in Hz.");
|
||||
DEFINE_int32(acq_test_coherent_time_ms, 1, "Acquisition coherent time, in ms");
|
||||
DEFINE_int32(acq_test_max_dwells, 1, "Number of non-coherent integrations");
|
||||
DEFINE_bool(acq_test_use_CFAR_algorithm, true, "Use CFAR algorithm");
|
||||
DEFINE_bool(acq_test_bit_transition_flag, false, "Bit transition flag");
|
||||
|
||||
DEFINE_int32(acq_test_signal_duration_s, 2, "Generated signal duration, in s");
|
||||
DEFINE_int32(acq_test_num_meas, 0, "Number of measurements per run. 0 means the complete file.");
|
||||
DEFINE_double(acq_test_cn0_init, 33.0, "Initial CN0, in dBHz.");
|
||||
DEFINE_double(acq_test_cn0_final, 45.0, "Final CN0, in dBHz.");
|
||||
DEFINE_double(acq_test_cn0_step, 3.0, "CN0 step, in dB.");
|
||||
|
||||
DEFINE_double(acq_test_threshold_init, 11.0, "Initial acquisition threshold");
|
||||
DEFINE_double(acq_test_threshold_final, 16.0, "Final acquisition threshold");
|
||||
DEFINE_double(acq_test_threshold_step, 1.0, "Acquisition threshold step");
|
||||
|
||||
DEFINE_double(acq_test_pfa_init, 1e-5, "Set initial threshold via probability of false alarm. Disable with -1.0");
|
||||
|
||||
DEFINE_int32(acq_test_PRN, 1, "PRN number of a present satellite");
|
||||
DEFINE_int32(acq_test_fake_PRN, 33, "PRN number of a non-present satellite");
|
||||
|
||||
DEFINE_int32(acq_test_iterations, 1, "Number of iterations (same signal, different noise realization)");
|
||||
DEFINE_bool(plot_acq_test, false, "Plots results with gnuplot, if available");
|
||||
|
||||
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
||||
class AcqPerfTest_msg_rx;
|
||||
|
||||
typedef boost::shared_ptr<AcqPerfTest_msg_rx> AcqPerfTest_msg_rx_sptr;
|
||||
|
||||
AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(concurrent_queue<int>& queue);
|
||||
|
||||
class AcqPerfTest_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(concurrent_queue<int>& queue);
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
AcqPerfTest_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~AcqPerfTest_msg_rx();
|
||||
};
|
||||
|
||||
|
||||
AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(concurrent_queue<int>& queue)
|
||||
{
|
||||
return AcqPerfTest_msg_rx_sptr(new AcqPerfTest_msg_rx(queue));
|
||||
}
|
||||
|
||||
|
||||
void AcqPerfTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AcqPerfTest_msg_rx::AcqPerfTest_msg_rx(concurrent_queue<int>& queue) : gr::block("AcqPerfTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&AcqPerfTest_msg_rx::msg_handler_events, this, _1));
|
||||
rx_message = 0;
|
||||
}
|
||||
|
||||
|
||||
AcqPerfTest_msg_rx::~AcqPerfTest_msg_rx()
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
|
||||
|
||||
class AcquisitionPerformanceTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
AcquisitionPerformanceTest()
|
||||
{
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
item_size = sizeof(gr_complex);
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
doppler_max = static_cast<unsigned int>(FLAGS_acq_test_doppler_max);
|
||||
doppler_step = static_cast<unsigned int>(FLAGS_acq_test_doppler_step);
|
||||
stop = false;
|
||||
if (FLAGS_acq_test_input_file.empty())
|
||||
{
|
||||
cn0_vector.push_back(FLAGS_acq_test_cn0_init);
|
||||
double aux = FLAGS_acq_test_cn0_init + FLAGS_acq_test_cn0_step;
|
||||
while (aux <= FLAGS_acq_test_cn0_final)
|
||||
{
|
||||
cn0_vector.push_back(aux);
|
||||
aux = aux + FLAGS_acq_test_cn0_step;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cn0_vector = {0.0};
|
||||
}
|
||||
init();
|
||||
|
||||
if (FLAGS_acq_test_pfa_init > 0.0)
|
||||
{
|
||||
pfa_vector.push_back(FLAGS_acq_test_pfa_init);
|
||||
float aux = 1.0;
|
||||
while ((FLAGS_acq_test_pfa_init * std::pow(10, aux)) < 1)
|
||||
{
|
||||
pfa_vector.push_back(FLAGS_acq_test_pfa_init * std::pow(10, aux));
|
||||
aux = aux + 1.0;
|
||||
}
|
||||
pfa_vector.push_back(1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
float aux = static_cast<float>(FLAGS_acq_test_threshold_init);
|
||||
pfa_vector.push_back(aux);
|
||||
aux = aux + static_cast<float>(FLAGS_acq_test_threshold_step);
|
||||
while (aux <= static_cast<float>(FLAGS_acq_test_threshold_final))
|
||||
{
|
||||
pfa_vector.push_back(aux);
|
||||
aux = aux + static_cast<float>(FLAGS_acq_test_threshold_step);
|
||||
}
|
||||
}
|
||||
|
||||
num_thresholds = pfa_vector.size();
|
||||
|
||||
int aux2 = ((generated_signal_duration_s * 1000 - FLAGS_acq_test_coherent_time_ms) / FLAGS_acq_test_coherent_time_ms);
|
||||
if ((FLAGS_acq_test_num_meas > 0) and (FLAGS_acq_test_num_meas < aux2))
|
||||
{
|
||||
num_of_measurements = static_cast<unsigned int>(FLAGS_acq_test_num_meas);
|
||||
}
|
||||
else
|
||||
{
|
||||
num_of_measurements = static_cast<unsigned int>(aux2);
|
||||
}
|
||||
|
||||
Pd.resize(cn0_vector.size());
|
||||
for (int i = 0; i < static_cast<int>(cn0_vector.size()); i++) Pd[i].reserve(num_thresholds);
|
||||
Pfa.resize(cn0_vector.size());
|
||||
for (int i = 0; i < static_cast<int>(cn0_vector.size()); i++) Pfa[i].reserve(num_thresholds);
|
||||
Pd_correct.resize(cn0_vector.size());
|
||||
for (int i = 0; i < static_cast<int>(cn0_vector.size()); i++) Pd_correct[i].reserve(num_thresholds);
|
||||
}
|
||||
|
||||
~AcquisitionPerformanceTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::vector<double> cn0_vector;
|
||||
std::vector<float> pfa_vector;
|
||||
|
||||
int N_iterations = FLAGS_acq_test_iterations;
|
||||
void init();
|
||||
|
||||
int configure_generator(double cn0);
|
||||
int generate_signal();
|
||||
int configure_receiver(double cn0, float pfa, unsigned int iter);
|
||||
void start_queue();
|
||||
void wait_message();
|
||||
void process_message();
|
||||
void stop_queue();
|
||||
int run_receiver();
|
||||
int count_executions(const std::string& basename, unsigned int sat);
|
||||
void check_results();
|
||||
void plot_results();
|
||||
|
||||
concurrent_queue<int> channel_internal_queue;
|
||||
|
||||
gr::msg_queue::sptr queue;
|
||||
gr::top_block_sptr top_block;
|
||||
std::shared_ptr<GpsL1CaPcpsAcquisition> acquisition;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
std::shared_ptr<FileConfiguration> config_f;
|
||||
Gnss_Synchro gnss_synchro;
|
||||
size_t item_size;
|
||||
unsigned int doppler_max;
|
||||
unsigned int doppler_step;
|
||||
bool stop;
|
||||
|
||||
int message;
|
||||
boost::thread ch_thread;
|
||||
|
||||
std::string implementation = "GPS_L1_CA_PCPS_Acquisition";
|
||||
|
||||
const double baseband_sampling_freq = static_cast<double>(FLAGS_fs_gen_sps);
|
||||
const int coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms;
|
||||
const int in_acquisition = 1;
|
||||
const int dump_channel = 0;
|
||||
|
||||
int generated_signal_duration_s = FLAGS_acq_test_signal_duration_s;
|
||||
unsigned int num_of_measurements;
|
||||
unsigned int measurement_counter = 0;
|
||||
|
||||
unsigned int observed_satellite = FLAGS_acq_test_PRN;
|
||||
std::string path_str = "./acq-perf-test";
|
||||
|
||||
int num_thresholds;
|
||||
|
||||
std::vector<std::vector<float>> Pd;
|
||||
std::vector<std::vector<float>> Pfa;
|
||||
std::vector<std::vector<float>> Pd_correct;
|
||||
|
||||
private:
|
||||
std::string generator_binary;
|
||||
std::string p1;
|
||||
std::string p2;
|
||||
std::string p3;
|
||||
std::string p4;
|
||||
std::string p5;
|
||||
std::string p6;
|
||||
|
||||
std::string filename_rinex_obs = FLAGS_filename_rinex_obs;
|
||||
std::string filename_raw_data = FLAGS_filename_raw_data;
|
||||
|
||||
double compute_stdev_precision(const std::vector<double>& vec);
|
||||
double compute_stdev_accuracy(const std::vector<double>& vec, double ref);
|
||||
};
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::init()
|
||||
{
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
gnss_synchro.PRN = observed_satellite;
|
||||
message = 0;
|
||||
measurement_counter = 0;
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::start_queue()
|
||||
{
|
||||
stop = false;
|
||||
ch_thread = boost::thread(&AcquisitionPerformanceTest::wait_message, this);
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::wait_message()
|
||||
{
|
||||
while (!stop)
|
||||
{
|
||||
channel_internal_queue.wait_and_pop(message);
|
||||
process_message();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::process_message()
|
||||
{
|
||||
measurement_counter++;
|
||||
acquisition->reset();
|
||||
acquisition->set_state(1);
|
||||
std::cout << "Progress: " << round(static_cast<float>(measurement_counter) / static_cast<float>(num_of_measurements) * 100.0) << "% \r" << std::flush;
|
||||
if (measurement_counter == num_of_measurements)
|
||||
{
|
||||
stop_queue();
|
||||
top_block->stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::stop_queue()
|
||||
{
|
||||
stop = true;
|
||||
}
|
||||
|
||||
|
||||
int AcquisitionPerformanceTest::configure_generator(double cn0)
|
||||
{
|
||||
// Configure signal generator
|
||||
generator_binary = FLAGS_generator_binary;
|
||||
|
||||
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
|
||||
if (FLAGS_dynamic_position.empty())
|
||||
{
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(std::min(generated_signal_duration_s * 10, 3000));
|
||||
}
|
||||
else
|
||||
{
|
||||
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
|
||||
}
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps]
|
||||
p6 = std::string("-CN0_dBHz=") + std::to_string(cn0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int AcquisitionPerformanceTest::generate_signal()
|
||||
{
|
||||
pid_t wait_result;
|
||||
int child_status;
|
||||
std::cout << "Generating signal for " << p6 << "..." << std::endl;
|
||||
char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], &p6[0], NULL};
|
||||
|
||||
int pid;
|
||||
if ((pid = fork()) == -1)
|
||||
perror("fork error");
|
||||
else if (pid == 0)
|
||||
{
|
||||
execv(&generator_binary[0], parmList);
|
||||
std::cout << "Return not expected. Must be an execv error." << std::endl;
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
wait_result = waitpid(pid, &child_status, 0);
|
||||
if (wait_result == -1) perror("waitpid error");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsigned int iter)
|
||||
{
|
||||
if (FLAGS_config_file_ptest.empty())
|
||||
{
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
const int sampling_rate_internal = baseband_sampling_freq;
|
||||
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal));
|
||||
|
||||
// Set Acquisition
|
||||
config->set_property("Acquisition_1C.implementation", implementation);
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
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.threshold", std::to_string(pfa));
|
||||
//if (FLAGS_acq_test_pfa_init > 0.0) config->supersede_property("Acquisition_1C.pfa", std::to_string(pfa));
|
||||
if (FLAGS_acq_test_pfa_init > 0.0)
|
||||
{
|
||||
config->supersede_property("Acquisition_1C.pfa", std::to_string(pfa));
|
||||
}
|
||||
if (FLAGS_acq_test_use_CFAR_algorithm)
|
||||
{
|
||||
config->set_property("Acquisition_1C.use_CFAR_algorithm", "true");
|
||||
}
|
||||
else
|
||||
{
|
||||
config->set_property("Acquisition_1C.use_CFAR_algorithm", "false");
|
||||
}
|
||||
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms));
|
||||
if (FLAGS_acq_test_bit_transition_flag)
|
||||
{
|
||||
config->set_property("Acquisition_1C.bit_transition_flag", "true");
|
||||
}
|
||||
else
|
||||
{
|
||||
config->set_property("Acquisition_1C.bit_transition_flag", "false");
|
||||
}
|
||||
|
||||
config->set_property("Acquisition_1C.max_dwells", std::to_string(FLAGS_acq_test_max_dwells));
|
||||
|
||||
config->set_property("Acquisition_1C.repeat_satellite", "true");
|
||||
|
||||
config->set_property("Acquisition_1C.blocking", "true");
|
||||
config->set_property("Acquisition_1C.make_two_steps", "false");
|
||||
config->set_property("Acquisition_1C.second_nbins", std::to_string(4));
|
||||
config->set_property("Acquisition_1C.second_doppler_step", std::to_string(125));
|
||||
|
||||
config->set_property("Acquisition_1C.dump", "true");
|
||||
std::string dump_file = path_str + std::string("/acquisition_") + std::to_string(cn0) + "_" + std::to_string(iter) + "_" + std::to_string(pfa);
|
||||
config->set_property("Acquisition_1C.dump_filename", dump_file);
|
||||
config->set_property("Acquisition_1C.dump_channel", std::to_string(dump_channel));
|
||||
config->set_property("Acquisition_1C.blocking_on_standby", "true");
|
||||
|
||||
config_f = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
config_f = std::make_shared<FileConfiguration>(FLAGS_config_file_ptest);
|
||||
config = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int AcquisitionPerformanceTest::run_receiver()
|
||||
{
|
||||
std::string file;
|
||||
if (FLAGS_acq_test_input_file.empty())
|
||||
{
|
||||
file = "./" + filename_raw_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
file = FLAGS_acq_test_input_file;
|
||||
}
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false);
|
||||
|
||||
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
boost::shared_ptr<AcqPerfTest_msg_rx> msg_rx = AcqPerfTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
queue = gr::msg_queue::make(0);
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
init();
|
||||
|
||||
int nsamples = floor(config->property("GNSS-SDR.internal_fs_sps", 2000000) * generated_signal_duration_s);
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
|
||||
acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
acquisition->set_channel(0);
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->connect(top_block);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
|
||||
acquisition->init();
|
||||
|
||||
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
|
||||
top_block->connect(gr_interleaved_char_to_complex, 0, valve, 0);
|
||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||
|
||||
start_queue();
|
||||
|
||||
top_block->run(); // Start threads and wait
|
||||
|
||||
#ifdef OLD_BOOST
|
||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||
#endif
|
||||
#ifndef OLD_BOOST
|
||||
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int AcquisitionPerformanceTest::count_executions(const std::string& basename, unsigned int sat)
|
||||
{
|
||||
FILE* fp;
|
||||
std::string argum2 = std::string("/usr/bin/find ") + path_str + std::string(" -maxdepth 1 -name ") + basename.substr(path_str.length() + 1, basename.length() - path_str.length()) + std::string("* | grep sat_") + std::to_string(sat) + std::string(" | wc -l");
|
||||
char buffer[1024];
|
||||
fp = popen(&argum2[0], "r");
|
||||
int num_executions = 1;
|
||||
if (fp == NULL)
|
||||
{
|
||||
std::cout << "Failed to run command: " << argum2 << std::endl;
|
||||
return 0;
|
||||
}
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL)
|
||||
{
|
||||
std::string aux = std::string(buffer);
|
||||
EXPECT_EQ(aux.empty(), false);
|
||||
num_executions = std::stoi(aux);
|
||||
}
|
||||
pclose(fp);
|
||||
return num_executions;
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::plot_results()
|
||||
{
|
||||
if (FLAGS_plot_acq_test == true)
|
||||
{
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test 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
|
||||
{
|
||||
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("linespoints");
|
||||
g1.cmd("set font \"Times,18\"");
|
||||
g1.set_title("Receiver Operating Characteristic for GPS L1 C/A acquisition");
|
||||
g1.cmd("set label 1 \"" + std::string("Coherent integration time: ") + std::to_string(config->property("Acquisition_1C.coherent_integration_time_ms", 1)) + " ms, Non-coherent integrations: " + std::to_string(config->property("Acquisition_1C.max_dwells", 1)) + " \" at screen 0.12, 0.83 font \"Times,16\"");
|
||||
g1.cmd("set logscale x");
|
||||
g1.cmd("set yrange [0:1]");
|
||||
g1.cmd("set xrange[0.0001:1]");
|
||||
g1.cmd("set grid mxtics");
|
||||
g1.cmd("set grid ytics");
|
||||
g1.set_xlabel("Pfa");
|
||||
g1.set_ylabel("Pd");
|
||||
g1.set_grid();
|
||||
g1.cmd("show grid");
|
||||
for (int i = 0; i < static_cast<int>(cn0_vector.size()); i++)
|
||||
{
|
||||
std::vector<float> Pd_i;
|
||||
std::vector<float> Pfa_i;
|
||||
for (int k = 0; k < num_thresholds; k++)
|
||||
{
|
||||
Pd_i.push_back(Pd[i][k]);
|
||||
Pfa_i.push_back(Pfa[i][k]);
|
||||
}
|
||||
g1.plot_xy(Pfa_i, Pd_i, "CN0 = " + std::to_string(static_cast<int>(cn0_vector[i])) + " dBHz");
|
||||
}
|
||||
g1.set_legend();
|
||||
g1.savetops("ROC");
|
||||
g1.savetopdf("ROC", 18);
|
||||
if (FLAGS_show_plots) g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("linespoints");
|
||||
g2.cmd("set font \"Times,18\"");
|
||||
g2.set_title("Receiver Operating Characteristic for GPS L1 C/A valid acquisition");
|
||||
g2.cmd("set label 1 \"" + std::string("Coherent integration time: ") + std::to_string(config->property("Acquisition_1C.coherent_integration_time_ms", 1)) + " ms, Non-coherent integrations: " + std::to_string(config->property("Acquisition_1C.max_dwells", 1)) + " \" at screen 0.12, 0.83 font \"Times,16\"");
|
||||
g2.cmd("set logscale x");
|
||||
g2.cmd("set yrange [0:1]");
|
||||
g2.cmd("set xrange[0.0001:1]");
|
||||
g2.cmd("set grid mxtics");
|
||||
g2.cmd("set grid ytics");
|
||||
g2.set_xlabel("Pfa");
|
||||
g2.set_ylabel("Valid Pd");
|
||||
g2.set_grid();
|
||||
g2.cmd("show grid");
|
||||
for (int i = 0; i < static_cast<int>(cn0_vector.size()); i++)
|
||||
{
|
||||
std::vector<float> Pd_i_correct;
|
||||
std::vector<float> Pfa_i;
|
||||
for (int k = 0; k < num_thresholds; k++)
|
||||
{
|
||||
Pd_i_correct.push_back(Pd_correct[i][k]);
|
||||
Pfa_i.push_back(Pfa[i][k]);
|
||||
}
|
||||
g2.plot_xy(Pfa_i, Pd_i_correct, "CN0 = " + std::to_string(static_cast<int>(cn0_vector[i])) + " dBHz");
|
||||
}
|
||||
g2.set_legend();
|
||||
g2.savetops("ROC-valid-detection");
|
||||
g2.savetopdf("ROC-valid-detection", 18);
|
||||
if (FLAGS_show_plots) g2.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_F(AcquisitionPerformanceTest, ROC)
|
||||
{
|
||||
tracking_true_obs_reader true_trk_data;
|
||||
|
||||
if (boost::filesystem::exists(path_str))
|
||||
{
|
||||
boost::filesystem::remove_all(path_str);
|
||||
}
|
||||
boost::system::error_code ec;
|
||||
ASSERT_TRUE(boost::filesystem::create_directory(path_str, ec)) << "Could not create the " << path_str << " folder.";
|
||||
|
||||
unsigned int cn0_index = 0;
|
||||
for (std::vector<double>::const_iterator it = cn0_vector.cbegin(); it != cn0_vector.cend(); ++it)
|
||||
{
|
||||
std::vector<double> meas_Pd_;
|
||||
std::vector<double> meas_Pd_correct_;
|
||||
std::vector<double> meas_Pfa_;
|
||||
|
||||
if (FLAGS_acq_test_input_file.empty()) std::cout << "Execution for CN0 = " << *it << " dB-Hz" << std::endl;
|
||||
|
||||
// Do N_iterations of the experiment
|
||||
for (int pfa_iter = 0; pfa_iter < static_cast<int>(pfa_vector.size()); pfa_iter++)
|
||||
{
|
||||
if (FLAGS_acq_test_pfa_init > 0.0)
|
||||
{
|
||||
std::cout << "Setting threshold for Pfa = " << pfa_vector[pfa_iter] << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Setting threshold to " << pfa_vector[pfa_iter] << std::endl;
|
||||
}
|
||||
|
||||
// Configure the signal generator
|
||||
if (FLAGS_acq_test_input_file.empty()) configure_generator(*it);
|
||||
|
||||
for (int iter = 0; iter < N_iterations; iter++)
|
||||
{
|
||||
// Generate signal raw signal samples and observations RINEX file
|
||||
if (FLAGS_acq_test_input_file.empty()) generate_signal();
|
||||
|
||||
for (unsigned k = 0; k < 2; k++)
|
||||
{
|
||||
if (k == 0)
|
||||
{
|
||||
observed_satellite = FLAGS_acq_test_PRN;
|
||||
}
|
||||
else
|
||||
{
|
||||
observed_satellite = FLAGS_acq_test_fake_PRN;
|
||||
}
|
||||
init();
|
||||
|
||||
// Configure the receiver
|
||||
configure_receiver(*it, pfa_vector[pfa_iter], iter);
|
||||
|
||||
// Run it
|
||||
run_receiver();
|
||||
|
||||
// count executions
|
||||
std::string basename = path_str + std::string("/acquisition_") + std::to_string(*it) + "_" + std::to_string(iter) + "_" + std::to_string(pfa_vector[pfa_iter]) + "_" + gnss_synchro.System + "_1C";
|
||||
int num_executions = count_executions(basename, observed_satellite);
|
||||
|
||||
// Read measured data
|
||||
int ch = config->property("Acquisition_1C.dump_channel", 0);
|
||||
arma::vec meas_timestamp_s = arma::zeros(num_executions, 1);
|
||||
arma::vec meas_doppler = arma::zeros(num_executions, 1);
|
||||
arma::vec positive_acq = arma::zeros(num_executions, 1);
|
||||
arma::vec meas_acq_delay_chips = arma::zeros(num_executions, 1);
|
||||
|
||||
double coh_time_ms = config->property("Acquisition_1C.coherent_integration_time_ms", 1);
|
||||
|
||||
std::cout << "Num executions: " << num_executions << std::endl;
|
||||
for (int execution = 1; execution <= num_executions; execution++)
|
||||
{
|
||||
acquisition_dump_reader acq_dump(basename, observed_satellite, config->property("Acquisition_1C.doppler_max", 0), config->property("Acquisition_1C.doppler_step", 0), config->property("GNSS-SDR.internal_fs_sps", 0) * GPS_L1_CA_CODE_PERIOD * static_cast<double>(coh_time_ms), ch, execution);
|
||||
acq_dump.read_binary_acq();
|
||||
if (acq_dump.positive_acq)
|
||||
{
|
||||
//std::cout << "Meas acq_delay_samples: " << acq_dump.acq_delay_samples << " chips: " << acq_dump.acq_delay_samples / (baseband_sampling_freq * GPS_L1_CA_CODE_PERIOD / GPS_L1_CA_CODE_LENGTH_CHIPS) << std::endl;
|
||||
meas_timestamp_s(execution - 1) = acq_dump.sample_counter / baseband_sampling_freq;
|
||||
meas_doppler(execution - 1) = acq_dump.acq_doppler_hz;
|
||||
meas_acq_delay_chips(execution - 1) = acq_dump.acq_delay_samples / (baseband_sampling_freq * GPS_L1_CA_CODE_PERIOD / GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||
positive_acq(execution - 1) = acq_dump.positive_acq;
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "Failed acquisition." << std::endl;
|
||||
meas_timestamp_s(execution - 1) = arma::datum::inf;
|
||||
meas_doppler(execution - 1) = arma::datum::inf;
|
||||
meas_acq_delay_chips(execution - 1) = arma::datum::inf;
|
||||
positive_acq(execution - 1) = acq_dump.positive_acq;
|
||||
}
|
||||
}
|
||||
|
||||
// Read reference data
|
||||
std::string true_trk_file = std::string("./gps_l1_ca_obs_prn");
|
||||
true_trk_file.append(std::to_string(observed_satellite));
|
||||
true_trk_file.append(".dat");
|
||||
true_trk_data.close_obs_file();
|
||||
true_trk_data.open_obs_file(true_trk_file);
|
||||
|
||||
// load the true values
|
||||
long int n_true_epochs = true_trk_data.num_epochs();
|
||||
arma::vec true_timestamp_s = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_acc_carrier_phase_cycles = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_Doppler_Hz = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_prn_delay_chips = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_tow_s = arma::zeros(n_true_epochs, 1);
|
||||
|
||||
long int epoch_counter = 0;
|
||||
int num_clean_executions = 0;
|
||||
while (true_trk_data.read_binary_obs())
|
||||
{
|
||||
true_timestamp_s(epoch_counter) = true_trk_data.signal_timestamp_s;
|
||||
true_acc_carrier_phase_cycles(epoch_counter) = true_trk_data.acc_carrier_phase_cycles;
|
||||
true_Doppler_Hz(epoch_counter) = true_trk_data.doppler_l1_hz;
|
||||
true_prn_delay_chips(epoch_counter) = GPS_L1_CA_CODE_LENGTH_CHIPS - true_trk_data.prn_delay_chips;
|
||||
true_tow_s(epoch_counter) = true_trk_data.tow;
|
||||
epoch_counter++;
|
||||
//std::cout << "True PRN_Delay chips = " << GPS_L1_CA_CODE_LENGTH_CHIPS - true_trk_data.prn_delay_chips << " at " << true_trk_data.signal_timestamp_s << std::endl;
|
||||
}
|
||||
|
||||
// Process results
|
||||
arma::vec clean_doppler_estimation_error;
|
||||
arma::vec clean_delay_estimation_error;
|
||||
|
||||
if (epoch_counter > 2)
|
||||
{
|
||||
arma::vec true_interpolated_doppler = arma::zeros(num_executions, 1);
|
||||
arma::vec true_interpolated_prn_delay_chips = arma::zeros(num_executions, 1);
|
||||
interp1(true_timestamp_s, true_Doppler_Hz, meas_timestamp_s, true_interpolated_doppler);
|
||||
interp1(true_timestamp_s, true_prn_delay_chips, meas_timestamp_s, true_interpolated_prn_delay_chips);
|
||||
|
||||
arma::vec doppler_estimation_error = true_interpolated_doppler - meas_doppler;
|
||||
arma::vec delay_estimation_error = true_interpolated_prn_delay_chips - (meas_acq_delay_chips - ((1.0 / baseband_sampling_freq) / GPS_L1_CA_CHIP_PERIOD)); // compensate 1 sample delay
|
||||
|
||||
// Cut measurements without reference
|
||||
for (int i = 0; i < num_executions; i++)
|
||||
{
|
||||
if (!std::isnan(doppler_estimation_error(i)) and !std::isnan(delay_estimation_error(i)))
|
||||
{
|
||||
num_clean_executions++;
|
||||
}
|
||||
}
|
||||
clean_doppler_estimation_error = arma::zeros(num_clean_executions, 1);
|
||||
clean_delay_estimation_error = arma::zeros(num_clean_executions, 1);
|
||||
num_clean_executions = 0;
|
||||
for (int i = 0; i < num_executions; i++)
|
||||
{
|
||||
if (!std::isnan(doppler_estimation_error(i)) and !std::isnan(delay_estimation_error(i)))
|
||||
{
|
||||
clean_doppler_estimation_error(num_clean_executions) = doppler_estimation_error(i);
|
||||
clean_delay_estimation_error(num_clean_executions) = delay_estimation_error(i);
|
||||
num_clean_executions++;
|
||||
}
|
||||
}
|
||||
|
||||
/* std::cout << "Doppler estimation error [Hz]: ";
|
||||
for (int i = 0; i < num_executions - 1; i++)
|
||||
{
|
||||
std::cout << doppler_estimation_error(i) << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << "Delay estimation error [chips]: ";
|
||||
for (int i = 0; i < num_executions - 1; i++)
|
||||
{
|
||||
std::cout << delay_estimation_error(i) << " ";
|
||||
|
||||
}
|
||||
std::cout << std::endl; */
|
||||
}
|
||||
if (k == 0)
|
||||
{
|
||||
double detected = arma::accu(positive_acq);
|
||||
double computed_Pd = detected / static_cast<double>(num_executions);
|
||||
if (num_executions > 0)
|
||||
{
|
||||
meas_Pd_.push_back(computed_Pd);
|
||||
}
|
||||
else
|
||||
{
|
||||
meas_Pd_.push_back(0.0);
|
||||
}
|
||||
std::cout << TEXT_BOLD_BLACK << "Probability of detection for channel=" << ch << ", CN0=" << *it << " dBHz"
|
||||
<< ": " << (num_executions > 0 ? computed_Pd : 0.0) << TEXT_RESET << std::endl;
|
||||
}
|
||||
if (num_clean_executions > 0)
|
||||
{
|
||||
arma::vec correct_acq = arma::zeros(num_executions, 1);
|
||||
double correctly_detected = 0.0;
|
||||
for (int i = 0; i < num_clean_executions - 1; i++)
|
||||
|
||||
{
|
||||
if (abs(clean_delay_estimation_error(i)) < 0.5 and abs(clean_doppler_estimation_error(i)) < static_cast<float>(config->property("Acquisition_1C.doppler_step", 1)) / 2.0)
|
||||
{
|
||||
correctly_detected = correctly_detected + 1.0;
|
||||
}
|
||||
}
|
||||
double computed_Pd_correct = correctly_detected / static_cast<double>(num_clean_executions);
|
||||
meas_Pd_correct_.push_back(computed_Pd_correct);
|
||||
std::cout << TEXT_BOLD_BLACK << "Probability of correct detection for channel=" << ch << ", CN0=" << *it << " dBHz"
|
||||
<< ": " << computed_Pd_correct << TEXT_RESET << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "No reference data has been found. Maybe a non-present satellite?" << num_executions << std::endl;
|
||||
if (k == 1)
|
||||
{
|
||||
double wrongly_detected = arma::accu(positive_acq);
|
||||
double computed_Pfa = wrongly_detected / static_cast<double>(num_executions);
|
||||
if (num_executions > 0)
|
||||
{
|
||||
meas_Pfa_.push_back(computed_Pfa);
|
||||
}
|
||||
else
|
||||
{
|
||||
meas_Pfa_.push_back(0.0);
|
||||
}
|
||||
std::cout << TEXT_BOLD_BLACK << "Probability of false alarm for channel=" << ch << ", CN0=" << *it << " dBHz"
|
||||
<< ": " << (num_executions > 0 ? computed_Pfa : 0.0) << TEXT_RESET << std::endl;
|
||||
}
|
||||
}
|
||||
true_trk_data.restart();
|
||||
}
|
||||
}
|
||||
true_trk_data.close_obs_file();
|
||||
float sum_pd = static_cast<float>(std::accumulate(meas_Pd_.begin(), meas_Pd_.end(), 0.0));
|
||||
float sum_pd_correct = static_cast<float>(std::accumulate(meas_Pd_correct_.begin(), meas_Pd_correct_.end(), 0.0));
|
||||
float sum_pfa = static_cast<float>(std::accumulate(meas_Pfa_.begin(), meas_Pfa_.end(), 0.0));
|
||||
if (meas_Pd_.size() > 0 and meas_Pfa_.size() > 0)
|
||||
{
|
||||
Pd[cn0_index][pfa_iter] = sum_pd / static_cast<float>(meas_Pd_.size());
|
||||
Pfa[cn0_index][pfa_iter] = sum_pfa / static_cast<float>(meas_Pfa_.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (meas_Pd_.size() > 0)
|
||||
{
|
||||
Pd[cn0_index][pfa_iter] = sum_pd / static_cast<float>(meas_Pd_.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
Pd[cn0_index][pfa_iter] = 0.0;
|
||||
}
|
||||
if (meas_Pfa_.size() > 0)
|
||||
{
|
||||
Pfa[cn0_index][pfa_iter] = sum_pfa / static_cast<float>(meas_Pfa_.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
Pfa[cn0_index][pfa_iter] = 0.0;
|
||||
}
|
||||
}
|
||||
if (meas_Pd_correct_.size() > 0)
|
||||
{
|
||||
Pd_correct[cn0_index][pfa_iter] = sum_pd_correct / static_cast<float>(meas_Pd_correct_.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
Pd_correct[cn0_index][pfa_iter] = 0.0;
|
||||
}
|
||||
meas_Pd_.clear();
|
||||
meas_Pfa_.clear();
|
||||
meas_Pd_correct_.clear();
|
||||
}
|
||||
cn0_index++;
|
||||
}
|
||||
|
||||
// Compute results
|
||||
unsigned int aux_index = 0;
|
||||
for (std::vector<double>::const_iterator it = cn0_vector.cbegin(); it != cn0_vector.cend(); ++it)
|
||||
{
|
||||
std::cout << "Results for CN0 = " << *it << " dBHz:" << std::endl;
|
||||
std::cout << "Pd = ";
|
||||
for (int pfa_iter = 0; pfa_iter < num_thresholds; pfa_iter++)
|
||||
{
|
||||
std::cout << Pd[aux_index][pfa_iter] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << "Pd_correct = ";
|
||||
for (int pfa_iter = 0; pfa_iter < num_thresholds; pfa_iter++)
|
||||
{
|
||||
std::cout << Pd_correct[aux_index][pfa_iter] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << "Pfa = ";
|
||||
for (int pfa_iter = 0; pfa_iter < num_thresholds; pfa_iter++)
|
||||
{
|
||||
std::cout << Pfa[aux_index][pfa_iter] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
aux_index++;
|
||||
}
|
||||
|
||||
plot_results();
|
||||
}
|
||||
@@ -423,7 +423,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::stop_queue()
|
||||
TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0);
|
||||
delete acquisition;
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
config_1();
|
||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -468,7 +468,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -563,7 +563,7 @@ 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_1C", 1, 1);
|
||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
|
||||
@@ -160,6 +160,7 @@ void GpsL1CaPcpsAcquisitionTest::init()
|
||||
config->set_property("Acquisition_1C.dump", "false");
|
||||
}
|
||||
config->set_property("Acquisition_1C.dump_filename", "./tmp-acq-gps1/acquisition");
|
||||
config->set_property("Acquisition_1C.dump_channel", "1");
|
||||
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));
|
||||
@@ -175,7 +176,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
|
||||
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(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);
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code, 1);
|
||||
|
||||
if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
|
||||
@@ -209,7 +210,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
|
||||
|
||||
g1.savetops("GPS_L1_acq_grid");
|
||||
g1.savetopdf("GPS_L1_acq_grid");
|
||||
g1.showonscreen();
|
||||
if (FLAGS_show_plots) g1.showonscreen();
|
||||
}
|
||||
catch (const GnuplotException &ge)
|
||||
{
|
||||
@@ -227,7 +228,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
|
||||
TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate)
|
||||
{
|
||||
init();
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +242,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun)
|
||||
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
init();
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -285,7 +286,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
boost::filesystem::create_directory(data_str);
|
||||
}
|
||||
|
||||
std::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
std::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
|
||||
@@ -422,7 +422,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::stop_queue()
|
||||
TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
|
||||
config_1();
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -460,7 +460,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
{
|
||||
config_1();
|
||||
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -542,7 +542,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie
|
||||
{
|
||||
config_2();
|
||||
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
|
||||
@@ -534,7 +534,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::stop_queue()
|
||||
TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -548,7 +548,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun)
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
config_1();
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
@@ -575,7 +575,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults)
|
||||
config_1();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -669,7 +669,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise
|
||||
config_1();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -760,7 +760,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili
|
||||
config_2();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
|
||||
@@ -419,7 +419,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::stop_queue()
|
||||
TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, Instantiate)
|
||||
{
|
||||
config_1();
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -432,7 +432,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
queue = gr::msg_queue::make(0);
|
||||
|
||||
config_1();
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -461,7 +461,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
@@ -549,7 +549,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
||||
config_2();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
|
||||
@@ -163,7 +163,8 @@ void GpsL2MPcpsAcquisitionTest::init()
|
||||
{
|
||||
config->set_property("Acquisition_2S.dump", "false");
|
||||
}
|
||||
config->set_property("Acquisition_2S.dump_filename", "./tmp-acq-gps2/acquisition");
|
||||
config->set_property("Acquisition_2S.dump_filename", "./tmp-acq-gps2/acquisition_test");
|
||||
config->set_property("Acquisition_2S.dump_channel", "1");
|
||||
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));
|
||||
@@ -175,11 +176,11 @@ void GpsL2MPcpsAcquisitionTest::init()
|
||||
void GpsL2MPcpsAcquisitionTest::plot_grid()
|
||||
{
|
||||
//load the measured values
|
||||
std::string basename = "./tmp-acq-gps2/acquisition_G_2S";
|
||||
std::string basename = "./tmp-acq-gps2/acquisition_test_G_2S";
|
||||
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(floor(static_cast<double>(sampling_frequency_hz) / (GPS_L2_M_CODE_RATE_HZ / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS))));
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code);
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code, 1);
|
||||
if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
|
||||
std::vector<int> *doppler = &acq_dump.doppler;
|
||||
@@ -212,7 +213,7 @@ void GpsL2MPcpsAcquisitionTest::plot_grid()
|
||||
|
||||
g1.savetops("GPS_L2CM_acq_grid");
|
||||
g1.savetopdf("GPS_L2CM_acq_grid");
|
||||
g1.showonscreen();
|
||||
if (FLAGS_show_plots) g1.showonscreen();
|
||||
}
|
||||
catch (const GnuplotException &ge)
|
||||
{
|
||||
@@ -231,7 +232,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, Instantiate)
|
||||
{
|
||||
init();
|
||||
queue = gr::msg_queue::make(0);
|
||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 1);
|
||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +244,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun)
|
||||
queue = gr::msg_queue::make(0);
|
||||
|
||||
init();
|
||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 1);
|
||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 0);
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
@@ -285,7 +286,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults)
|
||||
}
|
||||
|
||||
init();
|
||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 1);
|
||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 0);
|
||||
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
|
||||
@@ -227,7 +227,7 @@ TEST_F(FirFilterTest, ConnectAndRunGrcomplex)
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue));
|
||||
source->connect(top_block);
|
||||
|
||||
boost::shared_ptr<gr::block> null_sink = gr::blocks::null_sink::make(item_size);
|
||||
@@ -268,7 +268,7 @@ TEST_F(FirFilterTest, ConnectAndRunCshorts)
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue));
|
||||
source->connect(top_block);
|
||||
|
||||
interleaved_short_to_complex_short_sptr ishort_to_cshort_ = make_interleaved_short_to_complex_short();
|
||||
@@ -312,7 +312,7 @@ TEST_F(FirFilterTest, ConnectAndRunCbytes)
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue));
|
||||
source->connect(top_block);
|
||||
|
||||
interleaved_byte_to_complex_byte_sptr ibyte_to_cbyte_ = make_interleaved_byte_to_complex_byte();
|
||||
@@ -356,7 +356,7 @@ TEST_F(FirFilterTest, ConnectAndRunCbyteGrcomplex)
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue));
|
||||
source->connect(top_block);
|
||||
|
||||
interleaved_byte_to_complex_byte_sptr ibyte_to_cbyte_ = make_interleaved_byte_to_complex_byte();
|
||||
|
||||
@@ -150,7 +150,7 @@ TEST_F(NotchFilterLiteTest, ConnectAndRunGrcomplex)
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue));
|
||||
source->connect(top_block);
|
||||
|
||||
boost::shared_ptr<gr::block> null_sink = gr::blocks::null_sink::make(item_size);
|
||||
|
||||
@@ -150,7 +150,7 @@ TEST_F(NotchFilterTest, ConnectAndRunGrcomplex)
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue));
|
||||
source->connect(top_block);
|
||||
|
||||
boost::shared_ptr<gr::block> null_sink = gr::blocks::null_sink::make(item_size);
|
||||
|
||||
@@ -149,7 +149,7 @@ TEST_F(PulseBlankingFilterTest, ConnectAndRunGrcomplex)
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue));
|
||||
source->connect(top_block);
|
||||
|
||||
boost::shared_ptr<gr::block> null_sink = gr::blocks::null_sink::make(item_size);
|
||||
|
||||
@@ -43,7 +43,7 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
matvar_t* var_ = Mat_VarRead(matfile, "grid");
|
||||
matvar_t* var_ = Mat_VarRead(matfile, "acq_grid");
|
||||
if (var_ == NULL)
|
||||
{
|
||||
std::cout << "¡¡¡Unreachable grid variable into Acquisition dump file!!!" << std::endl;
|
||||
@@ -73,16 +73,56 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
Mat_Close(matfile);
|
||||
return false;
|
||||
}
|
||||
matvar_t* var2_ = Mat_VarRead(matfile, "doppler_max");
|
||||
d_doppler_max = *static_cast<unsigned int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "doppler_step");
|
||||
d_doppler_step = *static_cast<unsigned int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "input_power");
|
||||
input_power = *static_cast<float*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "acq_doppler_hz");
|
||||
acq_doppler_hz = *static_cast<float*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "acq_delay_samples");
|
||||
acq_delay_samples = *static_cast<float*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "test_statistic");
|
||||
test_statistic = *static_cast<float*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "threshold");
|
||||
threshold = *static_cast<float*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "sample_counter");
|
||||
sample_counter = *static_cast<long unsigned int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "d_positive_acq");
|
||||
positive_acq = *static_cast<int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "PRN");
|
||||
PRN = *static_cast<int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
std::vector<std::vector<float> >::iterator it1;
|
||||
std::vector<float>::iterator it2;
|
||||
float* aux = static_cast<float*>(var_->data);
|
||||
int k = 0;
|
||||
float normalization_factor = std::pow(d_samples_per_code, 2);
|
||||
float normalization_factor = std::pow(d_samples_per_code, 4) * input_power;
|
||||
for (it1 = mag.begin(); it1 != mag.end(); it1++)
|
||||
{
|
||||
for (it2 = it1->begin(); it2 != it1->end(); it2++)
|
||||
{
|
||||
*it2 = static_cast<float>(std::sqrt(aux[k])) / normalization_factor;
|
||||
*it2 = static_cast<float>(aux[k]) / normalization_factor;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
@@ -93,17 +133,74 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
acquisition_dump_reader::acquisition_dump_reader(const std::string& basename,
|
||||
int channel,
|
||||
int execution)
|
||||
{
|
||||
unsigned int sat_ = 0;
|
||||
unsigned int doppler_max_ = 0;
|
||||
unsigned int doppler_step_ = 0;
|
||||
unsigned int samples_per_code_ = 0;
|
||||
|
||||
mat_t* matfile = Mat_Open(d_dump_filename.c_str(), MAT_ACC_RDONLY);
|
||||
if (matfile != NULL)
|
||||
{
|
||||
matvar_t* var_ = Mat_VarRead(matfile, "doppler_max");
|
||||
doppler_max_ = *static_cast<unsigned int*>(var_->data);
|
||||
Mat_VarFree(var_);
|
||||
|
||||
var_ = Mat_VarRead(matfile, "doppler_step");
|
||||
doppler_step_ = *static_cast<unsigned int*>(var_->data);
|
||||
Mat_VarFree(var_);
|
||||
|
||||
var_ = Mat_VarRead(matfile, "PRN");
|
||||
sat_ = *static_cast<int*>(var_->data);
|
||||
Mat_VarFree(var_);
|
||||
|
||||
var_ = Mat_VarRead(matfile, "grid");
|
||||
samples_per_code_ = var_->dims[0];
|
||||
Mat_VarFree(var_);
|
||||
|
||||
Mat_Close(matfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl;
|
||||
}
|
||||
acquisition_dump_reader(basename,
|
||||
sat_,
|
||||
doppler_max_,
|
||||
doppler_step_,
|
||||
samples_per_code_,
|
||||
channel,
|
||||
execution);
|
||||
}
|
||||
|
||||
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,
|
||||
int channel,
|
||||
int execution)
|
||||
{
|
||||
d_basename = basename;
|
||||
d_sat = sat;
|
||||
d_doppler_max = doppler_max;
|
||||
d_doppler_step = doppler_step;
|
||||
d_samples_per_code = samples_per_code;
|
||||
acq_doppler_hz = 0.0;
|
||||
acq_delay_samples = 0.0;
|
||||
test_statistic = 0.0;
|
||||
input_power = 0.0;
|
||||
threshold = 0.0;
|
||||
positive_acq = 0;
|
||||
sample_counter = 0;
|
||||
PRN = 0;
|
||||
d_num_doppler_bins = static_cast<unsigned int>(ceil(static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step)));
|
||||
std::vector<std::vector<float> > mag_aux(d_num_doppler_bins, std::vector<float>(d_samples_per_code));
|
||||
mag = mag_aux;
|
||||
d_dump_filename = d_basename + "_sat_" + std::to_string(d_sat) + ".mat";
|
||||
d_dump_filename = d_basename + "_ch_" + std::to_string(channel) + "_" + std::to_string(execution) + "_sat_" + std::to_string(d_sat) + ".mat";
|
||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||
{
|
||||
doppler.push_back(-static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index);
|
||||
|
||||
@@ -38,13 +38,33 @@
|
||||
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(const std::string& basename,
|
||||
unsigned int sat,
|
||||
unsigned int doppler_max,
|
||||
unsigned int doppler_step,
|
||||
unsigned int samples_per_code,
|
||||
int channel = 0,
|
||||
int execution = 1);
|
||||
|
||||
acquisition_dump_reader(const std::string& basename,
|
||||
int channel = 0,
|
||||
int execution = 1);
|
||||
|
||||
~acquisition_dump_reader();
|
||||
|
||||
bool read_binary_acq();
|
||||
|
||||
std::vector<int> doppler;
|
||||
std::vector<unsigned int> samples;
|
||||
std::vector<std::vector<float> > mag;
|
||||
float acq_doppler_hz;
|
||||
float acq_delay_samples;
|
||||
float test_statistic;
|
||||
float input_power;
|
||||
float threshold;
|
||||
int positive_acq;
|
||||
unsigned int PRN;
|
||||
long unsigned int sample_counter;
|
||||
|
||||
private:
|
||||
std::string d_basename;
|
||||
|
||||
@@ -97,7 +97,6 @@ bool observables_dump_reader::open_obs_file(std::string out_file)
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "Observables sum file opened, Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
@@ -112,6 +111,13 @@ bool observables_dump_reader::open_obs_file(std::string out_file)
|
||||
}
|
||||
}
|
||||
|
||||
void observables_dump_reader::close_obs_file()
|
||||
{
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
observables_dump_reader::observables_dump_reader(int n_channels_)
|
||||
{
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
bool restart();
|
||||
long int num_epochs();
|
||||
bool open_obs_file(std::string out_file);
|
||||
void close_obs_file();
|
||||
|
||||
|
||||
//dump variables
|
||||
|
||||
@@ -109,7 +109,6 @@ bool tracking_dump_reader::open_obs_file(std::string out_file)
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "Tracking dump enabled, Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
|
||||
@@ -89,15 +89,15 @@ bool tracking_true_obs_reader::open_obs_file(std::string out_file)
|
||||
{
|
||||
try
|
||||
{
|
||||
d_dump_file.clear();
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "Observables dump enabled, Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cout << "Problem opening Observables dump Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
std::cout << "Problem opening Tracking dump Log file: " << d_dump_filename.c_str() << " Error: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,13 @@ bool tracking_true_obs_reader::open_obs_file(std::string out_file)
|
||||
}
|
||||
}
|
||||
|
||||
void tracking_true_obs_reader::close_obs_file()
|
||||
{
|
||||
if (d_dump_file.is_open() == true)
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
tracking_true_obs_reader::~tracking_true_obs_reader()
|
||||
{
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
bool restart();
|
||||
long int num_epochs();
|
||||
bool open_obs_file(std::string out_file);
|
||||
void close_obs_file();
|
||||
bool d_dump;
|
||||
|
||||
double signal_timestamp_s;
|
||||
|
||||
@@ -35,12 +35,128 @@
|
||||
#include "nmea_printer.h"
|
||||
|
||||
|
||||
TEST(NmeaPrinterTest, PrintLine)
|
||||
class NmeaPrinterTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
NmeaPrinterTest()
|
||||
{
|
||||
this->conf();
|
||||
}
|
||||
~NmeaPrinterTest()
|
||||
{
|
||||
}
|
||||
void conf();
|
||||
rtk_t rtk;
|
||||
};
|
||||
|
||||
void NmeaPrinterTest::conf()
|
||||
{
|
||||
snrmask_t snrmask = {{}, {{}, {}}};
|
||||
int positioning_mode = 0; // Single
|
||||
int number_of_frequencies = 1;
|
||||
double elevation_mask = 5;
|
||||
int navigation_system = 1; // GPS
|
||||
int integer_ambiguity_resolution_gps = 0;
|
||||
int integer_ambiguity_resolution_glo = 0;
|
||||
int integer_ambiguity_resolution_bds = 0;
|
||||
int outage_reset_ambiguity = 5;
|
||||
int min_lock_to_fix_ambiguity = 0;
|
||||
int iono_model = 0;
|
||||
int trop_model = 0;
|
||||
int dynamics_model = 0;
|
||||
int earth_tide = 0;
|
||||
int number_filter_iter = 1;
|
||||
double code_phase_error_ratio_l1 = 100.0;
|
||||
double code_phase_error_ratio_l2 = 100.0;
|
||||
double code_phase_error_ratio_l5 = 100.0;
|
||||
double carrier_phase_error_factor_a = 0.003;
|
||||
double carrier_phase_error_factor_b = 0.003;
|
||||
double bias_0 = 30.0;
|
||||
double iono_0 = 0.03;
|
||||
double trop_0 = 0.3;
|
||||
double sigma_bias = 1e-4;
|
||||
double sigma_iono = 1e-3;
|
||||
double sigma_trop = 1e-4;
|
||||
double sigma_acch = 1e-1;
|
||||
double sigma_accv = 1e-2;
|
||||
double sigma_pos = 0.0;
|
||||
double min_ratio_to_fix_ambiguity = 3.0;
|
||||
double min_elevation_to_fix_ambiguity = 0.0;
|
||||
double slip_threshold = 0.05;
|
||||
double threshold_reject_innovation = 30.0;
|
||||
double threshold_reject_gdop = 30.0;
|
||||
int sat_PCV = 0;
|
||||
int rec_PCV = 0;
|
||||
int phwindup = 0;
|
||||
int reject_GPS_IIA = 0;
|
||||
int raim_fde = 0;
|
||||
|
||||
prcopt_t rtklib_configuration_options = {
|
||||
positioning_mode, /* positioning mode (PMODE_XXX) see src/algorithms/libs/rtklib/rtklib.h */
|
||||
0, /* solution type (0:forward,1:backward,2:combined) */
|
||||
number_of_frequencies, /* number of frequencies (1:L1, 2:L1+L2, 3:L1+L2+L5)*/
|
||||
navigation_system, /* navigation system */
|
||||
elevation_mask * D2R, /* elevation mask angle (degrees) */
|
||||
snrmask, /* snrmask_t snrmask SNR mask */
|
||||
0, /* satellite ephemeris/clock (EPHOPT_XXX) */
|
||||
integer_ambiguity_resolution_gps, /* AR mode (0:off,1:continuous,2:instantaneous,3:fix and hold,4:ppp-ar) */
|
||||
integer_ambiguity_resolution_glo, /* GLONASS AR mode (0:off,1:on,2:auto cal,3:ext cal) */
|
||||
integer_ambiguity_resolution_bds, /* BeiDou AR mode (0:off,1:on) */
|
||||
outage_reset_ambiguity, /* obs outage count to reset bias */
|
||||
min_lock_to_fix_ambiguity, /* min lock count to fix ambiguity */
|
||||
10, /* min fix count to hold ambiguity */
|
||||
1, /* max iteration to resolve ambiguity */
|
||||
iono_model, /* ionosphere option (IONOOPT_XXX) */
|
||||
trop_model, /* troposphere option (TROPOPT_XXX) */
|
||||
dynamics_model, /* dynamics model (0:none, 1:velocity, 2:accel) */
|
||||
earth_tide, /* earth tide correction (0:off,1:solid,2:solid+otl+pole) */
|
||||
number_filter_iter, /* number of filter iteration */
|
||||
0, /* code smoothing window size (0:none) */
|
||||
0, /* interpolate reference obs (for post mission) */
|
||||
0, /* sbssat_t sbssat SBAS correction options */
|
||||
0, /* sbsion_t sbsion[MAXBAND+1] SBAS satellite selection (0:all) */
|
||||
0, /* rover position for fixed mode */
|
||||
0, /* base position for relative mode */
|
||||
/* 0:pos in prcopt, 1:average of single pos, */
|
||||
/* 2:read from file, 3:rinex header, 4:rtcm pos */
|
||||
{code_phase_error_ratio_l1, code_phase_error_ratio_l2, code_phase_error_ratio_l5}, /* eratio[NFREQ] code/phase error ratio */
|
||||
{100.0, carrier_phase_error_factor_a, carrier_phase_error_factor_b, 0.0, 1.0}, /* err[5]: measurement error factor [0]:reserved, [1-3]:error factor a/b/c of phase (m) , [4]:doppler frequency (hz) */
|
||||
{bias_0, iono_0, trop_0}, /* std[3]: initial-state std [0]bias,[1]iono [2]trop*/
|
||||
{sigma_bias, sigma_iono, sigma_trop, sigma_acch, sigma_accv, sigma_pos}, /* prn[6] process-noise std */
|
||||
5e-12, /* sclkstab: satellite clock stability (sec/sec) */
|
||||
{min_ratio_to_fix_ambiguity, 0.9999, 0.25, 0.1, 0.05, 0.0, 0.0, 0.0}, /* thresar[8]: AR validation threshold */
|
||||
min_elevation_to_fix_ambiguity, /* elevation mask of AR for rising satellite (deg) */
|
||||
0.0, /* elevation mask to hold ambiguity (deg) */
|
||||
slip_threshold, /* slip threshold of geometry-free phase (m) */
|
||||
30.0, /* max difference of time (sec) */
|
||||
threshold_reject_innovation, /* reject threshold of innovation (m) */
|
||||
threshold_reject_gdop, /* reject threshold of gdop */
|
||||
{}, /* double baseline[2] baseline length constraint {const,sigma} (m) */
|
||||
{}, /* double ru[3] rover position for fixed mode {x,y,z} (ecef) (m) */
|
||||
{}, /* double rb[3] base position for relative mode {x,y,z} (ecef) (m) */
|
||||
{"", ""}, /* char anttype[2][MAXANT] antenna types {rover,base} */
|
||||
{{}, {}}, /* double antdel[2][3] antenna delta {{rov_e,rov_n,rov_u},{ref_e,ref_n,ref_u}} */
|
||||
{}, /* pcv_t pcvr[2] receiver antenna parameters {rov,base} */
|
||||
{}, /* unsigned char exsats[MAXSAT] excluded satellites (1:excluded, 2:included) */
|
||||
0, /* max averaging epoches */
|
||||
0, /* initialize by restart */
|
||||
1, /* output single by dgps/float/fix/ppp outage */
|
||||
{"", ""}, /* char rnxopt[2][256] rinex options {rover,base} */
|
||||
{sat_PCV, rec_PCV, phwindup, reject_GPS_IIA, raim_fde}, /* posopt[6] positioning options [0]: satellite and receiver antenna PCV model; [1]: interpolate antenna parameters; [2]: apply phase wind-up correction for PPP modes; [3]: exclude measurements of GPS Block IIA satellites satellite [4]: RAIM FDE (fault detection and exclusion) [5]: handle day-boundary clock jump */
|
||||
0, /* solution sync mode (0:off,1:on) */
|
||||
{{}, {}}, /* odisp[2][6*11] ocean tide loading parameters {rov,base} */
|
||||
{{}, {{}, {}}, {{}, {}}, {}, {}}, /* exterr_t exterr extended receiver error model */
|
||||
0, /* disable L2-AR */
|
||||
{} /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
|
||||
};
|
||||
|
||||
rtkinit(&rtk, &rtklib_configuration_options);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(NmeaPrinterTest, PrintLine)
|
||||
{
|
||||
std::string filename("nmea_test.nmea");
|
||||
rtk_t rtk;
|
||||
prcopt_t rtklib_configuration_options;
|
||||
rtkinit(&rtk, &rtklib_configuration_options);
|
||||
std::shared_ptr<rtklib_solver> pvt_solution = std::make_shared<rtklib_solver>(12, "filename", false, rtk);
|
||||
|
||||
boost::posix_time::ptime pt(boost::gregorian::date(1994, boost::date_time::Nov, 19),
|
||||
@@ -76,12 +192,9 @@ TEST(NmeaPrinterTest, PrintLine)
|
||||
}
|
||||
|
||||
|
||||
TEST(NmeaPrinterTest, PrintLineLessthan10min)
|
||||
TEST_F(NmeaPrinterTest, PrintLineLessthan10min)
|
||||
{
|
||||
std::string filename("nmea_test.nmea");
|
||||
rtk_t rtk;
|
||||
prcopt_t rtklib_configuration_options;
|
||||
rtkinit(&rtk, &rtklib_configuration_options);
|
||||
std::shared_ptr<rtklib_solver> pvt_solution = std::make_shared<rtklib_solver>(12, "filename", false, rtk);
|
||||
|
||||
boost::posix_time::ptime pt(boost::gregorian::date(1994, boost::date_time::Nov, 19),
|
||||
|
||||
@@ -50,7 +50,7 @@ TEST(FileSignalSource, Instantiate)
|
||||
config->set_property("Test.item_type", "gr_complex");
|
||||
config->set_property("Test.repeat", "false");
|
||||
|
||||
std::unique_ptr<FileSignalSource> signal_source(new FileSignalSource(config.get(), "Test", 1, 1, queue));
|
||||
std::unique_ptr<FileSignalSource> signal_source(new FileSignalSource(config.get(), "Test", 0, 1, queue));
|
||||
|
||||
EXPECT_STREQ("gr_complex", signal_source->item_type().c_str());
|
||||
EXPECT_TRUE(signal_source->repeat() == false);
|
||||
@@ -67,5 +67,5 @@ TEST(FileSignalSource, InstantiateFileNotExists)
|
||||
config->set_property("Test.item_type", "gr_complex");
|
||||
config->set_property("Test.repeat", "false");
|
||||
|
||||
EXPECT_THROW({ auto uptr = std::make_shared<FileSignalSource>(config.get(), "Test", 1, 1, queue); }, std::exception);
|
||||
EXPECT_THROW({ auto uptr = std::make_shared<FileSignalSource>(config.get(), "Test", 0, 1, queue); }, std::exception);
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ void GpsL1CATelemetryDecoderTest::check_results(arma::vec& true_time_s,
|
||||
|
||||
//2. RMSE
|
||||
//arma::vec err = meas_value - true_value_interp + 0.001;
|
||||
arma::vec err = meas_value - true_value_interp - 0.001;
|
||||
arma::vec err = meas_value - true_value_interp; // - 0.001;
|
||||
|
||||
arma::vec err2 = arma::square(err);
|
||||
double rmse = sqrt(arma::mean(err2));
|
||||
|
||||
@@ -137,11 +137,10 @@ void GlonassL1CaDllPllCAidTrackingTest::init()
|
||||
gnss_synchro.PRN = 11;
|
||||
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", "6625000");
|
||||
config->set_property("Tracking_1G.implementation", "GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking");
|
||||
config->set_property("Tracking_1G.item_type", "gr_complex");
|
||||
config->set_property("Tracking_1G.dump", "false");
|
||||
config->set_property("Tracking_1G.if", "0.0");
|
||||
config->set_property("Tracking_1G.dump_filename", "./tracking_ch_");
|
||||
config->set_property("Tracking_1G.implementation", "GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking");
|
||||
config->set_property("Tracking_1G.early_late_space_chips", "0.5");
|
||||
config->set_property("Tracking_1G.order", "2");
|
||||
config->set_property("Tracking_1G.pll_bw_hz", "2");
|
||||
|
||||
@@ -137,11 +137,10 @@ void GlonassL1CaDllPllTrackingTest::init()
|
||||
gnss_synchro.PRN = 11;
|
||||
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", "6625000");
|
||||
config->set_property("Tracking_1G.implementation", "GLONASS_L1_CA_DLL_PLL_Tracking");
|
||||
config->set_property("Tracking_1G.item_type", "gr_complex");
|
||||
config->set_property("Tracking_1G.dump", "false");
|
||||
config->set_property("Tracking_1G.if", "0.0");
|
||||
config->set_property("Tracking_1G.dump_filename", "./tracking_ch_");
|
||||
config->set_property("Tracking_1G.implementation", "GLONASS_L1_CA_DLL_PLL_Tracking");
|
||||
config->set_property("Tracking_1G.early_late_space_chips", "0.5");
|
||||
config->set_property("Tracking_1G.order", "2");
|
||||
config->set_property("Tracking_1G.pll_bw_hz", "2");
|
||||
|
||||
@@ -0,0 +1,813 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_dll_pll_tracking_test.cc
|
||||
* \brief This class implements a tracking Pull-In test for GPS_L1_CA_DLL_PLL_Tracking
|
||||
* implementation based on some input parameters.
|
||||
* \author Javier Arribas, 2018. jarribas(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2012-2018 (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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <chrono>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
#include <armadillo>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <gnuradio/top_block.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/interleaved_char_to_complex.h>
|
||||
#include <gnuradio/blocks/null_sink.h>
|
||||
#include <gnuradio/blocks/skiphead.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "gnss_block_factory.h"
|
||||
#include "tracking_interface.h"
|
||||
#include "gps_l1_ca_pcps_acquisition_fine_doppler.h"
|
||||
#include "in_memory_configuration.h"
|
||||
#include "tracking_true_obs_reader.h"
|
||||
#include "tracking_dump_reader.h"
|
||||
#include "signal_generator_flags.h"
|
||||
#include "gnuplot_i.h"
|
||||
#include "test_flags.h"
|
||||
#include "tracking_tests_flags.h"
|
||||
|
||||
|
||||
// ######## GNURADIO ACQUISITION BLOCK MESSAGE RECEVER #########
|
||||
class Acquisition_msg_rx;
|
||||
|
||||
typedef boost::shared_ptr<Acquisition_msg_rx> Acquisition_msg_rx_sptr;
|
||||
|
||||
Acquisition_msg_rx_sptr Acquisition_msg_rx_make();
|
||||
|
||||
|
||||
class Acquisition_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend Acquisition_msg_rx_sptr Acquisition_msg_rx_make();
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
Acquisition_msg_rx();
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~Acquisition_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
Acquisition_msg_rx_sptr Acquisition_msg_rx_make()
|
||||
{
|
||||
return Acquisition_msg_rx_sptr(new Acquisition_msg_rx());
|
||||
}
|
||||
|
||||
|
||||
void Acquisition_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_acquisition Bad cast!\n";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Acquisition_msg_rx::Acquisition_msg_rx() : gr::block("Acquisition_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&Acquisition_msg_rx::msg_handler_events, this, _1));
|
||||
rx_message = 0;
|
||||
}
|
||||
|
||||
|
||||
Acquisition_msg_rx::~Acquisition_msg_rx() {}
|
||||
// ######## GNURADIO TRACKING BLOCK MESSAGE RECEVER #########
|
||||
class GpsL1CADllPllTrackingPullInTest_msg_rx;
|
||||
|
||||
typedef boost::shared_ptr<GpsL1CADllPllTrackingPullInTest_msg_rx> GpsL1CADllPllTrackingPullInTest_msg_rx_sptr;
|
||||
|
||||
GpsL1CADllPllTrackingPullInTest_msg_rx_sptr GpsL1CADllPllTrackingPullInTest_msg_rx_make();
|
||||
|
||||
class GpsL1CADllPllTrackingPullInTest_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend GpsL1CADllPllTrackingPullInTest_msg_rx_sptr GpsL1CADllPllTrackingPullInTest_msg_rx_make();
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL1CADllPllTrackingPullInTest_msg_rx();
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CADllPllTrackingPullInTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingPullInTest_msg_rx_sptr GpsL1CADllPllTrackingPullInTest_msg_rx_make()
|
||||
{
|
||||
return GpsL1CADllPllTrackingPullInTest_msg_rx_sptr(new GpsL1CADllPllTrackingPullInTest_msg_rx());
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CADllPllTrackingPullInTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message; //3 -> loss of lock
|
||||
//std::cout << "Received trk message: " << rx_message << std::endl;
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_tracking Bad cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingPullInTest_msg_rx::GpsL1CADllPllTrackingPullInTest_msg_rx() : gr::block("GpsL1CADllPllTrackingPullInTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CADllPllTrackingPullInTest_msg_rx::msg_handler_events, this, _1));
|
||||
rx_message = 0;
|
||||
}
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingPullInTest_msg_rx::~GpsL1CADllPllTrackingPullInTest_msg_rx()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL1CADllPllTrackingPullInTest : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
std::string generator_binary;
|
||||
std::string p1;
|
||||
std::string p2;
|
||||
std::string p3;
|
||||
std::string p4;
|
||||
std::string p5;
|
||||
std::string p6;
|
||||
std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking"; //"GPS_L1_CA_DLL_PLL_C_Aid_Tracking";
|
||||
|
||||
const int baseband_sampling_freq = FLAGS_fs_gen_sps;
|
||||
|
||||
std::string filename_rinex_obs = FLAGS_filename_rinex_obs;
|
||||
std::string filename_raw_data = FLAGS_signal_file;
|
||||
|
||||
std::map<int, double> doppler_measurements_map;
|
||||
std::map<int, double> code_delay_measurements_map;
|
||||
std::map<int, unsigned long int> acq_samplestamp_map;
|
||||
|
||||
int configure_generator(double CN0_dBHz, int file_idx);
|
||||
int generate_signal();
|
||||
std::vector<double> check_results_doppler(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value,
|
||||
double& mean_error,
|
||||
double& std_dev_error);
|
||||
std::vector<double> check_results_acc_carrier_phase(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value,
|
||||
double& mean_error,
|
||||
double& std_dev_error);
|
||||
std::vector<double> check_results_codephase(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value,
|
||||
double& mean_error,
|
||||
double& std_dev_error);
|
||||
|
||||
GpsL1CADllPllTrackingPullInTest()
|
||||
{
|
||||
factory = std::make_shared<GNSSBlockFactory>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
item_size = sizeof(gr_complex);
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
}
|
||||
|
||||
~GpsL1CADllPllTrackingPullInTest()
|
||||
{
|
||||
}
|
||||
|
||||
void configure_receiver(double PLL_wide_bw_hz,
|
||||
double DLL_wide_bw_hz,
|
||||
double PLL_narrow_bw_hz,
|
||||
double DLL_narrow_bw_hz,
|
||||
int extend_correlation_symbols);
|
||||
|
||||
bool acquire_GPS_L1CA_signal(int SV_ID);
|
||||
gr::top_block_sptr top_block;
|
||||
std::shared_ptr<GNSSBlockFactory> factory;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
Gnss_Synchro gnss_synchro;
|
||||
size_t item_size;
|
||||
};
|
||||
|
||||
|
||||
int GpsL1CADllPllTrackingPullInTest::configure_generator(double CN0_dBHz, int file_idx)
|
||||
{
|
||||
// Configure signal generator
|
||||
generator_binary = FLAGS_generator_binary;
|
||||
|
||||
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
|
||||
if (FLAGS_dynamic_position.empty())
|
||||
{
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(FLAGS_duration * 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
|
||||
}
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_signal_file + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int GpsL1CADllPllTrackingPullInTest::generate_signal()
|
||||
{
|
||||
int child_status;
|
||||
|
||||
char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], &p6[0], NULL};
|
||||
|
||||
int pid;
|
||||
if ((pid = fork()) == -1)
|
||||
perror("fork err");
|
||||
else if (pid == 0)
|
||||
{
|
||||
execv(&generator_binary[0], parmList);
|
||||
std::cout << "Return not expected. Must be an execv err." << std::endl;
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
waitpid(pid, &child_status, 0);
|
||||
|
||||
std::cout << "Signal and Observables RINEX and RAW files created." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CADllPllTrackingPullInTest::configure_receiver(
|
||||
double PLL_wide_bw_hz,
|
||||
double DLL_wide_bw_hz,
|
||||
double PLL_narrow_bw_hz,
|
||||
double DLL_narrow_bw_hz,
|
||||
int extend_correlation_symbols)
|
||||
{
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
gnss_synchro.PRN = FLAGS_test_satellite_PRN;
|
||||
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq));
|
||||
// Set Tracking
|
||||
config->set_property("Tracking_1C.implementation", implementation);
|
||||
config->set_property("Tracking_1C.item_type", "gr_complex");
|
||||
config->set_property("Tracking_1C.pll_bw_hz", std::to_string(PLL_wide_bw_hz));
|
||||
config->set_property("Tracking_1C.dll_bw_hz", std::to_string(DLL_wide_bw_hz));
|
||||
config->set_property("Tracking_1C.early_late_space_chips", "0.5");
|
||||
config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(extend_correlation_symbols));
|
||||
config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz));
|
||||
config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz));
|
||||
config->set_property("Tracking_1C.early_late_space_narrow_chips", "0.5");
|
||||
config->set_property("Tracking_1C.dump", "true");
|
||||
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
||||
|
||||
std::cout << "*****************************************\n";
|
||||
std::cout << "*** Tracking configuration parameters ***\n";
|
||||
std::cout << "*****************************************\n";
|
||||
std::cout << "pll_bw_hz: " << config->property("Tracking_1C.pll_bw_hz", 0.0) << " Hz\n";
|
||||
std::cout << "dll_bw_hz: " << config->property("Tracking_1C.dll_bw_hz", 0.0) << " Hz\n";
|
||||
std::cout << "pll_bw_narrow_hz: " << config->property("Tracking_1C.pll_bw_narrow_hz", 0.0) << " Hz\n";
|
||||
std::cout << "dll_bw_narrow_hz: " << config->property("Tracking_1C.dll_bw_narrow_hz", 0.0) << " Hz\n";
|
||||
std::cout << "extend_correlation_symbols: " << config->property("Tracking_1C.extend_correlation_symbols", 0) << " Symbols\n";
|
||||
std::cout << "*****************************************\n";
|
||||
std::cout << "*****************************************\n";
|
||||
}
|
||||
|
||||
|
||||
bool GpsL1CADllPllTrackingPullInTest::acquire_GPS_L1CA_signal(int SV_ID)
|
||||
{
|
||||
// 1. Setup GNU Radio flowgraph (file_source -> Acquisition_10m)
|
||||
gr::top_block_sptr top_block;
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
// Satellite signal definition
|
||||
Gnss_Synchro tmp_gnss_synchro;
|
||||
tmp_gnss_synchro.Channel_ID = 0;
|
||||
tmp_gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(tmp_gnss_synchro.Signal, 2, 0);
|
||||
tmp_gnss_synchro.PRN = SV_ID;
|
||||
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq));
|
||||
|
||||
GNSSBlockFactory block_factory;
|
||||
GpsL1CaPcpsAcquisitionFineDoppler* acquisition;
|
||||
acquisition = new GpsL1CaPcpsAcquisitionFineDoppler(config.get(), "Acquisition", 1, 1);
|
||||
|
||||
acquisition->set_channel(1);
|
||||
acquisition->set_gnss_synchro(&tmp_gnss_synchro);
|
||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.005));
|
||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 250));
|
||||
|
||||
boost::shared_ptr<Acquisition_msg_rx> msg_rx;
|
||||
try
|
||||
{
|
||||
msg_rx = Acquisition_msg_rx_make();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cout << "Failure connecting the message port system: " << e.what() << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
gr::blocks::file_source::sptr file_source;
|
||||
std::string file = FLAGS_signal_file;
|
||||
const char* file_name = file.c_str();
|
||||
file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false);
|
||||
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
|
||||
top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_left_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
|
||||
// 5. Run the flowgraph
|
||||
// Get visible GPS satellites (positive acquisitions with Doppler measurements)
|
||||
// record startup time
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
bool start_msg = true;
|
||||
|
||||
doppler_measurements_map.clear();
|
||||
code_delay_measurements_map.clear();
|
||||
acq_samplestamp_map.clear();
|
||||
|
||||
for (unsigned int PRN = 1; PRN < 33; PRN++)
|
||||
{
|
||||
tmp_gnss_synchro.PRN = PRN;
|
||||
acquisition->set_gnss_synchro(&tmp_gnss_synchro);
|
||||
acquisition->init();
|
||||
acquisition->set_local_code();
|
||||
acquisition->reset();
|
||||
msg_rx->rx_message = 0;
|
||||
top_block->run();
|
||||
if (start_msg == true)
|
||||
{
|
||||
std::cout << "Reading external signal file: " << FLAGS_signal_file << std::endl;
|
||||
std::cout << "Searching for GPS Satellites in L1 band..." << std::endl;
|
||||
std::cout << "[";
|
||||
start_msg = false;
|
||||
}
|
||||
while (msg_rx->rx_message == 0)
|
||||
{
|
||||
usleep(100000);
|
||||
}
|
||||
if (msg_rx->rx_message == 1)
|
||||
{
|
||||
std::cout << " " << PRN << " ";
|
||||
doppler_measurements_map.insert(std::pair<int, double>(PRN, tmp_gnss_synchro.Acq_doppler_hz));
|
||||
code_delay_measurements_map.insert(std::pair<int, double>(PRN, tmp_gnss_synchro.Acq_delay_samples));
|
||||
acq_samplestamp_map.insert(std::pair<int, double>(PRN, tmp_gnss_synchro.Acq_samplestamp_samples));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << " . ";
|
||||
}
|
||||
top_block->stop();
|
||||
file_source->seek(0, 0);
|
||||
std::cout.flush();
|
||||
}
|
||||
std::cout << "]" << std::endl;
|
||||
|
||||
// report the elapsed time
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
std::cout << "Total signal acquisition run time "
|
||||
<< elapsed_seconds.count()
|
||||
<< " [seconds]" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults)
|
||||
{
|
||||
//*************************************************
|
||||
//***** STEP 1: Prepare the parameters sweep ******
|
||||
//*************************************************
|
||||
std::vector<double>
|
||||
acq_doppler_error_hz_values;
|
||||
std::vector<std::vector<double>> acq_delay_error_chips_values; //vector of vector
|
||||
|
||||
for (double doppler_hz = FLAGS_acq_Doppler_error_hz_start; doppler_hz >= FLAGS_acq_Doppler_error_hz_stop; doppler_hz = doppler_hz + FLAGS_acq_Doppler_error_hz_step)
|
||||
{
|
||||
acq_doppler_error_hz_values.push_back(doppler_hz);
|
||||
std::vector<double> tmp_vector;
|
||||
//Code Delay Sweep
|
||||
for (double code_delay_chips = FLAGS_acq_Delay_error_chips_start; code_delay_chips >= FLAGS_acq_Delay_error_chips_stop; code_delay_chips = code_delay_chips + FLAGS_acq_Delay_error_chips_step)
|
||||
{
|
||||
tmp_vector.push_back(code_delay_chips);
|
||||
}
|
||||
acq_delay_error_chips_values.push_back(tmp_vector);
|
||||
}
|
||||
|
||||
|
||||
//***********************************************************
|
||||
//***** STEP 2: Generate the input signal (if required) *****
|
||||
//***********************************************************
|
||||
std::vector<double> generator_CN0_values;
|
||||
if (FLAGS_enable_external_signal_file)
|
||||
{
|
||||
generator_CN0_values.push_back(999); // an external input signal capture is selected, no CN0 information available
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FLAGS_CN0_dBHz_start == FLAGS_CN0_dBHz_stop)
|
||||
{
|
||||
generator_CN0_values.push_back(FLAGS_CN0_dBHz_start);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (double cn0 = FLAGS_CN0_dBHz_start; cn0 > FLAGS_CN0_dBHz_stop; cn0 = cn0 - FLAGS_CN0_dB_step)
|
||||
{
|
||||
generator_CN0_values.push_back(cn0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// use generator or use an external capture file
|
||||
if (FLAGS_enable_external_signal_file)
|
||||
{
|
||||
//create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters
|
||||
ASSERT_EQ(acquire_GPS_L1CA_signal(FLAGS_test_satellite_PRN), true);
|
||||
bool found_satellite = doppler_measurements_map.find(FLAGS_test_satellite_PRN) != doppler_measurements_map.end();
|
||||
EXPECT_TRUE(found_satellite) << "Error: satellite SV: " << FLAGS_test_satellite_PRN << " is not acquired";
|
||||
if (!found_satellite) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||
{
|
||||
// Configure the signal generator
|
||||
configure_generator(generator_CN0_values.at(current_cn0_idx), current_cn0_idx);
|
||||
// Generate signal raw signal samples and observations RINEX file
|
||||
if (FLAGS_disable_generator == false)
|
||||
{
|
||||
generate_signal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
configure_receiver(FLAGS_PLL_bw_hz_start,
|
||||
FLAGS_DLL_bw_hz_start,
|
||||
FLAGS_PLL_narrow_bw_hz,
|
||||
FLAGS_DLL_narrow_bw_hz,
|
||||
FLAGS_extend_correlation_symbols);
|
||||
|
||||
//******************************************************************************************
|
||||
//***** Obtain the initial signal sinchronization parameters (emulating an acquisition) ****
|
||||
//******************************************************************************************
|
||||
int test_satellite_PRN = 0;
|
||||
double true_acq_doppler_hz = 0.0;
|
||||
double true_acq_delay_samples = 0.0;
|
||||
unsigned long int acq_samplestamp_samples = 0;
|
||||
|
||||
tracking_true_obs_reader true_obs_data;
|
||||
if (!FLAGS_enable_external_signal_file)
|
||||
{
|
||||
test_satellite_PRN = FLAGS_test_satellite_PRN;
|
||||
std::string true_obs_file = std::string("./gps_l1_ca_obs_prn");
|
||||
true_obs_file.append(std::to_string(test_satellite_PRN));
|
||||
true_obs_file.append(".dat");
|
||||
true_obs_data.close_obs_file();
|
||||
ASSERT_EQ(true_obs_data.open_obs_file(true_obs_file), true) << "Failure opening true observables file";
|
||||
// load acquisition data based on the first epoch of the true observations
|
||||
ASSERT_EQ(true_obs_data.read_binary_obs(), true)
|
||||
<< "Failure reading true tracking dump file." << std::endl
|
||||
<< "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) +
|
||||
" is not available?";
|
||||
std::cout << "Testing satellite PRN=" << test_satellite_PRN << std::endl;
|
||||
std::cout << "True Initial Doppler " << true_obs_data.doppler_l1_hz << "[Hz], true Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << "[Chips]" << std::endl;
|
||||
true_acq_doppler_hz = true_obs_data.doppler_l1_hz;
|
||||
true_acq_delay_samples = (GPS_L1_CA_CODE_LENGTH_CHIPS - true_obs_data.prn_delay_chips / GPS_L1_CA_CODE_LENGTH_CHIPS) * static_cast<double>(baseband_sampling_freq) * GPS_L1_CA_CODE_PERIOD;
|
||||
acq_samplestamp_samples = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
true_acq_doppler_hz = doppler_measurements_map.find(FLAGS_test_satellite_PRN)->second;
|
||||
true_acq_delay_samples = code_delay_measurements_map.find(FLAGS_test_satellite_PRN)->second;
|
||||
acq_samplestamp_samples = 0; //acq_samplestamp_map.find(FLAGS_test_satellite_PRN)->second;
|
||||
std::cout << "Estimated Initial Doppler " << true_acq_doppler_hz << "[Hz], estimated Initial code delay " << true_acq_delay_samples << " [Samples]" << std::endl;
|
||||
}
|
||||
//CN0 LOOP
|
||||
std::vector<std::vector<double>> pull_in_results_v_v;
|
||||
|
||||
for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||
{
|
||||
std::vector<double> pull_in_results_v;
|
||||
for (unsigned int current_acq_doppler_error_idx = 0; current_acq_doppler_error_idx < acq_doppler_error_hz_values.size(); current_acq_doppler_error_idx++)
|
||||
{
|
||||
for (unsigned int current_acq_code_error_idx = 0; current_acq_code_error_idx < acq_delay_error_chips_values.at(current_acq_doppler_error_idx).size(); current_acq_code_error_idx++)
|
||||
{
|
||||
gnss_synchro.Acq_samplestamp_samples = acq_samplestamp_samples;
|
||||
//simulate a Doppler error in acquisition
|
||||
gnss_synchro.Acq_doppler_hz = true_acq_doppler_hz + acq_doppler_error_hz_values.at(current_acq_doppler_error_idx);
|
||||
//simulate Code Delay error in acquisition
|
||||
gnss_synchro.Acq_delay_samples = true_acq_delay_samples + (acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx) / GPS_L1_CA_CODE_RATE_HZ) * static_cast<double>(baseband_sampling_freq);
|
||||
|
||||
//create flowgraph
|
||||
top_block = gr::make_top_block("Tracking test");
|
||||
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking_1C", implementation, 1, 1);
|
||||
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
|
||||
boost::shared_ptr<GpsL1CADllPllTrackingPullInTest_msg_rx> msg_rx = GpsL1CADllPllTrackingPullInTest_msg_rx_make();
|
||||
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
std::string file;
|
||||
ASSERT_NO_THROW({
|
||||
if (!FLAGS_enable_external_signal_file)
|
||||
{
|
||||
file = "./" + filename_raw_data + std::to_string(current_cn0_idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
file = FLAGS_signal_file;
|
||||
}
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false);
|
||||
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
|
||||
top_block->connect(gr_interleaved_char_to_complex, 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"));
|
||||
|
||||
file_source->seek(acq_samplestamp_samples, 0);
|
||||
}) << "Failure connecting the blocks of tracking test.";
|
||||
|
||||
|
||||
//********************************************************************
|
||||
//***** STEP 5: Perform the signal tracking and read the results *****
|
||||
//********************************************************************
|
||||
std::cout << "------------ START TRACKING -------------" << std::endl;
|
||||
tracking->start_tracking();
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "Signal tracking completed in " << elapsed_seconds.count() << " seconds" << std::endl;
|
||||
|
||||
|
||||
pull_in_results_v.push_back(msg_rx->rx_message != 3); //save last asynchronous tracking message in order to detect a loss of lock
|
||||
|
||||
//********************************
|
||||
//***** STEP 7: Plot results *****
|
||||
//********************************
|
||||
if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots)
|
||||
{
|
||||
//load the measured values
|
||||
tracking_dump_reader trk_dump;
|
||||
ASSERT_EQ(trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")), true)
|
||||
<< "Failure opening tracking dump file";
|
||||
|
||||
long int n_measured_epochs = trk_dump.num_epochs();
|
||||
//todo: use vectors instead
|
||||
arma::vec trk_timestamp_s = arma::zeros(n_measured_epochs, 1);
|
||||
arma::vec trk_acc_carrier_phase_cycles = arma::zeros(n_measured_epochs, 1);
|
||||
arma::vec trk_Doppler_Hz = arma::zeros(n_measured_epochs, 1);
|
||||
arma::vec trk_prn_delay_chips = arma::zeros(n_measured_epochs, 1);
|
||||
std::vector<double> timestamp_s;
|
||||
std::vector<double> prompt;
|
||||
std::vector<double> early;
|
||||
std::vector<double> late;
|
||||
std::vector<double> promptI;
|
||||
std::vector<double> promptQ;
|
||||
std::vector<double> CN0_dBHz;
|
||||
long int epoch_counter = 0;
|
||||
while (trk_dump.read_binary_obs())
|
||||
{
|
||||
trk_timestamp_s(epoch_counter) = static_cast<double>(trk_dump.PRN_start_sample_count) / static_cast<double>(baseband_sampling_freq);
|
||||
trk_acc_carrier_phase_cycles(epoch_counter) = trk_dump.acc_carrier_phase_rad / GPS_TWO_PI;
|
||||
trk_Doppler_Hz(epoch_counter) = trk_dump.carrier_doppler_hz;
|
||||
double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS * (fmod((static_cast<double>(trk_dump.PRN_start_sample_count) + trk_dump.aux1) / static_cast<double>(baseband_sampling_freq), 1.0e-3) / 1.0e-3);
|
||||
|
||||
trk_prn_delay_chips(epoch_counter) = delay_chips;
|
||||
|
||||
timestamp_s.push_back(trk_timestamp_s(epoch_counter));
|
||||
prompt.push_back(trk_dump.abs_P);
|
||||
early.push_back(trk_dump.abs_E);
|
||||
late.push_back(trk_dump.abs_L);
|
||||
promptI.push_back(trk_dump.prompt_I);
|
||||
promptQ.push_back(trk_dump.prompt_Q);
|
||||
CN0_dBHz.push_back(trk_dump.CN0_SNV_dB_Hz);
|
||||
|
||||
epoch_counter++;
|
||||
}
|
||||
|
||||
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag show_plots 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
|
||||
{
|
||||
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);
|
||||
unsigned int decimate = static_cast<unsigned int>(FLAGS_plot_decimate);
|
||||
|
||||
if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots)
|
||||
{
|
||||
Gnuplot g1("linespoints");
|
||||
g1.showonscreen(); // window output
|
||||
if (!FLAGS_enable_external_signal_file)
|
||||
{
|
||||
g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
g1.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
}
|
||||
|
||||
g1.set_grid();
|
||||
g1.set_xlabel("Time [s]");
|
||||
g1.set_ylabel("Correlators' output");
|
||||
//g1.cmd("set key box opaque");
|
||||
g1.plot_xy(trk_timestamp_s, prompt, "Prompt", decimate);
|
||||
g1.plot_xy(trk_timestamp_s, early, "Early", decimate);
|
||||
g1.plot_xy(trk_timestamp_s, late, "Late", decimate);
|
||||
g1.set_legend();
|
||||
//g1.savetops("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)));
|
||||
//g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18);
|
||||
|
||||
Gnuplot g2("points");
|
||||
g2.showonscreen(); // window output
|
||||
if (!FLAGS_enable_external_signal_file)
|
||||
{
|
||||
g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
g2.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
}
|
||||
|
||||
g2.set_grid();
|
||||
g2.set_xlabel("Inphase");
|
||||
g2.set_ylabel("Quadrature");
|
||||
//g2.cmd("set size ratio -1");
|
||||
g2.plot_xy(promptI, promptQ);
|
||||
//g2.savetops("Constellation");
|
||||
//g2.savetopdf("Constellation", 18);
|
||||
|
||||
Gnuplot g3("linespoints");
|
||||
if (!FLAGS_enable_external_signal_file)
|
||||
{
|
||||
g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
g3.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
}
|
||||
g3.set_grid();
|
||||
g3.set_xlabel("Time [s]");
|
||||
g3.set_ylabel("Reported CN0 [dB-Hz]");
|
||||
g3.cmd("set key box opaque");
|
||||
|
||||
g3.plot_xy(trk_timestamp_s, CN0_dBHz,
|
||||
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
||||
|
||||
g3.set_legend();
|
||||
//g3.savetops("CN0_output");
|
||||
//g3.savetopdf("CN0_output", 18);
|
||||
g3.showonscreen(); // window output
|
||||
}
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
} //end plot
|
||||
|
||||
} //end acquisition Delay errors loop
|
||||
} //end acquisition Doppler errors loop
|
||||
pull_in_results_v_v.push_back(pull_in_results_v);
|
||||
|
||||
|
||||
} //end CN0 LOOP
|
||||
//build the mesh grid
|
||||
std::vector<double> doppler_error_mesh;
|
||||
std::vector<double> code_delay_error_mesh;
|
||||
for (unsigned int current_acq_doppler_error_idx = 0; current_acq_doppler_error_idx < acq_doppler_error_hz_values.size(); current_acq_doppler_error_idx++)
|
||||
{
|
||||
for (unsigned int current_acq_code_error_idx = 0; current_acq_code_error_idx < acq_delay_error_chips_values.at(current_acq_doppler_error_idx).size(); current_acq_code_error_idx++)
|
||||
{
|
||||
doppler_error_mesh.push_back(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx));
|
||||
code_delay_error_mesh.push_back(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx));
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||
{
|
||||
std::vector<double> pull_in_result_mesh;
|
||||
pull_in_result_mesh = pull_in_results_v_v.at(current_cn0_idx);
|
||||
//plot grid
|
||||
Gnuplot g4("points palette pointsize 2 pointtype 7");
|
||||
if (FLAGS_show_plots)
|
||||
{
|
||||
g4.showonscreen(); // window output
|
||||
}
|
||||
else
|
||||
{
|
||||
g4.disablescreen();
|
||||
}
|
||||
g4.cmd("set palette defined ( 0 \"black\", 1 \"green\" )");
|
||||
g4.cmd("set key off");
|
||||
g4.cmd("set view map");
|
||||
std::string title;
|
||||
if (!FLAGS_enable_external_signal_file)
|
||||
{
|
||||
title = std::string("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + " [dB-Hz], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz].");
|
||||
}
|
||||
else
|
||||
{
|
||||
title = std::string("Tracking Pull-in result grid, PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
}
|
||||
|
||||
g4.set_title(title);
|
||||
g4.set_grid();
|
||||
g4.set_xlabel("Acquisition Doppler error [Hz]");
|
||||
g4.set_ylabel("Acquisition Code Delay error [Chips]");
|
||||
g4.cmd("set cbrange[0:1]");
|
||||
g4.plot_xyz(doppler_error_mesh,
|
||||
code_delay_error_mesh,
|
||||
pull_in_result_mesh);
|
||||
g4.set_legend();
|
||||
if (!FLAGS_enable_external_signal_file)
|
||||
{
|
||||
g4.savetops("trk_pull_in_grid_" + std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))));
|
||||
g4.savetopdf("trk_pull_in_grid_" + std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))), 12);
|
||||
}
|
||||
else
|
||||
{
|
||||
g4.savetops("trk_pull_in_grid_external_file");
|
||||
g4.savetopdf("trk_pull_in_grid_external_file", 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,8 +36,8 @@
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include <armadillo>
|
||||
#include <boost/thread.hpp>// to test the FPGA we have to create a simultaneous task to send the samples using the DMA and stop the test
|
||||
#include <stdio.h>// FPGA read input file
|
||||
#include <boost/thread.hpp> // to test the FPGA we have to create a simultaneous task to send the samples using the DMA and stop the test
|
||||
#include <stdio.h> // FPGA read input file
|
||||
#include <gnuradio/top_block.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/analog/sig_source_waveform.h>
|
||||
@@ -61,17 +61,17 @@
|
||||
#include "signal_generator_flags.h"
|
||||
#include "interleaved_byte_to_complex_short.h"
|
||||
|
||||
#define DMA_TRACK_TRANSFER_SIZE 2046 // DMA transfer size for tracking
|
||||
#define MIN_SAMPLES_REMAINING 20000 // number of remaining samples in the DMA that causes the CPU to stop the flowgraph (it has to be a bit alrger than 2x max packet size)
|
||||
#define FIVE_SECONDS 5000000 // five seconds in microseconds
|
||||
#define DMA_TRACK_TRANSFER_SIZE 2046 // DMA transfer size for tracking
|
||||
#define MIN_SAMPLES_REMAINING 20000 // number of remaining samples in the DMA that causes the CPU to stop the flowgraph (it has to be a bit alrger than 2x max packet size)
|
||||
#define FIVE_SECONDS 5000000 // five seconds in microseconds
|
||||
|
||||
void send_tracking_gps_input_samples(FILE *rx_signal_file,
|
||||
int num_remaining_samples, gr::top_block_sptr top_block)
|
||||
int num_remaining_samples, gr::top_block_sptr top_block)
|
||||
{
|
||||
int num_samples_transferred = 0; // number of samples that have been transferred to the DMA so far
|
||||
static int flowgraph_stopped = 0; // flag to indicate if the flowgraph is stopped already
|
||||
char *buffer_DMA; // temporary buffer to store the samples to be sent to the DMA
|
||||
int dma_descr; // DMA descriptor
|
||||
int num_samples_transferred = 0; // number of samples that have been transferred to the DMA so far
|
||||
static int flowgraph_stopped = 0; // flag to indicate if the flowgraph is stopped already
|
||||
char *buffer_DMA; // temporary buffer to store the samples to be sent to the DMA
|
||||
int dma_descr; // DMA descriptor
|
||||
dma_descr = open("/dev/loop_tx", O_WRONLY);
|
||||
if (dma_descr < 0)
|
||||
{
|
||||
@@ -79,7 +79,7 @@ void send_tracking_gps_input_samples(FILE *rx_signal_file,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
buffer_DMA = (char *) malloc(DMA_TRACK_TRANSFER_SIZE);
|
||||
buffer_DMA = (char *)malloc(DMA_TRACK_TRANSFER_SIZE);
|
||||
if (!buffer_DMA)
|
||||
{
|
||||
fprintf(stderr, "Memory error!");
|
||||
@@ -98,8 +98,7 @@ void send_tracking_gps_input_samples(FILE *rx_signal_file,
|
||||
}
|
||||
if (num_remaining_samples > DMA_TRACK_TRANSFER_SIZE)
|
||||
{
|
||||
|
||||
fread(buffer_DMA, DMA_TRACK_TRANSFER_SIZE, 1,rx_signal_file);
|
||||
fread(buffer_DMA, DMA_TRACK_TRANSFER_SIZE, 1, rx_signal_file);
|
||||
|
||||
assert(DMA_TRACK_TRANSFER_SIZE == write(dma_descr, &buffer_DMA[0], DMA_TRACK_TRANSFER_SIZE));
|
||||
num_remaining_samples = num_remaining_samples - DMA_TRACK_TRANSFER_SIZE;
|
||||
@@ -121,11 +120,11 @@ void send_tracking_gps_input_samples(FILE *rx_signal_file,
|
||||
|
||||
|
||||
// thread that sends the samples to the FPGA
|
||||
void thread(gr::top_block_sptr top_block, const char * file_name)
|
||||
void sending_thread(gr::top_block_sptr top_block, const char *file_name)
|
||||
{
|
||||
// file descriptor
|
||||
FILE *rx_signal_file; // file descriptor
|
||||
int file_length; // length of the file containing the received samples
|
||||
FILE *rx_signal_file; // file descriptor
|
||||
int file_length; // length of the file containing the received samples
|
||||
|
||||
rx_signal_file = fopen(file_name, "rb");
|
||||
if (!rx_signal_file)
|
||||
@@ -137,7 +136,7 @@ void thread(gr::top_block_sptr top_block, const char * file_name)
|
||||
file_length = ftell(rx_signal_file);
|
||||
fseek(rx_signal_file, 0, SEEK_SET);
|
||||
|
||||
usleep(FIVE_SECONDS); // wait for some time to give time to the other thread to program the device
|
||||
usleep(FIVE_SECONDS); // wait for some time to give time to the other thread to program the device
|
||||
|
||||
//send_tracking_gps_input_samples(dma_descr, rx_signal_file, file_length);
|
||||
send_tracking_gps_input_samples(rx_signal_file, file_length, top_block);
|
||||
@@ -163,14 +162,14 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CADllPllTrackingTestFpga_msg_rx(); //!< Default destructor
|
||||
~GpsL1CADllPllTrackingTestFpga_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingTestFpga_msg_rx_sptr GpsL1CADllPllTrackingTestFpga_msg_rx_make()
|
||||
{
|
||||
return GpsL1CADllPllTrackingTestFpga_msg_rx_sptr(
|
||||
new GpsL1CADllPllTrackingTestFpga_msg_rx());
|
||||
new GpsL1CADllPllTrackingTestFpga_msg_rx());
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +180,7 @@ void GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
catch (boost::bad_any_cast &e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
@@ -189,22 +188,22 @@ void GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
}
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingTestFpga_msg_rx::GpsL1CADllPllTrackingTestFpga_msg_rx() :
|
||||
gr::block("GpsL1CADllPllTrackingTestFpga_msg_rx",
|
||||
gr::io_signature::make(0, 0, 0),
|
||||
gr::io_signature::make(0, 0, 0))
|
||||
GpsL1CADllPllTrackingTestFpga_msg_rx::GpsL1CADllPllTrackingTestFpga_msg_rx() : gr::block("GpsL1CADllPllTrackingTestFpga_msg_rx",
|
||||
gr::io_signature::make(0, 0, 0),
|
||||
gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"),
|
||||
boost::bind(
|
||||
&GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_events,
|
||||
this, _1));
|
||||
boost::bind(
|
||||
&GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_events,
|
||||
this, _1));
|
||||
rx_message = 0;
|
||||
}
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingTestFpga_msg_rx::~GpsL1CADllPllTrackingTestFpga_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
@@ -226,12 +225,12 @@ public:
|
||||
|
||||
int configure_generator();
|
||||
int generate_signal();
|
||||
void check_results_doppler(arma::vec & true_time_s, arma::vec & true_value,
|
||||
arma::vec & meas_time_s, arma::vec & meas_value);
|
||||
void check_results_acc_carrier_phase(arma::vec & true_time_s,
|
||||
arma::vec & true_value, arma::vec & meas_time_s, arma::vec & meas_value);
|
||||
void check_results_codephase(arma::vec & true_time_s, arma::vec & true_value,
|
||||
arma::vec & meas_time_s, arma::vec & meas_value);
|
||||
void check_results_doppler(arma::vec &true_time_s, arma::vec &true_value,
|
||||
arma::vec &meas_time_s, arma::vec &meas_value);
|
||||
void check_results_acc_carrier_phase(arma::vec &true_time_s,
|
||||
arma::vec &true_value, arma::vec &meas_time_s, arma::vec &meas_value);
|
||||
void check_results_codephase(arma::vec &true_time_s, arma::vec &true_value,
|
||||
arma::vec &meas_time_s, arma::vec &meas_value);
|
||||
|
||||
GpsL1CADllPllTrackingTestFpga()
|
||||
{
|
||||
@@ -263,16 +262,15 @@ int GpsL1CADllPllTrackingTestFpga::configure_generator()
|
||||
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
|
||||
if (FLAGS_dynamic_position.empty())
|
||||
{
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position
|
||||
+ std::string(",") + std::to_string(FLAGS_duration * 10);
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(FLAGS_duration * 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
|
||||
}
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -281,8 +279,8 @@ int GpsL1CADllPllTrackingTestFpga::generate_signal()
|
||||
{
|
||||
int child_status;
|
||||
|
||||
char * const parmList[] = { &generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0],
|
||||
&p4[0], &p5[0], NULL };
|
||||
char *const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0],
|
||||
&p4[0], &p5[0], NULL};
|
||||
|
||||
int pid;
|
||||
if ((pid = fork()) == -1)
|
||||
@@ -310,14 +308,13 @@ void GpsL1CADllPllTrackingTestFpga::configure_receiver()
|
||||
gnss_synchro.PRN = FLAGS_test_satellite_PRN;
|
||||
|
||||
config->set_property("GNSS-SDR.internal_fs_sps",
|
||||
std::to_string(baseband_sampling_freq));
|
||||
std::to_string(baseband_sampling_freq));
|
||||
// Set Tracking
|
||||
//config->set_property("Tracking_1C.implementation",
|
||||
// "GPS_L1_CA_DLL_PLL_C_Aid_Tracking_Fpga");
|
||||
config->set_property("Tracking_1C.implementation",
|
||||
"GPS_L1_CA_DLL_PLL_Tracking_Fpga");
|
||||
"GPS_L1_CA_DLL_PLL_Tracking_Fpga");
|
||||
config->set_property("Tracking_1C.item_type", "cshort");
|
||||
config->set_property("Tracking_1C.if", "0");
|
||||
config->set_property("Tracking_1C.dump", "true");
|
||||
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
||||
config->set_property("Tracking_1C.pll_bw_hz", "30.0");
|
||||
@@ -328,8 +325,8 @@ void GpsL1CADllPllTrackingTestFpga::configure_receiver()
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CADllPllTrackingTestFpga::check_results_doppler(arma::vec & true_time_s,
|
||||
arma::vec & true_value, arma::vec & meas_time_s, arma::vec & meas_value)
|
||||
void GpsL1CADllPllTrackingTestFpga::check_results_doppler(arma::vec &true_time_s,
|
||||
arma::vec &true_value, arma::vec &meas_time_s, arma::vec &meas_value)
|
||||
{
|
||||
//1. True value interpolation to match the measurement times
|
||||
arma::vec true_value_interp;
|
||||
@@ -362,13 +359,13 @@ void GpsL1CADllPllTrackingTestFpga::check_results_doppler(arma::vec & true_time_
|
||||
<< ", mean=" << error_mean << ", stdev=" << sqrt(error_var)
|
||||
<< " (max,min)=" << max_error << "," << min_error << " [Hz]"
|
||||
<< std::endl;
|
||||
std::cout.precision (ss);
|
||||
std::cout.precision(ss);
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CADllPllTrackingTestFpga::check_results_acc_carrier_phase(
|
||||
arma::vec & true_time_s, arma::vec & true_value, arma::vec & meas_time_s,
|
||||
arma::vec & meas_value)
|
||||
arma::vec &true_time_s, arma::vec &true_value, arma::vec &meas_time_s,
|
||||
arma::vec &meas_value)
|
||||
{
|
||||
//1. True value interpolation to match the measurement times
|
||||
arma::vec true_value_interp;
|
||||
@@ -401,13 +398,13 @@ void GpsL1CADllPllTrackingTestFpga::check_results_acc_carrier_phase(
|
||||
<< ", mean=" << error_mean << ", stdev=" << sqrt(error_var)
|
||||
<< " (max,min)=" << max_error << "," << min_error << " [Hz]"
|
||||
<< std::endl;
|
||||
std::cout.precision (ss);
|
||||
std::cout.precision(ss);
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CADllPllTrackingTestFpga::check_results_codephase(
|
||||
arma::vec & true_time_s, arma::vec & true_value, arma::vec & meas_time_s,
|
||||
arma::vec & meas_value)
|
||||
arma::vec &true_time_s, arma::vec &true_value, arma::vec &meas_time_s,
|
||||
arma::vec &meas_value)
|
||||
{
|
||||
//1. True value interpolation to match the measurement times
|
||||
arma::vec true_value_interp;
|
||||
@@ -439,7 +436,7 @@ void GpsL1CADllPllTrackingTestFpga::check_results_codephase(
|
||||
<< ", mean=" << error_mean << ", stdev=" << sqrt(error_var)
|
||||
<< " (max,min)=" << max_error << "," << min_error << " [Chips]"
|
||||
<< std::endl;
|
||||
std::cout.precision (ss);
|
||||
std::cout.precision(ss);
|
||||
}
|
||||
|
||||
|
||||
@@ -463,27 +460,29 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
||||
true_obs_file.append(std::to_string(test_satellite_PRN));
|
||||
true_obs_file.append(".dat");
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
if (true_obs_data.open_obs_file(true_obs_file) == false)
|
||||
{
|
||||
if (true_obs_data.open_obs_file(true_obs_file) == false)
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
}) << "Failure opening true observables file";
|
||||
throw std::exception();
|
||||
};
|
||||
})
|
||||
<< "Failure opening true observables file";
|
||||
|
||||
top_block = gr::make_top_block("Tracking test");
|
||||
//std::shared_ptr<GpsL1CaDllPllCAidTrackingFpga> tracking = std::make_shared<GpsL1CaDllPllCAidTrackingFpga> (config.get(), "Tracking_1C", 1, 1);
|
||||
std::shared_ptr<GpsL1CaDllPllTrackingFpga> tracking = std::make_shared<GpsL1CaDllPllTrackingFpga> (config.get(), "Tracking_1C", 1, 1);
|
||||
std::shared_ptr<GpsL1CaDllPllTrackingFpga> tracking = std::make_shared<GpsL1CaDllPllTrackingFpga>(config.get(), "Tracking_1C", 1, 1);
|
||||
|
||||
boost::shared_ptr<GpsL1CADllPllTrackingTestFpga_msg_rx> msg_rx = GpsL1CADllPllTrackingTestFpga_msg_rx_make();
|
||||
|
||||
// load acquisition data based on the first epoch of the true observations
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
if (true_obs_data.read_binary_obs() == false)
|
||||
{
|
||||
if (true_obs_data.read_binary_obs() == false)
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
}) << "Failure reading true observables file";
|
||||
throw std::exception();
|
||||
};
|
||||
})
|
||||
<< "Failure reading true observables file";
|
||||
|
||||
//restart the epoch counter
|
||||
true_obs_data.restart();
|
||||
@@ -492,52 +491,54 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
||||
<< " Initial code delay [Chips]=" << true_obs_data.prn_delay_chips
|
||||
<< std::endl;
|
||||
|
||||
gnss_synchro.Acq_delay_samples = (GPS_L1_CA_CODE_LENGTH_CHIPS
|
||||
- true_obs_data.prn_delay_chips / GPS_L1_CA_CODE_LENGTH_CHIPS)
|
||||
* baseband_sampling_freq * GPS_L1_CA_CODE_PERIOD;
|
||||
gnss_synchro.Acq_delay_samples = (GPS_L1_CA_CODE_LENGTH_CHIPS - true_obs_data.prn_delay_chips / GPS_L1_CA_CODE_LENGTH_CHIPS) * baseband_sampling_freq * GPS_L1_CA_CODE_PERIOD;
|
||||
gnss_synchro.Acq_doppler_hz = true_obs_data.doppler_l1_hz;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
{
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
})
|
||||
<< "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
{
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
})
|
||||
<< "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
{
|
||||
tracking->connect(top_block);
|
||||
})
|
||||
<< "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.";
|
||||
{
|
||||
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.";
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
// assemble again the file name in a null terminated string (not available by default in the main program flow)
|
||||
std::string file = "./" + filename_raw_data;
|
||||
const char * file_name = file.c_str();
|
||||
const char *file_name = file.c_str();
|
||||
|
||||
// start thread that sends the DMA samples to the FPGA
|
||||
boost::thread t
|
||||
{ thread, top_block, file_name };
|
||||
boost::thread t{sending_thread, top_block, file_name};
|
||||
|
||||
EXPECT_NO_THROW(
|
||||
{
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
//tracking->reset();// unlock the channel
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
{
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
//tracking->reset();// unlock the channel
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
})
|
||||
<< "Failure running the top_block.";
|
||||
|
||||
// wait until child thread terminates
|
||||
t.join();
|
||||
@@ -567,12 +568,13 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
||||
//load the measured values
|
||||
tracking_dump_reader trk_dump;
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
if (trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")) == false)
|
||||
{
|
||||
if (trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")) == false)
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
}) << "Failure opening tracking dump file";
|
||||
throw std::exception();
|
||||
};
|
||||
})
|
||||
<< "Failure opening tracking dump file";
|
||||
|
||||
nepoch = trk_dump.num_epochs();
|
||||
std::cout << "Measured observation epochs=" << nepoch << std::endl;
|
||||
@@ -585,14 +587,11 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
||||
epoch_counter = 0;
|
||||
while (trk_dump.read_binary_obs())
|
||||
{
|
||||
trk_timestamp_s(epoch_counter) = static_cast<double>(trk_dump.PRN_start_sample_count)
|
||||
/ static_cast<double>(baseband_sampling_freq);
|
||||
trk_timestamp_s(epoch_counter) = static_cast<double>(trk_dump.PRN_start_sample_count) / static_cast<double>(baseband_sampling_freq);
|
||||
trk_acc_carrier_phase_cycles(epoch_counter) = trk_dump.acc_carrier_phase_rad / GPS_TWO_PI;
|
||||
trk_Doppler_Hz(epoch_counter) = trk_dump.carrier_doppler_hz;
|
||||
|
||||
double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS
|
||||
* (fmod( (static_cast<double>(trk_dump.PRN_start_sample_count) + trk_dump.aux1)
|
||||
/ static_cast<double>(baseband_sampling_freq), 1.0e-3) / 1.0e-3);
|
||||
double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS * (fmod((static_cast<double>(trk_dump.PRN_start_sample_count) + trk_dump.aux1) / static_cast<double>(baseband_sampling_freq), 1.0e-3) / 1.0e-3);
|
||||
|
||||
trk_prn_delay_chips(epoch_counter) = delay_chips;
|
||||
epoch_counter++;
|
||||
@@ -600,7 +599,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
||||
|
||||
//Align initial measurements and cut the tracking pull-in transitory
|
||||
double pull_in_offset_s = 1.0;
|
||||
arma::uvec initial_meas_point = arma::find( trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first");
|
||||
arma::uvec initial_meas_point = arma::find(trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first");
|
||||
|
||||
trk_timestamp_s = trk_timestamp_s.subvec(initial_meas_point(0), trk_timestamp_s.size() - 1);
|
||||
trk_acc_carrier_phase_cycles = trk_acc_carrier_phase_cycles.subvec(initial_meas_point(0), trk_acc_carrier_phase_cycles.size() - 1);
|
||||
@@ -610,8 +609,8 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
||||
check_results_doppler(true_timestamp_s, true_Doppler_Hz, trk_timestamp_s, trk_Doppler_Hz);
|
||||
check_results_codephase(true_timestamp_s, true_prn_delay_chips, trk_timestamp_s, trk_prn_delay_chips);
|
||||
check_results_acc_carrier_phase(true_timestamp_s,
|
||||
true_acc_carrier_phase_cycles, trk_timestamp_s,
|
||||
trk_acc_carrier_phase_cycles);
|
||||
true_acc_carrier_phase_cycles, trk_timestamp_s,
|
||||
trk_acc_carrier_phase_cycles);
|
||||
|
||||
std::cout << "Signal tracking completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user