From 59e3ffe1674721a231195f219e5f484ead537470 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 2 Feb 2017 20:05:15 +0100 Subject: [PATCH 1/4] Add header --- .../libs/CMakeLists.txt | 2 +- .../libs/tlm_dump_reader.cc | 111 ++++++++++------ .../libs/tlm_dump_reader.h | 38 +++++- .../libs/tracking_dump_reader.cc | 120 +++++++++++------- .../libs/tracking_dump_reader.h | 38 +++++- .../libs/tracking_true_obs_reader.cc | 113 +++++++++++------ .../libs/tracking_true_obs_reader.h | 38 +++++- 7 files changed, 323 insertions(+), 137 deletions(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt index 82d4d76e3..3e68bc02d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt +++ b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2015 (see AUTHORS file for a list of contributors) +# Copyright (C) 2012-2017 (see AUTHORS file for a list of contributors) # # This file is part of GNSS-SDR. # diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc index 9cfb645a9..3cf8993fa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc @@ -1,73 +1,110 @@ -// -// Created by javier on 1/2/2017. -// +/*! + * \file tlm_dump_reader.cc + * \brief Helper file for unit testing + * \author Javier Arribas, 2017. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ #include "tlm_dump_reader.h" bool tlm_dump_reader::read_binary_obs() +{ + try { - try { d_dump_file.read((char *) &TOW_at_current_symbol, sizeof(double)); d_dump_file.read((char *) &Prn_timestamp_ms, sizeof(double)); d_dump_file.read((char *) &d_TOW_at_Preamble, sizeof(double)); + } + catch (const std::ifstream::failure &e) + { + return false; + } + return true; +} + +bool tlm_dump_reader::restart() +{ + if (d_dump_file.is_open()) + { + d_dump_file.clear(); + d_dump_file.seekg(0, std::ios::beg); + return true; } - catch (const std::ifstream::failure &e) { + else + { return false; } - return true; - } - -bool tlm_dump_reader::restart() { - if (d_dump_file.is_open()) - { - d_dump_file.clear(); - d_dump_file.seekg(0, std::ios::beg); - return true; - }else{ - return false; - } } long int tlm_dump_reader::num_epochs() { std::ifstream::pos_type size; - int number_of_vars_in_epoch=3; - int epoch_size_bytes=sizeof(double)*number_of_vars_in_epoch; + int number_of_vars_in_epoch = 3; + int epoch_size_bytes = sizeof(double)*number_of_vars_in_epoch; std::ifstream tmpfile( d_dump_filename.c_str(), std::ios::binary | std::ios::ate); if (tmpfile.is_open()) { size = tmpfile.tellg(); long int nepoch=size / epoch_size_bytes; return nepoch; - }else{ + } + else + { return 0; } } -bool tlm_dump_reader::open_obs_file(std::string out_file) { +bool tlm_dump_reader::open_obs_file(std::string out_file) +{ if (d_dump_file.is_open() == false) - { - try { - d_dump_filename=out_file; - d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); - d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); - std::cout << "TLM dump enabled, Log file: " << d_dump_filename.c_str()<< std::endl; - return true; + try + { + d_dump_filename=out_file; + d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); + d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); + std::cout << "TLM dump enabled, Log file: " << d_dump_filename.c_str()<< std::endl; + return true; + } + catch (const std::ifstream::failure & e) + { + std::cout << "Problem opening TLM dump Log file: " << d_dump_filename.c_str()<< std::endl; + return false; + } } - catch (const std::ifstream::failure & e) + else { - std::cout << "Problem opening TLM dump Log file: " << d_dump_filename.c_str()<< std::endl; return false; } - }else{ - return false; - } } -tlm_dump_reader::~tlm_dump_reader() { +tlm_dump_reader::~tlm_dump_reader() +{ if (d_dump_file.is_open() == true) - { - d_dump_file.close(); - } + { + d_dump_file.close(); + } } diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.h b/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.h index 0b64d19bf..a3afec291 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.h +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.h @@ -1,9 +1,35 @@ -// -// Created by javier on 23/1/2017. -// +/*! + * \file tlm_dump_reader.h + * \brief Helper file for unit testing + * \author Javier Arribas, 2017. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ -#ifndef GNSS_SIM_tlm_dump_reader_H -#define GNSS_SIM_tlm_dump_reader_H +#ifndef GNSS_SDR_tlm_dump_reader_H +#define GNSS_SDR_tlm_dump_reader_H #include #include @@ -31,4 +57,4 @@ private: }; -#endif //GNSS_SIM_tlm_dump_reader_H +#endif //GNSS_SDR_tlm_dump_reader_H diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc index 90b46b048..ac4120eb4 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc @@ -1,12 +1,38 @@ -// -// Created by javier on 1/2/2017. -// +/*! + * \file tracking_dump_reader.cc + * \brief Helper file for unit testing + * \author Javier Arribas, 2017. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ #include "tracking_dump_reader.h" bool tracking_dump_reader::read_binary_obs() - { - try { +{ + try { d_dump_file.read((char *) &abs_E, sizeof(float)); d_dump_file.read((char *) &abs_P, sizeof(float)); d_dump_file.read((char *) &abs_L, sizeof(float)); @@ -27,22 +53,26 @@ bool tracking_dump_reader::read_binary_obs() d_dump_file.read((char *) &aux1, sizeof(double)); d_dump_file.read((char *) &aux2, sizeof(double)); + } + catch (const std::ifstream::failure &e) + { + return false; + } + return true; +} + +bool tracking_dump_reader::restart() +{ + if (d_dump_file.is_open()) + { + d_dump_file.clear(); + d_dump_file.seekg(0, std::ios::beg); + return true; } - catch (const std::ifstream::failure &e) { + else + { return false; } - return true; - } - -bool tracking_dump_reader::restart() { - if (d_dump_file.is_open()) - { - d_dump_file.clear(); - d_dump_file.seekg(0, std::ios::beg); - return true; - }else{ - return false; - } } long int tracking_dump_reader::num_epochs() @@ -50,44 +80,48 @@ long int tracking_dump_reader::num_epochs() std::ifstream::pos_type size; int number_of_double_vars=11; int number_of_float_vars=5; - int epoch_size_bytes=sizeof(unsigned long int)+ - sizeof(double)*number_of_double_vars+ - sizeof(float)*number_of_float_vars; + int epoch_size_bytes=sizeof(unsigned long int) + + sizeof(double) * number_of_double_vars + + sizeof(float) * number_of_float_vars; std::ifstream tmpfile( d_dump_filename.c_str(), std::ios::binary | std::ios::ate); if (tmpfile.is_open()) { size = tmpfile.tellg(); - long int nepoch=size / epoch_size_bytes; + long int nepoch = size / epoch_size_bytes; return nepoch; - }else{ + } + else + { return 0; } } -bool tracking_dump_reader::open_obs_file(std::string out_file) { +bool tracking_dump_reader::open_obs_file(std::string out_file) +{ if (d_dump_file.is_open() == false) - { - try { - d_dump_filename=out_file; - d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); - d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); - std::cout << "Tracking dump enabled, Log file: " << d_dump_filename.c_str()<< std::endl; - return true; + try + { + d_dump_filename = out_file; + d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); + d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); + std::cout << "Tracking dump enabled, Log file: " << d_dump_filename.c_str() << std::endl; + return true; + } + catch (const std::ifstream::failure & e) + { + std::cout << "Problem opening Tracking dump Log file: " << d_dump_filename.c_str() << std::endl; + return false; + } + }else{ + return false; } - catch (const std::ifstream::failure & e) - { - std::cout << "Problem opening Tracking dump Log file: " << d_dump_filename.c_str()<< std::endl; - return false; - } - }else{ - return false; - } } -tracking_dump_reader::~tracking_dump_reader() { +tracking_dump_reader::~tracking_dump_reader() +{ if (d_dump_file.is_open() == true) - { - d_dump_file.close(); - } + { + d_dump_file.close(); + } } diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.h b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.h index a72315ce9..9f145ecc8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.h +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.h @@ -1,9 +1,35 @@ -// -// Created by javier on 23/1/2017. -// +/*! + * \file tracking_dump_reader.h + * \brief Helper file for unit testing + * \author Javier Arribas, 2017. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ -#ifndef GNSS_SIM_tracking_dump_reader_H -#define GNSS_SIM_tracking_dump_reader_H +#ifndef GNSS_SDR_tracking_dump_reader_H +#define GNSS_SDR_tracking_dump_reader_H #include #include @@ -60,4 +86,4 @@ private: }; -#endif //GNSS_SIM_tracking_dump_reader_H +#endif //GNSS_SDR_tracking_dump_reader_H diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc index cc843e70b..90a31cca4 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc @@ -1,75 +1,112 @@ -// -// Created by javier on 1/2/2017. -// +/*! + * \file tracking_true_obs_reader.cc + * \brief Helper file for unit testing + * \author Javier Arribas, 2017. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ #include "tracking_true_obs_reader.h" bool tracking_true_obs_reader::read_binary_obs() +{ + try { - try { d_dump_file.read((char *) &signal_timestamp_s, sizeof(double)); d_dump_file.read((char *) &acc_carrier_phase_cycles, sizeof(double)); d_dump_file.read((char *) &doppler_l1_hz, sizeof(double)); d_dump_file.read((char *) &prn_delay_chips, sizeof(double)); d_dump_file.read((char *) &tow, sizeof(double)); + } + catch (const std::ifstream::failure &e) + { + return false; + } + return true; +} + +bool tracking_true_obs_reader::restart() +{ + if (d_dump_file.is_open()) + { + d_dump_file.clear(); + d_dump_file.seekg(0, std::ios::beg); + return true; } - catch (const std::ifstream::failure &e) { + else + { return false; } - return true; - } - -bool tracking_true_obs_reader::restart() { - if (d_dump_file.is_open()) - { - d_dump_file.clear(); - d_dump_file.seekg(0, std::ios::beg); - return true; - }else{ - return false; - } } long int tracking_true_obs_reader::num_epochs() { std::ifstream::pos_type size; - int number_of_vars_in_epoch=5; - int epoch_size_bytes=sizeof(double)*number_of_vars_in_epoch; + int number_of_vars_in_epoch = 5; + int epoch_size_bytes = sizeof(double) * number_of_vars_in_epoch; std::ifstream tmpfile( d_dump_filename.c_str(), std::ios::binary | std::ios::ate); if (tmpfile.is_open()) { size = tmpfile.tellg(); - long int nepoch=size / epoch_size_bytes; + long int nepoch = size / epoch_size_bytes; return nepoch; - }else{ + } + else + { return 0; } } -bool tracking_true_obs_reader::open_obs_file(std::string out_file) { +bool tracking_true_obs_reader::open_obs_file(std::string out_file) +{ if (d_dump_file.is_open() == false) - { - try { - d_dump_filename=out_file; - d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); - d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); - std::cout << "Observables dump enabled, Log file: " << d_dump_filename.c_str()<< std::endl; - return true; + try + { + d_dump_filename = out_file; + d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); + d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); + std::cout << "Observables dump enabled, Log file: " << d_dump_filename.c_str() << std::endl; + return true; + } + catch (const std::ifstream::failure & e) + { + std::cout << "Problem opening Observables dump Log file: " << d_dump_filename.c_str() << std::endl; + return false; + } } - catch (const std::ifstream::failure & e) + else { - std::cout << "Problem opening Observables dump Log file: " << d_dump_filename.c_str()<< std::endl; return false; } - }else{ - return false; - } } -tracking_true_obs_reader::~tracking_true_obs_reader() { +tracking_true_obs_reader::~tracking_true_obs_reader() +{ if (d_dump_file.is_open() == true) - { - d_dump_file.close(); - } + { + d_dump_file.close(); + } } diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h index de4664896..c7f1e646b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h @@ -1,9 +1,35 @@ -// -// Created by javier on 23/1/2017. -// +/*! + * \file tracking_true_obs_reader.h + * \brief Helper file for unit testing + * \author Javier Arribas, 2017. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ -#ifndef GNSS_SIM_tracking_true_obs_reader_H -#define GNSS_SIM_tracking_true_obs_reader_H +#ifndef GNSS_SDR_tracking_true_obs_reader_H +#define GNSS_SDR_tracking_true_obs_reader_H #include #include @@ -33,4 +59,4 @@ private: }; -#endif //GNSS_SIM_tracking_true_obs_reader_H +#endif //GNSS_SDR_tracking_true_obs_reader_H From 6e97c5f2f903b6cd0ede1dc3541ffc263b4ee605 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 2 Feb 2017 20:07:36 +0100 Subject: [PATCH 2/4] Define all the commandline flags of the signal generator in a single file --- src/tests/CMakeLists.txt | 3 +- .../common-files/signal_generator_flags.h | 13 ++++++ .../system-tests/obs_gps_l1_system_test.cc | 40 +++++++++++-------- .../gps_l1_ca_telemetry_decoder_test.cc | 29 ++++++-------- 4 files changed, 52 insertions(+), 33 deletions(-) create mode 100644 src/tests/common-files/signal_generator_flags.h diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 77249088c..0dc9e830a 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -234,6 +234,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs ${CMAKE_SOURCE_DIR}/src/tests/unit-tests/signal-processing-blocks/libs + ${CMAKE_SOURCE_DIR}/src/tests/common-files ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS} @@ -504,7 +505,7 @@ if(ENABLE_SYSTEM_TESTING) ) if(ENABLE_SYSTEM_TESTING_EXTRA) - add_executable(obs_gps_l1_system_test ${CMAKE_CURRENT_SOURCE_DIR}/system-tests/obs_gps_l1_system_test.cc ) + add_executable(obs_gps_l1_system_test ${CMAKE_CURRENT_SOURCE_DIR}/system-tests/obs_gps_l1_system_test.cc) if(NOT ${GTEST_DIR_LOCAL}) add_dependencies(obs_gps_l1_system_test gtest-${gtest_RELEASE} ) else(NOT ${GTEST_DIR_LOCAL}) diff --git a/src/tests/common-files/signal_generator_flags.h b/src/tests/common-files/signal_generator_flags.h new file mode 100644 index 000000000..0a5e22a6b --- /dev/null +++ b/src/tests/common-files/signal_generator_flags.h @@ -0,0 +1,13 @@ + +#include + + +DEFINE_string(generator_binary, std::string(SW_GENERATOR_BIN), "Path of software-defined signal generator binary"); +DEFINE_string(rinex_nav_file, std::string(DEFAULT_RINEX_NAV), "Input RINEX navigation file"); +DEFINE_int32(duration, 100, "Duration of the experiment [in seconds, max = 300]"); +DEFINE_string(static_position, "30.286502,120.032669,100", "Static receiver position [log,lat,height]"); +DEFINE_string(dynamic_position, "", "Observer positions file, in .csv or .nmea format"); +DEFINE_string(filename_rinex_obs, "sim.16o", "Filename of output RINEX navigation file"); +DEFINE_string(filename_raw_data, "signal_out.bin", "Filename of output raw data file"); +DEFINE_int32(fs_gen_hz, 2600000, "Samppling frequency [Hz]"); +DEFINE_int32(test_satellite_PRN, 1, "PRN of the satellite under test (must be visible during the observation time)"); diff --git a/src/tests/system-tests/obs_gps_l1_system_test.cc b/src/tests/system-tests/obs_gps_l1_system_test.cc index ae18180e0..2eb15b55a 100644 --- a/src/tests/system-tests/obs_gps_l1_system_test.cc +++ b/src/tests/system-tests/obs_gps_l1_system_test.cc @@ -50,15 +50,16 @@ #include "concurrent_queue.h" #include "control_thread.h" #include "in_memory_configuration.h" +#include "signal_generator_flags.h" -DEFINE_string(generator_binary, std::string(SW_GENERATOR_BIN), "Path of software-defined signal generator binary"); -DEFINE_string(rinex_nav_file, std::string(DEFAULT_RINEX_NAV), "Input RINEX navigation file"); -DEFINE_int32(duration, 100, "Duration of the experiment [in seconds, max = 300]"); -DEFINE_string(static_position, "30.286502,120.032669,100", "Static receiver position [log,lat,height]"); -DEFINE_string(dynamic_position, "", "Observer positions file, in .csv or .nmea format"); -DEFINE_string(filename_rinex_obs, "sim.16o", "Filename of output RINEX navigation file"); -DEFINE_string(filename_raw_data, "signal_out.bin", "Filename of output raw data file"); +DECLARE_string(generator_binary); +DECLARE_string(rinex_nav_file); +DECLARE_int32(duration); +DECLARE_string(static_position); +DECLARE_string(dynamic_position); +DECLARE_string(filename_rinex_obs); +DECLARE_string(filename_raw_data); // For GPS NAVIGATION (L1) concurrent_queue global_gps_acq_assist_queue; @@ -237,11 +238,14 @@ int Obs_Gps_L1_System_Test::configure_receiver() // Set the Signal Conditioner config->set_property("SignalConditioner.implementation", "Signal_Conditioner"); - config->set_property("DataTypeAdapter.implementation", "Ibyte_To_Complex"); + //config->set_property("DataTypeAdapter.implementation", "Ibyte_To_Complex"); + config->set_property("DataTypeAdapter.implementation", "Ibyte_To_Cshort"); config->set_property("InputFilter.implementation", "Fir_Filter"); config->set_property("InputFilter.dump", "false"); - config->set_property("InputFilter.input_item_type", "gr_complex"); - config->set_property("InputFilter.output_item_type", "gr_complex"); + //config->set_property("InputFilter.input_item_type", "gr_complex"); + //config->set_property("InputFilter.output_item_type", "gr_complex"); + config->set_property("InputFilter.input_item_type", "cshort"); + config->set_property("InputFilter.output_item_type", "cshort"); config->set_property("InputFilter.taps_item_type", "float"); config->set_property("InputFilter.number_of_taps", std::to_string(number_of_taps)); config->set_property("InputFilter.number_of_bands", std::to_string(number_of_bands)); @@ -261,7 +265,8 @@ int Obs_Gps_L1_System_Test::configure_receiver() config->set_property("InputFilter.IF", std::to_string(zero)); config->set_property("Resampler.implementation", "Pass_Through"); config->set_property("Resampler.dump", "false"); - config->set_property("Resampler.item_type", "gr_complex"); + //config->set_property("Resampler.item_type", "gr_complex"); + config->set_property("Resampler.item_type", "cshort"); config->set_property("Resampler.sample_freq_in", std::to_string(sampling_rate_internal)); config->set_property("Resampler.sample_freq_out", std::to_string(sampling_rate_internal)); @@ -271,8 +276,10 @@ int Obs_Gps_L1_System_Test::configure_receiver() config->set_property("Channel.signal", "1C"); // Set Acquisition - config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); - config->set_property("Acquisition_1C.item_type", "gr_complex"); + //config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition"); + //config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.item_type", "cshort"); config->set_property("Acquisition_1C.if", std::to_string(zero)); config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); config->set_property("Acquisition_1C.threshold", std::to_string(threshold)); @@ -285,9 +292,10 @@ int Obs_Gps_L1_System_Test::configure_receiver() config->set_property("Acquisition_1C.tong_max_dwells", std::to_string(tong_max_dwells)); // Set Tracking - config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); - //config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_C_Aid_Tracking"); - config->set_property("Tracking_1C.item_type", "gr_complex"); + //config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); + config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_C_Aid_Tracking"); + //config->set_property("Tracking_1C.item_type", "gr_complex"); + config->set_property("Tracking_1C.item_type", "cshort"); config->set_property("Tracking_1C.if", std::to_string(zero)); config->set_property("Tracking_1C.dump", "false"); config->set_property("Tracking_1C.dump_filename", "./tracking_ch_"); diff --git a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc index 4798b861e..0f4a816ce 100644 --- a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc @@ -49,7 +49,6 @@ #include #include #include - #include "GPS_L1_CA.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" @@ -58,24 +57,22 @@ #include "in_memory_configuration.h" #include "gnss_synchro.h" #include "gps_l1_ca_telemetry_decoder.h" - -#include "../libs/tracking_true_obs_reader.h" -#include "../libs/tracking_dump_reader.h" -#include "../libs/tlm_dump_reader.h" - +#include "tracking_true_obs_reader.h" +#include "tracking_dump_reader.h" +#include "tlm_dump_reader.h" #include "gps_l1_ca_dll_pll_tracking.h" #include "gps_l1_ca_dll_pll_c_aid_tracking.h" +#include "signal_generator_flags.h" -DEFINE_string(generator_binary, std::string(SW_GENERATOR_BIN), "Path of software-defined signal generator binary"); -DEFINE_string(rinex_nav_file, std::string(DEFAULT_RINEX_NAV), "Input RINEX navigation file"); -DEFINE_int32(duration, 20, "Duration of the experiment [in seconds]"); -DEFINE_int32(fs_gen_hz, 2600000, "Samppling frequency [Hz]"); -DEFINE_string(static_position, "30.286502,120.032669,100", "Static receiver position [log,lat,height]"); -DEFINE_string(dynamic_position, "", "Observer positions file, in .csv or .nmea format"); -DEFINE_string(filename_rinex_obs, "sim.16o", "Filename of output RINEX navigation file"); -DEFINE_string(filename_raw_data, "signal_out.bin", "Filename of output raw data file"); -DEFINE_int32(test_satellite_PRN,1, "PRN of the satellite under test (must be visible during the observation time)"); - +DECLARE_string(generator_binary); +DECLARE_string(rinex_nav_file); +DECLARE_int32(duration); // 20 +DECLARE_int32(fs_gen_hz); +DECLARE_string(static_position); +DECLARE_string(dynamic_position); +DECLARE_string(filename_rinex_obs); +DECLARE_string(filename_raw_data); +DECLARE_int32(test_satellite_PRN); // ######## GNURADIO BLOCK MESSAGE RECEVER FOR TRACKING MESSAGES ######### class GpsL1CADllPllTelemetryDecoderTest_msg_rx; From 51c6ed85a9c5854b060ad1d8aaa9ca9d27d84087 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 2 Feb 2017 20:30:56 +0100 Subject: [PATCH 3/4] Fix path of raw data file --- .../tracking/gps_l2_m_dll_pll_tracking_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc index 842600c9e..372c8c5e6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc @@ -181,7 +181,7 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults) ASSERT_NO_THROW( { //gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); std::string path = std::string(TEST_PATH); - std::string file = path + "/data/gps_l2c_m_prn7_5msps.dat"; + std::string file = path + "signal_samples/gps_l2c_m_prn7_5msps.dat"; const char * file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false); boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); From e078ebfd109409745346ce422b802912a118de3c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 2 Feb 2017 20:37:46 +0100 Subject: [PATCH 4/4] Add header --- .../common-files/signal_generator_flags.h | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/tests/common-files/signal_generator_flags.h b/src/tests/common-files/signal_generator_flags.h index 0a5e22a6b..07a01a511 100644 --- a/src/tests/common-files/signal_generator_flags.h +++ b/src/tests/common-files/signal_generator_flags.h @@ -1,3 +1,35 @@ +/*! + * \file signal_generator_flags.h + * \brief Helper file for unit testing + * \author Carles Fernandez-Prades, 2017. cfernandez(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_SIGNAL_GENERATOR_FLAGS_H_ +#define GNSS_SDR_SIGNAL_GENERATOR_FLAGS_H_ #include @@ -11,3 +43,6 @@ DEFINE_string(filename_rinex_obs, "sim.16o", "Filename of output RINEX navigatio DEFINE_string(filename_raw_data, "signal_out.bin", "Filename of output raw data file"); DEFINE_int32(fs_gen_hz, 2600000, "Samppling frequency [Hz]"); DEFINE_int32(test_satellite_PRN, 1, "PRN of the satellite under test (must be visible during the observation time)"); + + +#endif