mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-11-19 00:04:58 +00:00
Add unit test for new tracking blocks
This commit is contained in:
parent
ed1e99b15b
commit
4c83f59cfc
@ -0,0 +1,230 @@
|
|||||||
|
/*!
|
||||||
|
* \file glonass_l1_ca_dll_pll_c_aid_tracking_test.cc
|
||||||
|
* \brief This class implements a tracking test for GLONASS_L1_CA_DLL_PLL_Tracking
|
||||||
|
* implementation based on some input parameters.
|
||||||
|
* \author Gabriel Araujo, 2017. gabriel.araujo.5000(at)gmail.com
|
||||||
|
* \author Luis Esteve, 2017. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
|
#include <iostream>
|
||||||
|
#include <gnuradio/top_block.h>
|
||||||
|
#include <gnuradio/blocks/file_source.h>
|
||||||
|
#include <gnuradio/analog/sig_source_waveform.h>
|
||||||
|
#include <gnuradio/analog/sig_source_c.h>
|
||||||
|
#include <gnuradio/msg_queue.h>
|
||||||
|
#include <gnuradio/blocks/null_sink.h>
|
||||||
|
#include <gnuradio/blocks/skiphead.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include "gnss_block_factory.h"
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
#include "tracking_interface.h"
|
||||||
|
#include "in_memory_configuration.h"
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
#include "gnss_synchro.h"
|
||||||
|
// #include "signal_conditioner.h"
|
||||||
|
#include "glonass_l1_ca_dll_pll_c_aid_tracking.h"
|
||||||
|
|
||||||
|
|
||||||
|
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
||||||
|
class GlonassL1CaDllPllCAidTrackingTest_msg_rx;
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<GlonassL1CaDllPllCAidTrackingTest_msg_rx> GlonassL1CaDllPllCAidTrackingTest_msg_rx_sptr;
|
||||||
|
|
||||||
|
GlonassL1CaDllPllCAidTrackingTest_msg_rx_sptr GlonassL1CaDllPllCAidTrackingTest_msg_rx_make();
|
||||||
|
|
||||||
|
class GlonassL1CaDllPllCAidTrackingTest_msg_rx : public gr::block
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
friend GlonassL1CaDllPllCAidTrackingTest_msg_rx_sptr GlonassL1CaDllPllCAidTrackingTest_msg_rx_make();
|
||||||
|
void msg_handler_events(pmt::pmt_t msg);
|
||||||
|
GlonassL1CaDllPllCAidTrackingTest_msg_rx();
|
||||||
|
|
||||||
|
public:
|
||||||
|
int rx_message;
|
||||||
|
~GlonassL1CaDllPllCAidTrackingTest_msg_rx(); //!< Default destructor
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GlonassL1CaDllPllCAidTrackingTest_msg_rx_sptr GlonassL1CaDllPllCAidTrackingTest_msg_rx_make()
|
||||||
|
{
|
||||||
|
return GlonassL1CaDllPllCAidTrackingTest_msg_rx_sptr(new GlonassL1CaDllPllCAidTrackingTest_msg_rx());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GlonassL1CaDllPllCAidTrackingTest_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_telemetry Bad any cast!";
|
||||||
|
rx_message = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GlonassL1CaDllPllCAidTrackingTest_msg_rx::GlonassL1CaDllPllCAidTrackingTest_msg_rx() :
|
||||||
|
gr::block("GlonassL1CaDllPllCAidTrackingTest_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(&GlonassL1CaDllPllCAidTrackingTest_msg_rx::msg_handler_events, this, _1));
|
||||||
|
rx_message = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GlonassL1CaDllPllCAidTrackingTest_msg_rx::~GlonassL1CaDllPllCAidTrackingTest_msg_rx()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ###########################################################
|
||||||
|
|
||||||
|
|
||||||
|
class GlonassL1CaDllPllCAidTrackingTest: public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
GlonassL1CaDllPllCAidTrackingTest()
|
||||||
|
{
|
||||||
|
factory = std::make_shared<GNSSBlockFactory>();
|
||||||
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
gnss_synchro = Gnss_Synchro();
|
||||||
|
}
|
||||||
|
|
||||||
|
~GlonassL1CaDllPllCAidTrackingTest()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
gr::msg_queue::sptr queue;
|
||||||
|
gr::top_block_sptr top_block;
|
||||||
|
std::shared_ptr<GNSSBlockFactory> factory;
|
||||||
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
|
Gnss_Synchro gnss_synchro;
|
||||||
|
size_t item_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void GlonassL1CaDllPllCAidTrackingTest::init()
|
||||||
|
{
|
||||||
|
gnss_synchro.Channel_ID = 0;
|
||||||
|
gnss_synchro.System = 'R';
|
||||||
|
std::string signal = "1G";
|
||||||
|
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||||
|
gnss_synchro.PRN = 11;
|
||||||
|
|
||||||
|
config->set_property("GNSS-SDR.internal_fs_hz", "6625000");
|
||||||
|
|
||||||
|
|
||||||
|
std::string path = std::string(TEST_PATH);
|
||||||
|
std::string file = path + "signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_schar_10s.bin";
|
||||||
|
const char * file_name = file.c_str();
|
||||||
|
|
||||||
|
config->set_property("SignalSource.implementation","File_Signal_Source");
|
||||||
|
config->set_property("SignalSource.filename",file_name);
|
||||||
|
config->set_property("SignalSource.item_type","ibyte");
|
||||||
|
config->set_property("SignalSource.sampling_frequency","6625000");
|
||||||
|
|
||||||
|
config->set_property("SignalConditioner.implementation","Signal_Conditioner");
|
||||||
|
config->set_property("DataTypeAdapter.implementation","Ibyte_To_Complex");
|
||||||
|
config->set_property("InputFilter.implementation","Pass_Through");
|
||||||
|
config->set_property("InputFilter.item_type","gr_complex");
|
||||||
|
config->set_property("Resampler.implementation","Direct_Resampler");
|
||||||
|
config->set_property("Resampler.sample_freq_in","6625000");
|
||||||
|
config->set_property("Resampler.sample_freq_out","2000000");
|
||||||
|
config->set_property("Resampler.item_type","gr_complex");
|
||||||
|
|
||||||
|
config->set_property("Tracking_1G.item_type", "gr_complex");
|
||||||
|
config->set_property("Tracking_1G.dump", "true");
|
||||||
|
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", "20");
|
||||||
|
config->set_property("Tracking_1G.dll_bw_hz", "4");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(GlonassL1CaDllPllCAidTrackingTest, ValidationOfResults)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
long long int begin = 0;
|
||||||
|
long long int end = 0;
|
||||||
|
int fs_in = 6625000;
|
||||||
|
int nsamples = fs_in*4e-3*2;
|
||||||
|
|
||||||
|
init();
|
||||||
|
queue = gr::msg_queue::make(0);
|
||||||
|
top_block = gr::make_top_block("Tracking test");
|
||||||
|
std::shared_ptr<TrackingInterface> tracking = std::make_shared<GlonassL1CaDllPllTracking>(config.get(), "Tracking_1G", 1, 1);
|
||||||
|
boost::shared_ptr<GlonassL1CaDllPllCAidTrackingTest_msg_rx> msg_rx = GlonassL1CaDllPllCAidTrackingTest_msg_rx_make();
|
||||||
|
|
||||||
|
gnss_synchro.Acq_delay_samples = 1343;
|
||||||
|
gnss_synchro.Acq_doppler_hz = -2750;
|
||||||
|
// gnss_synchro.Acq_doppler_hz = -2750;
|
||||||
|
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||||
|
}) << "Failure setting channel." << std::endl;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
tracking->set_gnss_synchro(&gnss_synchro);
|
||||||
|
}) << "Failure setting gnss_synchro." << std::endl;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
tracking->connect(top_block);
|
||||||
|
}) << "Failure connecting tracking to the top_block." << std::endl;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
gr::analog::sig_source_c::sptr sin_source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||||
|
std::string path = std::string(TEST_PATH);
|
||||||
|
std::string file = path + "signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin";
|
||||||
|
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);
|
||||||
|
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||||
|
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||||
|
top_block->connect(file_source, 0, valve, 0);
|
||||||
|
top_block->connect(valve, 0, tracking->get_left_block(), 0);
|
||||||
|
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
||||||
|
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
|
}) << "Failure connecting the blocks of tracking test." << std::endl;
|
||||||
|
|
||||||
|
tracking->start_tracking();
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
begin = tv.tv_sec *1000000 + tv.tv_usec;
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||||
|
}) << "Failure running the top_block." << std::endl;
|
||||||
|
|
||||||
|
// TODO: Verify tracking results
|
||||||
|
std::cout << "Tracked " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
||||||
|
}
|
@ -0,0 +1,233 @@
|
|||||||
|
/*!
|
||||||
|
* \file glonass_l1_ca_dll_pll_tracking_test.cc
|
||||||
|
* \brief This class implements a tracking test for GLONASS_L1_CA_DLL_PLL_Tracking
|
||||||
|
* implementation based on some input parameters.
|
||||||
|
* \author Gabriel Araujo, 2017. gabriel.araujo.5000(at)gmail.com
|
||||||
|
* \author Luis Esteve, 2017. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
|
#include <iostream>
|
||||||
|
#include <gnuradio/top_block.h>
|
||||||
|
#include <gnuradio/blocks/file_source.h>
|
||||||
|
#include <gnuradio/analog/sig_source_waveform.h>
|
||||||
|
#include <gnuradio/analog/sig_source_c.h>
|
||||||
|
#include <gnuradio/msg_queue.h>
|
||||||
|
#include <gnuradio/blocks/null_sink.h>
|
||||||
|
#include <gnuradio/blocks/skiphead.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include "gnss_block_factory.h"
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
#include "tracking_interface.h"
|
||||||
|
#include "in_memory_configuration.h"
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
#include "gnss_synchro.h"
|
||||||
|
#include "array_signal_conditioner.h"
|
||||||
|
#include "signal_conditioner.h"
|
||||||
|
#include "ibyte_to_complex.h"
|
||||||
|
#include "direct_resampler_conditioner.h"
|
||||||
|
#include "glonass_l1_ca_dll_pll_tracking.h"
|
||||||
|
|
||||||
|
|
||||||
|
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
||||||
|
class GlonassL1CaDllPllTrackingTest_msg_rx;
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<GlonassL1CaDllPllTrackingTest_msg_rx> GlonassL1CaDllPllTrackingTest_msg_rx_sptr;
|
||||||
|
|
||||||
|
GlonassL1CaDllPllTrackingTest_msg_rx_sptr GlonassL1CaDllPllTrackingTest_msg_rx_make();
|
||||||
|
|
||||||
|
class GlonassL1CaDllPllTrackingTest_msg_rx : public gr::block
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
friend GlonassL1CaDllPllTrackingTest_msg_rx_sptr GlonassL1CaDllPllTrackingTest_msg_rx_make();
|
||||||
|
void msg_handler_events(pmt::pmt_t msg);
|
||||||
|
GlonassL1CaDllPllTrackingTest_msg_rx();
|
||||||
|
|
||||||
|
public:
|
||||||
|
int rx_message;
|
||||||
|
~GlonassL1CaDllPllTrackingTest_msg_rx(); //!< Default destructor
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GlonassL1CaDllPllTrackingTest_msg_rx_sptr GlonassL1CaDllPllTrackingTest_msg_rx_make()
|
||||||
|
{
|
||||||
|
return GlonassL1CaDllPllTrackingTest_msg_rx_sptr(new GlonassL1CaDllPllTrackingTest_msg_rx());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GlonassL1CaDllPllTrackingTest_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_telemetry Bad any cast!";
|
||||||
|
rx_message = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GlonassL1CaDllPllTrackingTest_msg_rx::GlonassL1CaDllPllTrackingTest_msg_rx() :
|
||||||
|
gr::block("GlonassL1CaDllPllTrackingTest_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(&GlonassL1CaDllPllTrackingTest_msg_rx::msg_handler_events, this, _1));
|
||||||
|
rx_message = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GlonassL1CaDllPllTrackingTest_msg_rx::~GlonassL1CaDllPllTrackingTest_msg_rx()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ###########################################################
|
||||||
|
|
||||||
|
|
||||||
|
class GlonassL1CaDllPllTrackingTest: public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
GlonassL1CaDllPllTrackingTest()
|
||||||
|
{
|
||||||
|
factory = std::make_shared<GNSSBlockFactory>();
|
||||||
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
gnss_synchro = Gnss_Synchro();
|
||||||
|
}
|
||||||
|
|
||||||
|
~GlonassL1CaDllPllTrackingTest()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
gr::msg_queue::sptr queue;
|
||||||
|
gr::top_block_sptr top_block;
|
||||||
|
std::shared_ptr<GNSSBlockFactory> factory;
|
||||||
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
|
Gnss_Synchro gnss_synchro;
|
||||||
|
size_t item_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void GlonassL1CaDllPllTrackingTest::init()
|
||||||
|
{
|
||||||
|
gnss_synchro.Channel_ID = 0;
|
||||||
|
gnss_synchro.System = 'R';
|
||||||
|
std::string signal = "1G";
|
||||||
|
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||||
|
gnss_synchro.PRN = 11;
|
||||||
|
|
||||||
|
config->set_property("GNSS-SDR.internal_fs_hz", "6625000");
|
||||||
|
|
||||||
|
|
||||||
|
std::string path = std::string(TEST_PATH);
|
||||||
|
std::string file = path + "signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_schar_10s.bin";
|
||||||
|
const char * file_name = file.c_str();
|
||||||
|
|
||||||
|
config->set_property("SignalSource.implementation","File_Signal_Source");
|
||||||
|
config->set_property("SignalSource.filename",file_name);
|
||||||
|
config->set_property("SignalSource.item_type","ibyte");
|
||||||
|
config->set_property("SignalSource.sampling_frequency","6625000");
|
||||||
|
|
||||||
|
config->set_property("SignalConditioner.implementation","Signal_Conditioner");
|
||||||
|
config->set_property("DataTypeAdapter.implementation","Ibyte_To_Complex");
|
||||||
|
config->set_property("InputFilter.implementation","Pass_Through");
|
||||||
|
config->set_property("InputFilter.item_type","gr_complex");
|
||||||
|
config->set_property("Resampler.implementation","Direct_Resampler");
|
||||||
|
config->set_property("Resampler.sample_freq_in","6625000");
|
||||||
|
config->set_property("Resampler.sample_freq_out","2000000");
|
||||||
|
config->set_property("Resampler.item_type","gr_complex");
|
||||||
|
|
||||||
|
config->set_property("Tracking_1G.item_type", "gr_complex");
|
||||||
|
config->set_property("Tracking_1G.dump", "true");
|
||||||
|
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", "20");
|
||||||
|
config->set_property("Tracking_1G.dll_bw_hz", "4");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(GlonassL1CaDllPllTrackingTest, ValidationOfResults)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
long long int begin = 0;
|
||||||
|
long long int end = 0;
|
||||||
|
int fs_in = 6625000;
|
||||||
|
int nsamples = fs_in*4e-3*2;
|
||||||
|
|
||||||
|
init();
|
||||||
|
queue = gr::msg_queue::make(0);
|
||||||
|
top_block = gr::make_top_block("Tracking test");
|
||||||
|
std::shared_ptr<TrackingInterface> tracking = std::make_shared<GlonassL1CaDllPllTracking>(config.get(), "Tracking_1G", 1, 1);
|
||||||
|
boost::shared_ptr<GlonassL1CaDllPllTrackingTest_msg_rx> msg_rx = GlonassL1CaDllPllTrackingTest_msg_rx_make();
|
||||||
|
|
||||||
|
gnss_synchro.Acq_delay_samples = 1343;
|
||||||
|
gnss_synchro.Acq_doppler_hz = -2750;
|
||||||
|
// gnss_synchro.Acq_doppler_hz = -2750;
|
||||||
|
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||||
|
}) << "Failure setting channel." << std::endl;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
tracking->set_gnss_synchro(&gnss_synchro);
|
||||||
|
}) << "Failure setting gnss_synchro." << std::endl;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
tracking->connect(top_block);
|
||||||
|
}) << "Failure connecting tracking to the top_block." << std::endl;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
gr::analog::sig_source_c::sptr sin_source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||||
|
std::string path = std::string(TEST_PATH);
|
||||||
|
std::string file = path + "signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin";
|
||||||
|
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);
|
||||||
|
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||||
|
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||||
|
top_block->connect(file_source, 0, valve, 0);
|
||||||
|
top_block->connect(valve, 0, tracking->get_left_block(), 0);
|
||||||
|
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
||||||
|
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
|
}) << "Failure connecting the blocks of tracking test." << std::endl;
|
||||||
|
|
||||||
|
tracking->start_tracking();
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
begin = tv.tv_sec *1000000 + tv.tv_usec;
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||||
|
}) << "Failure running the top_block." << std::endl;
|
||||||
|
|
||||||
|
// TODO: Verify tracking results
|
||||||
|
std::cout << "Tracked " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user