diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h index 50c8bf1e3..384e3ce6a 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -5,7 +5,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -33,23 +33,25 @@ #define GNSS_SDR_GPS_L1_CA_H_ #include +#include +#include #include // Physical constants -const double GPS_C_m_s = 299792458.0; //!< The speed of light, [m/s] -const double GPS_C_m_ms = 299792.4580; //!< The speed of light, [m/ms] -const double GPS_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200E -const double GPS_TWO_PI = 6.283185307179586;//!< 2Pi as defined in IS-GPS-200E -const double OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Earth rotation rate, [rad/s] -const double GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] -const double F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] +const double GPS_C_m_s = 299792458.0; //!< The speed of light, [m/s] +const double GPS_C_m_ms = 299792.4580; //!< The speed of light, [m/ms] +const double GPS_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200E +const double GPS_TWO_PI = 6.283185307179586;//!< 2Pi as defined in IS-GPS-200E +const double OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Earth rotation rate, [rad/s] +const double GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] +const double F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] // carrier and code frequencies -const double GPS_L1_FREQ_HZ = 1.57542e9; //!< L1 [Hz] -const double GPS_L1_CA_CODE_RATE_HZ = 1.023e6; //!< GPS L1 C/A code rate [chips/s] -const double GPS_L1_CA_CODE_LENGTH_CHIPS = 1023.0; //!< GPS L1 C/A code length [chips] -const double GPS_L1_CA_CODE_PERIOD = 0.001; //!< GPS L1 C/A code period [seconds] +const double GPS_L1_FREQ_HZ = 1.57542e9; //!< L1 [Hz] +const double GPS_L1_CA_CODE_RATE_HZ = 1.023e6; //!< GPS L1 C/A code rate [chips/s] +const double GPS_L1_CA_CODE_LENGTH_CHIPS = 1023.0; //!< GPS L1 C/A code length [chips] +const double GPS_L1_CA_CODE_PERIOD = 0.001; //!< GPS L1 C/A code period [seconds] /*! * \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms @@ -74,26 +76,10 @@ const int GPS_CA_PREAMBLE_LENGTH_BITS = 8; const int GPS_CA_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s] const int GPS_CA_TELEMETRY_RATE_SYMBOLS_SECOND = GPS_CA_TELEMETRY_RATE_BITS_SECOND*20; //!< NAV message bit rate [symbols/s] const int GPS_WORD_LENGTH = 4; // CRC + GPS WORD (-2 -1 0 ... 29) Bits = 4 bytes -const int GPS_SUBFRAME_LENGTH=40; // GPS_WORD_LENGTH x 10 = 40 bytes -const int GPS_SUBFRAME_BITS=300; //!< Number of bits per subframe in the NAV message [bits] -const int GPS_SUBFRAME_SECONDS=6; //!< Subframe duration [seconds] -const int GPS_WORD_BITS=30; //!< Number of bits per word in the NAV message [bits] - - -/*! - * \brief Navigation message bits slice structure: A portion of bits is indicated by - * the start position inside the subframe and the length in number of bits */ -typedef struct bits_slice -{ - int position; - int length; - bits_slice(int p,int l) - { - position=p; - length=l; - } -} bits_slice; - +const int GPS_SUBFRAME_LENGTH = 40; // GPS_WORD_LENGTH x 10 = 40 bytes +const int GPS_SUBFRAME_BITS = 300; //!< Number of bits per subframe in the NAV message [bits] +const int GPS_SUBFRAME_SECONDS = 6; //!< Subframe duration [seconds] +const int GPS_WORD_BITS = 30; //!< Number of bits per word in the NAV message [bits] /* Constants for scaling the ephemeris found in the data message the format is the following: TWO_N5 -> 2^-5, TWO_P4 -> 2^4, PI_TWO_N43 -> Pi*2^-43, etc etc @@ -104,41 +90,40 @@ typedef struct bits_slice PI_TWO_PX ==> Pi*2^X ONE_PI_TWO_PX = (1/Pi)*2^X */ -const double TWO_P4 =(16); //!< 2^4 -const double TWO_P11 =(2048); //!< 2^11 -const double TWO_P12 =(4096); //!< 2^12 -const double TWO_P14 =(16384); //!< 2^14 -const double TWO_P16 =(65536); //!< 2^16 -const double TWO_P19 =(524288); //!< 2^19 -const double TWO_P31 =(2147483648.0); //!< 2^31 -const double TWO_P32 =(4294967296.0); //!< 2^32 this is too big for an int so add the x.0 -const double TWO_P56 =(7.205759403792794e+016); //!< 2^56 -const double TWO_P57 =(1.441151880758559e+017); //!< 2^57 +const double TWO_P4 = (16); //!< 2^4 +const double TWO_P11 = (2048); //!< 2^11 +const double TWO_P12 = (4096); //!< 2^12 +const double TWO_P14 = (16384); //!< 2^14 +const double TWO_P16 = (65536); //!< 2^16 +const double TWO_P19 = (524288); //!< 2^19 +const double TWO_P31 = (2147483648.0); //!< 2^31 +const double TWO_P32 = (4294967296.0); //!< 2^32 this is too big for an int so add the x.0 +const double TWO_P56 = (7.205759403792794e+016); //!< 2^56 +const double TWO_P57 = (1.441151880758559e+017); //!< 2^57 -const double TWO_N5 =(0.03125); //!< 2^-5 -const double TWO_N11 =(4.882812500000000e-004); //!< 2^-11 -const double TWO_N19 =(1.907348632812500e-006); //!< 2^-19 -const double TWO_N20 =(9.536743164062500e-007); //!< 2^-20 -const double TWO_N21 =(4.768371582031250e-007); //!< 2^-21 -const double TWO_N24 =(5.960464477539063e-008); //!< 2^-24 -const double TWO_N25 =(2.980232238769531e-008); //!< 2^-25 -const double TWO_N27 =(7.450580596923828e-009); //!< 2^-27 -const double TWO_N29 =(1.862645149230957e-009); //!< 2^-29 -const double TWO_N30 =(9.313225746154785e-010); //!< 2^-30 -const double TWO_N31 =(4.656612873077393e-010); //!< 2^-31 -const double TWO_N32 =(2.328306436538696e-010); //!< 2^-32 -const double TWO_N33 =(1.164153218269348e-010); //!< 2^-33 -const double TWO_N38 =(3.637978807091713e-012); //!< 2^-38 -const double TWO_N43 =(1.136868377216160e-013); //!< 2^-43 -const double TWO_N50 =(8.881784197001252e-016); //!< 2^-50 -const double TWO_N55 =(2.775557561562891e-017); //!< 2^-55 +const double TWO_N5 = (0.03125); //!< 2^-5 +const double TWO_N11 = (4.882812500000000e-004); //!< 2^-11 +const double TWO_N19 = (1.907348632812500e-006); //!< 2^-19 +const double TWO_N20 = (9.536743164062500e-007); //!< 2^-20 +const double TWO_N21 = (4.768371582031250e-007); //!< 2^-21 +const double TWO_N24 = (5.960464477539063e-008); //!< 2^-24 +const double TWO_N25 = (2.980232238769531e-008); //!< 2^-25 +const double TWO_N27 = (7.450580596923828e-009); //!< 2^-27 +const double TWO_N29 = (1.862645149230957e-009); //!< 2^-29 +const double TWO_N30 = (9.313225746154785e-010); //!< 2^-30 +const double TWO_N31 = (4.656612873077393e-010); //!< 2^-31 +const double TWO_N32 = (2.328306436538696e-010); //!< 2^-32 +const double TWO_N33 = (1.164153218269348e-010); //!< 2^-33 +const double TWO_N38 = (3.637978807091713e-012); //!< 2^-38 +const double TWO_N43 = (1.136868377216160e-013); //!< 2^-43 +const double TWO_N50 = (8.881784197001252e-016); //!< 2^-50 +const double TWO_N55 = (2.775557561562891e-017); //!< 2^-55 - -const double PI_TWO_N19 =(5.992112452678286e-006); //!< Pi*2^-19 -const double PI_TWO_N43 =(3.571577341960839e-013); //!< Pi*2^-43 -const double PI_TWO_N31 =(1.462918079267160e-009); //!< Pi*2^-31 -const double PI_TWO_N38 =(1.142904749427469e-011); //!< Pi*2^-38 -const double PI_TWO_N23 =(3.745070282923929e-007); //!< Pi*2^-23 +const double PI_TWO_N19 = (5.992112452678286e-006); //!< Pi*2^-19 +const double PI_TWO_N43 = (3.571577341960839e-013); //!< Pi*2^-43 +const double PI_TWO_N31 = (1.462918079267160e-009); //!< Pi*2^-31 +const double PI_TWO_N38 = (1.142904749427469e-011); //!< Pi*2^-38 +const double PI_TWO_N23 = (3.745070282923929e-007); //!< Pi*2^-23 @@ -147,130 +132,129 @@ const double PI_TWO_N23 =(3.745070282923929e-007); //!< Pi*2^-2 // SUBFRAME 1-5 (TLM and HOW) -const bits_slice TOW[]= {{31,17}}; -const bits_slice INTEGRITY_STATUS_FLAG[] = {{23,1}}; -const bits_slice ALERT_FLAG[] = {{48,1}}; -const bits_slice ANTI_SPOOFING_FLAG[] = {{49,1}}; -const bits_slice SUBFRAME_ID[]= {{50,3}}; +const std::vector> TOW({{31,17}}); +const std::vector> INTEGRITY_STATUS_FLAG({{23,1}}); +const std::vector> ALERT_FLAG({{48,1}}); +const std::vector> ANTI_SPOOFING_FLAG({{49,1}}); +const std::vector> SUBFRAME_ID({{50,3}}); // SUBFRAME 1 -const bits_slice GPS_WEEK[]= {{61,10}}; -const bits_slice CA_OR_P_ON_L2[]= {{71,2}}; //* -const bits_slice SV_ACCURACY[]= {{73,4}}; -const bits_slice SV_HEALTH[]= {{77,6}}; -const bits_slice L2_P_DATA_FLAG[] = {{91,1}}; -const bits_slice T_GD[]= {{197,8}}; -const double T_GD_LSB=TWO_N31; +const std::vector> GPS_WEEK({{61,10}}); +const std::vector> CA_OR_P_ON_L2({{71,2}}); //* +const std::vector> SV_ACCURACY({{73,4}}); +const std::vector> SV_HEALTH ({{77,6}}); +const std::vector> L2_P_DATA_FLAG ({{91,1}}); +const std::vector> T_GD({{197,8}}); +const double T_GD_LSB = TWO_N31; -const bits_slice IODC[]= {{83,2},{211,8}}; -const bits_slice T_OC[]= {{219,16}}; -const double T_OC_LSB=TWO_P4; +const std::vector> IODC({{83,2},{211,8}}); +const std::vector> T_OC({{219,16}}); +const double T_OC_LSB = TWO_P4; -const bits_slice A_F2[]= {{241,8}}; -const double A_F2_LSB=TWO_N55; -const bits_slice A_F1[]= {{249,16}}; -const double A_F1_LSB=TWO_N43; -const bits_slice A_F0[]= {{271,22}}; -const double A_F0_LSB=TWO_N31; +const std::vector> A_F2({{241,8}}); +const double A_F2_LSB = TWO_N55; +const std::vector> A_F1({{249,16}}); +const double A_F1_LSB = TWO_N43; +const std::vector> A_F0({{271,22}}); +const double A_F0_LSB = TWO_N31; // SUBFRAME 2 -const bits_slice IODE_SF2[]= {{61,8}}; -const bits_slice C_RS[]= {{69,16}}; -const double C_RS_LSB=TWO_N5; -const bits_slice DELTA_N[]= {{91,16}}; -const double DELTA_N_LSB=PI_TWO_N43; -const bits_slice M_0[]= {{107,8},{121,24}}; -const double M_0_LSB=PI_TWO_N31; -const bits_slice C_UC[]= {{151,16}}; -const double C_UC_LSB=TWO_N29; -const bits_slice E[]= {{167,8},{181,24}}; -const double E_LSB=TWO_N33; -const bits_slice C_US[]= {{211,16}}; -const double C_US_LSB=TWO_N29; -const bits_slice SQRT_A[]= {{227,8},{241,24}}; -const double SQRT_A_LSB=TWO_N19; -const bits_slice T_OE[]= {{271,16}}; -const double T_OE_LSB=TWO_P4; -const bits_slice FIT_INTERVAL_FLAG[]= {{271,1}}; -const bits_slice AODO[] = {{272,5}}; +const std::vector> IODE_SF2({{61,8}}); +const std::vector> C_RS({{69,16}}); +const double C_RS_LSB = TWO_N5; +const std::vector> DELTA_N({{91,16}}); +const double DELTA_N_LSB = PI_TWO_N43; +const std::vector> M_0({{107,8},{121,24}}); +const double M_0_LSB = PI_TWO_N31; +const std::vector> C_UC({{151,16}}); +const double C_UC_LSB = TWO_N29; +const std::vector> E({{167,8},{181,24}}); +const double E_LSB = TWO_N33; +const std::vector> C_US({{211,16}}); +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 std::vector> FIT_INTERVAL_FLAG({{271,1}}); +const std::vector> AODO({{272,5}}); const int AODO_LSB = 900; // SUBFRAME 3 -const bits_slice C_IC[]= {{61,16}}; -const double C_IC_LSB=TWO_N29; -const bits_slice OMEGA_0[]= {{77,8},{91,24}}; -const double OMEGA_0_LSB=PI_TWO_N31; -const bits_slice C_IS[]= {{121,16}}; -const double C_IS_LSB=TWO_N29; -const bits_slice I_0[]= {{137,8},{151,24}}; -const double I_0_LSB=PI_TWO_N31; -const bits_slice C_RC[]= {{181,16}}; -const double C_RC_LSB=TWO_N5; -const bits_slice OMEGA[]= {{197,8},{211,24}}; -const double OMEGA_LSB=PI_TWO_N31; -const bits_slice OMEGA_DOT[]= {{241,24}}; -const double OMEGA_DOT_LSB=PI_TWO_N43; -const bits_slice IODE_SF3[]= {{271,8}}; - -const bits_slice I_DOT[]= {{279,14}}; -const double I_DOT_LSB=PI_TWO_N43; +const std::vector> C_IC({{61,16}}); +const double C_IC_LSB = TWO_N29; +const std::vector> OMEGA_0({{77,8},{91,24}}); +const double OMEGA_0_LSB = PI_TWO_N31; +const std::vector> C_IS({{121,16}}); +const double C_IS_LSB = TWO_N29; +const std::vector> I_0({{137,8},{151,24}}); +const double I_0_LSB = PI_TWO_N31; +const std::vector> C_RC({{181,16}}); +const double C_RC_LSB = TWO_N5; +const std::vector> OMEGA({{197,8},{211,24}}); +const double OMEGA_LSB = PI_TWO_N31; +const std::vector> OMEGA_DOT({{241,24}}); +const double OMEGA_DOT_LSB = PI_TWO_N43; +const std::vector> IODE_SF3({{271,8}}); +const std::vector> I_DOT({{279,14}}); +const double I_DOT_LSB = PI_TWO_N43; // SUBFRAME 4-5 -const bits_slice SV_DATA_ID[]= {{61,2}}; -const bits_slice SV_PAGE[]= {{63,6}}; +const std::vector> SV_DATA_ID({{61,2}}); +const std::vector> SV_PAGE({{63,6}}); // SUBFRAME 4 //! \todo read all pages of subframe 4 // Page 18 - Ionospheric and UTC data -const bits_slice ALPHA_0[]= {{69,8}}; -const double ALPHA_0_LSB=TWO_N30; -const bits_slice ALPHA_1[]= {{77,8}}; -const double ALPHA_1_LSB=TWO_N27; -const bits_slice ALPHA_2[]= {{91,8}}; -const double ALPHA_2_LSB=TWO_N24; -const bits_slice ALPHA_3[]= {{99,8}}; -const double ALPHA_3_LSB=TWO_N24; -const bits_slice BETA_0[]= {{107,8}}; -const double BETA_0_LSB=TWO_P11; -const bits_slice BETA_1[]= {{121,8}}; -const double BETA_1_LSB=TWO_P14; -const bits_slice BETA_2[]= {{129,8}}; -const double BETA_2_LSB=TWO_P16; -const bits_slice BETA_3[]= {{137,8}}; -const double BETA_3_LSB=TWO_P16; -const bits_slice A_1[]= {{151,24}}; -const double A_1_LSB=TWO_N50; -const bits_slice A_0[]= {{181,24},{211,8}}; -const double A_0_LSB=TWO_N30; -const bits_slice T_OT[]= {{219,8}}; -const double T_OT_LSB=TWO_P12; -const bits_slice WN_T[]= {{227,8}}; +const std::vector> ALPHA_0({{69,8}}); +const double ALPHA_0_LSB = TWO_N30; +const std::vector> ALPHA_1({{77,8}}); +const double ALPHA_1_LSB = TWO_N27; +const std::vector> ALPHA_2({{91,8}}); +const double ALPHA_2_LSB = TWO_N24; +const std::vector> ALPHA_3({{99,8}}); +const double ALPHA_3_LSB = TWO_N24; +const std::vector> BETA_0({{107,8}}); +const double BETA_0_LSB = TWO_P11; +const std::vector> BETA_1({{121,8}}); +const double BETA_1_LSB = TWO_P14; +const std::vector> BETA_2({{129,8}}); +const double BETA_2_LSB = TWO_P16; +const std::vector> BETA_3({{137,8}}); +const double BETA_3_LSB = TWO_P16; +const std::vector> A_1({{151,24}}); +const double A_1_LSB = TWO_N50; +const std::vector> A_0({{181,24},{211,8}}); +const double A_0_LSB = TWO_N30; +const std::vector> T_OT({{219,8}}); +const double T_OT_LSB = TWO_P12; +const std::vector> WN_T({{227,8}}); const double WN_T_LSB = 1; -const bits_slice DELTAT_LS[]= {{241,8}}; +const std::vector> DELTAT_LS({{241,8}}); const double DELTAT_LS_LSB = 1; -const bits_slice WN_LSF[]= {{249,8}}; +const std::vector> WN_LSF({{249,8}}); const double WN_LSF_LSB = 1; -const bits_slice DN[]= {{257,8}}; +const std::vector> DN({{257,8}}); const double DN_LSB = 1; -const bits_slice DELTAT_LSF[]= {{271,8}}; +const std::vector> DELTAT_LSF({{271,8}}); const double DELTAT_LSF_LSB = 1; // Page 25 - Antispoofing, SV config and SV health (PRN 25 -32) -const bits_slice HEALTH_SV25[]={{229,6}}; -const bits_slice HEALTH_SV26[]={{241,6}}; -const bits_slice HEALTH_SV27[]={{247,6}}; -const bits_slice HEALTH_SV28[]={{253,6}}; -const bits_slice HEALTH_SV29[]={{259,6}}; -const bits_slice HEALTH_SV30[]={{271,6}}; -const bits_slice HEALTH_SV31[]={{277,6}}; -const bits_slice HEALTH_SV32[]={{283,6}}; +const std::vector> HEALTH_SV25({{229,6}}); +const std::vector> HEALTH_SV26({{241,6}}); +const std::vector> HEALTH_SV27({{247,6}}); +const std::vector> HEALTH_SV28({{253,6}}); +const std::vector> HEALTH_SV29({{259,6}}); +const std::vector> HEALTH_SV30({{271,6}}); +const std::vector> HEALTH_SV31({{277,6}}); +const std::vector> HEALTH_SV32({{283,6}}); @@ -281,33 +265,33 @@ const bits_slice HEALTH_SV32[]={{283,6}}; // page 25 - Health (PRN 1 - 24) -const bits_slice T_OA[]={{69,8}}; +const std::vector> T_OA({{69,8}}); const double T_OA_LSB = TWO_P12; -const bits_slice WN_A[]={{77,8}}; -const bits_slice HEALTH_SV1[]={{91,6}}; -const bits_slice HEALTH_SV2[]={{97,6}}; -const bits_slice HEALTH_SV3[]={{103,6}}; -const bits_slice HEALTH_SV4[]={{109,6}}; -const bits_slice HEALTH_SV5[]={{121,6}}; -const bits_slice HEALTH_SV6[]={{127,6}}; -const bits_slice HEALTH_SV7[]={{133,6}}; -const bits_slice HEALTH_SV8[]={{139,6}}; -const bits_slice HEALTH_SV9[]={{151,6}}; -const bits_slice HEALTH_SV10[]={{157,6}}; -const bits_slice HEALTH_SV11[]={{163,6}}; -const bits_slice HEALTH_SV12[]={{169,6}}; -const bits_slice HEALTH_SV13[]={{181,6}}; -const bits_slice HEALTH_SV14[]={{187,6}}; -const bits_slice HEALTH_SV15[]={{193,6}}; -const bits_slice HEALTH_SV16[]={{199,6}}; -const bits_slice HEALTH_SV17[]={{211,6}}; -const bits_slice HEALTH_SV18[]={{217,6}}; -const bits_slice HEALTH_SV19[]={{223,6}}; -const bits_slice HEALTH_SV20[]={{229,6}}; -const bits_slice HEALTH_SV21[]={{241,6}}; -const bits_slice HEALTH_SV22[]={{247,6}}; -const bits_slice HEALTH_SV23[]={{253,6}}; -const bits_slice HEALTH_SV24[]={{259,6}}; +const std::vector> WN_A({{77,8}}); +const std::vector> HEALTH_SV1({{91,6}}); +const std::vector> HEALTH_SV2({{97,6}}); +const std::vector> HEALTH_SV3({{103,6}}); +const std::vector> HEALTH_SV4({{109,6}}); +const std::vector> HEALTH_SV5({{121,6}}); +const std::vector> HEALTH_SV6({{127,6}}); +const std::vector> HEALTH_SV7({{133,6}}); +const std::vector> HEALTH_SV8({{139,6}}); +const std::vector> HEALTH_SV9({{151,6}}); +const std::vector> HEALTH_SV10({{157,6}}); +const std::vector> HEALTH_SV11({{163,6}}); +const std::vector> HEALTH_SV12({{169,6}}); +const std::vector> HEALTH_SV13({{181,6}}); +const std::vector> HEALTH_SV14({{187,6}}); +const std::vector> HEALTH_SV15({{193,6}}); +const std::vector> HEALTH_SV16({{199,6}}); +const std::vector> HEALTH_SV17({{211,6}}); +const std::vector> HEALTH_SV18({{217,6}}); +const std::vector> HEALTH_SV19({{223,6}}); +const std::vector> HEALTH_SV20({{229,6}}); +const std::vector> HEALTH_SV21({{241,6}}); +const std::vector> HEALTH_SV22({{247,6}}); +const std::vector> HEALTH_SV23({{253,6}}); +const std::vector> HEALTH_SV24({{259,6}}); /* diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index 6334d7abc..e02ad33bf 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -7,7 +7,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -34,266 +34,262 @@ #include #include "boost/date_time/posix_time/posix_time.hpp" -#define num_of_slices(x) sizeof(x)/sizeof(bits_slice) - void Gps_Navigation_Message::reset() { - b_update_tow_flag=false; - b_valid_ephemeris_set_flag=false; - d_TOW=0; - d_TOW_SF1 = 0; - d_TOW_SF2 = 0; - d_TOW_SF3 = 0; - d_TOW_SF4 = 0; - d_TOW_SF5 = 0; + b_update_tow_flag = false; + b_valid_ephemeris_set_flag = false; + 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; - d_Delta_n = 0; - d_M_0 = 0; - d_Cuc = 0; - d_e_eccentricity = 0; - d_Cus = 0; - d_sqrt_A = 0; - d_Toe = 0; - d_Toc = 0; - d_Cic = 0; - d_OMEGA0 = 0; - d_Cis = 0; - d_i_0 = 0; - d_Crc = 0; - d_OMEGA = 0; - d_OMEGA_DOT = 0; - d_IDOT = 0; - i_code_on_L2 = 0; - i_GPS_week = 0; - b_L2_P_data_flag = false; - i_SV_accuracy = 0; - i_SV_health = 0; - d_TGD = 0; - d_IODC = -1; - i_AODO = 0; + d_IODE_SF2 = 0; + d_IODE_SF3 = 0; + d_Crs = 0; + d_Delta_n = 0; + d_M_0 = 0; + d_Cuc = 0; + d_e_eccentricity = 0; + d_Cus = 0; + d_sqrt_A = 0; + d_Toe = 0; + d_Toc = 0; + d_Cic = 0; + d_OMEGA0 = 0; + d_Cis = 0; + d_i_0 = 0; + d_Crc = 0; + d_OMEGA = 0; + d_OMEGA_DOT = 0; + d_IDOT = 0; + i_code_on_L2 = 0; + i_GPS_week = 0; + b_L2_P_data_flag = false; + i_SV_accuracy = 0; + i_SV_health = 0; + d_TGD = 0; + d_IODC = -1; + i_AODO = 0; - b_fit_interval_flag = false; - d_spare1 = 0; - d_spare2 = 0; + b_fit_interval_flag = false; + d_spare1 = 0; + d_spare2 = 0; - d_A_f0 = 0; - d_A_f1 = 0; - d_A_f2 = 0; + d_A_f0 = 0; + d_A_f1 = 0; + d_A_f2 = 0; - //clock terms - //d_master_clock=0; - d_dtr = 0; - d_satClkCorr = 0; + //clock terms + //d_master_clock=0; + d_dtr = 0; + d_satClkCorr = 0; - // satellite positions - d_satpos_X = 0; - d_satpos_Y = 0; - d_satpos_Z = 0; + // satellite positions + d_satpos_X = 0; + d_satpos_Y = 0; + d_satpos_Z = 0; - // info - i_channel_ID = 0; - i_satellite_PRN = 0; + // info + i_channel_ID = 0; + i_satellite_PRN = 0; - // time synchro - d_subframe_timestamp_ms = 0; + // time synchro + d_subframe_timestamp_ms = 0; - // flags - b_alert_flag = false; - b_integrity_status_flag = false; - b_antispoofing_flag = false; + // flags + b_alert_flag = false; + b_integrity_status_flag = false; + b_antispoofing_flag = false; + // Ionosphere and UTC + d_alpha0 = 0; + d_alpha1 = 0; + d_alpha2 = 0; + d_alpha3 = 0; + d_beta0 = 0; + d_beta1 = 0; + d_beta2 = 0; + d_beta3 = 0; + d_A1 = 0; + d_A0 = 0; + d_t_OT = 0; + i_WN_T = 0; + d_DeltaT_LS = 0; + i_WN_LSF = 0; + i_DN = 0; + d_DeltaT_LSF= 0; - // Ionosphere and UTC - d_alpha0 = 0; - d_alpha1 = 0; - d_alpha2 = 0; - d_alpha3 = 0; - d_beta0 = 0; - d_beta1 = 0; - d_beta2 = 0; - d_beta3 = 0; - d_A1 = 0; - d_A0 = 0; - d_t_OT = 0; - i_WN_T = 0; - d_DeltaT_LS = 0; - i_WN_LSF = 0; - i_DN = 0; - d_DeltaT_LSF= 0; + //Almanac + d_Toa = 0; + i_WN_A = 0; + for (int i=1; i < 32; i++ ) + { + almanacHealth[i] = 0; + } - //Almanac - d_Toa = 0; - i_WN_A = 0; - for (int i=1; i < 32; i++ ) - { - almanacHealth[i] = 0; - } + // Satellite velocity + d_satvel_X = 0; + d_satvel_Y = 0; + d_satvel_Z = 0; - // Satellite velocity - d_satvel_X = 0; - d_satvel_Y = 0; - d_satvel_Z = 0; - - //Plane A (info from http://www.navcen.uscg.gov/?Do=constellationStatus) - satelliteBlock[9] = "IIA"; - satelliteBlock[31] = "IIR-M"; - satelliteBlock[8] = "IIA"; - satelliteBlock[7] = "IIR-M"; - satelliteBlock[27] = "IIA"; - //Plane B - satelliteBlock[16] = "IIR"; - satelliteBlock[25] = "IIF"; - satelliteBlock[28] = "IIR"; - satelliteBlock[12] = "IIR-M"; - satelliteBlock[30] = "IIA"; - //Plane C - satelliteBlock[29] = "IIR-M"; - satelliteBlock[3] = "IIA"; - satelliteBlock[19] = "IIR"; - satelliteBlock[17] = "IIR-M"; - satelliteBlock[6] = "IIA"; - //Plane D - satelliteBlock[2] = "IIR"; - satelliteBlock[1] = "IIF"; - satelliteBlock[21] = "IIR"; - satelliteBlock[4] = "IIA"; - satelliteBlock[11] = "IIR"; - satelliteBlock[24] = "IIA"; // Decommissioned from active service on 04 Nov 2011 - //Plane E - satelliteBlock[20] = "IIR"; - satelliteBlock[22] = "IIR"; - satelliteBlock[5] = "IIR-M"; - satelliteBlock[18] = "IIR"; - satelliteBlock[32] = "IIA"; - satelliteBlock[10] = "IIA"; - //Plane F - satelliteBlock[14] = "IIR"; - satelliteBlock[15] = "IIR-M"; - satelliteBlock[13] = "IIR"; - satelliteBlock[23] = "IIR"; - satelliteBlock[26] = "IIA"; + //Plane A (info from http://www.navcen.uscg.gov/?Do=constellationStatus) + satelliteBlock[9] = "IIA"; + satelliteBlock[31] = "IIR-M"; + satelliteBlock[8] = "IIA"; + satelliteBlock[7] = "IIR-M"; + satelliteBlock[27] = "IIA"; + //Plane B + satelliteBlock[16] = "IIR"; + satelliteBlock[25] = "IIF"; + satelliteBlock[28] = "IIR"; + satelliteBlock[12] = "IIR-M"; + satelliteBlock[30] = "IIA"; + //Plane C + satelliteBlock[29] = "IIR-M"; + satelliteBlock[3] = "IIA"; + satelliteBlock[19] = "IIR"; + satelliteBlock[17] = "IIR-M"; + satelliteBlock[6] = "IIA"; + //Plane D + satelliteBlock[2] = "IIR"; + satelliteBlock[1] = "IIF"; + satelliteBlock[21] = "IIR"; + satelliteBlock[4] = "IIA"; + satelliteBlock[11] = "IIR"; + satelliteBlock[24] = "IIA"; // Decommissioned from active service on 04 Nov 2011 + //Plane E + satelliteBlock[20] = "IIR"; + satelliteBlock[22] = "IIR"; + satelliteBlock[5] = "IIR-M"; + satelliteBlock[18] = "IIR"; + satelliteBlock[32] = "IIA"; + satelliteBlock[10] = "IIA"; + //Plane F + satelliteBlock[14] = "IIR"; + satelliteBlock[15] = "IIR-M"; + satelliteBlock[13] = "IIR"; + satelliteBlock[23] = "IIR"; + satelliteBlock[26] = "IIA"; } Gps_Navigation_Message::Gps_Navigation_Message() { - reset(); + reset(); } void Gps_Navigation_Message::print_gps_word_bytes(unsigned int GPS_word) { - std::cout << " Word ="; - std::cout << std::bitset<32>(GPS_word); - std::cout << std::endl; + std::cout << " Word ="; + std::cout << std::bitset<32>(GPS_word); + std::cout << std::endl; } -bool Gps_Navigation_Message::read_navigation_bool(std::bitset bits, const bits_slice *slices) +bool Gps_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector> parameter) { - bool value; + bool value; - if (bits[GPS_SUBFRAME_BITS - slices[0].position] == 1) - { - value = true; - } - else - { - value = false; - } - return value; + if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1) + { + value = true; + } + else + { + value = false; + } + return value; +} + + + + +unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) +{ + unsigned long int value = 0; + int num_of_slices = parameter.size(); + for (int i=0; i bits, const bits_slice *slices, int num_of_slices) +signed long int Gps_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector> parameter) { - unsigned long int value = 0; - for (int i=0; i bits, const bits_slice *slices, int num_of_slices) -{ - signed long int value = 0; - - // Discriminate between 64 bits and 32 bits compiler - int long_int_size_bytes = sizeof(signed long int); - if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system - { - // read the MSB and perform the sign extension - if (bits[GPS_SUBFRAME_BITS - slices[0].position] == 1) - { - value^=0xFFFFFFFFFFFFFFFF; //64 bits variable - } - else - { - value&=0; - } - - for (int i=0; i half_week) - { - corrTime = time - 2*half_week; - } - else if (time < -half_week) - { - corrTime = time + 2*half_week; - } - return corrTime; + double corrTime; + double half_week = 302400; // seconds + corrTime = time; + if (time > half_week) + { + corrTime = time - 2*half_week; + } + else if (time < -half_week) + { + corrTime = time + 2*half_week; + } + return corrTime; } @@ -322,11 +318,11 @@ double Gps_Navigation_Message::check_t(double time) // 20.3.3.3.3.1 User Algorithm for SV Clock Correction. double Gps_Navigation_Message::sv_clock_correction(double transmitTime) { - double dt; - dt = check_t(transmitTime - d_Toc); - d_satClkCorr = (d_A_f2 * dt + d_A_f1) * dt + d_A_f0 + d_dtr; - double correctedTime = transmitTime - d_satClkCorr; - return correctedTime; + double dt; + dt = check_t(transmitTime - d_Toc); + d_satClkCorr = (d_A_f2 * dt + d_A_f1) * dt + d_A_f0 + d_dtr; + double correctedTime = transmitTime - d_satClkCorr; + return correctedTime; } @@ -335,96 +331,96 @@ double Gps_Navigation_Message::sv_clock_correction(double transmitTime) void Gps_Navigation_Message::satellitePosition(double transmitTime) { - double tk; - double a; - double n; - double n0; - double M; - double E; - double E_old; - double dE; - double nu; - double phi; - double u; - double r; - double i; - double Omega; + double tk; + double a; + double n; + double n0; + double M; + double E; + double E_old; + double dE; + double nu; + double phi; + double u; + double r; + double i; + double Omega; - // Find satellite's position ---------------------------------------------- + // Find satellite's position ---------------------------------------------- - // Restore semi-major axis - a = d_sqrt_A*d_sqrt_A; + // Restore semi-major axis + a = d_sqrt_A*d_sqrt_A; - // Time from ephemeris reference epoch - tk = check_t(transmitTime - d_Toe); + // Time from ephemeris reference epoch + tk = check_t(transmitTime - d_Toe); - // Computed mean motion - n0 = sqrt(GM / (a*a*a)); + // Computed mean motion + n0 = sqrt(GM / (a*a*a)); - // Corrected mean motion - n = n0 + d_Delta_n; + // Corrected mean motion + n = n0 + d_Delta_n; - // Mean anomaly - M = d_M_0 + n * tk; + // Mean anomaly + M = d_M_0 + n * tk; - // Reduce mean anomaly to between 0 and 2pi - M = fmod((M + 2*GPS_PI), (2*GPS_PI)); + // Reduce mean anomaly to between 0 and 2pi + M = fmod((M + 2*GPS_PI), (2*GPS_PI)); - // Initial guess of eccentric anomaly - E = M; + // Initial guess of eccentric anomaly + E = M; - // --- Iteratively compute eccentric anomaly ---------------------------- - for (int ii = 1; ii<20; ii++) - { - E_old = E; - E = M + d_e_eccentricity * sin(E); - dE = fmod(E - E_old, 2*GPS_PI); - if (fabs(dE) < 1e-12) - { - //Necessary precision is reached, exit from the loop - break; - } - } + // --- Iteratively compute eccentric anomaly ---------------------------- + for (int ii = 1; ii<20; ii++) + { + E_old = E; + E = M + d_e_eccentricity * sin(E); + dE = fmod(E - E_old, 2*GPS_PI); + if (fabs(dE) < 1e-12) + { + //Necessary precision is reached, exit from the loop + break; + } + } - // Compute relativistic correction term - d_dtr = F * d_e_eccentricity * d_sqrt_A * sin(E); + // Compute relativistic correction term + d_dtr = F * d_e_eccentricity * d_sqrt_A * sin(E); - // Compute the true anomaly - double tmp_Y = sqrt(1.0 - d_e_eccentricity*d_e_eccentricity) * sin(E); - double tmp_X = cos(E) - d_e_eccentricity; - nu = atan2(tmp_Y, tmp_X); + // Compute the true anomaly + double tmp_Y = sqrt(1.0 - d_e_eccentricity * d_e_eccentricity) * sin(E); + double tmp_X = cos(E) - d_e_eccentricity; + nu = atan2(tmp_Y, tmp_X); - // Compute angle phi (argument of Latitude) - phi = nu + d_OMEGA; + // Compute angle phi (argument of Latitude) + phi = nu + d_OMEGA; - // Reduce phi to between 0 and 2*pi rad - phi = fmod((phi), (2*GPS_PI)); + // Reduce phi to between 0 and 2*pi rad + phi = fmod((phi), (2*GPS_PI)); - // Correct argument of latitude - u = phi + d_Cuc * cos(2*phi) + d_Cus * sin(2*phi); + // Correct argument of latitude + u = phi + d_Cuc * cos(2*phi) + d_Cus * sin(2*phi); - // Correct radius - r = a * (1 - d_e_eccentricity*cos(E)) + d_Crc * cos(2*phi) + d_Crs * sin(2*phi); + // Correct radius + r = a * (1 - d_e_eccentricity*cos(E)) + d_Crc * cos(2*phi) + d_Crs * sin(2*phi); - // Correct inclination - i = d_i_0 + d_IDOT * tk + d_Cic * cos(2*phi) + d_Cis * sin(2*phi); + // Correct inclination + i = d_i_0 + d_IDOT * tk + d_Cic * cos(2*phi) + d_Cis * sin(2*phi); - // Compute the angle between the ascending node and the Greenwich meridian - Omega = d_OMEGA0 + (d_OMEGA_DOT - OMEGA_EARTH_DOT)*tk - OMEGA_EARTH_DOT * d_Toe; + // Compute the angle between the ascending node and the Greenwich meridian + Omega = d_OMEGA0 + (d_OMEGA_DOT - OMEGA_EARTH_DOT)*tk - OMEGA_EARTH_DOT * d_Toe; - // Reduce to between 0 and 2*pi rad - Omega = fmod((Omega + 2*GPS_PI), (2*GPS_PI)); + // Reduce to between 0 and 2*pi rad + Omega = fmod((Omega + 2*GPS_PI), (2*GPS_PI)); - // --- Compute satellite coordinates in Earth-fixed coordinates - d_satpos_X = cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega); - d_satpos_Y = cos(u) * r * sin(Omega) + sin(u) * r * cos(i) * cos(Omega); - d_satpos_Z = sin(u) * r * sin(i); + // --- Compute satellite coordinates in Earth-fixed coordinates + d_satpos_X = cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega); + d_satpos_Y = cos(u) * r * sin(Omega) + sin(u) * r * cos(i) * cos(Omega); + d_satpos_Z = sin(u) * r * sin(i); - // Satellite's velocity. Can be useful for Vector Tracking loops - double Omega_dot = d_OMEGA_DOT - OMEGA_EARTH_DOT; - d_satvel_X = - Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + d_satpos_X * cos(Omega) - d_satpos_Y * cos(i) * sin(Omega); - d_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + d_satpos_X * sin(Omega) + d_satpos_Y * cos(i) * cos(Omega); - d_satvel_Z = d_satpos_Y * sin(i); + // Satellite's velocity. Can be useful for Vector Tracking loops + double Omega_dot = d_OMEGA_DOT - OMEGA_EARTH_DOT; + d_satvel_X = - Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + d_satpos_X * cos(Omega) - d_satpos_Y * cos(i) * sin(Omega); + d_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + d_satpos_X * sin(Omega) + d_satpos_Y * cos(i) * cos(Omega); + d_satvel_Z = d_satpos_Y * sin(i); } @@ -433,236 +429,236 @@ void Gps_Navigation_Message::satellitePosition(double transmitTime) int Gps_Navigation_Message::subframe_decoder(char *subframe) { - int subframe_ID = 0; - int SV_data_ID = 0; - int SV_page = 0; - //double tmp_TOW; + int subframe_ID = 0; + int SV_data_ID = 0; + int SV_page = 0; + //double tmp_TOW; - unsigned int gps_word; + unsigned int gps_word; - // UNPACK BYTES TO BITS AND REMOVE THE CRC REDUNDANCE - std::bitset subframe_bits; - std::bitset word_bits; - for (int i=0; i<10; i++) - { - memcpy(&gps_word, &subframe[i*4], sizeof(char)*4); - word_bits = std::bitset<(GPS_WORD_BITS+2)>(gps_word); - for (int j=0; j subframe_bits; + std::bitset word_bits; + for (int i=0; i<10; i++) + { + memcpy(&gps_word, &subframe[i*4], sizeof(char)*4); + word_bits = std::bitset<(GPS_WORD_BITS+2)>(gps_word); + for (int j=0; j= 0) // is not in the past - { - //Detect if the effectivity time and user's time is within six hours = 6 * 60 *60 = 21600 s - int secondOfLeapSecondEvent = i_DN * 24 * 60 * 60; - if (weeksToLeapSecondEvent > 0) - { - t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); - } - else //we are in the same week than the leap second event - { - if (abs(gpstime_corrected - secondOfLeapSecondEvent) > 21600) - { - /* 20.3.3.5.2.4a - * Whenever the effectivity time indicated by the WN_LSF and the DN values - * is not in the past (relative to the user's present time), and the user's - * present time does not fall in the time span which starts at six hours prior - * to the effectivity time and ends at six hours after the effectivity time, - * the UTC/GPS-time relationship is given by - */ - t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); - } - else - { - /* 20.3.3.5.2.4b - * Whenever the user's current time falls within the time span of six hours - * prior to the effectivity time to six hours after the effectivity time, - * proper accommodation of the leap second event with a possible week number - * transition is provided by the following expression for UTC: - */ - int W = fmod(gpstime_corrected - Delta_t_UTC - 43200, 86400) + 43200; - t_utc_daytime = fmod(W, 86400 + d_DeltaT_LSF - d_DeltaT_LS); - //implement something to handle a leap second event! - } - if ( (gpstime_corrected - secondOfLeapSecondEvent) > 21600) - { - Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800*(double)(i_GPS_week - i_WN_T)); - t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); - } - } - } - else // the effectivity time is in the past - { - /* 20.3.3.5.2.4c - * Whenever the effectivity time of the leap second event, as indicated by the - * WNLSF and DN values, is in the "past" (relative to the user's current time), - * and the user�s current time does not fall in the time span as given above - * in 20.3.3.5.2.4b,*/ - Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800 * (double)(i_GPS_week - i_WN_T)); - t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); - } + if ((weeksToLeapSecondEvent) >= 0) // is not in the past + { + //Detect if the effectivity time and user's time is within six hours = 6 * 60 *60 = 21600 s + int secondOfLeapSecondEvent = i_DN * 24 * 60 * 60; + if (weeksToLeapSecondEvent > 0) + { + t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); + } + else //we are in the same week than the leap second event + { + if (abs(gpstime_corrected - secondOfLeapSecondEvent) > 21600) + { + /* 20.3.3.5.2.4a + * Whenever the effectivity time indicated by the WN_LSF and the DN values + * is not in the past (relative to the user's present time), and the user's + * present time does not fall in the time span which starts at six hours prior + * to the effectivity time and ends at six hours after the effectivity time, + * the UTC/GPS-time relationship is given by + */ + t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); + } + else + { + /* 20.3.3.5.2.4b + * Whenever the user's current time falls within the time span of six hours + * prior to the effectivity time to six hours after the effectivity time, + * proper accommodation of the leap second event with a possible week number + * transition is provided by the following expression for UTC: + */ + int W = fmod(gpstime_corrected - Delta_t_UTC - 43200, 86400) + 43200; + t_utc_daytime = fmod(W, 86400 + d_DeltaT_LSF - d_DeltaT_LS); + //implement something to handle a leap second event! + } + if ( (gpstime_corrected - secondOfLeapSecondEvent) > 21600) + { + Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800*(double)(i_GPS_week - i_WN_T)); + t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); + } + } + } + else // the effectivity time is in the past + { + /* 20.3.3.5.2.4c + * Whenever the effectivity time of the leap second event, as indicated by the + * WNLSF and DN values, is in the "past" (relative to the user's current time), + * and the user�s current time does not fall in the time span as given above + * in 20.3.3.5.2.4b,*/ + Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800 * (double)(i_GPS_week - i_WN_T)); + t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); + } - double secondsOfWeekBeforeToday = 43200 * floor(gpstime_corrected / 43200); - t_utc = secondsOfWeekBeforeToday + t_utc_daytime; - return t_utc; + double secondsOfWeekBeforeToday = 43200 * floor(gpstime_corrected / 43200); + t_utc = secondsOfWeekBeforeToday + t_utc_daytime; + return t_utc; } @@ -739,19 +735,19 @@ double Gps_Navigation_Message::utc_time(double gpstime_corrected) bool Gps_Navigation_Message::satellite_validation() { - bool flag_data_valid = false; - b_valid_ephemeris_set_flag = false; + bool flag_data_valid = false; + b_valid_ephemeris_set_flag = false; - // First Step: - // check Issue Of Ephemeris Data (IODE IODC..) to find a possible interrupted reception - // and check if the data have been filled (!=0) - if (d_TOW_SF1 != 0 and d_TOW_SF2 != 0 and d_TOW_SF3 != 0) - { - if (d_IODE_SF2 == d_IODE_SF3 and d_IODC == d_IODE_SF2 and d_IODC!=-1) - { - flag_data_valid = true; - b_valid_ephemeris_set_flag=true; - } - } - return flag_data_valid; + // First Step: + // check Issue Of Ephemeris Data (IODE IODC..) to find a possible interrupted reception + // and check if the data have been filled (!=0) + if (d_TOW_SF1 != 0 and d_TOW_SF2 != 0 and d_TOW_SF3 != 0) + { + if (d_IODE_SF2 == d_IODE_SF3 and d_IODC == d_IODE_SF2 and d_IODC!= -1) + { + flag_data_valid = true; + b_valid_ephemeris_set_flag=true; + } + } + return flag_data_valid; } diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index 286e261cb..a74257eaf 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -5,7 +5,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -29,8 +29,8 @@ */ -#ifndef GNSS_SDR_GPS_NAVIGATION_MESSAGE_H -#define GNSS_SDR_GPS_NAVIGATION_MESSAGE_H +#ifndef GNSS_SDR_GPS_NAVIGATION_MESSAGE_H_ +#define GNSS_SDR_GPS_NAVIGATION_MESSAGE_H_ #include #include @@ -51,9 +51,9 @@ class Gps_Navigation_Message { private: - unsigned long int read_navigation_unsigned(std::bitset bits, const bits_slice *slices, int num_of_slices); - signed long int read_navigation_signed(std::bitset bits, const bits_slice *slices, int num_of_slices); - bool read_navigation_bool(std::bitset bits, const bits_slice *slices); + unsigned long int read_navigation_unsigned(std::bitset bits, const std::vector> parameter); + signed long int read_navigation_signed(std::bitset bits, const std::vector> parameter); + bool read_navigation_bool(std::bitset bits, const std::vector> parameter); void print_gps_word_bytes(unsigned int GPS_word); /* * Accounts for the beginning or end of week crossover @@ -100,7 +100,7 @@ public: double d_IDOT; //!< Rate of Inclination Angle [semi-circles/s] int i_code_on_L2; //!< If 1, P code ON in L2; if 2, C/A code ON in L2; int i_GPS_week; //!< GPS week number, aka WN [week] - 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 + 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 //broadcast orbit 6 int 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) int i_SV_health;