diff --git a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf index 9b7c1cfa5..82f40644f 100644 --- a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf +++ b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf @@ -25,7 +25,7 @@ Resampler.sample_freq_out=6625000 Resampler.item_type=gr_complex ;######### CHANNELS GLOBAL CONFIG ############ -Channels_1G.count=2 +Channels_1G.count=5 Channels.in_acquisition=1 Channel0.signal=1G Channel1.signal=1G @@ -33,10 +33,10 @@ Channel2.signal=1G Channel3.signal=1G Channel4.signal=1G -Channel0.satellite=2 -Channel1.satellite=21 -Channel2.satellite=12 -Channel3.satellite=23 +;Channel0.satellite=2 +;Channel1.satellite=21 +;Channel2.satellite=12 +;Channel3.satellite=23 ; Possible list includes 2, 12, 21, 22 ;######### ACQUISITION GLOBAL CONFIG ############ @@ -48,7 +48,7 @@ Acquisition_1G.if=0 Acquisition_1G.doppler_max=10000 Acquisition_1G.doppler_step=250 Acquisition_1G.dump=false; -Acquisition_1G.dump_filename=../data/glo_acquisition.dat +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat ;######### TRACKING GLOBAL CONFIG ############ Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking @@ -58,7 +58,7 @@ Tracking_1G.early_late_space_chips=0.5 Tracking_1G.pll_bw_hz=20.0; Tracking_1G.dll_bw_hz=4.0; Tracking_1G.dump=true; -Tracking_1G.dump_filename=../data/glo_tracking_ch_ +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ TelemetryDecoder_1G.implementation=GPS_L1_CA_Telemetry_Decoder diff --git a/src/algorithms/libs/rtklib/rtklib_conversions.cc b/src/algorithms/libs/rtklib/rtklib_conversions.cc index 45f13db82..c495fc210 100644 --- a/src/algorithms/libs/rtklib/rtklib_conversions.cc +++ b/src/algorithms/libs/rtklib/rtklib_conversions.cc @@ -72,7 +72,7 @@ geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris & glonass_gnav_eph) struct tm utcinfo; rtklib_sat.sat = glonass_gnav_eph.i_satellite_slot_number; /* satellite number */ - rtklib_sat.iode = glonass_gnav_eph.d_t_b; /* IODE (0-6 bit of tb field) */ + rtklib_sat.iode = glonass_gnav_eph.d_iode; /* IODE (0-6 bit of tb field) */ rtklib_sat.frq = glonass_gnav_eph.i_satellite_freq_channel; /* satellite frequency number */ rtklib_sat.svh = glonass_gnav_eph.d_l3rd_n; /* satellite health*/ rtklib_sat.sva = glonass_gnav_eph.d_F_T; /* satellite accuracy*/ @@ -90,25 +90,24 @@ geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris & glonass_gnav_eph) rtklib_sat.gamn = glonass_gnav_eph.d_gamma_n; /* SV relative freq bias */ rtklib_sat.age = glonass_gnav_eph.d_Delta_tau_n; /* delay between L1 and L2 (s) */ - /* TODO: adjustment for week handover */ utcinfo.tm_mon = 0; - utcinfo.tm_mday = glonass_gnav_eph.d_D4Y; + utcinfo.tm_mday = glonass_gnav_eph.d_N_T; utcinfo.tm_year = glonass_gnav_eph.d_yr - 1900; - utcinfo.tm_hour = 0; + utcinfo.tm_hour = 6; // Diff between utc and (utc(su) + 3.00h) utcinfo.tm_min = 0; utcinfo.tm_sec = glonass_gnav_eph.d_t_b; t_utc.time = mktime(&utcinfo); - t_utc.sec = 0.0; + t_utc.sec = glonass_gnav_eph.d_tau_c; rtklib_sat.toe = utc2gpst(t_utc); /* epoch of epherides (gpst) */ utcinfo.tm_mon = 0; - utcinfo.tm_mday = glonass_gnav_eph.d_D4Y; + utcinfo.tm_mday = glonass_gnav_eph.d_N_T; utcinfo.tm_year = glonass_gnav_eph.d_yr - 1900; - utcinfo.tm_hour = 0; + utcinfo.tm_hour = 6; utcinfo.tm_min = 0; utcinfo.tm_sec = glonass_gnav_eph.d_t_k; t_utc.time = mktime(&utcinfo); - t_utc.sec = 0.0; + t_utc.sec = glonass_gnav_eph.d_tau_c; rtklib_sat.tof = utc2gpst(t_utc); /* message frame time (gpst) */ diff --git a/src/core/system_parameters/glonass_gnav_almanac.cc b/src/core/system_parameters/glonass_gnav_almanac.cc index cbef6df64..049d3a4c0 100644 --- a/src/core/system_parameters/glonass_gnav_almanac.cc +++ b/src/core/system_parameters/glonass_gnav_almanac.cc @@ -52,8 +52,8 @@ Glonass_Gnav_Almanac::Glonass_Gnav_Almanac() d_M_n_A = 0.0; d_KP = 0.0; d_tau_n_A = 0.0; - d_C_n = 0.0; - d_l_n = 0.0; + d_C_n = false; + d_l_n = false; } void Glonass_Gnav_Almanac::satellite_position(double N_A, double N_i, double t_i) diff --git a/src/core/system_parameters/glonass_gnav_almanac.h b/src/core/system_parameters/glonass_gnav_almanac.h index 2c7780bf5..3012708dd 100644 --- a/src/core/system_parameters/glonass_gnav_almanac.h +++ b/src/core/system_parameters/glonass_gnav_almanac.h @@ -59,8 +59,8 @@ public: double d_M_n_A; //!< Type of satellite n_A [dimensionless] double d_KP; //!< Notification on forthcoming leap second correction of UTC [dimensionless] double d_tau_n_A; //!< Coarse value of d_n_A satellite time correction to GLONASS time at instant t_lambdan_A[s] - double d_C_n; //!< Generalized “unhealthy flag” of n_A satellite at instant of almanac upload [dimensionless] - double d_l_n; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless] + bool d_C_n; //!< Generalized “unhealthy flag” of n_A satellite at instant of almanac upload [dimensionless] + bool d_l_n; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless] // Satellite Identification Information int i_satellite_freq_channel; //!< SV Frequency Channel Number diff --git a/src/core/system_parameters/glonass_gnav_ephemeris.cc b/src/core/system_parameters/glonass_gnav_ephemeris.cc index f5bb76eab..b7b8e2d3a 100644 --- a/src/core/system_parameters/glonass_gnav_ephemeris.cc +++ b/src/core/system_parameters/glonass_gnav_ephemeris.cc @@ -62,18 +62,16 @@ Glonass_Gnav_Ephemeris::Glonass_Gnav_Ephemeris() d_Delta_tau_n = 0.0; //!< Time difference between navigation RF signal transmitted in L2 sub- band and aviation RF signal transmitted in L1 sub-band by nth satellite. [dimensionless] d_E_n = 0.0; //!< Characterises "age" of a current information [days] d_P_1 = 0.0; //!< Flag of the immediate data updating [minutes] - d_P_2 = 0.0; //!< Flag of oddness ("1") or evenness ("0") of the value of (tb) [dimensionless] - d_P_3 = 0.0; //!< Flag indicating a number of satellites for which almanac is transmitted within given frame: "1" corresponds to 5 satellites and "0" corresponds to 4 satellites [dimensionless] - d_P_4 = 0.0; //!< Flag to show that ephemeris parameters are present. "1" indicates that updated ephemeris or frequency/time parameters have been uploaded by the control segment [dimensionless] - d_l3rd_n = 0.0; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless] - d_l5th_n = 0.0; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless] + d_P_2 = false; //!< Flag of oddness ("1") or evenness ("0") of the value of (tb) [dimensionless] + d_P_3 = false; //!< Flag indicating a number of satellites for which almanac is transmitted within given frame: "1" corresponds to 5 satellites and "0" corresponds to 4 satellites [dimensionless] + d_P_4 = false; //!< Flag to show that ephemeris parameters are present. "1" indicates that updated ephemeris or frequency/time parameters have been uploaded by the control segment [dimensionless] + d_l3rd_n = false; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless] + d_l5th_n = false; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless] // Satellite Identification Information i_satellite_freq_channel = 0; //!< SV Frequency Channel Number i_satellite_PRN = 0; //!< SV PRN Number, equivalent to slot number for compatibility with GPS i_satellite_slot_number = 0; //!< SV Slot Number - d_TOD = 0.0; //!< Time of Day of the ephemeris set based in start of frame [s] - d_D4Y = 0.0; //!< Day of Year after latest leap year (4 year interval) d_yr = 1972; //!< Current year, defaults to 1972 (UTC Epoch with leap seconds) d_satClkDrift = 0.0; //!< GLONASS clock error d_dtr = 0.0; //!< relativistic clock correction term @@ -86,7 +84,7 @@ Glonass_Gnav_Ephemeris::Glonass_Gnav_Ephemeris() boost::posix_time::ptime Glonass_Gnav_Ephemeris::compute_GLONASS_time(const double offset_time) const { - boost::posix_time::time_duration t(0, 0, offset_time); + boost::posix_time::time_duration t(0, 0, offset_time + d_tau_c); boost::gregorian::date d1(d_yr, 1, 1); boost::gregorian::days d2(d_N_T); boost::posix_time::ptime glonass_time(d1+d2, t); diff --git a/src/core/system_parameters/glonass_gnav_ephemeris.h b/src/core/system_parameters/glonass_gnav_ephemeris.h index ef4a0ec12..281237b48 100644 --- a/src/core/system_parameters/glonass_gnav_ephemeris.h +++ b/src/core/system_parameters/glonass_gnav_ephemeris.h @@ -64,7 +64,7 @@ public: double d_m; //!< String number within frame [dimensionless] double d_t_k; //!< GLONASS Time (UTC(SU) + 3 h) referenced to the beginning of the frame within the current day [s] double d_t_b; //!< Reference ephemeris relative time in GLONASS Time (UTC(SU) + 3 h). Index of a time interval within current day according to UTC(SU) + 03 hours 00 min. [s] - double d_M; //!< Type of satellite transmitting navigation signal [dimensionless] + double d_M; //!< Type of satellite transmitting navigation signal [dimensionless] double d_gamma_n; //!< Relative deviation of predicted carrier frequency value of n- satellite from nominal value at the instant tb [dimensionless] double d_tau_n; //!< Correction to the nth satellite time (tn) relative to GLONASS time (te), double d_Xn; //!< Earth-fixed coordinate x of the satellite in PZ-90.02 coordinate system [km]. @@ -84,19 +84,17 @@ public: double d_Delta_tau_n; //!< Time difference between navigation RF signal transmitted in L2 sub- band and aviation RF signal transmitted in L1 sub-band by nth satellite. [dimensionless] double d_E_n; //!< Characterises "age" of a current information [days] double d_P_1; //!< Flag of the immediate data updating [minutes] - double d_P_2; //!< Flag of oddness ("1") or evenness ("0") of the value of (tb) [dimensionless] - double d_P_3; //!< Flag indicating a number of satellites for which almanac is transmitted within given frame: "1" corresponds to 5 satellites and "0" corresponds to 4 satellites [dimensionless] - double d_P_4; //!< Flag to show that ephemeris parameters are present. "1" indicates that updated ephemeris or frequency/time parameters have been uploaded by the control segment [dimensionless] - double d_l3rd_n; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless] - double d_l5th_n; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless] + bool d_P_2; //!< Flag of oddness ("1") or evenness ("0") of the value of (tb) [dimensionless] + bool d_P_3; //!< Flag indicating a number of satellites for which almanac is transmitted within given frame: "1" corresponds to 5 satellites and "0" corresponds to 4 satellites [dimensionless] + bool d_P_4; //!< Flag to show that ephemeris parameters are present. "1" indicates that updated ephemeris or frequency/time parameters have been uploaded by the control segment [dimensionless] + bool d_l3rd_n; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless] + bool d_l5th_n; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless] // Inmediate deliverables of ephemeris information // Satellite Identification Information int i_satellite_freq_channel; //!< SV Frequency Channel Number unsigned int i_satellite_PRN; //!< SV PRN Number, equivalent to slot number for compatibility with GPS unsigned int i_satellite_slot_number; //!< SV Slot Number - double d_TOD; //!< Time of Day of the ephemeris set based in start of frame [s] - double d_D4Y; //!< Day of Year after latest leap year (4 year interval) double d_yr; //!< Current year double d_satClkDrift; //!< GLONASS clock error double d_dtr; //!< relativistic clock correction term diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index bd73917ce..424376129 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -74,12 +74,12 @@ void Glonass_Gnav_Navigation_Message::reset() //broadcast orbit 1 flag_TOW_set = false; - d_TOW = false; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] - d_TOW_F1 = false; //!< Time of GPS Week from HOW word of Subframe 1 [s] - d_TOW_F2 = false; //!< Time of GPS Week from HOW word of Subframe 2 [s] - d_TOW_F3 = false; //!< Time of GPS Week from HOW word of Subframe 3 [s] - d_TOW_F4 = false; //!< Time of GPS Week from HOW word of Subframe 4 [s] - d_TOW_F5 = false; //!< Time of GPS Week from HOW word of Subframe 5 [s] + 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] // Clock terms d_satClkCorr = 0.0; @@ -310,6 +310,23 @@ unsigned int Glonass_Gnav_Navigation_Message::get_frame_number(unsigned int sate return frame_ID; } +double Glonass_Gnav_Navigation_Message::get_TOW() +{ + double TOW = 0.0; + double utcsu2utc = 3*3600; + double glot2utcsu = 3*3600; + int i = 0; + + TOW = gnav_ephemeris.d_t_k + glot2utcsu + utcsu2utc + gnav_utc_model.d_tau_c + gnav_utc_model.d_tau_gps; + + for (i = 0; leaps[i][0]>0; i++) + { + if (leaps[i][0] == gnav_ephemeris.d_yr) + { + TOW -= leaps[i][6]; + } + return TOW; +} int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) { @@ -337,6 +354,8 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) gnav_ephemeris.d_Xn = static_cast(read_navigation_signed(string_bits, X_N)) * TWO_N11; flag_ephemeris_str_1 = true; + d_TOW = get_TOW(); + flag_TOW_set = true; break; @@ -345,7 +364,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) if (flag_ephemeris_str_1 == true) { gnav_ephemeris.d_B_n = static_cast(read_navigation_unsigned(string_bits, B_N)); - gnav_ephemeris.d_P_2 = static_cast(read_navigation_unsigned(string_bits, P2)); + gnav_ephemeris.d_P_2 = static_cast(read_navigation_bool(string_bits, P2)); gnav_ephemeris.d_t_b = static_cast(read_navigation_unsigned(string_bits, T_B))*gnav_ephemeris.d_P_1*60; gnav_ephemeris.d_VYn = static_cast(read_navigation_signed(string_bits, Y_N_DOT))* TWO_N20; gnav_ephemeris.d_AYn = static_cast(read_navigation_signed(string_bits, Y_N_DOT_DOT)) * TWO_N30; @@ -359,10 +378,10 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) case 3: // --- It is string 3 ---------------------------------------------- - gnav_ephemeris.d_P_3 = static_cast(read_navigation_unsigned(string_bits, P3)); + gnav_ephemeris.d_P_3 = static_cast(read_navigation_bool(string_bits, P3)); gnav_ephemeris.d_gamma_n = static_cast(read_navigation_signed(string_bits, GAMMA_N)) * TWO_N40; gnav_ephemeris.d_P = static_cast(read_navigation_unsigned(string_bits, P)); - gnav_ephemeris.d_l3rd_n = static_cast(read_navigation_unsigned(string_bits, EPH_L_N)); + gnav_ephemeris.d_l3rd_n = static_cast(read_navigation_bool(string_bits, EPH_L_N)); gnav_ephemeris.d_VZn = static_cast(read_navigation_signed(string_bits, Z_N_DOT)) * TWO_N20; gnav_ephemeris.d_AZn = static_cast(read_navigation_signed(string_bits, Z_N_DOT_DOT)) * TWO_N30; gnav_ephemeris.d_Zn = static_cast(read_navigation_signed(string_bits, Z_N)) * TWO_N11; @@ -376,7 +395,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) gnav_ephemeris.d_tau_n = static_cast(read_navigation_signed(string_bits, TAU_N)) * TWO_N30; gnav_ephemeris.d_Delta_tau_n = static_cast(read_navigation_signed(string_bits, DELTA_TAU_N)) * TWO_N30; gnav_ephemeris.d_E_n = static_cast(read_navigation_unsigned(string_bits, E_N)); - gnav_ephemeris.d_P_4 = static_cast(read_navigation_unsigned(string_bits, P4)); + gnav_ephemeris.d_P_4 = static_cast(read_navigation_bool(string_bits, P4)); gnav_ephemeris.d_F_T = static_cast(read_navigation_unsigned(string_bits, F_T)); gnav_ephemeris.d_N_T = static_cast(read_navigation_unsigned(string_bits, N_T)); gnav_ephemeris.d_n = static_cast(read_navigation_unsigned(string_bits, N)); @@ -385,7 +404,6 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) // Fill in ephemeris deliverables in the code gnav_ephemeris.i_satellite_slot_number = gnav_ephemeris.d_n; gnav_ephemeris.i_satellite_PRN = gnav_ephemeris.d_n; - gnav_ephemeris.d_D4Y = gnav_ephemeris.d_N_T; flag_ephemeris_str_4 = true; @@ -397,7 +415,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) gnav_utc_model.d_tau_c = static_cast(read_navigation_signed(string_bits, TAU_C)) * TWO_N31; gnav_utc_model.d_N_4 = static_cast(read_navigation_unsigned(string_bits, N_4)); gnav_utc_model.d_tau_gps = static_cast(read_navigation_signed(string_bits, TAU_GPS)) * TWO_N30; - gnav_ephemeris.d_l5th_n = static_cast(read_navigation_unsigned(string_bits, ALM_L_N)); + gnav_ephemeris.d_l5th_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); flag_utc_model_str_5 = true; // Compute Year and DoY based on Algorithm A3.11 of GLONASS ICD @@ -422,6 +440,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) } // 2). Current year in common form is calculated by the following formula: gnav_ephemeris.d_yr = 1996 + 4.0*(gnav_utc_model.d_N_4 - 1.0) + (J - 1.0); + gnav_ephemeris.d_tau_c = gnav_utc_model.d_tau_c; } break; @@ -430,7 +449,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) i_satellite_slot_number = static_cast(read_navigation_unsigned(string_bits, n_A)); frame_ID = get_frame_number(i_satellite_slot_number); - gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_unsigned(string_bits, C_N)); + gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_bool(string_bits, C_N)); gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast(read_navigation_unsigned(string_bits, n_A)); gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18; @@ -451,7 +470,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9; gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14; gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast(read_navigation_unsigned(string_bits, H_N_A)); - gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_unsigned(string_bits, ALM_L_N)); + gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); // Set satellite information for redundancy purposes if(gnav_almanac[i_satellite_slot_number - 1].d_H_n_A > 24) @@ -475,7 +494,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) i_satellite_slot_number = static_cast(read_navigation_unsigned(string_bits, n_A)); frame_ID = get_frame_number(i_satellite_slot_number); - gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_unsigned(string_bits, C_N)); + gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_bool(string_bits, C_N)); gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast(read_navigation_unsigned(string_bits, n_A)); gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18; @@ -496,7 +515,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9; gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14; gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast(read_navigation_unsigned(string_bits, H_N_A)) -32.0; - gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_unsigned(string_bits, ALM_L_N)); + gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); // Set satellite information for redundancy purposes if(gnav_almanac[i_satellite_slot_number - 1].d_H_n_A > 24) @@ -514,7 +533,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) i_satellite_slot_number = static_cast(read_navigation_unsigned(string_bits, n_A)); frame_ID = get_frame_number(i_satellite_slot_number); - gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_unsigned(string_bits, C_N)); + gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_bool(string_bits, C_N)); gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast(read_navigation_unsigned(string_bits, n_A)); gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18; @@ -535,7 +554,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9; gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14; gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast(read_navigation_unsigned(string_bits, H_N_A)) - 32.0; - gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_unsigned(string_bits, ALM_L_N)); + gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); // Set satellite information for redundancy purposes if(gnav_almanac[i_satellite_slot_number - 1].d_H_n_A > 24) @@ -553,7 +572,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) i_satellite_slot_number = static_cast(read_navigation_unsigned(string_bits, n_A)); frame_ID = get_frame_number(i_satellite_slot_number); - gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_unsigned(string_bits, C_N)); + gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_bool(string_bits, C_N)); gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast(read_navigation_unsigned(string_bits, n_A)); gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18; @@ -574,7 +593,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9; gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14; gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast(read_navigation_unsigned(string_bits, H_N_A)) - 32.0; - gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_unsigned(string_bits, ALM_L_N)); + gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); // Set satellite information for redundancy purposes if(gnav_almanac[i_satellite_slot_number - 1].d_H_n_A > 24) @@ -599,7 +618,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) i_satellite_slot_number = static_cast(read_navigation_unsigned(string_bits, n_A)); frame_ID = get_frame_number(i_satellite_slot_number); - gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_unsigned(string_bits, C_N)); + gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_bool(string_bits, C_N)); gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast(read_navigation_unsigned(string_bits, n_A)); gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18; @@ -622,7 +641,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9; gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14; gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast(read_navigation_unsigned(string_bits, H_N_A)) - 32.0; - gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_unsigned(string_bits, ALM_L_N)); + gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); // Set satellite information for redundancy purposes if(gnav_almanac[i_satellite_slot_number - 1].d_H_n_A > 24) diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.h b/src/core/system_parameters/glonass_gnav_navigation_message.h index 3cb73c819..0c71040f0 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.h +++ b/src/core/system_parameters/glonass_gnav_navigation_message.h @@ -97,8 +97,6 @@ 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 - //broadcast orbit 1 - //TODO Need to send the information regarding the frame number bool flag_TOW_set; 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] @@ -156,6 +154,11 @@ public: */ int string_decoder(std::string frame_string); + /* + * \brief Gets the time of week in GPS Time + */ + double get_TOW(); + /*! * \brief Computes the Coordinated Universal Time (UTC) and returns it in [s] */ diff --git a/src/core/system_parameters/rtcm.cc b/src/core/system_parameters/rtcm.cc index 7ee09e6bb..7dd60969a 100644 --- a/src/core/system_parameters/rtcm.cc +++ b/src/core/system_parameters/rtcm.cc @@ -3957,10 +3957,10 @@ int Rtcm::set_DF041(const Gnss_Synchro & gnss_synchro) return 0; } -//TODO Need to fix the lambda value since it needs to include frequency channel + int Rtcm::set_DF042(const Gnss_Synchro & gnss_synchro) { - const double lambda = GLONASS_C_m_s / GLONASS_L1_CA_FREQ_HZ; + const double lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN))); double ambiguity = std::floor( gnss_synchro.Pseudorange_m / 599584.92 ); double glonass_L1_pseudorange = std::round(( gnss_synchro.Pseudorange_m - ambiguity * 599584.92) / 0.02 ); double glonass_L1_pseudorange_c = glonass_L1_pseudorange * 0.02 + ambiguity * 299792.458; @@ -4349,8 +4349,7 @@ int Rtcm::set_DF106(const Glonass_Gnav_Ephemeris & glonass_gnav_eph) int Rtcm::set_DF107(const Glonass_Gnav_Ephemeris & glonass_gnav_eph) { - // TODO Need to fix this here, bit position has a given order - unsigned int hrs = 0; + unsigned int hrs = 0; unsigned int min = 0; unsigned int sec = 0; unsigned int tk = 0; @@ -5271,8 +5270,7 @@ int Rtcm::set_DF401(const Gnss_Synchro & gnss_synchro) } if ((sig.compare("1C") == 0) && (sys.compare("R") == 0 )) { - // TODO Need to add slot number and freq number to gnss_syncro - lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ); + lambda = GLONASS_C_m_s / ((GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)))); } if ((sig.compare("2C") == 0) && (sys.compare("R") == 0 )) { @@ -5381,8 +5379,7 @@ int Rtcm::set_DF404(const Gnss_Synchro & gnss_synchro) } if ((sig_.compare("1C") == 0) && (sys_.compare("R") == 0 )) { - //TODO Need to add slot number and freq number to gnss syncro - lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ); + lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN))); } if ((sig_.compare("2C") == 0) && (sys_.compare("R") == 0 )) { @@ -5470,8 +5467,7 @@ int Rtcm::set_DF406(const Gnss_Synchro & gnss_synchro) } if ((sig_.compare("1C") == 0) && (sys_.compare("R") == 0 )) { - //TODO Need to add slot number and freq number to gnss syncro - lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ); + lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN))); } if ((sig_.compare("2C") == 0) && (sys_.compare("R") == 0 )) {