From e0dfd90916bf4e351e58b82cf4a9cd0091c22426 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Mon, 2 Oct 2017 23:00:45 -0600 Subject: [PATCH] GLONASS Observables: Fixes bug in TOW updating Fixes bug in TOW update when a new value has been computed. This adds a new flag to keep track of TOW update given the tk component. The code fix improves the pseudorange measurement for code --- conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf | 2 ++ .../glonass_l1_ca_telemetry_decoder_cc.cc | 5 +++-- .../glonass_gnav_navigation_message.cc | 10 ++++------ .../glonass_gnav_navigation_message.h | 8 ++------ src/utils/matlab/hybrid_observables_plot_sample.m | 5 +++-- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf index 9bec04bd9..3b08957b4 100644 --- a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf +++ b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf @@ -62,6 +62,8 @@ TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder ;######### OBSERVABLES CONFIG ############ Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/glo_observables.dat ;######### PVT CONFIG ############ PVT.implementation=RTKLIB_PVT diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc index e12e83b7e..1e3f86622 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc @@ -351,10 +351,11 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib // UPDATE GNSS SYNCHRO DATA //2. Add the telemetry decoder information - if (this->d_flag_preamble == true and d_nav.flag_TOW_set == true) + if (this->d_flag_preamble == true and d_nav.flag_TOW_new == true) //update TOW at the preamble instant { - d_TOW_at_current_symbol = floor((d_nav.d_TOW + 2*GLONASS_L1_CA_CODE_PERIOD + GLONASS_GNAV_PREAMBLE_DURATION_S)*1000.0)/1000.0; + d_TOW_at_current_symbol = floor((d_nav.d_TOW - GLONASS_GNAV_PREAMBLE_DURATION_S)*1000.0)/1000.0; + d_nav.flag_TOW_new = false; } else //if there is not a new preamble, we define the TOW of the current symbol diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index 5bec42b38..1f3b5291d 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -73,12 +73,8 @@ void Glonass_Gnav_Navigation_Message::reset() //broadcast orbit 1 flag_TOW_set = false; + flag_TOW_new = false; d_TOW = 0.0; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] - d_TOW_F1 = 0.0; //!< Time of GPS Week from HOW word of Subframe 1 [s] - d_TOW_F2 = 0.0; //!< Time of GPS Week from HOW word of Subframe 2 [s] - d_TOW_F3 = 0.0; //!< Time of GPS Week from HOW word of Subframe 3 [s] - d_TOW_F4 = 0.0; //!< Time of GPS Week from HOW word of Subframe 4 [s] - d_TOW_F5 = 0.0; //!< Time of GPS Week from HOW word of Subframe 5 [s] flag_CRC_test = false; d_frame_ID = 0; @@ -366,7 +362,8 @@ double Glonass_Gnav_Navigation_Message::get_TOW() int i = 0; // tk is relative to UTC(SU) + 3.00 hrs, so we need to convert to utc and add corrections - TOD = gnav_ephemeris.d_t_k - glot2utcsu - utcsu2utc + gnav_utc_model.d_tau_c + gnav_utc_model.d_tau_gps; + // tk plus 10 sec is the true tod since get_TOW is called when in str5 + TOD = (gnav_ephemeris.d_t_k + 10) - glot2utcsu - utcsu2utc + gnav_utc_model.d_tau_c + gnav_utc_model.d_tau_gps; boost::gregorian::date glo_date(gnav_ephemeris.d_yr, 1, 1); @@ -521,6 +518,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) gnav_ephemeris.d_TOW = d_TOW; gnav_ephemeris.d_WN = get_WN(); flag_TOW_set = true; + flag_TOW_new = true; } } diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.h b/src/core/system_parameters/glonass_gnav_navigation_message.h index cf2ac3750..743f4cefa 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.h +++ b/src/core/system_parameters/glonass_gnav_navigation_message.h @@ -95,13 +95,9 @@ public: bool flag_utc_model_str_5; //!< Clock info send in string 5 of navigation data bool flag_utc_model_str_15; //!< Clock info send in string 15 of frame 5 of navigation data - bool flag_TOW_set; + bool flag_TOW_set; //!< Flag indicating when the TOW has been set + bool flag_TOW_new; //!< Flag indicating when a new TOW has been computed double d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] - double d_TOW_F1; //!< Time of GPS Week from HOW word of Subframe 1 [s] - double d_TOW_F2; //!< Time of GPS Week from HOW word of Subframe 2 [s] - double d_TOW_F3; //!< Time of GPS Week from HOW word of Subframe 3 [s] - double d_TOW_F4; //!< Time of GPS Week from HOW word of Subframe 4 [s] - double d_TOW_F5; //!< Time of GPS Week from HOW word of Subframe 5 [s] // Clock terms double d_satClkCorr; // Satellite clock error diff --git a/src/utils/matlab/hybrid_observables_plot_sample.m b/src/utils/matlab/hybrid_observables_plot_sample.m index 218527343..538575bee 100644 --- a/src/utils/matlab/hybrid_observables_plot_sample.m +++ b/src/utils/matlab/hybrid_observables_plot_sample.m @@ -7,16 +7,17 @@ addpath('./libs'); samplingFreq = 6625000; %[Hz] channels=5; path='/archive/'; -observables_log_path=[path 'glo_observables']; +observables_log_path=[path 'glo_observables.dat']; GNSS_observables= read_hybrid_observables_dump(channels,observables_log_path); +%% %optional: %search all channels having good satellite simultaneously min_idx=1; for n=1:1:channels idx=find(GNSS_observables.valid(n,:)>0,1,'first'); if min_idx