diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4bebde1b9..ec38046f0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -381,6 +381,12 @@ All notable changes to GNSS-SDR will be documented in this file. acquired, instead of moving by half a cycle to the polarity of the pilot, and the half-cycle ambiguity is left to the telemetry decoder, as for signals without a pilot. The parameter is ignored for BeiDou B1C. +- A new tracking parameter `Tracking_XX.dump_every_code_period` (default + `false`) makes the tracking dump (`Tracking_XX.dump=true`) keep one record per + code period once the channel has reached symbol synchronization, instead of + one record per symbol. This stores the prompt correlator output of the code + periods inside a symbol (for instance, each of the 20 periods of a GPS L1 C/A + bit). The record layout does not change. See the definitions of concepts and metrics at https://gnss-sdr.org/design-forces/ diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index f2c34b07a..cd267ced0 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -2865,9 +2865,13 @@ int dll_pll_veml_tracking::process_input(int noutput_items __attribute__((unused do_correlation_step(in); save_correlation_results(); update_tracking_vars(); - if (d_current_data_symbol == 0) + // dump_every_code_period also logs the code periods inside a symbol + if (d_current_data_symbol == 0 || d_trk_parameters.dump_every_code_period) { log_data(); + } + if (d_current_data_symbol == 0) + { // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; @@ -2907,10 +2911,14 @@ int dll_pll_veml_tracking::process_input(int noutput_items __attribute__((unused run_dll_pll(); update_tracking_vars(); check_carrier_phase_coherent_initialization(); + // enable write dump file this cycle (valid DLL/PLL cycle); + // dump_every_code_period also logs the code periods inside a symbol + if (d_current_data_symbol == 0 || d_trk_parameters.dump_every_code_period) + { + log_data(); + } if (d_current_data_symbol == 0) { - // enable write dump file this cycle (valid DLL/PLL cycle) - log_data(); // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index da36bb97b..018036430 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -1854,9 +1854,13 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un save_correlation_results(); update_tracking_vars(); - if (d_current_data_symbol == 0) + // dump_every_code_period also logs the correlations inside a symbol + if (d_current_data_symbol == 0 || d_trk_parameters.dump_every_code_period) { log_data(); + } + if (d_current_data_symbol == 0) + { // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; @@ -1909,10 +1913,14 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un run_dll_pll(); update_tracking_vars(); check_carrier_phase_coherent_initialization(); + // enable write dump file this cycle (valid DLL/PLL cycle); + // dump_every_code_period also logs the correlations inside a symbol + if (d_current_data_symbol == 0 || d_trk_parameters.dump_every_code_period) + { + log_data(); + } if (d_current_data_symbol == 0) { - // enable write dump file this cycle (valid DLL/PLL cycle) - log_data(); // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; @@ -1967,9 +1975,13 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un save_correlation_results(); update_tracking_vars(); - if (d_current_data_symbol == 0) + // dump_every_code_period also logs the correlations inside a symbol + if (d_current_data_symbol == 0 || d_trk_parameters.dump_every_code_period) { log_data(); + } + if (d_current_data_symbol == 0) + { // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; @@ -2032,10 +2044,14 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un update_tracking_vars(); check_carrier_phase_coherent_initialization(); + // enable write dump file this cycle (valid DLL/PLL cycle); + // dump_every_code_period also logs the correlations inside a symbol + if (d_current_data_symbol == 0 || d_trk_parameters.dump_every_code_period) + { + log_data(); + } if (d_current_data_symbol == 0) { - // enable write dump file this cycle (valid DLL/PLL cycle) - log_data(); // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; diff --git a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc index 2989cd8f3..6a148fc83 100644 --- a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc @@ -2016,9 +2016,13 @@ int kf_tracking::process_input(int noutput_items __attribute__((unused)), gr_vec save_correlation_results(); // run_Kf(); update_tracking_vars(); // ? - if (d_current_data_symbol == 0) + // dump_every_code_period also logs the code periods inside a symbol + if (d_current_data_symbol == 0 || d_trk_parameters.dump_every_code_period) { log_data(); + } + if (d_current_data_symbol == 0) + { // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; @@ -2066,10 +2070,14 @@ int kf_tracking::process_input(int noutput_items __attribute__((unused)), gr_vec run_Kf(); update_tracking_vars(); check_carrier_phase_coherent_initialization(); + // enable write dump file this cycle (valid DLL/PLL cycle); + // dump_every_code_period also logs the code periods inside a symbol + if (d_current_data_symbol == 0 || d_trk_parameters.dump_every_code_period) + { + log_data(); + } if (d_current_data_symbol == 0) { - // enable write dump file this cycle (valid DLL/PLL cycle) - log_data(); // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; diff --git a/src/algorithms/tracking/libs/dll_pll_conf.cc b/src/algorithms/tracking/libs/dll_pll_conf.cc index 924ea538c..132ff76c6 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf.cc +++ b/src/algorithms/tracking/libs/dll_pll_conf.cc @@ -63,6 +63,7 @@ void Dll_Pll_Conf::SetFromConfiguration(const ConfigurationInterface *configurat f_error_dump = configuration->property(role + ".f_error_dump", f_error_dump); f_error_dump_filename = configuration->property(role + ".f_error_dump_filename", f_error_dump_filename); dump_mat = configuration->property(role + ".dump_mat", dump_mat); + dump_every_code_period = configuration->property(role + ".dump_every_code_period", dump_every_code_period); keep_phase_at_secondary_lock = configuration->property(role + ".keep_phase_at_secondary_lock", keep_phase_at_secondary_lock); pll_bw_hz = configuration->property(role + ".pll_bw_hz", pll_bw_hz); #if USE_GLOG_AND_GFLAGS diff --git a/src/algorithms/tracking/libs/dll_pll_conf.h b/src/algorithms/tracking/libs/dll_pll_conf.h index ab71cf039..7360154d3 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf.h +++ b/src/algorithms/tracking/libs/dll_pll_conf.h @@ -93,6 +93,7 @@ public: bool dump{false}; bool dump_mat{true}; bool f_error_dump{false}; + bool dump_every_code_period{false}; bool keep_phase_at_secondary_lock{false}; bool tow_to_trk{false}; bool bs_use_phase_dot_detector{true}; diff --git a/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc b/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc index d17d353cf..6307b5d21 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc +++ b/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc @@ -60,6 +60,7 @@ void Dll_Pll_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *confi } dump = configuration->property(role + ".dump", dump); dump_mat = configuration->property(role + ".dump_mat", dump_mat); + dump_every_code_period = configuration->property(role + ".dump_every_code_period", dump_every_code_period); keep_phase_at_secondary_lock = configuration->property(role + ".keep_phase_at_secondary_lock", keep_phase_at_secondary_lock); dump_filename = configuration->property(role + ".dump_filename", dump_filename); enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", enable_fll_pull_in); diff --git a/src/algorithms/tracking/libs/dll_pll_conf_fpga.h b/src/algorithms/tracking/libs/dll_pll_conf_fpga.h index bb193c3cd..46e749fe9 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf_fpga.h +++ b/src/algorithms/tracking/libs/dll_pll_conf_fpga.h @@ -105,6 +105,7 @@ public: bool high_dyn{false}; bool dump{false}; bool dump_mat{true}; + bool dump_every_code_period{false}; bool keep_phase_at_secondary_lock{false}; bool bs_use_phase_dot_detector{true}; }; diff --git a/src/algorithms/tracking/libs/kf_conf.cc b/src/algorithms/tracking/libs/kf_conf.cc index a90e277f9..809f4865a 100644 --- a/src/algorithms/tracking/libs/kf_conf.cc +++ b/src/algorithms/tracking/libs/kf_conf.cc @@ -82,6 +82,7 @@ Kf_Conf::Kf_Conf() : item_type("gr_complex"), high_dyn(false), dump(false), dump_mat(true), + dump_every_code_period(false), keep_phase_at_secondary_lock(false) { signal[0] = '1'; @@ -106,6 +107,7 @@ void Kf_Conf::SetFromConfiguration(const ConfigurationInterface *configuration, dump = configuration->property(role + ".dump", dump); dump_filename = configuration->property(role + ".dump_filename", dump_filename); dump_mat = configuration->property(role + ".dump_mat", dump_mat); + dump_every_code_period = configuration->property(role + ".dump_every_code_period", dump_every_code_period); keep_phase_at_secondary_lock = configuration->property(role + ".keep_phase_at_secondary_lock", keep_phase_at_secondary_lock); pull_in_time_s = configuration->property(role + ".pull_in_time_s", pull_in_time_s); diff --git a/src/algorithms/tracking/libs/kf_conf.h b/src/algorithms/tracking/libs/kf_conf.h index 1842eb484..cbc763e23 100644 --- a/src/algorithms/tracking/libs/kf_conf.h +++ b/src/algorithms/tracking/libs/kf_conf.h @@ -81,6 +81,7 @@ public: bool high_dyn; bool dump; bool dump_mat; + bool dump_every_code_period; bool keep_phase_at_secondary_lock; }; diff --git a/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc b/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc index 7dcd7a6e6..6dcebd6b3 100644 --- a/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc +++ b/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc @@ -276,7 +276,7 @@ std::string find_line_starting_with(const std::string& filename, const std::stri } -std::string find_line_containing(const std::string& filename, const std::string& text) +std::string find_line_containing(const std::string& filename, const std::string& text, bool data_records_only = false) { std::fstream fstr(filename.c_str(), std::fstream::in); if (!fstr.is_open()) @@ -286,9 +286,18 @@ std::string find_line_containing(const std::string& filename, const std::string& fstr.seekg(0); std::string line_str; + bool in_header = data_records_only; while (!fstr.eof()) { std::getline(fstr, line_str); + if (in_header) + { + if (line_str.find("END OF HEADER", 60) != std::string::npos) + { + in_header = false; + } + continue; + } if (line_str.find(text) != std::string::npos) { return line_str; @@ -564,10 +573,42 @@ TEST_F(RinexPrinterTest, Rinex4GpsNavAndObs) const std::string sto_line = find_line_containing(navfile, "GPUT"); EXPECT_NE(std::string::npos, sto_line.find("UTC(USNO)")); - // RINEX 4 navigation records use the 'e' exponent indicator instead of 'D' - EXPECT_TRUE(find_line_containing(navfile, "D+0").empty()); - EXPECT_TRUE(find_line_containing(navfile, "D-0").empty()); - EXPECT_FALSE(find_line_containing(navfile, "e+0").empty()); + // RINEX 4 navigation records use the 'e' exponent indicator instead of 'D'. + // Ignore header comments: a version containing HEAD-0 is not an exponent. + EXPECT_TRUE(find_line_containing(navfile, "D+0", true).empty()); + EXPECT_TRUE(find_line_containing(navfile, "D-0", true).empty()); + EXPECT_FALSE(find_line_containing(navfile, "e+0", true).empty()); +} + + +TEST_F(RinexPrinterTest, NavigationExponentSearchSkipsHeader) +{ + auto rp = make_rinex_printer(GPS_1C, 4); + const std::string navfile = rp->get_navfilename()[0]; + rp = nullptr; + + { + std::ofstream out(navfile); + ASSERT_TRUE(out.is_open()); + const std::string version = "GNSS-SDR VERSION 0.0.22.git-HEAD-068cc29"; + out << version << std::string(60 - version.size(), ' ') << "COMMENT\n"; + out << std::string(60, ' ') << "END OF HEADER\n"; + out << "> EPH G01 LNAV\n 1.000000000000e+00\n"; + } + + EXPECT_FALSE(find_line_containing(navfile, "D-0").empty()); + EXPECT_TRUE(find_line_containing(navfile, "D-0", true).empty()); + EXPECT_TRUE(find_line_containing(navfile, "D+0", true).empty()); + EXPECT_FALSE(find_line_containing(navfile, "e+0", true).empty()); + + { + std::ofstream out(navfile, std::ios::app); + ASSERT_TRUE(out.is_open()); + out << " 1.000000000000D-01\n 1.000000000000D+01\n"; + } + + EXPECT_EQ(" 1.000000000000D-01", find_line_containing(navfile, "D-0", true)); + EXPECT_EQ(" 1.000000000000D+01", find_line_containing(navfile, "D+0", true)); }