mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-18 21:23:02 +00:00
Merge branch 'tlm-dump' into next
This commit is contained in:
commit
94337c159f
@ -85,6 +85,10 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc
|
|||||||
Make use of MathJax for equation rendering. Added new building option
|
Make use of MathJax for equation rendering. Added new building option
|
||||||
`ENABLE_EXTERNAL_MATHJAX`, set to `ON` by default. If set to `OFF`, it allows
|
`ENABLE_EXTERNAL_MATHJAX`, set to `ON` by default. If set to `OFF`, it allows
|
||||||
using a local installation of MathJax 2.
|
using a local installation of MathJax 2.
|
||||||
|
- Improved dumps in Telemetry Decoding blocks. Now they include the raw
|
||||||
|
navigation message bits. If `TelemetryDecoder_XX.dump=true`, the resulting
|
||||||
|
`.dat` binary file is also delivered in `.mat` format, which is readable from
|
||||||
|
Matlab and Python.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ target_link_libraries(telemetry_decoder_gr_blocks
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
Gflags::gflags
|
Gflags::gflags
|
||||||
Glog::glog
|
Glog::glog
|
||||||
|
Matio::matio
|
||||||
)
|
)
|
||||||
|
|
||||||
if(GNURADIO_USES_STD_POINTERS)
|
if(GNURADIO_USES_STD_POINTERS)
|
||||||
|
@ -29,12 +29,14 @@
|
|||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <matio.h> // for Mat_VarCreate
|
||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <cstdlib> // for abs
|
#include <cstdlib> // for abs
|
||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define CRC_ERROR_LIMIT 8
|
#define CRC_ERROR_LIMIT 8
|
||||||
|
|
||||||
@ -115,6 +117,118 @@ beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs()
|
|||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
save_matfile();
|
||||||
|
}
|
||||||
|
catch (const std::exception &ex)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error saving the .mat file: " << ex.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t beidou_b1i_telemetry_decoder_gs::save_matfile() const
|
||||||
|
{
|
||||||
|
std::ifstream::pos_type size;
|
||||||
|
const int32_t number_of_double_vars = 2;
|
||||||
|
const int32_t number_of_int_vars = 2;
|
||||||
|
const int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
|
||||||
|
sizeof(int32_t) * number_of_int_vars;
|
||||||
|
std::ifstream dump_file;
|
||||||
|
std::string dump_filename_ = d_dump_filename;
|
||||||
|
|
||||||
|
std::cout << "Generating .mat file for " << dump_filename_ << '\n';
|
||||||
|
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dump_file.open(dump_filename_.c_str(), std::ios::binary | std::ios::ate);
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem opening dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// count number of epochs and rewind
|
||||||
|
int64_t num_epoch = 0;
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
size = dump_file.tellg();
|
||||||
|
num_epoch = static_cast<int64_t>(size) / static_cast<int64_t>(epoch_size_bytes);
|
||||||
|
if (num_epoch == 0LL)
|
||||||
|
{
|
||||||
|
// empty file, exit
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dump_file.seekg(0, std::ios::beg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto TOW_at_current_symbol_ms = std::vector<double>(num_epoch);
|
||||||
|
auto tracking_sample_counter = std::vector<uint64_t>(num_epoch);
|
||||||
|
auto TOW_at_Preamble_ms = std::vector<double>(num_epoch);
|
||||||
|
auto nav_symbol = std::vector<int32_t>(num_epoch);
|
||||||
|
auto prn = std::vector<int32_t>(num_epoch);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
for (int64_t i = 0; i < num_epoch; i++)
|
||||||
|
{
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&tracking_sample_counter[i]), sizeof(uint64_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_Preamble_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&nav_symbol[i]), sizeof(int32_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(int32_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_file.close();
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem reading dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WRITE MAT FILE
|
||||||
|
mat_t *matfp;
|
||||||
|
matvar_t *matvar;
|
||||||
|
std::string filename = dump_filename_;
|
||||||
|
filename.erase(filename.length() - 4, 4);
|
||||||
|
filename.append(".mat");
|
||||||
|
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
|
||||||
|
if (reinterpret_cast<int64_t *>(matfp) != nullptr)
|
||||||
|
{
|
||||||
|
std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
|
||||||
|
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_current_symbol_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("tracking_sample_counter", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), tracking_sample_counter.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("TOW_at_Preamble_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_Preamble_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("nav_symbol", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), nav_symbol.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("PRN", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), prn.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
}
|
||||||
|
Mat_Close(matfp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -585,12 +699,17 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
|||||||
{
|
{
|
||||||
double tmp_double;
|
double tmp_double;
|
||||||
uint64_t tmp_ulong_int;
|
uint64_t tmp_ulong_int;
|
||||||
|
int32_t tmp_int;
|
||||||
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
||||||
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
|
tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
|
tmp_int = static_cast<int32_t>(current_symbol.PRN);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
|
@ -74,6 +74,8 @@ private:
|
|||||||
|
|
||||||
beidou_b1i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
beidou_b1i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
|
int32_t save_matfile() const;
|
||||||
|
|
||||||
void decode_subframe(float *symbols);
|
void decode_subframe(float *symbols);
|
||||||
void decode_word(int32_t word_counter, const float *enc_word_symbols, int32_t *dec_word_symbols);
|
void decode_word(int32_t word_counter, const float *enc_word_symbols, int32_t *dec_word_symbols);
|
||||||
void decode_bch15_11_01(const int32_t *bits, std::array<int32_t, 15> &decbits);
|
void decode_bch15_11_01(const int32_t *bits, std::array<int32_t, 15> &decbits);
|
||||||
|
@ -28,12 +28,14 @@
|
|||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <matio.h> // for Mat_VarCreate
|
||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <cstdlib> // for abs
|
#include <cstdlib> // for abs
|
||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define CRC_ERROR_LIMIT 8
|
#define CRC_ERROR_LIMIT 8
|
||||||
|
|
||||||
@ -115,6 +117,118 @@ beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
|
|||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
save_matfile();
|
||||||
|
}
|
||||||
|
catch (const std::exception &ex)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error saving the .mat file: " << ex.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t beidou_b3i_telemetry_decoder_gs::save_matfile() const
|
||||||
|
{
|
||||||
|
std::ifstream::pos_type size;
|
||||||
|
const int32_t number_of_double_vars = 2;
|
||||||
|
const int32_t number_of_int_vars = 2;
|
||||||
|
const int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
|
||||||
|
sizeof(int32_t) * number_of_int_vars;
|
||||||
|
std::ifstream dump_file;
|
||||||
|
std::string dump_filename_ = d_dump_filename;
|
||||||
|
|
||||||
|
std::cout << "Generating .mat file for " << dump_filename_ << '\n';
|
||||||
|
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dump_file.open(dump_filename_.c_str(), std::ios::binary | std::ios::ate);
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem opening dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// count number of epochs and rewind
|
||||||
|
int64_t num_epoch = 0;
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
size = dump_file.tellg();
|
||||||
|
num_epoch = static_cast<int64_t>(size) / static_cast<int64_t>(epoch_size_bytes);
|
||||||
|
if (num_epoch == 0LL)
|
||||||
|
{
|
||||||
|
// empty file, exit
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dump_file.seekg(0, std::ios::beg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto TOW_at_current_symbol_ms = std::vector<double>(num_epoch);
|
||||||
|
auto tracking_sample_counter = std::vector<uint64_t>(num_epoch);
|
||||||
|
auto TOW_at_Preamble_ms = std::vector<double>(num_epoch);
|
||||||
|
auto nav_symbol = std::vector<int32_t>(num_epoch);
|
||||||
|
auto prn = std::vector<int32_t>(num_epoch);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
for (int64_t i = 0; i < num_epoch; i++)
|
||||||
|
{
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&tracking_sample_counter[i]), sizeof(uint64_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_Preamble_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&nav_symbol[i]), sizeof(int32_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(int32_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_file.close();
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem reading dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WRITE MAT FILE
|
||||||
|
mat_t *matfp;
|
||||||
|
matvar_t *matvar;
|
||||||
|
std::string filename = dump_filename_;
|
||||||
|
filename.erase(filename.length() - 4, 4);
|
||||||
|
filename.append(".mat");
|
||||||
|
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
|
||||||
|
if (reinterpret_cast<int64_t *>(matfp) != nullptr)
|
||||||
|
{
|
||||||
|
std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
|
||||||
|
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_current_symbol_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("tracking_sample_counter", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), tracking_sample_counter.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("TOW_at_Preamble_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_Preamble_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("nav_symbol", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), nav_symbol.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("PRN", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), prn.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
}
|
||||||
|
Mat_Close(matfp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -615,12 +729,17 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
|||||||
{
|
{
|
||||||
double tmp_double;
|
double tmp_double;
|
||||||
uint64_t tmp_ulong_int;
|
uint64_t tmp_ulong_int;
|
||||||
|
int32_t tmp_int;
|
||||||
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
||||||
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
|
tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
|
tmp_int = static_cast<int32_t>(current_symbol.PRN);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
|
@ -72,6 +72,8 @@ private:
|
|||||||
|
|
||||||
beidou_b3i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
beidou_b3i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
|
int32_t save_matfile() const;
|
||||||
|
|
||||||
void decode_subframe(float *symbols);
|
void decode_subframe(float *symbols);
|
||||||
void decode_word(int32_t word_counter, const float *enc_word_symbols,
|
void decode_word(int32_t word_counter, const float *enc_word_symbols,
|
||||||
int32_t *dec_word_symbols);
|
int32_t *dec_word_symbols);
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <matio.h> // for Mat_VarCreate
|
||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <cmath> // for fmod
|
#include <cmath> // for fmod
|
||||||
@ -224,6 +225,119 @@ galileo_telemetry_decoder_gs::~galileo_telemetry_decoder_gs()
|
|||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
save_matfile();
|
||||||
|
}
|
||||||
|
catch (const std::exception &ex)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error saving the .mat file: " << ex.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t galileo_telemetry_decoder_gs::save_matfile() const
|
||||||
|
{
|
||||||
|
std::ifstream::pos_type size;
|
||||||
|
const int32_t number_of_double_vars = 2;
|
||||||
|
const int32_t number_of_int_vars = 2;
|
||||||
|
const int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
|
||||||
|
sizeof(int32_t) * number_of_int_vars;
|
||||||
|
std::ifstream dump_file;
|
||||||
|
std::string dump_filename_ = d_dump_filename;
|
||||||
|
|
||||||
|
std::cout << "Generating .mat file for " << dump_filename_ << '\n';
|
||||||
|
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dump_file.open(dump_filename_.c_str(), std::ios::binary | std::ios::ate);
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem opening dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// count number of epochs and rewind
|
||||||
|
int64_t num_epoch = 0;
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
size = dump_file.tellg();
|
||||||
|
num_epoch = static_cast<int64_t>(size) / static_cast<int64_t>(epoch_size_bytes);
|
||||||
|
if (num_epoch == 0LL)
|
||||||
|
{
|
||||||
|
// empty file, exit
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dump_file.seekg(0, std::ios::beg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto TOW_at_current_symbol_ms = std::vector<double>(num_epoch);
|
||||||
|
auto tracking_sample_counter = std::vector<uint64_t>(num_epoch);
|
||||||
|
auto TOW_at_Preamble_ms = std::vector<double>(num_epoch);
|
||||||
|
auto nav_symbol = std::vector<int32_t>(num_epoch);
|
||||||
|
auto prn = std::vector<int32_t>(num_epoch);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
for (int64_t i = 0; i < num_epoch; i++)
|
||||||
|
{
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&tracking_sample_counter[i]), sizeof(uint64_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_Preamble_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&nav_symbol[i]), sizeof(int32_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(int32_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_file.close();
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem reading dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WRITE MAT FILE
|
||||||
|
mat_t *matfp;
|
||||||
|
matvar_t *matvar;
|
||||||
|
std::string filename = dump_filename_;
|
||||||
|
filename.erase(filename.length() - 4, 4);
|
||||||
|
filename.append(".mat");
|
||||||
|
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
|
||||||
|
if (reinterpret_cast<int64_t *>(matfp) != nullptr)
|
||||||
|
{
|
||||||
|
std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
|
||||||
|
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_current_symbol_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("tracking_sample_counter", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), tracking_sample_counter.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("TOW_at_Preamble_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_Preamble_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("nav_symbol", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), nav_symbol.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("PRN", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), prn.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
}
|
||||||
|
Mat_Close(matfp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -907,12 +1021,31 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
|||||||
{
|
{
|
||||||
double tmp_double;
|
double tmp_double;
|
||||||
uint64_t tmp_ulong_int;
|
uint64_t tmp_ulong_int;
|
||||||
|
int32_t tmp_int;
|
||||||
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
||||||
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
|
switch (d_frame_type)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
tmp_int = (current_symbol.Prompt_Q > 0.0 ? 1 : -1);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tmp_int = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
|
tmp_int = static_cast<int32_t>(current_symbol.PRN);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
|
@ -82,6 +82,8 @@ private:
|
|||||||
const int32_t d_nn = 2; // Coding rate 1/n
|
const int32_t d_nn = 2; // Coding rate 1/n
|
||||||
const int32_t d_KK = 7; // Constraint Length
|
const int32_t d_KK = 7; // Constraint Length
|
||||||
|
|
||||||
|
int32_t save_matfile() const;
|
||||||
|
|
||||||
void viterbi_decoder(float *page_part_symbols, int32_t *page_part_bits);
|
void viterbi_decoder(float *page_part_symbols, int32_t *page_part_bits);
|
||||||
void deinterleaver(int32_t rows, int32_t cols, const float *in, float *out);
|
void deinterleaver(int32_t rows, int32_t cols, const float *in, float *out);
|
||||||
void decode_INAV_word(float *page_part_symbols, int32_t frame_length);
|
void decode_INAV_word(float *page_part_symbols, int32_t frame_length);
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "glonass_gnav_utc_model.h"
|
#include "glonass_gnav_utc_model.h"
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <matio.h> // for Mat_VarCreate
|
||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <cmath> // for floor, round
|
#include <cmath> // for floor, round
|
||||||
@ -32,6 +33,7 @@
|
|||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define CRC_ERROR_LIMIT 6
|
#define CRC_ERROR_LIMIT 6
|
||||||
|
|
||||||
@ -108,6 +110,118 @@ glonass_l1_ca_telemetry_decoder_gs::~glonass_l1_ca_telemetry_decoder_gs()
|
|||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
save_matfile();
|
||||||
|
}
|
||||||
|
catch (const std::exception &ex)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error saving the .mat file: " << ex.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t glonass_l1_ca_telemetry_decoder_gs::save_matfile() const
|
||||||
|
{
|
||||||
|
std::ifstream::pos_type size;
|
||||||
|
const int32_t number_of_double_vars = 2;
|
||||||
|
const int32_t number_of_int_vars = 2;
|
||||||
|
const int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
|
||||||
|
sizeof(int32_t) * number_of_int_vars;
|
||||||
|
std::ifstream dump_file;
|
||||||
|
std::string dump_filename_ = d_dump_filename;
|
||||||
|
|
||||||
|
std::cout << "Generating .mat file for " << dump_filename_ << '\n';
|
||||||
|
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dump_file.open(dump_filename_.c_str(), std::ios::binary | std::ios::ate);
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem opening dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// count number of epochs and rewind
|
||||||
|
int64_t num_epoch = 0;
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
size = dump_file.tellg();
|
||||||
|
num_epoch = static_cast<int64_t>(size) / static_cast<int64_t>(epoch_size_bytes);
|
||||||
|
if (num_epoch == 0LL)
|
||||||
|
{
|
||||||
|
// empty file, exit
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dump_file.seekg(0, std::ios::beg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto TOW_at_current_symbol_ms = std::vector<double>(num_epoch);
|
||||||
|
auto tracking_sample_counter = std::vector<uint64_t>(num_epoch);
|
||||||
|
auto TOW_at_Preamble_ms = std::vector<double>(num_epoch);
|
||||||
|
auto nav_symbol = std::vector<int32_t>(num_epoch);
|
||||||
|
auto prn = std::vector<int32_t>(num_epoch);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
for (int64_t i = 0; i < num_epoch; i++)
|
||||||
|
{
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&tracking_sample_counter[i]), sizeof(uint64_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_Preamble_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&nav_symbol[i]), sizeof(int32_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(int32_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_file.close();
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem reading dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WRITE MAT FILE
|
||||||
|
mat_t *matfp;
|
||||||
|
matvar_t *matvar;
|
||||||
|
std::string filename = dump_filename_;
|
||||||
|
filename.erase(filename.length() - 4, 4);
|
||||||
|
filename.append(".mat");
|
||||||
|
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
|
||||||
|
if (reinterpret_cast<int64_t *>(matfp) != nullptr)
|
||||||
|
{
|
||||||
|
std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
|
||||||
|
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_current_symbol_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("tracking_sample_counter", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), tracking_sample_counter.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("TOW_at_Preamble_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_Preamble_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("nav_symbol", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), nav_symbol.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("PRN", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), prn.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
}
|
||||||
|
Mat_Close(matfp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -414,12 +528,17 @@ int glonass_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
|
|||||||
{
|
{
|
||||||
double tmp_double;
|
double tmp_double;
|
||||||
uint64_t tmp_ulong_int;
|
uint64_t tmp_ulong_int;
|
||||||
|
int32_t tmp_int;
|
||||||
tmp_double = d_TOW_at_current_symbol;
|
tmp_double = d_TOW_at_current_symbol;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
||||||
tmp_double = 0;
|
tmp_double = 0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
|
tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
|
tmp_int = static_cast<int32_t>(current_symbol.PRN);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
|
@ -82,6 +82,8 @@ private:
|
|||||||
|
|
||||||
const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
|
|
||||||
|
int32_t save_matfile() const;
|
||||||
|
|
||||||
void decode_string(const double *symbols, int32_t frame_length);
|
void decode_string(const double *symbols, int32_t frame_length);
|
||||||
|
|
||||||
// Help with coherent tracking
|
// Help with coherent tracking
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "glonass_gnav_utc_model.h"
|
#include "glonass_gnav_utc_model.h"
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <matio.h> // for Mat_VarCreate
|
||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <cmath> // for floor, round
|
#include <cmath> // for floor, round
|
||||||
@ -32,6 +33,7 @@
|
|||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define CRC_ERROR_LIMIT 6
|
#define CRC_ERROR_LIMIT 6
|
||||||
|
|
||||||
@ -108,6 +110,118 @@ glonass_l2_ca_telemetry_decoder_gs::~glonass_l2_ca_telemetry_decoder_gs()
|
|||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
save_matfile();
|
||||||
|
}
|
||||||
|
catch (const std::exception &ex)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error saving the .mat file: " << ex.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t glonass_l2_ca_telemetry_decoder_gs::save_matfile() const
|
||||||
|
{
|
||||||
|
std::ifstream::pos_type size;
|
||||||
|
const int32_t number_of_double_vars = 2;
|
||||||
|
const int32_t number_of_int_vars = 2;
|
||||||
|
const int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
|
||||||
|
sizeof(int32_t) * number_of_int_vars;
|
||||||
|
std::ifstream dump_file;
|
||||||
|
std::string dump_filename_ = d_dump_filename;
|
||||||
|
|
||||||
|
std::cout << "Generating .mat file for " << dump_filename_ << '\n';
|
||||||
|
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dump_file.open(dump_filename_.c_str(), std::ios::binary | std::ios::ate);
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem opening dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// count number of epochs and rewind
|
||||||
|
int64_t num_epoch = 0;
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
size = dump_file.tellg();
|
||||||
|
num_epoch = static_cast<int64_t>(size) / static_cast<int64_t>(epoch_size_bytes);
|
||||||
|
if (num_epoch == 0LL)
|
||||||
|
{
|
||||||
|
// empty file, exit
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dump_file.seekg(0, std::ios::beg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto TOW_at_current_symbol_ms = std::vector<double>(num_epoch);
|
||||||
|
auto tracking_sample_counter = std::vector<uint64_t>(num_epoch);
|
||||||
|
auto TOW_at_Preamble_ms = std::vector<double>(num_epoch);
|
||||||
|
auto nav_symbol = std::vector<int32_t>(num_epoch);
|
||||||
|
auto prn = std::vector<int32_t>(num_epoch);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
for (int64_t i = 0; i < num_epoch; i++)
|
||||||
|
{
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&tracking_sample_counter[i]), sizeof(uint64_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_Preamble_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&nav_symbol[i]), sizeof(int32_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(int32_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_file.close();
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem reading dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WRITE MAT FILE
|
||||||
|
mat_t *matfp;
|
||||||
|
matvar_t *matvar;
|
||||||
|
std::string filename = dump_filename_;
|
||||||
|
filename.erase(filename.length() - 4, 4);
|
||||||
|
filename.append(".mat");
|
||||||
|
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
|
||||||
|
if (reinterpret_cast<int64_t *>(matfp) != nullptr)
|
||||||
|
{
|
||||||
|
std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
|
||||||
|
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_current_symbol_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("tracking_sample_counter", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), tracking_sample_counter.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("TOW_at_Preamble_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_Preamble_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("nav_symbol", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), nav_symbol.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("PRN", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), prn.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
}
|
||||||
|
Mat_Close(matfp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -413,12 +527,17 @@ int glonass_l2_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
|
|||||||
{
|
{
|
||||||
double tmp_double;
|
double tmp_double;
|
||||||
uint64_t tmp_ulong_int;
|
uint64_t tmp_ulong_int;
|
||||||
|
int32_t tmp_int;
|
||||||
tmp_double = d_TOW_at_current_symbol;
|
tmp_double = d_TOW_at_current_symbol;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
||||||
tmp_double = 0;
|
tmp_double = 0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
|
tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
|
tmp_int = static_cast<int32_t>(current_symbol.PRN);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
|
@ -80,6 +80,8 @@ private:
|
|||||||
|
|
||||||
const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
|
|
||||||
|
int32_t save_matfile() const;
|
||||||
|
|
||||||
void decode_string(const double *symbols, int32_t frame_length);
|
void decode_string(const double *symbols, int32_t frame_length);
|
||||||
|
|
||||||
// Storage for incoming data
|
// Storage for incoming data
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "gps_utc_model.h" // for Gps_Utc_Model
|
#include "gps_utc_model.h" // for Gps_Utc_Model
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <matio.h> // for Mat_VarCreate
|
||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <cmath> // for round
|
#include <cmath> // for round
|
||||||
@ -31,6 +32,7 @@
|
|||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr
|
#include <memory> // for shared_ptr
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
#ifdef COMPILER_HAS_ROTL
|
#ifdef COMPILER_HAS_ROTL
|
||||||
@ -130,6 +132,118 @@ gps_l1_ca_telemetry_decoder_gs::~gps_l1_ca_telemetry_decoder_gs()
|
|||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
save_matfile();
|
||||||
|
}
|
||||||
|
catch (const std::exception &ex)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error saving the .mat file: " << ex.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t gps_l1_ca_telemetry_decoder_gs::save_matfile() const
|
||||||
|
{
|
||||||
|
std::ifstream::pos_type size;
|
||||||
|
const int32_t number_of_double_vars = 2;
|
||||||
|
const int32_t number_of_int_vars = 2;
|
||||||
|
const int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
|
||||||
|
sizeof(int32_t) * number_of_int_vars;
|
||||||
|
std::ifstream dump_file;
|
||||||
|
std::string dump_filename_ = d_dump_filename;
|
||||||
|
|
||||||
|
std::cout << "Generating .mat file for " << dump_filename_ << '\n';
|
||||||
|
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dump_file.open(dump_filename_.c_str(), std::ios::binary | std::ios::ate);
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem opening dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// count number of epochs and rewind
|
||||||
|
int64_t num_epoch = 0;
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
size = dump_file.tellg();
|
||||||
|
num_epoch = static_cast<int64_t>(size) / static_cast<int64_t>(epoch_size_bytes);
|
||||||
|
if (num_epoch == 0LL)
|
||||||
|
{
|
||||||
|
// empty file, exit
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dump_file.seekg(0, std::ios::beg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto TOW_at_current_symbol_ms = std::vector<double>(num_epoch);
|
||||||
|
auto tracking_sample_counter = std::vector<uint64_t>(num_epoch);
|
||||||
|
auto TOW_at_Preamble_ms = std::vector<double>(num_epoch);
|
||||||
|
auto nav_symbol = std::vector<int32_t>(num_epoch);
|
||||||
|
auto prn = std::vector<int32_t>(num_epoch);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
for (int64_t i = 0; i < num_epoch; i++)
|
||||||
|
{
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&tracking_sample_counter[i]), sizeof(uint64_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_Preamble_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&nav_symbol[i]), sizeof(int32_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(int32_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_file.close();
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem reading dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WRITE MAT FILE
|
||||||
|
mat_t *matfp;
|
||||||
|
matvar_t *matvar;
|
||||||
|
std::string filename = dump_filename_;
|
||||||
|
filename.erase(filename.length() - 4, 4);
|
||||||
|
filename.append(".mat");
|
||||||
|
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
|
||||||
|
if (reinterpret_cast<int64_t *>(matfp) != nullptr)
|
||||||
|
{
|
||||||
|
std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
|
||||||
|
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_current_symbol_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("tracking_sample_counter", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), tracking_sample_counter.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("TOW_at_Preamble_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_Preamble_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("nav_symbol", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), nav_symbol.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("PRN", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), prn.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
}
|
||||||
|
Mat_Close(matfp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -501,12 +615,17 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
|
|||||||
{
|
{
|
||||||
double tmp_double;
|
double tmp_double;
|
||||||
uint64_t tmp_ulong_int;
|
uint64_t tmp_ulong_int;
|
||||||
|
int32_t tmp_int;
|
||||||
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
||||||
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
|
tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
|
tmp_int = static_cast<int32_t>(current_symbol.PRN);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
|
@ -72,6 +72,8 @@ private:
|
|||||||
|
|
||||||
gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
|
int32_t save_matfile() const;
|
||||||
|
|
||||||
bool gps_word_parityCheck(uint32_t gpsword);
|
bool gps_word_parityCheck(uint32_t gpsword);
|
||||||
bool decode_subframe();
|
bool decode_subframe();
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model
|
#include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <matio.h> // for Mat_VarCreate
|
||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <bitset> // for bitset
|
#include <bitset> // for bitset
|
||||||
@ -34,6 +35,7 @@
|
|||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
gps_l2c_telemetry_decoder_gs_sptr
|
gps_l2c_telemetry_decoder_gs_sptr
|
||||||
@ -92,6 +94,118 @@ gps_l2c_telemetry_decoder_gs::~gps_l2c_telemetry_decoder_gs()
|
|||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
save_matfile();
|
||||||
|
}
|
||||||
|
catch (const std::exception &ex)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error saving the .mat file: " << ex.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t gps_l2c_telemetry_decoder_gs::save_matfile() const
|
||||||
|
{
|
||||||
|
std::ifstream::pos_type size;
|
||||||
|
const int32_t number_of_double_vars = 2;
|
||||||
|
const int32_t number_of_int_vars = 2;
|
||||||
|
const int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
|
||||||
|
sizeof(int32_t) * number_of_int_vars;
|
||||||
|
std::ifstream dump_file;
|
||||||
|
std::string dump_filename_ = d_dump_filename;
|
||||||
|
|
||||||
|
std::cout << "Generating .mat file for " << dump_filename_ << '\n';
|
||||||
|
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dump_file.open(dump_filename_.c_str(), std::ios::binary | std::ios::ate);
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem opening dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// count number of epochs and rewind
|
||||||
|
int64_t num_epoch = 0;
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
size = dump_file.tellg();
|
||||||
|
num_epoch = static_cast<int64_t>(size) / static_cast<int64_t>(epoch_size_bytes);
|
||||||
|
if (num_epoch == 0LL)
|
||||||
|
{
|
||||||
|
// empty file, exit
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dump_file.seekg(0, std::ios::beg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto TOW_at_current_symbol_ms = std::vector<double>(num_epoch);
|
||||||
|
auto tracking_sample_counter = std::vector<uint64_t>(num_epoch);
|
||||||
|
auto TOW_at_Preamble_ms = std::vector<double>(num_epoch);
|
||||||
|
auto nav_symbol = std::vector<int32_t>(num_epoch);
|
||||||
|
auto prn = std::vector<int32_t>(num_epoch);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
for (int64_t i = 0; i < num_epoch; i++)
|
||||||
|
{
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&tracking_sample_counter[i]), sizeof(uint64_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_Preamble_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&nav_symbol[i]), sizeof(int32_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(int32_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_file.close();
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem reading dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WRITE MAT FILE
|
||||||
|
mat_t *matfp;
|
||||||
|
matvar_t *matvar;
|
||||||
|
std::string filename = dump_filename_;
|
||||||
|
filename.erase(filename.length() - 4, 4);
|
||||||
|
filename.append(".mat");
|
||||||
|
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
|
||||||
|
if (reinterpret_cast<int64_t *>(matfp) != nullptr)
|
||||||
|
{
|
||||||
|
std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
|
||||||
|
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_current_symbol_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("tracking_sample_counter", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), tracking_sample_counter.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("TOW_at_Preamble_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_Preamble_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("nav_symbol", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), nav_symbol.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("PRN", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), prn.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
}
|
||||||
|
Mat_Close(matfp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -252,12 +366,17 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
|||||||
{
|
{
|
||||||
double tmp_double;
|
double tmp_double;
|
||||||
uint64_t tmp_ulong_int;
|
uint64_t tmp_ulong_int;
|
||||||
|
int32_t tmp_int;
|
||||||
tmp_double = d_TOW_at_current_symbol;
|
tmp_double = d_TOW_at_current_symbol;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
tmp_ulong_int = current_synchro_data.Tracking_sample_counter;
|
tmp_ulong_int = current_synchro_data.Tracking_sample_counter;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
||||||
tmp_double = d_TOW_at_Preamble;
|
tmp_double = d_TOW_at_Preamble;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
|
tmp_int = (current_synchro_data.Prompt_I > 0.0 ? 1 : -1);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
|
tmp_int = static_cast<int32_t>(current_synchro_data.PRN);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
|
@ -72,6 +72,8 @@ private:
|
|||||||
|
|
||||||
gps_l2c_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
gps_l2c_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
|
int32_t save_matfile() const;
|
||||||
|
|
||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
|
|
||||||
cnav_msg_decoder_t d_cnav_decoder{};
|
cnav_msg_decoder_t d_cnav_decoder{};
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model
|
#include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <matio.h> // for Mat_VarCreate
|
||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <bitset> // for std::bitset
|
#include <bitset> // for std::bitset
|
||||||
@ -33,6 +34,7 @@
|
|||||||
#include <exception> // for std::exception
|
#include <exception> // for std::exception
|
||||||
#include <iostream> // for std::cout
|
#include <iostream> // for std::cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
gps_l5_telemetry_decoder_gs_sptr
|
gps_l5_telemetry_decoder_gs_sptr
|
||||||
@ -87,6 +89,118 @@ gps_l5_telemetry_decoder_gs::~gps_l5_telemetry_decoder_gs()
|
|||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
save_matfile();
|
||||||
|
}
|
||||||
|
catch (const std::exception &ex)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error saving the .mat file: " << ex.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t gps_l5_telemetry_decoder_gs::save_matfile() const
|
||||||
|
{
|
||||||
|
std::ifstream::pos_type size;
|
||||||
|
const int32_t number_of_double_vars = 2;
|
||||||
|
const int32_t number_of_int_vars = 2;
|
||||||
|
const int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
|
||||||
|
sizeof(int32_t) * number_of_int_vars;
|
||||||
|
std::ifstream dump_file;
|
||||||
|
std::string dump_filename_ = d_dump_filename;
|
||||||
|
|
||||||
|
std::cout << "Generating .mat file for " << dump_filename_ << '\n';
|
||||||
|
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dump_file.open(dump_filename_.c_str(), std::ios::binary | std::ios::ate);
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem opening dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// count number of epochs and rewind
|
||||||
|
int64_t num_epoch = 0;
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
size = dump_file.tellg();
|
||||||
|
num_epoch = static_cast<int64_t>(size) / static_cast<int64_t>(epoch_size_bytes);
|
||||||
|
if (num_epoch == 0LL)
|
||||||
|
{
|
||||||
|
// empty file, exit
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dump_file.seekg(0, std::ios::beg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto TOW_at_current_symbol_ms = std::vector<double>(num_epoch);
|
||||||
|
auto tracking_sample_counter = std::vector<uint64_t>(num_epoch);
|
||||||
|
auto TOW_at_Preamble_ms = std::vector<double>(num_epoch);
|
||||||
|
auto nav_symbol = std::vector<int32_t>(num_epoch);
|
||||||
|
auto prn = std::vector<int32_t>(num_epoch);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dump_file.is_open())
|
||||||
|
{
|
||||||
|
for (int64_t i = 0; i < num_epoch; i++)
|
||||||
|
{
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&tracking_sample_counter[i]), sizeof(uint64_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&TOW_at_Preamble_ms[i]), sizeof(double));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&nav_symbol[i]), sizeof(int32_t));
|
||||||
|
dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(int32_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_file.close();
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Problem reading dump file:" << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WRITE MAT FILE
|
||||||
|
mat_t *matfp;
|
||||||
|
matvar_t *matvar;
|
||||||
|
std::string filename = dump_filename_;
|
||||||
|
filename.erase(filename.length() - 4, 4);
|
||||||
|
filename.append(".mat");
|
||||||
|
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
|
||||||
|
if (reinterpret_cast<int64_t *>(matfp) != nullptr)
|
||||||
|
{
|
||||||
|
std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
|
||||||
|
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_current_symbol_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("tracking_sample_counter", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), tracking_sample_counter.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("TOW_at_Preamble_ms", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_Preamble_ms.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("nav_symbol", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), nav_symbol.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
matvar = Mat_VarCreate("PRN", MAT_C_INT32, MAT_T_INT32, 2, dims.data(), prn.data(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
}
|
||||||
|
Mat_Close(matfp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -263,12 +377,17 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
|
|||||||
{
|
{
|
||||||
double tmp_double;
|
double tmp_double;
|
||||||
uint64_t tmp_ulong_int;
|
uint64_t tmp_ulong_int;
|
||||||
|
int32_t tmp_int;
|
||||||
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
tmp_ulong_int = current_synchro_data.Tracking_sample_counter;
|
tmp_ulong_int = current_synchro_data.Tracking_sample_counter;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
||||||
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
|
tmp_int = (current_synchro_data.Prompt_Q > 0.0 ? 1 : -1);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
|
tmp_int = static_cast<int32_t>(current_synchro_data.PRN);
|
||||||
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_int), sizeof(int32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
|
@ -71,6 +71,8 @@ private:
|
|||||||
|
|
||||||
gps_l5_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
gps_l5_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
|
int32_t save_matfile() const;
|
||||||
|
|
||||||
cnav_msg_decoder_t d_cnav_decoder{};
|
cnav_msg_decoder_t d_cnav_decoder{};
|
||||||
|
|
||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
|
@ -29,6 +29,8 @@ bool Tlm_Dump_Reader::read_binary_obs()
|
|||||||
d_dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&Tracking_sample_counter), sizeof(uint64_t));
|
d_dump_file.read(reinterpret_cast<char *>(&Tracking_sample_counter), sizeof(uint64_t));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&d_TOW_at_Preamble), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&d_TOW_at_Preamble), sizeof(double));
|
||||||
|
d_dump_file.read(reinterpret_cast<char *>(&nav_symbol), sizeof(int32_t));
|
||||||
|
d_dump_file.read(reinterpret_cast<char *>(&prn), sizeof(int32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
@ -53,8 +55,9 @@ bool Tlm_Dump_Reader::restart()
|
|||||||
int64_t Tlm_Dump_Reader::num_epochs()
|
int64_t Tlm_Dump_Reader::num_epochs()
|
||||||
{
|
{
|
||||||
std::ifstream::pos_type size;
|
std::ifstream::pos_type size;
|
||||||
int number_of_vars_in_epoch = 2;
|
int number_of_double_vars_in_epoch = 2;
|
||||||
int epoch_size_bytes = sizeof(double) * number_of_vars_in_epoch + sizeof(uint64_t);
|
int number_of_int_vars_in_epoch = 2;
|
||||||
|
int epoch_size_bytes = sizeof(double) * number_of_double_vars_in_epoch + sizeof(uint64_t) + sizeof(int32_t) * number_of_int_vars_in_epoch;
|
||||||
std::ifstream tmpfile(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
std::ifstream tmpfile(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||||
if (tmpfile.is_open())
|
if (tmpfile.is_open())
|
||||||
{
|
{
|
||||||
|
@ -38,6 +38,8 @@ public:
|
|||||||
double TOW_at_current_symbol;
|
double TOW_at_current_symbol;
|
||||||
uint64_t Tracking_sample_counter;
|
uint64_t Tracking_sample_counter;
|
||||||
double d_TOW_at_Preamble;
|
double d_TOW_at_Preamble;
|
||||||
|
int32_t nav_symbol;
|
||||||
|
int32_t prn;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
|
@ -21,9 +21,11 @@ function [telemetry] = gps_l1_ca_read_telemetry_dump (filename, count)
|
|||||||
%%
|
%%
|
||||||
|
|
||||||
m = nargchk (1,2,nargin);
|
m = nargchk (1,2,nargin);
|
||||||
num_double_vars=4;
|
num_double_vars=3;
|
||||||
double_size_bytes=8;
|
double_size_bytes=8;
|
||||||
skip_bytes_each_read=double_size_bytes*num_double_vars;
|
num_int_vars=2;
|
||||||
|
int_size_bytes=4;
|
||||||
|
skip_bytes_each_read=double_size_bytes*num_double_vars+num_int_vars*int_size_bytes;
|
||||||
bytes_shift=0;
|
bytes_shift=0;
|
||||||
if (m)
|
if (m)
|
||||||
usage (m);
|
usage (m);
|
||||||
@ -32,34 +34,27 @@ end
|
|||||||
if (nargin < 3)
|
if (nargin < 3)
|
||||||
count = Inf;
|
count = Inf;
|
||||||
end
|
end
|
||||||
%loops_counter = fread (f, count, 'uint32',4*12);
|
|
||||||
f = fopen (filename, 'rb');
|
f = fopen (filename, 'rb');
|
||||||
if (f < 0)
|
if (f < 0)
|
||||||
else
|
else
|
||||||
telemetry.tow_current_symbol_ms = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
[x, loops_counter] = fread (f,skip_bytes_each_read);
|
||||||
bytes_shift=bytes_shift+double_size_bytes;
|
fseek(f,0,-1);
|
||||||
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
for i=1:min(count, loops_counter),
|
||||||
telemetry.tracking_sample_counter = fread (f, count, 'uint64',skip_bytes_each_read-double_size_bytes);
|
telemetry(i).tow_current_symbol_ms = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||||
bytes_shift=bytes_shift+double_size_bytes;
|
bytes_shift=bytes_shift+double_size_bytes;
|
||||||
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
||||||
telemetry.tow = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
telemetry(i).tracking_sample_counter = fread (f, count, 'uint64',skip_bytes_each_read-double_size_bytes);
|
||||||
bytes_shift=bytes_shift+double_size_bytes;
|
bytes_shift=bytes_shift+double_size_bytes;
|
||||||
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
||||||
telemetry.required_symbols = fread (f, count, 'uint64',skip_bytes_each_read-double_size_bytes);
|
telemetry(i).tow = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||||
bytes_shift=bytes_shift+double_size_bytes;
|
bytes_shift=bytes_shift+double_size_bytes;
|
||||||
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
||||||
|
telemetry(i).nav_simbols = fread (f, count, 'int32',skip_bytes_each_read-int_size_bytes);
|
||||||
|
bytes_shift=bytes_shift+int_size_bytes;
|
||||||
|
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
||||||
|
telemetry(i).prn = fread (f, count, 'int32',skip_bytes_each_read-int_size_bytes);
|
||||||
|
bytes_shift=bytes_shift+int_size_bytes;
|
||||||
|
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
||||||
|
end
|
||||||
fclose (f);
|
fclose (f);
|
||||||
|
|
||||||
%%%%%%%% output vars %%%%%%%%
|
|
||||||
% {
|
|
||||||
% double tmp_double;
|
|
||||||
% tmp_double = current_synchro_data.Preamble_delay_ms;
|
|
||||||
% d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
% tmp_double = current_synchro_data.Prn_delay_ms;
|
|
||||||
% d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
% tmp_double = current_synchro_data.Preamble_symbol_counter;
|
|
||||||
% d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
% }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user