mirror of https://github.com/gnss-sdr/gnss-sdr
Restructuring the src/tests directory. Deleted old tests. Added new test cases. Added signal sample for the tests.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@198 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
0cc9a67b47
commit
950765180f
|
@ -3,7 +3,7 @@
|
|||
|
||||
;######### GLOBAL OPTIONS ##################
|
||||
;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz].
|
||||
GNSS-SDR.internal_fs_hz=4000000
|
||||
GNSS-SDR.internal_fs_hz=8000000
|
||||
|
||||
;######### CONTROL_THREAD CONFIG ############
|
||||
ControlThread.wait_for_flowgraph=false
|
||||
|
@ -13,13 +13,13 @@ ControlThread.wait_for_flowgraph=false
|
|||
SignalSource.implementation=File_Signal_Source
|
||||
|
||||
;#filename: path to file with the captured GNSS signal samples to be processed
|
||||
SignalSource.filename=/media/DATALOGGER/signals/Agilent GPS Generator/cap3/san_francisco_2msps_v2010.dat
|
||||
SignalSource.filename=/media/DATA/Proyectos/Signals/spirent scenario 2/data/sc2_d8.dat
|
||||
|
||||
;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
|
||||
SignalSource.item_type=gr_complex
|
||||
|
||||
;#sampling_frequency: Original Signal sampling frequency in [Hz]
|
||||
SignalSource.sampling_frequency=4000000
|
||||
SignalSource.sampling_frequency=8000000
|
||||
|
||||
;#freq: RF front-end center frequency in [Hz]
|
||||
SignalSource.freq=1575420000
|
||||
|
@ -41,7 +41,6 @@ SignalSource.dump=false
|
|||
|
||||
SignalSource.dump_filename=../data/signal_source.dat
|
||||
|
||||
SignalSource.dump_filename=../data/SignalSource.dat
|
||||
|
||||
;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing.
|
||||
; it helps to not overload the CPU, but the processing time will be longer.
|
||||
|
@ -144,7 +143,7 @@ Resampler.sample_freq_out=4000000
|
|||
;######### CHANNELS GLOBAL CONFIG ############
|
||||
;#count: Number of available satellite channels.
|
||||
Channels.count=5
|
||||
Channels.in_acquisition=1
|
||||
Channels.in_acquisition=5
|
||||
|
||||
;######### CHANNEL 0 CONFIG ############
|
||||
;#system: GPS, GLONASS, GALILEO, SBAS or COMPASS
|
||||
|
@ -212,35 +211,35 @@ Channel0.signal=1C
|
|||
|
||||
;#satellite: Satellite PRN ID for this channel. Disable this option to random search
|
||||
Channel0.satellite=15
|
||||
Channel0.repeat_satellite=true
|
||||
Channel0.repeat_satellite=false
|
||||
|
||||
;######### CHANNEL 1 CONFIG ############
|
||||
|
||||
Channel1.system=GPS
|
||||
Channel1.signal=1C
|
||||
Channel1.satellite=18
|
||||
Channel1.repeat_satellite=true
|
||||
Channel1.repeat_satellite=false
|
||||
|
||||
;######### CHANNEL 2 CONFIG ############
|
||||
|
||||
Channel2.system=GPS
|
||||
Channel2.signal=1C
|
||||
Channel2.satellite=16
|
||||
Channel2.repeat_satellite=true
|
||||
Channel2.repeat_satellite=false
|
||||
|
||||
;######### CHANNEL 3 CONFIG ############
|
||||
|
||||
Channel3.system=GPS
|
||||
Channel3.signal=1C
|
||||
Channel3.satellite=21
|
||||
Channel3.repeat_satellite=true
|
||||
Channel3.repeat_satellite=false
|
||||
|
||||
;######### CHANNEL 4 CONFIG ############
|
||||
|
||||
Channel4.system=GPS
|
||||
Channel4.signal=1C
|
||||
Channel4.satellite=3
|
||||
Channel4.repeat_satellite=true
|
||||
Channel4.repeat_satellite=false
|
||||
|
||||
;######### CHANNEL 3 CONFIG ############
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://www.opengis.net/kml/2.2">
|
||||
<Document>
|
||||
<name>GNSS Track</name>
|
||||
<description>GNSS-SDR Receiver position log file created at Fri Jun 22 16:02:49 2012
|
||||
</description>
|
||||
<Style id="yellowLineGreenPoly">
|
||||
<LineStyle>
|
||||
<color>7f00ffff</color>
|
||||
<width>1</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7f00ff00</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Placemark>
|
||||
<name>GNSS-SDR PVT</name>
|
||||
<description>GNSS-SDR position log</description>
|
||||
<styleUrl>#yellowLineGreenPoly</styleUrl>
|
||||
<LineString>
|
||||
<extrude>0</extrude>
|
||||
<tessellate>1</tessellate>
|
||||
<altitudeMode>absolute</altitudeMode>
|
||||
<coordinates>
|
||||
</coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
</Document>
|
||||
</kml>
|
|
@ -64,7 +64,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "pvt";
|
||||
return "GPS_L1_CA_PVT";
|
||||
}
|
||||
|
||||
void connect(gr_top_block_sptr top_block);
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "Acquisition";
|
||||
return "GPS_L1_CA_PCPS_Acquisition";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "PassThrough";
|
||||
return "Pass_Through";
|
||||
}
|
||||
|
||||
std::string item_type()
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "observables";
|
||||
return "GPS_L1_CA_Observables";
|
||||
}
|
||||
|
||||
void connect(gr_top_block_sptr top_block);
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "FileOutputFilter";
|
||||
return "File_Output_Filter";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "NullSinkOutputFilter";
|
||||
return "Null_Sink_Output_Filter";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "DirectResamplerConditioner";
|
||||
return "Direct_Resampler";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "FileSignalSource";
|
||||
return "File_Signal_Source";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "UhdSignalSource";
|
||||
return "UHD_Signal_Source";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "TelemetryDecoder";
|
||||
return "GPS_L1_CA_Telemetry_Decoder";
|
||||
}
|
||||
|
||||
void connect(gr_top_block_sptr top_block);
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "tracking";
|
||||
return "GPS_L1_CA_DLL_FLL_PLL_Tracking";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "tracking";
|
||||
return "GPS_L1_CA_DLL_PLL_Tracking";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "tracking";
|
||||
return "GPS_L1_CA_TCP_CONNECTOR_Tracking";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
|
|
|
@ -209,9 +209,9 @@ std::vector<GNSSBlockInterface*>* GNSSBlockFactory::GetChannels(
|
|||
channels->push_back(GetChannel(configuration,
|
||||
acquisition_implementation, tracking, telemetry_decoder, i,
|
||||
queue));
|
||||
//std::cout << "getchannel_" << i << ", acq_implementation_name: "
|
||||
//<< acquisition_implementation_name << ", implementation: "
|
||||
//<< acquisition_implementation << std::endl;
|
||||
// std::cout << "getchannel_" << i << ", acq_implementation_name: "
|
||||
// << acquisition_implementation_name << ", implementation: "
|
||||
// << acquisition_implementation << std::endl;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* \file gnss_satellite.cc
|
||||
* \file gnss_signal.h
|
||||
* \brief Implementation of the Gnss_Signal class
|
||||
* \author
|
||||
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
|
|
|
@ -1,30 +1,48 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements a Unit Test for the class FileOutputFilter
|
||||
/*!
|
||||
* \file file_output_filter_test.cc
|
||||
* \brief This class implements a Unit Test for the class FileOutputFilter.
|
||||
* \author Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (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 <gtest/gtest.h>
|
||||
|
||||
#include "file_output_filter.h"
|
||||
#include "in_memory_configuration.h"
|
||||
|
||||
TEST(FileOutoutFilter, Instantiate) {
|
||||
TEST(FileOutputFilter, Instantiate) {
|
||||
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
config->set_property("Test.filename", "./data/output.dat");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,32 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements a Unit Test for the class InMemoryConfiguration.
|
||||
/*!
|
||||
* \file file_signal_source_test.cc
|
||||
* \brief This class implements a Unit Test for the class FileSignalSource.
|
||||
* \author Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (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 <gtest/gtest.h>
|
||||
|
@ -32,13 +49,13 @@ TEST(FileSignalSource, Instantiate) {
|
|||
|
||||
config->set_property("Test.samples", "0");
|
||||
config->set_property("Test.sampling_frequency", "0");
|
||||
config->set_property("Test.filename", "./signal_samples/signal.dat");
|
||||
config->set_property("Test.filename", "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat");
|
||||
config->set_property("Test.item_type", "gr_complex");
|
||||
config->set_property("Test.repeat", "false");
|
||||
|
||||
FileSignalSource *signal_source = new FileSignalSource(config, "Test", 1, 1, queue);
|
||||
|
||||
EXPECT_STREQ("./signal_samples/signal.dat", signal_source->filename().c_str());
|
||||
EXPECT_STREQ("../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat", signal_source->filename().c_str());
|
||||
EXPECT_STREQ("gr_complex", signal_source->item_type().c_str());
|
||||
EXPECT_TRUE(signal_source->repeat() == false);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*!
|
||||
* \file fir_filter_test.cc
|
||||
* \brief Test for the fir filter.
|
||||
* \brief Implements Unit Test for the fir filter.
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
|
@ -51,26 +51,22 @@ protected:
|
|||
Fir_Filter_Test() {
|
||||
queue = gr_make_msg_queue(0);
|
||||
top_block = gr_make_top_block("Fir filter test");
|
||||
factory = new GNSSBlockFactory();
|
||||
config = new InMemoryConfiguration();
|
||||
item_size = sizeof(gr_complex);
|
||||
|
||||
}
|
||||
~Fir_Filter_Test() {
|
||||
delete factory;
|
||||
delete config;
|
||||
}
|
||||
bool init();
|
||||
void init();
|
||||
gr_msg_queue_sptr queue;
|
||||
gr_top_block_sptr top_block;
|
||||
GNSSBlockFactory* factory;
|
||||
InMemoryConfiguration* config;
|
||||
GNSSBlockInterface* gnss_block;
|
||||
size_t item_size;
|
||||
|
||||
};
|
||||
|
||||
bool 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");
|
||||
|
@ -92,14 +88,19 @@ bool Fir_Filter_Test::init(){
|
|||
config->set_property("InputFilter.grid_density", "16");
|
||||
|
||||
// config->set_property("InputFilter.dump", "true");
|
||||
gnss_block = factory->GetBlock(config, "InputFilter", "Fir_Filter", 1,
|
||||
1, queue);
|
||||
if (gnss_block == NULL) return false;
|
||||
else return true;
|
||||
|
||||
}
|
||||
|
||||
TEST_F(Fir_Filter_Test, Instantiate)
|
||||
{
|
||||
init();
|
||||
|
||||
TEST_F(Fir_Filter_Test, InstantiationConnectAndRunTest)
|
||||
FirFilter *filter = new FirFilter(config, "InputFilter", 1, 1, queue);
|
||||
|
||||
delete filter;
|
||||
}
|
||||
|
||||
TEST_F(Fir_Filter_Test, ConnectAndRun)
|
||||
{
|
||||
int fs_in = 8000000;
|
||||
int nsamples = 10000000;
|
||||
|
@ -107,20 +108,19 @@ TEST_F(Fir_Filter_Test, InstantiationConnectAndRunTest)
|
|||
long long int begin;
|
||||
long long int end;
|
||||
|
||||
// ASSERT_NE( (int)gnss_block, NULL)
|
||||
// << "Function factory->GetInputFilter(config, queue) fails." << std::endl;
|
||||
init();
|
||||
|
||||
ASSERT_NE(init(), false) << "Function factory->GetBlock(config, queue) fails." << std::endl;
|
||||
FirFilter *filter = new FirFilter(config, "InputFilter", 1, 1, queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
gnss_block->connect(top_block);
|
||||
gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in,GR_SIN_WAVE, 1000, 1, 0);
|
||||
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, gnss_block->get_left_block(), 0);
|
||||
top_block->connect(gnss_block->get_right_block(), 0, null_sink, 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( {
|
||||
|
@ -132,4 +132,5 @@ TEST_F(Fir_Filter_Test, InstantiationConnectAndRunTest)
|
|||
}) << "Failure running he top_block."<< std::endl;
|
||||
std::cout << "Filtered " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
|
||||
|
||||
delete filter;
|
||||
}
|
||||
|
|
|
@ -1,61 +1,77 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements a Unit Test for the class GNSSBlockFactory.
|
||||
/*!
|
||||
* \file gnss_block_factory_test.cc
|
||||
* \brief This class implements a Unit Test for the class GNSSBlockFactory..
|
||||
* \authors Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (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 <gr_msg_queue.h>
|
||||
#include <vector>
|
||||
#include <gtest/gtest.h>
|
||||
#include "in_memory_configuration.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include "acquisition_interface.h"
|
||||
#include "tracking_interface.h"
|
||||
#include "telemetry_decoder_interface.h"
|
||||
#include "observables_interface.h"
|
||||
#include "pvt_interface.h"
|
||||
#include "gnss_block_factory.h"
|
||||
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateChannels) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("Channels.count", "2");
|
||||
configuration->set_property("Channel1.implementation", "Pass_Through");
|
||||
configuration->set_property("Channel1.item_type", "float");
|
||||
configuration->set_property("Channel1.vector_size", "1");
|
||||
configuration->set_property("Channel2.implementation", "Pass_Through");
|
||||
configuration->set_property("Channel2.item_type", "float");
|
||||
configuration->set_property("Channel2.vector_size", "1");
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
GNSSBlockFactory *factory = new GNSSBlockFactory();
|
||||
std::vector<GNSSBlockInterface*>* channels = factory->GetChannels(configuration, queue);
|
||||
|
||||
EXPECT_EQ(2, channels->size());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
for(unsigned int i=0 ; i<channels->size() ; i++)
|
||||
delete channels->at(i);
|
||||
channels->clear();
|
||||
delete channels;
|
||||
}
|
||||
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateSignalSource) {
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateFileSignalSource) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("SignalSource.implementation", "File_Signal_Source");
|
||||
|
||||
configuration->set_property("SignalSource.filename", "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat");
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
GNSSBlockFactory *factory = new GNSSBlockFactory();
|
||||
GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue);
|
||||
|
||||
EXPECT_STREQ("SignalSource", signal_source->role().c_str());
|
||||
EXPECT_STREQ("File_Signal_Source", signal_source->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete signal_source;
|
||||
}
|
||||
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateUHDSignalSource) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("SignalSource.implementation", "UHD_Signal_Source");
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
GNSSBlockFactory *factory = new GNSSBlockFactory();
|
||||
GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue);
|
||||
|
||||
EXPECT_STREQ("SignalSource", signal_source->role().c_str());
|
||||
EXPECT_STREQ("UHD_Signal_Source", signal_source->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
|
@ -78,10 +94,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongSignalSource) {
|
|||
delete factory;
|
||||
}
|
||||
|
||||
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateSignalConditioner) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("SignalConditioner.implementation", "Pass_Through");
|
||||
configuration->set_property("SignalConditioner.implementation", "Signal_Conditioner");
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
|
@ -89,46 +106,283 @@ TEST(GNSS_Block_Factory_Test, InstantiateSignalConditioner) {
|
|||
GNSSBlockInterface *signal_conditioner = factory->GetSignalConditioner(configuration, queue);
|
||||
|
||||
EXPECT_STREQ("SignalConditioner", signal_conditioner->role().c_str());
|
||||
EXPECT_STREQ("Signal_Conditioner", signal_conditioner->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete signal_conditioner;
|
||||
}
|
||||
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongSignalConditioner) {
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateFIRFilter) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("SignalConditioner.implementation", "Pepito");
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
GNSSBlockFactory *factory = new GNSSBlockFactory();
|
||||
GNSSBlockInterface *signal_conditioner = factory->GetSignalConditioner(configuration, queue);
|
||||
configuration->set_property("InputFilter.implementation", "Fir_Filter");
|
||||
|
||||
EXPECT_EQ(NULL, signal_conditioner);
|
||||
configuration->set_property("InputFilter.number_of_taps", "4");
|
||||
configuration->set_property("InputFilter.number_of_bands", "2");
|
||||
|
||||
configuration->set_property("InputFilter.band1_begin", "0.0");
|
||||
configuration->set_property("InputFilter.band1_end", "0.45");
|
||||
configuration->set_property("InputFilter.band2_begin", "0.55");
|
||||
configuration->set_property("InputFilter.band2_end", "1.0");
|
||||
|
||||
configuration->set_property("InputFilter.ampl1_begin", "1.0");
|
||||
configuration->set_property("InputFilter.ampl1_end", "1.0");
|
||||
configuration->set_property("InputFilter.ampl2_begin", "0.0");
|
||||
configuration->set_property("InputFilter.ampl2_end", "0.0");
|
||||
|
||||
configuration->set_property("InputFilter.band1_error", "1.0");
|
||||
configuration->set_property("InputFilter.band2_error", "1.0");
|
||||
|
||||
configuration->set_property("InputFilter.filter_type", "bandpass");
|
||||
configuration->set_property("InputFilter.grid_density", "16");
|
||||
|
||||
GNSSBlockFactory *factory = new GNSSBlockFactory();
|
||||
GNSSBlockInterface *input_filter = factory->GetBlock(configuration, "InputFilter", "Fir_Filter", 1,1, queue);
|
||||
|
||||
EXPECT_STREQ("InputFilter", input_filter->role().c_str());
|
||||
EXPECT_STREQ("Fir_Filter", input_filter->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete input_filter;
|
||||
}
|
||||
|
||||
TEST(GNSS_Block_Factory_Test, InstantiatePVT) {
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateDirectResampler) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("PVT.implementation", "PassThrough");
|
||||
configuration->set_property("Resampler.implementation", "Direct_Resampler");
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
GNSSBlockFactory *factory = new GNSSBlockFactory();
|
||||
GNSSBlockInterface *pvt = factory->GetPVT(configuration, queue);
|
||||
GNSSBlockInterface *resampler = factory->GetBlock(configuration, "Resampler", "Direct_Resampler", 1,1, queue);
|
||||
|
||||
EXPECT_STREQ("Resampler", resampler->role().c_str());
|
||||
EXPECT_STREQ("Direct_Resampler", resampler->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete resampler;
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete acquisition;
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete tracking;
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete tracking;
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete tracking;
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete telemetry_decoder;
|
||||
}
|
||||
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateChannels) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("Channels.count", "2");
|
||||
configuration->set_property("Channels.in_acquisition", "2");
|
||||
configuration->set_property("Tracking.implementation","GPS_L1_CA_DLL_FLL_PLL_Tracking");
|
||||
configuration->set_property("TelemetryDecoder.implementation","GPS_L1_CA_Telemetry_Decoder");
|
||||
|
||||
configuration->set_property("Channel0.item_type", "gr_complex");
|
||||
configuration->set_property("Acquisition0.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
|
||||
configuration->set_property("Channel1.item_type", "gr_complex");
|
||||
configuration->set_property("Acquisition1.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
GNSSBlockFactory *factory = new GNSSBlockFactory();
|
||||
|
||||
std::vector<GNSSBlockInterface*>* channels = factory->GetChannels(configuration, queue);
|
||||
|
||||
EXPECT_EQ((unsigned int) 2, channels->size());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
for(unsigned int i=0 ; i<channels->size() ; i++)
|
||||
delete channels->at(i);
|
||||
channels->clear();
|
||||
delete channels;
|
||||
}
|
||||
|
||||
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();
|
||||
ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue);
|
||||
|
||||
EXPECT_STREQ("Observables", observables->role().c_str());
|
||||
EXPECT_STREQ("Pass_Through", observables->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete observables;
|
||||
}
|
||||
|
||||
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();
|
||||
ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue);
|
||||
|
||||
EXPECT_STREQ("Observables", observables->role().c_str());
|
||||
EXPECT_STREQ("GPS_L1_CA_Observables", observables->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete observables;
|
||||
}
|
||||
|
||||
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();
|
||||
ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue);
|
||||
|
||||
EXPECT_EQ(NULL, observables);
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete observables;
|
||||
}
|
||||
|
||||
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();
|
||||
PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue);
|
||||
|
||||
EXPECT_STREQ("PVT", pvt->role().c_str());
|
||||
EXPECT_STREQ("Pass_Through", pvt->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete pvt;
|
||||
}
|
||||
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongPVT) {
|
||||
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();
|
||||
PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue);
|
||||
|
||||
EXPECT_STREQ("PVT", pvt->role().c_str());
|
||||
EXPECT_STREQ("GPS_L1_CA_PVT", pvt->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete pvt;
|
||||
}
|
||||
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateWrongPvt) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("PVT.implementation", "Pepito");
|
||||
|
@ -136,18 +390,19 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongPVT) {
|
|||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
GNSSBlockFactory *factory = new GNSSBlockFactory();
|
||||
GNSSBlockInterface *pvt = factory->GetPVT(configuration, queue);
|
||||
PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue);
|
||||
|
||||
EXPECT_EQ(NULL, pvt);
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete pvt;
|
||||
}
|
||||
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateOutputFilter) {
|
||||
TEST(GNSS_Block_Factory_Test, InstantiateNullSinkOutputFilter) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("OutputFilter.implementation", "NullSinkOutputFilter");
|
||||
configuration->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter");
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
|
@ -155,6 +410,25 @@ TEST(GNSS_Block_Factory_Test, InstantiateOutputFilter) {
|
|||
GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue);
|
||||
|
||||
EXPECT_STREQ("OutputFilter", output_filter->role().c_str());
|
||||
EXPECT_STREQ("Null_Sink_Output_Filter", output_filter->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
delete output_filter;
|
||||
}
|
||||
|
||||
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();
|
||||
GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue);
|
||||
|
||||
EXPECT_STREQ("OutputFilter", output_filter->role().c_str());
|
||||
EXPECT_STREQ("File_Output_Filter", output_filter->implementation().c_str());
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
#include <string>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include <gnuradio/gr_sig_source_s.h>
|
||||
#include <gnuradio/gr_sig_source_c.h>
|
||||
#include <gnuradio/gr_head.h>
|
||||
#include <gnuradio/gr_null_sink.h>
|
||||
#include <gnuradio/gr_top_block.h>
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
#include <gnuradio/gr_file_source.h>
|
||||
#include <gnuradio/gr_file_sink.h>
|
||||
#include <gnuradio/gr_multiply_const_ss.h>
|
||||
#include <gnuradio/gr_complex_to_xxx.h>
|
||||
#include <gnuradio/gr_complex_to_interleaved_short.h>
|
||||
|
||||
#include "gnss_block_factory.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include "in_memory_configuration.h"
|
||||
#include "acquisition_interface.h"
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
DEFINE_bool(usrp, false, "If true, the USRPSignalSource will be used");
|
||||
DEFINE_string(usrp_gain, "40", "Gain");
|
||||
DEFINE_int32(satellite, 0, "Satellite to be acquired");
|
||||
DEFINE_string(fs_in, "2048000", "FS of the input signal");
|
||||
DEFINE_string(ifreq, "0", "Intermediate frequency");
|
||||
DEFINE_string(doppler_max, "15", "Doppler max");
|
||||
DEFINE_string(sampled_ms, "1", "ms used for acquisition");
|
||||
DEFINE_string(signal_filename, "./signal_samples/conditioner_30.dat", "Name of the file with the signal samples");
|
||||
DEFINE_string(item_type, "short", "Type of data for samples");
|
||||
DEFINE_string(dump, "true", "If true, magnitudes are written to a file");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
//printf("Runlevel 1 \r\n");
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
DLOG(INFO) << "fs_in " << FLAGS_fs_in;
|
||||
DLOG(INFO) << "ifreq " << FLAGS_ifreq;
|
||||
DLOG(INFO) << "doppler_max " << FLAGS_doppler_max;
|
||||
DLOG(INFO) << "sampled ms " << FLAGS_sampled_ms;
|
||||
DLOG(INFO) << "signal filename " << FLAGS_signal_filename;
|
||||
DLOG(INFO) << "satellite " << FLAGS_satellite;
|
||||
DLOG(INFO) << "dump " << FLAGS_dump;
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("acquisition test");
|
||||
|
||||
size_t item_size;
|
||||
|
||||
if(FLAGS_item_type.compare("short") == 0) {
|
||||
item_size = sizeof(short);
|
||||
} else if(FLAGS_item_type.compare("gr_complex") == 0) {
|
||||
item_size = sizeof(gr_complex);
|
||||
} else {
|
||||
item_size = sizeof(short);
|
||||
}
|
||||
|
||||
// Build Acquisition GNSS block
|
||||
GNSSBlockFactory* factory = new GNSSBlockFactory();
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
//config->set_property("Acquisition.implementation", "GpsSdrAcquisition");
|
||||
config->set_property("Acquisition.implementation", "gnss_acquisition_a");
|
||||
config->set_property("Acquisition.fs_in", FLAGS_fs_in.c_str());
|
||||
config->set_property("Acquisition.ifreq", FLAGS_ifreq.c_str());
|
||||
config->set_property("Acquisition.doppler_max", FLAGS_doppler_max);
|
||||
config->set_property("Acquisition.sampled_ms", FLAGS_sampled_ms);
|
||||
config->set_property("Acquisition.dump", FLAGS_dump);
|
||||
config->set_property("Acquisition.item_type", FLAGS_item_type);
|
||||
|
||||
//GNSSBlockInterface* acquisition_gnss_block = factory->GetBlock(config, "Acquisition", "GpsSdrAcquisition", 1, 1, gr_msg_queue_sptr());
|
||||
GNSSBlockInterface* acquisition_gnss_block = factory->GetBlock(config, "Acquisition", "gnss_acquisition_a", 1, 1, gr_msg_queue_sptr());
|
||||
acquisition_gnss_block->connect(top_block);
|
||||
|
||||
|
||||
if(FLAGS_usrp) {
|
||||
|
||||
// Build USRP GNSS block
|
||||
config->set_property("SignalSource.implementation", "USRPSignalSource");
|
||||
config->set_property("SignalSource.item_type", FLAGS_item_type);
|
||||
config->set_property("SignalSource.decim_rate", "16");
|
||||
config->set_property("SignalSource.gain", FLAGS_usrp_gain);
|
||||
config->set_property("SignalSource.dump", "false");
|
||||
|
||||
GNSSBlockInterface* usrp_source_gnss_block = factory->GetBlock(config, "SignalSource", "USRPSignalSource", 0, 1, gr_msg_queue_sptr());
|
||||
usrp_source_gnss_block->connect(top_block);
|
||||
|
||||
// Build conditioner GNSS block
|
||||
config->set_property("SignalConditioner.implementation", "DirectResampler");
|
||||
config->set_property("SignalConditioner.item_type", FLAGS_item_type);
|
||||
config->set_property("SignalConditioner.sample_freq_in", "4000000");
|
||||
config->set_property("SignalConditioner.sample_freq_out", "2048000");
|
||||
config->set_property("SignalConditioner.dump", "false");
|
||||
|
||||
GNSSBlockInterface* resampler_gnss_block = factory->GetBlock(config, "SignalConditioner", "DirectResampler", 1, 1, gr_msg_queue_sptr());
|
||||
resampler_gnss_block->connect(top_block);
|
||||
|
||||
top_block->connect(usrp_source_gnss_block->get_right_block(), 0, resampler_gnss_block->get_left_block(), 0);
|
||||
top_block->connect(resampler_gnss_block->get_right_block(), 0, acquisition_gnss_block->get_left_block(), 0);
|
||||
} else {
|
||||
// file_source->gnss_acquisition
|
||||
gr_block_sptr file_source = gr_make_file_source(item_size, FLAGS_signal_filename.c_str());
|
||||
top_block->connect(file_source, 0, acquisition_gnss_block->get_left_block(), 0);
|
||||
}
|
||||
|
||||
//printf("runlevel 2 \r \n");
|
||||
gr_block_sptr null_sink = gr_make_null_sink(item_size);
|
||||
top_block->connect(acquisition_gnss_block->get_right_block(), 0, null_sink, 0); // gnss_acquisition->null_sink
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "testing satellite " << FLAGS_satellite;
|
||||
((AcquisitionInterface*)acquisition_gnss_block)->set_satellite(FLAGS_satellite);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include <gr_sig_source_c.h>
|
||||
#include <gr_head.h>
|
||||
#include <gr_null_sink.h>
|
||||
#include <gr_top_block.h>
|
||||
#include <gr_msg_queue.h>
|
||||
|
||||
#include "gnss_block_factory.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include "in_memory_configuration.h"
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
DEFINE_string(d, "16", "Decimation");
|
||||
DEFINE_string(f, "1.57542e9", "Carrier frequency of the signal");
|
||||
DEFINE_string(g, "40", "Gain in dB");
|
||||
DEFINE_string(s, "4000000", "Samples to be recorded");
|
||||
DEFINE_string(dump_filename, "./data/usrp_test.dat", "Dump filename");
|
||||
DEFINE_string(item_type, "short", "Data type for samples");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
DLOG(INFO) << "samples " << FLAGS_s;
|
||||
DLOG(INFO) << "f " << FLAGS_f;
|
||||
DLOG(INFO) << "g " << FLAGS_g;
|
||||
DLOG(INFO) << "item_type " << FLAGS_item_type;
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("usrp signal source test");
|
||||
|
||||
GNSSBlockFactory* factory = new GNSSBlockFactory();
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
config->set_property("SignalSource.implementation", "USRPSignalSource");
|
||||
config->set_property("SignalSource.freq", FLAGS_f.c_str());
|
||||
config->set_property("SignalSource.gain", FLAGS_g.c_str());
|
||||
config->set_property("SignalSource.samples", FLAGS_s.c_str());
|
||||
config->set_property("SignalSource.item_type", FLAGS_item_type.c_str());
|
||||
config->set_property("SignalSource.dump", "true");
|
||||
config->set_property("SignalSource.dump_filename", FLAGS_dump_filename);
|
||||
|
||||
GNSSBlockInterface* gnss_block = factory->GetSignalSource(config, queue);
|
||||
gnss_block->connect(top_block);
|
||||
|
||||
size_t item_size;
|
||||
|
||||
if(FLAGS_item_type.compare("short") == 0) {
|
||||
item_size = sizeof(short);
|
||||
} else {
|
||||
item_size = sizeof(gr_complex);
|
||||
}
|
||||
|
||||
gr_block_sptr null_sink = gr_make_null_sink(item_size);
|
||||
|
||||
top_block->connect(gnss_block->get_right_block(), 0, null_sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
|
||||
}
|
|
@ -0,0 +1,248 @@
|
|||
/*!
|
||||
* \file gps_l1_ca_pcps_acquisition_test.cc
|
||||
* \brief This class implements an acquisition test based on some input parameters.
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (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 <gtest/gtest.h>
|
||||
#include <sys/time.h>
|
||||
#include <iostream>
|
||||
#include <gnuradio/gr_top_block.h>
|
||||
#include <gnuradio/gr_file_source.h>
|
||||
#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 Gps_L1_Ca_Pcps_Acquisition_Test: public ::testing::Test {
|
||||
protected:
|
||||
Gps_L1_Ca_Pcps_Acquisition_Test() {
|
||||
queue = gr_make_msg_queue(0);
|
||||
top_block = gr_make_top_block("Acquisition test");
|
||||
factory = new GNSSBlockFactory();
|
||||
config = new InMemoryConfiguration();
|
||||
item_size = sizeof(gr_complex);
|
||||
stop = false;
|
||||
message = 0;
|
||||
}
|
||||
|
||||
~Gps_L1_Ca_Pcps_Acquisition_Test() {
|
||||
delete factory;
|
||||
delete config;
|
||||
}
|
||||
|
||||
void init();
|
||||
void start_queue();
|
||||
void wait_message();
|
||||
void stop_queue();
|
||||
|
||||
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 Gps_L1_Ca_Pcps_Acquisition_Test::init(){
|
||||
|
||||
gnss_synchro.Channel_ID=1;
|
||||
gnss_synchro.System = 'G';
|
||||
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");
|
||||
config->set_property("Acquisition.if", "0");
|
||||
config->set_property("Acquisition.sampled_ms", "1");
|
||||
config->set_property("Acquisition.dump", "false");
|
||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Acquisition.threshold", "70");
|
||||
config->set_property("Acquisition.doppler_max", "7200");
|
||||
config->set_property("Acquisition.doppler_step", "600");
|
||||
config->set_property("Acquisition.repeat_satellite", "false");
|
||||
|
||||
}
|
||||
|
||||
void Gps_L1_Ca_Pcps_Acquisition_Test::start_queue()
|
||||
{
|
||||
ch_thread = boost::thread(&Gps_L1_Ca_Pcps_Acquisition_Test::wait_message, this);
|
||||
}
|
||||
|
||||
|
||||
void Gps_L1_Ca_Pcps_Acquisition_Test::wait_message()
|
||||
{
|
||||
while (!stop)
|
||||
{
|
||||
channel_internal_queue.wait_and_pop(message);
|
||||
stop_queue();
|
||||
}
|
||||
}
|
||||
|
||||
void Gps_L1_Ca_Pcps_Acquisition_Test::stop_queue()
|
||||
{
|
||||
stop = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_F(Gps_L1_Ca_Pcps_Acquisition_Test, Instantiate)
|
||||
{
|
||||
|
||||
init();
|
||||
|
||||
GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue);
|
||||
|
||||
delete acquisition;
|
||||
|
||||
}
|
||||
|
||||
TEST_F(Gps_L1_Ca_Pcps_Acquisition_Test, ConnectAndRun)
|
||||
{
|
||||
int fs_in = 4000000;
|
||||
int nsamples = 4000;
|
||||
struct timeval tv;
|
||||
long long int begin;
|
||||
long long int end;
|
||||
|
||||
init();
|
||||
GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->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);
|
||||
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
gettimeofday(&tv, NULL);
|
||||
begin = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
}) << "Failure running he top_block."<< std::endl;
|
||||
|
||||
delete acquisition;
|
||||
std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
TEST_F(Gps_L1_Ca_Pcps_Acquisition_Test, ValidationOfResults)
|
||||
{
|
||||
struct timeval tv;
|
||||
long long int begin;
|
||||
long long int end;
|
||||
double expected_delay_samples = 524;
|
||||
double expected_doppler_hz = -1680;
|
||||
init();
|
||||
GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel."<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_channel_queue(&channel_internal_queue);
|
||||
}) << "Failure setting channel_internal_queue."<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
||||
}) << "Failure setting threshold."<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max",
|
||||
10000));
|
||||
}) << "Failure setting doppler_max."<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step",
|
||||
500));
|
||||
}) << "Failure setting doppler_step."<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block."<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
std::string file = "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||
const char * file_name = file.c_str();
|
||||
gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false);
|
||||
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
||||
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
|
||||
|
||||
start_queue();
|
||||
acquisition->init();
|
||||
acquisition->reset();
|
||||
|
||||
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;
|
||||
|
||||
ch_thread.join();
|
||||
|
||||
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
|
||||
|
||||
ASSERT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
|
||||
double delay_error_samples = abs(expected_delay_samples-gnss_synchro.Acq_delay_samples);
|
||||
float delay_error_chips = (float)(delay_error_samples*1023/4000);
|
||||
double doppler_error_hz = abs(expected_doppler_hz-gnss_synchro.Acq_doppler_hz);
|
||||
|
||||
EXPECT_LE(doppler_error_hz, 333) << "Doppler error exceeds the expected value: 333 Hz = 2/(3*integration period)";
|
||||
EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips";
|
||||
|
||||
delete acquisition;
|
||||
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Executes a gps sdr acquisition based on some input parameters.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
#include <gnuradio/gr_top_block.h>
|
||||
#include <gr_file_source.h>
|
||||
#include <gr_null_sink.h>
|
||||
#include <gps_sdr_acquisition_ss.h>
|
||||
#include <gr_stream_to_vector.h>
|
||||
#include <gr_msg_queue.h>
|
||||
#include <gr_complex_to_interleaved_short.h>
|
||||
|
||||
#include "gnss_sdr_direct_resampler_ccf.h"
|
||||
|
||||
DEFINE_string(signal_file, "signal_samples/signal.dat",
|
||||
"Path to the file containing the signal samples");
|
||||
|
||||
DEFINE_int64(fs_in, 2048000, "FS of the signal in Hz");
|
||||
DEFINE_int64(if_freq, 0, "Intermediate frequency");
|
||||
DEFINE_int32(satellite, 0, "Satellite number");
|
||||
DEFINE_bool(dump, false, "If true, acquisition result will be dumped in a file");
|
||||
DEFINE_int32(ms, 1, "ms of signal to be used in the acquisition process");
|
||||
DEFINE_int32(shift_resolution, 15, "shift resolution for acquisition");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
int samples_per_ms = ceil(FLAGS_fs_in/1000);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "fs_in " << FLAGS_fs_in;
|
||||
LOG_AT_LEVEL(INFO) << "if_freq " << FLAGS_if_freq;
|
||||
LOG_AT_LEVEL(INFO) << "satellite " << FLAGS_satellite;
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gps_sdr_acquisition_test");
|
||||
gr_block_sptr source = gr_make_file_source(sizeof(gr_complex),FLAGS_signal_file.c_str());
|
||||
gr_block_sptr complex_to_interleaved_short = gr_make_complex_to_interleaved_short();
|
||||
|
||||
gr_block_sptr stream_to_vector = gr_make_stream_to_vector(sizeof(short), samples_per_ms);
|
||||
gr_block_sptr acquisition = gps_sdr_make_acquisition_ss(FLAGS_satellite, FLAGS_ms, FLAGS_shift_resolution, FLAGS_if_freq, FLAGS_fs_in, samples_per_ms, queue, FLAGS_dump);
|
||||
gr_block_sptr null_sink = gr_make_null_sink(sizeof(short)*samples_per_ms);
|
||||
|
||||
top_block->connect(source, 0, complex_to_interleaved_short, 0);
|
||||
top_block->connect(complex_to_interleaved_short, 0, stream_to_vector, 0);
|
||||
top_block->connect(stream_to_vector, 0 , acquisition, 0);
|
||||
top_block->connect(acquisition, 0, null_sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Executes a resampler based on some input parameters.
|
||||
* This is intended to check performance of resampling implementations.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
#include <gr_top_block.h>
|
||||
#include <gr_file_source.h>
|
||||
#include <gr_null_sink.h>
|
||||
#include <gr_firdes.h>
|
||||
|
||||
#include "gr_pfb_arb_resampler_ccf.h"
|
||||
|
||||
DEFINE_string(signal_file, "signal_samples/signal.dat",
|
||||
"Path to the file containing the signal samples");
|
||||
|
||||
DEFINE_int64(fs_in, 8000000, "FS of the signal in Hz");
|
||||
DEFINE_int64(fs_out, 2048000, "FS of the resampled signal in Hz");
|
||||
DEFINE_int64(trans_band, 100000, "Transition band of the filter");
|
||||
|
||||
int mcd(int a, int b){
|
||||
if (a==0) return b;
|
||||
return mcd(b%a,a);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
||||
double cutoff_freq;
|
||||
int div = mcd(FLAGS_fs_in,FLAGS_fs_out);
|
||||
unsigned int interpolation = FLAGS_fs_out/div;
|
||||
unsigned int decimation = FLAGS_fs_in/div;
|
||||
double sampling_freq = FLAGS_fs_in*interpolation;
|
||||
float rate = FLAGS_fs_in/FLAGS_fs_out;
|
||||
double gain = (double) interpolation;
|
||||
|
||||
if(interpolation > decimation) {
|
||||
cutoff_freq = FLAGS_fs_in/2;
|
||||
} else {
|
||||
cutoff_freq = (interpolation*FLAGS_fs_in)/(decimation*2);
|
||||
}
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "fs_in " << FLAGS_fs_in;
|
||||
LOG_AT_LEVEL(INFO) << "fs_out " << FLAGS_fs_out;
|
||||
LOG_AT_LEVEL(INFO) << "signal file " << FLAGS_signal_file;
|
||||
LOG_AT_LEVEL(INFO) << "transition band " << FLAGS_trans_band;
|
||||
LOG_AT_LEVEL(INFO) << "Interpolation " << interpolation;
|
||||
LOG_AT_LEVEL(INFO) << "Decimation " << decimation;
|
||||
LOG_AT_LEVEL(INFO) << "LPF cut-off frequency " << cutoff_freq;
|
||||
LOG_AT_LEVEL(INFO) << "Sampling frequency " << sampling_freq;
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gr_pfb_arb_resampler_test");
|
||||
|
||||
gr_file_source_sptr source = gr_make_file_source(sizeof(gr_complex),FLAGS_signal_file.c_str());
|
||||
|
||||
std::vector<float> low_pass_taps =
|
||||
gr_firdes::low_pass(gain, sampling_freq, cutoff_freq, FLAGS_trans_band, (gr_firdes::win_type)1);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Taps count " << low_pass_taps.size();
|
||||
|
||||
gr_pfb_arb_resampler_ccf_sptr resampler =
|
||||
gr_make_pfb_arb_resampler_ccf(rate, low_pass_taps, interpolation);
|
||||
gr_block_sptr sink = gr_make_null_sink(sizeof(gr_complex));
|
||||
|
||||
top_block->connect(source, 0, resampler, 0);
|
||||
top_block->connect(resampler, 0, sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Executes a resampler based on some input parameters.
|
||||
* This is intended to check performance of resampling implementations.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
#include <gr_top_block.h>
|
||||
#include <gr_file_source.h>
|
||||
#include <gr_null_sink.h>
|
||||
#include <gr_rational_resampler_base_ccf.h>
|
||||
#include <gr_firdes.h>
|
||||
|
||||
DEFINE_string(signal_file, "signal_samples/signal.dat",
|
||||
"Path to the file containing the signal samples");
|
||||
|
||||
DEFINE_int64(fs_in, 8000000, "FS of the signal in Hz");
|
||||
DEFINE_int64(fs_out, 2048000, "FS of the resampled signal in Hz");
|
||||
DEFINE_int64(trans_band, 100000, "Transition band of the filter");
|
||||
DEFINE_int32(window, 0, "win type");
|
||||
|
||||
int mcd(int a, int b){
|
||||
if (a==0) return b;
|
||||
return mcd(b%a,a);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
||||
int div = mcd(FLAGS_fs_in, FLAGS_fs_out);
|
||||
unsigned int interpolation = FLAGS_fs_out/div;
|
||||
unsigned int decimation = FLAGS_fs_in/div;
|
||||
double sampling_freq = FLAGS_fs_in*interpolation;
|
||||
double gain = (double) interpolation;
|
||||
double cutoff_freq;
|
||||
|
||||
if(interpolation > decimation) {
|
||||
cutoff_freq = FLAGS_fs_in/2;
|
||||
} else {
|
||||
cutoff_freq = (interpolation*FLAGS_fs_in)/(decimation*2);
|
||||
}
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "fs_in " << FLAGS_fs_in;
|
||||
LOG_AT_LEVEL(INFO) << "fs_out " << FLAGS_fs_out;
|
||||
LOG_AT_LEVEL(INFO) << "trans_band " << FLAGS_trans_band;
|
||||
LOG_AT_LEVEL(INFO) << "Interpolation " << interpolation;
|
||||
LOG_AT_LEVEL(INFO) << "Decimation " << decimation;
|
||||
LOG_AT_LEVEL(INFO) << "LPF cut-off frequency " << cutoff_freq;
|
||||
LOG_AT_LEVEL(INFO) << "Sampling frequency " << sampling_freq;
|
||||
LOG_AT_LEVEL(INFO) << "Windows " << FLAGS_window;
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gr_rational_resampler_test");
|
||||
|
||||
gr_file_source_sptr file_in = gr_make_file_source(sizeof(gr_complex),FLAGS_signal_file.c_str());
|
||||
|
||||
std::vector<float> low_pass_taps =
|
||||
gr_firdes::low_pass(gain, sampling_freq, cutoff_freq, FLAGS_trans_band, (gr_firdes::win_type)FLAGS_window);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Taps count " << low_pass_taps.size();
|
||||
|
||||
gr_rational_resampler_base_ccf_sptr resampler =
|
||||
gr_make_rational_resampler_base_ccf(interpolation, decimation, low_pass_taps);
|
||||
gr_block_sptr sink = gr_make_null_sink(sizeof(gr_complex));
|
||||
|
||||
top_block->connect(file_in, 0, resampler, 0);
|
||||
top_block->connect(resampler, 0, sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
}
|
|
@ -52,7 +52,7 @@ TEST(Direct_Resampler_Conditioner_Cc_Test, InstantiationAndRunTest) {
|
|||
int nsamples = 1000000; //Number of samples to be computed
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
gr_top_block_sptr top_block = gr_make_top_block("direct_resampler_conditioner_cc_test");
|
||||
gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in, GR_SIN_WAVE, 1000, 1, 0);
|
||||
gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in, GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||
gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
long long int begin;
|
||||
long long int end;
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Executes a gps sdr acquisition based on some input parameters.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
#include <gnuradio/gr_top_block.h>
|
||||
#include <gr_file_source.h>
|
||||
#include <gr_null_sink.h>
|
||||
#include <gps_sdr_acquisition_ss.h>
|
||||
#include <gr_stream_to_vector.h>
|
||||
#include <gr_msg_queue.h>
|
||||
#include <gr_complex_to_interleaved_short.h>
|
||||
|
||||
#include "gnss_sdr_direct_resampler_ccf.h"
|
||||
|
||||
DEFINE_string(signal_file, "signal_samples/signal.dat",
|
||||
"Path to the file containing the signal samples");
|
||||
|
||||
DEFINE_int64(fs_in, 2048000, "FS of the signal in Hz");
|
||||
DEFINE_int64(if_freq, 0, "Intermediate frequency");
|
||||
DEFINE_int32(satellite, 0, "Satellite number");
|
||||
DEFINE_bool(dump, false, "If true, acquisition result will be dumped in a file");
|
||||
DEFINE_int32(ms, 1, "ms of signal to be used in the acquisition process");
|
||||
DEFINE_int32(shift_resolution, 15, "shift resolution for acquisition");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
int samples_per_ms = ceil(FLAGS_fs_in/1000);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "fs_in " << FLAGS_fs_in;
|
||||
LOG_AT_LEVEL(INFO) << "if_freq " << FLAGS_if_freq;
|
||||
LOG_AT_LEVEL(INFO) << "satellite " << FLAGS_satellite;
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gps_sdr_acquisition_test");
|
||||
gr_block_sptr source = gr_make_file_source(sizeof(gr_complex),FLAGS_signal_file.c_str());
|
||||
gr_block_sptr complex_to_interleaved_short = gr_make_complex_to_interleaved_short();
|
||||
|
||||
gr_block_sptr stream_to_vector = gr_make_stream_to_vector(sizeof(short), samples_per_ms);
|
||||
gr_block_sptr acquisition = gps_sdr_make_acquisition_ss(FLAGS_satellite, FLAGS_ms, FLAGS_shift_resolution, FLAGS_if_freq, FLAGS_fs_in, samples_per_ms, queue, FLAGS_dump);
|
||||
gr_block_sptr null_sink = gr_make_null_sink(sizeof(short)*samples_per_ms);
|
||||
|
||||
top_block->connect(source, 0, complex_to_interleaved_short, 0);
|
||||
top_block->connect(complex_to_interleaved_short, 0, stream_to_vector, 0);
|
||||
top_block->connect(stream_to_vector, 0 , acquisition, 0);
|
||||
top_block->connect(acquisition, 0, null_sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Luis Esteve, 2010.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Executes the Tong algorithm for a gps sdr acquisition based on some input parameters.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
#include <gr_top_block.h>
|
||||
#include <gr_sig_source_c.h>
|
||||
#include <gr_file_sink.h>
|
||||
#include <gr_stream_to_vector.h>
|
||||
#include <gr_complex_to_interleaved_short.h>
|
||||
#include <gr_head.h>
|
||||
|
||||
#include "gps_sdr_fft_block.h"
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gps sdr fft block test");
|
||||
gr_block_sptr source = gr_make_sig_source_c(2048, GR_SIN_WAVE, 1, 32767, 0);
|
||||
gr_block_sptr complex2short = gr_make_complex_to_interleaved_short();
|
||||
gr_block_sptr fft = gps_sdr_make_fft();
|
||||
gr_block_sptr sink = gr_make_file_sink(sizeof(short)*2*2048, "./data/gps_sdr_fft_block_test.dat");
|
||||
gr_block_sptr str2vec = gr_make_stream_to_vector(sizeof(short), 2048*2);
|
||||
gr_block_sptr head = gr_make_head(sizeof(gr_complex), 2048);
|
||||
|
||||
top_block->connect(source, 0, head, 0);
|
||||
top_block->connect(head, 0, complex2short, 0);
|
||||
top_block->connect(complex2short, 0, str2vec, 0);
|
||||
top_block->connect(str2vec, 0, fft, 0);
|
||||
top_block->connect(fft, 0, sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Luis Esteve, 2010.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Executes the Tong algorithm for a gps sdr acquisition based on some input parameters.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
#include <gr_top_block.h>
|
||||
#include <gr_file_source.h>
|
||||
#include <gr_null_sink.h>
|
||||
#include <gps_sdr_tong_acquisition_ss.h>
|
||||
#include <gr_stream_to_vector.h>
|
||||
#include <gr_msg_queue.h>
|
||||
#include <gr_complex_to_interleaved_short.h>
|
||||
#include <gr_multiply_const_cc.h>
|
||||
|
||||
#include "gnss_sdr_direct_resampler_ccf.h"
|
||||
|
||||
DEFINE_string(signal_file, "signal_samples/signal.dat",
|
||||
"Path to the file containing the signal samples");
|
||||
|
||||
DEFINE_int64(fs_in, 2048000, "FS of the signal in Hz");
|
||||
DEFINE_int64(if_freq, 0, "Intermediate frequency");
|
||||
DEFINE_int32(satellite, 0, "Satellite number");
|
||||
DEFINE_bool(dump, false, "If true, acquisition result will be dumped in a file");
|
||||
DEFINE_int32(ms, 1, "ms of signal to be used in the acquisition process");
|
||||
DEFINE_int32(shift_resolution, 15, "shift resolution for acquisition");
|
||||
DEFINE_int32(A_value, 8, "Value of the k variable when the acquisition_done is true");
|
||||
DEFINE_int64(acquisition_threshold, 2000000, "threshold of the acquisition algorithm");
|
||||
//DEFINE_int32(max_dwells, 30, "number of dwells in Tong acquisition algorithm");
|
||||
DEFINE_int32(B_value, 2, "Value of the initial K variable in Tong algorithm");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
gr_msg_queue_sptr queue = gr_msg_queue_sptr();
|
||||
|
||||
int samples_per_ms = ceil(FLAGS_fs_in/1000);
|
||||
gr_complex div = 0.001;
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "fs_in " << FLAGS_fs_in;
|
||||
LOG_AT_LEVEL(INFO) << "if_freq " << FLAGS_if_freq;
|
||||
LOG_AT_LEVEL(INFO) << "satellite " << FLAGS_satellite;
|
||||
// LOG_AT_LEVEL(INFO) << "max_dwells " << FLAGS_max_dwells;
|
||||
LOG_AT_LEVEL(INFO) << "threshold " << FLAGS_acquisition_threshold;
|
||||
LOG_AT_LEVEL(INFO) << "A_value " << FLAGS_A_value;
|
||||
LOG_AT_LEVEL(INFO) << "B_value " << FLAGS_B_value;
|
||||
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gps_sdr_tong_acquisition_test");
|
||||
gr_block_sptr source = gr_make_file_source(sizeof(gr_complex),FLAGS_signal_file.c_str());
|
||||
gr_multiply_const_cc_sptr divisor = gr_make_multiply_const_cc(div);
|
||||
gr_block_sptr complex_to_interleaved_short = gr_make_complex_to_interleaved_short();
|
||||
|
||||
gr_block_sptr stream_to_vector = gr_make_stream_to_vector(sizeof(short), samples_per_ms);
|
||||
gr_block_sptr acquisition = gps_sdr_make_tong_acquisition_ss(FLAGS_satellite, FLAGS_ms, FLAGS_shift_resolution, FLAGS_if_freq, FLAGS_fs_in, samples_per_ms, queue, FLAGS_dump, FLAGS_B_value, FLAGS_acquisition_threshold, FLAGS_A_value);
|
||||
gr_block_sptr null_sink = gr_make_null_sink(sizeof(short)*samples_per_ms);
|
||||
|
||||
top_block->connect(source, 0, divisor, 0);
|
||||
top_block->connect(divisor, 0, complex_to_interleaved_short, 0);
|
||||
top_block->connect(complex_to_interleaved_short, 0, stream_to_vector, 0);
|
||||
top_block->connect(stream_to_vector, 0 , acquisition, 0);
|
||||
top_block->connect(acquisition, 0, null_sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Executes a resampler based on some input parameters.
|
||||
* This is intended to check performance of resampling implementations.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
#include <gr_top_block.h>
|
||||
#include <gr_file_source.h>
|
||||
#include <gr_null_sink.h>
|
||||
#include <gr_firdes.h>
|
||||
|
||||
#include "gr_pfb_arb_resampler_ccf.h"
|
||||
|
||||
DEFINE_string(signal_file, "signal_samples/signal.dat",
|
||||
"Path to the file containing the signal samples");
|
||||
|
||||
DEFINE_int64(fs_in, 8000000, "FS of the signal in Hz");
|
||||
DEFINE_int64(fs_out, 2048000, "FS of the resampled signal in Hz");
|
||||
DEFINE_int64(trans_band, 100000, "Transition band of the filter");
|
||||
|
||||
int mcd(int a, int b){
|
||||
if (a==0) return b;
|
||||
return mcd(b%a,a);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
||||
double cutoff_freq;
|
||||
int div = mcd(FLAGS_fs_in,FLAGS_fs_out);
|
||||
unsigned int interpolation = FLAGS_fs_out/div;
|
||||
unsigned int decimation = FLAGS_fs_in/div;
|
||||
double sampling_freq = FLAGS_fs_in*interpolation;
|
||||
float rate = FLAGS_fs_in/FLAGS_fs_out;
|
||||
double gain = (double) interpolation;
|
||||
|
||||
if(interpolation > decimation) {
|
||||
cutoff_freq = FLAGS_fs_in/2;
|
||||
} else {
|
||||
cutoff_freq = (interpolation*FLAGS_fs_in)/(decimation*2);
|
||||
}
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "fs_in " << FLAGS_fs_in;
|
||||
LOG_AT_LEVEL(INFO) << "fs_out " << FLAGS_fs_out;
|
||||
LOG_AT_LEVEL(INFO) << "signal file " << FLAGS_signal_file;
|
||||
LOG_AT_LEVEL(INFO) << "transition band " << FLAGS_trans_band;
|
||||
LOG_AT_LEVEL(INFO) << "Interpolation " << interpolation;
|
||||
LOG_AT_LEVEL(INFO) << "Decimation " << decimation;
|
||||
LOG_AT_LEVEL(INFO) << "LPF cut-off frequency " << cutoff_freq;
|
||||
LOG_AT_LEVEL(INFO) << "Sampling frequency " << sampling_freq;
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gr_pfb_arb_resampler_test");
|
||||
|
||||
gr_file_source_sptr source = gr_make_file_source(sizeof(gr_complex),FLAGS_signal_file.c_str());
|
||||
|
||||
std::vector<float> low_pass_taps =
|
||||
gr_firdes::low_pass(gain, sampling_freq, cutoff_freq, FLAGS_trans_band, (gr_firdes::win_type)1);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Taps count " << low_pass_taps.size();
|
||||
|
||||
gr_pfb_arb_resampler_ccf_sptr resampler =
|
||||
gr_make_pfb_arb_resampler_ccf(rate, low_pass_taps, interpolation);
|
||||
gr_block_sptr sink = gr_make_null_sink(sizeof(gr_complex));
|
||||
|
||||
top_block->connect(source, 0, resampler, 0);
|
||||
top_block->connect(resampler, 0, sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Executes a resampler based on some input parameters.
|
||||
* This is intended to check performance of resampling implementations.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
#include <gr_top_block.h>
|
||||
#include <gr_file_source.h>
|
||||
#include <gr_null_sink.h>
|
||||
#include <gr_rational_resampler_base_ccf.h>
|
||||
#include <gr_firdes.h>
|
||||
|
||||
DEFINE_string(signal_file, "signal_samples/signal.dat",
|
||||
"Path to the file containing the signal samples");
|
||||
|
||||
DEFINE_int64(fs_in, 8000000, "FS of the signal in Hz");
|
||||
DEFINE_int64(fs_out, 2048000, "FS of the resampled signal in Hz");
|
||||
DEFINE_int64(trans_band, 100000, "Transition band of the filter");
|
||||
DEFINE_int32(window, 0, "win type");
|
||||
|
||||
int mcd(int a, int b){
|
||||
if (a==0) return b;
|
||||
return mcd(b%a,a);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
||||
int div = mcd(FLAGS_fs_in, FLAGS_fs_out);
|
||||
unsigned int interpolation = FLAGS_fs_out/div;
|
||||
unsigned int decimation = FLAGS_fs_in/div;
|
||||
double sampling_freq = FLAGS_fs_in*interpolation;
|
||||
double gain = (double) interpolation;
|
||||
double cutoff_freq;
|
||||
|
||||
if(interpolation > decimation) {
|
||||
cutoff_freq = FLAGS_fs_in/2;
|
||||
} else {
|
||||
cutoff_freq = (interpolation*FLAGS_fs_in)/(decimation*2);
|
||||
}
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "fs_in " << FLAGS_fs_in;
|
||||
LOG_AT_LEVEL(INFO) << "fs_out " << FLAGS_fs_out;
|
||||
LOG_AT_LEVEL(INFO) << "trans_band " << FLAGS_trans_band;
|
||||
LOG_AT_LEVEL(INFO) << "Interpolation " << interpolation;
|
||||
LOG_AT_LEVEL(INFO) << "Decimation " << decimation;
|
||||
LOG_AT_LEVEL(INFO) << "LPF cut-off frequency " << cutoff_freq;
|
||||
LOG_AT_LEVEL(INFO) << "Sampling frequency " << sampling_freq;
|
||||
LOG_AT_LEVEL(INFO) << "Windows " << FLAGS_window;
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gr_rational_resampler_test");
|
||||
|
||||
gr_file_source_sptr file_in = gr_make_file_source(sizeof(gr_complex),FLAGS_signal_file.c_str());
|
||||
|
||||
std::vector<float> low_pass_taps =
|
||||
gr_firdes::low_pass(gain, sampling_freq, cutoff_freq, FLAGS_trans_band, (gr_firdes::win_type)FLAGS_window);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Taps count " << low_pass_taps.size();
|
||||
|
||||
gr_rational_resampler_base_ccf_sptr resampler =
|
||||
gr_make_rational_resampler_base_ccf(interpolation, decimation, low_pass_taps);
|
||||
gr_block_sptr sink = gr_make_null_sink(sizeof(gr_complex));
|
||||
|
||||
top_block->connect(file_in, 0, resampler, 0);
|
||||
top_block->connect(resampler, 0, sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,46 @@
|
|||
Matlab Signal Generator:
|
||||
|
||||
function [E1]=GPS_L1(Fs,BB_BW,CN0_IN,Tsig,FI,Doppler,Delay,numsat,flag_Datos,flag_local,flag_noise)
|
||||
%[L1]=GPS_L1
|
||||
%Fs= Sampling frequency [Hz]
|
||||
%BB_BW= BaseBand bandwidth [Hz]
|
||||
%CN0_IN= Carrier-to-noise-density ratio [dB]
|
||||
%Tsig= Total signal time to generate [s]
|
||||
%FI= Intermediate Frequency, 0 means baseband [Hz]
|
||||
%Doppler = Doppler frequency [Hz]
|
||||
%Delay = Code delay [s]
|
||||
%numsat= Satellite Vehicle number(1-31)
|
||||
%flag_datos = 1 -> Signal contains random telemetry bits 0 -> No telemetry
|
||||
%flag_local = 1 -> Signal will be used as a local replica
|
||||
%flag_noise = 1 -> Signal contains noise 0 -> signal is noise-free
|
||||
|
||||
s = GPS_L1(4e6,1.99e6,42,0.2,0,1680,131e-6,1,1,0,0);
|
||||
|
||||
fs: 4e06
|
||||
CN0: 42 dbHz
|
||||
Doppler: -1680 Hz
|
||||
Delay: 131e-6 s x 4e6 sps/s = 524 sps
|
||||
|
||||
=============================================================================================================
|
||||
|
||||
Matlab analysis:
|
||||
|
||||
Probing data (/media/DATA/Proyectos/Signals/signal.dat)...
|
||||
Raw IF data plotted
|
||||
(run setSettings or change settings in "initSettings.m" to reconfigure)
|
||||
|
||||
Enter "1" to initiate GNSS processing or "0" to exit : 1
|
||||
|
||||
Starting processing...
|
||||
Acquiring satellites...
|
||||
(01 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
|
||||
|
||||
*=========*=====*===============*===========*=============*========*
|
||||
| Channel | PRN | Frequency | Doppler | Code Offset | Status |
|
||||
*=========*=====*===============*===========*=============*========*
|
||||
| 1 | 1 | -1.67847e+03 | -1678 | 525 | T |
|
||||
*=========*=====*===============*===========*=============*========*
|
||||
|
||||
Tracking started at 31-May-2012 12:55:03
|
||||
Tracking is over (elapsed time 00:00:00)
|
||||
Saving Acq & Tracking results to file "trackingResults.mat"
|
|
@ -53,45 +53,21 @@
|
|||
//#include "flowgraph/file_signal_source_test.cc"
|
||||
#include "flowgraph/pass_through_test.cc"
|
||||
//#include "flowgraph/gnss_flowgraph_test.cc"
|
||||
//#include "gnss_block/file_output_filter_test.cc"
|
||||
//#include "gnss_block/gnss_block_factory_test.cc"
|
||||
#include "gnuradio_block/gnss_sdr_valve_test.cc"
|
||||
#include "gnuradio_block/direct_resampler_conditioner_cc_test.cc"
|
||||
#include "string_converter/string_converter_test.cc"
|
||||
#include "arithmetic/complex_arithmetic_libc.cc"
|
||||
#include "arithmetic/correlations_libc.cc"
|
||||
#include "arithmetic/cordic_test.cc"
|
||||
#include "gnss_block/file_signal_source_test.cc"
|
||||
#include "gnss_block/fir_filter_test.cc"
|
||||
#include "gnss_block/gps_l1_ca_pcps_acquisition_test.cc"
|
||||
#include "gnss_block/file_output_filter_test.cc"
|
||||
#include "gnss_block/gnss_block_factory_test.cc"
|
||||
//#include "gnss_block/direct_resampler_conditioner_test.cc"
|
||||
|
||||
concurrent_queue<Gps_Navigation_Message> global_gps_nav_msg_queue;
|
||||
|
||||
/*
|
||||
class Control_Message_Factory_Test : public ::testing:: Test
|
||||
{
|
||||
protected:
|
||||
Control_Message_Factory_Test(){}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class File_Configuration_Test : public ::testing:: Test
|
||||
{
|
||||
protected:
|
||||
File_Configuration_Test(){}
|
||||
};
|
||||
|
||||
|
||||
class Control_Thread_Test : public ::testing:: Test
|
||||
{
|
||||
protected:
|
||||
Control_Thread_Test(){}
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue