mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-11-24 16:17:22 +00:00
Write the accumulated carrier phase as double in tracking dumps
log_data() in dll_pll_veml_tracking and dll_pll_veml_tracking_fpga casts d_acc_carrier_phase_rad, a double, to float before writing it to the binary dump, and save_matfile() reads it back as a float. The accumulated phase grows by 2*pi times the Doppler shift every second (about 31400 rad/s at 5 kHz), so it reaches 1e6 rad after about 30 s of tracking at 5 kHz, or under 3 minutes at 1 kHz. The float spacing is 0.0625 rad at 1e6 rad, 0.25 rad at 3e6 rad and 1 rad at 1e7 rad. At 3e6 rad, for instance, the phase difference between two 1 ms epochs of the dump is only known to within +/-0.25 rad, about 40 Hz in frequency terms. The phase used by the receiver (Gnss_Synchro::Carrier_phase_rads) is a double and is not affected; only the dump is. Write the field as a double, and read it back as a double in save_matfile(), so that the .mat file also holds a double. This changes the dump record layout. The field keeps its position but grows from 4 to 8 bytes, so a record is now 112 bytes long in dll_pll_veml_tracking (it was 108) and 100 bytes long in dll_pll_veml_tracking_fpga (it was 96). The readers of this format are updated accordingly: Tracking_Dump_Reader, used by the unit tests, and dll_pll_veml_read_tracking_dump in utils/matlab and utils/python. Signed-off-by: ObvMamut <obvmamut@proton.me>
This commit is contained in:
6 files changed
+26
-26
No files matched your search
@@ -1909,9 +1909,9 @@ void dll_pll_veml_tracking::log_data()
|
||||
// PRN start sample stamp
|
||||
tmp_long_int = this->nitems_read(0) + static_cast<uint64_t>(d_current_prn_length_samples);
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_long_int), sizeof(uint64_t));
|
||||
// accumulated carrier phase
|
||||
tmp_float = static_cast<float>(d_acc_carrier_phase_rad);
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
// accumulated carrier phase (double, since it grows without bound)
|
||||
tmp_double = d_acc_carrier_phase_rad;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
// carrier and code frequency
|
||||
tmp_float = static_cast<float>(d_carrier_doppler_hz);
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
@@ -1965,8 +1965,8 @@ int32_t dll_pll_veml_tracking::save_matfile() const
|
||||
{
|
||||
// READ DUMP FILE
|
||||
std::ifstream::pos_type size;
|
||||
const int32_t number_of_double_vars = 1;
|
||||
const int32_t number_of_float_vars = 19;
|
||||
const int32_t number_of_double_vars = 2;
|
||||
const int32_t number_of_float_vars = 18;
|
||||
const int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(uint32_t) +
|
||||
sizeof(uint64_t) + sizeof(int32_t);
|
||||
@@ -2007,7 +2007,7 @@ int32_t dll_pll_veml_tracking::save_matfile() const
|
||||
auto Prompt_I = std::vector<float>(num_epoch);
|
||||
auto Prompt_Q = std::vector<float>(num_epoch);
|
||||
auto PRN_start_sample_count = std::vector<uint64_t>(num_epoch);
|
||||
auto acc_carrier_phase_rad = std::vector<float>(num_epoch);
|
||||
auto acc_carrier_phase_rad = std::vector<double>(num_epoch);
|
||||
auto carrier_doppler_hz = std::vector<float>(num_epoch);
|
||||
auto carrier_doppler_rate_hz = std::vector<float>(num_epoch);
|
||||
auto code_freq_chips = std::vector<float>(num_epoch);
|
||||
@@ -2037,7 +2037,7 @@ int32_t dll_pll_veml_tracking::save_matfile() const
|
||||
dump_file.read(reinterpret_cast<char *>(&Prompt_I[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&Prompt_Q[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&PRN_start_sample_count[i]), sizeof(uint64_t));
|
||||
dump_file.read(reinterpret_cast<char *>(&acc_carrier_phase_rad[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&acc_carrier_phase_rad[i]), sizeof(double));
|
||||
dump_file.read(reinterpret_cast<char *>(&carrier_doppler_hz[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&carrier_doppler_rate_hz[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&code_freq_chips[i]), sizeof(float));
|
||||
@@ -2080,7 +2080,7 @@ int32_t dll_pll_veml_tracking::save_matfile() const
|
||||
write_matlab_var<2, float>("Prompt_I", Prompt_I.data(), matfp, dims);
|
||||
write_matlab_var<2, float>("Prompt_Q", Prompt_Q.data(), matfp, dims);
|
||||
write_matlab_var<2, uint64_t>("PRN_start_sample_count", PRN_start_sample_count.data(), matfp, dims);
|
||||
write_matlab_var<2, float>("acc_carrier_phase_rad", acc_carrier_phase_rad.data(), matfp, dims);
|
||||
write_matlab_var<2, double>("acc_carrier_phase_rad", acc_carrier_phase_rad.data(), matfp, dims);
|
||||
write_matlab_var<2, float>("carrier_doppler_hz", carrier_doppler_hz.data(), matfp, dims);
|
||||
write_matlab_var<2, float>("carrier_doppler_rate_hz", carrier_doppler_rate_hz.data(), matfp, dims);
|
||||
write_matlab_var<2, float>("code_freq_chips", code_freq_chips.data(), matfp, dims);
|
||||
|
||||
@@ -1135,9 +1135,9 @@ void dll_pll_veml_tracking_fpga::log_data()
|
||||
// PRN start sample stamp
|
||||
tmp_long_int = d_sample_counter_next;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_long_int), sizeof(uint64_t));
|
||||
// accumulated carrier phase
|
||||
tmp_float = static_cast<float>(d_acc_carrier_phase_rad);
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
// accumulated carrier phase (double, since it grows without bound)
|
||||
tmp_double = d_acc_carrier_phase_rad;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
// carrier and code frequency
|
||||
tmp_float = static_cast<float>(d_carrier_doppler_hz);
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
@@ -1185,8 +1185,8 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() const
|
||||
{
|
||||
// READ DUMP FILE
|
||||
std::ifstream::pos_type size;
|
||||
const int32_t number_of_double_vars = 1;
|
||||
const int32_t number_of_float_vars = 19;
|
||||
const int32_t number_of_double_vars = 2;
|
||||
const int32_t number_of_float_vars = 18;
|
||||
const 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;
|
||||
@@ -1226,7 +1226,7 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() const
|
||||
auto Prompt_I = std::vector<float>(num_epoch);
|
||||
auto Prompt_Q = std::vector<float>(num_epoch);
|
||||
auto PRN_start_sample_count = std::vector<uint64_t>(num_epoch);
|
||||
auto acc_carrier_phase_rad = std::vector<float>(num_epoch);
|
||||
auto acc_carrier_phase_rad = std::vector<double>(num_epoch);
|
||||
auto carrier_doppler_hz = std::vector<float>(num_epoch);
|
||||
auto carrier_doppler_rate_hz = std::vector<float>(num_epoch);
|
||||
auto code_freq_chips = std::vector<float>(num_epoch);
|
||||
@@ -1254,7 +1254,7 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() const
|
||||
dump_file.read(reinterpret_cast<char *>(&Prompt_I[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&Prompt_Q[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&PRN_start_sample_count[i]), sizeof(uint64_t));
|
||||
dump_file.read(reinterpret_cast<char *>(&acc_carrier_phase_rad[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&acc_carrier_phase_rad[i]), sizeof(double));
|
||||
dump_file.read(reinterpret_cast<char *>(&carrier_doppler_hz[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&carrier_doppler_rate_hz[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&code_freq_chips[i]), sizeof(float));
|
||||
@@ -1295,7 +1295,7 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() const
|
||||
write_matlab_var<2, float>("Prompt_I", Prompt_I.data(), matfp, dims);
|
||||
write_matlab_var<2, float>("Prompt_Q", Prompt_Q.data(), matfp, dims);
|
||||
write_matlab_var<2, uint64_t>("PRN_start_sample_count", PRN_start_sample_count.data(), matfp, dims);
|
||||
write_matlab_var<2, float>("acc_carrier_phase_rad", acc_carrier_phase_rad.data(), matfp, dims);
|
||||
write_matlab_var<2, double>("acc_carrier_phase_rad", acc_carrier_phase_rad.data(), matfp, dims);
|
||||
write_matlab_var<2, float>("carrier_doppler_hz", carrier_doppler_hz.data(), matfp, dims);
|
||||
write_matlab_var<2, float>("carrier_doppler_rate_hz", carrier_doppler_rate_hz.data(), matfp, dims);
|
||||
write_matlab_var<2, float>("code_freq_chips", code_freq_chips.data(), matfp, dims);
|
||||
|
||||
Reference in new issue
Block a user