2014-07-07 19:06:26 +00:00
|
|
|
/*!
|
|
|
|
* \file galileo_e1_dll_pll_veml_tracking_test.cc
|
|
|
|
* \brief This class implements a tracking test for Galileo_E5a_DLL_PLL_Tracking
|
|
|
|
* implementation based on some input parameters.
|
|
|
|
* \author Marc Sales, 2014. marcsales92(at)gmail.com
|
|
|
|
*
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2014-07-07 19:06:26 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2014-07-07 19:06:26 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2012-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2014-06-20 16:23:44 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2014-06-20 16:23:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2019-07-18 17:29:14 +00:00
|
|
|
#include "concurrent_queue.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "galileo_e5a_dll_pll_tracking.h"
|
|
|
|
#include "gnss_block_factory.h"
|
|
|
|
#include "gnss_block_interface.h"
|
|
|
|
#include "gnss_sdr_valve.h"
|
|
|
|
#include "gnss_synchro.h"
|
|
|
|
#include "in_memory_configuration.h"
|
2014-06-20 16:23:44 +00:00
|
|
|
#include <gnuradio/analog/sig_source_waveform.h>
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <gnuradio/blocks/file_source.h>
|
|
|
|
#include <gnuradio/blocks/null_sink.h>
|
|
|
|
#include <gnuradio/blocks/skiphead.h>
|
|
|
|
#include <gnuradio/top_block.h>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <chrono>
|
2018-08-31 11:52:35 +00:00
|
|
|
#ifdef GR_GREATER_38
|
|
|
|
#include <gnuradio/analog/sig_source.h>
|
|
|
|
#else
|
2014-06-20 16:23:44 +00:00
|
|
|
#include <gnuradio/analog/sig_source_c.h>
|
2018-08-31 11:52:35 +00:00
|
|
|
#endif
|
2014-06-20 16:23:44 +00:00
|
|
|
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
class GalileoE5aTrackingTest : public ::testing::Test
|
2014-06-20 16:23:44 +00:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
GalileoE5aTrackingTest()
|
|
|
|
{
|
2014-09-08 13:43:47 +00:00
|
|
|
factory = std::make_shared<GNSSBlockFactory>();
|
2014-06-20 16:23:44 +00:00
|
|
|
config = std::make_shared<InMemoryConfiguration>();
|
|
|
|
item_size = sizeof(gr_complex);
|
|
|
|
stop = false;
|
|
|
|
message = 0;
|
2015-05-15 09:47:34 +00:00
|
|
|
gnss_synchro = Gnss_Synchro();
|
2014-06-20 16:23:44 +00:00
|
|
|
}
|
|
|
|
|
2019-02-11 20:13:02 +00:00
|
|
|
~GalileoE5aTrackingTest() = default;
|
2014-06-20 16:23:44 +00:00
|
|
|
|
|
|
|
void init();
|
|
|
|
|
2019-07-16 15:41:12 +00:00
|
|
|
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
|
2014-06-20 16:23:44 +00:00
|
|
|
gr::top_block_sptr top_block;
|
|
|
|
std::shared_ptr<GNSSBlockFactory> factory;
|
|
|
|
std::shared_ptr<InMemoryConfiguration> config;
|
|
|
|
Gnss_Synchro gnss_synchro;
|
|
|
|
size_t item_size;
|
|
|
|
bool stop;
|
|
|
|
int message;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void GalileoE5aTrackingTest::init()
|
|
|
|
{
|
|
|
|
gnss_synchro.Channel_ID = 0;
|
|
|
|
gnss_synchro.System = 'E';
|
2017-10-28 22:44:38 +00:00
|
|
|
std::string signal = "5X";
|
2014-06-20 16:23:44 +00:00
|
|
|
signal.copy(gnss_synchro.Signal, 2, 0);
|
2014-09-12 08:56:04 +00:00
|
|
|
gnss_synchro.PRN = 11;
|
2014-08-05 00:01:37 +00:00
|
|
|
|
2017-09-02 09:24:44 +00:00
|
|
|
config->set_property("GNSS-SDR.internal_fs_sps", "32000000");
|
2017-10-28 22:44:38 +00:00
|
|
|
config->set_property("Tracking_5X.implementation", "Galileo_E5a_DLL_PLL_Tracking");
|
|
|
|
config->set_property("Tracking_5X.item_type", "gr_complex");
|
|
|
|
config->set_property("Tracking_5X.dump", "false");
|
2024-10-04 17:43:07 +00:00
|
|
|
config->set_property("Tracking_5X.dump_filename", "./e5a_tracking_ch_");
|
2017-10-28 22:44:38 +00:00
|
|
|
config->set_property("Tracking_5X.early_late_space_chips", "0.5");
|
|
|
|
config->set_property("Tracking_5X.order", "2");
|
2018-03-03 01:03:39 +00:00
|
|
|
config->set_property("Tracking_5X.pll_bw_hz", "20.0");
|
2018-02-18 18:28:21 +00:00
|
|
|
config->set_property("Tracking_5X.dll_bw_hz", "5.0");
|
2018-03-03 01:03:39 +00:00
|
|
|
config->set_property("Tracking_5X.pll_bw_narrow_hz", "2.0");
|
2018-02-18 18:28:21 +00:00
|
|
|
config->set_property("Tracking_5X.pll_bw_narrow_hz", "2.0");
|
2017-10-28 22:44:38 +00:00
|
|
|
config->set_property("Tracking_5X.ti_ms", "1");
|
2014-06-20 16:23:44 +00:00
|
|
|
}
|
|
|
|
|
2017-08-11 11:11:38 +00:00
|
|
|
|
2014-06-20 16:23:44 +00:00
|
|
|
TEST_F(GalileoE5aTrackingTest, ValidationOfResults)
|
|
|
|
{
|
2017-08-11 03:18:38 +00:00
|
|
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
2017-08-11 11:11:38 +00:00
|
|
|
std::chrono::duration<double> elapsed_seconds(0);
|
2014-09-08 13:43:47 +00:00
|
|
|
int fs_in = 32000000;
|
2017-10-28 22:44:38 +00:00
|
|
|
int nsamples = 32000000 * 5;
|
2014-06-20 16:23:44 +00:00
|
|
|
init();
|
2019-07-18 17:29:14 +00:00
|
|
|
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
|
2015-02-06 20:34:35 +00:00
|
|
|
top_block = gr::make_top_block("Tracking test");
|
2014-06-20 16:23:44 +00:00
|
|
|
|
|
|
|
// Example using smart pointers and the block factory
|
2020-07-13 13:17:15 +00:00
|
|
|
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config.get(), "Tracking_5X", 1, 1);
|
2014-06-20 16:23:44 +00:00
|
|
|
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
|
|
|
|
|
2019-08-18 23:29:04 +00:00
|
|
|
// REAL
|
2018-03-03 01:03:39 +00:00
|
|
|
gnss_synchro.Acq_delay_samples = 10; // 32 Msps
|
2014-09-06 01:42:22 +00:00
|
|
|
// gnss_synchro.Acq_doppler_hz = 3500; // 32 Msps
|
2018-03-03 01:03:39 +00:00
|
|
|
gnss_synchro.Acq_doppler_hz = 2000; // 500 Hz resolution
|
2014-09-06 01:42:22 +00:00
|
|
|
// gnss_synchro.Acq_samplestamp_samples = 98000;
|
2014-06-20 16:23:44 +00:00
|
|
|
gnss_synchro.Acq_samplestamp_samples = 0;
|
2014-07-07 19:06:26 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
ASSERT_NO_THROW({
|
2014-06-20 16:23:44 +00:00
|
|
|
tracking->set_channel(gnss_synchro.Channel_ID);
|
2017-10-28 22:44:38 +00:00
|
|
|
}) << "Failure setting channel.";
|
2014-06-20 16:23:44 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
ASSERT_NO_THROW({
|
2014-06-20 16:23:44 +00:00
|
|
|
tracking->set_gnss_synchro(&gnss_synchro);
|
2017-10-28 22:44:38 +00:00
|
|
|
}) << "Failure setting gnss_synchro.";
|
2014-06-20 16:23:44 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
ASSERT_NO_THROW({
|
2014-06-20 16:23:44 +00:00
|
|
|
tracking->connect(top_block);
|
2017-10-28 22:44:38 +00:00
|
|
|
}) << "Failure connecting tracking to the top_block.";
|
2014-06-20 16:23:44 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
ASSERT_NO_THROW({
|
2014-09-06 01:42:22 +00:00
|
|
|
gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
2020-06-18 09:49:28 +00:00
|
|
|
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
|
2014-09-06 01:42:22 +00:00
|
|
|
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
|
|
|
top_block->connect(source, 0, valve, 0);
|
|
|
|
top_block->connect(valve, 0, tracking->get_left_block(), 0);
|
|
|
|
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
2017-10-28 22:44:38 +00:00
|
|
|
}) << "Failure connecting the blocks of tracking test.";
|
2014-06-20 16:23:44 +00:00
|
|
|
|
|
|
|
tracking->start_tracking();
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
EXPECT_NO_THROW({
|
2017-08-11 03:18:38 +00:00
|
|
|
start = std::chrono::system_clock::now();
|
2018-03-03 01:03:39 +00:00
|
|
|
top_block->run(); // Start threads and wait
|
2017-08-11 03:18:38 +00:00
|
|
|
end = std::chrono::system_clock::now();
|
|
|
|
elapsed_seconds = end - start;
|
2017-10-28 22:44:38 +00:00
|
|
|
}) << "Failure running the top_block.";
|
2014-06-20 16:23:44 +00:00
|
|
|
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds\n";
|
2014-06-20 16:23:44 +00:00
|
|
|
}
|