mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-17 15:47:15 +00:00
Fix reading of IONO and UTC data
This commit is contained in:
@@ -103,7 +103,7 @@ void Gps_Navigation_Message::reset()
|
|||||||
|
|
||||||
// Ionosphere and UTC
|
// Ionosphere and UTC
|
||||||
flag_iono_valid = false;
|
flag_iono_valid = false;
|
||||||
flag_utc_model_valid = true;
|
flag_utc_model_valid = false;
|
||||||
d_alpha0 = 0;
|
d_alpha0 = 0;
|
||||||
d_alpha1 = 0;
|
d_alpha1 = 0;
|
||||||
d_alpha2 = 0;
|
d_alpha2 = 0;
|
||||||
@@ -214,9 +214,9 @@ unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset<G
|
|||||||
{
|
{
|
||||||
unsigned long int value = 0;
|
unsigned long int value = 0;
|
||||||
int num_of_slices = parameter.size();
|
int num_of_slices = parameter.size();
|
||||||
for (int i=0; i<num_of_slices; i++)
|
for (int i = 0; i < num_of_slices; i++)
|
||||||
{
|
{
|
||||||
for (int j=0; j<parameter[i].second; j++)
|
for (int j = 0; j < parameter[i].second; j++)
|
||||||
{
|
{
|
||||||
value <<= 1; //shift left
|
value <<= 1; //shift left
|
||||||
if (bits[GPS_SUBFRAME_BITS - parameter[i].first - j] == 1)
|
if (bits[GPS_SUBFRAME_BITS - parameter[i].first - j] == 1)
|
||||||
@@ -250,9 +250,9 @@ signed long int Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_S
|
|||||||
value &= 0;
|
value &= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<num_of_slices; i++)
|
for (int i = 0; i < num_of_slices; i++)
|
||||||
{
|
{
|
||||||
for (int j=0; j<parameter[i].second; j++)
|
for (int j = 0; j < parameter[i].second; j++)
|
||||||
{
|
{
|
||||||
value <<= 1; //shift left
|
value <<= 1; //shift left
|
||||||
value &= 0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable)
|
value &= 0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable)
|
||||||
@@ -275,9 +275,9 @@ signed long int Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_S
|
|||||||
value &= 0;
|
value &= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<num_of_slices; i++)
|
for (int i = 0; i < num_of_slices; i++)
|
||||||
{
|
{
|
||||||
for (int j=0; j<parameter[i].second; j++)
|
for (int j = 0; j < parameter[i].second; j++)
|
||||||
{
|
{
|
||||||
value <<= 1; //shift left
|
value <<= 1; //shift left
|
||||||
value &= 0xFFFFFFFE; //reset the corresponding bit
|
value &= 0xFFFFFFFE; //reset the corresponding bit
|
||||||
@@ -369,7 +369,7 @@ void Gps_Navigation_Message::satellitePosition(double transmitTime)
|
|||||||
E = M;
|
E = M;
|
||||||
|
|
||||||
// --- Iteratively compute eccentric anomaly ----------------------------
|
// --- Iteratively compute eccentric anomaly ----------------------------
|
||||||
for (int ii = 1; ii<20; ii++)
|
for (int ii = 1; ii < 20; ii++)
|
||||||
{
|
{
|
||||||
E_old = E;
|
E_old = E;
|
||||||
E = M + d_e_eccentricity * sin(E);
|
E = M + d_e_eccentricity * sin(E);
|
||||||
@@ -429,8 +429,7 @@ void Gps_Navigation_Message::satellitePosition(double transmitTime)
|
|||||||
int Gps_Navigation_Message::subframe_decoder(char *subframe)
|
int Gps_Navigation_Message::subframe_decoder(char *subframe)
|
||||||
{
|
{
|
||||||
int subframe_ID = 0;
|
int subframe_ID = 0;
|
||||||
int SV_data_ID;
|
|
||||||
int SV_page = 0;
|
|
||||||
//double tmp_TOW;
|
//double tmp_TOW;
|
||||||
|
|
||||||
unsigned int gps_word;
|
unsigned int gps_word;
|
||||||
@@ -438,7 +437,7 @@ int Gps_Navigation_Message::subframe_decoder(char *subframe)
|
|||||||
// UNPACK BYTES TO BITS AND REMOVE THE CRC REDUNDANCE
|
// UNPACK BYTES TO BITS AND REMOVE THE CRC REDUNDANCE
|
||||||
std::bitset<GPS_SUBFRAME_BITS> subframe_bits;
|
std::bitset<GPS_SUBFRAME_BITS> subframe_bits;
|
||||||
std::bitset<GPS_WORD_BITS + 2> word_bits;
|
std::bitset<GPS_WORD_BITS + 2> word_bits;
|
||||||
for (int i=0; i<10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
memcpy(&gps_word, &subframe[i * 4], sizeof(char) * 4);
|
memcpy(&gps_word, &subframe[i * 4], sizeof(char) * 4);
|
||||||
word_bits = std::bitset<(GPS_WORD_BITS + 2) > (gps_word);
|
word_bits = std::bitset<(GPS_WORD_BITS + 2) > (gps_word);
|
||||||
@@ -546,6 +545,8 @@ int Gps_Navigation_Message::subframe_decoder(char *subframe)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // --- It is subframe 4 ---------- Almanac, ionospheric model, UTC parameters, SV health (PRN: 25-32)
|
case 4: // --- It is subframe 4 ---------- Almanac, ionospheric model, UTC parameters, SV health (PRN: 25-32)
|
||||||
|
int SV_data_ID;
|
||||||
|
int SV_page;
|
||||||
d_TOW_SF4 = static_cast<double>(read_navigation_unsigned(subframe_bits, TOW));
|
d_TOW_SF4 = static_cast<double>(read_navigation_unsigned(subframe_bits, TOW));
|
||||||
d_TOW_SF4 = d_TOW_SF4 * 6;
|
d_TOW_SF4 = d_TOW_SF4 * 6;
|
||||||
d_TOW = d_TOW_SF4 - 6; // Set transmission time
|
d_TOW = d_TOW_SF4 - 6; // Set transmission time
|
||||||
@@ -554,13 +555,17 @@ int Gps_Navigation_Message::subframe_decoder(char *subframe)
|
|||||||
b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG);
|
b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG);
|
||||||
SV_data_ID = static_cast<int>(read_navigation_unsigned(subframe_bits, SV_DATA_ID));
|
SV_data_ID = static_cast<int>(read_navigation_unsigned(subframe_bits, SV_DATA_ID));
|
||||||
SV_page = static_cast<int>(read_navigation_unsigned(subframe_bits, SV_PAGE));
|
SV_page = static_cast<int>(read_navigation_unsigned(subframe_bits, SV_PAGE));
|
||||||
|
if (SV_page > 24 && SV_page < 33) // Page 4 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110)
|
||||||
|
{
|
||||||
|
//! \TODO read almanac
|
||||||
|
}
|
||||||
|
|
||||||
if (SV_page == 13)
|
if (SV_page == 52) // Page 13 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110)
|
||||||
{
|
{
|
||||||
//! \TODO read Estimated Range Deviation (ERD) values
|
//! \TODO read Estimated Range Deviation (ERD) values
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SV_page == 18)
|
if (SV_page == 56) // Page 18 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110)
|
||||||
{
|
{
|
||||||
// Page 18 - Ionospheric and UTC data
|
// Page 18 - Ionospheric and UTC data
|
||||||
d_alpha0 = static_cast<double>(read_navigation_signed(subframe_bits, ALPHA_0));
|
d_alpha0 = static_cast<double>(read_navigation_signed(subframe_bits, ALPHA_0));
|
||||||
@@ -593,8 +598,12 @@ int Gps_Navigation_Message::subframe_decoder(char *subframe)
|
|||||||
flag_iono_valid = true;
|
flag_iono_valid = true;
|
||||||
flag_utc_model_valid = true;
|
flag_utc_model_valid = true;
|
||||||
}
|
}
|
||||||
|
if (SV_page == 57)
|
||||||
|
{
|
||||||
|
// Reserved
|
||||||
|
}
|
||||||
|
|
||||||
if (SV_page == 25)
|
if (SV_page == 63) // Page 25 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110)
|
||||||
{
|
{
|
||||||
// Page 25 Anti-Spoofing, SV config and almanac health (PRN: 25-32)
|
// Page 25 Anti-Spoofing, SV config and almanac health (PRN: 25-32)
|
||||||
//! \TODO Read Anti-Spoofing, SV config
|
//! \TODO Read Anti-Spoofing, SV config
|
||||||
@@ -611,19 +620,21 @@ int Gps_Navigation_Message::subframe_decoder(char *subframe)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 5://--- It is subframe 5 -----------------almanac health (PRN: 1-24) and Almanac reference week number and time.
|
case 5://--- It is subframe 5 -----------------almanac health (PRN: 1-24) and Almanac reference week number and time.
|
||||||
|
int SV_data_ID_5;
|
||||||
|
int SV_page_5;
|
||||||
d_TOW_SF5 = static_cast<double>(read_navigation_unsigned(subframe_bits, TOW));
|
d_TOW_SF5 = static_cast<double>(read_navigation_unsigned(subframe_bits, TOW));
|
||||||
d_TOW_SF5 = d_TOW_SF5 * 6;
|
d_TOW_SF5 = d_TOW_SF5 * 6;
|
||||||
d_TOW = d_TOW_SF5 - 6; // Set transmission time
|
d_TOW = d_TOW_SF5 - 6; // Set transmission time
|
||||||
b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG);
|
b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG);
|
||||||
b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG);
|
b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG);
|
||||||
b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG);
|
b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG);
|
||||||
SV_data_ID = static_cast<int>(read_navigation_unsigned(subframe_bits, SV_DATA_ID));
|
SV_data_ID_5 = static_cast<int>(read_navigation_unsigned(subframe_bits, SV_DATA_ID));
|
||||||
SV_page = static_cast<int>(read_navigation_unsigned(subframe_bits, SV_PAGE));
|
SV_page_5 = static_cast<int>(read_navigation_unsigned(subframe_bits, SV_PAGE));
|
||||||
if (SV_page < 25)
|
if (SV_page_5 < 25)
|
||||||
{
|
{
|
||||||
//! \TODO read almanac
|
//! \TODO read almanac
|
||||||
}
|
}
|
||||||
if (SV_page == 25)
|
if (SV_page_5 == 51) // Page 25 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110)
|
||||||
{
|
{
|
||||||
d_Toa = static_cast<double>(read_navigation_unsigned(subframe_bits, T_OA));
|
d_Toa = static_cast<double>(read_navigation_unsigned(subframe_bits, T_OA));
|
||||||
d_Toa = d_Toa * T_OA_LSB;
|
d_Toa = d_Toa * T_OA_LSB;
|
||||||
@@ -809,7 +820,7 @@ Gps_Utc_Model Gps_Navigation_Message::get_utc_model()
|
|||||||
utc_model.i_DN = i_DN;
|
utc_model.i_DN = i_DN;
|
||||||
utc_model.d_DeltaT_LSF = d_DeltaT_LSF;
|
utc_model.d_DeltaT_LSF = d_DeltaT_LSF;
|
||||||
// warning: We clear flag_utc_model_valid in order to not re-send the same information to the ionospheric parameters queue
|
// warning: We clear flag_utc_model_valid in order to not re-send the same information to the ionospheric parameters queue
|
||||||
d_DeltaT_LSF = false;
|
flag_utc_model_valid = false;
|
||||||
return utc_model;
|
return utc_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user