mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-11-04 01:03:04 +00:00 
			
		
		
		
	Code cleaning
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@261 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
		@@ -35,14 +35,11 @@
 | 
			
		||||
#include "file_output_filter.h"
 | 
			
		||||
#include "in_memory_configuration.h"
 | 
			
		||||
 | 
			
		||||
TEST(FileOutputFilter, Instantiate) {
 | 
			
		||||
 | 
			
		||||
TEST(FileOutputFilter, Instantiate)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration* config = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	config->set_property("Test.filename", "../data/output.dat");
 | 
			
		||||
	config->set_property("Test.item_type", "float");
 | 
			
		||||
 | 
			
		||||
	FileOutputFilter *output_filter = new FileOutputFilter(config, "Test", 1, 0);
 | 
			
		||||
 | 
			
		||||
	delete output_filter;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,21 +30,17 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <gtest/gtest.h>
 | 
			
		||||
 | 
			
		||||
#include <gr_block.h>
 | 
			
		||||
#include <gr_msg_queue.h>
 | 
			
		||||
#include <gr_top_block.h>
 | 
			
		||||
#include <gr_null_sink.h>
 | 
			
		||||
 | 
			
		||||
#include <stdexcept>
 | 
			
		||||
 | 
			
		||||
#include "file_signal_source.h"
 | 
			
		||||
#include "in_memory_configuration.h"
 | 
			
		||||
 | 
			
		||||
TEST(FileSignalSource, Instantiate) {
 | 
			
		||||
 | 
			
		||||
TEST(FileSignalSource, Instantiate)
 | 
			
		||||
{
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	InMemoryConfiguration* config = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	config->set_property("Test.samples", "0");
 | 
			
		||||
@@ -62,10 +58,9 @@ TEST(FileSignalSource, Instantiate) {
 | 
			
		||||
	delete signal_source;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(FileSignalSource, InstantiateFileNotExists) {
 | 
			
		||||
 | 
			
		||||
TEST(FileSignalSource, InstantiateFileNotExists)
 | 
			
		||||
{
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	InMemoryConfiguration* config = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	config->set_property("Test.samples", "0");
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,6 @@
 | 
			
		||||
#include <gnuradio/gr_sig_source_c.h>
 | 
			
		||||
#include <gnuradio/gr_msg_queue.h>
 | 
			
		||||
#include <gnuradio/gr_null_sink.h>
 | 
			
		||||
 | 
			
		||||
#include "gnss_block_factory.h"
 | 
			
		||||
#include "gnss_block_interface.h"
 | 
			
		||||
#include "in_memory_configuration.h"
 | 
			
		||||
@@ -45,16 +44,19 @@
 | 
			
		||||
 | 
			
		||||
DEFINE_string(filter_test_output_filename, "../src/tests/data/fir_filter_test_output.dat", "Dump filename");
 | 
			
		||||
 | 
			
		||||
class Fir_Filter_Test: public ::testing::Test {
 | 
			
		||||
class Fir_Filter_Test: public ::testing::Test
 | 
			
		||||
{
 | 
			
		||||
protected:
 | 
			
		||||
	Fir_Filter_Test() {
 | 
			
		||||
	Fir_Filter_Test()
 | 
			
		||||
	{
 | 
			
		||||
		queue = gr_make_msg_queue(0);
 | 
			
		||||
		top_block = gr_make_top_block("Fir filter test");
 | 
			
		||||
		config = new InMemoryConfiguration();
 | 
			
		||||
		item_size = sizeof(gr_complex);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	~Fir_Filter_Test() {
 | 
			
		||||
	~Fir_Filter_Test()
 | 
			
		||||
	{
 | 
			
		||||
		delete config;
 | 
			
		||||
	}
 | 
			
		||||
	void init();
 | 
			
		||||
@@ -62,11 +64,10 @@ protected:
 | 
			
		||||
	gr_top_block_sptr top_block;
 | 
			
		||||
	InMemoryConfiguration* config;
 | 
			
		||||
	size_t item_size;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void Fir_Filter_Test::init(){
 | 
			
		||||
 | 
			
		||||
void Fir_Filter_Test::init()
 | 
			
		||||
{
 | 
			
		||||
	config->set_property("InputFilter.number_of_taps", "4");
 | 
			
		||||
	config->set_property("InputFilter.number_of_bands", "2");
 | 
			
		||||
 | 
			
		||||
@@ -85,17 +86,14 @@ void Fir_Filter_Test::init(){
 | 
			
		||||
 | 
			
		||||
	config->set_property("InputFilter.filter_type", "bandpass");
 | 
			
		||||
	config->set_property("InputFilter.grid_density", "16");
 | 
			
		||||
 | 
			
		||||
//		config->set_property("InputFilter.dump", "true");
 | 
			
		||||
 | 
			
		||||
	//config->set_property("InputFilter.dump", "true");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST_F(Fir_Filter_Test, Instantiate)
 | 
			
		||||
{
 | 
			
		||||
	init();
 | 
			
		||||
 | 
			
		||||
	FirFilter *filter = new FirFilter(config, "InputFilter", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
	delete filter;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -104,31 +102,31 @@ TEST_F(Fir_Filter_Test, ConnectAndRun)
 | 
			
		||||
	int fs_in = 8000000;
 | 
			
		||||
	int nsamples = 10000000;
 | 
			
		||||
	struct timeval tv;
 | 
			
		||||
    long long int begin = 0;
 | 
			
		||||
    long long int end = 0;
 | 
			
		||||
	long long int begin = 0;
 | 
			
		||||
	long long int end = 0;
 | 
			
		||||
 | 
			
		||||
    init();
 | 
			
		||||
	init();
 | 
			
		||||
 | 
			
		||||
	FirFilter *filter = new FirFilter(config, "InputFilter", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
	ASSERT_NO_THROW( {
 | 
			
		||||
			filter->connect(top_block);
 | 
			
		||||
			gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in,GR_SIN_WAVE, 1000, 1, gr_complex(0));
 | 
			
		||||
			gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
 | 
			
		||||
			gr_block_sptr null_sink = gr_make_null_sink(item_size);
 | 
			
		||||
		filter->connect(top_block);
 | 
			
		||||
		gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in,GR_SIN_WAVE, 1000, 1, gr_complex(0));
 | 
			
		||||
		gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
 | 
			
		||||
		gr_block_sptr null_sink = gr_make_null_sink(item_size);
 | 
			
		||||
 | 
			
		||||
			top_block->connect(source, 0, valve, 0);
 | 
			
		||||
			top_block->connect(valve, 0, filter->get_left_block(), 0);
 | 
			
		||||
			top_block->connect(filter->get_right_block(), 0, null_sink, 0);
 | 
			
		||||
		}) << "Failure connecting the top_block."<< std::endl;
 | 
			
		||||
		top_block->connect(source, 0, valve, 0);
 | 
			
		||||
		top_block->connect(valve, 0, filter->get_left_block(), 0);
 | 
			
		||||
		top_block->connect(filter->get_right_block(), 0, null_sink, 0);
 | 
			
		||||
	}) << "Failure connecting the top_block."<< std::endl;
 | 
			
		||||
 | 
			
		||||
	EXPECT_NO_THROW( {
 | 
			
		||||
			gettimeofday(&tv, NULL);
 | 
			
		||||
			begin = tv.tv_sec *1000000 + tv.tv_usec;
 | 
			
		||||
			top_block->run(); // Start threads and wait
 | 
			
		||||
			gettimeofday(&tv, NULL);
 | 
			
		||||
			end = tv.tv_sec *1000000 + tv.tv_usec;
 | 
			
		||||
		}) << "Failure running he top_block."<< std::endl;
 | 
			
		||||
		gettimeofday(&tv, NULL);
 | 
			
		||||
		begin = tv.tv_sec *1000000 + tv.tv_usec;
 | 
			
		||||
		top_block->run(); // Start threads and wait
 | 
			
		||||
		gettimeofday(&tv, NULL);
 | 
			
		||||
		end = tv.tv_sec *1000000 + tv.tv_usec;
 | 
			
		||||
	}) << "Failure running he top_block."<< std::endl;
 | 
			
		||||
	std::cout <<  "Filtered " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
 | 
			
		||||
 | 
			
		||||
	delete filter;
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,6 @@
 | 
			
		||||
#include <gnuradio/gr_msg_queue.h>
 | 
			
		||||
#include <gnuradio/gr_null_sink.h>
 | 
			
		||||
#include <gnuradio/gr_skiphead.h>
 | 
			
		||||
 | 
			
		||||
#include "gnss_block_factory.h"
 | 
			
		||||
#include "gnss_block_interface.h"
 | 
			
		||||
#include "in_memory_configuration.h"
 | 
			
		||||
@@ -50,54 +49,58 @@
 | 
			
		||||
 | 
			
		||||
#include "galileo_e1_dll_pll_veml_tracking.h"
 | 
			
		||||
 | 
			
		||||
class GalileoE1DllPllVemlTrackingInternalTest: public ::testing::Test {
 | 
			
		||||
class GalileoE1DllPllVemlTrackingInternalTest: public ::testing::Test
 | 
			
		||||
{
 | 
			
		||||
protected:
 | 
			
		||||
    GalileoE1DllPllVemlTrackingInternalTest() {
 | 
			
		||||
        queue = gr_make_msg_queue(0);
 | 
			
		||||
        top_block = gr_make_top_block("Tracking test");
 | 
			
		||||
        factory = new GNSSBlockFactory();
 | 
			
		||||
        config = new InMemoryConfiguration();
 | 
			
		||||
        item_size = sizeof(gr_complex);
 | 
			
		||||
        stop = false;
 | 
			
		||||
        message = 0;
 | 
			
		||||
    }
 | 
			
		||||
	GalileoE1DllPllVemlTrackingInternalTest()
 | 
			
		||||
	{
 | 
			
		||||
		queue = gr_make_msg_queue(0);
 | 
			
		||||
		top_block = gr_make_top_block("Tracking test");
 | 
			
		||||
		factory = new GNSSBlockFactory();
 | 
			
		||||
		config = new InMemoryConfiguration();
 | 
			
		||||
		item_size = sizeof(gr_complex);
 | 
			
		||||
		stop = false;
 | 
			
		||||
		message = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    ~GalileoE1DllPllVemlTrackingInternalTest() {
 | 
			
		||||
        delete factory;
 | 
			
		||||
        delete config;
 | 
			
		||||
    }
 | 
			
		||||
	~GalileoE1DllPllVemlTrackingInternalTest()
 | 
			
		||||
	{
 | 
			
		||||
		delete factory;
 | 
			
		||||
		delete config;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    void init();
 | 
			
		||||
	void init();
 | 
			
		||||
 | 
			
		||||
    gr_msg_queue_sptr queue;
 | 
			
		||||
    gr_top_block_sptr top_block;
 | 
			
		||||
    GNSSBlockFactory* factory;
 | 
			
		||||
    InMemoryConfiguration* config;
 | 
			
		||||
    Gnss_Synchro gnss_synchro;
 | 
			
		||||
    size_t item_size;
 | 
			
		||||
    concurrent_queue<int> channel_internal_queue;
 | 
			
		||||
    bool stop;
 | 
			
		||||
    int message;
 | 
			
		||||
    boost::thread ch_thread;
 | 
			
		||||
	gr_msg_queue_sptr queue;
 | 
			
		||||
	gr_top_block_sptr top_block;
 | 
			
		||||
	GNSSBlockFactory* factory;
 | 
			
		||||
	InMemoryConfiguration* config;
 | 
			
		||||
	Gnss_Synchro gnss_synchro;
 | 
			
		||||
	size_t item_size;
 | 
			
		||||
	concurrent_queue<int> channel_internal_queue;
 | 
			
		||||
	bool stop;
 | 
			
		||||
	int message;
 | 
			
		||||
	boost::thread ch_thread;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void GalileoE1DllPllVemlTrackingInternalTest::init(){
 | 
			
		||||
 | 
			
		||||
    gnss_synchro.Channel_ID=0;
 | 
			
		||||
    gnss_synchro.System = 'E';
 | 
			
		||||
    std::string signal = "1B";
 | 
			
		||||
    signal.copy(gnss_synchro.Signal,2,0);
 | 
			
		||||
    gnss_synchro.PRN=11;
 | 
			
		||||
void GalileoE1DllPllVemlTrackingInternalTest::init()
 | 
			
		||||
{
 | 
			
		||||
	gnss_synchro.Channel_ID=0;
 | 
			
		||||
	gnss_synchro.System = 'E';
 | 
			
		||||
	std::string signal = "1B";
 | 
			
		||||
	signal.copy(gnss_synchro.Signal,2,0);
 | 
			
		||||
	gnss_synchro.PRN=11;
 | 
			
		||||
 | 
			
		||||
    config->set_property("GNSS-SDR.internal_fs_hz", "8000000");
 | 
			
		||||
    config->set_property("Tracking.item_type", "gr_complex");
 | 
			
		||||
    config->set_property("Tracking.dump", "true");
 | 
			
		||||
    config->set_property("Tracking.dump_filename", "../data/veml_tracking_ch_");
 | 
			
		||||
    config->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_Tracking");
 | 
			
		||||
    config->set_property("Tracking.early_late_space_chips", "0.15");
 | 
			
		||||
    config->set_property("Tracking.very_early_late_space_chips", "0.6");
 | 
			
		||||
    config->set_property("Tracking.pll_bw_hz", "30.0");
 | 
			
		||||
    config->set_property("Tracking.dll_bw_hz", "2.0");
 | 
			
		||||
	config->set_property("GNSS-SDR.internal_fs_hz", "8000000");
 | 
			
		||||
	config->set_property("Tracking.item_type", "gr_complex");
 | 
			
		||||
	config->set_property("Tracking.dump", "true");
 | 
			
		||||
	config->set_property("Tracking.dump_filename", "../data/veml_tracking_ch_");
 | 
			
		||||
	config->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_Tracking");
 | 
			
		||||
	config->set_property("Tracking.early_late_space_chips", "0.15");
 | 
			
		||||
	config->set_property("Tracking.very_early_late_space_chips", "0.6");
 | 
			
		||||
	config->set_property("Tracking.pll_bw_hz", "30.0");
 | 
			
		||||
	config->set_property("Tracking.dll_bw_hz", "2.0");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -105,13 +108,10 @@ void GalileoE1DllPllVemlTrackingInternalTest::init(){
 | 
			
		||||
TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    init();
 | 
			
		||||
 | 
			
		||||
    GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue);
 | 
			
		||||
    EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str());
 | 
			
		||||
 | 
			
		||||
    delete tracking;
 | 
			
		||||
 | 
			
		||||
	init();
 | 
			
		||||
	GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue);
 | 
			
		||||
	EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str());
 | 
			
		||||
	delete tracking;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun)
 | 
			
		||||
@@ -152,68 +152,66 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate)
 | 
			
		||||
 | 
			
		||||
TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
 | 
			
		||||
{
 | 
			
		||||
    struct timeval tv;
 | 
			
		||||
    long long int begin;
 | 
			
		||||
    long long int end;
 | 
			
		||||
//    int num_samples = 40000000; // 4 Msps
 | 
			
		||||
//    unsigned int skiphead_sps = 24000000; // 4 Msps
 | 
			
		||||
    int num_samples = 80000000; // 8 Msps
 | 
			
		||||
    unsigned int skiphead_sps = 8000000; // 8 Msps
 | 
			
		||||
    init();
 | 
			
		||||
    GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue);
 | 
			
		||||
	struct timeval tv;
 | 
			
		||||
	long long int begin;
 | 
			
		||||
	long long int end;
 | 
			
		||||
	// int num_samples = 40000000; // 4 Msps
 | 
			
		||||
	// unsigned int skiphead_sps = 24000000; // 4 Msps
 | 
			
		||||
	int num_samples = 80000000; // 8 Msps
 | 
			
		||||
	unsigned int skiphead_sps = 8000000; // 8 Msps
 | 
			
		||||
	init();
 | 
			
		||||
	GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
//    gnss_synchro.Acq_delay_samples=1753; // 4 Msps
 | 
			
		||||
//    gnss_synchro.Acq_doppler_hz=-9500; // 4 Msps
 | 
			
		||||
    gnss_synchro.Acq_delay_samples=17256; // 8 Msps
 | 
			
		||||
    gnss_synchro.Acq_doppler_hz=-8750; // 8 Msps
 | 
			
		||||
    gnss_synchro.Acq_samplestamp_samples=0;
 | 
			
		||||
	// gnss_synchro.Acq_delay_samples=1753; // 4 Msps
 | 
			
		||||
	// gnss_synchro.Acq_doppler_hz=-9500; // 4 Msps
 | 
			
		||||
	gnss_synchro.Acq_delay_samples=17256; // 8 Msps
 | 
			
		||||
	gnss_synchro.Acq_doppler_hz=-8750; // 8 Msps
 | 
			
		||||
	gnss_synchro.Acq_samplestamp_samples=0;
 | 
			
		||||
 | 
			
		||||
    ASSERT_NO_THROW( {
 | 
			
		||||
        tracking->set_channel(gnss_synchro.Channel_ID);
 | 
			
		||||
    }) << "Failure setting channel."<< std::endl;
 | 
			
		||||
	ASSERT_NO_THROW( {
 | 
			
		||||
		tracking->set_channel(gnss_synchro.Channel_ID);
 | 
			
		||||
	}) << "Failure setting channel."<< std::endl;
 | 
			
		||||
 | 
			
		||||
    ASSERT_NO_THROW( {
 | 
			
		||||
        tracking->set_gnss_synchro(&gnss_synchro);
 | 
			
		||||
    }) << "Failure setting gnss_synchro."<< std::endl;
 | 
			
		||||
	ASSERT_NO_THROW( {
 | 
			
		||||
		tracking->set_gnss_synchro(&gnss_synchro);
 | 
			
		||||
	}) << "Failure setting gnss_synchro."<< std::endl;
 | 
			
		||||
 | 
			
		||||
    ASSERT_NO_THROW( {
 | 
			
		||||
        tracking->set_channel_queue(&channel_internal_queue);
 | 
			
		||||
    }) << "Failure setting channel_internal_queue."<< std::endl;
 | 
			
		||||
	ASSERT_NO_THROW( {
 | 
			
		||||
		tracking->set_channel_queue(&channel_internal_queue);
 | 
			
		||||
	}) << "Failure setting channel_internal_queue."<< std::endl;
 | 
			
		||||
 | 
			
		||||
	ASSERT_NO_THROW( {
 | 
			
		||||
		tracking->connect(top_block);
 | 
			
		||||
	}) << "Failure connecting tracking to the top_block."<< std::endl;
 | 
			
		||||
 | 
			
		||||
	ASSERT_NO_THROW( {
 | 
			
		||||
		std::string file = "/media/DATA/Proyectos/Signals/cttc_2012_07_26/cp_cttc_2012_07_26_n6_8Msps.dat";
 | 
			
		||||
		// std::string file = "/media/DATA/Proyectos/Signals/cttc_2012_07_26/cp_cttc_2012_07_26_n4_4Msps.dat";
 | 
			
		||||
		// std::string file = "/media/DATA/Proyectos/Signals/prueba.dat";
 | 
			
		||||
		// std::string file = "../data/resampler.dat";
 | 
			
		||||
		const char * file_name = file.c_str();
 | 
			
		||||
		gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false);
 | 
			
		||||
		gr_skiphead_sptr skip_head = gr_make_skiphead(sizeof(gr_complex), skiphead_sps);
 | 
			
		||||
		gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), num_samples, queue);
 | 
			
		||||
		gr_null_sink_sptr sink = gr_make_null_sink(sizeof(Gnss_Synchro));
 | 
			
		||||
		top_block->connect(file_source, 0, skip_head, 0);
 | 
			
		||||
		top_block->connect(skip_head, 0, valve, 0);
 | 
			
		||||
		top_block->connect(valve, 0, tracking->get_left_block(), 0);
 | 
			
		||||
		top_block->connect(tracking->get_right_block(), 0, sink, 0);
 | 
			
		||||
	}) << "Failure connecting the blocks of tracking test."<< std::endl;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    ASSERT_NO_THROW( {
 | 
			
		||||
        tracking->connect(top_block);
 | 
			
		||||
    }) << "Failure connecting tracking to the top_block."<< std::endl;
 | 
			
		||||
	tracking->start_tracking();
 | 
			
		||||
 | 
			
		||||
    ASSERT_NO_THROW( {
 | 
			
		||||
            std::string file = "/media/DATA/Proyectos/Signals/cttc_2012_07_26/cp_cttc_2012_07_26_n6_8Msps.dat";
 | 
			
		||||
//            std::string file = "/media/DATA/Proyectos/Signals/cttc_2012_07_26/cp_cttc_2012_07_26_n4_4Msps.dat";
 | 
			
		||||
//            std::string file = "/media/DATA/Proyectos/Signals/prueba.dat";
 | 
			
		||||
//            std::string file = "../data/resampler.dat";
 | 
			
		||||
            const char * file_name = file.c_str();
 | 
			
		||||
            gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false);
 | 
			
		||||
            gr_skiphead_sptr skip_head = gr_make_skiphead(sizeof(gr_complex), skiphead_sps);
 | 
			
		||||
            gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), num_samples, queue);
 | 
			
		||||
            gr_null_sink_sptr sink = gr_make_null_sink(sizeof(Gnss_Synchro));
 | 
			
		||||
            top_block->connect(file_source, 0, skip_head, 0);
 | 
			
		||||
            top_block->connect(skip_head, 0, valve, 0);
 | 
			
		||||
            top_block->connect(valve, 0, tracking->get_left_block(), 0);
 | 
			
		||||
            top_block->connect(tracking->get_right_block(), 0, sink, 0);
 | 
			
		||||
    }) << "Failure connecting the blocks of tracking test."<< std::endl;
 | 
			
		||||
	EXPECT_NO_THROW( {
 | 
			
		||||
		gettimeofday(&tv, NULL);
 | 
			
		||||
		begin = tv.tv_sec *1000000 + tv.tv_usec;
 | 
			
		||||
		top_block->run(); // Start threads and wait
 | 
			
		||||
		gettimeofday(&tv, NULL);
 | 
			
		||||
		end = tv.tv_sec *1000000 + tv.tv_usec;
 | 
			
		||||
	}) << "Failure running he top_block."<< std::endl;
 | 
			
		||||
 | 
			
		||||
	std::cout <<  "Tracked " << num_samples << " samples in " << (end-begin) << " microseconds" << 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 he top_block."<< std::endl;
 | 
			
		||||
 | 
			
		||||
    std::cout <<  "Tracked " << num_samples << " samples in " << (end-begin) << " microseconds" << std::endl;
 | 
			
		||||
 | 
			
		||||
    delete tracking;
 | 
			
		||||
 | 
			
		||||
	delete tracking;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,6 @@
 | 
			
		||||
#include <gnuradio/gr_sig_source_c.h>
 | 
			
		||||
#include <gnuradio/gr_msg_queue.h>
 | 
			
		||||
#include <gnuradio/gr_null_sink.h>
 | 
			
		||||
 | 
			
		||||
#include "gnss_block_factory.h"
 | 
			
		||||
#include "gnss_block_interface.h"
 | 
			
		||||
#include "in_memory_configuration.h"
 | 
			
		||||
@@ -50,9 +49,11 @@
 | 
			
		||||
 | 
			
		||||
#include "galileo_e1_pcps_ambiguous_acquisition.h"
 | 
			
		||||
 | 
			
		||||
class GalileoE1PcpsAmbiguousAcquisitionTest: public ::testing::Test {
 | 
			
		||||
class GalileoE1PcpsAmbiguousAcquisitionTest: public ::testing::Test
 | 
			
		||||
{
 | 
			
		||||
protected:
 | 
			
		||||
	GalileoE1PcpsAmbiguousAcquisitionTest() {
 | 
			
		||||
	GalileoE1PcpsAmbiguousAcquisitionTest()
 | 
			
		||||
	{
 | 
			
		||||
		queue = gr_make_msg_queue(0);
 | 
			
		||||
		top_block = gr_make_top_block("Acquisition test");
 | 
			
		||||
		factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -62,7 +63,8 @@ protected:
 | 
			
		||||
		message = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	~GalileoE1PcpsAmbiguousAcquisitionTest() {
 | 
			
		||||
	~GalileoE1PcpsAmbiguousAcquisitionTest()
 | 
			
		||||
	{
 | 
			
		||||
		delete factory;
 | 
			
		||||
		delete config;
 | 
			
		||||
	}
 | 
			
		||||
@@ -78,19 +80,19 @@ protected:
 | 
			
		||||
	InMemoryConfiguration* config;
 | 
			
		||||
	Gnss_Synchro gnss_synchro;
 | 
			
		||||
	size_t item_size;
 | 
			
		||||
    concurrent_queue<int> channel_internal_queue;
 | 
			
		||||
    bool stop;
 | 
			
		||||
    int message;
 | 
			
		||||
    boost::thread ch_thread;
 | 
			
		||||
	concurrent_queue<int> channel_internal_queue;
 | 
			
		||||
	bool stop;
 | 
			
		||||
	int message;
 | 
			
		||||
	boost::thread ch_thread;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void GalileoE1PcpsAmbiguousAcquisitionTest::init(){
 | 
			
		||||
 | 
			
		||||
    gnss_synchro.Channel_ID=0;
 | 
			
		||||
    gnss_synchro.System = 'E';
 | 
			
		||||
    std::string signal = "1C";
 | 
			
		||||
    signal.copy(gnss_synchro.Signal,2,0);
 | 
			
		||||
    gnss_synchro.PRN=1;
 | 
			
		||||
void GalileoE1PcpsAmbiguousAcquisitionTest::init()
 | 
			
		||||
{
 | 
			
		||||
	gnss_synchro.Channel_ID=0;
 | 
			
		||||
	gnss_synchro.System = 'E';
 | 
			
		||||
	std::string signal = "1C";
 | 
			
		||||
	signal.copy(gnss_synchro.Signal,2,0);
 | 
			
		||||
	gnss_synchro.PRN=1;
 | 
			
		||||
 | 
			
		||||
	config->set_property("GNSS-SDR.internal_fs_hz", "4000000");
 | 
			
		||||
	config->set_property("Acquisition.item_type", "gr_complex");
 | 
			
		||||
@@ -107,35 +109,31 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::init(){
 | 
			
		||||
 | 
			
		||||
void GalileoE1PcpsAmbiguousAcquisitionTest::start_queue()
 | 
			
		||||
{
 | 
			
		||||
    ch_thread = boost::thread(&GalileoE1PcpsAmbiguousAcquisitionTest::wait_message, this);
 | 
			
		||||
	ch_thread = boost::thread(&GalileoE1PcpsAmbiguousAcquisitionTest::wait_message, this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void GalileoE1PcpsAmbiguousAcquisitionTest::wait_message()
 | 
			
		||||
{
 | 
			
		||||
    while (!stop)
 | 
			
		||||
        {
 | 
			
		||||
            channel_internal_queue.wait_and_pop(message);
 | 
			
		||||
            stop_queue();
 | 
			
		||||
        }
 | 
			
		||||
	while (!stop)
 | 
			
		||||
	{
 | 
			
		||||
		channel_internal_queue.wait_and_pop(message);
 | 
			
		||||
		stop_queue();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GalileoE1PcpsAmbiguousAcquisitionTest::stop_queue()
 | 
			
		||||
{
 | 
			
		||||
	stop = true;
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	init();
 | 
			
		||||
 | 
			
		||||
	GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
	delete acquisition;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun)
 | 
			
		||||
@@ -245,5 +243,4 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
 | 
			
		||||
	EXPECT_LT(delay_error_chips, 0.175) << "Delay error exceeds the expected value: 0.175 chips";
 | 
			
		||||
 | 
			
		||||
	delete acquisition;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,8 @@
 | 
			
		||||
#include "gnss_block_factory.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateFileSignalSource) {
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateFileSignalSource)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("SignalSource.implementation", "File_Signal_Source");
 | 
			
		||||
@@ -65,7 +66,9 @@ TEST(GNSS_Block_Factory_Test, InstantiateFileSignalSource) {
 | 
			
		||||
	delete signal_source;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateUHDSignalSource) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateUHDSignalSource)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("SignalSource.implementation", "UHD_Signal_Source");
 | 
			
		||||
@@ -82,11 +85,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateUHDSignalSource) {
 | 
			
		||||
	delete signal_source;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongSignalSource) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongSignalSource)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("SignalSource.implementation", "Pepito");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -99,11 +102,10 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongSignalSource) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateSignalConditioner) {
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateSignalConditioner)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("SignalConditioner.implementation", "Signal_Conditioner");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -117,9 +119,10 @@ TEST(GNSS_Block_Factory_Test, InstantiateSignalConditioner) {
 | 
			
		||||
	delete signal_conditioner;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateFIRFilter) {
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateFIRFilter)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("InputFilter.implementation", "Fir_Filter");
 | 
			
		||||
@@ -154,9 +157,9 @@ TEST(GNSS_Block_Factory_Test, InstantiateFIRFilter) {
 | 
			
		||||
	delete input_filter;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateFreqXlatingFIRFilter) {
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateFreqXlatingFIRFilter)
 | 
			
		||||
{
 | 
			
		||||
    InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
    gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
    configuration->set_property("InputFilter.implementation", "Freq_Xlating_Fir_Filter");
 | 
			
		||||
@@ -194,11 +197,10 @@ TEST(GNSS_Block_Factory_Test, InstantiateFreqXlatingFIRFilter) {
 | 
			
		||||
    delete input_filter;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateDirectResampler) {
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateDirectResampler)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("Resampler.implementation", "Direct_Resampler");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -212,17 +214,15 @@ TEST(GNSS_Block_Factory_Test, InstantiateDirectResampler) {
 | 
			
		||||
	delete resampler;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPcpsAcquisition) {
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPcpsAcquisition)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
	AcquisitionInterface *acquisition = (AcquisitionInterface*)factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	EXPECT_STREQ("Acquisition", acquisition->role().c_str());
 | 
			
		||||
	EXPECT_STREQ("GPS_L1_CA_PCPS_Acquisition", acquisition->implementation().c_str());
 | 
			
		||||
 | 
			
		||||
@@ -231,17 +231,16 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPcpsAcquisition) {
 | 
			
		||||
	delete acquisition;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1PcpsAmbiguousAcquisition) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1PcpsAmbiguousAcquisition)
 | 
			
		||||
{
 | 
			
		||||
    InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
    configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
 | 
			
		||||
 | 
			
		||||
    gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
    GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
    AcquisitionInterface *acquisition = (AcquisitionInterface*)factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    EXPECT_STREQ("Acquisition", acquisition->role().c_str());
 | 
			
		||||
    EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str());
 | 
			
		||||
 | 
			
		||||
@@ -249,17 +248,17 @@ TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1PcpsAmbiguousAcquisition) {
 | 
			
		||||
    delete factory;
 | 
			
		||||
    delete acquisition;
 | 
			
		||||
}
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllFllPllTracking) {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllFllPllTracking)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
	TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_FLL_PLL_Tracking", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	EXPECT_STREQ("Tracking", tracking->role().c_str());
 | 
			
		||||
	EXPECT_STREQ("GPS_L1_CA_DLL_FLL_PLL_Tracking", tracking->implementation().c_str());
 | 
			
		||||
 | 
			
		||||
@@ -268,17 +267,16 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllFllPllTracking) {
 | 
			
		||||
	delete tracking;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllPllTracking) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllPllTracking)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
	TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	EXPECT_STREQ("Tracking", tracking->role().c_str());
 | 
			
		||||
	EXPECT_STREQ("GPS_L1_CA_DLL_PLL_Tracking", tracking->implementation().c_str());
 | 
			
		||||
 | 
			
		||||
@@ -287,17 +285,16 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllPllTracking) {
 | 
			
		||||
	delete tracking;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTcpConnectorTracking) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTcpConnectorTracking)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("Tracking.implementation", "GPS_L1_CA_TCP_CONNECTOR_Tracking");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
	TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	EXPECT_STREQ("Tracking", tracking->role().c_str());
 | 
			
		||||
	EXPECT_STREQ("GPS_L1_CA_TCP_CONNECTOR_Tracking", tracking->implementation().c_str());
 | 
			
		||||
 | 
			
		||||
@@ -306,17 +303,16 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTcpConnectorTracking) {
 | 
			
		||||
	delete tracking;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1DllPllVemlTracking) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1DllPllVemlTracking)
 | 
			
		||||
{
 | 
			
		||||
    InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
    configuration->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking");
 | 
			
		||||
 | 
			
		||||
    gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
    GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
    TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    EXPECT_STREQ("Tracking", tracking->role().c_str());
 | 
			
		||||
    EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str());
 | 
			
		||||
 | 
			
		||||
@@ -325,17 +321,16 @@ TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1DllPllVemlTracking) {
 | 
			
		||||
    delete tracking;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTelemetryDecoder) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTelemetryDecoder)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
	TelemetryDecoderInterface *telemetry_decoder = (TelemetryDecoderInterface*)factory->GetBlock(configuration, "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	EXPECT_STREQ("TelemetryDecoder", telemetry_decoder->role().c_str());
 | 
			
		||||
	EXPECT_STREQ("GPS_L1_CA_Telemetry_Decoder", telemetry_decoder->implementation().c_str());
 | 
			
		||||
 | 
			
		||||
@@ -344,7 +339,8 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTelemetryDecoder) {
 | 
			
		||||
	delete telemetry_decoder;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateChannels) {
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateChannels)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("Channels.count", "2");
 | 
			
		||||
@@ -368,17 +364,16 @@ TEST(GNSS_Block_Factory_Test, InstantiateChannels) {
 | 
			
		||||
 | 
			
		||||
	delete configuration;
 | 
			
		||||
	delete factory;
 | 
			
		||||
	for(unsigned int i=0 ; i<channels->size() ; i++)
 | 
			
		||||
        delete channels->at(i);
 | 
			
		||||
	for(unsigned int i=0 ; i<channels->size() ; i++) delete channels->at(i);
 | 
			
		||||
	channels->clear();
 | 
			
		||||
	delete channels;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateObservables) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateObservables)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("Observables.implementation", "Pass_Through");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -392,11 +387,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateObservables) {
 | 
			
		||||
	delete observables;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaObservables) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaObservables)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("Observables.implementation", "GPS_L1_CA_Observables");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -410,11 +405,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaObservables) {
 | 
			
		||||
	delete observables;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongObservables) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongObservables)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("Observables.implementation", "Pepito");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -427,11 +422,10 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongObservables) {
 | 
			
		||||
	delete observables;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiatePvt) {
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiatePvt)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("PVT.implementation", "Pass_Through");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -445,11 +439,11 @@ TEST(GNSS_Block_Factory_Test, InstantiatePvt) {
 | 
			
		||||
	delete pvt;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPvt) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPvt)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("PVT.implementation", "GPS_L1_CA_PVT");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -463,11 +457,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPvt) {
 | 
			
		||||
	delete pvt;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongPvt) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongPvt)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("PVT.implementation", "Pepito");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -480,11 +474,12 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongPvt) {
 | 
			
		||||
	delete pvt;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateNullSinkOutputFilter) {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateNullSinkOutputFilter)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -498,11 +493,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateNullSinkOutputFilter) {
 | 
			
		||||
	delete output_filter;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateFileOutputFilter) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateFileOutputFilter)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("OutputFilter.implementation", "File_Output_Filter");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -516,11 +511,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateFileOutputFilter) {
 | 
			
		||||
	delete output_filter;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongOutputFilter) {
 | 
			
		||||
 | 
			
		||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongOutputFilter)
 | 
			
		||||
{
 | 
			
		||||
	InMemoryConfiguration *configuration = new InMemoryConfiguration();
 | 
			
		||||
 | 
			
		||||
	configuration->set_property("OutputFilter.implementation", "Pepito");
 | 
			
		||||
 | 
			
		||||
	gr_msg_queue_sptr queue = gr_make_msg_queue(0);
 | 
			
		||||
 | 
			
		||||
	GNSSBlockFactory *factory = new GNSSBlockFactory();
 | 
			
		||||
 
 | 
			
		||||
@@ -40,18 +40,19 @@
 | 
			
		||||
#include <gnuradio/gr_sig_source_c.h>
 | 
			
		||||
#include <gnuradio/gr_msg_queue.h>
 | 
			
		||||
#include <gnuradio/gr_null_sink.h>
 | 
			
		||||
 | 
			
		||||
#include "gnss_block_factory.h"
 | 
			
		||||
#include "gnss_block_interface.h"
 | 
			
		||||
#include "in_memory_configuration.h"
 | 
			
		||||
#include "gnss_sdr_valve.h"
 | 
			
		||||
#include "gnss_synchro.h"
 | 
			
		||||
 | 
			
		||||
#include "gps_l1_ca_pcps_acquisition.h"
 | 
			
		||||
 | 
			
		||||
class GpsL1CaPcpsAcquisitionTest: public ::testing::Test {
 | 
			
		||||
 | 
			
		||||
class GpsL1CaPcpsAcquisitionTest: public ::testing::Test
 | 
			
		||||
{
 | 
			
		||||
protected:
 | 
			
		||||
	GpsL1CaPcpsAcquisitionTest() {
 | 
			
		||||
	GpsL1CaPcpsAcquisitionTest()
 | 
			
		||||
	{
 | 
			
		||||
		queue = gr_make_msg_queue(0);
 | 
			
		||||
		top_block = gr_make_top_block("Acquisition test");
 | 
			
		||||
		factory = new GNSSBlockFactory();
 | 
			
		||||
@@ -61,7 +62,8 @@ protected:
 | 
			
		||||
		message = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	~GpsL1CaPcpsAcquisitionTest() {
 | 
			
		||||
	~GpsL1CaPcpsAcquisitionTest()
 | 
			
		||||
	{
 | 
			
		||||
		delete factory;
 | 
			
		||||
		delete config;
 | 
			
		||||
	}
 | 
			
		||||
@@ -77,14 +79,15 @@ protected:
 | 
			
		||||
	InMemoryConfiguration* config;
 | 
			
		||||
	Gnss_Synchro gnss_synchro;
 | 
			
		||||
	size_t item_size;
 | 
			
		||||
    concurrent_queue<int> channel_internal_queue;
 | 
			
		||||
    bool stop;
 | 
			
		||||
    int message;
 | 
			
		||||
    boost::thread ch_thread;
 | 
			
		||||
	concurrent_queue<int> channel_internal_queue;
 | 
			
		||||
	bool stop;
 | 
			
		||||
	int message;
 | 
			
		||||
	boost::thread ch_thread;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void GpsL1CaPcpsAcquisitionTest::init(){
 | 
			
		||||
 | 
			
		||||
void GpsL1CaPcpsAcquisitionTest::init()
 | 
			
		||||
{
 | 
			
		||||
	gnss_synchro.Channel_ID = 0;
 | 
			
		||||
	gnss_synchro.System = 'G';
 | 
			
		||||
	std::string signal = "1C";
 | 
			
		||||
@@ -101,40 +104,38 @@ void GpsL1CaPcpsAcquisitionTest::init(){
 | 
			
		||||
	config->set_property("Acquisition.doppler_max", "7200");
 | 
			
		||||
	config->set_property("Acquisition.doppler_step", "600");
 | 
			
		||||
	config->set_property("Acquisition.repeat_satellite", "false");
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void GpsL1CaPcpsAcquisitionTest::start_queue()
 | 
			
		||||
{
 | 
			
		||||
    ch_thread = boost::thread(&GpsL1CaPcpsAcquisitionTest::wait_message, this);
 | 
			
		||||
	ch_thread = boost::thread(&GpsL1CaPcpsAcquisitionTest::wait_message, this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void GpsL1CaPcpsAcquisitionTest::wait_message()
 | 
			
		||||
{
 | 
			
		||||
    while (!stop)
 | 
			
		||||
        {
 | 
			
		||||
            channel_internal_queue.wait_and_pop(message);
 | 
			
		||||
            stop_queue();
 | 
			
		||||
        }
 | 
			
		||||
	while (!stop)
 | 
			
		||||
	{
 | 
			
		||||
		channel_internal_queue.wait_and_pop(message);
 | 
			
		||||
		stop_queue();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void GpsL1CaPcpsAcquisitionTest::stop_queue()
 | 
			
		||||
{
 | 
			
		||||
	stop = true;
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	init();
 | 
			
		||||
 | 
			
		||||
	GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue);
 | 
			
		||||
 | 
			
		||||
	delete acquisition;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user