From fa03077ca19f0207c1d584a84d2f334ba2c7d48e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 14 Dec 2018 00:42:05 +0100 Subject: [PATCH 1/4] Improve data types for Galileo navigation data --- src/core/system_parameters/Galileo_E1.h | 8 +-- src/core/system_parameters/Galileo_E5a.h | 8 +-- .../system_parameters/galileo_ephemeris.cc | 20 +++--- .../system_parameters/galileo_ephemeris.h | 28 ++++---- .../system_parameters/galileo_fnav_message.cc | 70 +++++++++---------- .../system_parameters/galileo_fnav_message.h | 36 +++++----- src/core/system_parameters/galileo_iono.cc | 4 +- src/core/system_parameters/galileo_iono.h | 4 +- .../galileo_navigation_message.cc | 64 ++++++++--------- .../galileo_navigation_message.h | 48 ++++++------- .../system_parameters/galileo_utc_model.cc | 16 ++--- .../system_parameters/galileo_utc_model.h | 14 ++-- 12 files changed, 160 insertions(+), 160 deletions(-) diff --git a/src/core/system_parameters/Galileo_E1.h b/src/core/system_parameters/Galileo_E1.h index d6f08a19e..93a814805 100644 --- a/src/core/system_parameters/Galileo_E1.h +++ b/src/core/system_parameters/Galileo_E1.h @@ -103,7 +103,7 @@ const std::vector> PAGE_TYPE_bit({{1, 6}}); /*Page 1 - Word type 1: Ephemeris (1/4)*/ const std::vector> IOD_nav_1_bit({{7, 10}}); const std::vector> T0E_1_bit({{17, 14}}); -const double t0e_1_LSB = 60; +const int32_t t0e_1_LSB = 60; const std::vector> M0_1_bit({{31, 32}}); const double M0_1_LSB = PI_TWO_N31; const std::vector> e_1_bit({{63, 32}}); @@ -151,7 +151,7 @@ const double C_ic_4_LSB = TWO_N29; const std::vector> C_is_4_bit({{39, 16}}); const double C_is_4_LSB = TWO_N29; const std::vector> t0c_4_bit({{55, 14}}); // -const double t0c_4_LSB = 60; +const int32_t t0c_4_LSB = 60; const std::vector> af0_4_bit({{69, 31}}); // const double af0_4_LSB = TWO_N34; const std::vector> af1_4_bit({{100, 21}}); // @@ -198,7 +198,7 @@ const std::vector> A1_6_bit({{39, 24}}); const double A1_6_LSB = TWO_N50; const std::vector> Delta_tLS_6_bit({{63, 8}}); const std::vector> t0t_6_bit({{71, 8}}); -const double t0t_6_LSB = 3600; +const int32_t t0t_6_LSB = 3600; const std::vector> WNot_6_bit({{79, 8}}); const std::vector> WN_LSF_6_bit({{87, 8}}); const std::vector> DN_6_bit({{95, 3}}); @@ -294,7 +294,7 @@ const double A_0G_10_LSB = TWO_N35; const std::vector> A_1G_10_bit({{103, 12}}); const double A_1G_10_LSB = TWO_N51; const std::vector> t_0G_10_bit({{115, 8}}); -const double t_0G_10_LSB = 3600; +const int32_t t_0G_10_LSB = 3600; const std::vector> WN_0G_10_bit({{123, 6}}); diff --git a/src/core/system_parameters/Galileo_E5a.h b/src/core/system_parameters/Galileo_E5a.h index c1cf20350..cf7e56ce1 100644 --- a/src/core/system_parameters/Galileo_E5a.h +++ b/src/core/system_parameters/Galileo_E5a.h @@ -83,7 +83,7 @@ const std::vector> FNAV_PAGE_TYPE_bit({{1, 6}}); const std::vector> FNAV_SV_ID_PRN_1_bit({{7, 6}}); const std::vector> FNAV_IODnav_1_bit({{13, 10}}); const std::vector> FNAV_t0c_1_bit({{23, 14}}); -const double FNAV_t0c_1_LSB = 60; +const int32_t FNAV_t0c_1_LSB = 60; const std::vector> FNAV_af0_1_bit({{37, 31}}); const double FNAV_af0_1_LSB = TWO_N34; const std::vector> FNAV_af1_1_bit({{68, 21}}); @@ -143,7 +143,7 @@ const double FNAV_Crc_3_LSB = TWO_N5; const std::vector> FNAV_Crs_3_bit({{145, 16}}); const double FNAV_Crs_3_LSB = TWO_N5; const std::vector> FNAV_t0e_3_bit({{161, 14}}); -const double FNAV_t0e_3_LSB = 60; +const int32_t FNAV_t0e_3_LSB = 60; const std::vector> FNAV_WN_3_bit({{175, 12}}); const std::vector> FNAV_TOW_3_bit({{187, 20}}); @@ -159,13 +159,13 @@ const std::vector> FNAV_A1_4_bit({{81, 24}}); const double FNAV_A1_4_LSB = TWO_N50; const std::vector> FNAV_deltatls_4_bit({{105, 8}}); const std::vector> FNAV_t0t_4_bit({{113, 8}}); -const double FNAV_t0t_4_LSB = 3600; +const int32_t FNAV_t0t_4_LSB = 3600; const std::vector> FNAV_WNot_4_bit({{121, 8}}); const std::vector> FNAV_WNlsf_4_bit({{129, 8}}); const std::vector> FNAV_DN_4_bit({{137, 3}}); const std::vector> FNAV_deltatlsf_4_bit({{140, 8}}); const std::vector> FNAV_t0g_4_bit({{148, 8}}); -const double FNAV_t0g_4_LSB = 3600; +const int32_t FNAV_t0g_4_LSB = 3600; const std::vector> FNAV_A0g_4_bit({{156, 16}}); const double FNAV_A0g_4_LSB = TWO_N35; const std::vector> FNAV_A1g_4_bit({{172, 12}}); diff --git a/src/core/system_parameters/galileo_ephemeris.cc b/src/core/system_parameters/galileo_ephemeris.cc index 0c1021048..a606b2d20 100644 --- a/src/core/system_parameters/galileo_ephemeris.cc +++ b/src/core/system_parameters/galileo_ephemeris.cc @@ -54,26 +54,26 @@ Galileo_Ephemeris::Galileo_Ephemeris() C_rs_3 = 0.0; // Amplitude of the sine harmonic correction term to the orbit radius [meters] C_ic_4 = 0.0; // Amplitude of the cosine harmonic correction term to the angle of inclination [radians] C_is_4 = 0.0; // Amplitude of the sine harmonic correction term to the angle of inclination [radians] - t0e_1 = 0.0; // Ephemeris reference time [s] + t0e_1 = 0; // Ephemeris reference time [s] // Clock correction parameters - t0c_4 = 0.0; // Clock correction data reference Time of Week [sec] + t0c_4 = 0; // Clock correction data reference Time of Week [sec] af0_4 = 0.0; // SV clock bias correction coefficient [s] af1_4 = 0.0; // SV clock drift correction coefficient [s/s] af2_4 = 0.0; // SV clock drift rate correction coefficient [s/s^2] // GST - WN_5 = 0.0; - TOW_5 = 0.0; + WN_5 = 0; + TOW_5 = 0; // SV status - SISA_3 = 0.0; - E5a_HS = 0U; - E5b_HS_5 = 0.0; - E1B_HS_5 = 0.0; + SISA_3 = 0; + E5a_HS = 0; + E5b_HS_5 = 0; + E1B_HS_5 = 0; E5a_DVS = false; - E5b_DVS_5 = 0.0; - E1B_DVS_5 = 0.0; + E5b_DVS_5 = false; + E1B_DVS_5 = false; BGD_E1E5a_5 = 0.0; // E1-E5a Broadcast Group Delay [s] BGD_E1E5b_5 = 0.0; // E1-E5b Broadcast Group Delay [s] diff --git a/src/core/system_parameters/galileo_ephemeris.h b/src/core/system_parameters/galileo_ephemeris.h index fd844adf2..75d2bdbd9 100644 --- a/src/core/system_parameters/galileo_ephemeris.h +++ b/src/core/system_parameters/galileo_ephemeris.h @@ -67,29 +67,29 @@ public: double C_rs_3; //!< Amplitude of the sine harmonic correction term to the orbit radius [meters] double C_ic_4; //!< Amplitude of the cosine harmonic correction term to the angle of inclination [radians] double C_is_4; //!< Amplitude of the sine harmonic correction term to the angle of inclination [radians] - double t0e_1; //!< Ephemeris reference time [s] + int32_t t0e_1; //!< Ephemeris reference time [s] /*Clock correction parameters*/ - double t0c_4; //!< Clock correction data reference Time of Week [sec] - double af0_4; //!< SV clock bias correction coefficient [s] - double af1_4; //!< SV clock drift correction coefficient [s/s] - double af2_4; //!< SV clock drift rate correction coefficient [s/s^2] + int32_t t0c_4; //!< Clock correction data reference Time of Week [sec] + double af0_4; //!< SV clock bias correction coefficient [s] + double af1_4; //!< SV clock drift correction coefficient [s/s] + double af2_4; //!< SV clock drift rate correction coefficient [s/s^2] /*GST*/ - //Not belong to ephemeris set (page 1 to 4) - double WN_5; //!< Week number - double TOW_5; //!< Time of Week + // Not belong to ephemeris set (page 1 to 4) + int32_t WN_5; //!< Week number + int32_t TOW_5; //!< Time of Week double Galileo_satClkDrift; double Galileo_dtr; //!< relativistic clock correction term // SV status - double SISA_3; - uint32_t E5a_HS; //!< E5a Signal Health Status - double E5b_HS_5; //!< E5b Signal Health Status - double E1B_HS_5; //!< E1B Signal Health Status + int32_t SISA_3; + int32_t E5a_HS; //!< E5a Signal Health Status + int32_t E5b_HS_5; //!< E5b Signal Health Status + int32_t E1B_HS_5; //!< E1B Signal Health Status bool E5a_DVS; //!< E5a Data Validity Status - double E5b_DVS_5; //!< E5b Data Validity Status - double E1B_DVS_5; //!< E1B Data Validity Status + bool E5b_DVS_5; //!< E5b Data Validity Status + bool E1B_DVS_5; //!< E1B Data Validity Status double BGD_E1E5a_5; //!< E1-E5a Broadcast Group Delay [s] double BGD_E1E5b_5; //!< E1-E5b Broadcast Group Delay [s] diff --git a/src/core/system_parameters/galileo_fnav_message.cc b/src/core/system_parameters/galileo_fnav_message.cc index 660f7c413..c6026c7b7 100644 --- a/src/core/system_parameters/galileo_fnav_message.cc +++ b/src/core/system_parameters/galileo_fnav_message.cc @@ -70,11 +70,11 @@ void Galileo_Fnav_Message::reset() // health and Data validity status FNAV_SV_ID_PRN_1 = 0; FNAV_IODnav_1 = -1; - FNAV_t0c_1 = 0.0; + FNAV_t0c_1 = 0; FNAV_af0_1 = 0.0; FNAV_af1_1 = 0.0; FNAV_af2_1 = 0.0; - FNAV_SISA_1 = 0.0; + FNAV_SISA_1 = 0; FNAV_ai0_1 = 0.0; FNAV_ai1_1 = 0.0; FNAV_ai2_1 = 0.0; @@ -85,8 +85,8 @@ void Galileo_Fnav_Message::reset() FNAV_region5_1 = false; FNAV_BGD_1 = 0.0; FNAV_E5ahs_1 = 0; - FNAV_WN_1 = 0.0; - FNAV_TOW_1 = 0.0; + FNAV_WN_1 = 0; + FNAV_TOW_1 = 0; FNAV_E5advs_1 = false; // WORD 2 Ephemeris (1/3) and GST @@ -97,8 +97,8 @@ void Galileo_Fnav_Message::reset() FNAV_a12_2 = 0.0; FNAV_omega0_2 = 0.0; FNAV_idot_2 = 0.0; - FNAV_WN_2 = 0.0; - FNAV_TOW_2 = 0.0; + FNAV_WN_2 = 0; + FNAV_TOW_2 = 0; // WORD 3 Ephemeris (2/3) and GST FNAV_IODnav_3 = -3; @@ -109,9 +109,9 @@ void Galileo_Fnav_Message::reset() FNAV_Cus_3 = 0.0; FNAV_Crc_3 = 0.0; FNAV_Crs_3 = 0.0; - FNAV_t0e_3 = 0.0; - FNAV_WN_3 = 0.0; - FNAV_TOW_3 = 0.0; + FNAV_t0e_3 = 0; + FNAV_WN_3 = 0; + FNAV_TOW_3 = 0; // WORD 4 Ephemeris (3/3), GST-UTC conversion, GST-GPS conversion and TOW. // Note that the clock is repeated in this page type @@ -120,17 +120,17 @@ void Galileo_Fnav_Message::reset() FNAV_Cis_4 = 0.0; FNAV_A0_4 = 0.0; FNAV_A1_4 = 0.0; - FNAV_deltatls_4 = 0.0; - FNAV_t0t_4 = 0.0; - FNAV_WNot_4 = 0.0; - FNAV_WNlsf_4 = 0.0; - FNAV_DN_4 = 0.0; - FNAV_deltatlsf_4 = 0.0; - FNAV_t0g_4 = 0.0; + FNAV_deltatls_4 = 0; + FNAV_t0t_4 = 0; + FNAV_WNot_4 = 0; + FNAV_WNlsf_4 = 0; + FNAV_DN_4 = 0; + FNAV_deltatlsf_4 = 0; + FNAV_t0g_4 = 0; FNAV_A0g_4 = 0.0; FNAV_A1g_4 = 0.0; - FNAV_WN0g_4 = 0.0; - FNAV_TOW_4 = 0.0; + FNAV_WN0g_4 = 0; + FNAV_TOW_4 = 0; // WORD 5 Almanac (SVID1 and SVID2(1/2)), Week Number and almanac reference time FNAV_IODa_5 = 0; @@ -238,7 +238,7 @@ void Galileo_Fnav_Message::decode_page(const std::string& data) case 1: // SVID, Clock correction, SISA, Ionospheric correction, BGD, GST, Signal health and Data validity status FNAV_SV_ID_PRN_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_SV_ID_PRN_1_bit)); FNAV_IODnav_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_IODnav_1_bit)); - FNAV_t0c_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_t0c_1_bit)); + FNAV_t0c_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_t0c_1_bit)); FNAV_t0c_1 *= FNAV_t0c_1_LSB; FNAV_af0_1 = static_cast(read_navigation_signed(data_bits, FNAV_af0_1_bit)); FNAV_af0_1 *= FNAV_af0_1_LSB; @@ -246,7 +246,7 @@ void Galileo_Fnav_Message::decode_page(const std::string& data) FNAV_af1_1 *= FNAV_af1_1_LSB; FNAV_af2_1 = static_cast(read_navigation_signed(data_bits, FNAV_af2_1_bit)); FNAV_af2_1 *= FNAV_af2_1_LSB; - FNAV_SISA_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_SISA_1_bit)); + FNAV_SISA_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_SISA_1_bit)); FNAV_ai0_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_ai0_1_bit)); FNAV_ai0_1 *= FNAV_ai0_1_LSB; FNAV_ai1_1 = static_cast(read_navigation_signed(data_bits, FNAV_ai1_1_bit)); @@ -261,8 +261,8 @@ void Galileo_Fnav_Message::decode_page(const std::string& data) FNAV_BGD_1 = static_cast(read_navigation_signed(data_bits, FNAV_BGD_1_bit)); FNAV_BGD_1 *= FNAV_BGD_1_LSB; FNAV_E5ahs_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_E5ahs_1_bit)); - FNAV_WN_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_WN_1_bit)); - FNAV_TOW_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_TOW_1_bit)); + FNAV_WN_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_WN_1_bit)); + FNAV_TOW_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_TOW_1_bit)); FNAV_E5advs_1 = static_cast(read_navigation_unsigned(data_bits, FNAV_E5advs_1_bit)); flag_TOW_1 = true; flag_TOW_set = true; @@ -282,8 +282,8 @@ void Galileo_Fnav_Message::decode_page(const std::string& data) FNAV_omega0_2 *= FNAV_omega0_2_LSB; FNAV_idot_2 = static_cast(read_navigation_signed(data_bits, FNAV_idot_2_bit)); FNAV_idot_2 *= FNAV_idot_2_LSB; - FNAV_WN_2 = static_cast(read_navigation_unsigned(data_bits, FNAV_WN_2_bit)); - FNAV_TOW_2 = static_cast(read_navigation_unsigned(data_bits, FNAV_TOW_2_bit)); + FNAV_WN_2 = static_cast(read_navigation_unsigned(data_bits, FNAV_WN_2_bit)); + FNAV_TOW_2 = static_cast(read_navigation_unsigned(data_bits, FNAV_TOW_2_bit)); flag_TOW_2 = true; flag_TOW_set = true; flag_ephemeris_1 = true; @@ -304,10 +304,10 @@ void Galileo_Fnav_Message::decode_page(const std::string& data) FNAV_Crc_3 *= FNAV_Crc_3_LSB; FNAV_Crs_3 = static_cast(read_navigation_signed(data_bits, FNAV_Crs_3_bit)); FNAV_Crs_3 *= FNAV_Crs_3_LSB; - FNAV_t0e_3 = static_cast(read_navigation_unsigned(data_bits, FNAV_t0e_3_bit)); + FNAV_t0e_3 = static_cast(read_navigation_unsigned(data_bits, FNAV_t0e_3_bit)); FNAV_t0e_3 *= FNAV_t0e_3_LSB; - FNAV_WN_3 = static_cast(read_navigation_unsigned(data_bits, FNAV_WN_3_bit)); - FNAV_TOW_3 = static_cast(read_navigation_unsigned(data_bits, FNAV_TOW_3_bit)); + FNAV_WN_3 = static_cast(read_navigation_unsigned(data_bits, FNAV_WN_3_bit)); + FNAV_TOW_3 = static_cast(read_navigation_unsigned(data_bits, FNAV_TOW_3_bit)); flag_TOW_3 = true; flag_TOW_set = true; flag_ephemeris_2 = true; @@ -323,20 +323,20 @@ void Galileo_Fnav_Message::decode_page(const std::string& data) FNAV_A1_4 = static_cast(read_navigation_signed(data_bits, FNAV_A1_4_bit)); FNAV_A1_4 *= FNAV_A1_4_LSB; FNAV_deltatls_4 = static_cast(read_navigation_signed(data_bits, FNAV_deltatls_4_bit)); - FNAV_t0t_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_t0t_4_bit)); + FNAV_t0t_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_t0t_4_bit)); FNAV_t0t_4 *= FNAV_t0t_4_LSB; - FNAV_WNot_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_WNot_4_bit)); - FNAV_WNlsf_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_WNlsf_4_bit)); - FNAV_DN_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_DN_4_bit)); - FNAV_deltatlsf_4 = static_cast(read_navigation_signed(data_bits, FNAV_deltatlsf_4_bit)); - FNAV_t0g_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_t0g_4_bit)); + FNAV_WNot_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_WNot_4_bit)); + FNAV_WNlsf_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_WNlsf_4_bit)); + FNAV_DN_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_DN_4_bit)); + FNAV_deltatlsf_4 = static_cast(read_navigation_signed(data_bits, FNAV_deltatlsf_4_bit)); + FNAV_t0g_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_t0g_4_bit)); FNAV_t0g_4 *= FNAV_t0g_4_LSB; FNAV_A0g_4 = static_cast(read_navigation_signed(data_bits, FNAV_A0g_4_bit)); FNAV_A0g_4 *= FNAV_A0g_4_LSB; FNAV_A1g_4 = static_cast(read_navigation_signed(data_bits, FNAV_A1g_4_bit)); FNAV_A1g_4 *= FNAV_A1g_4_LSB; - FNAV_WN0g_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_WN0g_4_bit)); - FNAV_TOW_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_TOW_4_bit)); + FNAV_WN0g_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_WN0g_4_bit)); + FNAV_TOW_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_TOW_4_bit)); flag_TOW_4 = true; flag_TOW_set = true; flag_ephemeris_3 = true; diff --git a/src/core/system_parameters/galileo_fnav_message.h b/src/core/system_parameters/galileo_fnav_message.h index ff69df958..1bb0ae31d 100644 --- a/src/core/system_parameters/galileo_fnav_message.h +++ b/src/core/system_parameters/galileo_fnav_message.h @@ -95,11 +95,11 @@ public: // health and Data validity status int32_t FNAV_SV_ID_PRN_1; int32_t FNAV_IODnav_1; - double FNAV_t0c_1; + int32_t FNAV_t0c_1; double FNAV_af0_1; double FNAV_af1_1; double FNAV_af2_1; - double FNAV_SISA_1; + int32_t FNAV_SISA_1; double FNAV_ai0_1; double FNAV_ai1_1; double FNAV_ai2_1; @@ -110,8 +110,8 @@ public: bool FNAV_region5_1; double FNAV_BGD_1; int32_t FNAV_E5ahs_1; - double FNAV_WN_1; - double FNAV_TOW_1; + int32_t FNAV_WN_1; + int32_t FNAV_TOW_1; bool FNAV_E5advs_1; // WORD 2 Ephemeris (1/3) and GST @@ -122,8 +122,8 @@ public: double FNAV_a12_2; double FNAV_omega0_2; double FNAV_idot_2; - double FNAV_WN_2; - double FNAV_TOW_2; + int32_t FNAV_WN_2; + int32_t FNAV_TOW_2; // WORD 3 Ephemeris (2/3) and GST int32_t FNAV_IODnav_3; @@ -134,9 +134,9 @@ public: double FNAV_Cus_3; double FNAV_Crc_3; double FNAV_Crs_3; - double FNAV_t0e_3; - double FNAV_WN_3; - double FNAV_TOW_3; + int32_t FNAV_t0e_3; + int32_t FNAV_WN_3; + int32_t FNAV_TOW_3; // WORD 4 Ephemeris (3/3), GST-UTC conversion, GST-GPS conversion and TOW. // Note that the clock is repeated in this page type @@ -145,17 +145,17 @@ public: double FNAV_Cis_4; double FNAV_A0_4; double FNAV_A1_4; - double FNAV_deltatls_4; - double FNAV_t0t_4; - double FNAV_WNot_4; - double FNAV_WNlsf_4; - double FNAV_DN_4; - double FNAV_deltatlsf_4; - double FNAV_t0g_4; + int32_t FNAV_deltatls_4; + int32_t FNAV_t0t_4; + int32_t FNAV_WNot_4; + int32_t FNAV_WNlsf_4; + int32_t FNAV_DN_4; + int32_t FNAV_deltatlsf_4; + int32_t FNAV_t0g_4; double FNAV_A0g_4; double FNAV_A1g_4; - double FNAV_WN0g_4; - double FNAV_TOW_4; + int32_t FNAV_WN0g_4; + int32_t FNAV_TOW_4; // WORD 5 Almanac (SVID1 and SVID2(1/2)), Week Number and almanac reference time int32_t FNAV_IODa_5; diff --git a/src/core/system_parameters/galileo_iono.cc b/src/core/system_parameters/galileo_iono.cc index d79b2a319..440abbc44 100644 --- a/src/core/system_parameters/galileo_iono.cc +++ b/src/core/system_parameters/galileo_iono.cc @@ -45,6 +45,6 @@ Galileo_Iono::Galileo_Iono() Region4_flag_5 = false; // Ionospheric Disturbance Flag for region 4 Region5_flag_5 = false; // Ionospheric Disturbance Flag for region 5 - TOW_5 = 0.0; - WN_5 = 0.0; + TOW_5 = 0; + WN_5 = 0; } diff --git a/src/core/system_parameters/galileo_iono.h b/src/core/system_parameters/galileo_iono.h index 90c861c12..ab36199c0 100644 --- a/src/core/system_parameters/galileo_iono.h +++ b/src/core/system_parameters/galileo_iono.h @@ -55,8 +55,8 @@ public: bool Region5_flag_5; //!< Ionospheric Disturbance Flag for region 5 // from page 5 (UTC) to have a timestamp - double TOW_5; //!< UTC data reference Time of Week [s] - double WN_5; //!< UTC data reference Week number [week] + int32_t TOW_5; //!< UTC data reference Time of Week [s] + int32_t WN_5; //!< UTC data reference Week number [week] /*! * Default constructor diff --git a/src/core/system_parameters/galileo_navigation_message.cc b/src/core/system_parameters/galileo_navigation_message.cc index 51c28068d..650ed88bd 100644 --- a/src/core/system_parameters/galileo_navigation_message.cc +++ b/src/core/system_parameters/galileo_navigation_message.cc @@ -74,7 +74,7 @@ void Galileo_Navigation_Message::reset() // Word type 1: Ephemeris (1/4) IOD_nav_1 = 0; - t0e_1 = 0.0; + t0e_1 = 0; M0_1 = 0.0; e_1 = 0.0; A_1 = 0.0; @@ -94,7 +94,7 @@ void Galileo_Navigation_Message::reset() C_us_3 = 0.0; // Amplitude of the sine harmonic correction term to the argument of latitude [radians] C_rc_3 = 0.0; // Amplitude of the cosine harmonic correction term to the orbit radius [meters] C_rs_3 = 0.0; // Amplitude of the sine harmonic correction term to the orbit radius [meters] - SISA_3 = 0.0; // + SISA_3 = 0; // // Word type 4: Ephemeris (4/4) and Clock correction parameter/ IOD_nav_4 = 0; @@ -103,7 +103,7 @@ void Galileo_Navigation_Message::reset() C_is_4 = 0.0; // Amplitude of the sine harmonic correction term to the angle of inclination [radians] // Clock correction parameters - t0c_4 = 0.0; + t0c_4 = 0; af0_4 = 0.0; af1_4 = 0.0; af2_4 = 0.0; @@ -129,20 +129,20 @@ void Galileo_Navigation_Message::reset() E1B_DVS_5 = 0; // GST - WN_5 = 0.0; - TOW_5 = 0.0; + WN_5 = 0; + TOW_5 = 0; spare_5 = 0.0; // Word type 6: GST-UTC conversion parameters A0_6 = 0.0; A1_6 = 0.0; - Delta_tLS_6 = 0.0; - t0t_6 = 0.0; - WNot_6 = 0.0; + Delta_tLS_6 = 0; + t0t_6 = 0; + WNot_6 = 0; WN_LSF_6 = 0; DN_6 = 0; - Delta_tLSF_6 = 0.0; - TOW_6 = 0.0; + Delta_tLSF_6 = 0; + TOW_6 = 0; // Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number IOD_a_7 = 0; @@ -199,13 +199,13 @@ void Galileo_Navigation_Message::reset() // GST-GPS A_0G_10 = 0.0; A_1G_10 = 0.0; - t_0G_10 = 0.0; - WN_0G_10 = 0.0; + t_0G_10 = 0; + WN_0G_10 = 0; // Word type 0: I/NAV Spare Word - Time_0 = 0.0; - WN_0 = 0.0; - TOW_0 = 0.0; + Time_0 = 0; + WN_0 = 0; + TOW_0 = 0; flag_TOW_6 = false; @@ -653,7 +653,7 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char* data_jk) case 1: // Word type 1: Ephemeris (1/4) IOD_nav_1 = static_cast(read_navigation_unsigned(data_jk_bits, IOD_nav_1_bit)); DLOG(INFO) << "IOD_nav_1= " << IOD_nav_1; - t0e_1 = static_cast(read_navigation_unsigned(data_jk_bits, T0E_1_bit)); + t0e_1 = static_cast(read_navigation_unsigned(data_jk_bits, T0E_1_bit)); t0e_1 = t0e_1 * t0e_1_LSB; DLOG(INFO) << "t0e_1= " << t0e_1; M0_1 = static_cast(read_navigation_signed(data_jk_bits, M0_1_bit)); @@ -709,7 +709,7 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char* data_jk) C_rs_3 = static_cast(read_navigation_signed(data_jk_bits, C_rs_3_bit)); C_rs_3 = C_rs_3 * C_rs_3_LSB; DLOG(INFO) << "C_rs_3= " << C_rs_3; - SISA_3 = static_cast(read_navigation_unsigned(data_jk_bits, SISA_3_bit)); + SISA_3 = static_cast(read_navigation_unsigned(data_jk_bits, SISA_3_bit)); DLOG(INFO) << "SISA_3= " << SISA_3; flag_ephemeris_3 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; @@ -727,7 +727,7 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char* data_jk) C_is_4 = C_is_4 * C_is_4_LSB; DLOG(INFO) << "C_is_4= " << C_is_4; // Clock correction parameters - t0c_4 = static_cast(read_navigation_unsigned(data_jk_bits, t0c_4_bit)); + t0c_4 = static_cast(read_navigation_unsigned(data_jk_bits, t0c_4_bit)); t0c_4 = t0c_4 * t0c_4_LSB; DLOG(INFO) << "t0c_4= " << t0c_4; af0_4 = static_cast(read_navigation_signed(data_jk_bits, af0_4_bit)); @@ -777,14 +777,14 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char* data_jk) DLOG(INFO) << "E5b_HS_5= " << E5b_HS_5; E1B_HS_5 = static_cast(read_navigation_unsigned(data_jk_bits, E1B_HS_5_bit)); DLOG(INFO) << "E1B_HS_5= " << E1B_HS_5; - E5b_DVS_5 = static_cast(read_navigation_unsigned(data_jk_bits, E5b_DVS_5_bit)); + E5b_DVS_5 = static_cast(read_navigation_unsigned(data_jk_bits, E5b_DVS_5_bit)); DLOG(INFO) << "E5b_DVS_5= " << E5b_DVS_5; - E1B_DVS_5 = static_cast(read_navigation_unsigned(data_jk_bits, E1B_DVS_5_bit)); + E1B_DVS_5 = static_cast(read_navigation_unsigned(data_jk_bits, E1B_DVS_5_bit)); DLOG(INFO) << "E1B_DVS_5= " << E1B_DVS_5; // GST - WN_5 = static_cast(read_navigation_unsigned(data_jk_bits, WN_5_bit)); + WN_5 = static_cast(read_navigation_unsigned(data_jk_bits, WN_5_bit)); DLOG(INFO) << "WN_5= " << WN_5; - TOW_5 = static_cast(read_navigation_unsigned(data_jk_bits, TOW_5_bit)); + TOW_5 = static_cast(read_navigation_unsigned(data_jk_bits, TOW_5_bit)); DLOG(INFO) << "TOW_5= " << TOW_5; flag_TOW_5 = true; // set to false externally spare_5 = static_cast(read_navigation_unsigned(data_jk_bits, spare_5_bit)); @@ -801,20 +801,20 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char* data_jk) A1_6 = static_cast(read_navigation_signed(data_jk_bits, A1_6_bit)); A1_6 = A1_6 * A1_6_LSB; DLOG(INFO) << "A1_6= " << A1_6; - Delta_tLS_6 = static_cast(read_navigation_signed(data_jk_bits, Delta_tLS_6_bit)); + Delta_tLS_6 = static_cast(read_navigation_signed(data_jk_bits, Delta_tLS_6_bit)); DLOG(INFO) << "Delta_tLS_6= " << Delta_tLS_6; - t0t_6 = static_cast(read_navigation_unsigned(data_jk_bits, t0t_6_bit)); + t0t_6 = static_cast(read_navigation_unsigned(data_jk_bits, t0t_6_bit)); t0t_6 = t0t_6 * t0t_6_LSB; DLOG(INFO) << "t0t_6= " << t0t_6; - WNot_6 = static_cast(read_navigation_unsigned(data_jk_bits, WNot_6_bit)); + WNot_6 = static_cast(read_navigation_unsigned(data_jk_bits, WNot_6_bit)); DLOG(INFO) << "WNot_6= " << WNot_6; WN_LSF_6 = static_cast(read_navigation_unsigned(data_jk_bits, WN_LSF_6_bit)); DLOG(INFO) << "WN_LSF_6= " << WN_LSF_6; DN_6 = static_cast(read_navigation_unsigned(data_jk_bits, DN_6_bit)); DLOG(INFO) << "DN_6= " << DN_6; - Delta_tLSF_6 = static_cast(read_navigation_signed(data_jk_bits, Delta_tLSF_6_bit)); + Delta_tLSF_6 = static_cast(read_navigation_signed(data_jk_bits, Delta_tLSF_6_bit)); DLOG(INFO) << "Delta_tLSF_6= " << Delta_tLSF_6; - TOW_6 = static_cast(read_navigation_unsigned(data_jk_bits, TOW_6_bit)); + TOW_6 = static_cast(read_navigation_unsigned(data_jk_bits, TOW_6_bit)); DLOG(INFO) << "TOW_6= " << TOW_6; flag_TOW_6 = true; // set to false externally flag_utc_model = true; // set to false externally @@ -963,11 +963,11 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char* data_jk) A_1G_10 = A_1G_10 * A_1G_10_LSB; flag_GGTO_2 = true; DLOG(INFO) << "A_1G_10= " << A_1G_10; - t_0G_10 = static_cast(read_navigation_unsigned(data_jk_bits, t_0G_10_bit)); + t_0G_10 = static_cast(read_navigation_unsigned(data_jk_bits, t_0G_10_bit)); t_0G_10 = t_0G_10 * t_0G_10_LSB; flag_GGTO_3 = true; DLOG(INFO) << "t_0G_10= " << t_0G_10; - WN_0G_10 = static_cast(read_navigation_unsigned(data_jk_bits, WN_0G_10_bit)); + WN_0G_10 = static_cast(read_navigation_unsigned(data_jk_bits, WN_0G_10_bit)); flag_GGTO_4 = true; DLOG(INFO) << "WN_0G_10= " << WN_0G_10; flag_almanac_4 = true; @@ -975,11 +975,11 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char* data_jk) break; case 0: // Word type 0: I/NAV Spare Word - Time_0 = static_cast(read_navigation_unsigned(data_jk_bits, Time_0_bit)); + Time_0 = static_cast(read_navigation_unsigned(data_jk_bits, Time_0_bit)); DLOG(INFO) << "Time_0= " << Time_0; - WN_0 = static_cast(read_navigation_unsigned(data_jk_bits, WN_0_bit)); + WN_0 = static_cast(read_navigation_unsigned(data_jk_bits, WN_0_bit)); DLOG(INFO) << "WN_0= " << WN_0; - TOW_0 = static_cast(read_navigation_unsigned(data_jk_bits, TOW_0_bit)); + TOW_0 = static_cast(read_navigation_unsigned(data_jk_bits, TOW_0_bit)); DLOG(INFO) << "TOW_0= " << TOW_0; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; break; diff --git a/src/core/system_parameters/galileo_navigation_message.h b/src/core/system_parameters/galileo_navigation_message.h index 302c38424..cf1eb0a0f 100644 --- a/src/core/system_parameters/galileo_navigation_message.h +++ b/src/core/system_parameters/galileo_navigation_message.h @@ -93,7 +93,7 @@ public: // Word type 1: Ephemeris (1/4) int32_t IOD_nav_1; //!< IOD_nav page 1 - double t0e_1; //!< Ephemeris reference time [s] + int32_t t0e_1; //!< Ephemeris reference time [s] double M0_1; //!< Mean anomaly at reference time [semi-circles] double e_1; //!< Eccentricity double A_1; //!< Square root of the semi-major axis [meters^1/2] @@ -113,7 +113,7 @@ public: double C_us_3; //!< Amplitude of the sine harmonic correction term to the argument of latitude [radians] double C_rc_3; //!< Amplitude of the cosine harmonic correction term to the orbit radius [meters] double C_rs_3; //!< Amplitude of the sine harmonic correction term to the orbit radius [meters] - double SISA_3; + int32_t SISA_3; // Word type 4: Ephemeris (4/4) and Clock correction parameters*/ int32_t IOD_nav_4; // @@ -122,10 +122,10 @@ public: double C_is_4; //!< Amplitude of the sine harmonic correction term to the angle of inclination [radians] // Clock correction parameters - double t0c_4; //!< Clock correction data reference Time of Week [sec] - double af0_4; //!< SV clock bias correction coefficient [s] - double af1_4; //!< SV clock drift correction coefficient [s/s] - double af2_4; //!< clock drift rate correction coefficient [s/s^2] + int32_t t0c_4; //!< Clock correction data reference Time of Week [sec] + double af0_4; //!< SV clock bias correction coefficient [s] + double af1_4; //!< SV clock drift correction coefficient [s/s] + double af2_4; //!< clock drift rate correction coefficient [s/s^2] double spare_4; // Word type 5: Ionospheric correction, BGD, signal health and data validity status and GST*/ @@ -143,26 +143,26 @@ public: double BGD_E1E5a_5; //!< E1-E5a Broadcast Group Delay [s] double BGD_E1E5b_5; //!< E1-E5b Broadcast Group Delay [s] - int32_t E5b_HS_5; //!< E5b Signal Health Status - int32_t E1B_HS_5; //!< E1B Signal Health Status - int32_t E5b_DVS_5; //!< E5b Data Validity Status - int32_t E1B_DVS_5; //!< E1B Data Validity Status + int32_t E5b_HS_5; //!< E5b Signal Health Status + int32_t E1B_HS_5; //!< E1B Signal Health Status + bool E5b_DVS_5; //!< E5b Data Validity Status + bool E1B_DVS_5; //!< E1B Data Validity Status // GST - double WN_5; - double TOW_5; + int32_t WN_5; + int32_t TOW_5; double spare_5; // Word type 6: GST-UTC conversion parameters double A0_6; double A1_6; - double Delta_tLS_6; - double t0t_6; - double WNot_6; + int32_t Delta_tLS_6; + int32_t t0t_6; + int32_t WNot_6; int32_t WN_LSF_6; int32_t DN_6; - double Delta_tLSF_6; - double TOW_6; + int32_t Delta_tLSF_6; + int32_t TOW_6; // Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number int32_t IOD_a_7; @@ -217,15 +217,15 @@ public: int32_t E1B_HS_10; // GST-GPS conversion - double A_0G_10; //!< Constant term of the offset Delta t systems - double A_1G_10; //!< Rate of change of the offset Delta t systems - double t_0G_10; //!< Reference time for Galileo/GPS Time Offset (GGTO) data - double WN_0G_10; //!< Week Number of Galileo/GPS Time Offset (GGTO) reference + double A_0G_10; //!< Constant term of the offset Delta t systems + double A_1G_10; //!< Rate of change of the offset Delta t systems + int32_t t_0G_10; //!< Reference time for Galileo/GPS Time Offset (GGTO) data + int32_t WN_0G_10; //!< Week Number of Galileo/GPS Time Offset (GGTO) reference // Word type 0: I/NAV Spare Word - double Time_0; - double WN_0; - double TOW_0; + int32_t Time_0; + int32_t WN_0; + int32_t TOW_0; double Galileo_satClkDrift; double Galileo_dtr; //!< Relativistic clock correction term diff --git a/src/core/system_parameters/galileo_utc_model.cc b/src/core/system_parameters/galileo_utc_model.cc index e51c7c2f2..96ca127e7 100644 --- a/src/core/system_parameters/galileo_utc_model.cc +++ b/src/core/system_parameters/galileo_utc_model.cc @@ -36,28 +36,28 @@ Galileo_Utc_Model::Galileo_Utc_Model() // Word type 6: GST-UTC conversion parameters A0_6 = 0.0; A1_6 = 0.0; - Delta_tLS_6 = 0.0; - t0t_6 = 0.0; - WNot_6 = 0.0; + Delta_tLS_6 = 0; + t0t_6 = 0; + WNot_6 = 0; WN_LSF_6 = 0; DN_6 = 0; - Delta_tLSF_6 = 0.0; + Delta_tLSF_6 = 0; flag_utc_model = false; // GPS to Galileo GST conversion parameters A_0G_10 = 0.0; A_1G_10 = 0.0; - t_0G_10 = 0.0; - WN_0G_10 = 0.0; + t_0G_10 = 0; + WN_0G_10 = 0; } -double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int WN) +double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) { double t_Utc; double t_Utc_daytime; double Delta_t_Utc = 0; // Determine if the effectivity time of the leap second event is in the past - int weeksToLeapSecondEvent = WN_LSF_6 - (WN % 256); + int32_t weeksToLeapSecondEvent = WN_LSF_6 - (WN % 256); if ((weeksToLeapSecondEvent) >= 0) // is not in the past { diff --git a/src/core/system_parameters/galileo_utc_model.h b/src/core/system_parameters/galileo_utc_model.h index f91b3ded1..7e9e328b0 100644 --- a/src/core/system_parameters/galileo_utc_model.h +++ b/src/core/system_parameters/galileo_utc_model.h @@ -47,22 +47,22 @@ public: // Word type 6: GST-UTC conversion parameters double A0_6; double A1_6; - double Delta_tLS_6; - double t0t_6; //!< UTC data reference Time of Week [s] - double WNot_6; //!< UTC data reference Week number [week] + int32_t Delta_tLS_6; + int32_t t0t_6; //!< UTC data reference Time of Week [s] + int32_t WNot_6; //!< UTC data reference Week number [week] int32_t WN_LSF_6; int32_t DN_6; - double Delta_tLSF_6; + int32_t Delta_tLSF_6; bool flag_utc_model; // GPS to Galileo GST conversion parameters double A_0G_10; double A_1G_10; - double t_0G_10; - double WN_0G_10; + int32_t t_0G_10; + int32_t WN_0G_10; //double TOW_6; - double GST_to_UTC_time(double t_e, int WN); //!< GST-UTC Conversion Algorithm and Parameters + double GST_to_UTC_time(double t_e, int32_t WN); //!< GST-UTC Conversion Algorithm and Parameters /*! * Default constructor */ From 432c6b9c70bfe9ecf7c9ea86e38ffb84b32f72de Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 14 Dec 2018 02:14:43 +0100 Subject: [PATCH 2/4] Miscelaneous clang-tidy fixes --- src/algorithms/libs/rtklib/rtklib_sbas.cc | 2 +- src/algorithms/libs/rtklib/rtklib_solution.cc | 2 +- .../gnuradio_blocks/galileo_telemetry_decoder_cc.cc | 2 +- .../gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc | 2 +- .../telemetry_decoder/libs/libswiftcnav/viterbi27.c | 10 +++++----- src/core/libs/supl/asn-rrlp/OCTET_STRING.c | 6 +++--- src/core/libs/supl/asn-rrlp/ber_decoder.c | 2 +- src/core/libs/supl/asn-rrlp/constr_CHOICE.c | 4 ++-- src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c | 6 +++--- src/core/libs/supl/asn-rrlp/constr_SET_OF.c | 6 +++--- src/core/libs/supl/asn-rrlp/converter-sample.c | 4 ++-- src/core/libs/supl/asn-rrlp/xer_decoder.c | 6 +++--- src/core/libs/supl/asn-rrlp/xer_support.c | 6 +++--- src/core/libs/supl/asn-supl/GeneralizedTime.c | 2 +- src/core/libs/supl/asn-supl/OCTET_STRING.c | 6 +++--- src/core/libs/supl/asn-supl/ber_decoder.c | 2 +- src/core/libs/supl/asn-supl/constr_CHOICE.c | 4 ++-- src/core/libs/supl/asn-supl/constr_SEQUENCE.c | 6 +++--- src/core/libs/supl/asn-supl/constr_SET_OF.c | 6 +++--- src/core/libs/supl/asn-supl/xer_decoder.c | 6 +++--- src/core/libs/supl/asn-supl/xer_support.c | 6 +++--- 21 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/algorithms/libs/rtklib/rtklib_sbas.cc b/src/algorithms/libs/rtklib/rtklib_sbas.cc index 2341a30d8..d4c45aad8 100644 --- a/src/algorithms/libs/rtklib/rtklib_sbas.cc +++ b/src/algorithms/libs/rtklib/rtklib_sbas.cc @@ -645,7 +645,7 @@ int sbsreadmsgt(const char *file, int sel, gtime_t ts, gtime_t te, for (i = 0; i < n; i++) { if (!(ext = strrchr(efiles[i], '.'))) continue; - if (strcmp(ext, ".sbs") != 0 && strcmp(ext, ".SBS") && + if (strcmp(ext, ".sbs") != 0 && strcmp(ext, ".SBS") != 0 && strcmp(ext, ".ems") != 0 && strcmp(ext, ".EMS") != 0) continue; readmsgs(efiles[i], sel, ts, te, sbs); diff --git a/src/algorithms/libs/rtklib/rtklib_solution.cc b/src/algorithms/libs/rtklib/rtklib_solution.cc index fe1a7d533..e2c19cecd 100644 --- a/src/algorithms/libs/rtklib/rtklib_solution.cc +++ b/src/algorithms/libs/rtklib/rtklib_solution.cc @@ -682,7 +682,7 @@ void decode_solopt(char *buff, solopt_t *opt) trace(4, "decode_solhead: buff=%s\n", buff); - if (strncmp(buff, COMMENTH, 1) != 0 && strncmp(buff, "+", 1)) return; + if (strncmp(buff, COMMENTH, 1) != 0 && strncmp(buff, "+", 1) != 0) return; if (strstr(buff, "GPST")) opt->times = TIMES_GPST; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_cc.cc index 3a265a6d5..96d81d65a 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_cc.cc @@ -141,7 +141,7 @@ galileo_telemetry_decoder_cc::galileo_telemetry_decoder_cc( d_samples_per_symbol = 0U; d_PRN_code_period_ms = 0U; d_required_symbols = 0U; - d_frame_length_symbols = 0.0; + d_frame_length_symbols = 0U; CodeLength = 0; DataLength = 0; std::cout << "Galileo unified telemetry decoder error: Unknown frame type " << std::endl; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc index 33522ddc8..ef2988629 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc @@ -38,7 +38,7 @@ #ifndef _rotl -#define _rotl(X, N) ((X << N) ^ (X >> (32 - N))) // Used in the parity check algorithm +#define _rotl(X, N) (((X) << (N)) ^ ((X) >> (32 - (N)))) // Used in the parity check algorithm #endif using google::LogMessage; diff --git a/src/algorithms/telemetry_decoder/libs/libswiftcnav/viterbi27.c b/src/algorithms/telemetry_decoder/libs/libswiftcnav/viterbi27.c index bf14cb297..9739c2ab3 100644 --- a/src/algorithms/telemetry_decoder/libs/libswiftcnav/viterbi27.c +++ b/src/algorithms/telemetry_decoder/libs/libswiftcnav/viterbi27.c @@ -95,15 +95,15 @@ void v27_init(v27_t *v, v27_decision_t *decisions, unsigned int decisions_count, unsigned int metric,m0,m1,decision;\ metric = (v->poly->c0[i] ^ sym0) + (v->poly->c1[i] ^ sym1);\ m0 = v->old_metrics[i] + metric;\ - m1 = v->old_metrics[i+32] + (510 - metric);\ + m1 = v->old_metrics[(i)+32] + (510 - metric);\ decision = (signed int)(m0-m1) > 0;\ - v->new_metrics[2*i] = decision ? m1 : m0;\ - d->w[i/16] |= decision << ((2*i)&31);\ + v->new_metrics[2*(i)] = decision ? m1 : m0;\ + d->w[(i)/16] |= decision << ((2*(i))&31);\ m0 -= (metric+metric-510);\ m1 += (metric+metric-510);\ decision = (signed int)(m0-m1) > 0;\ - v->new_metrics[2*i+1] = decision ? m1 : m0;\ - d->w[i/16] |= decision << ((2*i+1)&31);\ + v->new_metrics[2*(i)+1] = decision ? m1 : m0;\ + d->w[(i)/16] |= decision << ((2*(i)+1)&31);\ } /** Update a v27_t decoder with a block of symbols. diff --git a/src/core/libs/supl/asn-rrlp/OCTET_STRING.c b/src/core/libs/supl/asn-rrlp/OCTET_STRING.c index 584def8b4..bd2d1d845 100644 --- a/src/core/libs/supl/asn-rrlp/OCTET_STRING.c +++ b/src/core/libs/supl/asn-rrlp/OCTET_STRING.c @@ -52,9 +52,9 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { #undef NEXT_PHASE #undef PREV_PHASE #define _CH_PHASE(ctx, inc) do { \ - if(ctx->phase == 0) \ - ctx->context = 0; \ - ctx->phase += inc; \ + if((ctx)->phase == 0) \ + (ctx)->context = 0; \ + (ctx)->phase += (inc); \ } while(0) #define NEXT_PHASE(ctx) _CH_PHASE(ctx, +1) #define PREV_PHASE(ctx) _CH_PHASE(ctx, -1) diff --git a/src/core/libs/supl/asn-rrlp/ber_decoder.c b/src/core/libs/supl/asn-rrlp/ber_decoder.c index 601f66c0b..77cb8032e 100644 --- a/src/core/libs/supl/asn-rrlp/ber_decoder.c +++ b/src/core/libs/supl/asn-rrlp/ber_decoder.c @@ -16,7 +16,7 @@ asn_dec_rval_t rval; \ rval.code = _code; \ if(opt_ctx) opt_ctx->step = step; /* Save context */ \ - if(_code == RC_OK || opt_ctx) \ + if((_code) == RC_OK || opt_ctx) \ rval.consumed = consumed_myself; \ else \ rval.consumed = 0; /* Context-free */ \ diff --git a/src/core/libs/supl/asn-rrlp/constr_CHOICE.c b/src/core/libs/supl/asn-rrlp/constr_CHOICE.c index a9eb71941..75903fde7 100644 --- a/src/core/libs/supl/asn-rrlp/constr_CHOICE.c +++ b/src/core/libs/supl/asn-rrlp/constr_CHOICE.c @@ -46,8 +46,8 @@ */ #undef NEXT_PHASE #define NEXT_PHASE(ctx) do { \ - ctx->phase++; \ - ctx->step = 0; \ + (ctx)->phase++; \ + (ctx)->step = 0; \ } while(0) /* diff --git a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c index db3c92581..aba19bd26 100644 --- a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c +++ b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c @@ -47,10 +47,10 @@ #undef NEXT_PHASE #undef PHASE_OUT #define NEXT_PHASE(ctx) do { \ - ctx->phase++; \ - ctx->step = 0; \ + (ctx)->phase++; \ + (ctx)->step = 0; \ } while(0) -#define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) +#define PHASE_OUT(ctx) do { (ctx)->phase = 10; } while(0) /* * Return a standardized complex structure. diff --git a/src/core/libs/supl/asn-rrlp/constr_SET_OF.c b/src/core/libs/supl/asn-rrlp/constr_SET_OF.c index 0bc891abf..8b9c0669a 100644 --- a/src/core/libs/supl/asn-rrlp/constr_SET_OF.c +++ b/src/core/libs/supl/asn-rrlp/constr_SET_OF.c @@ -47,10 +47,10 @@ #undef NEXT_PHASE #undef PHASE_OUT #define NEXT_PHASE(ctx) do { \ - ctx->phase++; \ - ctx->step = 0; \ + (ctx)->phase++; \ + (ctx)->step = 0; \ } while(0) -#define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) +#define PHASE_OUT(ctx) do { (ctx)->phase = 10; } while(0) /* * Return a standardized complex structure. diff --git a/src/core/libs/supl/asn-rrlp/converter-sample.c b/src/core/libs/supl/asn-rrlp/converter-sample.c index ee4abeb55..46136ebb3 100644 --- a/src/core/libs/supl/asn-rrlp/converter-sample.c +++ b/src/core/libs/supl/asn-rrlp/converter-sample.c @@ -774,11 +774,11 @@ static int write_out(const void *buffer, size_t size, void *key) { } static int argument_is_stdin(char *av[], int idx) { - if(strcmp(av[idx], "-")) { + if(strcmp(av[idx], "-") != 0) { return 0; /* Certainly not */ } else { /* This might be , unless `./program -- -` */ - if(strcmp(av[-1], "--")) + if(strcmp(av[-1], "--") != 0) return 1; else return 0; diff --git a/src/core/libs/supl/asn-rrlp/xer_decoder.c b/src/core/libs/supl/asn-rrlp/xer_decoder.c index 161dc78ce..ef5f06481 100644 --- a/src/core/libs/supl/asn-rrlp/xer_decoder.c +++ b/src/core/libs/supl/asn-rrlp/xer_decoder.c @@ -181,12 +181,12 @@ xer_check_tag(const void *buf_ptr, int size, const char *need_tag) { #define XER_GOT_BODY(chunk_buf, chunk_size, size) do { \ ssize_t converted_size = body_receiver \ (struct_key, chunk_buf, chunk_size, \ - (size_t)chunk_size < size); \ + (size_t)(chunk_size) < (size)); \ if(converted_size == -1) RETURN(RC_FAIL); \ if(converted_size == 0 \ - && size == (size_t)chunk_size) \ + && (size) == (size_t)(chunk_size)) \ RETURN(RC_WMORE); \ - chunk_size = converted_size; \ + (chunk_size) = converted_size; \ } while(0) #define XER_GOT_EMPTY() do { \ if(body_receiver(struct_key, 0, 0, size > 0) == -1) \ diff --git a/src/core/libs/supl/asn-rrlp/xer_support.c b/src/core/libs/supl/asn-rrlp/xer_support.c index 9e34e6923..cfa30e674 100644 --- a/src/core/libs/supl/asn-rrlp/xer_support.c +++ b/src/core/libs/supl/asn-rrlp/xer_support.c @@ -60,7 +60,7 @@ _charclass[256] = { #define TOKEN_CB_CALL(type, _ns, _current_too, _final) do { \ int _ret; \ pstate_e ns = _ns; \ - ssize_t _sz = (p - chunk_start) + _current_too; \ + ssize_t _sz = (p - chunk_start) + (_current_too); \ if (!_sz) { \ /* Shortcut */ \ state = _ns; \ @@ -68,11 +68,11 @@ _charclass[256] = { } \ _ret = cb(type, chunk_start, _sz, key); \ if(_ret < _sz) { \ - if(_current_too && _ret == -1) \ + if((_current_too) && _ret == -1) \ state = ns; \ goto finish; \ } \ - chunk_start = p + _current_too; \ + chunk_start = p + (_current_too); \ state = ns; \ } while(0) diff --git a/src/core/libs/supl/asn-supl/GeneralizedTime.c b/src/core/libs/supl/asn-supl/GeneralizedTime.c index 2fd63f262..3007af94e 100644 --- a/src/core/libs/supl/asn-supl/GeneralizedTime.c +++ b/src/core/libs/supl/asn-supl/GeneralizedTime.c @@ -369,7 +369,7 @@ asn_GT2time_frac(const GeneralizedTime_t *st, int *frac_value, int *frac_digits, errno = EINVAL; \ return -1; \ } else { \ - var = var * 10 + (ch - 0x30); \ + (var) = (var) * 10 + (ch - 0x30); \ buf++; \ } \ } while(0) diff --git a/src/core/libs/supl/asn-supl/OCTET_STRING.c b/src/core/libs/supl/asn-supl/OCTET_STRING.c index 584def8b4..bd2d1d845 100644 --- a/src/core/libs/supl/asn-supl/OCTET_STRING.c +++ b/src/core/libs/supl/asn-supl/OCTET_STRING.c @@ -52,9 +52,9 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { #undef NEXT_PHASE #undef PREV_PHASE #define _CH_PHASE(ctx, inc) do { \ - if(ctx->phase == 0) \ - ctx->context = 0; \ - ctx->phase += inc; \ + if((ctx)->phase == 0) \ + (ctx)->context = 0; \ + (ctx)->phase += (inc); \ } while(0) #define NEXT_PHASE(ctx) _CH_PHASE(ctx, +1) #define PREV_PHASE(ctx) _CH_PHASE(ctx, -1) diff --git a/src/core/libs/supl/asn-supl/ber_decoder.c b/src/core/libs/supl/asn-supl/ber_decoder.c index 601f66c0b..77cb8032e 100644 --- a/src/core/libs/supl/asn-supl/ber_decoder.c +++ b/src/core/libs/supl/asn-supl/ber_decoder.c @@ -16,7 +16,7 @@ asn_dec_rval_t rval; \ rval.code = _code; \ if(opt_ctx) opt_ctx->step = step; /* Save context */ \ - if(_code == RC_OK || opt_ctx) \ + if((_code) == RC_OK || opt_ctx) \ rval.consumed = consumed_myself; \ else \ rval.consumed = 0; /* Context-free */ \ diff --git a/src/core/libs/supl/asn-supl/constr_CHOICE.c b/src/core/libs/supl/asn-supl/constr_CHOICE.c index a9eb71941..75903fde7 100644 --- a/src/core/libs/supl/asn-supl/constr_CHOICE.c +++ b/src/core/libs/supl/asn-supl/constr_CHOICE.c @@ -46,8 +46,8 @@ */ #undef NEXT_PHASE #define NEXT_PHASE(ctx) do { \ - ctx->phase++; \ - ctx->step = 0; \ + (ctx)->phase++; \ + (ctx)->step = 0; \ } while(0) /* diff --git a/src/core/libs/supl/asn-supl/constr_SEQUENCE.c b/src/core/libs/supl/asn-supl/constr_SEQUENCE.c index db3c92581..aba19bd26 100644 --- a/src/core/libs/supl/asn-supl/constr_SEQUENCE.c +++ b/src/core/libs/supl/asn-supl/constr_SEQUENCE.c @@ -47,10 +47,10 @@ #undef NEXT_PHASE #undef PHASE_OUT #define NEXT_PHASE(ctx) do { \ - ctx->phase++; \ - ctx->step = 0; \ + (ctx)->phase++; \ + (ctx)->step = 0; \ } while(0) -#define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) +#define PHASE_OUT(ctx) do { (ctx)->phase = 10; } while(0) /* * Return a standardized complex structure. diff --git a/src/core/libs/supl/asn-supl/constr_SET_OF.c b/src/core/libs/supl/asn-supl/constr_SET_OF.c index 0bc891abf..8b9c0669a 100644 --- a/src/core/libs/supl/asn-supl/constr_SET_OF.c +++ b/src/core/libs/supl/asn-supl/constr_SET_OF.c @@ -47,10 +47,10 @@ #undef NEXT_PHASE #undef PHASE_OUT #define NEXT_PHASE(ctx) do { \ - ctx->phase++; \ - ctx->step = 0; \ + (ctx)->phase++; \ + (ctx)->step = 0; \ } while(0) -#define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) +#define PHASE_OUT(ctx) do { (ctx)->phase = 10; } while(0) /* * Return a standardized complex structure. diff --git a/src/core/libs/supl/asn-supl/xer_decoder.c b/src/core/libs/supl/asn-supl/xer_decoder.c index 161dc78ce..ef5f06481 100644 --- a/src/core/libs/supl/asn-supl/xer_decoder.c +++ b/src/core/libs/supl/asn-supl/xer_decoder.c @@ -181,12 +181,12 @@ xer_check_tag(const void *buf_ptr, int size, const char *need_tag) { #define XER_GOT_BODY(chunk_buf, chunk_size, size) do { \ ssize_t converted_size = body_receiver \ (struct_key, chunk_buf, chunk_size, \ - (size_t)chunk_size < size); \ + (size_t)(chunk_size) < (size)); \ if(converted_size == -1) RETURN(RC_FAIL); \ if(converted_size == 0 \ - && size == (size_t)chunk_size) \ + && (size) == (size_t)(chunk_size)) \ RETURN(RC_WMORE); \ - chunk_size = converted_size; \ + (chunk_size) = converted_size; \ } while(0) #define XER_GOT_EMPTY() do { \ if(body_receiver(struct_key, 0, 0, size > 0) == -1) \ diff --git a/src/core/libs/supl/asn-supl/xer_support.c b/src/core/libs/supl/asn-supl/xer_support.c index 9e34e6923..cfa30e674 100644 --- a/src/core/libs/supl/asn-supl/xer_support.c +++ b/src/core/libs/supl/asn-supl/xer_support.c @@ -60,7 +60,7 @@ _charclass[256] = { #define TOKEN_CB_CALL(type, _ns, _current_too, _final) do { \ int _ret; \ pstate_e ns = _ns; \ - ssize_t _sz = (p - chunk_start) + _current_too; \ + ssize_t _sz = (p - chunk_start) + (_current_too); \ if (!_sz) { \ /* Shortcut */ \ state = _ns; \ @@ -68,11 +68,11 @@ _charclass[256] = { } \ _ret = cb(type, chunk_start, _sz, key); \ if(_ret < _sz) { \ - if(_current_too && _ret == -1) \ + if((_current_too) && _ret == -1) \ state = ns; \ goto finish; \ } \ - chunk_start = p + _current_too; \ + chunk_start = p + (_current_too); \ state = ns; \ } while(0) From c176e512656d078e5a6916498c17f9be9b9c5d7f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 14 Dec 2018 02:31:01 +0100 Subject: [PATCH 3/4] Improve data types for GPS navigation messages --- src/core/libs/gnss_sdr_supl_client.cc | 14 ++-- src/core/system_parameters/GPS_CNAV.h | 18 +++--- src/core/system_parameters/GPS_L1_CA.h | 4 +- .../system_parameters/galileo_fnav_message.cc | 2 +- .../galileo_navigation_message.cc | 4 +- .../system_parameters/gps_cnav_ephemeris.cc | 10 +-- .../system_parameters/gps_cnav_ephemeris.h | 10 +-- .../gps_cnav_navigation_message.cc | 22 +++---- .../gps_cnav_navigation_message.h | 2 +- .../system_parameters/gps_cnav_utc_model.cc | 6 +- .../system_parameters/gps_cnav_utc_model.h | 18 +++--- src/core/system_parameters/gps_ephemeris.cc | 16 ++--- src/core/system_parameters/gps_ephemeris.h | 18 +++--- .../gps_navigation_message.cc | 64 +++++++++---------- .../gps_navigation_message.h | 33 +++++----- src/core/system_parameters/gps_utc_model.cc | 9 +-- src/core/system_parameters/gps_utc_model.h | 17 ++--- 17 files changed, 135 insertions(+), 132 deletions(-) diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index 46b0b0031..0311892bd 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -220,12 +220,12 @@ void gnss_sdr_supl_client::read_supl_data() { gps_utc.d_A0 = static_cast(assist.utc.a0) * pow(2.0, -30); gps_utc.d_A1 = static_cast(assist.utc.a1) * pow(2.0, -50); - gps_utc.d_DeltaT_LS = static_cast(assist.utc.delta_tls); - gps_utc.d_DeltaT_LSF = static_cast(assist.utc.delta_tlsf); - gps_utc.d_t_OT = static_cast(assist.utc.tot) * pow(2.0, 12); - gps_utc.i_DN = static_cast(assist.utc.dn); - gps_utc.i_WN_T = static_cast(assist.utc.wnt); - gps_utc.i_WN_LSF = static_cast(assist.utc.wnlsf); + gps_utc.d_DeltaT_LS = static_cast(assist.utc.delta_tls); + gps_utc.d_DeltaT_LSF = static_cast(assist.utc.delta_tlsf); + gps_utc.d_t_OT = static_cast(assist.utc.tot) * pow(2.0, 12); + gps_utc.i_DN = static_cast(assist.utc.dn); + gps_utc.i_WN_T = static_cast(assist.utc.wnt); + gps_utc.i_WN_LSF = static_cast(assist.utc.wnlsf); gps_utc.valid = true; } @@ -268,7 +268,7 @@ void gnss_sdr_supl_client::read_supl_data() gps_almanac_iterator->second.d_OMEGA0 = static_cast(a->OMEGA_0) * pow(2.0, -23); gps_almanac_iterator->second.d_sqrt_A = static_cast(a->A_sqrt) * pow(2.0, -11); gps_almanac_iterator->second.d_OMEGA_DOT = static_cast(a->OMEGA_dot) * pow(2.0, -38); - gps_almanac_iterator->second.i_Toa = static_cast(a->toa) * pow(2.0, 12); + gps_almanac_iterator->second.i_Toa = static_cast(a->toa * pow(2.0, 12)); gps_almanac_iterator->second.d_e_eccentricity = static_cast(a->e) * pow(2.0, -21); gps_almanac_iterator->second.d_M_0 = static_cast(a->M0) * pow(2.0, -23); } diff --git a/src/core/system_parameters/GPS_CNAV.h b/src/core/system_parameters/GPS_CNAV.h index b12b50056..025230930 100644 --- a/src/core/system_parameters/GPS_CNAV.h +++ b/src/core/system_parameters/GPS_CNAV.h @@ -54,7 +54,7 @@ const int32_t GPS_CNAV_DATA_PAGE_BITS = 300; const std::vector > CNAV_PRN({{9, 6}}); const std::vector > CNAV_MSG_TYPE({{15, 6}}); const std::vector > CNAV_TOW({{21, 17}}); // GPS Time Of Week in seconds -const double CNAV_TOW_LSB = 6.0; +const int32_t CNAV_TOW_LSB = 6; const std::vector > CNAV_ALERT_FLAG({{38, 1}}); // MESSAGE TYPE 10 (Ephemeris 1) @@ -62,11 +62,11 @@ const std::vector > CNAV_ALERT_FLAG({{38, 1}}); const std::vector > CNAV_WN({{39, 13}}); const std::vector > CNAV_HEALTH({{52, 3}}); const std::vector > CNAV_TOP1({{55, 11}}); -const double CNAV_TOP1_LSB = 300.0; +const int32_t CNAV_TOP1_LSB = 300; const std::vector > CNAV_URA({{66, 5}}); const std::vector > CNAV_TOE1({{71, 11}}); -const double CNAV_TOE1_LSB = 300.0; +const int32_t CNAV_TOE1_LSB = 300; const std::vector > CNAV_DELTA_A({{82, 26}}); // Relative to AREF = 26,559,710 meters const double CNAV_DELTA_A_LSB = TWO_N9; @@ -90,7 +90,7 @@ const std::vector > CNAV_L2_PHASING_FLAG({{273, 1}}) // MESSAGE TYPE 11 (Ephemeris 2) const std::vector > CNAV_TOE2({{39, 11}}); -const double CNAV_TOE2_LSB = 300.0; +const int32_t CNAV_TOE2_LSB = 300; const std::vector > CNAV_OMEGA0({{50, 33}}); const double CNAV_OMEGA0_LSB = TWO_N32 * PI; // semi-circles to radians const std::vector > CNAV_I0({{83, 33}}); @@ -116,12 +116,12 @@ const double CNAV_CUC_LSB = TWO_N30; // MESSAGE TYPE 30 (CLOCK, IONO, GRUP DELAY) const std::vector > CNAV_TOP2({{39, 11}}); -const double CNAV_TOP2_LSB = 300.0; +const int32_t CNAV_TOP2_LSB = 300; const std::vector > CNAV_URA_NED0({{50, 5}}); const std::vector > CNAV_URA_NED1({{55, 3}}); const std::vector > CNAV_URA_NED2({{58, 3}}); const std::vector > CNAV_TOC({{61, 11}}); -const double CNAV_TOC_LSB = 300.0; +const int32_t CNAV_TOC_LSB = 300; const std::vector > CNAV_AF0({{72, 26}}); const double CNAV_AF0_LSB = TWO_N35; const std::vector > CNAV_AF1({{98, 20}}); @@ -167,9 +167,9 @@ const double CNAV_A1_LSB = TWO_N51; const std::vector > CNAV_A2({{157, 7}}); const double CNAV_A2_LSB = TWO_N68; const std::vector > CNAV_DELTA_TLS({{164, 8}}); -const double CNAV_DELTA_TLS_LSB = 1; +const int32_t CNAV_DELTA_TLS_LSB = 1; const std::vector > CNAV_TOT({{172, 16}}); -const double CNAV_TOT_LSB = TWO_P4; +const int32_t CNAV_TOT_LSB = TWO_P4; const std::vector > CNAV_WN_OT({{188, 13}}); const int32_t CNAV_WN_OT_LSB = 1; const std::vector > CNAV_WN_LSF({{201, 13}}); @@ -177,7 +177,7 @@ const int32_t CNAV_WN_LSF_LSB = 1; const std::vector > CNAV_DN({{214, 4}}); const int32_t CNAV_DN_LSB = 1; const std::vector > CNAV_DELTA_TLSF({{218, 8}}); -const double CNAV_DELTA_TLSF_LSB = 1; +const int32_t CNAV_DELTA_TLSF_LSB = 1; // TODO: Add more frames (Almanac, etc...) diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h index 138e74844..349897994 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -118,7 +118,7 @@ const std::vector> T_GD({{197, 8}}); const double T_GD_LSB = TWO_N31; const std::vector> IODC({{83, 2}, {211, 8}}); const std::vector> T_OC({{219, 16}}); -const double T_OC_LSB = TWO_P4; +const int32_t T_OC_LSB = static_cast(TWO_P4); const std::vector> A_F2({{241, 8}}); const double A_F2_LSB = TWO_N55; const std::vector> A_F1({{249, 16}}); @@ -143,7 +143,7 @@ const double C_US_LSB = TWO_N29; const std::vector> SQRT_A({{227, 8}, {241, 24}}); const double SQRT_A_LSB = TWO_N19; const std::vector> T_OE({{271, 16}}); -const double T_OE_LSB = TWO_P4; +const int32_t T_OE_LSB = static_cast(TWO_P4); const std::vector> FIT_INTERVAL_FLAG({{271, 1}}); const std::vector> AODO({{272, 5}}); const int32_t AODO_LSB = 900; diff --git a/src/core/system_parameters/galileo_fnav_message.cc b/src/core/system_parameters/galileo_fnav_message.cc index c6026c7b7..b7fa86e3c 100644 --- a/src/core/system_parameters/galileo_fnav_message.cc +++ b/src/core/system_parameters/galileo_fnav_message.cc @@ -322,7 +322,7 @@ void Galileo_Fnav_Message::decode_page(const std::string& data) FNAV_A0_4 *= FNAV_A0_4_LSB; FNAV_A1_4 = static_cast(read_navigation_signed(data_bits, FNAV_A1_4_bit)); FNAV_A1_4 *= FNAV_A1_4_LSB; - FNAV_deltatls_4 = static_cast(read_navigation_signed(data_bits, FNAV_deltatls_4_bit)); + FNAV_deltatls_4 = static_cast(read_navigation_signed(data_bits, FNAV_deltatls_4_bit)); FNAV_t0t_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_t0t_4_bit)); FNAV_t0t_4 *= FNAV_t0t_4_LSB; FNAV_WNot_4 = static_cast(read_navigation_unsigned(data_bits, FNAV_WNot_4_bit)); diff --git a/src/core/system_parameters/galileo_navigation_message.cc b/src/core/system_parameters/galileo_navigation_message.cc index 650ed88bd..7ac22320c 100644 --- a/src/core/system_parameters/galileo_navigation_message.cc +++ b/src/core/system_parameters/galileo_navigation_message.cc @@ -125,8 +125,8 @@ void Galileo_Navigation_Message::reset() BGD_E1E5b_5 = 0.0; E5b_HS_5 = 0; E1B_HS_5 = 0; - E5b_DVS_5 = 0; - E1B_DVS_5 = 0; + E5b_DVS_5 = false; + E1B_DVS_5 = false; // GST WN_5 = 0; diff --git a/src/core/system_parameters/gps_cnav_ephemeris.cc b/src/core/system_parameters/gps_cnav_ephemeris.cc index 41b3dd655..cb96a8a73 100644 --- a/src/core/system_parameters/gps_cnav_ephemeris.cc +++ b/src/core/system_parameters/gps_cnav_ephemeris.cc @@ -37,17 +37,17 @@ Gps_CNAV_Ephemeris::Gps_CNAV_Ephemeris() { i_satellite_PRN = 0U; - d_Toe1 = -1.0; - d_Toe2 = -1.0; + d_Toe1 = -1; + d_Toe2 = -1; - d_TOW = 0.0; + d_TOW = 0; d_Crs = 0.0; d_M_0 = 0.0; d_Cuc = 0.0; d_e_eccentricity = 0.0; d_Cus = 0.0; - d_Toc = 0.0; + d_Toc = 0; d_Cic = 0.0; d_OMEGA0 = 0.0; d_Cis = 0.0; @@ -79,7 +79,7 @@ Gps_CNAV_Ephemeris::Gps_CNAV_Ephemeris() i_URA = 0; i_signal_health = 0; - d_Top = 0.0; + d_Top = 0; d_DELTA_A = 0.0; d_A_DOT = 0.0; d_Delta_n = 0.0; diff --git a/src/core/system_parameters/gps_cnav_ephemeris.h b/src/core/system_parameters/gps_cnav_ephemeris.h index 158206994..5f39454ea 100644 --- a/src/core/system_parameters/gps_cnav_ephemeris.h +++ b/src/core/system_parameters/gps_cnav_ephemeris.h @@ -54,7 +54,7 @@ public: int32_t i_GPS_week; //!< GPS week number, aka WN [week] int32_t i_URA; //!< ED Accuracy Index int32_t i_signal_health; //!< Signal health (L1/L2/L5) - double d_Top; //!< Data predict time of week + int32_t d_Top; //!< Data predict time of week double d_DELTA_A; //!< Semi-major axis difference at reference time double d_A_DOT; //!< Change rate in semi-major axis double d_Delta_n; //!< Mean Motion Difference From Computed Value [semi-circles/s] @@ -63,8 +63,8 @@ public: double d_e_eccentricity; //!< Eccentricity double d_OMEGA; //!< Argument of Perigee [semi-cicles] double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-cicles] - double d_Toe1; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] - double d_Toe2; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] + int32_t d_Toe1; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] + int32_t d_Toe2; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] double d_DELTA_OMEGA_DOT; //!< Rate of Right Ascension difference [semi-circles/s] double d_i_0; //!< Inclination Angle at Reference Time [semi-circles] double d_IDOT; //!< Rate of Inclination Angle [semi-circles/s] @@ -76,7 +76,7 @@ public: double d_Cuc; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad] // Clock Correction and Accuracy Parameters - double d_Toc; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s] + int32_t d_Toc; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s] double d_A_f0; //!< Coefficient 0 of code phase offset model [s] double d_A_f1; //!< Coefficient 1 of code phase offset model [s/s] double d_A_f2; //!< Coefficient 2 of code phase offset model [s/s^2] @@ -92,7 +92,7 @@ public: double d_ISCL5I; double d_ISCL5Q; - double d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] + int32_t d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] /*! \brief If true, enhanced level of integrity assurance. * diff --git a/src/core/system_parameters/gps_cnav_navigation_message.cc b/src/core/system_parameters/gps_cnav_navigation_message.cc index d3d493bb5..ea1d10782 100644 --- a/src/core/system_parameters/gps_cnav_navigation_message.cc +++ b/src/core/system_parameters/gps_cnav_navigation_message.cc @@ -55,7 +55,7 @@ void Gps_CNAV_Navigation_Message::reset() d_satvel_Y = 0.0; d_satvel_Z = 0.0; - d_TOW = 0.0; + d_TOW = 0; } @@ -148,7 +148,7 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset(read_navigation_unsigned(data_bits, CNAV_PRN)); ephemeris_record.i_satellite_PRN = PRN; - d_TOW = static_cast(read_navigation_unsigned(data_bits, CNAV_TOW)); + d_TOW = static_cast(read_navigation_unsigned(data_bits, CNAV_TOW)); d_TOW *= CNAV_TOW_LSB; ephemeris_record.d_TOW = d_TOW; @@ -162,10 +162,10 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset(read_navigation_unsigned(data_bits, CNAV_WN)); ephemeris_record.i_signal_health = static_cast(read_navigation_unsigned(data_bits, CNAV_HEALTH)); - ephemeris_record.d_Top = static_cast(read_navigation_unsigned(data_bits, CNAV_TOP1)); + ephemeris_record.d_Top = static_cast(read_navigation_unsigned(data_bits, CNAV_TOP1)); ephemeris_record.d_Top *= CNAV_TOP1_LSB; ephemeris_record.d_URA0 = static_cast(read_navigation_signed(data_bits, CNAV_URA)); - ephemeris_record.d_Toe1 = static_cast(read_navigation_unsigned(data_bits, CNAV_TOE1)); + ephemeris_record.d_Toe1 = static_cast(read_navigation_unsigned(data_bits, CNAV_TOE1)); ephemeris_record.d_Toe1 *= CNAV_TOE1_LSB; ephemeris_record.d_DELTA_A = static_cast(read_navigation_signed(data_bits, CNAV_DELTA_A)); ephemeris_record.d_DELTA_A *= CNAV_DELTA_A_LSB; @@ -188,7 +188,7 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset(read_navigation_unsigned(data_bits, CNAV_TOE2)); + ephemeris_record.d_Toe2 = static_cast(read_navigation_unsigned(data_bits, CNAV_TOE2)); ephemeris_record.d_Toe2 *= CNAV_TOE2_LSB; ephemeris_record.d_OMEGA0 = static_cast(read_navigation_signed(data_bits, CNAV_OMEGA0)); ephemeris_record.d_OMEGA0 *= CNAV_OMEGA0_LSB; @@ -214,7 +214,7 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset(read_navigation_unsigned(data_bits, CNAV_TOC)); + ephemeris_record.d_Toc = static_cast(read_navigation_unsigned(data_bits, CNAV_TOC)); ephemeris_record.d_Toc *= CNAV_TOC_LSB; ephemeris_record.d_URA0 = static_cast(read_navigation_signed(data_bits, CNAV_URA_NED0)); ephemeris_record.d_URA1 = static_cast(read_navigation_unsigned(data_bits, CNAV_URA_NED1)); @@ -282,9 +282,9 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset(read_navigation_unsigned(data_bits, CNAV_TOP1)); + ephemeris_record.d_Top = static_cast(read_navigation_unsigned(data_bits, CNAV_TOP1)); ephemeris_record.d_Top = ephemeris_record.d_Top * CNAV_TOP1_LSB; - ephemeris_record.d_Toc = static_cast(read_navigation_unsigned(data_bits, CNAV_TOC)); + ephemeris_record.d_Toc = static_cast(read_navigation_unsigned(data_bits, CNAV_TOC)); ephemeris_record.d_Toc = ephemeris_record.d_Toc * CNAV_TOC_LSB; ephemeris_record.d_A_f0 = static_cast(read_navigation_signed(data_bits, CNAV_AF0)); ephemeris_record.d_A_f0 = ephemeris_record.d_A_f0 * CNAV_AF0_LSB; @@ -300,10 +300,10 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset(read_navigation_signed(data_bits, CNAV_A2)); utc_model_record.d_A2 = utc_model_record.d_A2 * CNAV_A2_LSB; - utc_model_record.d_DeltaT_LS = static_cast(read_navigation_signed(data_bits, CNAV_DELTA_TLS)); + utc_model_record.d_DeltaT_LS = static_cast(read_navigation_signed(data_bits, CNAV_DELTA_TLS)); utc_model_record.d_DeltaT_LS = utc_model_record.d_DeltaT_LS * CNAV_DELTA_TLS_LSB; - utc_model_record.d_t_OT = static_cast(read_navigation_signed(data_bits, CNAV_TOT)); + utc_model_record.d_t_OT = static_cast(read_navigation_signed(data_bits, CNAV_TOT)); utc_model_record.d_t_OT = utc_model_record.d_t_OT * CNAV_TOT_LSB; utc_model_record.i_WN_T = static_cast(read_navigation_signed(data_bits, CNAV_WN_OT)); @@ -315,7 +315,7 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset(read_navigation_signed(data_bits, CNAV_DN)); utc_model_record.i_DN = utc_model_record.i_DN * CNAV_DN_LSB; - utc_model_record.d_DeltaT_LSF = static_cast(read_navigation_signed(data_bits, CNAV_DELTA_TLSF)); + utc_model_record.d_DeltaT_LSF = static_cast(read_navigation_signed(data_bits, CNAV_DELTA_TLSF)); utc_model_record.d_DeltaT_LSF = utc_model_record.d_DeltaT_LSF * CNAV_DELTA_TLSF_LSB; b_flag_utc_valid = true; break; diff --git a/src/core/system_parameters/gps_cnav_navigation_message.h b/src/core/system_parameters/gps_cnav_navigation_message.h index 2a817e32d..62fc6fbc1 100644 --- a/src/core/system_parameters/gps_cnav_navigation_message.h +++ b/src/core/system_parameters/gps_cnav_navigation_message.h @@ -65,7 +65,7 @@ private: Gps_CNAV_Utc_Model utc_model_record; public: - double d_TOW; + int32_t d_TOW; bool b_flag_ephemeris_1; bool b_flag_ephemeris_2; bool b_flag_iono_valid; //!< If set, it indicates that the ionospheric parameters are filled and are not yet read by the get_iono diff --git a/src/core/system_parameters/gps_cnav_utc_model.cc b/src/core/system_parameters/gps_cnav_utc_model.cc index 565993f06..673329f31 100644 --- a/src/core/system_parameters/gps_cnav_utc_model.cc +++ b/src/core/system_parameters/gps_cnav_utc_model.cc @@ -37,12 +37,12 @@ Gps_CNAV_Utc_Model::Gps_CNAV_Utc_Model() d_A2 = 0.0; d_A1 = 0.0; d_A0 = 0.0; - d_t_OT = 0.0; + d_t_OT = 0; i_WN_T = 0; - d_DeltaT_LS = 0.0; + d_DeltaT_LS = 0; i_WN_LSF = 0; i_DN = 0; - d_DeltaT_LSF = 0.0; + d_DeltaT_LSF = 0; } diff --git a/src/core/system_parameters/gps_cnav_utc_model.h b/src/core/system_parameters/gps_cnav_utc_model.h index b9dba4936..555c7c640 100644 --- a/src/core/system_parameters/gps_cnav_utc_model.h +++ b/src/core/system_parameters/gps_cnav_utc_model.h @@ -46,15 +46,15 @@ class Gps_CNAV_Utc_Model public: bool valid; // UTC parameters - double d_A2; //!< 2nd order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200H) [s/s] - double d_A1; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200H) [s/s] - double d_A0; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200H) [s] - double d_t_OT; //!< Reference time for UTC data (reference 20.3.4.5 and 20.3.3.5.2.4 IS-GPS-200H) [s] - int32_t i_WN_T; //!< UTC reference week number [weeks] - double d_DeltaT_LS; //!< delta time due to leap seconds [s]. Number of leap seconds since 6-Jan-1980 as transmitted by the GPS almanac. - int32_t i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks] - int32_t i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days] - double d_DeltaT_LSF; //!< Scheduled future or recent past (relative to NAV message upload) value of the delta time due to leap seconds [s] + double d_A2; //!< 2nd order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200H) [s/s] + double d_A1; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200H) [s/s] + double d_A0; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200H) [s] + int32_t d_t_OT; //!< Reference time for UTC data (reference 20.3.4.5 and 20.3.3.5.2.4 IS-GPS-200H) [s] + int32_t i_WN_T; //!< UTC reference week number [weeks] + int32_t d_DeltaT_LS; //!< delta time due to leap seconds [s]. Number of leap seconds since 6-Jan-1980 as transmitted by the GPS almanac. + int32_t i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks] + int32_t i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days] + int32_t d_DeltaT_LSF; //!< Scheduled future or recent past (relative to NAV message upload) value of the delta time due to leap seconds [s] /*! * Default constructor diff --git a/src/core/system_parameters/gps_ephemeris.cc b/src/core/system_parameters/gps_ephemeris.cc index abec83103..c6e181815 100644 --- a/src/core/system_parameters/gps_ephemeris.cc +++ b/src/core/system_parameters/gps_ephemeris.cc @@ -38,7 +38,7 @@ Gps_Ephemeris::Gps_Ephemeris() { i_satellite_PRN = 0U; - d_TOW = 0.0; + d_TOW = 0; d_Crs = 0.0; d_Delta_n = 0.0; d_M_0 = 0.0; @@ -46,8 +46,8 @@ Gps_Ephemeris::Gps_Ephemeris() d_e_eccentricity = 0.0; d_Cus = 0.0; d_sqrt_A = 0.0; - d_Toe = 0.0; - d_Toc = 0.0; + d_Toe = 0; + d_Toc = 0; d_Cic = 0.0; d_OMEGA0 = 0.0; d_Cis = 0.0; @@ -61,11 +61,11 @@ Gps_Ephemeris::Gps_Ephemeris() b_L2_P_data_flag = false; i_SV_accuracy = 0; i_SV_health = 0; - d_IODE_SF2 = 0.0; - d_IODE_SF3 = 0.0; - d_TGD = 0.0; // Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s] - d_IODC = 0.0; // Issue of Data, Clock - i_AODO = 0; // Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] + d_IODE_SF2 = 0; + d_IODE_SF3 = 0; + d_TGD = 0.0; // Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s] + d_IODC = 0; // Issue of Data, Clock + i_AODO = 0; // Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] b_fit_interval_flag = false; // indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours. d_spare1 = 0.0; diff --git a/src/core/system_parameters/gps_ephemeris.h b/src/core/system_parameters/gps_ephemeris.h index 5e6613d9d..683eb9135 100644 --- a/src/core/system_parameters/gps_ephemeris.h +++ b/src/core/system_parameters/gps_ephemeris.h @@ -60,7 +60,7 @@ private: public: uint32_t i_satellite_PRN; // SV PRN NUMBER - double d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] + int32_t d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] double d_Crs; //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m] double d_Delta_n; //!< Mean Motion Difference From Computed Value [semi-circles/s] double d_M_0; //!< Mean Anomaly at Reference Time [semi-circles] @@ -68,8 +68,8 @@ public: double d_e_eccentricity; //!< Eccentricity [dimensionless] double d_Cus; //!< Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude [rad] double d_sqrt_A; //!< Square Root of the Semi-Major Axis [sqrt(m)] - double d_Toe; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] - double d_Toc; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s] + int32_t d_Toe; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] + int32_t d_Toc; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s] double d_Cic; //!< Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination [rad] double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles] double d_Cis; //!< Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination [rad] @@ -83,11 +83,11 @@ public: bool b_L2_P_data_flag; //!< When true, indicates that the NAV data stream was commanded OFF on the P-code of the L2 channel int32_t i_SV_accuracy; //!< User Range Accuracy (URA) index of the SV (reference paragraph 6.2.1) for the standard positioning service user (Ref 20.3.3.3.1.3 IS-GPS-200E) int32_t i_SV_health; - double d_TGD; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s] - double d_IODC; //!< Issue of Data, Clock - double d_IODE_SF2; //!< Issue of Data, Ephemeris (IODE), subframe 2 - double d_IODE_SF3; //!< Issue of Data, Ephemeris(IODE), subframe 3 - int32_t i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] + double d_TGD; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s] + int32_t d_IODC; //!< Issue of Data, Clock + int32_t d_IODE_SF2; //!< Issue of Data, Ephemeris (IODE), subframe 2 + int32_t d_IODE_SF3; //!< Issue of Data, Ephemeris(IODE), subframe 3 + int32_t i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] bool b_fit_interval_flag; //!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours. double d_spare1; @@ -111,7 +111,7 @@ public: */ bool b_integrity_status_flag; bool b_alert_flag; //!< If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our own risk. - bool b_antispoofing_flag; //!< If true, the AntiSpoofing mode is ON in that SV + bool b_antispoofing_flag; //!< If true, the AntiSpoofing mode is ON in that SV // clock terms derived from ephemeris data double d_satClkDrift; //!< GPS clock error diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index 01e8ce430..e38f6bdb2 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -39,14 +39,14 @@ m * \file gps_navigation_message.cc void Gps_Navigation_Message::reset() { b_valid_ephemeris_set_flag = false; - d_TOW = 0.0; - d_TOW_SF1 = 0.0; - d_TOW_SF2 = 0.0; - d_TOW_SF3 = 0.0; - d_TOW_SF4 = 0.0; - d_TOW_SF5 = 0.0; - d_IODE_SF2 = 0.0; - d_IODE_SF3 = 0.0; + d_TOW = 0; + d_TOW_SF1 = 0; + d_TOW_SF2 = 0; + d_TOW_SF3 = 0; + d_TOW_SF4 = 0; + d_TOW_SF5 = 0; + d_IODE_SF2 = 0; + d_IODE_SF3 = 0; d_Crs = 0.0; d_Delta_n = 0.0; d_M_0 = 0.0; @@ -54,8 +54,8 @@ void Gps_Navigation_Message::reset() d_e_eccentricity = 0.0; d_Cus = 0.0; d_sqrt_A = 0.0; - d_Toe = 0.0; - d_Toc = 0.0; + d_Toe = 0; + d_Toc = 0; d_Cic = 0.0; d_OMEGA0 = 0.0; d_Cis = 0.0; @@ -70,7 +70,7 @@ void Gps_Navigation_Message::reset() i_SV_accuracy = 0; i_SV_health = 0; d_TGD = 0.0; - d_IODC = -1.0; + d_IODC = -1; i_AODO = 0; b_fit_interval_flag = false; @@ -117,12 +117,12 @@ void Gps_Navigation_Message::reset() d_beta3 = 0.0; d_A1 = 0.0; d_A0 = 0.0; - d_t_OT = 0.0; + d_t_OT = 0; i_WN_T = 0; - d_DeltaT_LS = 0.0; + d_DeltaT_LS = 0; i_WN_LSF = 0; i_DN = 0; - d_DeltaT_LSF = 0.0; + d_DeltaT_LSF = 0; // Almanac i_Toa = 0; @@ -257,9 +257,9 @@ int32_t Gps_Navigation_Message::subframe_decoder(char* subframe) // The transmitted TOW is actual TOW of the next subframe // (the variable subframe at this point contains bits of the last subframe). //TOW = bin2dec(subframe(31:47)) * 6; - d_TOW_SF1 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); + d_TOW_SF1 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); //we are in the first subframe (the transmitted TOW is the start time of the next subframe) ! - d_TOW_SF1 = d_TOW_SF1 * 6.0; + d_TOW_SF1 = d_TOW_SF1 * 6; d_TOW = d_TOW_SF1; // Set transmission time b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); @@ -271,8 +271,8 @@ int32_t Gps_Navigation_Message::subframe_decoder(char* subframe) i_code_on_L2 = static_cast(read_navigation_unsigned(subframe_bits, CA_OR_P_ON_L2)); d_TGD = static_cast(read_navigation_signed(subframe_bits, T_GD)); d_TGD = d_TGD * T_GD_LSB; - d_IODC = static_cast(read_navigation_unsigned(subframe_bits, IODC)); - d_Toc = static_cast(read_navigation_unsigned(subframe_bits, T_OC)); + d_IODC = static_cast(read_navigation_unsigned(subframe_bits, IODC)); + d_Toc = static_cast(read_navigation_unsigned(subframe_bits, T_OC)); d_Toc = d_Toc * T_OC_LSB; d_A_f0 = static_cast(read_navigation_signed(subframe_bits, A_F0)); d_A_f0 = d_A_f0 * A_F0_LSB; @@ -283,13 +283,13 @@ int32_t Gps_Navigation_Message::subframe_decoder(char* subframe) break; case 2: //--- It is subframe 2 ------------------- - d_TOW_SF2 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); - d_TOW_SF2 = d_TOW_SF2 * 6.0; + d_TOW_SF2 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); + d_TOW_SF2 = d_TOW_SF2 * 6; d_TOW = d_TOW_SF2; // Set transmission time b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); - d_IODE_SF2 = static_cast(read_navigation_unsigned(subframe_bits, IODE_SF2)); + d_IODE_SF2 = static_cast(read_navigation_unsigned(subframe_bits, IODE_SF2)); d_Crs = static_cast(read_navigation_signed(subframe_bits, C_RS)); d_Crs = d_Crs * C_RS_LSB; d_Delta_n = static_cast(read_navigation_signed(subframe_bits, DELTA_N)); @@ -304,7 +304,7 @@ int32_t Gps_Navigation_Message::subframe_decoder(char* subframe) d_Cus = d_Cus * C_US_LSB; d_sqrt_A = static_cast(read_navigation_unsigned(subframe_bits, SQRT_A)); d_sqrt_A = d_sqrt_A * SQRT_A_LSB; - d_Toe = static_cast(read_navigation_unsigned(subframe_bits, T_OE)); + d_Toe = static_cast(read_navigation_unsigned(subframe_bits, T_OE)); d_Toe = d_Toe * T_OE_LSB; b_fit_interval_flag = read_navigation_bool(subframe_bits, FIT_INTERVAL_FLAG); i_AODO = static_cast(read_navigation_unsigned(subframe_bits, AODO)); @@ -312,8 +312,8 @@ int32_t Gps_Navigation_Message::subframe_decoder(char* subframe) break; case 3: // --- It is subframe 3 ------------------------------------- - d_TOW_SF3 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); - d_TOW_SF3 = d_TOW_SF3 * 6.0; + d_TOW_SF3 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); + d_TOW_SF3 = d_TOW_SF3 * 6; d_TOW = d_TOW_SF3; // Set transmission time b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); @@ -332,7 +332,7 @@ int32_t Gps_Navigation_Message::subframe_decoder(char* subframe) d_OMEGA = d_OMEGA * OMEGA_LSB; d_OMEGA_DOT = static_cast(read_navigation_signed(subframe_bits, OMEGA_DOT)); d_OMEGA_DOT = d_OMEGA_DOT * OMEGA_DOT_LSB; - d_IODE_SF3 = static_cast(read_navigation_unsigned(subframe_bits, IODE_SF3)); + d_IODE_SF3 = static_cast(read_navigation_unsigned(subframe_bits, IODE_SF3)); d_IDOT = static_cast(read_navigation_signed(subframe_bits, I_DOT)); d_IDOT = d_IDOT * I_DOT_LSB; break; @@ -340,8 +340,8 @@ int32_t Gps_Navigation_Message::subframe_decoder(char* subframe) case 4: // --- It is subframe 4 ---------- Almanac, ionospheric model, UTC parameters, SV health (PRN: 25-32) int32_t SV_data_ID; int32_t SV_page; - d_TOW_SF4 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); - d_TOW_SF4 = d_TOW_SF4 * 6.0; + d_TOW_SF4 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); + d_TOW_SF4 = d_TOW_SF4 * 6; d_TOW = d_TOW_SF4; // Set transmission time b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); @@ -384,13 +384,13 @@ int32_t Gps_Navigation_Message::subframe_decoder(char* subframe) d_A1 = d_A1 * A_1_LSB; d_A0 = static_cast(read_navigation_signed(subframe_bits, A_0)); d_A0 = d_A0 * A_0_LSB; - d_t_OT = static_cast(read_navigation_unsigned(subframe_bits, T_OT)); + d_t_OT = static_cast(read_navigation_unsigned(subframe_bits, T_OT)); d_t_OT = d_t_OT * T_OT_LSB; i_WN_T = static_cast(read_navigation_unsigned(subframe_bits, WN_T)); - d_DeltaT_LS = static_cast(read_navigation_signed(subframe_bits, DELTAT_LS)); + d_DeltaT_LS = static_cast(read_navigation_signed(subframe_bits, DELTAT_LS)); i_WN_LSF = static_cast(read_navigation_unsigned(subframe_bits, WN_LSF)); i_DN = static_cast(read_navigation_unsigned(subframe_bits, DN)); // Right-justified ? - d_DeltaT_LSF = static_cast(read_navigation_signed(subframe_bits, DELTAT_LSF)); + d_DeltaT_LSF = static_cast(read_navigation_signed(subframe_bits, DELTAT_LSF)); flag_iono_valid = true; flag_utc_model_valid = true; } @@ -417,8 +417,8 @@ int32_t Gps_Navigation_Message::subframe_decoder(char* subframe) case 5: //--- It is subframe 5 -----------------almanac health (PRN: 1-24) and Almanac reference week number and time. int32_t SV_data_ID_5; int32_t SV_page_5; - d_TOW_SF5 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); - d_TOW_SF5 = d_TOW_SF5 * 6.0; + d_TOW_SF5 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); + d_TOW_SF5 = d_TOW_SF5 * 6; d_TOW = d_TOW_SF5; // Set transmission time b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index 57b76f62b..1e79a02c9 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -62,14 +62,14 @@ private: public: bool b_valid_ephemeris_set_flag; // flag indicating that this ephemeris set have passed the validation check // broadcast orbit 1 - double d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] - double d_TOW_SF1; //!< Time of GPS Week from HOW word of Subframe 1 [s] - double d_TOW_SF2; //!< Time of GPS Week from HOW word of Subframe 2 [s] - double d_TOW_SF3; //!< Time of GPS Week from HOW word of Subframe 3 [s] - double d_TOW_SF4; //!< Time of GPS Week from HOW word of Subframe 4 [s] - double d_TOW_SF5; //!< Time of GPS Week from HOW word of Subframe 5 [s] - double d_IODE_SF2; - double d_IODE_SF3; + int32_t d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] + int32_t d_TOW_SF1; //!< Time of GPS Week from HOW word of Subframe 1 [s] + int32_t d_TOW_SF2; //!< Time of GPS Week from HOW word of Subframe 2 [s] + int32_t d_TOW_SF3; //!< Time of GPS Week from HOW word of Subframe 3 [s] + int32_t d_TOW_SF4; //!< Time of GPS Week from HOW word of Subframe 4 [s] + int32_t d_TOW_SF5; //!< Time of GPS Week from HOW word of Subframe 5 [s] + int32_t d_IODE_SF2; + int32_t d_IODE_SF3; double d_Crs; //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m] double d_Delta_n; //!< Mean Motion Difference From Computed Value [semi-circles/s] double d_M_0; //!< Mean Anomaly at Reference Time [semi-circles] @@ -79,8 +79,8 @@ public: double d_Cus; //!< Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude [rad] double d_sqrt_A; //!< Square Root of the Semi-Major Axis [sqrt(m)] // broadcast orbit 3 - double d_Toe; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] - double d_Toc; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s] + int32_t d_Toe; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] + int32_t d_Toc; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s] double d_Cic; //!< Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination [rad] double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles] double d_Cis; //!< Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination [rad] @@ -97,8 +97,8 @@ public: // broadcast orbit 6 int32_t i_SV_accuracy; //!< User Range Accuracy (URA) index of the SV (reference paragraph 6.2.1) for the standard positioning service user (Ref 20.3.3.3.1.3 IS-GPS-200E) int32_t i_SV_health; - double d_TGD; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s] - double d_IODC; //!< Issue of Data, Clock + double d_TGD; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s] + int32_t d_IODC; //!< Issue of Data, Clock // broadcast orbit 7 int32_t i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] bool b_fit_interval_flag; //!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours. @@ -162,14 +162,15 @@ public: // UTC parameters bool flag_utc_model_valid; //!< If set, it indicates that the UTC model parameters are filled - double d_A1; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s] double d_A0; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s] - double d_t_OT; //!< Reference time for UTC data (reference 20.3.4.5 and 20.3.3.5.2.4 IS-GPS-200E) [s] + double d_A1; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s] + double d_A2; //!< 2nd order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s] + int32_t d_t_OT; //!< Reference time for UTC data (reference 20.3.4.5 and 20.3.3.5.2.4 IS-GPS-200E) [s] int32_t i_WN_T; //!< UTC reference week number [weeks] - double d_DeltaT_LS; //!< delta time due to leap seconds [s]. Number of leap seconds since 6-Jan-1980 as transmitted by the GPS almanac. + int32_t d_DeltaT_LS; //!< delta time due to leap seconds [s]. Number of leap seconds since 6-Jan-1980 as transmitted by the GPS almanac. int32_t i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks] int32_t i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days] - double d_DeltaT_LSF; //!< Scheduled future or recent past (relative to NAV message upload) value of the delta time due to leap seconds [s] + int32_t d_DeltaT_LSF; //!< Scheduled future or recent past (relative to NAV message upload) value of the delta time due to leap seconds [s] // Satellite velocity double d_satvel_X; //!< Earth-fixed velocity coordinate x of the satellite [m] diff --git a/src/core/system_parameters/gps_utc_model.cc b/src/core/system_parameters/gps_utc_model.cc index c29a61e5d..5641186b4 100644 --- a/src/core/system_parameters/gps_utc_model.cc +++ b/src/core/system_parameters/gps_utc_model.cc @@ -35,14 +35,15 @@ Gps_Utc_Model::Gps_Utc_Model() { valid = false; - d_A1 = 0.0; d_A0 = 0.0; - d_t_OT = 0.0; + d_A1 = 0.0; + d_A2 = 0.0; + d_t_OT = 0; i_WN_T = 0; - d_DeltaT_LS = 0.0; + d_DeltaT_LS = 0; i_WN_LSF = 0; i_DN = 0; - d_DeltaT_LSF = 0.0; + d_DeltaT_LSF = 0; } diff --git a/src/core/system_parameters/gps_utc_model.h b/src/core/system_parameters/gps_utc_model.h index e037aff99..43283d30d 100644 --- a/src/core/system_parameters/gps_utc_model.h +++ b/src/core/system_parameters/gps_utc_model.h @@ -45,14 +45,15 @@ class Gps_Utc_Model public: bool valid; // UTC parameters - double d_A1; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s] - double d_A0; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s] - double d_t_OT; //!< Reference time for UTC data (reference 20.3.4.5 and 20.3.3.5.2.4 IS-GPS-200E) [s] - int32_t i_WN_T; //!< UTC reference week number [weeks] - double d_DeltaT_LS; //!< delta time due to leap seconds [s]. Number of leap seconds since 6-Jan-1980 as transmitted by the GPS almanac. - int32_t i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks] - int32_t i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days] - double d_DeltaT_LSF; //!< Scheduled future or recent past (relative to NAV message upload) value of the delta time due to leap seconds [s] + double d_A0; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s] + double d_A1; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s] + double d_A2; //!< 2nd order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s] + int32_t d_t_OT; //!< Reference time for UTC data (reference 20.3.4.5 and 20.3.3.5.2.4 IS-GPS-200E) [s] + int32_t i_WN_T; //!< UTC reference week number [weeks] + int32_t d_DeltaT_LS; //!< delta time due to leap seconds [s]. Number of leap seconds since 6-Jan-1980 as transmitted by the GPS almanac. + int32_t i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks] + int32_t i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days] + int32_t d_DeltaT_LSF; //!< Scheduled future or recent past (relative to NAV message upload) value of the delta time due to leap seconds [s] /*! * Default constructor From 82ca7091d6819b305fb66dd8362fabce9276e617 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 14 Dec 2018 11:52:13 +0100 Subject: [PATCH 4/4] Update schemas --- docs/xml-schemas/cnav_ephemeris_map.xsd | 8 ++++---- docs/xml-schemas/ephemeris_map.xsd | 12 ++++++------ docs/xml-schemas/gal_ephemeris_map.xsd | 18 +++++++++--------- docs/xml-schemas/gal_iono_model.xsd | 4 ++-- docs/xml-schemas/gal_utc_model.xsd | 8 ++++---- docs/xml-schemas/utc_model.xsd | 6 +++--- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/xml-schemas/cnav_ephemeris_map.xsd b/docs/xml-schemas/cnav_ephemeris_map.xsd index 139756f36..2ada62f13 100644 --- a/docs/xml-schemas/cnav_ephemeris_map.xsd +++ b/docs/xml-schemas/cnav_ephemeris_map.xsd @@ -15,15 +15,15 @@ - + - - - + + + diff --git a/docs/xml-schemas/ephemeris_map.xsd b/docs/xml-schemas/ephemeris_map.xsd index f76c5e900..4290bbed5 100644 --- a/docs/xml-schemas/ephemeris_map.xsd +++ b/docs/xml-schemas/ephemeris_map.xsd @@ -15,9 +15,9 @@ - - - + + + @@ -25,8 +25,8 @@ - - + + @@ -41,7 +41,7 @@ - + diff --git a/docs/xml-schemas/gal_ephemeris_map.xsd b/docs/xml-schemas/gal_ephemeris_map.xsd index bf2166b48..fe307412e 100644 --- a/docs/xml-schemas/gal_ephemeris_map.xsd +++ b/docs/xml-schemas/gal_ephemeris_map.xsd @@ -30,25 +30,25 @@ - - + + - - + + - + - - + + - - + + diff --git a/docs/xml-schemas/gal_iono_model.xsd b/docs/xml-schemas/gal_iono_model.xsd index dc0219273..69b22aad4 100644 --- a/docs/xml-schemas/gal_iono_model.xsd +++ b/docs/xml-schemas/gal_iono_model.xsd @@ -13,8 +13,8 @@ - - + + diff --git a/docs/xml-schemas/gal_utc_model.xsd b/docs/xml-schemas/gal_utc_model.xsd index 2e1e22eed..3cc38107c 100644 --- a/docs/xml-schemas/gal_utc_model.xsd +++ b/docs/xml-schemas/gal_utc_model.xsd @@ -7,12 +7,12 @@ - - - + + + - + diff --git a/docs/xml-schemas/utc_model.xsd b/docs/xml-schemas/utc_model.xsd index 44005a628..c02015ead 100644 --- a/docs/xml-schemas/utc_model.xsd +++ b/docs/xml-schemas/utc_model.xsd @@ -8,12 +8,12 @@ - + - + - +