1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-02 17:00:50 +00:00
This commit is contained in:
Carles Fernandez 2018-10-30 03:03:37 +01:00
commit 142a1c4b8c
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
29 changed files with 372 additions and 152 deletions

View File

@ -38,6 +38,7 @@ set(GNSS_SPLIBS_SOURCES
conjugate_cc.cc
conjugate_sc.cc
conjugate_ic.cc
gnss_sdr_create_directory.cc
)
set(GNSS_SPLIBS_HEADERS
@ -60,6 +61,7 @@ set(GNSS_SPLIBS_HEADERS
conjugate_cc.h
conjugate_sc.h
conjugate_ic.h
gnss_sdr_create_directory.h
gnss_circular_deque.h
)
@ -74,7 +76,7 @@ if(ENABLE_FPGA)
gnss_sdr_time_counter.h
gnss_sdr_fpga_sample_counter.h
)
endif(ENABLE_FPGA)
if(OPENCL_FOUND)
@ -83,12 +85,12 @@ if(OPENCL_FOUND)
opencl/fft_setup.cc # Needs OpenCL
opencl/fft_kernelstring.cc # Needs OpenCL
)
set(GNSS_SPLIBS_HEADERS ${GNSS_SPLIBS_HEADERS}
opencl/fft_execute.h # Needs OpenCL
opencl/fft_setup.h # Needs OpenCL
opencl/fft_kernelstring.h # Needs OpenCL
)
)
endif(OPENCL_FOUND)
include_directories(

View File

@ -0,0 +1,87 @@
/*!
* \file gnss_sdr_create_directory.cc
* \brief Create a directory
* \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (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 <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "gnss_sdr_create_directory.h"
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <fstream>
bool gnss_sdr_create_directory(const std::string& foldername)
{
std::string new_folder;
for (auto& folder : boost::filesystem::path(foldername))
{
new_folder += folder.string();
boost::system::error_code ec;
if (!boost::filesystem::exists(new_folder))
{
try
{
if (!boost::filesystem::create_directory(new_folder, ec))
{
return false;
}
}
catch (std::exception& e)
{
return false;
}
}
new_folder += boost::filesystem::path::preferred_separator;
}
// Check if we have writing permissions
std::string test_file = foldername + "/test_file.txt";
std::ofstream os_test_file;
os_test_file.open(test_file.c_str(), std::ios::out | std::ios::binary);
if (os_test_file.is_open())
{
boost::system::error_code ec;
os_test_file.close();
try
{
boost::filesystem::remove(test_file, ec);
}
catch (std::exception& e)
{
return false;
}
return true;
}
else
{
os_test_file.close();
return false;
}
}

View File

@ -0,0 +1,38 @@
/*!
* \file gnss_sdr_create_directory.h
* \brief Create a directory
* \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (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 <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GNSS_SDR_CREATE_DIRECTORY_H_
#define GNSS_SDR_GNSS_SDR_CREATE_DIRECTORY_H_
#include <string>
bool gnss_sdr_create_directory(const std::string& foldername);
#endif

View File

@ -38,21 +38,22 @@
using google::LogMessage;
HybridObservables::HybridObservables(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams, unsigned int out_streams) :
role_(role), in_streams_(in_streams), out_streams_(out_streams)
std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_dump_filename = "./observables.dat";
DLOG(INFO) << "role " << role;
dump_ = configuration->property(role + ".dump", false);
dump_mat_ = configuration->property(role + ".dump_mat", true);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
observables_ = hybrid_make_observables_cc(in_streams_, out_streams_, dump_, dump_filename_);
observables_ = hybrid_make_observables_cc(in_streams_, out_streams_, dump_, dump_mat_, dump_filename_);
DLOG(INFO) << "Observables block ID (" << observables_->unique_id() << ")";
}
HybridObservables::~HybridObservables()
{}
{
}
void HybridObservables::connect(gr::top_block_sptr top_block)

View File

@ -83,6 +83,7 @@ public:
private:
hybrid_observables_cc_sptr observables_;
bool dump_;
bool dump_mat_;
std::string dump_filename_;
std::string role_;
unsigned int in_streams_;

View File

@ -16,11 +16,11 @@
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
#
set(OBS_GR_BLOCKS_SOURCES
set(OBS_GR_BLOCKS_SOURCES
hybrid_observables_cc.cc
)
set(OBS_GR_BLOCKS_HEADERS
set(OBS_GR_BLOCKS_HEADERS
hybrid_observables_cc.h
)

View File

@ -32,6 +32,8 @@
#include "hybrid_observables_cc.h"
#include "display.h"
#include "GPS_L1_CA.h"
#include "gnss_sdr_create_directory.h"
#include <boost/filesystem/path.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
@ -45,42 +47,70 @@
using google::LogMessage;
hybrid_observables_cc_sptr hybrid_make_observables_cc(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, std::string dump_filename)
hybrid_observables_cc_sptr hybrid_make_observables_cc(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, bool dump_mat, std::string dump_filename)
{
return hybrid_observables_cc_sptr(new hybrid_observables_cc(nchannels_in, nchannels_out, dump, dump_filename));
return hybrid_observables_cc_sptr(new hybrid_observables_cc(nchannels_in, nchannels_out, dump, dump_mat, dump_filename));
}
hybrid_observables_cc::hybrid_observables_cc(uint32_t nchannels_in,
uint32_t nchannels_out,
bool dump,
bool dump_mat,
std::string dump_filename) : gr::block("hybrid_observables_cc",
gr::io_signature::make(nchannels_in, nchannels_in, sizeof(Gnss_Synchro)),
gr::io_signature::make(nchannels_out, nchannels_out, sizeof(Gnss_Synchro)))
{
d_dump = dump;
d_dump_mat = dump_mat and d_dump;
d_dump_filename = dump_filename;
d_nchannels_out = nchannels_out;
d_nchannels_in = nchannels_in;
d_dump_filename = dump_filename;
T_rx_clock_step_samples = 0U;
d_gnss_synchro_history = new Gnss_circular_deque<Gnss_Synchro>(500, d_nchannels_out);
// ############# ENABLE DATA FILE LOG #################
if (d_dump)
{
if (!d_dump_file.is_open())
std::string dump_path;
// Get path
if (d_dump_filename.find_last_of("/") != std::string::npos)
{
try
{
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
LOG(INFO) << "Observables dump enabled Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "Exception opening observables dump file " << e.what();
d_dump = false;
}
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of("/") + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of("/"));
d_dump_filename = dump_filename_;
}
else
{
dump_path = std::string(".");
}
if (d_dump_filename.empty())
{
d_dump_filename = "observables.dat";
}
// remove extension if any
if (d_dump_filename.substr(1).find_last_of(".") != std::string::npos)
{
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of("."));
}
d_dump_filename.append(".dat");
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
// create directory
if (!gnss_sdr_create_directory(dump_path))
{
std::cerr << "GNSS-SDR cannot create dump file for the Observables block. Wrong permissions?" << std::endl;
d_dump = false;
}
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try
{
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
LOG(INFO) << "Observables dump enabled Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "Exception opening observables dump file " << e.what();
d_dump = false;
}
}
T_rx_TOW_ms = 0U;
@ -107,11 +137,9 @@ hybrid_observables_cc::~hybrid_observables_cc()
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
}
}
if (d_dump)
if (d_dump_mat)
{
std::cout << "Writing observables .mat files ...";
save_matfile();
std::cout << " done." << std::endl;
}
}
@ -119,14 +147,16 @@ hybrid_observables_cc::~hybrid_observables_cc()
int32_t hybrid_observables_cc::save_matfile()
{
// READ DUMP FILE
std::string dump_filename = d_dump_filename;
std::ifstream::pos_type size;
int32_t number_of_double_vars = 7;
int32_t epoch_size_bytes = sizeof(double) * number_of_double_vars * d_nchannels_out;
std::ifstream dump_file;
std::cout << "Generating .mat file for " << dump_filename << std::endl;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try
{
dump_file.open(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
dump_file.open(dump_filename.c_str(), std::ios::binary | std::ios::ate);
}
catch (const std::ifstream::failure &e)
{
@ -553,7 +583,6 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused)
{
out[n][0] = epoch_data.at(n);
}
if (d_dump)
{
// MULTIPLEXED FILE RECORDING - Record results to file

View File

@ -48,7 +48,7 @@ class hybrid_observables_cc;
typedef boost::shared_ptr<hybrid_observables_cc> hybrid_observables_cc_sptr;
hybrid_observables_cc_sptr
hybrid_make_observables_cc(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, std::string dump_filename);
hybrid_make_observables_cc(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, bool dump_mat, std::string dump_filename);
/*!
* \brief This class implements a block that computes observables
@ -63,8 +63,8 @@ public:
private:
friend hybrid_observables_cc_sptr
hybrid_make_observables_cc(uint32_t nchannels_in, uint32_t nchannels_out, bool dump, std::string dump_filename);
hybrid_observables_cc(uint32_t nchannels_in, uint32_t nchannels_out, bool dump, std::string dump_filename);
hybrid_make_observables_cc(uint32_t nchannels_in, uint32_t nchannels_out, bool dump, bool dump_mat, std::string dump_filename);
hybrid_observables_cc(uint32_t nchannels_in, uint32_t nchannels_out, bool dump, bool dump_mat, std::string dump_filename);
bool interpolate_data(Gnss_Synchro& out, const uint32_t& ch, const double& ti);
bool interp_trk_obs(Gnss_Synchro& interpolated_obs, const uint32_t& ch, const uint64_t& rx_clock);
double compute_T_rx_s(const Gnss_Synchro& a);
@ -82,6 +82,7 @@ private:
uint32_t T_rx_TOW_ms;
uint32_t T_rx_TOW_offset_ms;
bool d_dump;
bool d_dump_mat;
uint32_t d_nchannels_in;
uint32_t d_nchannels_out;
std::string d_dump_filename;

View File

@ -63,6 +63,11 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
trk_param.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
trk_param.dump = dump;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
bool dump_mat = configuration->property(role + ".dump_mat", true);
trk_param.dump_mat = dump_mat;
trk_param.high_dyn = configuration->property(role + ".high_dyn", false);
if (configuration->property(role + ".smoother_length", 10) < 1)
{
@ -109,9 +114,6 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
}
trk_param.track_pilot = track_pilot;
trk_param.extend_correlation_symbols = extend_correlation_symbols;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
int vector_length = std::round(fs_in / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS));
trk_param.vector_length = vector_length;
trk_param.system = 'E';

View File

@ -65,6 +65,11 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
trk_param_fpga.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
trk_param_fpga.dump = dump;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param_fpga.dump_filename = dump_filename;
bool dump_mat = configuration->property(role + ".dump_mat", true);
trk_param_fpga.dump_mat = dump_mat;
float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 5.0);
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
trk_param_fpga.pll_bw_hz = pll_bw_hz;
@ -102,9 +107,6 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
trk_param_fpga.track_pilot = track_pilot;
d_track_pilot = track_pilot;
trk_param_fpga.extend_correlation_symbols = extend_correlation_symbols;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param_fpga.dump_filename = dump_filename;
int vector_length = std::round(fs_in / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS));
trk_param_fpga.vector_length = vector_length;
trk_param_fpga.system = 'E';

View File

@ -63,6 +63,11 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
trk_param.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
trk_param.dump = dump;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
bool dump_mat = configuration->property(role + ".dump_mat", true);
trk_param.dump_mat = dump_mat;
trk_param.high_dyn = configuration->property(role + ".high_dyn", false);
if (configuration->property(role + ".smoother_length", 10) < 1)
{
@ -85,9 +90,6 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz;
float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
trk_param.early_late_space_chips = early_late_space_chips;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
int vector_length = std::round(fs_in / (Galileo_E5a_CODE_CHIP_RATE_HZ / Galileo_E5a_CODE_LENGTH_CHIPS));
trk_param.vector_length = vector_length;
int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);

View File

@ -67,6 +67,11 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
trk_param_fpga.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
trk_param_fpga.dump = dump;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param_fpga.dump_filename = dump_filename;
bool dump_mat = configuration->property(role + ".dump_mat", true);
trk_param_fpga.dump_mat = dump_mat;
float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 20.0);
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
trk_param_fpga.pll_bw_hz = pll_bw_hz;
@ -79,9 +84,6 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
trk_param_fpga.dll_bw_narrow_hz = dll_bw_narrow_hz;
float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
trk_param_fpga.early_late_space_chips = early_late_space_chips;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param_fpga.dump_filename = dump_filename;
int vector_length = std::round(fs_in / (Galileo_E5a_CODE_CHIP_RATE_HZ / Galileo_E5a_CODE_LENGTH_CHIPS));
trk_param_fpga.vector_length = vector_length;
int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);

View File

@ -74,6 +74,11 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
}
bool dump = configuration->property(role + ".dump", false);
trk_param.dump = dump;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
bool dump_mat = configuration->property(role + ".dump_mat", true);
trk_param.dump_mat = dump_mat;
float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
trk_param.pll_bw_hz = pll_bw_hz;
@ -88,9 +93,6 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
trk_param.early_late_space_chips = early_late_space_chips;
float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5);
trk_param.early_late_space_narrow_chips = early_late_space_narrow_chips;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
int vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
trk_param.vector_length = vector_length;
int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1);

View File

@ -67,6 +67,11 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
trk_param_fpga.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
trk_param_fpga.dump = dump;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param_fpga.dump_filename = dump_filename;
bool dump_mat = configuration->property(role + ".dump_mat", true);
trk_param_fpga.dump_mat = dump_mat;
float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
trk_param_fpga.pll_bw_hz = pll_bw_hz;
@ -81,9 +86,6 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
trk_param_fpga.early_late_space_chips = early_late_space_chips;
float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5);
trk_param_fpga.early_late_space_narrow_chips = early_late_space_narrow_chips;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param_fpga.dump_filename = dump_filename;
int vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
trk_param_fpga.vector_length = vector_length;
int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1);

View File

@ -63,6 +63,11 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
trk_param.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
trk_param.dump = dump;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
bool dump_mat = configuration->property(role + ".dump_mat", true);
trk_param.dump_mat = dump_mat;
float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 2.0);
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
trk_param.pll_bw_hz = pll_bw_hz;
@ -72,9 +77,6 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
trk_param.early_late_space_chips = early_late_space_chips;
trk_param.early_late_space_narrow_chips = 0.0;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
int vector_length = std::round(static_cast<double>(fs_in) / (static_cast<double>(GPS_L2_M_CODE_RATE_HZ) / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS)));
trk_param.vector_length = vector_length;
int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1);

View File

@ -66,6 +66,11 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga(
trk_param_fpga.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
trk_param_fpga.dump = dump;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param_fpga.dump_filename = dump_filename;
bool dump_mat = configuration->property(role + ".dump_mat", true);
trk_param_fpga.dump_mat = dump_mat;
float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 2.0);
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
trk_param_fpga.pll_bw_hz = pll_bw_hz;
@ -75,9 +80,6 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga(
float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
trk_param_fpga.early_late_space_chips = early_late_space_chips;
trk_param_fpga.early_late_space_narrow_chips = 0.0;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param_fpga.dump_filename = dump_filename;
int vector_length = std::round(static_cast<double>(fs_in) / (static_cast<double>(GPS_L2_M_CODE_RATE_HZ) / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS)));
trk_param_fpga.vector_length = vector_length;
int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1);

View File

@ -63,6 +63,11 @@ GpsL5DllPllTracking::GpsL5DllPllTracking(
trk_param.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
trk_param.dump = dump;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
bool dump_mat = configuration->property(role + ".dump_mat", true);
trk_param.dump_mat = dump_mat;
trk_param.high_dyn = configuration->property(role + ".high_dyn", false);
if (configuration->property(role + ".smoother_length", 10) < 1)
{
@ -85,9 +90,6 @@ GpsL5DllPllTracking::GpsL5DllPllTracking(
trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz;
float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
trk_param.early_late_space_chips = early_late_space_chips;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
int vector_length = std::round(static_cast<double>(fs_in) / (static_cast<double>(GPS_L5i_CODE_RATE_HZ) / static_cast<double>(GPS_L5i_CODE_LENGTH_CHIPS)));
trk_param.vector_length = vector_length;
int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);

View File

@ -67,6 +67,11 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
trk_param_fpga.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
trk_param_fpga.dump = dump;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param_fpga.dump_filename = dump_filename;
bool dump_mat = configuration->property(role + ".dump_mat", true);
trk_param_fpga.dump_mat = dump_mat;
float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
trk_param_fpga.pll_bw_hz = pll_bw_hz;
@ -79,9 +84,6 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
trk_param_fpga.dll_bw_narrow_hz = dll_bw_narrow_hz;
float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
trk_param_fpga.early_late_space_chips = early_late_space_chips;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param_fpga.dump_filename = dump_filename;
int vector_length = std::round(static_cast<double>(fs_in) / (static_cast<double>(GPS_L5i_CODE_RATE_HZ) / static_cast<double>(GPS_L5i_CODE_LENGTH_CHIPS)));
trk_param_fpga.vector_length = vector_length;
int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);

View File

@ -49,6 +49,7 @@
#include "gps_l2c_signal.h"
#include "GPS_L5.h"
#include "gps_l5_signal.h"
#include "gnss_sdr_create_directory.h"
#include <boost/lexical_cast.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
@ -415,6 +416,42 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
d_carr_ph_history.resize(1);
d_code_ph_history.resize(1);
}
d_dump = trk_parameters.dump;
d_dump_mat = trk_parameters.dump_mat and d_dump;
if (d_dump)
{
d_dump_filename = trk_parameters.dump_filename;
std::string dump_path;
// Get path
if (d_dump_filename.find_last_of("/") != std::string::npos)
{
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of("/") + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of("/"));
d_dump_filename = dump_filename_;
}
else
{
dump_path = std::string(".");
}
if (d_dump_filename.empty())
{
d_dump_filename = "trk_channel_";
}
// remove extension if any
if (d_dump_filename.substr(1).find_last_of(".") != std::string::npos)
{
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of("."));
}
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
// create directory
if (!gnss_sdr_create_directory(dump_path))
{
std::cerr << "GNSS-SDR cannot create dump files for the tracking block. Wrong permissions?" << std::endl;
d_dump = false;
}
}
}
@ -592,17 +629,9 @@ dll_pll_veml_tracking::~dll_pll_veml_tracking()
LOG(WARNING) << "Exception in destructor " << ex.what();
}
}
if (trk_parameters.dump)
if (d_dump_mat)
{
if (d_channel == 0)
{
std::cout << "Writing .mat files ...";
}
save_matfile();
if (d_channel == 0)
{
std::cout << " done." << std::endl;
}
}
try
{
@ -928,7 +957,7 @@ void dll_pll_veml_tracking::save_correlation_results()
void dll_pll_veml_tracking::log_data(bool integrating)
{
if (trk_parameters.dump)
if (d_dump)
{
// Dump results to file
float prompt_I;
@ -1060,10 +1089,16 @@ int32_t dll_pll_veml_tracking::save_matfile()
int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
sizeof(float) * number_of_float_vars + sizeof(uint32_t);
std::ifstream dump_file;
std::string dump_filename_ = d_dump_filename;
// add channel number to the filename
dump_filename_.append(boost::lexical_cast<std::string>(d_channel));
// add extension
dump_filename_.append(".dat");
std::cout << "Generating .mat file for " << dump_filename_ << std::endl;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try
{
dump_file.open(trk_parameters.dump_filename.c_str(), std::ios::binary | std::ios::ate);
dump_file.open(dump_filename_.c_str(), std::ios::binary | std::ios::ate);
}
catch (const std::ifstream::failure &e)
{
@ -1168,7 +1203,7 @@ int32_t dll_pll_veml_tracking::save_matfile()
// WRITE MAT FILE
mat_t *matfp;
matvar_t *matvar;
std::string filename = trk_parameters.dump_filename;
std::string filename = dump_filename_;
filename.erase(filename.length() - 4, 4);
filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
@ -1296,17 +1331,23 @@ void dll_pll_veml_tracking::set_channel(uint32_t channel)
d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel;
// ############# ENABLE DATA FILE LOG #################
if (trk_parameters.dump)
if (d_dump)
{
std::string dump_filename_ = d_dump_filename;
// add channel number to the filename
dump_filename_.append(boost::lexical_cast<std::string>(d_channel));
// add extension
dump_filename_.append(".dat");
if (!d_dump_file.is_open())
{
try
{
trk_parameters.dump_filename.append(boost::lexical_cast<std::string>(d_channel));
trk_parameters.dump_filename.append(".dat");
//trk_parameters.dump_filename.append(boost::lexical_cast<std::string>(d_channel));
//trk_parameters.dump_filename.append(".dat");
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
d_dump_file.open(trk_parameters.dump_filename.c_str(), std::ios::out | std::ios::binary);
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << trk_parameters.dump_filename.c_str();
d_dump_file.open(dump_filename_.c_str(), std::ios::out | std::ios::binary);
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << dump_filename_.c_str();
}
catch (const std::ifstream::failure &e)
{

View File

@ -196,6 +196,9 @@ private:
// file dump
std::ofstream d_dump_file;
std::string d_dump_filename;
bool d_dump;
bool d_dump_mat;
};
#endif // GNSS_SDR_DLL_PLL_VEML_TRACKING_H

View File

@ -47,6 +47,7 @@
#include "gps_l2c_signal.h"
#include "GPS_L5.h"
#include "gps_l5_signal.h"
#include "gnss_sdr_create_directory.h"
#include <boost/lexical_cast.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
@ -420,6 +421,42 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
multicorrelator_fpga->set_output_vectors(d_correlator_outs, d_Prompt_Data);
d_pull_in = 0;
d_dump = trk_parameters.dump;
d_dump_mat = trk_parameters.dump_mat and d_dump;
if (d_dump)
{
d_dump_filename = trk_parameters.dump_filename;
std::string dump_path;
if (d_dump_filename.find_last_of("/") != std::string::npos)
{
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of("/") + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of("/"));
d_dump_filename = dump_filename_;
}
else
{
dump_path = std::string(".");
}
if (d_dump_filename.empty())
{
d_dump_filename = "trk_channel_";
}
// remove extension if any
if (d_dump_filename.substr(1).find_last_of(".") != std::string::npos)
{
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of("."));
}
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
// create directory
if (!gnss_sdr_create_directory(dump_path))
{
std::cerr << "GNSS-SDR cannot create dump files for the tracking block. Wrong permissions?" << std::endl;
d_dump = false;
};
}
}
@ -583,17 +620,9 @@ dll_pll_veml_tracking_fpga::~dll_pll_veml_tracking_fpga()
LOG(WARNING) << "Exception in destructor " << ex.what();
}
}
if (trk_parameters.dump)
if (d_dump_mat)
{
if (d_channel == 0)
{
std::cout << "Writing .mat files ...";
}
save_matfile();
if (d_channel == 0)
{
std::cout << " done." << std::endl;
}
}
try
{
@ -842,7 +871,7 @@ void dll_pll_veml_tracking_fpga::save_correlation_results()
void dll_pll_veml_tracking_fpga::log_data(bool integrating)
{
if (trk_parameters.dump)
if (d_dump)
{
// Dump results to file
float prompt_I;
@ -968,10 +997,16 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile()
int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
sizeof(float) * number_of_float_vars + sizeof(uint32_t);
std::ifstream dump_file;
std::string dump_filename_ = d_dump_filename;
// add channel number to the filename
dump_filename_.append(boost::lexical_cast<std::string>(d_channel));
// add extension
dump_filename_.append(".dat");
std::cout << "Generating .mat file for " << dump_filename_ << std::endl;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try
{
dump_file.open(trk_parameters.dump_filename.c_str(), std::ios::binary | std::ios::ate);
dump_file.open(dump_filename_.c_str(), std::ios::binary | std::ios::ate);
}
catch (const std::ifstream::failure &e)
{
@ -1070,7 +1105,7 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile()
// WRITE MAT FILE
mat_t *matfp;
matvar_t *matvar;
std::string filename = trk_parameters.dump_filename;
std::string filename = dump_filename_;
filename.erase(filename.length() - 4, 4);
filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
@ -1188,17 +1223,21 @@ void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel)
multicorrelator_fpga->set_channel(d_channel);
LOG(INFO) << "Tracking Channel set to " << d_channel;
// ############# ENABLE DATA FILE LOG #################
if (trk_parameters.dump)
if (d_dump)
{
std::string dump_filename_ = d_dump_filename;
// add channel number to the filename
dump_filename_.append(boost::lexical_cast<std::string>(d_channel));
// add extension
dump_filename_.append(".dat");
if (!d_dump_file.is_open())
{
try
{
trk_parameters.dump_filename.append(boost::lexical_cast<std::string>(d_channel));
trk_parameters.dump_filename.append(".dat");
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
d_dump_file.open(trk_parameters.dump_filename.c_str(), std::ios::out | std::ios::binary);
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << trk_parameters.dump_filename.c_str();
d_dump_file.open(dump_filename_.c_str(), std::ios::out | std::ios::binary);
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << dump_filename_.c_str();
}
catch (const std::ifstream::failure &e)
{

View File

@ -195,6 +195,9 @@ private:
// file dump
std::ofstream d_dump_file;
std::string d_dump_filename;
bool d_dump;
bool d_dump_mat;
// extra
int32_t d_correlation_length_samples;

View File

@ -1,5 +1,5 @@
/*!
* \file glonass_l1_ca_dll_pll_c_aid_tracking_cc.h
* \file glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc
* \brief Implementation of a code DLL + carrier PLL tracking block
* \author Gabriel Araujo, 2017. gabriel.araujo.5000(at)gmail.com
* \author Luis Esteve, 2017. luis(at)epsilon-formacion.com

View File

@ -1,5 +1,5 @@
/*!
* \file glonass_l2_ca_dll_pll_c_aid_tracking_cc.h
* \file glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc
* \brief Implementation of a code DLL + carrier PLL tracking block
* \author Damian Miralles, 2018. dmiralles2009(at)gmail.com
*

View File

@ -1,5 +1,5 @@
/*!
* \file gps_l1_ca_kf_tracking_cc.cc
* \file gps_l1_ca_kf_tracking_cc.h
* \brief Interface of a processing block of a DLL + Kalman carrier
* tracking loop for GPS L1 C/A signals
* \author Javier Arribas, 2018. jarribas(at)cttc.es

View File

@ -41,7 +41,8 @@ Dll_Pll_Conf::Dll_Pll_Conf()
fs_in = 0.0;
vector_length = 0U;
dump = false;
dump_filename = "./dll_pll_dump.dat";
dump_mat = true;
dump_filename = std::string("./dll_pll_dump.dat");
pll_pull_in_bw_hz = 50.0;
dll_pull_in_bw_hz = 3.0;
pll_bw_hz = 35.0;

View File

@ -38,12 +38,12 @@
class Dll_Pll_Conf
{
private:
public:
/* DLL/PLL tracking configuration */
double fs_in;
uint32_t vector_length;
bool dump;
bool dump_mat;
std::string dump_filename;
float pll_pull_in_bw_hz;
float dll_pull_in_bw_hz;

View File

@ -35,35 +35,12 @@
Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga()
{
// /* DLL/PLL tracking configuration */
// fs_in = 0.0;
// vector_length = 0;
// dump = false;
// dump_filename = "./dll_pll_dump.dat";
// pll_bw_hz = 40.0;
// dll_bw_hz = 2.0;
// pll_bw_narrow_hz = 5.0;
// dll_bw_narrow_hz = 0.75;
// early_late_space_chips = 0.5;
// very_early_late_space_chips = 0.5;
// early_late_space_narrow_chips = 0.1;
// very_early_late_space_narrow_chips = 0.1;
// extend_correlation_symbols = 5;
// cn0_samples = 20;
// carrier_lock_det_mav_samples = 20;
// cn0_min = 25;
// max_lock_fail = 50;
// carrier_lock_th = 0.85;
// track_pilot = false;
// system = 'G';
// char sig_[3] = "1C";
// std::memcpy(signal, sig_, 3);
/* DLL/PLL tracking configuration */
fs_in = 0.0;
vector_length = 0U;
dump = false;
dump_filename = "./dll_pll_dump.dat";
dump_mat = true;
dump_filename = std::string("./dll_pll_dump.dat");
pll_bw_hz = 40.0;
dll_bw_hz = 2.0;
pll_bw_narrow_hz = 5.0;
@ -86,6 +63,6 @@ Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga()
multicorr_type = 0U;
code_length_chips = 0U;
code_samples_per_chip = 0U;
//int32_t* ca_codes;
//int32_t* data_codes;
ca_codes = nullptr;
data_codes = nullptr;
}

View File

@ -38,35 +38,12 @@
class Dll_Pll_Conf_Fpga
{
private:
public:
// /* DLL/PLL tracking configuration */
// double fs_in;
// uint32_t vector_length;
// bool dump;
// std::string dump_filename;
// float pll_bw_hz;
// float dll_bw_hz;
// float pll_bw_narrow_hz;
// float dll_bw_narrow_hz;
// float early_late_space_chips;
// float very_early_late_space_chips;
// float early_late_space_narrow_chips;
// float very_early_late_space_narrow_chips;
// int32_t extend_correlation_symbols;
// int32_t cn0_samples;
// int32_t carrier_lock_det_mav_samples;
// int32_t cn0_min;
// int32_t max_lock_fail;
// double carrier_lock_th;
// bool track_pilot;
// char system;
// char signal[3];
/* DLL/PLL tracking configuration */
double fs_in;
uint32_t vector_length;
bool dump;
bool dump_mat;
std::string dump_filename;
float pll_bw_hz;
float dll_bw_hz;