1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 13:13:03 +00:00

bugfix: Fixes bugs with units in GNAV Almanac decoding

Forces conversion of semicircles to radians units  in some GNAV Almanac
parameters. In addition, adds safeguards in code to avoid invalid
slot number identification.
This commit is contained in:
Damian Miralles 2017-09-20 08:42:01 -06:00 committed by Carles Fernandez
parent c4c90dcad2
commit d8f697401e
3 changed files with 89 additions and 78 deletions

View File

@ -25,20 +25,15 @@ Resampler.sample_freq_out=6625000
Resampler.item_type=gr_complex Resampler.item_type=gr_complex
;######### CHANNELS GLOBAL CONFIG ############ ;######### CHANNELS GLOBAL CONFIG ############
Channel.signal=1G
Channels.in_acquisition=1
Channels_1G.count=5 Channels_1G.count=5
Channels.in_acquisition=5
Channel0.signal=1G
Channel1.signal=1G
Channel2.signal=1G
Channel3.signal=1G
Channel4.signal=1G
Channel0.satellite=11 Channel0.satellite=11
Channel1.satellite=2 Channel1.satellite=2
Channel2.satellite=18 Channel2.satellite=18
Channel3.satellite=12 Channel3.satellite=12
Channel4.satellite=21 Channel4.satellite=21
; Possible list includes 2, 12, 21, 22
;######### ACQUISITION GLOBAL CONFIG ############ ;######### ACQUISITION GLOBAL CONFIG ############
Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition
@ -53,9 +48,9 @@ Acquisition_1G.dump_filename=/archive/glo_acquisition.dat
;Acquisition_1G.coherent_integration_time_ms=10 ;Acquisition_1G.coherent_integration_time_ms=10
;######### TRACKING GLOBAL CONFIG ############ ;######### TRACKING GLOBAL CONFIG ############
Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking
Tracking_1G.item_type=gr_complex Tracking_1G.item_type=gr_complex
Tracking_1G.if=1 Tracking_1G.if=0
Tracking_1G.early_late_space_chips=0.5 Tracking_1G.early_late_space_chips=0.5
Tracking_1G.pll_bw_hz=25.0; Tracking_1G.pll_bw_hz=25.0;
Tracking_1G.dll_bw_hz=3.0; Tracking_1G.dll_bw_hz=3.0;
@ -63,7 +58,7 @@ Tracking_1G.dump=true;
Tracking_1G.dump_filename=/archive/glo_tracking_ch_ Tracking_1G.dump_filename=/archive/glo_tracking_ch_
;######### TELEMETRY DECODER GPS CONFIG ############ ;######### TELEMETRY DECODER GPS CONFIG ############
TelemetryDecoder_1G.implementation=GPS_L1_CA_Telemetry_Decoder TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder
;######### OBSERVABLES CONFIG ############ ;######### OBSERVABLES CONFIG ############
Observables.implementation=Hybrid_Observables Observables.implementation=Hybrid_Observables

View File

@ -200,6 +200,7 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols,int
// get object for this SV (mandatory) // get object for this SV (mandatory)
std::shared_ptr<Glonass_Gnav_Ephemeris> tmp_obj = std::make_shared<Glonass_Gnav_Ephemeris>(d_nav.get_ephemeris()); std::shared_ptr<Glonass_Gnav_Ephemeris> tmp_obj = std::make_shared<Glonass_Gnav_Ephemeris>(d_nav.get_ephemeris());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
LOG(INFO) << "GLONASS GNAV Ephemeris have been received on channel" << d_channel << " from satellite " << d_satellite;
} }
if (d_nav.have_new_utc_model() == true) if (d_nav.have_new_utc_model() == true)
@ -207,12 +208,14 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols,int
// get object for this SV (mandatory) // get object for this SV (mandatory)
std::shared_ptr<Glonass_Gnav_Utc_Model> tmp_obj = std::make_shared<Glonass_Gnav_Utc_Model>(d_nav.get_utc_model()); std::shared_ptr<Glonass_Gnav_Utc_Model> tmp_obj = std::make_shared<Glonass_Gnav_Utc_Model>(d_nav.get_utc_model());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
LOG(INFO) << "GLONASS GNAV UTC Model have been received on channel" << d_channel << " from satellite " << d_satellite;
} }
if (d_nav.have_new_almanac() == true) if (d_nav.have_new_almanac() == true)
{ {
unsigned int slot_nbr = d_nav.i_alm_satellite_slot_number; unsigned int slot_nbr = d_nav.i_alm_satellite_slot_number;
std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj= std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr)); std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj= std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr));
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
LOG(INFO) << "GLONASS GNAV Almanac have been received on channel" << d_channel << " in slot number " << slot_nbr;
} }
// 5. Update satellite information on system // 5. Update satellite information on system
if(d_nav.flag_update_slot_number == true) if(d_nav.flag_update_slot_number == true)

