Skip to content

Commit

Permalink
Merge branch 'rinex_fix' of https://github.com/gnss-sdr/gnss-sdr into…
Browse files Browse the repository at this point in the history
… rinex_fix
  • Loading branch information
carlesfernandez committed Feb 2, 2017
2 parents d491718 + e078ebf commit 94514bb
Show file tree
Hide file tree
Showing 12 changed files with 411 additions and 171 deletions.
3 changes: 2 additions & 1 deletion src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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})
Expand Down
48 changes: 48 additions & 0 deletions src/tests/common-files/signal_generator_flags.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*!
* \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 <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/

#ifndef GNSS_SDR_SIGNAL_GENERATOR_FLAGS_H_
#define GNSS_SDR_SIGNAL_GENERATOR_FLAGS_H_

#include <gflags/gflags.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");
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
40 changes: 24 additions & 16 deletions src/tests/system-tests/obs_gps_l1_system_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<Gps_Acq_Assist> global_gps_acq_assist_queue;
Expand Down Expand Up @@ -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));
Expand All @@ -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));

Expand All @@ -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));
Expand All @@ -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_");
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
#
Expand Down
109 changes: 73 additions & 36 deletions src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/

#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) {
}
catch (const std::ifstream::failure &e)
{
return false;
}
return true;
}
return true;
}

bool tlm_dump_reader::restart() {
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;
}
{
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();
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
//
// Created by javier on 23/1/2017.
//

#ifndef GNSS_SIM_tlm_dump_reader_H
#define GNSS_SIM_tlm_dump_reader_H
/*!
* \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 <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/

#ifndef GNSS_SDR_tlm_dump_reader_H
#define GNSS_SDR_tlm_dump_reader_H

#include <iostream>
#include <fstream>
Expand Down Expand Up @@ -31,4 +57,4 @@ class tlm_dump_reader {

};

#endif //GNSS_SIM_tlm_dump_reader_H
#endif //GNSS_SDR_tlm_dump_reader_H
Loading

0 comments on commit 94514bb

Please sign in to comment.