View File

@ -385,6 +385,8 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
case 3: case 3:
// --- It is string 3 ---------------------------------------------- // --- It is string 3 ----------------------------------------------
if (flag_ephemeris_str_2 == true)
{
gnav_ephemeris.d_P_3 = static_cast<bool>(read_navigation_bool(string_bits, P3)); gnav_ephemeris.d_P_3 = static_cast<bool>(read_navigation_bool(string_bits, P3));
gnav_ephemeris.d_gamma_n = static_cast<double>(read_navigation_signed(string_bits, GAMMA_N)) * TWO_N40; gnav_ephemeris.d_gamma_n = static_cast<double>(read_navigation_signed(string_bits, GAMMA_N)) * TWO_N40;
gnav_ephemeris.d_P = static_cast<double>(read_navigation_unsigned(string_bits, P)); gnav_ephemeris.d_P = static_cast<double>(read_navigation_unsigned(string_bits, P));
@ -394,11 +396,14 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
gnav_ephemeris.d_Zn = static_cast<double>(read_navigation_signed(string_bits, Z_N)) * TWO_N11; gnav_ephemeris.d_Zn = static_cast<double>(read_navigation_signed(string_bits, Z_N)) * TWO_N11;
flag_ephemeris_str_3 = true; flag_ephemeris_str_3 = true;
}
break; break;
case 4: case 4:
// --- It is string 4 ---------------------------------------------- // --- It is string 4 ----------------------------------------------
if (flag_ephemeris_str_3 == true)
{
gnav_ephemeris.d_tau_n = static_cast<double>(read_navigation_signed(string_bits, TAU_N)) * TWO_N30; gnav_ephemeris.d_tau_n = static_cast<double>(read_navigation_signed(string_bits, TAU_N)) * TWO_N30;
gnav_ephemeris.d_Delta_tau_n = static_cast<double>(read_navigation_signed(string_bits, DELTA_TAU_N)) * TWO_N30; gnav_ephemeris.d_Delta_tau_n = static_cast<double>(read_navigation_signed(string_bits, DELTA_TAU_N)) * TWO_N30;
gnav_ephemeris.d_E_n = static_cast<double>(read_navigation_unsigned(string_bits, E_N)); gnav_ephemeris.d_E_n = static_cast<double>(read_navigation_unsigned(string_bits, E_N));
@ -414,11 +419,14 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
gnav_ephemeris.i_satellite_PRN = static_cast<unsigned int>(gnav_ephemeris.d_n); gnav_ephemeris.i_satellite_PRN = static_cast<unsigned int>(gnav_ephemeris.d_n);
flag_ephemeris_str_4 = true; flag_ephemeris_str_4 = true;
}
break; break;
case 5: case 5:
// --- It is string 5 ---------------------------------------------- // --- It is string 5 ----------------------------------------------
if (flag_ephemeris_str_4 == true)
{
gnav_utc_model.d_N_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A)); gnav_utc_model.d_N_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
gnav_utc_model.d_tau_c = static_cast<double>(read_navigation_signed(string_bits, TAU_C)) * TWO_N31; gnav_utc_model.d_tau_c = static_cast<double>(read_navigation_signed(string_bits, TAU_C)) * TWO_N31;
gnav_utc_model.d_N_4 = static_cast<double>(read_navigation_unsigned(string_bits, N_4)); gnav_utc_model.d_N_4 = static_cast<double>(read_navigation_unsigned(string_bits, N_4));
@ -426,10 +434,9 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
gnav_ephemeris.d_l5th_n = static_cast<bool>(read_navigation_bool(string_bits, ALM_L_N)); gnav_ephemeris.d_l5th_n = static_cast<bool>(read_navigation_bool(string_bits, ALM_L_N));
flag_utc_model_str_5 = true; flag_utc_model_str_5 = true;
// Compute Year and DoY based on Algorithm A3.11 of GLONASS ICD // Compute Year and DoY based on Algorithm A3.11 of GLONASS ICD
if (flag_ephemeris_str_4 == true) // 1). Current year number J in the four-year interval is calculated
{
//Current year number J in the four-year interval is calculated:
if (gnav_ephemeris.d_N_T >= 1 && gnav_ephemeris.d_N_T <= 366) if (gnav_ephemeris.d_N_T >= 1 && gnav_ephemeris.d_N_T <= 366)
{ {
J = 1; J = 1;
@ -455,16 +462,20 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
{ {
d_TOW = get_TOW(); d_TOW = get_TOW();
flag_TOW_set = true; flag_TOW_set = true;
} }
} }
break; break;
case 6: case 6:
// --- It is string 6 ---------------------------------------------- // --- It is string 6 ----------------------------------------------
i_alm_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A)); i_alm_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A));
d_frame_ID = get_frame_number(i_alm_satellite_slot_number); d_frame_ID = get_frame_number(i_alm_satellite_slot_number);
// Make sure a valid frame_ID or satellite slot number is returned
if(d_frame_ID == 0)
return 0;
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N)); gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
@ -510,6 +521,9 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
// --- It is string 8 ---------------------------------------------- // --- It is string 8 ----------------------------------------------
i_alm_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A)); i_alm_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A));
d_frame_ID = get_frame_number(i_alm_satellite_slot_number); d_frame_ID = get_frame_number(i_alm_satellite_slot_number);
// Make sure a valid frame_ID or satellite slot number is returned
if(d_frame_ID == 0)
return 0;
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N)); gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
@ -548,6 +562,9 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
// --- It is string 10 --------------------------------------------- // --- It is string 10 ---------------------------------------------
i_alm_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A)); i_alm_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A));
d_frame_ID = get_frame_number(i_alm_satellite_slot_number); d_frame_ID = get_frame_number(i_alm_satellite_slot_number);
// Make sure a valid frame_ID or satellite slot number is returned
if(d_frame_ID == 0)
return 0;
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N)); gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
@ -587,7 +604,9 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
// --- It is string 12 --------------------------------------------- // --- It is string 12 ---------------------------------------------
i_alm_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A)); i_alm_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A));
d_frame_ID = get_frame_number(i_alm_satellite_slot_number); d_frame_ID = get_frame_number(i_alm_satellite_slot_number);
// Make sure a valid frame_ID or satellite slot number is returned
if(d_frame_ID == 0)
return 0;
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N)); gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, n_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
@ -633,7 +652,9 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
{ {
i_alm_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A)); i_alm_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A));
d_frame_ID = get_frame_number(i_alm_satellite_slot_number); d_frame_ID = get_frame_number(i_alm_satellite_slot_number);
// Make sure a valid frame_ID or satellite slot number is returned
if(d_frame_ID == 0)
return 0;
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N)); gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, n_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
@ -644,12 +665,10 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
flag_almanac_str_14 = true; flag_almanac_str_14 = true;
} }
break; break;
case 15: case 15:
// --- It is string 9 ---------------------------------------------- // --- It is string 15 ----------------------------------------------
if (d_frame_ID != 5 and flag_almanac_str_14 == true) { if (d_frame_ID != 5 and flag_almanac_str_14 == true) {
gnav_almanac[i_alm_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_signed(string_bits, OMEGA_N_A)) * TWO_N15 * GLONASS_PI; gnav_almanac[i_alm_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_signed(string_bits, OMEGA_N_A)) * TWO_N15 * GLONASS_PI;
gnav_almanac[i_alm_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A)) * TWO_N5; gnav_almanac[i_alm_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A)) * TWO_N5;
@ -711,23 +730,17 @@ Glonass_Gnav_Almanac Glonass_Gnav_Navigation_Message::get_almanac(unsigned int s
bool Glonass_Gnav_Navigation_Message::have_new_ephemeris() //Check if we have a new ephemeris stored in the galileo navigation class bool Glonass_Gnav_Navigation_Message::have_new_ephemeris() //Check if we have a new ephemeris stored in the galileo navigation class
{ {
if ((flag_ephemeris_str_1 == true) and (flag_ephemeris_str_2 == true) and (flag_ephemeris_str_3 == true) and (flag_ephemeris_str_4 == true)) // We need to make sure we have received the ephemeris info plus the time info
{ if ((flag_ephemeris_str_1 == true) and (flag_ephemeris_str_2 == true) and
if (gnav_ephemeris.d_P_4 == 1) (flag_ephemeris_str_3 == true) and (flag_ephemeris_str_4 == true) and
(flag_utc_model_str_5 == true))
{ {
flag_ephemeris_str_1 = false;// clear the flag flag_ephemeris_str_1 = false;// clear the flag
flag_ephemeris_str_2 = false;// clear the flag flag_ephemeris_str_2 = false;// clear the flag
flag_ephemeris_str_3 = false;// clear the flag flag_ephemeris_str_3 = false;// clear the flag
flag_ephemeris_str_4 = false;// clear the flag flag_ephemeris_str_4 = false;// clear the flag
flag_all_ephemeris = true; flag_all_ephemeris = true;
DLOG(INFO) << "Ephemeris (1, 2, 3, 4) have been received and belong to the same batch" << std::endl; DLOG(INFO) << "GLONASS GNAV Ephemeris (1, 2, 3, 4) have been received and belong to the same batch" << std::endl;
return true;
}
else
{
return false;
}
} }
else else
return false; return false;