From 14d1152eda0d04618853a4211bd6d9f63279bcf6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 1 Jul 2020 19:39:25 +0200 Subject: [PATCH] Make constants constexpr, so they can be used at compile time --- src/core/system_parameters/Beidou_B1I.h | 10 +- src/core/system_parameters/Beidou_B3I.h | 10 +- src/core/system_parameters/Beidou_DNAV.h | 128 ++++++------ src/core/system_parameters/GLONASS_L1_L2_CA.h | 130 ++++++------ src/core/system_parameters/GPS_CNAV.h | 98 ++++----- src/core/system_parameters/GPS_L1_CA.h | 141 +++++++------ src/core/system_parameters/GPS_L2C.h | 44 ++-- src/core/system_parameters/GPS_L5.h | 60 +++--- src/core/system_parameters/Galileo_E1.h | 194 +++++++++--------- src/core/system_parameters/Galileo_E5a.h | 130 ++++++------ src/core/system_parameters/Galileo_E5b.h | 186 ++++++++--------- src/core/system_parameters/MATH_CONSTANTS.h | 137 ++++++------- src/core/system_parameters/gnss_frequencies.h | 30 +-- src/core/system_parameters/gnss_obs_codes.h | 114 +++++----- 14 files changed, 702 insertions(+), 710 deletions(-) diff --git a/src/core/system_parameters/Beidou_B1I.h b/src/core/system_parameters/Beidou_B1I.h index 6acdf3b2d..0d36b6983 100644 --- a/src/core/system_parameters/Beidou_B1I.h +++ b/src/core/system_parameters/Beidou_B1I.h @@ -30,7 +30,7 @@ const double BEIDOU_B1I_FREQ_HZ = 1.561098e9; //!< B1I [Hz] const double BEIDOU_B1I_CODE_RATE_CPS = 2.046e6; //!< Beidou B1I code rate [chips/s] const double BEIDOU_B1I_CODE_LENGTH_CHIPS = 2046.0; //!< Beidou B1I code length [chips] const double BEIDOU_B1I_CODE_PERIOD_S = 0.001; //!< Beidou B1I code period [seconds] -const uint32_t BEIDOU_B1I_CODE_PERIOD_MS = 1; //!< Beidou B1I code period [ms] +constexpr uint32_t BEIDOU_B1I_CODE_PERIOD_MS = 1; //!< Beidou B1I code period [ms] const int32_t BEIDOU_B1I_SECONDARY_CODE_LENGTH = 20; const std::string BEIDOU_B1I_SECONDARY_CODE_STR = "00000100110101001110"; const std::string BEIDOU_B1I_GEO_PREAMBLE_SYMBOLS_STR = {"1111110000001100001100"}; @@ -40,11 +40,11 @@ const uint32_t BEIDOU_B1I_PREAMBLE_LENGTH_BITS = 11; const uint32_t BEIDOU_B1I_PREAMBLE_LENGTH_SYMBOLS = 220; const double BEIDOU_B1I_PREAMBLE_DURATION_S = 0.220; const int32_t BEIDOU_B1I_PREAMBLE_DURATION_MS = 220; -const int32_t BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND = 50; -const int32_t BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT = 20; +constexpr int32_t BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND = 50; +constexpr int32_t BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT = 20; const int32_t BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT = 2; -const int32_t BEIDOU_B1I_TELEMETRY_SYMBOL_PERIOD_MS = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS; -const int32_t BEIDOU_B1I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; +constexpr int32_t BEIDOU_B1I_TELEMETRY_SYMBOL_PERIOD_MS = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS; +constexpr int32_t BEIDOU_B1I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; #endif // GNSS_SDR_BEIDOU_B1I_H diff --git a/src/core/system_parameters/Beidou_B3I.h b/src/core/system_parameters/Beidou_B3I.h index 4a9442423..35b3ef438 100644 --- a/src/core/system_parameters/Beidou_B3I.h +++ b/src/core/system_parameters/Beidou_B3I.h @@ -29,7 +29,7 @@ const double BEIDOU_B3I_FREQ_HZ = 1.268520e9; //!< BeiDou B3I [Hz] const double BEIDOU_B3I_CODE_RATE_CPS = 10.23e6; //!< BeiDou B3I code rate [chips/s] const double BEIDOU_B3I_CODE_LENGTH_CHIPS = 10230.0; //!< BeiDou B3I code length [chips] const double BEIDOU_B3I_CODE_PERIOD_S = 0.001; //!< BeiDou B3I code period [seconds] -const uint32_t BEIDOU_B3I_CODE_PERIOD_MS = 1; //!< BeiDou B3I code period [ms] +constexpr uint32_t BEIDOU_B3I_CODE_PERIOD_MS = 1; //!< BeiDou B3I code period [ms] const int32_t BEIDOU_B3I_SECONDARY_CODE_LENGTH = 20; const std::string BEIDOU_B3I_SECONDARY_CODE_STR = "00000100110101001110"; const std::string BEIDOU_B3I_GEO_PREAMBLE_SYMBOLS_STR = {"1111110000001100001100"}; @@ -39,11 +39,11 @@ const uint32_t BEIDOU_B3I_PREAMBLE_LENGTH_BITS = 11; const uint32_t BEIDOU_B3I_PREAMBLE_LENGTH_SYMBOLS = 220; // ************** const double BEIDOU_B3I_PREAMBLE_DURATION_S = 0.220; const int32_t BEIDOU_B3I_PREAMBLE_DURATION_MS = 220; -const int32_t BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND = 50; //!< D1 NAV message bit rate [bits/s] -const int32_t BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT = 20; +constexpr int32_t BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND = 50; //!< D1 NAV message bit rate [bits/s] +constexpr int32_t BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT = 20; const int32_t BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT = 2; // ************* -const int32_t BEIDOU_B3I_TELEMETRY_SYMBOL_PERIOD_MS = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS; -const int32_t BEIDOU_B3I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; +constexpr int32_t BEIDOU_B3I_TELEMETRY_SYMBOL_PERIOD_MS = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS; +constexpr int32_t BEIDOU_B3I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; #endif // GNSS_SDR_BEIDOU_B3I_H diff --git a/src/core/system_parameters/Beidou_DNAV.h b/src/core/system_parameters/Beidou_DNAV.h index 920a10c8b..67d3e1a8a 100644 --- a/src/core/system_parameters/Beidou_DNAV.h +++ b/src/core/system_parameters/Beidou_DNAV.h @@ -26,27 +26,27 @@ #include #include -const double BEIDOU_DNAV_C_M_S = 299792458.0; //!< The speed of light, [m/s] -const double BEIDOU_DNAV_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] -const double BEIDOU_DNAV_PI = 3.1415926535898; //!< BeiDou DNAV Pi -const double BEIDOU_DNAV_TWO_PI = 6.2831853071796; //!< BeiDou DNAV 2Pi -const double BEIDOU_DNAV_OMEGA_EARTH_DOT = 7.2921150e-5; //!< Earth rotation rate, [rad/s] as defined in CGCS2000 -const double BEIDOU_DNAV_GM = 3.986004418e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] as defined in CGCS2000 -const double BEIDOU_DNAV_F = -4.442807309e-10; //!< Constant, [s/(m)^(1/2)] F=-2(GM)^.5/C^2 +constexpr double BEIDOU_DNAV_C_M_S = 299792458.0; //!< The speed of light, [m/s] +constexpr double BEIDOU_DNAV_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] +constexpr double BEIDOU_DNAV_PI = 3.1415926535898; //!< BeiDou DNAV Pi +constexpr double BEIDOU_DNAV_TWO_PI = 6.2831853071796; //!< BeiDou DNAV 2Pi +constexpr double BEIDOU_DNAV_OMEGA_EARTH_DOT = 7.2921150e-5; //!< Earth rotation rate, [rad/s] as defined in CGCS2000 +constexpr double BEIDOU_DNAV_GM = 3.986004418e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] as defined in CGCS2000 +constexpr double BEIDOU_DNAV_F = -4.442807309e-10; //!< Constant, [s/(m)^(1/2)] F=-2(GM)^.5/C^2 -const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11; -const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // ************** -const int32_t BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300; -const uint32_t BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300; -const int32_t BEIDOU_DNAV_SUBFRAME_DATA_BITS = 300; //!< Number of bits per subframe in the NAV message [bits] -const uint32_t BEIDOU_DNAV_WORDS_SUBFRAME = 10; -const uint32_t BEIDOU_DNAV_WORD_LENGTH_BITS = 30; +constexpr int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11; +constexpr int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // ************** +constexpr int32_t BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300; +constexpr uint32_t BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300; +constexpr int32_t BEIDOU_DNAV_SUBFRAME_DATA_BITS = 300; //!< Number of bits per subframe in the NAV message [bits] +constexpr uint32_t BEIDOU_DNAV_WORDS_SUBFRAME = 10; +constexpr uint32_t BEIDOU_DNAV_WORD_LENGTH_BITS = 30; const std::string BEIDOU_DNAV_PREAMBLE = "11100010010"; // Number of leap seconds passed from the start of the GPS epoch up to the start of BeiDou epoch -const int32_t BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET = 14; +constexpr int32_t BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET = 14; // Number of weeks passed from the start of the GPS epoch up to the start of BeiDou epoch -const int32_t BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET = 1356; +constexpr int32_t BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET = 1356; // BEIDOU D1 NAVIGATION MESSAGE STRUCTURE // GENERAL @@ -57,55 +57,55 @@ const std::vector > D1_PNUM({{44, 7}}); // DNAV SCALE FACTORS // EPH -const double D1_TOC_LSB = TWO_P3; -const double D1_TGD1_LSB = 0.1e-9; -const double D1_TGD2_LSB = 0.1e-9; -const double D1_ALPHA0_LSB = TWO_N30; -const double D1_ALPHA1_LSB = TWO_N27; -const double D1_ALPHA2_LSB = TWO_N24; -const double D1_ALPHA3_LSB = TWO_N24; -const double D1_BETA0_LSB = TWO_P11; -const double D1_BETA1_LSB = TWO_P14; -const double D1_BETA2_LSB = TWO_P16; -const double D1_BETA3_LSB = TWO_P16; -const double D1_A2_LSB = TWO_N66; -const double D1_A0_LSB = TWO_N33; -const double D1_A1_LSB = TWO_N50; -const double D1_DELTA_N_LSB = PI_TWO_N43; -const double D1_CUC_LSB = TWO_N31; -const double D1_M0_LSB = PI_TWO_N31; -const double D1_E_LSB = TWO_N33; -const double D1_CUS_LSB = TWO_N31; -const double D1_CRC_LSB = TWO_N6; -const double D1_CRS_LSB = TWO_N6; -const double D1_SQRT_A_LSB = TWO_N19; -const double D1_TOE_LSB = TWO_P3; -const double D1_I0_LSB = PI_TWO_N31; -const double D1_CIC_LSB = TWO_N31; -const double D1_OMEGA_DOT_LSB = PI_TWO_N43; -const double D1_CIS_LSB = TWO_N31; -const double D1_IDOT_LSB = PI_TWO_N43; -const double D1_OMEGA0_LSB = PI_TWO_N31; -const double D1_OMEGA_LSB = PI_TWO_N31; +constexpr double D1_TOC_LSB = TWO_P3; +constexpr double D1_TGD1_LSB = 0.1e-9; +constexpr double D1_TGD2_LSB = 0.1e-9; +constexpr double D1_ALPHA0_LSB = TWO_N30; +constexpr double D1_ALPHA1_LSB = TWO_N27; +constexpr double D1_ALPHA2_LSB = TWO_N24; +constexpr double D1_ALPHA3_LSB = TWO_N24; +constexpr double D1_BETA0_LSB = TWO_P11; +constexpr double D1_BETA1_LSB = TWO_P14; +constexpr double D1_BETA2_LSB = TWO_P16; +constexpr double D1_BETA3_LSB = TWO_P16; +constexpr double D1_A2_LSB = TWO_N66; +constexpr double D1_A0_LSB = TWO_N33; +constexpr double D1_A1_LSB = TWO_N50; +constexpr double D1_DELTA_N_LSB = PI_TWO_N43; +constexpr double D1_CUC_LSB = TWO_N31; +constexpr double D1_M0_LSB = PI_TWO_N31; +constexpr double D1_E_LSB = TWO_N33; +constexpr double D1_CUS_LSB = TWO_N31; +constexpr double D1_CRC_LSB = TWO_N6; +constexpr double D1_CRS_LSB = TWO_N6; +constexpr double D1_SQRT_A_LSB = TWO_N19; +constexpr double D1_TOE_LSB = TWO_P3; +constexpr double D1_I0_LSB = PI_TWO_N31; +constexpr double D1_CIC_LSB = TWO_N31; +constexpr double D1_OMEGA_DOT_LSB = PI_TWO_N43; +constexpr double D1_CIS_LSB = TWO_N31; +constexpr double D1_IDOT_LSB = PI_TWO_N43; +constexpr double D1_OMEGA0_LSB = PI_TWO_N31; +constexpr double D1_OMEGA_LSB = PI_TWO_N31; // ALM -const double D1_SQRT_A_ALMANAC_LSB = TWO_N11; -const double D1_A1_ALMANAC_LSB = TWO_N38; -const double D1_A0_ALMANAC_LSB = TWO_N20; -const double D1_OMEGA0_ALMANAC_LSB = PI_TWO_N23; -const double D1_E_ALMANAC_LSB = TWO_N21; -const double D1_DELTA_I_LSB = PI_TWO_N19; -const double D1_TOA_LSB = TWO_P12; -const double D1_OMEGA_DOT_ALMANAC_LSB = PI_TWO_N38; -const double D1_OMEGA_ALMANAC_LSB = PI_TWO_N23; -const double D1_M0_ALMANAC_LSB = PI_TWO_N23; -const double D1_A0GPS_LSB = 0.1e-9; -const double D1_A1GPS_LSB = 0.1e-9; -const double D1_A0GAL_LSB = 0.1e-9; -const double D1_A1GAL_LSB = 0.1e-9; -const double D1_A0GLO_LSB = 0.1e-9; -const double D1_A1GLO_LSB = 0.1e-9; -const double D1_A0UTC_LSB = TWO_N30; -const double D1_A1UTC_LSB = TWO_N50; +constexpr double D1_SQRT_A_ALMANAC_LSB = TWO_N11; +constexpr double D1_A1_ALMANAC_LSB = TWO_N38; +constexpr double D1_A0_ALMANAC_LSB = TWO_N20; +constexpr double D1_OMEGA0_ALMANAC_LSB = PI_TWO_N23; +constexpr double D1_E_ALMANAC_LSB = TWO_N21; +constexpr double D1_DELTA_I_LSB = PI_TWO_N19; +constexpr double D1_TOA_LSB = TWO_P12; +constexpr double D1_OMEGA_DOT_ALMANAC_LSB = PI_TWO_N38; +constexpr double D1_OMEGA_ALMANAC_LSB = PI_TWO_N23; +constexpr double D1_M0_ALMANAC_LSB = PI_TWO_N23; +constexpr double D1_A0GPS_LSB = 0.1e-9; +constexpr double D1_A1GPS_LSB = 0.1e-9; +constexpr double D1_A0GAL_LSB = 0.1e-9; +constexpr double D1_A1GAL_LSB = 0.1e-9; +constexpr double D1_A0GLO_LSB = 0.1e-9; +constexpr double D1_A1GLO_LSB = 0.1e-9; +constexpr double D1_A0UTC_LSB = TWO_N30; +constexpr double D1_A1UTC_LSB = TWO_N50; // SUBFRAME 1 const std::vector > D1_SAT_H1({{43, 1}}); diff --git a/src/core/system_parameters/GLONASS_L1_L2_CA.h b/src/core/system_parameters/GLONASS_L1_L2_CA.h index 8c18781b0..65750949b 100644 --- a/src/core/system_parameters/GLONASS_L1_L2_CA.h +++ b/src/core/system_parameters/GLONASS_L1_L2_CA.h @@ -31,69 +31,69 @@ // Physical constants -const double GLONASS_C_M_S = SPEED_OF_LIGHT; //!< The speed of light, [m/s] -const double GLONASS_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] -const double GLONASS_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200K -const double GLONASS_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200K -const double GLONASS_OMEGA_EARTH_DOT = 7.292115e-5; //!< Earth rotation rate, [rad/s] -const double GLONASS_GM = 398600.4418e9; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] -const double GLONASS_F_M_A = 0.35e9; //!< Gravitational constant of atmosphere [m^3/s^2] -const double GLONASS_SEMI_MAJOR_AXIS = 6378136; //!< Semi-major axis of Earth [m] -const double GLONASS_FLATTENING = 1 / 29825784; //!< Flattening parameter -const double GLONASS_GRAVITY = 97803284; //!< Equatorial acceleration of gravity [mGal] -const double GLONASS_GRAVITY_CORRECTION = 0.87; //!< Correction to acceleration of gravity at sea-level due to Atmosphere[uGal] -const double GLONASS_J2 = 1082625.75e-9; //!< Second zonal harmonic of the geopotential -const double GLONASS_J4 = -2370.89e-9; //!< Fourth zonal harmonic of the geopotential -const double GLONASS_J6 = 6.08e-9; //!< Sixth zonal harmonic of the geopotential -const double GLONASS_J8 = 1.40e-11; //!< Eighth zonal harmonic of the geopotential -const double GLONASS_U0 = 62636861.4; //!< Normal potential at surface of common terrestrial ellipsoid [m^2/s^2] -const double GLONASS_C20 = -1082.63e-6; //!< Second zonal coefficient of spherical harmonic expansion -const double GLONASS_EARTH_RADIUS = 6378.136; //!< Equatorial radius of Earth [km] -const double GLONASS_EARTH_INCLINATION = 0.000409148809899e3; //!< Mean inclination of ecliptic to equator (23 deg 26 min 33 sec) [rad] +constexpr double GLONASS_C_M_S = SPEED_OF_LIGHT; //!< The speed of light, [m/s] +constexpr double GLONASS_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] +constexpr double GLONASS_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200K +constexpr double GLONASS_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200K +constexpr double GLONASS_OMEGA_EARTH_DOT = 7.292115e-5; //!< Earth rotation rate, [rad/s] +constexpr double GLONASS_GM = 398600.4418e9; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] +constexpr double GLONASS_F_M_A = 0.35e9; //!< Gravitational constant of atmosphere [m^3/s^2] +constexpr double GLONASS_SEMI_MAJOR_AXIS = 6378136; //!< Semi-major axis of Earth [m] +constexpr double GLONASS_FLATTENING = 1.0 / 29825784.0; //!< Flattening parameter +constexpr double GLONASS_GRAVITY = 97803284; //!< Equatorial acceleration of gravity [mGal] +constexpr double GLONASS_GRAVITY_CORRECTION = 0.87; //!< Correction to acceleration of gravity at sea-level due to Atmosphere[uGal] +constexpr double GLONASS_J2 = 1082625.75e-9; //!< Second zonal harmonic of the geopotential +constexpr double GLONASS_J4 = -2370.89e-9; //!< Fourth zonal harmonic of the geopotential +constexpr double GLONASS_J6 = 6.08e-9; //!< Sixth zonal harmonic of the geopotential +constexpr double GLONASS_J8 = 1.40e-11; //!< Eighth zonal harmonic of the geopotential +constexpr double GLONASS_U0 = 62636861.4; //!< Normal potential at surface of common terrestrial ellipsoid [m^2/s^2] +constexpr double GLONASS_C20 = -1082.63e-6; //!< Second zonal coefficient of spherical harmonic expansion +constexpr double GLONASS_EARTH_RADIUS = 6378.136; //!< Equatorial radius of Earth [km] +constexpr double GLONASS_EARTH_INCLINATION = 0.000409148809899e3; //!< Mean inclination of ecliptic to equator (23 deg 26 min 33 sec) [rad] -const double GLONASS_TAU_0 = -0.005835151531174e3; //!< (-334 deg 19 min 46.40 sec) [rad]; -const double GLONASS_TAU_1 = 0.071018041257371e3; //!< (4069 deg 02 min 02.52 sec) [rad]; +constexpr double GLONASS_TAU_0 = -0.005835151531174e3; //!< (-334 deg 19 min 46.40 sec) [rad]; +constexpr double GLONASS_TAU_1 = 0.071018041257371e3; //!< (4069 deg 02 min 02.52 sec) [rad]; -const double GLONASS_MOON_Q0 = -0.001115184961435e3; //!< (-63 deg 53 min 43.41 sec) [rad] -const double GLONASS_MOON_Q1 = 8.328691103668023e3; //!< (477198 deg 50 min 56.79 sec) [rad] -const double GLONASS_MOON_OMEGA_0 = 0.004523601514852e3; //!< (259 deg 10 min 59.79 sec) [rad] -const double GLONASS_MOON_OMEGA_1 = -0.033757146246552e3; //!< (-1934 deg 08 min 31.23 sec) [rad] -const double GLONASS_MOON_GM = 4902.835; //!< Lunar gravitational constant [km^3/s^2] -const double GLONASS_MOON_SEMI_MAJOR_AXIS = 3.84385243e5; //!< Semi-major axis of lunar orbit [km]; -const double GLONASS_MOON_ECCENTRICITY = 0.054900489; //!< Eccentricity of lunar orbit -const double GLONASS_MOON_INCLINATION = 0.000089803977407e3; //!< Inclination of lunar orbit to ecliptic plane (5 deg 08 min 43.4 sec) [rad] +constexpr double GLONASS_MOON_Q0 = -0.001115184961435e3; //!< (-63 deg 53 min 43.41 sec) [rad] +constexpr double GLONASS_MOON_Q1 = 8.328691103668023e3; //!< (477198 deg 50 min 56.79 sec) [rad] +constexpr double GLONASS_MOON_OMEGA_0 = 0.004523601514852e3; //!< (259 deg 10 min 59.79 sec) [rad] +constexpr double GLONASS_MOON_OMEGA_1 = -0.033757146246552e3; //!< (-1934 deg 08 min 31.23 sec) [rad] +constexpr double GLONASS_MOON_GM = 4902.835; //!< Lunar gravitational constant [km^3/s^2] +constexpr double GLONASS_MOON_SEMI_MAJOR_AXIS = 3.84385243e5; //!< Semi-major axis of lunar orbit [km]; +constexpr double GLONASS_MOON_ECCENTRICITY = 0.054900489; //!< Eccentricity of lunar orbit +constexpr double GLONASS_MOON_INCLINATION = 0.000089803977407e3; //!< Inclination of lunar orbit to ecliptic plane (5 deg 08 min 43.4 sec) [rad] -const double GLONASS_SUN_OMEGA = 0.004908229466869e3; //!< TODO What is this operation in the seconds with T?(281 deg 13 min 15.0 + 6189.03 x T sec) [rad] -const double GLONASS_SUN_Q0 = 0.006256583774423e3; //!< (358 deg 28 min 33.04 sec) [rad] -const double GLONASS_SUN_Q1 = 0e3; //!< TODO Why is the value greater than 60?(129596579.10 sec) [rad] -const double GLONASS_SUN_GM = 0.1325263e12; //!< Solar gravitational constant [km^3/s^2] -const double GLONASS_SUN_SEMI_MAJOR_AXIS = 1.49598e8; //!< Semi-major axis of solar orbit [km]; -const double GLONASS_SUN_ECCENTRICITY = 0.016719; //!< Eccentricity of solar orbit +constexpr double GLONASS_SUN_OMEGA = 0.004908229466869e3; //!< TODO What is this operation in the seconds with T?(281 deg 13 min 15.0 + 6189.03 x T sec) [rad] +constexpr double GLONASS_SUN_Q0 = 0.006256583774423e3; //!< (358 deg 28 min 33.04 sec) [rad] +constexpr double GLONASS_SUN_Q1 = 0e3; //!< TODO Why is the value greater than 60?(129596579.10 sec) [rad] +constexpr double GLONASS_SUN_GM = 0.1325263e12; //!< Solar gravitational constant [km^3/s^2] +constexpr double GLONASS_SUN_SEMI_MAJOR_AXIS = 1.49598e8; //!< Semi-major axis of solar orbit [km]; +constexpr double GLONASS_SUN_ECCENTRICITY = 0.016719; //!< Eccentricity of solar orbit -const double GLONASS_L2_CA_FREQ_HZ = FREQ2_GLO; //!< L2 [Hz] -const double GLONASS_L2_CA_DFREQ_HZ = DFRQ2_GLO; //!< Freq Bias for GLONASS L1 [Hz] -const double GLONASS_L2_CA_CODE_RATE_CPS = 0.511e6; //!< GLONASS L1 C/A code rate [chips/s] -const double GLONASS_L2_CA_CODE_LENGTH_CHIPS = 511.0; //!< GLONASS L1 C/A code length [chips] -const double GLONASS_L2_CA_CODE_PERIOD_S = 0.001; //!< GLONASS L1 C/A code period [seconds] -const double GLONASS_L2_CA_CHIP_PERIOD_S = 1.9569e-06; //!< GLONASS L1 C/A chip period [seconds] -const double GLONASS_L2_CA_SYMBOL_RATE_BPS = 1000; +constexpr double GLONASS_L2_CA_FREQ_HZ = FREQ2_GLO; //!< L2 [Hz] +constexpr double GLONASS_L2_CA_DFREQ_HZ = DFRQ2_GLO; //!< Freq Bias for GLONASS L1 [Hz] +constexpr double GLONASS_L2_CA_CODE_RATE_CPS = 0.511e6; //!< GLONASS L1 C/A code rate [chips/s] +constexpr double GLONASS_L2_CA_CODE_LENGTH_CHIPS = 511.0; //!< GLONASS L1 C/A code length [chips] +constexpr double GLONASS_L2_CA_CODE_PERIOD_S = 0.001; //!< GLONASS L1 C/A code period [seconds] +constexpr double GLONASS_L2_CA_CHIP_PERIOD_S = 1.9569e-06; //!< GLONASS L1 C/A chip period [seconds] +constexpr double GLONASS_L2_CA_SYMBOL_RATE_BPS = 1000; -const double GLONASS_L1_CA_FREQ_HZ = FREQ1_GLO; //!< L1 [Hz] -const double GLONASS_L1_CA_DFREQ_HZ = DFRQ1_GLO; //!< Freq Bias for GLONASS L1 [Hz] -const double GLONASS_L1_CA_CODE_RATE_CPS = 0.511e6; //!< GLONASS L1 C/A code rate [chips/s] -const double GLONASS_L1_CA_CODE_LENGTH_CHIPS = 511.0; //!< GLONASS L1 C/A code length [chips] -const double GLONASS_L1_CA_CODE_PERIOD_S = 0.001; //!< GLONASS L1 C/A code period [seconds] -const double GLONASS_L1_CA_CHIP_PERIOD_S = 1.9569e-06; //!< GLONASS L1 C/A chip period [seconds] -const double GLONASS_L1_CA_SYMBOL_RATE_BPS = 1000; +constexpr double GLONASS_L1_CA_FREQ_HZ = FREQ1_GLO; //!< L1 [Hz] +constexpr double GLONASS_L1_CA_DFREQ_HZ = DFRQ1_GLO; //!< Freq Bias for GLONASS L1 [Hz] +constexpr double GLONASS_L1_CA_CODE_RATE_CPS = 0.511e6; //!< GLONASS L1 C/A code rate [chips/s] +constexpr double GLONASS_L1_CA_CODE_LENGTH_CHIPS = 511.0; //!< GLONASS L1 C/A code length [chips] +constexpr double GLONASS_L1_CA_CODE_PERIOD_S = 0.001; //!< GLONASS L1 C/A code period [seconds] +constexpr double GLONASS_L1_CA_CHIP_PERIOD_S = 1.9569e-06; //!< GLONASS L1 C/A chip period [seconds] +constexpr double GLONASS_L1_CA_SYMBOL_RATE_BPS = 1000; -const int32_t GLONASS_CA_NBR_SATS = 24; // STRING DATA WITHOUT PREAMBLE +constexpr int32_t GLONASS_CA_NBR_SATS = 24; // STRING DATA WITHOUT PREAMBLE /*! * \brief Record of leap seconds definition for GLOT to GPST conversion and vice versa * \details Each entry is defined by an array of 7 elements consisting of yr,month,day,hr,min,sec,utc-gpst * \note Ideally should use leap seconds definitions of rtklib */ -const double GLONASS_LEAP_SECONDS[19][7] = { +constexpr double GLONASS_LEAP_SECONDS[19][7] = { {2017, 1, 1, 0, 0, 0, -18}, {2015, 7, 1, 0, 0, 0, -17}, {2012, 7, 1, 0, 0, 0, -16}, @@ -214,28 +214,26 @@ const std::map GLONASS_PRN = { }, // Plane 3 {24, 2}}; // Plane 3 -const double GLONASS_STARTOFFSET_MS = 68.802; // [ms] Initial sign. travel time (this cannot go here) - // OBSERVABLE HISTORY DEEP FOR INTERPOLATION -const int32_t GLONASS_L1_CA_HISTORY_DEEP = 100; +constexpr int32_t GLONASS_L1_CA_HISTORY_DEEP = 100; // NAVIGATION MESSAGE DEMODULATION AND DECODING #define GLONASS_GNAV_PREAMBLE \ { \ 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0 \ } -const double GLONASS_GNAV_PREAMBLE_DURATION_S = 0.300; -const int32_t GLONASS_GNAV_PREAMBLE_LENGTH_BITS = 30; -const int32_t GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS = 300; -const int32_t GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS = 2000; -const int32_t GLONASS_GNAV_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s] -const int32_t GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_BIT = 10; -const int32_t GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT = 10; -const int32_t GLONASS_GNAV_TELEMETRY_RATE_SYMBOLS_SECOND = GLONASS_GNAV_TELEMETRY_RATE_BITS_SECOND * GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_BIT; //!< NAV message bit rate [symbols/s] -const int32_t GLONASS_GNAV_STRING_SYMBOLS = 2000; //!< Number of bits per string in the GNAV message (85 data bits + 30 time mark bits) [bits] -const int32_t GLONASS_GNAV_STRING_BITS = 85; //!< Number of bits per string in the GNAV message (85 data bits + 30 time mark bits) [bits] -const int32_t GLONASS_GNAV_HAMMING_CODE_BITS = 8; //!< Number of bits in hamming code sequence of GNAV message -const int32_t GLONASS_GNAV_DATA_SYMBOLS = 1700; // STRING DATA WITHOUT PREAMBLE +constexpr double GLONASS_GNAV_PREAMBLE_DURATION_S = 0.300; +constexpr int32_t GLONASS_GNAV_PREAMBLE_LENGTH_BITS = 30; +constexpr int32_t GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS = 300; +constexpr int32_t GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS = 2000; +constexpr int32_t GLONASS_GNAV_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s] +constexpr int32_t GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_BIT = 10; +constexpr int32_t GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT = 10; +constexpr int32_t GLONASS_GNAV_TELEMETRY_RATE_SYMBOLS_SECOND = GLONASS_GNAV_TELEMETRY_RATE_BITS_SECOND * GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_BIT; //!< NAV message bit rate [symbols/s] +constexpr int32_t GLONASS_GNAV_STRING_SYMBOLS = 2000; //!< Number of bits per string in the GNAV message (85 data bits + 30 time mark bits) [bits] +constexpr int32_t GLONASS_GNAV_STRING_BITS = 85; //!< Number of bits per string in the GNAV message (85 data bits + 30 time mark bits) [bits] +constexpr int32_t GLONASS_GNAV_HAMMING_CODE_BITS = 8; //!< Number of bits in hamming code sequence of GNAV message +constexpr int32_t GLONASS_GNAV_DATA_SYMBOLS = 1700; // STRING DATA WITHOUT PREAMBLE const std::vector GLONASS_GNAV_CRC_I_INDEX{9, 10, 12, 13, 15, 17, 19, 20, 22, 24, 26, 28, 30, 32, 34, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84}; const std::vector GLONASS_GNAV_CRC_J_INDEX{9, 11, 12, 14, 15, 18, 19, 21, 22, 25, 26, 29, 30, 33, 34, 36, 37, 40, 41, 44, 45, 48, 49, 52, 53, 56, 57, 60, 61, 64, 65, 67, 68, 71, 72, 75, 76, 79, 80, 83, 84}; diff --git a/src/core/system_parameters/GPS_CNAV.h b/src/core/system_parameters/GPS_CNAV.h index 29ae7d331..a152aff22 100644 --- a/src/core/system_parameters/GPS_CNAV.h +++ b/src/core/system_parameters/GPS_CNAV.h @@ -37,132 +37,132 @@ #define GPS_CNAV_PREAMBLE_STR "10001011" #define GPS_CNAV_INV_PREAMBLE_STR "01110100" -const int32_t GPS_CNAV_DATA_PAGE_BITS = 300; +constexpr int32_t GPS_CNAV_DATA_PAGE_BITS = 300; // common to all messages 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 int32_t CNAV_TOW_LSB = 6; +constexpr int32_t CNAV_TOW_LSB = 6; const std::vector > CNAV_ALERT_FLAG({{38, 1}}); // MESSAGE TYPE 10 (Ephemeris 1) const std::vector > CNAV_WN({{39, 13}}); const std::vector > CNAV_HEALTH({{52, 3}}); const std::vector > CNAV_TOP1({{55, 11}}); -const int32_t CNAV_TOP1_LSB = 300; +constexpr int32_t CNAV_TOP1_LSB = 300; const std::vector > CNAV_URA({{66, 5}}); const std::vector > CNAV_TOE1({{71, 11}}); -const int32_t CNAV_TOE1_LSB = 300; +constexpr 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; +constexpr double CNAV_DELTA_A_LSB = TWO_N9; const std::vector > CNAV_A_DOT({{108, 25}}); -const double CNAV_A_DOT_LSB = TWO_N21; +constexpr double CNAV_A_DOT_LSB = TWO_N21; const std::vector > CNAV_DELTA_N0({{133, 17}}); -const double CNAV_DELTA_N0_LSB = TWO_N44 * PI; // semi-circles to radians +constexpr double CNAV_DELTA_N0_LSB = TWO_N44 * PI; // semi-circles to radians const std::vector > CNAV_DELTA_N0_DOT({{150, 23}}); -const double CNAV_DELTA_N0_DOT_LSB = TWO_N57 * PI; // semi-circles to radians +constexpr double CNAV_DELTA_N0_DOT_LSB = TWO_N57 * PI; // semi-circles to radians const std::vector > CNAV_M0({{173, 33}}); -const double CNAV_M0_LSB = TWO_N32 * PI; // semi-circles to radians +constexpr double CNAV_M0_LSB = TWO_N32 * PI; // semi-circles to radians const std::vector > CNAV_E_ECCENTRICITY({{206, 33}}); -const double CNAV_E_ECCENTRICITY_LSB = TWO_N34; +constexpr double CNAV_E_ECCENTRICITY_LSB = TWO_N34; const std::vector > CNAV_OMEGA({{239, 33}}); -const double CNAV_OMEGA_LSB = TWO_N32 * PI; // semi-circles to radians +constexpr double CNAV_OMEGA_LSB = TWO_N32 * PI; // semi-circles to radians const std::vector > CNAV_INTEGRITY_FLAG({{272, 1}}); const std::vector > CNAV_L2_PHASING_FLAG({{273, 1}}); // MESSAGE TYPE 11 (Ephemeris 2) const std::vector > CNAV_TOE2({{39, 11}}); -const int32_t CNAV_TOE2_LSB = 300; +constexpr 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 +constexpr double CNAV_OMEGA0_LSB = TWO_N32 * PI; // semi-circles to radians const std::vector > CNAV_I0({{83, 33}}); -const double CNAV_I0_LSB = TWO_N32 * PI; // semi-circles to radians +constexpr double CNAV_I0_LSB = TWO_N32 * PI; // semi-circles to radians const std::vector > CNAV_DELTA_OMEGA_DOT({{116, 17}}); // Relative to REF = -2.6 x 10-9 semi-circles/second. -const double CNAV_DELTA_OMEGA_DOT_LSB = TWO_N44 * PI; // semi-circles to radians +constexpr double CNAV_DELTA_OMEGA_DOT_LSB = TWO_N44 * PI; // semi-circles to radians const std::vector > CNAV_I0_DOT({{133, 15}}); -const double CNAV_I0_DOT_LSB = TWO_N44 * PI; // semi-circles to radians +constexpr double CNAV_I0_DOT_LSB = TWO_N44 * PI; // semi-circles to radians const std::vector > CNAV_CIS({{148, 16}}); -const double CNAV_CIS_LSB = TWO_N30; +constexpr double CNAV_CIS_LSB = TWO_N30; const std::vector > CNAV_CIC({{164, 16}}); -const double CNAV_CIC_LSB = TWO_N30; +constexpr double CNAV_CIC_LSB = TWO_N30; const std::vector > CNAV_CRS({{180, 24}}); -const double CNAV_CRS_LSB = TWO_N8; +constexpr double CNAV_CRS_LSB = TWO_N8; const std::vector > CNAV_CRC({{204, 24}}); -const double CNAV_CRC_LSB = TWO_N8; +constexpr double CNAV_CRC_LSB = TWO_N8; const std::vector > CNAV_CUS({{228, 21}}); -const double CNAV_CUS_LSB = TWO_N30; +constexpr double CNAV_CUS_LSB = TWO_N30; const std::vector > CNAV_CUC({{249, 21}}); -const double CNAV_CUC_LSB = TWO_N30; +constexpr double CNAV_CUC_LSB = TWO_N30; // MESSAGE TYPE 30 (CLOCK, IONO, GRUP DELAY) const std::vector > CNAV_TOP2({{39, 11}}); -const int32_t CNAV_TOP2_LSB = 300; +constexpr 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 int32_t CNAV_TOC_LSB = 300; +constexpr int32_t CNAV_TOC_LSB = 300; const std::vector > CNAV_AF0({{72, 26}}); -const double CNAV_AF0_LSB = TWO_N35; +constexpr double CNAV_AF0_LSB = TWO_N35; const std::vector > CNAV_AF1({{98, 20}}); -const double CNAV_AF1_LSB = TWO_N48; +constexpr double CNAV_AF1_LSB = TWO_N48; const std::vector > CNAV_AF2({{118, 10}}); -const double CNAV_AF2_LSB = TWO_N60; +constexpr double CNAV_AF2_LSB = TWO_N60; const std::vector > CNAV_TGD({{128, 13}}); -const double CNAV_TGD_LSB = TWO_N35; +constexpr double CNAV_TGD_LSB = TWO_N35; const std::vector > CNAV_ISCL1({{141, 13}}); -const double CNAV_ISCL1_LSB = TWO_N35; +constexpr double CNAV_ISCL1_LSB = TWO_N35; const std::vector > CNAV_ISCL2({{154, 13}}); -const double CNAV_ISCL2_LSB = TWO_N35; +constexpr double CNAV_ISCL2_LSB = TWO_N35; const std::vector > CNAV_ISCL5I({{167, 13}}); -const double CNAV_ISCL5I_LSB = TWO_N35; +constexpr double CNAV_ISCL5I_LSB = TWO_N35; const std::vector > CNAV_ISCL5Q({{180, 13}}); -const double CNAV_ISCL5Q_LSB = TWO_N35; +constexpr double CNAV_ISCL5Q_LSB = TWO_N35; // Ionospheric parameters const std::vector > CNAV_ALPHA0({{193, 8}}); -const double CNAV_ALPHA0_LSB = TWO_N30; +constexpr double CNAV_ALPHA0_LSB = TWO_N30; const std::vector > CNAV_ALPHA1({{201, 8}}); -const double CNAV_ALPHA1_LSB = TWO_N27; +constexpr double CNAV_ALPHA1_LSB = TWO_N27; const std::vector > CNAV_ALPHA2({{209, 8}}); -const double CNAV_ALPHA2_LSB = TWO_N24; +constexpr double CNAV_ALPHA2_LSB = TWO_N24; const std::vector > CNAV_ALPHA3({{217, 8}}); -const double CNAV_ALPHA3_LSB = TWO_N24; +constexpr double CNAV_ALPHA3_LSB = TWO_N24; const std::vector > CNAV_BETA0({{225, 8}}); -const double CNAV_BETA0_LSB = TWO_P11; +constexpr double CNAV_BETA0_LSB = TWO_P11; const std::vector > CNAV_BETA1({{233, 8}}); -const double CNAV_BETA1_LSB = TWO_P14; +constexpr double CNAV_BETA1_LSB = TWO_P14; const std::vector > CNAV_BETA2({{241, 8}}); -const double CNAV_BETA2_LSB = TWO_P16; +constexpr double CNAV_BETA2_LSB = TWO_P16; const std::vector > CNAV_BETA3({{249, 8}}); -const double CNAV_BETA3_LSB = TWO_P16; +constexpr double CNAV_BETA3_LSB = TWO_P16; const std::vector > CNAV_WNOP({{257, 8}}); // MESSAGE TYPE 33 (CLOCK and UTC) const std::vector > CNAV_A0({{128, 16}}); -const double CNAV_A0_LSB = TWO_N35; +constexpr double CNAV_A0_LSB = TWO_N35; const std::vector > CNAV_A1({{144, 13}}); -const double CNAV_A1_LSB = TWO_N51; +constexpr double CNAV_A1_LSB = TWO_N51; const std::vector > CNAV_A2({{157, 7}}); -const double CNAV_A2_LSB = TWO_N68; +constexpr double CNAV_A2_LSB = TWO_N68; const std::vector > CNAV_DELTA_TLS({{164, 8}}); -const int32_t CNAV_DELTA_TLS_LSB = 1; +constexpr int32_t CNAV_DELTA_TLS_LSB = 1; const std::vector > CNAV_TOT({{172, 16}}); -const int32_t CNAV_TOT_LSB = TWO_P4; +constexpr int32_t CNAV_TOT_LSB = TWO_P4; const std::vector > CNAV_WN_OT({{188, 13}}); -const int32_t CNAV_WN_OT_LSB = 1; +constexpr int32_t CNAV_WN_OT_LSB = 1; const std::vector > CNAV_WN_LSF({{201, 13}}); -const int32_t CNAV_WN_LSF_LSB = 1; +constexpr int32_t CNAV_WN_LSF_LSB = 1; const std::vector > CNAV_DN({{214, 4}}); -const int32_t CNAV_DN_LSB = 1; +constexpr int32_t CNAV_DN_LSB = 1; const std::vector > CNAV_DELTA_TLSF({{218, 8}}); -const int32_t CNAV_DELTA_TLSF_LSB = 1; +constexpr 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 f80b2d676..983a90d23 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -30,26 +30,26 @@ // Physical constants -const double GPS_C_M_S = SPEED_OF_LIGHT; //!< 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-200K -const double GPS_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200K -const double OMEGA_EARTH_DOT = DEFAULT_OMEGA_EARTH_DOT; //!< 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)] +constexpr double GPS_C_M_S = SPEED_OF_LIGHT; //!< The speed of light, [m/s] +constexpr double GPS_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] +constexpr double GPS_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200K +constexpr double GPS_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200K +constexpr double OMEGA_EARTH_DOT = DEFAULT_OMEGA_EARTH_DOT; //!< Earth rotation rate, [rad/s] +constexpr double GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] +constexpr double F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] // carrier and code frequencies -const double GPS_L1_FREQ_HZ = FREQ1; //!< L1 [Hz] -const double GPS_L1_CA_CODE_RATE_CPS = 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_S = 0.001; //!< GPS L1 C/A code period [seconds] -const uint32_t GPS_L1_CA_CODE_PERIOD_MS = 1U; //!< GPS L1 C/A code period [ms] -const uint32_t GPS_L1_CA_BIT_PERIOD_MS = 20U; //!< GPS L1 C/A bit period [ms] -const double GPS_L1_CA_CHIP_PERIOD_S = 9.7752e-07; //!< GPS L1 C/A chip period [seconds] +constexpr double GPS_L1_FREQ_HZ = FREQ1; //!< L1 [Hz] +constexpr double GPS_L1_CA_CODE_RATE_CPS = 1.023e6; //!< GPS L1 C/A code rate [chips/s] +constexpr double GPS_L1_CA_CODE_LENGTH_CHIPS = 1023.0; //!< GPS L1 C/A code length [chips] +constexpr double GPS_L1_CA_CODE_PERIOD_S = 0.001; //!< GPS L1 C/A code period [seconds] +constexpr uint32_t GPS_L1_CA_CODE_PERIOD_MS = 1U; //!< GPS L1 C/A code period [ms] +constexpr uint32_t GPS_L1_CA_BIT_PERIOD_MS = 20U; //!< GPS L1 C/A bit period [ms] +constexpr double GPS_L1_CA_CHIP_PERIOD_S = 9.7752e-07; //!< GPS L1 C/A chip period [seconds] // optimum parameters -const uint32_t GPS_L1_CA_OPT_ACQ_FS_SPS = 2000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate +constexpr uint32_t GPS_L1_CA_OPT_ACQ_FS_SPS = 2000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate /*! * \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms @@ -59,12 +59,12 @@ const uint32_t GPS_L1_CA_OPT_ACQ_FS_SPS = 2000000; //!< Sampling frequency that * [1] J. Bao-Yen Tsui, Fundamentals of Global Positioning System Receivers. A Software Approach, John Wiley & Sons, * Inc., Hoboken, NJ, 2nd edition, 2005. */ -const double MAX_TOA_DELAY_MS = 20; +constexpr double MAX_TOA_DELAY_MS = 20; -const double GPS_STARTOFFSET_MS = 68.802; // [ms] Initial signal travel time (only for old ls_pvt implementation) +constexpr double GPS_STARTOFFSET_MS = 68.802; // [ms] Initial signal travel time (only for old ls_pvt implementation) // OBSERVABLE HISTORY DEEP FOR INTERPOLATION -const int32_t GPS_L1_CA_HISTORY_DEEP = 100; +constexpr int32_t GPS_L1_CA_HISTORY_DEEP = 100; // NAVIGATION MESSAGE DEMODULATION AND DECODING @@ -74,19 +74,19 @@ const int32_t GPS_L1_CA_HISTORY_DEEP = 100; } const std::string GPS_CA_PREAMBLE = {"10001011"}; const std::string GPS_CA_PREAMBLE_SYMBOLS_STR = {"1111111111111111111100000000000000000000000000000000000000000000000000000000000011111111111111111111000000000000000000001111111111111111111111111111111111111111"}; -const int32_t GPS_CA_PREAMBLE_LENGTH_BITS = 8; -const int32_t GPS_CA_PREAMBLE_LENGTH_SYMBOLS = 160; -const double GPS_CA_PREAMBLE_DURATION_S = 0.160; -const int32_t GPS_CA_PREAMBLE_DURATION_MS = 160; -const int32_t GPS_CA_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s] -const int32_t GPS_CA_TELEMETRY_SYMBOLS_PER_BIT = 20; -const int32_t GPS_CA_TELEMETRY_RATE_SYMBOLS_SECOND = GPS_CA_TELEMETRY_RATE_BITS_SECOND * GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; //!< NAV message bit rate [symbols/s] -const int32_t GPS_WORD_LENGTH = 4; //!< CRC + GPS WORD (-2 -1 0 ... 29) Bits = 4 bytes -const int32_t GPS_SUBFRAME_LENGTH = 40; //!< GPS_WORD_LENGTH x 10 = 40 bytes -const int32_t GPS_SUBFRAME_BITS = 300; //!< Number of bits per subframe in the NAV message [bits] -const int32_t GPS_SUBFRAME_SECONDS = 6; //!< Subframe duration [seconds] -const int32_t GPS_SUBFRAME_MS = 6000; //!< Subframe duration [seconds] -const int32_t GPS_WORD_BITS = 30; //!< Number of bits per word in the NAV message [bits] +constexpr int32_t GPS_CA_PREAMBLE_LENGTH_BITS = 8; +constexpr int32_t GPS_CA_PREAMBLE_LENGTH_SYMBOLS = 160; +constexpr double GPS_CA_PREAMBLE_DURATION_S = 0.160; +constexpr int32_t GPS_CA_PREAMBLE_DURATION_MS = 160; +constexpr int32_t GPS_CA_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s] +constexpr int32_t GPS_CA_TELEMETRY_SYMBOLS_PER_BIT = 20; +constexpr int32_t GPS_CA_TELEMETRY_RATE_SYMBOLS_SECOND = GPS_CA_TELEMETRY_RATE_BITS_SECOND * GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; //!< NAV message bit rate [symbols/s] +constexpr int32_t GPS_WORD_LENGTH = 4; //!< CRC + GPS WORD (-2 -1 0 ... 29) Bits = 4 bytes +constexpr int32_t GPS_SUBFRAME_LENGTH = 40; //!< GPS_WORD_LENGTH x 10 = 40 bytes +constexpr int32_t GPS_SUBFRAME_BITS = 300; //!< Number of bits per subframe in the NAV message [bits] +constexpr int32_t GPS_SUBFRAME_SECONDS = 6; //!< Subframe duration [seconds] +constexpr int32_t GPS_SUBFRAME_MS = 6000; //!< Subframe duration [seconds] +constexpr int32_t GPS_WORD_BITS = 30; //!< Number of bits per word in the NAV message [bits] // GPS NAVIGATION MESSAGE STRUCTURE // NAVIGATION MESSAGE FIELDS POSITIONS (from IS-GPS-200K Appendix II) @@ -106,58 +106,57 @@ 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; +constexpr double T_GD_LSB = TWO_N31; const std::vector> IODC({{83, 2}, {211, 8}}); const std::vector> T_OC({{219, 16}}); -const int32_t T_OC_LSB = static_cast(TWO_P4); +constexpr int32_t T_OC_LSB = static_cast(TWO_P4); const std::vector> A_F2({{241, 8}}); -const double A_F2_LSB = TWO_N55; +constexpr double A_F2_LSB = TWO_N55; const std::vector> A_F1({{249, 16}}); -const double A_F1_LSB = TWO_N43; +constexpr double A_F1_LSB = TWO_N43; const std::vector> A_F0({{271, 22}}); -const double A_F0_LSB = TWO_N31; +constexpr double A_F0_LSB = TWO_N31; // SUBFRAME 2 const std::vector> IODE_SF2({{61, 8}}); const std::vector> C_RS({{69, 16}}); -const double C_RS_LSB = TWO_N5; +constexpr double C_RS_LSB = TWO_N5; const std::vector> DELTA_N({{91, 16}}); -const double DELTA_N_LSB = PI_TWO_N43; +constexpr double DELTA_N_LSB = PI_TWO_N43; const std::vector> M_0({{107, 8}, {121, 24}}); -const double M_0_LSB = PI_TWO_N31; +constexpr double M_0_LSB = PI_TWO_N31; const std::vector> C_UC({{151, 16}}); -const double C_UC_LSB = TWO_N29; +constexpr double C_UC_LSB = TWO_N29; const std::vector> ECCENTRICITY({{167, 8}, {181, 24}}); -const double ECCENTRICITY_LSB = TWO_N33; +constexpr double ECCENTRICITY_LSB = TWO_N33; const std::vector> C_US({{211, 16}}); -const double C_US_LSB = TWO_N29; +constexpr double C_US_LSB = TWO_N29; const std::vector> SQRT_A({{227, 8}, {241, 24}}); -const double SQRT_A_LSB = TWO_N19; +constexpr double SQRT_A_LSB = TWO_N19; const std::vector> T_OE({{271, 16}}); -const int32_t T_OE_LSB = static_cast(TWO_P4); +constexpr 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; +constexpr int32_t AODO_LSB = 900; // SUBFRAME 3 const std::vector> C_IC({{61, 16}}); -const double C_IC_LSB = TWO_N29; +constexpr double C_IC_LSB = TWO_N29; const std::vector> OMEGA_0({{77, 8}, {91, 24}}); -const double OMEGA_0_LSB = PI_TWO_N31; +constexpr double OMEGA_0_LSB = PI_TWO_N31; const std::vector> C_IS({{121, 16}}); -const double C_IS_LSB = TWO_N29; +constexpr double C_IS_LSB = TWO_N29; const std::vector> I_0({{137, 8}, {151, 24}}); -const double I_0_LSB = PI_TWO_N31; +constexpr double I_0_LSB = PI_TWO_N31; const std::vector> C_RC({{181, 16}}); -const double C_RC_LSB = TWO_N5; +constexpr double C_RC_LSB = TWO_N5; const std::vector> OMEGA({{197, 8}, {211, 24}}); -const double OMEGA_LSB = PI_TWO_N31; +constexpr double OMEGA_LSB = PI_TWO_N31; const std::vector> OMEGA_DOT({{241, 24}}); -const double OMEGA_DOT_LSB = PI_TWO_N43; +constexpr 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; - +constexpr double I_DOT_LSB = PI_TWO_N43; // SUBFRAME 4-5 const std::vector> SV_DATA_ID({{61, 2}}); @@ -167,37 +166,37 @@ const std::vector> SV_PAGE({{63, 6}}); //! \todo read all pages of subframe 4 // Page 18 - Ionospheric and UTC data const std::vector> ALPHA_0({{69, 8}}); -const double ALPHA_0_LSB = TWO_N30; +constexpr double ALPHA_0_LSB = TWO_N30; const std::vector> ALPHA_1({{77, 8}}); -const double ALPHA_1_LSB = TWO_N27; +constexpr double ALPHA_1_LSB = TWO_N27; const std::vector> ALPHA_2({{91, 8}}); -const double ALPHA_2_LSB = TWO_N24; +constexpr double ALPHA_2_LSB = TWO_N24; const std::vector> ALPHA_3({{99, 8}}); -const double ALPHA_3_LSB = TWO_N24; +constexpr double ALPHA_3_LSB = TWO_N24; const std::vector> BETA_0({{107, 8}}); -const double BETA_0_LSB = TWO_P11; +constexpr double BETA_0_LSB = TWO_P11; const std::vector> BETA_1({{121, 8}}); -const double BETA_1_LSB = TWO_P14; +constexpr double BETA_1_LSB = TWO_P14; const std::vector> BETA_2({{129, 8}}); -const double BETA_2_LSB = TWO_P16; +constexpr double BETA_2_LSB = TWO_P16; const std::vector> BETA_3({{137, 8}}); -const double BETA_3_LSB = TWO_P16; +constexpr double BETA_3_LSB = TWO_P16; const std::vector> A_1({{151, 24}}); -const double A_1_LSB = TWO_N50; +constexpr double A_1_LSB = TWO_N50; const std::vector> A_0({{181, 24}, {211, 8}}); -const double A_0_LSB = TWO_N30; +constexpr double A_0_LSB = TWO_N30; const std::vector> T_OT({{219, 8}}); -const double T_OT_LSB = TWO_P12; +constexpr double T_OT_LSB = TWO_P12; const std::vector> WN_T({{227, 8}}); -const double WN_T_LSB = 1; +constexpr double WN_T_LSB = 1; const std::vector> DELTAT_LS({{241, 8}}); -const double DELTAT_LS_LSB = 1; +constexpr double DELTAT_LS_LSB = 1; const std::vector> WN_LSF({{249, 8}}); -const double WN_LSF_LSB = 1; +constexpr double WN_LSF_LSB = 1; const std::vector> DN({{257, 8}}); -const double DN_LSB = 1; +constexpr double DN_LSB = 1; const std::vector> DELTAT_LSF({{271, 8}}); -const double DELTAT_LSF_LSB = 1; +constexpr double DELTAT_LSF_LSB = 1; // Page 25 - Antispoofing, SV config and SV health (PRN 25 -32) const std::vector> HEALTH_SV25({{229, 6}}); @@ -215,7 +214,7 @@ const std::vector> HEALTH_SV32({{283, 6}}); // page 25 - Health (PRN 1 - 24) const std::vector> T_OA({{69, 8}}); -const int32_t T_OA_LSB = TWO_P12; +constexpr int32_t T_OA_LSB = TWO_P12; const std::vector> WN_A({{77, 8}}); const std::vector> HEALTH_SV1({{91, 6}}); const std::vector> HEALTH_SV2({{97, 6}}); diff --git a/src/core/system_parameters/GPS_L2C.h b/src/core/system_parameters/GPS_L2C.h index aa18abfdf..3708cc227 100644 --- a/src/core/system_parameters/GPS_L2C.h +++ b/src/core/system_parameters/GPS_L2C.h @@ -31,32 +31,32 @@ // Physical constants -const double GPS_L2_C_M_S = 299792458.0; //!< The speed of light, [m/s] -const double GPS_L2_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] -const double GPS_L2_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200K -const double GPS_L2_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200K -const double GPS_L2_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Earth rotation rate, [rad/s] -const double GPS_L2_GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] -const double GPS_L2_F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] +constexpr double GPS_L2_C_M_S = 299792458.0; //!< The speed of light, [m/s] +constexpr double GPS_L2_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] +constexpr double GPS_L2_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200K +constexpr double GPS_L2_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200K +constexpr double GPS_L2_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Earth rotation rate, [rad/s] +constexpr double GPS_L2_GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] +constexpr double GPS_L2_F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] // carrier and code frequencies -const double GPS_L2_FREQ_HZ = FREQ2; //!< L2 [Hz] +constexpr double GPS_L2_FREQ_HZ = FREQ2; //!< L2 [Hz] -const double GPS_L2_M_CODE_RATE_CPS = 0.5115e6; //!< GPS L2 M code rate [chips/s] -const int32_t GPS_L2_M_CODE_LENGTH_CHIPS = 10230; //!< GPS L2 M code length [chips] -const double GPS_L2_M_PERIOD_S = 0.02; //!< GPS L2 M code period [seconds] +constexpr double GPS_L2_M_CODE_RATE_CPS = 0.5115e6; //!< GPS L2 M code rate [chips/s] +constexpr int32_t GPS_L2_M_CODE_LENGTH_CHIPS = 10230; //!< GPS L2 M code length [chips] +constexpr double GPS_L2_M_PERIOD_S = 0.02; //!< GPS L2 M code period [seconds] -const double GPS_L2_L_CODE_RATE_CPS = 0.5115e6; //!< GPS L2 L code rate [chips/s] -const int32_t GPS_L2_L_CODE_LENGTH_CHIPS = 767250; //!< GPS L2 L code length [chips] -const double GPS_L2_L_PERIOD_S = 1.5; //!< GPS L2 L code period [seconds] +constexpr double GPS_L2_L_CODE_RATE_CPS = 0.5115e6; //!< GPS L2 L code rate [chips/s] +constexpr int32_t GPS_L2_L_CODE_LENGTH_CHIPS = 767250; //!< GPS L2 L code length [chips] +constexpr double GPS_L2_L_PERIOD_S = 1.5; //!< GPS L2 L code period [seconds] -const int32_t GPS_L2C_HISTORY_DEEP = 5; +constexpr int32_t GPS_L2C_HISTORY_DEEP = 5; // optimum parameters -const uint32_t GPS_L2C_OPT_ACQ_FS_SPS = 2000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate +constexpr uint32_t GPS_L2C_OPT_ACQ_FS_SPS = 2000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate -const int32_t GPS_L2C_M_INIT_REG[115] = +constexpr int32_t GPS_L2C_M_INIT_REG[115] = {0742417664, 0756014035, 0002747144, 0066265724, // 1:4 0601403471, 0703232733, 0124510070, 0617316361, // 5:8 0047541621, 0733031046, 0713512145, 0024437606, @@ -87,10 +87,10 @@ const int32_t GPS_L2C_M_INIT_REG[115] = 0706202440, 0705056276, 0020373522, 0746013617, 0132720621, 0434015513, 0566721727, 0140633660}; -const int32_t GPS_L2_CNAV_DATA_PAGE_BITS = 300; //!< GPS L2 CNAV page length, including preamble and CRC [bits] -const int32_t GPS_L2_SYMBOLS_PER_BIT = 2; -const int32_t GPS_L2_SAMPLES_PER_SYMBOL = 1; -const int32_t GPS_L2_CNAV_DATA_PAGE_SYMBOLS = 600; -const int32_t GPS_L2_CNAV_DATA_PAGE_DURATION_S = 12; +constexpr int32_t GPS_L2_CNAV_DATA_PAGE_BITS = 300; //!< GPS L2 CNAV page length, including preamble and CRC [bits] +constexpr int32_t GPS_L2_SYMBOLS_PER_BIT = 2; +constexpr int32_t GPS_L2_SAMPLES_PER_SYMBOL = 1; +constexpr int32_t GPS_L2_CNAV_DATA_PAGE_SYMBOLS = 600; +constexpr int32_t GPS_L2_CNAV_DATA_PAGE_DURATION_S = 12; #endif // GNSS_SDR_GPS_L2C_H diff --git a/src/core/system_parameters/GPS_L5.h b/src/core/system_parameters/GPS_L5.h index 3723466b1..8b32ed1dd 100644 --- a/src/core/system_parameters/GPS_L5.h +++ b/src/core/system_parameters/GPS_L5.h @@ -29,34 +29,34 @@ // Physical constants -const double GPS_L5_C_M_S = 299792458.0; //!< The speed of light, [m/s] -const double GPS_L5_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] -const double GPS_L5_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200K -const double GPS_L5_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200K -const double GPS_L5_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Earth rotation rate, [rad/s] -const double GPS_L5_GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] -const double GPS_L5_F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] +constexpr double GPS_L5_C_M_S = 299792458.0; //!< The speed of light, [m/s] +constexpr double GPS_L5_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] +constexpr double GPS_L5_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200K +constexpr double GPS_L5_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200K +constexpr double GPS_L5_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Earth rotation rate, [rad/s] +constexpr double GPS_L5_GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] +constexpr double GPS_L5_F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] // carrier and code frequencies -const double GPS_L5_FREQ_HZ = FREQ5; //!< L5 [Hz] +constexpr double GPS_L5_FREQ_HZ = FREQ5; //!< L5 [Hz] -const double GPS_L5I_CODE_RATE_CPS = 10.23e6; //!< GPS L5i code rate [chips/s] -const int32_t GPS_L5I_CODE_LENGTH_CHIPS = 10230; //!< GPS L5i code length [chips] -const double GPS_L5I_PERIOD_S = 0.001; //!< GPS L5 code period [seconds] -const int32_t GPS_L5I_PERIOD_MS = 1; //!< GPS L5 code period [ms] -const double GPS_L5I_SYMBOL_PERIOD_S = 0.01; //!< GPS L5 symbol period [seconds] -const int32_t GPS_L5I_SYMBOL_PERIOD_MS = 10; //!< GPS L5 symbol period [ms] +constexpr double GPS_L5I_CODE_RATE_CPS = 10.23e6; //!< GPS L5i code rate [chips/s] +constexpr int32_t GPS_L5I_CODE_LENGTH_CHIPS = 10230; //!< GPS L5i code length [chips] +constexpr double GPS_L5I_PERIOD_S = 0.001; //!< GPS L5 code period [seconds] +constexpr int32_t GPS_L5I_PERIOD_MS = 1; //!< GPS L5 code period [ms] +constexpr double GPS_L5I_SYMBOL_PERIOD_S = 0.01; //!< GPS L5 symbol period [seconds] +constexpr int32_t GPS_L5I_SYMBOL_PERIOD_MS = 10; //!< GPS L5 symbol period [ms] -const double GPS_L5Q_CODE_RATE_CPS = 10.23e6; //!< GPS L5i code rate [chips/s] -const int32_t GPS_L5Q_CODE_LENGTH_CHIPS = 10230; //!< GPS L5i code length [chips] -const double GPS_L5Q_PERIOD_S = 0.001; //!< GPS L5 code period [seconds] +constexpr double GPS_L5Q_CODE_RATE_CPS = 10.23e6; //!< GPS L5i code rate [chips/s] +constexpr int32_t GPS_L5Q_CODE_LENGTH_CHIPS = 10230; //!< GPS L5i code length [chips] +constexpr double GPS_L5Q_PERIOD_S = 0.001; //!< GPS L5 code period [seconds] -const int32_t GPS_L5_HISTORY_DEEP = 5; +constexpr int32_t GPS_L5_HISTORY_DEEP = 5; // optimum parameters -const uint32_t GPS_L5_OPT_ACQ_FS_SPS = 10000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate +constexpr uint32_t GPS_L5_OPT_ACQ_FS_SPS = 10000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate -const int32_t GPS_L5I_INIT_REG[210] = +constexpr int32_t GPS_L5I_INIT_REG[210] = {266, 365, 804, 1138, 1509, 1559, 1756, 2084, 2170, 2303, 2527, 2687, @@ -113,7 +113,7 @@ const int32_t GPS_L5I_INIT_REG[210] = 5950, 5521, 1515}; -const int32_t GPS_L5Q_INIT_REG[210] = +constexpr int32_t GPS_L5Q_INIT_REG[210] = { 1701, 323, 5292, 2020, 5429, 7136, 1041, 5947, @@ -170,16 +170,16 @@ const int32_t GPS_L5Q_INIT_REG[210] = 2765, 37, 1943, 7977, 2512, 4451, 4071}; -const int32_t GPS_L5_CNAV_DATA_PAGE_BITS = 300; //!< GPS L5 CNAV page length, including preamble and CRC [bits] -const int32_t GPS_L5_SYMBOLS_PER_BIT = 2; -const int32_t GPS_L5_SAMPLES_PER_SYMBOL = 10; -const int32_t GPS_L5_CNAV_DATA_PAGE_SYMBOLS = 600; -const int32_t GPS_L5_CNAV_DATA_PAGE_DURATION_S = 6; -const int32_t GPS_L5I_NH_CODE_LENGTH = 10; -const int32_t GPS_L5I_NH_CODE[10] = {0, 0, 0, 0, 1, 1, 0, 1, 0, 1}; +constexpr int32_t GPS_L5_CNAV_DATA_PAGE_BITS = 300; //!< GPS L5 CNAV page length, including preamble and CRC [bits] +constexpr int32_t GPS_L5_SYMBOLS_PER_BIT = 2; +constexpr int32_t GPS_L5_SAMPLES_PER_SYMBOL = 10; +constexpr int32_t GPS_L5_CNAV_DATA_PAGE_SYMBOLS = 600; +constexpr int32_t GPS_L5_CNAV_DATA_PAGE_DURATION_S = 6; +constexpr int32_t GPS_L5I_NH_CODE_LENGTH = 10; +constexpr int32_t GPS_L5I_NH_CODE[10] = {0, 0, 0, 0, 1, 1, 0, 1, 0, 1}; const std::string GPS_L5I_NH_CODE_STR = "0000110101"; -const int32_t GPS_L5Q_NH_CODE_LENGTH = 20; -const int32_t GPS_L5Q_NH_CODE[20] = {0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0}; +constexpr int32_t GPS_L5Q_NH_CODE_LENGTH = 20; +constexpr int32_t GPS_L5Q_NH_CODE[20] = {0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0}; const std::string GPS_L5Q_NH_CODE_STR = "00000100110101001110"; #endif // GNSS_SDR_GPS_L5_H diff --git a/src/core/system_parameters/Galileo_E1.h b/src/core/system_parameters/Galileo_E1.h index aca3d2c42..77c61f5b6 100644 --- a/src/core/system_parameters/Galileo_E1.h +++ b/src/core/system_parameters/Galileo_E1.h @@ -31,57 +31,53 @@ // Physical constants -const double GALILEO_PI = 3.1415926535898; //!< Pi as defined in GALILEO ICD -const double GALILEO_TWO_PI = 6.283185307179600; //!< 2*Pi as defined in GALILEO ICD -const double GALILEO_GM = 3.986004418e14; //!< Geocentric gravitational constant[m^3/s^2] -const double GALILEO_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Mean angular velocity of the Earth [rad/s] -const double GALILEO_C_M_S = 299792458.0; //!< The speed of light, [m/s] -const double GALILEO_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] -const double GALILEO_F = -4.442807309e-10; //!< Constant, [s/(m)^(1/2)] +constexpr double GALILEO_PI = 3.1415926535898; //!< Pi as defined in GALILEO ICD +constexpr double GALILEO_TWO_PI = 6.283185307179600; //!< 2*Pi as defined in GALILEO ICD +constexpr double GALILEO_GM = 3.986004418e14; //!< Geocentric gravitational constant[m^3/s^2] +constexpr double GALILEO_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Mean angular velocity of the Earth [rad/s] +constexpr double GALILEO_C_M_S = 299792458.0; //!< The speed of light, [m/s] +constexpr double GALILEO_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] +constexpr double GALILEO_F = -4.442807309e-10; //!< Constant, [s/(m)^(1/2)] // carrier and code frequencies -const double GALILEO_E1_FREQ_HZ = FREQ1; //!< Galileo E1 carrier frequency [Hz] -const double GALILEO_E1_CODE_CHIP_RATE_CPS = 1.023e6; //!< Galileo E1 code rate [chips/s] -const double GALILEO_E1_CODE_PERIOD_S = 0.004; //!< Galileo E1 code period [s] -const int32_t GALILEO_E1_CODE_PERIOD_MS = 4; //!< Galileo E1 code period [ms] -const double GALILEO_E1_SUB_CARRIER_A_RATE_HZ = 1.023e6; //!< Galileo E1 sub-carrier 'a' rate [Hz] -const double GALILEO_E1_SUB_CARRIER_B_RATE_HZ = 6.138e6; //!< Galileo E1 sub-carrier 'b' rate [Hz] -const double GALILEO_E1_B_CODE_LENGTH_CHIPS = 4092.0; //!< Galileo E1-B code length [chips] -const double GALILEO_E1_B_SYMBOL_RATE_BPS = 250.0; //!< Galileo E1-B symbol rate [bits/second] -const int32_t GALILEO_E1_B_SAMPLES_PER_SYMBOL = 1; //!< (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS) / Galileo_E1_B_SYMBOL_RATE_BPS -const int32_t GALILEO_E1_C_SECONDARY_CODE_LENGTH = 25; //!< Galileo E1-C secondary code length [chips] -const int32_t GALILEO_E1_NUMBER_OF_CODES = 50; +constexpr double GALILEO_E1_FREQ_HZ = FREQ1; //!< Galileo E1 carrier frequency [Hz] +constexpr double GALILEO_E1_CODE_CHIP_RATE_CPS = 1.023e6; //!< Galileo E1 code rate [chips/s] +constexpr double GALILEO_E1_CODE_PERIOD_S = 0.004; //!< Galileo E1 code period [s] +constexpr int32_t GALILEO_E1_CODE_PERIOD_MS = 4; //!< Galileo E1 code period [ms] +constexpr double GALILEO_E1_SUB_CARRIER_A_RATE_HZ = 1.023e6; //!< Galileo E1 sub-carrier 'a' rate [Hz] +constexpr double GALILEO_E1_SUB_CARRIER_B_RATE_HZ = 6.138e6; //!< Galileo E1 sub-carrier 'b' rate [Hz] +constexpr double GALILEO_E1_B_CODE_LENGTH_CHIPS = 4092.0; //!< Galileo E1-B code length [chips] +constexpr double GALILEO_E1_B_SYMBOL_RATE_BPS = 250.0; //!< Galileo E1-B symbol rate [bits/second] +constexpr int32_t GALILEO_E1_B_SAMPLES_PER_SYMBOL = 1; //!< (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS) / Galileo_E1_B_SYMBOL_RATE_BPS +constexpr int32_t GALILEO_E1_C_SECONDARY_CODE_LENGTH = 25; //!< Galileo E1-C secondary code length [chips] +constexpr int32_t GALILEO_E1_NUMBER_OF_CODES = 50; // optimum parameters -const uint32_t GALILEO_E1_OPT_ACQ_FS_SPS = 2000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate +constexpr uint32_t GALILEO_E1_OPT_ACQ_FS_SPS = 2000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate -const double GALILEO_STARTOFFSET_MS = 68.802; // [ms] Initial sign. travel time (this cannot go here) - - -// OBSERVABLE HISTORY DEEP FOR INTERPOLATION -const int32_t GALILEO_E1_HISTORY_DEEP = 100; +constexpr int32_t GALILEO_E1_HISTORY_DEEP = 100; //!< Observable history length for interpotalion // Galileo INAV Telemetry structure const std::string GALILEO_INAV_PREAMBLE = {"0101100000"}; -const int32_t GALILEO_INAV_PREAMBLE_LENGTH_BITS = 10; -const double GALILEO_INAV_PAGE_PART_WITH_PREABLE_SECONDS = 2.0 + GALILEO_INAV_PREAMBLE_LENGTH_BITS * GALILEO_E1_CODE_PERIOD_S; -const int32_t GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS = 250; -const int32_t GALILEO_INAV_PAGE_PART_SYMBOLS = 250; //!< Each Galileo INAV pages are composed of two parts (even and odd) each of 250 symbols, including preamble. See Galileo ICD 4.3.2 -const int32_t GALILEO_INAV_PAGE_SYMBOLS = 500; //!< The complete Galileo INAV page length -const int32_t GALILEO_INAV_PAGE_PART_SECONDS = 1; // a page part last 1 sec -const int32_t GALILEO_INAV_PAGE_PART_MS = 1000; // a page part last 1 sec -const int32_t GALILEO_INAV_PAGE_SECONDS = 2; // a full page last 2 sec -const int32_t GALILEO_INAV_INTERLEAVER_ROWS = 8; -const int32_t GALILEO_INAV_INTERLEAVER_COLS = 30; -const int32_t GALILEO_TELEMETRY_RATE_BITS_SECOND = 250; // bps -const int32_t GALILEO_PAGE_TYPE_BITS = 6; -const int32_t GALILEO_DATA_JK_BITS = 128; -const int32_t GALILEO_DATA_FRAME_BITS = 196; -const int32_t GALILEO_DATA_FRAME_BYTES = 25; +constexpr int32_t GALILEO_INAV_PREAMBLE_LENGTH_BITS = 10; +constexpr double GALILEO_INAV_PAGE_PART_WITH_PREABLE_SECONDS = 2.0 + GALILEO_INAV_PREAMBLE_LENGTH_BITS * GALILEO_E1_CODE_PERIOD_S; +constexpr int32_t GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS = 250; +constexpr int32_t GALILEO_INAV_PAGE_PART_SYMBOLS = 250; //!< Each Galileo INAV pages are composed of two parts (even and odd) each of 250 symbols, including preamble. See Galileo ICD 4.3.2 +constexpr int32_t GALILEO_INAV_PAGE_SYMBOLS = 500; //!< The complete Galileo INAV page length +constexpr int32_t GALILEO_INAV_PAGE_PART_SECONDS = 1; // a page part last 1 sec +constexpr int32_t GALILEO_INAV_PAGE_PART_MS = 1000; // a page part last 1 sec +constexpr int32_t GALILEO_INAV_PAGE_SECONDS = 2; // a full page last 2 sec +constexpr int32_t GALILEO_INAV_INTERLEAVER_ROWS = 8; +constexpr int32_t GALILEO_INAV_INTERLEAVER_COLS = 30; +constexpr int32_t GALILEO_TELEMETRY_RATE_BITS_SECOND = 250; // bps +constexpr int32_t GALILEO_PAGE_TYPE_BITS = 6; +constexpr int32_t GALILEO_DATA_JK_BITS = 128; +constexpr int32_t GALILEO_DATA_FRAME_BITS = 196; +constexpr int32_t GALILEO_DATA_FRAME_BYTES = 25; const std::vector> TYPE({{1, 6}}); const std::vector> PAGE_TYPE_BIT({{1, 6}}); @@ -89,43 +85,43 @@ 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> T0_E_1_BIT({{17, 14}}); -const int32_t T0E_1_LSB = 60; +constexpr int32_t T0E_1_LSB = 60; const std::vector> M0_1_BIT({{31, 32}}); -const double M0_1_LSB = PI_TWO_N31; +constexpr double M0_1_LSB = PI_TWO_N31; const std::vector> E_1_BIT({{63, 32}}); -const double E_1_LSB = TWO_N33; +constexpr double E_1_LSB = TWO_N33; const std::vector> A_1_BIT({{95, 32}}); -const double A_1_LSB_GAL = TWO_N19; +constexpr double A_1_LSB_GAL = TWO_N19; // last two bits are reserved /* Page 2 - Word type 2: Ephemeris (2/4) */ const std::vector> IOD_NAV_2_BIT({{7, 10}}); const std::vector> OMEGA_0_2_BIT({{17, 32}}); -const double OMEGA_0_2_LSB = PI_TWO_N31; +constexpr double OMEGA_0_2_LSB = PI_TWO_N31; const std::vector> I_0_2_BIT({{49, 32}}); -const double I_0_2_LSB = PI_TWO_N31; +constexpr double I_0_2_LSB = PI_TWO_N31; const std::vector> OMEGA_2_BIT({{81, 32}}); -const double OMEGA_2_LSB = PI_TWO_N31; +constexpr double OMEGA_2_LSB = PI_TWO_N31; const std::vector> I_DOT_2_BIT({{113, 14}}); -const double I_DOT_2_LSB = PI_TWO_N43; +constexpr double I_DOT_2_LSB = PI_TWO_N43; // last two bits are reserved /* Word type 3: Ephemeris (3/4) and SISA */ const std::vector> IOD_NAV_3_BIT({{7, 10}}); const std::vector> OMEGA_DOT_3_BIT({{17, 24}}); -const double OMEGA_DOT_3_LSB = PI_TWO_N43; +constexpr double OMEGA_DOT_3_LSB = PI_TWO_N43; const std::vector> DELTA_N_3_BIT({{41, 16}}); -const double DELTA_N_3_LSB = PI_TWO_N43; +constexpr double DELTA_N_3_LSB = PI_TWO_N43; const std::vector> C_UC_3_BIT({{57, 16}}); -const double C_UC_3_LSB = TWO_N29; +constexpr double C_UC_3_LSB = TWO_N29; const std::vector> C_US_3_BIT({{73, 16}}); -const double C_US_3_LSB = TWO_N29; +constexpr double C_US_3_LSB = TWO_N29; const std::vector> C_RC_3_BIT({{89, 16}}); -const double C_RC_3_LSB = TWO_N5; +constexpr double C_RC_3_LSB = TWO_N5; const std::vector> C_RS_3_BIT({{105, 16}}); -const double C_RS_3_LSB = TWO_N5; +constexpr double C_RS_3_LSB = TWO_N5; const std::vector> SISA_3_BIT({{121, 8}}); @@ -133,17 +129,17 @@ const std::vector> SISA_3_BIT({{121, 8}}); const std::vector> IOD_NAV_4_BIT({{7, 10}}); const std::vector> SV_ID_PRN_4_BIT({{17, 6}}); const std::vector> C_IC_4_BIT({{23, 16}}); -const double C_IC_4_LSB = TWO_N29; +constexpr double C_IC_4_LSB = TWO_N29; const std::vector> C_IS_4_BIT({{39, 16}}); -const double C_IS_4_LSB = TWO_N29; +constexpr double C_IS_4_LSB = TWO_N29; const std::vector> T0C_4_BIT({{55, 14}}); // -const int32_t T0C_4_LSB = 60; +constexpr int32_t T0C_4_LSB = 60; const std::vector> AF0_4_BIT({{69, 31}}); // -const double AF0_4_LSB = TWO_N34; +constexpr double AF0_4_LSB = TWO_N34; const std::vector> AF1_4_BIT({{100, 21}}); // -const double AF1_4_LSB = TWO_N46; +constexpr double AF1_4_LSB = TWO_N46; const std::vector> AF2_4_BIT({{121, 6}}); -const double AF2_4_LSB = TWO_N59; +constexpr double AF2_4_LSB = TWO_N59; const std::vector> SPARE_4_BIT({{127, 2}}); // last two bits are reserved @@ -152,11 +148,11 @@ const std::vector> SPARE_4_BIT({{127, 2}}); /* Ionospheric correction */ /* Az */ const std::vector> AI0_5_BIT({{7, 11}}); // -const double AI0_5_LSB = TWO_N2; +constexpr double AI0_5_LSB = TWO_N2; const std::vector> AI1_5_BIT({{18, 11}}); // -const double AI1_5_LSB = TWO_N8; +constexpr double AI1_5_LSB = TWO_N8; const std::vector> AI2_5_BIT({{29, 14}}); // -const double AI2_5_LSB = TWO_N15; +constexpr double AI2_5_LSB = TWO_N15; /* Ionospheric disturbance flag */ const std::vector> REGION1_5_BIT({{43, 1}}); // const std::vector> REGION2_5_BIT({{44, 1}}); // @@ -164,9 +160,9 @@ const std::vector> REGION3_5_BIT({{45, 1}}); // const std::vector> REGION4_5_BIT({{46, 1}}); // const std::vector> REGION5_5_BIT({{47, 1}}); // const std::vector> BGD_E1_E5A_5_BIT({{48, 10}}); // -const double BGD_E1_E5A_5_LSB = TWO_N32; +constexpr double BGD_E1_E5A_5_LSB = TWO_N32; const std::vector> BGD_E1_E5B_5_BIT({{58, 10}}); // -const double BGD_E1_E5B_5_LSB = TWO_N32; +constexpr double BGD_E1_E5B_5_LSB = TWO_N32; const std::vector> E5B_HS_5_BIT({{68, 2}}); // const std::vector> E1_B_HS_5_BIT({{70, 2}}); // const std::vector> E5B_DVS_5_BIT({{72, 1}}); // @@ -179,12 +175,12 @@ const std::vector> SPARE_5_BIT({{106, 23}}); /* Page 6 */ const std::vector> A0_6_BIT({{7, 32}}); -const double A0_6_LSB = TWO_N30; +constexpr double A0_6_LSB = TWO_N30; const std::vector> A1_6_BIT({{39, 24}}); -const double A1_6_LSB = TWO_N50; +constexpr double A1_6_LSB = TWO_N50; const std::vector> DELTA_T_LS_6_BIT({{63, 8}}); const std::vector> T0T_6_BIT({{71, 8}}); -const int32_t T0T_6_LSB = 3600; +constexpr int32_t T0T_6_LSB = 3600; const std::vector> W_NOT_6_BIT({{79, 8}}); const std::vector> WN_LSF_6_BIT({{87, 8}}); const std::vector> DN_6_BIT({{95, 3}}); @@ -196,91 +192,91 @@ const std::vector> TOW_6_BIT({{106, 20}}); const std::vector> IOD_A_7_BIT({{7, 4}}); const std::vector> WN_A_7_BIT({{11, 2}}); const std::vector> T0A_7_BIT({{13, 10}}); -const int32_t T0A_7_LSB = 600; +constexpr int32_t T0A_7_LSB = 600; const std::vector> SVI_D1_7_BIT({{23, 6}}); const std::vector> DELTA_A_7_BIT({{29, 13}}); -const double DELTA_A_7_LSB = TWO_N9; +constexpr double DELTA_A_7_LSB = TWO_N9; const std::vector> E_7_BIT({{42, 11}}); -const double E_7_LSB = TWO_N16; +constexpr double E_7_LSB = TWO_N16; const std::vector> OMEGA_7_BIT({{53, 16}}); -const double OMEGA_7_LSB = TWO_N15; +constexpr double OMEGA_7_LSB = TWO_N15; const std::vector> DELTA_I_7_BIT({{69, 11}}); -const double DELTA_I_7_LSB = TWO_N14; +constexpr double DELTA_I_7_LSB = TWO_N14; const std::vector> OMEGA0_7_BIT({{80, 16}}); -const double OMEGA0_7_LSB = TWO_N15; +constexpr double OMEGA0_7_LSB = TWO_N15; const std::vector> OMEGA_DOT_7_BIT({{96, 11}}); -const double OMEGA_DOT_7_LSB = TWO_N33; +constexpr double OMEGA_DOT_7_LSB = TWO_N33; const std::vector> M0_7_BIT({{107, 16}}); -const double M0_7_LSB = TWO_N15; +constexpr double M0_7_LSB = TWO_N15; /* Page 8 */ const std::vector> IOD_A_8_BIT({{7, 4}}); const std::vector> AF0_8_BIT({{11, 16}}); -const double AF0_8_LSB = TWO_N19; +constexpr double AF0_8_LSB = TWO_N19; const std::vector> AF1_8_BIT({{27, 13}}); -const double AF1_8_LSB = TWO_N38; +constexpr double AF1_8_LSB = TWO_N38; const std::vector> E5B_HS_8_BIT({{40, 2}}); const std::vector> E1_B_HS_8_BIT({{42, 2}}); const std::vector> SVI_D2_8_BIT({{44, 6}}); const std::vector> DELTA_A_8_BIT({{50, 13}}); -const double DELTA_A_8_LSB = TWO_N9; +constexpr double DELTA_A_8_LSB = TWO_N9; const std::vector> E_8_BIT({{63, 11}}); -const double E_8_LSB = TWO_N16; +constexpr double E_8_LSB = TWO_N16; const std::vector> OMEGA_8_BIT({{74, 16}}); -const double OMEGA_8_LSB = TWO_N15; +constexpr double OMEGA_8_LSB = TWO_N15; const std::vector> DELTA_I_8_BIT({{90, 11}}); -const double DELTA_I_8_LSB = TWO_N14; +constexpr double DELTA_I_8_LSB = TWO_N14; const std::vector> OMEGA0_8_BIT({{101, 16}}); -const double OMEGA0_8_LSB = TWO_N15; +constexpr double OMEGA0_8_LSB = TWO_N15; const std::vector> OMEGA_DOT_8_BIT({{117, 11}}); -const double OMEGA_DOT_8_LSB = TWO_N33; +constexpr double OMEGA_DOT_8_LSB = TWO_N33; /* Page 9 */ const std::vector> IOD_A_9_BIT({{7, 4}}); const std::vector> WN_A_9_BIT({{11, 2}}); const std::vector> T0A_9_BIT({{13, 10}}); -const int32_t T0A_9_LSB = 600; +constexpr int32_t T0A_9_LSB = 600; const std::vector> M0_9_BIT({{23, 16}}); -const double M0_9_LSB = TWO_N15; +constexpr double M0_9_LSB = TWO_N15; const std::vector> AF0_9_BIT({{39, 16}}); -const double AF0_9_LSB = TWO_N19; +constexpr double AF0_9_LSB = TWO_N19; const std::vector> AF1_9_BIT({{55, 13}}); -const double AF1_9_LSB = TWO_N38; +constexpr double AF1_9_LSB = TWO_N38; const std::vector> E5B_HS_9_BIT({{68, 2}}); const std::vector> E1_B_HS_9_BIT({{70, 2}}); const std::vector> SVI_D3_9_BIT({{72, 6}}); const std::vector> DELTA_A_9_BIT({{78, 13}}); -const double DELTA_A_9_LSB = TWO_N9; +constexpr double DELTA_A_9_LSB = TWO_N9; const std::vector> E_9_BIT({{91, 11}}); -const double E_9_LSB = TWO_N16; +constexpr double E_9_LSB = TWO_N16; const std::vector> OMEGA_9_BIT({{102, 16}}); -const double OMEGA_9_LSB = TWO_N15; +constexpr double OMEGA_9_LSB = TWO_N15; const std::vector> DELTA_I_9_BIT({{118, 11}}); -const double DELTA_I_9_LSB = TWO_N14; +constexpr double DELTA_I_9_LSB = TWO_N14; /* Page 10 */ const std::vector> IOD_A_10_BIT({{7, 4}}); const std::vector> OMEGA0_10_BIT({{11, 16}}); -const double OMEGA0_10_LSB = TWO_N15; +constexpr double OMEGA0_10_LSB = TWO_N15; const std::vector> OMEGA_DOT_10_BIT({{27, 11}}); -const double OMEGA_DOT_10_LSB = TWO_N33; +constexpr double OMEGA_DOT_10_LSB = TWO_N33; const std::vector> M0_10_BIT({{38, 16}}); -const double M0_10_LSB = TWO_N15; +constexpr double M0_10_LSB = TWO_N15; const std::vector> AF0_10_BIT({{54, 16}}); -const double AF0_10_LSB = TWO_N19; +constexpr double AF0_10_LSB = TWO_N19; const std::vector> AF1_10_BIT({{70, 13}}); -const double AF1_10_LSB = TWO_N38; +constexpr double AF1_10_LSB = TWO_N38; const std::vector> E5B_HS_10_BIT({{83, 2}}); const std::vector> E1_B_HS_10_BIT({{85, 2}}); const std::vector> A_0_G_10_BIT({{87, 16}}); -const double A_0G_10_LSB = TWO_N35; +constexpr double A_0G_10_LSB = TWO_N35; const std::vector> A_1_G_10_BIT({{103, 12}}); -const double A_1G_10_LSB = TWO_N51; +constexpr double A_1G_10_LSB = TWO_N51; const std::vector> T_0_G_10_BIT({{115, 8}}); -const int32_t T_0_G_10_LSB = 3600; +constexpr int32_t T_0_G_10_LSB = 3600; const std::vector> WN_0_G_10_BIT({{123, 6}}); diff --git a/src/core/system_parameters/Galileo_E5a.h b/src/core/system_parameters/Galileo_E5a.h index 0a1d8fd4d..c04ccd8d3 100644 --- a/src/core/system_parameters/Galileo_E5a.h +++ b/src/core/system_parameters/Galileo_E5a.h @@ -29,42 +29,42 @@ // Carrier and code frequencies -const double GALILEO_E5A_FREQ_HZ = FREQ5; //!< Galileo E5a carrier frequency [Hz] -const double GALILEO_E5A_CODE_CHIP_RATE_CPS = 1.023e7; //!< Galileo E5a code rate [chips/s] -const double GALILEO_E5A_I_TIERED_CODE_PERIOD_S = 0.020; //!< Galileo E5a-I tiered code period [s] -const double GALILEO_E5A_Q_TIERED_CODE_PERIOD_S = 0.100; //!< Galileo E5a-Q tiered code period [s] -const int32_t GALILEO_E5A_CODE_LENGTH_CHIPS = 10230; //!< Galileo E5a primary code length [chips] -const int32_t GALILEO_E5A_I_SECONDARY_CODE_LENGTH = 20; //!< Galileo E5a-I secondary code length [chips] -const int32_t GALILEO_E5A_Q_SECONDARY_CODE_LENGTH = 100; //!< Galileo E5a-Q secondary code length [chips] -const double GALILEO_E5A_CODE_PERIOD_S = 0.001; //!< Galileo E1 primary code period [s] -const int32_t GALILEO_E5A_CODE_PERIOD_MS = 1; //!< Galileo E1 primary code period [ms] -const int32_t GALILEO_E5A_SYMBOL_RATE_BPS = 50; //!< Galileo E5a symbol rate [bits/second] -const int32_t GALILEO_E5A_NUMBER_OF_CODES = 50; +constexpr double GALILEO_E5A_FREQ_HZ = FREQ5; //!< Galileo E5a carrier frequency [Hz] +constexpr double GALILEO_E5A_CODE_CHIP_RATE_CPS = 1.023e7; //!< Galileo E5a code rate [chips/s] +constexpr double GALILEO_E5A_I_TIERED_CODE_PERIOD_S = 0.020; //!< Galileo E5a-I tiered code period [s] +constexpr double GALILEO_E5A_Q_TIERED_CODE_PERIOD_S = 0.100; //!< Galileo E5a-Q tiered code period [s] +constexpr int32_t GALILEO_E5A_CODE_LENGTH_CHIPS = 10230; //!< Galileo E5a primary code length [chips] +constexpr int32_t GALILEO_E5A_I_SECONDARY_CODE_LENGTH = 20; //!< Galileo E5a-I secondary code length [chips] +constexpr int32_t GALILEO_E5A_Q_SECONDARY_CODE_LENGTH = 100; //!< Galileo E5a-Q secondary code length [chips] +constexpr double GALILEO_E5A_CODE_PERIOD_S = 0.001; //!< Galileo E1 primary code period [s] +constexpr int32_t GALILEO_E5A_CODE_PERIOD_MS = 1; //!< Galileo E1 primary code period [ms] +constexpr int32_t GALILEO_E5A_SYMBOL_RATE_BPS = 50; //!< Galileo E5a symbol rate [bits/second] +constexpr int32_t GALILEO_E5A_NUMBER_OF_CODES = 50; // OBSERVABLE HISTORY DEEP FOR INTERPOLATION AND CRC ERROR LIMIT -const int32_t GALILEO_E5A_HISTORY_DEEP = 20; -const int32_t GALILEO_E5A_CRC_ERROR_LIMIT = 6; +constexpr int32_t GALILEO_E5A_HISTORY_DEEP = 20; +constexpr int32_t GALILEO_E5A_CRC_ERROR_LIMIT = 6; // optimum parameters -const uint32_t GALILEO_E5A_OPT_ACQ_FS_SPS = 10000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate +constexpr uint32_t GALILEO_E5A_OPT_ACQ_FS_SPS = 10000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate // F/NAV message structure -const int32_t GALILEO_FNAV_PREAMBLE_LENGTH_BITS = 12; +constexpr int32_t GALILEO_FNAV_PREAMBLE_LENGTH_BITS = 12; const std::string GALILEO_FNAV_PREAMBLE = {"101101110000"}; -const int32_t GALILEO_FNAV_CODES_PER_SYMBOL = 20; // (chip rate/ code length)/telemetry bps -const int32_t GALILEO_FNAV_CODES_PER_PREAMBLE = 240; // bits preamble * codes/symbol -const int32_t GALILEO_FNAV_SYMBOLS_PER_PAGE = 500; // Total symbols per page including preamble. See Galileo ICD 4.2.2 -const int32_t GALILEO_FNAV_SECONDS_PER_PAGE = 10; -const int32_t GALILEO_FNAV_CODES_PER_PAGE = 10000; // symbols * codes/symbol, where code stands for primary code +constexpr int32_t GALILEO_FNAV_CODES_PER_SYMBOL = 20; // (chip rate/ code length)/telemetry bps +constexpr int32_t GALILEO_FNAV_CODES_PER_PREAMBLE = 240; // bits preamble * codes/symbol +constexpr int32_t GALILEO_FNAV_SYMBOLS_PER_PAGE = 500; // Total symbols per page including preamble. See Galileo ICD 4.2.2 +constexpr int32_t GALILEO_FNAV_SECONDS_PER_PAGE = 10; +constexpr int32_t GALILEO_FNAV_CODES_PER_PAGE = 10000; // symbols * codes/symbol, where code stands for primary code -const int32_t GALILEO_FNAV_INTERLEAVER_ROWS = 8; -const int32_t GALILEO_FNAV_INTERLEAVER_COLS = 61; -const int32_t GALILEO_FNAV_PAGE_TYPE_BITS = 6; +constexpr int32_t GALILEO_FNAV_INTERLEAVER_ROWS = 8; +constexpr int32_t GALILEO_FNAV_INTERLEAVER_COLS = 61; +constexpr int32_t GALILEO_FNAV_PAGE_TYPE_BITS = 6; -const int32_t GALILEO_FNAV_DATA_FRAME_BITS = 214; -const int32_t GALILEO_FNAV_DATA_FRAME_BYTES = 27; +constexpr int32_t GALILEO_FNAV_DATA_FRAME_BITS = 214; +constexpr int32_t GALILEO_FNAV_DATA_FRAME_BYTES = 27; const std::vector> FNAV_PAGE_TYPE_BIT({{1, 6}}); @@ -72,27 +72,27 @@ const std::vector> FNAV_PAGE_TYPE_BIT({{1, 6}}); const std::vector> FNAV_SV_ID_PRN_1_BIT({{7, 6}}); const std::vector> FNAV_IO_DNAV_1_BIT({{13, 10}}); const std::vector> FNAV_T0C_1_BIT({{23, 14}}); -const int32_t FNAV_T0C_1_LSB = 60; +constexpr int32_t FNAV_T0C_1_LSB = 60; const std::vector> FNAV_AF0_1_BIT({{37, 31}}); -const double FNAV_AF0_1_LSB = TWO_N34; +constexpr double FNAV_AF0_1_LSB = TWO_N34; const std::vector> FNAV_AF1_1_BIT({{68, 21}}); -const double FNAV_AF1_1_LSB = TWO_N46; +constexpr double FNAV_AF1_1_LSB = TWO_N46; const std::vector> FNAV_AF2_1_BIT({{89, 6}}); -const double FNAV_AF2_1_LSB = TWO_N59; +constexpr double FNAV_AF2_1_LSB = TWO_N59; const std::vector> FNAV_SISA_1_BIT({{95, 8}}); const std::vector> FNAV_AI0_1_BIT({{103, 11}}); -const double FNAV_AI0_1_LSB = TWO_N2; +constexpr double FNAV_AI0_1_LSB = TWO_N2; const std::vector> FNAV_AI1_1_BIT({{114, 11}}); -const double FNAV_AI1_1_LSB = TWO_N8; +constexpr double FNAV_AI1_1_LSB = TWO_N8; const std::vector> FNAV_AI2_1_BIT({{125, 14}}); -const double FNAV_AI2_1_LSB = TWO_N15; +constexpr double FNAV_AI2_1_LSB = TWO_N15; const std::vector> FNAV_REGION1_1_BIT({{139, 1}}); const std::vector> FNAV_REGION2_1_BIT({{140, 1}}); const std::vector> FNAV_REGION3_1_BIT({{141, 1}}); const std::vector> FNAV_REGION4_1_BIT({{142, 1}}); const std::vector> FNAV_REGION5_1_BIT({{143, 1}}); const std::vector> FNAV_BGD_1_BIT({{144, 10}}); -const double FNAV_BGD_1_LSB = TWO_N32; +constexpr double FNAV_BGD_1_LSB = TWO_N32; const std::vector> FNAV_E5AHS_1_BIT({{154, 2}}); const std::vector> FNAV_WN_1_BIT({{156, 12}}); const std::vector> FNAV_TOW_1_BIT({{168, 20}}); @@ -101,64 +101,64 @@ const std::vector> FNAV_E5ADVS_1_BIT({{188, 1}}); // WORD 2 Ephemeris (1/3) const std::vector> FNAV_IO_DNAV_2_BIT({{7, 10}}); const std::vector> FNAV_M0_2_BIT({{17, 32}}); -const double FNAV_M0_2_LSB = PI_TWO_N31; +constexpr double FNAV_M0_2_LSB = PI_TWO_N31; const std::vector> FNAV_OMEGADOT_2_BIT({{49, 24}}); -const double FNAV_OMEGADOT_2_LSB = PI_TWO_N43; +constexpr double FNAV_OMEGADOT_2_LSB = PI_TWO_N43; const std::vector> FNAV_E_2_BIT({{73, 32}}); -const double FNAV_E_2_LSB = TWO_N33; +constexpr double FNAV_E_2_LSB = TWO_N33; const std::vector> FNAV_A12_2_BIT({{105, 32}}); -const double FNAV_A12_2_LSB = TWO_N19; +constexpr double FNAV_A12_2_LSB = TWO_N19; const std::vector> FNAV_OMEGA0_2_BIT({{137, 32}}); -const double FNAV_OMEGA0_2_LSB = PI_TWO_N31; +constexpr double FNAV_OMEGA0_2_LSB = PI_TWO_N31; const std::vector> FNAV_IDOT_2_BIT({{169, 14}}); -const double FNAV_IDOT_2_LSB = PI_TWO_N43; +constexpr double FNAV_IDOT_2_LSB = PI_TWO_N43; const std::vector> FNAV_WN_2_BIT({{183, 12}}); const std::vector> FNAV_TOW_2_BIT({{195, 20}}); // WORD 3 Ephemeris (2/3) const std::vector> FNAV_IO_DNAV_3_BIT({{7, 10}}); const std::vector> FNAV_I0_3_BIT({{17, 32}}); -const double FNAV_I0_3_LSB = PI_TWO_N31; +constexpr double FNAV_I0_3_LSB = PI_TWO_N31; const std::vector> FNAV_W_3_BIT({{49, 32}}); -const double FNAV_W_3_LSB = PI_TWO_N31; +constexpr double FNAV_W_3_LSB = PI_TWO_N31; const std::vector> FNAV_DELTAN_3_BIT({{81, 16}}); -const double FNAV_DELTAN_3_LSB = PI_TWO_N43; +constexpr double FNAV_DELTAN_3_LSB = PI_TWO_N43; const std::vector> FNAV_CUC_3_BIT({{97, 16}}); -const double FNAV_CUC_3_LSB = TWO_N29; +constexpr double FNAV_CUC_3_LSB = TWO_N29; const std::vector> FNAV_CUS_3_BIT({{113, 16}}); -const double FNAV_CUS_3_LSB = TWO_N29; +constexpr double FNAV_CUS_3_LSB = TWO_N29; const std::vector> FNAV_CRC_3_BIT({{129, 16}}); -const double FNAV_CRC_3_LSB = TWO_N5; +constexpr double FNAV_CRC_3_LSB = TWO_N5; const std::vector> FNAV_CRS_3_BIT({{145, 16}}); -const double FNAV_CRS_3_LSB = TWO_N5; +constexpr double FNAV_CRS_3_LSB = TWO_N5; const std::vector> FNAV_T0E_3_BIT({{161, 14}}); -const int32_t FNAV_T0E_3_LSB = 60; +constexpr 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}}); // WORD 4 Ephemeris (3/3) const std::vector> FNAV_IO_DNAV_4_BIT({{7, 10}}); const std::vector> FNAV_CIC_4_BIT({{17, 16}}); -const double FNAV_CIC_4_LSB = TWO_N29; +constexpr double FNAV_CIC_4_LSB = TWO_N29; const std::vector> FNAV_CIS_4_BIT({{33, 16}}); -const double FNAV_CIS_4_LSB = TWO_N29; +constexpr double FNAV_CIS_4_LSB = TWO_N29; const std::vector> FNAV_A0_4_BIT({{49, 32}}); -const double FNAV_A0_4_LSB = TWO_N30; +constexpr double FNAV_A0_4_LSB = TWO_N30; const std::vector> FNAV_A1_4_BIT({{81, 24}}); -const double FNAV_A1_4_LSB = TWO_N50; +constexpr 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 int32_t FNAV_T0T_4_LSB = 3600; +constexpr int32_t FNAV_T0T_4_LSB = 3600; const std::vector> FNAV_W_NOT_4_BIT({{121, 8}}); const std::vector> FNAV_W_NLSF_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 int32_t FNAV_T0G_4_LSB = 3600; +constexpr int32_t FNAV_T0G_4_LSB = 3600; const std::vector> FNAV_A0G_4_BIT({{156, 16}}); -const double FNAV_A0G_4_LSB = TWO_N35; +constexpr double FNAV_A0G_4_LSB = TWO_N35; const std::vector> FNAV_A1G_4_BIT({{172, 12}}); -const double FNAV_A1G_4_LSB = TWO_N51; +constexpr double FNAV_A1G_4_LSB = TWO_N51; const std::vector> FNAV_W_N0G_4_BIT({{184, 6}}); const std::vector> FNAV_TOW_4_BIT({{190, 20}}); @@ -166,26 +166,26 @@ const std::vector> FNAV_TOW_4_BIT({{190, 20}}); const std::vector> FNAV_IO_DA_5_BIT({{7, 4}}); const std::vector> FNAV_W_NA_5_BIT({{11, 2}}); const std::vector> FNAV_T0A_5_BIT({{13, 10}}); -const int32_t FNAV_T0A_5_LSB = 600; +constexpr int32_t FNAV_T0A_5_LSB = 600; const std::vector> FNAV_SVI_D1_5_BIT({{23, 6}}); const std::vector> FNAV_DELTAA12_1_5_BIT({{29, 13}}); -const double FNAV_DELTAA12_5_LSB = TWO_N9; +constexpr double FNAV_DELTAA12_5_LSB = TWO_N9; const std::vector> FNAV_E_1_5_BIT({{42, 11}}); -const double FNAV_E_5_LSB = TWO_N16; +constexpr double FNAV_E_5_LSB = TWO_N16; const std::vector> FNAV_W_1_5_BIT({{53, 16}}); -const double FNAV_W_5_LSB = TWO_N15; +constexpr double FNAV_W_5_LSB = TWO_N15; const std::vector> FNAV_DELTAI_1_5_BIT({{69, 11}}); -const double FNAV_DELTAI_5_LSB = TWO_N14; +constexpr double FNAV_DELTAI_5_LSB = TWO_N14; const std::vector> FNAV_OMEGA0_1_5_BIT({{80, 16}}); -const double FNAV_OMEGA0_5_LSB = TWO_N15; +constexpr double FNAV_OMEGA0_5_LSB = TWO_N15; const std::vector> FNAV_OMEGADOT_1_5_BIT({{96, 11}}); -const double FNAV_OMEGADOT_5_LSB = TWO_N33; +constexpr double FNAV_OMEGADOT_5_LSB = TWO_N33; const std::vector> FNAV_M0_1_5_BIT({{107, 16}}); -const double FNAV_M0_5_LSB = TWO_N15; +constexpr double FNAV_M0_5_LSB = TWO_N15; const std::vector> FNAV_AF0_1_5_BIT({{123, 16}}); -const double FNAV_AF0_5_LSB = TWO_N19; +constexpr double FNAV_AF0_5_LSB = TWO_N19; const std::vector> FNAV_AF1_1_5_BIT({{139, 13}}); -const double FNAV_AF1_5_LSB = TWO_N38; +constexpr double FNAV_AF1_5_LSB = TWO_N38; const std::vector> FNAV_E5AHS_1_5_BIT({{152, 2}}); const std::vector> FNAV_SVI_D2_5_BIT({{154, 6}}); const std::vector> FNAV_DELTAA12_2_5_BIT({{160, 13}}); diff --git a/src/core/system_parameters/Galileo_E5b.h b/src/core/system_parameters/Galileo_E5b.h index a81e7e748..d39e17a15 100644 --- a/src/core/system_parameters/Galileo_E5b.h +++ b/src/core/system_parameters/Galileo_E5b.h @@ -30,50 +30,50 @@ // Physical constants -const double GALILEO_PI = 3.1415926535898; //!< Pi as defined in GALILEO ICD -const double GALILEO_TWO_PI = 6.283185307179600; //!< 2*Pi as defined in GALILEO ICD -const double GALILEO_GM = 3.986004418e14; //!< Geocentric gravitational constant[m^3/s^2] -const double GALILEO_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Mean angular velocity of the Earth [rad/s] -const double GALILEO_C_M_S = 299792458.0; //!< The speed of light, [m/s] -const double GALILEO_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] -const double GALILEO_F = -4.442807309e-10; //!< Constant, [s/(m)^(1/2)] +constexpr double GALILEO_PI = 3.1415926535898; //!< Pi as defined in GALILEO ICD +constexpr double GALILEO_TWO_PI = 6.283185307179600; //!< 2*Pi as defined in GALILEO ICD +constexpr double GALILEO_GM = 3.986004418e14; //!< Geocentric gravitational constant[m^3/s^2] +constexpr double GALILEO_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Mean angular velocity of the Earth [rad/s] +constexpr double GALILEO_C_M_S = 299792458.0; //!< The speed of light, [m/s] +constexpr double GALILEO_C_M_MS = 299792.4580; //!< The speed of light, [m/ms] +constexpr double GALILEO_F = -4.442807309e-10; //!< Constant, [s/(m)^(1/2)] // Carrier and code frequencies -const double GALILEO_E5B_FREQ_HZ = FREQ7; //!< Galileo E5b carrier frequency [Hz] -const double GALILEO_E5B_CODE_CHIP_RATE_CPS = 1.023e7; //!< Galileo E5b code rate [chips/s] -const double GALILEO_E5B_I_TIERED_CODE_PERIOD_S = 0.004; //!< Galileo E5b-I tiered code period [s] -const double GALILEO_E5B_Q_TIERED_CODE_PERIOD_S = 0.100; //!< Galileo E5b-Q tiered code period [s] -const int32_t GALILEO_E5B_CODE_LENGTH_CHIPS = 10230; //!< Galileo E5b primary code length [chips] -const int32_t GALILEO_E5B_I_SECONDARY_CODE_LENGTH = 4; //!< Galileo E5b-I secondary code length [chips] -const int32_t GALILEO_E5B_Q_SECONDARY_CODE_LENGTH = 100; //!< Galileo E5b-Q secondary code length [chips] -const int32_t GALILEO_E5B_SYMBOL_RATE_BPS = 250; //!< Galileo E5b symbol rate [bits/second] -const int32_t GALILEO_E5B_NUMBER_OF_CODES = 50; +constexpr double GALILEO_E5B_FREQ_HZ = FREQ7; //!< Galileo E5b carrier frequency [Hz] +constexpr double GALILEO_E5B_CODE_CHIP_RATE_CPS = 1.023e7; //!< Galileo E5b code rate [chips/s] +constexpr double GALILEO_E5B_I_TIERED_CODE_PERIOD_S = 0.004; //!< Galileo E5b-I tiered code period [s] +constexpr double GALILEO_E5B_Q_TIERED_CODE_PERIOD_S = 0.100; //!< Galileo E5b-Q tiered code period [s] +constexpr int32_t GALILEO_E5B_CODE_LENGTH_CHIPS = 10230; //!< Galileo E5b primary code length [chips] +constexpr int32_t GALILEO_E5B_I_SECONDARY_CODE_LENGTH = 4; //!< Galileo E5b-I secondary code length [chips] +constexpr int32_t GALILEO_E5B_Q_SECONDARY_CODE_LENGTH = 100; //!< Galileo E5b-Q secondary code length [chips] +constexpr int32_t GALILEO_E5B_SYMBOL_RATE_BPS = 250; //!< Galileo E5b symbol rate [bits/second] +constexpr int32_t GALILEO_E5B_NUMBER_OF_CODES = 50; // OBSERVABLE HISTORY DEEP FOR INTERPOLATION -const int32_t GALILEO_E5B_HISTORY_DEEP = 100; +constexpr int32_t GALILEO_E5B_HISTORY_DEEP = 100; // optimum parameters -const uint32_t GALILEO_E5B_OPT_ACQ_FS_SPS = 10000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate +constexpr uint32_t GALILEO_E5B_OPT_ACQ_FS_SPS = 10000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate // Galileo I/NAV message structure const std::string GALILEO_INAV_PREAMBLE = {"0101100000"}; -const int32_t GALILEO_INAV_PREAMBLE_LENGTH_BITS = 10; -const double GALILEO_INAV_PAGE_PART_WITH_PREABLE_SECONDS = 2.04; //!< Page Duration + (Galileo I/NAV Preamble bits)*(Galileo E5b-I tiered Code Period(seconds)) -const int32_t GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS = 250; -const int32_t GALILEO_INAV_PAGE_PART_SYMBOLS = 250; //!< Each Galileo INAV pages are composed of two parts (even and odd) each of 250 symbols, including preamble. See Galileo ICD 4.3.2 -const int32_t GALILEO_INAV_PAGE_SYMBOLS = 500; //!< The complete Galileo INAV page length -const int32_t GALILEO_INAV_PAGE_PART_SECONDS = 1; // a page part last 1 sec -const int32_t GALILEO_INAV_PAGE_PART_MS = 1000; // a page part last 1 sec -const int32_t GALILEO_INAV_PAGE_SECONDS = 2; // a full page last 2 sec -const int32_t GALILEO_INAV_INTERLEAVER_ROWS = 8; -const int32_t GALILEO_INAV_INTERLEAVER_COLS = 30; -const int32_t GALILEO_TELEMETRY_RATE_BITS_SECOND = 250; // bps -const int32_t GALILEO_PAGE_TYPE_BITS = 6; -const int32_t GALILEO_DATA_JK_BITS = 128; -const int32_t GALILEO_DATA_FRAME_BITS = 196; -const int32_t GALILEO_DATA_FRAME_BYTES = 25; +constexpr int32_t GALILEO_INAV_PREAMBLE_LENGTH_BITS = 10; +constexpr double GALILEO_INAV_PAGE_PART_WITH_PREABLE_SECONDS = 2.04; //!< Page Duration + (Galileo I/NAV Preamble bits)*(Galileo E5b-I tiered Code Period(seconds)) +constexpr int32_t GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS = 250; +constexpr int32_t GALILEO_INAV_PAGE_PART_SYMBOLS = 250; //!< Each Galileo INAV pages are composed of two parts (even and odd) each of 250 symbols, including preamble. See Galileo ICD 4.3.2 +constexpr int32_t GALILEO_INAV_PAGE_SYMBOLS = 500; //!< The complete Galileo INAV page length +constexpr int32_t GALILEO_INAV_PAGE_PART_SECONDS = 1; // a page part last 1 sec +constexpr int32_t GALILEO_INAV_PAGE_PART_MS = 1000; // a page part last 1 sec +constexpr int32_t GALILEO_INAV_PAGE_SECONDS = 2; // a full page last 2 sec +constexpr int32_t GALILEO_INAV_INTERLEAVER_ROWS = 8; +constexpr int32_t GALILEO_INAV_INTERLEAVER_COLS = 30; +constexpr int32_t GALILEO_TELEMETRY_RATE_BITS_SECOND = 250; // bps +constexpr int32_t GALILEO_PAGE_TYPE_BITS = 6; +constexpr int32_t GALILEO_DATA_JK_BITS = 128; +constexpr int32_t GALILEO_DATA_FRAME_BITS = 196; +constexpr int32_t GALILEO_DATA_FRAME_BYTES = 25; const std::vector> TYPE({{1, 6}}); const std::vector> PAGE_TYPE_BIT({{1, 6}}); @@ -87,43 +87,43 @@ const std::vector> TOW_0_BIT({{109, 20}}); /* Page 1 - Word type 1: Ephemeris (1/4) */ const std::vector> IOD_NAV_1_BIT({{7, 10}}); const std::vector> T0_E_1_BIT({{17, 14}}); -const int32_t T0E_1_LSB = 60; +constexpr int32_t T0E_1_LSB = 60; const std::vector> M0_1_BIT({{31, 32}}); -const double M0_1_LSB = PI_TWO_N31; +constexpr double M0_1_LSB = PI_TWO_N31; const std::vector> E_1_BIT({{63, 32}}); -const double E_1_LSB = TWO_N33; +constexpr double E_1_LSB = TWO_N33; const std::vector> A_1_BIT({{95, 32}}); -const double A_1_LSB_GAL = TWO_N19; +constexpr double A_1_LSB_GAL = TWO_N19; // last two bits are reserved /* Page 2 - Word type 2: Ephemeris (2/4) */ const std::vector> IOD_NAV_2_BIT({{7, 10}}); const std::vector> OMEGA_0_2_BIT({{17, 32}}); -const double OMEGA_0_2_LSB = PI_TWO_N31; +constexpr double OMEGA_0_2_LSB = PI_TWO_N31; const std::vector> I_0_2_BIT({{49, 32}}); -const double I_0_2_LSB = PI_TWO_N31; +constexpr double I_0_2_LSB = PI_TWO_N31; const std::vector> OMEGA_2_BIT({{81, 32}}); -const double OMEGA_2_LSB = PI_TWO_N31; +constexpr double OMEGA_2_LSB = PI_TWO_N31; const std::vector> I_DOT_2_BIT({{113, 14}}); -const double I_DOT_2_LSB = PI_TWO_N43; +constexpr double I_DOT_2_LSB = PI_TWO_N43; // last two bits are reserved /* Word type 3: Ephemeris (3/4) and SISA */ const std::vector> IOD_NAV_3_BIT({{7, 10}}); const std::vector> OMEGA_DOT_3_BIT({{17, 24}}); -const double OMEGA_DOT_3_LSB = PI_TWO_N43; +constexpr double OMEGA_DOT_3_LSB = PI_TWO_N43; const std::vector> DELTA_N_3_BIT({{41, 16}}); -const double DELTA_N_3_LSB = PI_TWO_N43; +constexpr double DELTA_N_3_LSB = PI_TWO_N43; const std::vector> C_UC_3_BIT({{57, 16}}); -const double C_UC_3_LSB = TWO_N29; +constexpr double C_UC_3_LSB = TWO_N29; const std::vector> C_US_3_BIT({{73, 16}}); -const double C_US_3_LSB = TWO_N29; +constexpr double C_US_3_LSB = TWO_N29; const std::vector> C_RC_3_BIT({{89, 16}}); -const double C_RC_3_LSB = TWO_N5; +constexpr double C_RC_3_LSB = TWO_N5; const std::vector> C_RS_3_BIT({{105, 16}}); -const double C_RS_3_LSB = TWO_N5; +constexpr double C_RS_3_LSB = TWO_N5; const std::vector> SISA_3_BIT({{121, 8}}); @@ -131,17 +131,17 @@ const std::vector> SISA_3_BIT({{121, 8}}); const std::vector> IOD_NAV_4_BIT({{7, 10}}); const std::vector> SV_ID_PRN_4_BIT({{17, 6}}); const std::vector> C_IC_4_BIT({{23, 16}}); -const double C_IC_4_LSB = TWO_N29; +constexpr double C_IC_4_LSB = TWO_N29; const std::vector> C_IS_4_BIT({{39, 16}}); -const double C_IS_4_LSB = TWO_N29; +constexpr double C_IS_4_LSB = TWO_N29; const std::vector> T0C_4_BIT({{55, 14}}); // -const int32_t T0C_4_LSB = 60; +constexpr int32_t T0C_4_LSB = 60; const std::vector> AF0_4_BIT({{69, 31}}); // -const double AF0_4_LSB = TWO_N34; +constexpr double AF0_4_LSB = TWO_N34; const std::vector> AF1_4_BIT({{100, 21}}); // -const double AF1_4_LSB = TWO_N46; +constexpr double AF1_4_LSB = TWO_N46; const std::vector> AF2_4_BIT({{121, 6}}); -const double AF2_4_LSB = TWO_N59; +constexpr double AF2_4_LSB = TWO_N59; const std::vector> SPARE_4_BIT({{127, 2}}); // last two bits are reserved @@ -150,11 +150,11 @@ const std::vector> SPARE_4_BIT({{127, 2}}); /* Ionospheric correction */ /* Az */ const std::vector> AI0_5_BIT({{7, 11}}); // -const double AI0_5_LSB = TWO_N2; +constexpr double AI0_5_LSB = TWO_N2; const std::vector> AI1_5_BIT({{18, 11}}); // -const double AI1_5_LSB = TWO_N8; +constexpr double AI1_5_LSB = TWO_N8; const std::vector> AI2_5_BIT({{29, 14}}); // -const double AI2_5_LSB = TWO_N15; +constexpr double AI2_5_LSB = TWO_N15; /* Ionospheric disturbance flag */ @@ -164,9 +164,9 @@ const std::vector> REGION3_5_BIT({{45, 1}}); // const std::vector> REGION4_5_BIT({{46, 1}}); // const std::vector> REGION5_5_BIT({{47, 1}}); // const std::vector> BGD_E1_E5A_5_BIT({{48, 10}}); // -const double BGD_E1_E5A_5_LSB = TWO_N32; +constexpr double BGD_E1_E5A_5_LSB = TWO_N32; const std::vector> BGD_E1_E5B_5_BIT({{58, 10}}); // -const double BGD_E1_E5B_5_LSB = TWO_N32; +constexpr double BGD_E1_E5B_5_LSB = TWO_N32; const std::vector> E5B_HS_5_BIT({{68, 2}}); // const std::vector> E1_B_HS_5_BIT({{70, 2}}); // const std::vector> E5B_DVS_5_BIT({{72, 1}}); // @@ -181,12 +181,12 @@ const std::vector> SPARE_5_BIT({{106, 23}}); /* Page 6 */ const std::vector> A0_6_BIT({{7, 32}}); -const double A0_6_LSB = TWO_N30; +constexpr double A0_6_LSB = TWO_N30; const std::vector> A1_6_BIT({{39, 24}}); -const double A1_6_LSB = TWO_N50; +constexpr double A1_6_LSB = TWO_N50; const std::vector> DELTA_T_LS_6_BIT({{63, 8}}); const std::vector> T0T_6_BIT({{71, 8}}); -const int32_t T0T_6_LSB = 3600; +constexpr int32_t T0T_6_LSB = 3600; const std::vector> W_NOT_6_BIT({{79, 8}}); const std::vector> WN_LSF_6_BIT({{87, 8}}); const std::vector> DN_6_BIT({{95, 3}}); @@ -198,91 +198,91 @@ const std::vector> TOW_6_BIT({{106, 20}}); const std::vector> IOD_A_7_BIT({{7, 4}}); const std::vector> WN_A_7_BIT({{11, 2}}); const std::vector> T0A_7_BIT({{13, 10}}); -const int32_t T0A_7_LSB = 600; +constexpr int32_t T0A_7_LSB = 600; const std::vector> SVI_D1_7_BIT({{23, 6}}); const std::vector> DELTA_A_7_BIT({{29, 13}}); -const double DELTA_A_7_LSB = TWO_N9; +constexpr double DELTA_A_7_LSB = TWO_N9; const std::vector> E_7_BIT({{42, 11}}); -const double E_7_LSB = TWO_N16; +constexpr double E_7_LSB = TWO_N16; const std::vector> OMEGA_7_BIT({{53, 16}}); -const double OMEGA_7_LSB = TWO_N15; +constexpr double OMEGA_7_LSB = TWO_N15; const std::vector> DELTA_I_7_BIT({{69, 11}}); -const double DELTA_I_7_LSB = TWO_N14; +constexpr double DELTA_I_7_LSB = TWO_N14; const std::vector> OMEGA0_7_BIT({{80, 16}}); -const double OMEGA0_7_LSB = TWO_N15; +constexpr double OMEGA0_7_LSB = TWO_N15; const std::vector> OMEGA_DOT_7_BIT({{96, 11}}); -const double OMEGA_DOT_7_LSB = TWO_N33; +constexpr double OMEGA_DOT_7_LSB = TWO_N33; const std::vector> M0_7_BIT({{107, 16}}); -const double M0_7_LSB = TWO_N15; +constexpr double M0_7_LSB = TWO_N15; /* Page 8 */ const std::vector> IOD_A_8_BIT({{7, 4}}); const std::vector> AF0_8_BIT({{11, 16}}); -const double AF0_8_LSB = TWO_N19; +constexpr double AF0_8_LSB = TWO_N19; const std::vector> AF1_8_BIT({{27, 13}}); -const double AF1_8_LSB = TWO_N38; +constexpr double AF1_8_LSB = TWO_N38; const std::vector> E5B_HS_8_BIT({{40, 2}}); const std::vector> E1_B_HS_8_BIT({{42, 2}}); const std::vector> SVI_D2_8_BIT({{44, 6}}); const std::vector> DELTA_A_8_BIT({{50, 13}}); -const double DELTA_A_8_LSB = TWO_N9; +constexpr double DELTA_A_8_LSB = TWO_N9; const std::vector> E_8_BIT({{63, 11}}); -const double E_8_LSB = TWO_N16; +constexpr double E_8_LSB = TWO_N16; const std::vector> OMEGA_8_BIT({{74, 16}}); -const double OMEGA_8_LSB = TWO_N15; +constexpr double OMEGA_8_LSB = TWO_N15; const std::vector> DELTA_I_8_BIT({{90, 11}}); -const double DELTA_I_8_LSB = TWO_N14; +constexpr double DELTA_I_8_LSB = TWO_N14; const std::vector> OMEGA0_8_BIT({{101, 16}}); -const double OMEGA0_8_LSB = TWO_N15; +constexpr double OMEGA0_8_LSB = TWO_N15; const std::vector> OMEGA_DOT_8_BIT({{117, 11}}); -const double OMEGA_DOT_8_LSB = TWO_N33; +constexpr double OMEGA_DOT_8_LSB = TWO_N33; /* Page 9 */ const std::vector> IOD_A_9_BIT({{7, 4}}); const std::vector> WN_A_9_BIT({{11, 2}}); const std::vector> T0A_9_BIT({{13, 10}}); -const int32_t T0A_9_LSB = 600; +constexpr int32_t T0A_9_LSB = 600; const std::vector> M0_9_BIT({{23, 16}}); -const double M0_9_LSB = TWO_N15; +constexpr double M0_9_LSB = TWO_N15; const std::vector> AF0_9_BIT({{39, 16}}); -const double AF0_9_LSB = TWO_N19; +constexpr double AF0_9_LSB = TWO_N19; const std::vector> AF1_9_BIT({{55, 13}}); -const double AF1_9_LSB = TWO_N38; +constexpr double AF1_9_LSB = TWO_N38; const std::vector> E5B_HS_9_BIT({{68, 2}}); const std::vector> E1_B_HS_9_BIT({{70, 2}}); const std::vector> SVI_D3_9_BIT({{72, 6}}); const std::vector> DELTA_A_9_BIT({{78, 13}}); -const double DELTA_A_9_LSB = TWO_N9; +constexpr double DELTA_A_9_LSB = TWO_N9; const std::vector> E_9_BIT({{91, 11}}); -const double E_9_LSB = TWO_N16; +constexpr double E_9_LSB = TWO_N16; const std::vector> OMEGA_9_BIT({{102, 16}}); -const double OMEGA_9_LSB = TWO_N15; +constexpr double OMEGA_9_LSB = TWO_N15; const std::vector> DELTA_I_9_BIT({{118, 11}}); -const double DELTA_I_9_LSB = TWO_N14; +constexpr double DELTA_I_9_LSB = TWO_N14; /* Page 10 */ const std::vector> IOD_A_10_BIT({{7, 4}}); const std::vector> OMEGA0_10_BIT({{11, 16}}); -const double OMEGA0_10_LSB = TWO_N15; +constexpr double OMEGA0_10_LSB = TWO_N15; const std::vector> OMEGA_DOT_10_BIT({{27, 11}}); -const double OMEGA_DOT_10_LSB = TWO_N33; +constexpr double OMEGA_DOT_10_LSB = TWO_N33; const std::vector> M0_10_BIT({{38, 16}}); -const double M0_10_LSB = TWO_N15; +constexpr double M0_10_LSB = TWO_N15; const std::vector> AF0_10_BIT({{54, 16}}); -const double AF0_10_LSB = TWO_N19; +constexpr double AF0_10_LSB = TWO_N19; const std::vector> AF1_10_BIT({{70, 13}}); -const double AF1_10_LSB = TWO_N38; +constexpr double AF1_10_LSB = TWO_N38; const std::vector> E5B_HS_10_BIT({{83, 2}}); const std::vector> E1_B_HS_10_BIT({{85, 2}}); const std::vector> A_0_G_10_BIT({{87, 16}}); -const double A_0G_10_LSB = TWO_N35; +constexpr double A_0G_10_LSB = TWO_N35; const std::vector> A_1_G_10_BIT({{103, 12}}); -const double A_1G_10_LSB = TWO_N51; +constexpr double A_1G_10_LSB = TWO_N51; const std::vector> T_0_G_10_BIT({{115, 8}}); -const int32_t T_0_G_10_LSB = 3600; +constexpr int32_t T_0_G_10_LSB = 3600; const std::vector> WN_0_G_10_BIT({{123, 6}}); diff --git a/src/core/system_parameters/MATH_CONSTANTS.h b/src/core/system_parameters/MATH_CONSTANTS.h index 4089bdca8..9be2d44ed 100644 --- a/src/core/system_parameters/MATH_CONSTANTS.h +++ b/src/core/system_parameters/MATH_CONSTANTS.h @@ -32,80 +32,79 @@ ONE_PI_TWO_PX = (1/Pi)*2^X */ -const double HALF_PI = 1.570796326794897; //!< pi/2 -const double PI = 3.1415926535897932; //!< pi -const double PI_2 = 2.0 * PI; //!< 2 * pi +constexpr double HALF_PI = 1.570796326794897; //!< pi/2 +constexpr double PI = 3.1415926535897932; //!< pi +constexpr double PI_2 = 2.0 * PI; //!< 2 * pi -const double TWO_P3 = (8); //!< 2^3 -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 +constexpr double TWO_P3 = (8); //!< 2^3 +constexpr double TWO_P4 = (16); //!< 2^4 +constexpr double TWO_P11 = (2048); //!< 2^11 +constexpr double TWO_P12 = (4096); //!< 2^12 +constexpr double TWO_P14 = (16384); //!< 2^14 +constexpr double TWO_P16 = (65536); //!< 2^16 +constexpr double TWO_P19 = (524288); //!< 2^19 +constexpr double TWO_P31 = (2147483648.0); //!< 2^31 +constexpr double TWO_P32 = (4294967296.0); //!< 2^32 this is too big for an int so add the x.0 +constexpr double TWO_P56 = (7.205759403792794e+016); //!< 2^56 +constexpr double TWO_P57 = (1.441151880758559e+017); //!< 2^57 -const double TWO_N2 = (0.25); //!< 2^-2 -const double TWO_N5 = (0.03125); //!< 2^-5 -const double TWO_N6 = (0.015625); //!< 2^-6 -const double TWO_N8 = (0.00390625); //!< 2^-8 -const double TWO_N9 = (0.001953125); //!< 2^-9 -const double TWO_N10 = (0.0009765625); //!< 2^-10 -const double TWO_N11 = (4.882812500000000e-004); //!< 2^-11 -const double TWO_N14 = (0.00006103515625); //!< 2^-14 -const double TWO_N15 = (0.00003051757813); //!< 2^-15 -const double TWO_N16 = (0.0000152587890625); //!< 2^-16 -const double TWO_N17 = (7.629394531250000e-006); //!< 2^-17 -const double TWO_N18 = (3.814697265625000e-006); //!< 2^-18 -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_N23 = (1.192092895507810e-007); //!< 2^-23 -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_N34 = (5.82076609134674e-011); //!< 2^-34 -const double TWO_N35 = (2.91038304567337e-011); //!< 2^-35 -const double TWO_N38 = (3.637978807091713e-012); //!< 2^-38 -const double TWO_N39 = (1.818989403545856e-012); //!< 2^-39 -const double TWO_N40 = (9.094947017729280e-013); //!< 2^-40 -const double TWO_N43 = (1.136868377216160e-013); //!< 2^-43 -const double TWO_N44 = (5.684341886080802e-14); //!< 2^-44 -const double TWO_N46 = (1.4210854715202e-014); //!< 2^-46 -const double TWO_N48 = (3.552713678800501e-15); //!< 2^-46 +constexpr double TWO_N2 = (0.25); //!< 2^-2 +constexpr double TWO_N5 = (0.03125); //!< 2^-5 +constexpr double TWO_N6 = (0.015625); //!< 2^-6 +constexpr double TWO_N8 = (0.00390625); //!< 2^-8 +constexpr double TWO_N9 = (0.001953125); //!< 2^-9 +constexpr double TWO_N10 = (0.0009765625); //!< 2^-10 +constexpr double TWO_N11 = (4.882812500000000e-004); //!< 2^-11 +constexpr double TWO_N14 = (0.00006103515625); //!< 2^-14 +constexpr double TWO_N15 = (0.00003051757813); //!< 2^-15 +constexpr double TWO_N16 = (0.0000152587890625); //!< 2^-16 +constexpr double TWO_N17 = (7.629394531250000e-006); //!< 2^-17 +constexpr double TWO_N18 = (3.814697265625000e-006); //!< 2^-18 +constexpr double TWO_N19 = (1.907348632812500e-006); //!< 2^-19 +constexpr double TWO_N20 = (9.536743164062500e-007); //!< 2^-20 +constexpr double TWO_N21 = (4.768371582031250e-007); //!< 2^-21 +constexpr double TWO_N23 = (1.192092895507810e-007); //!< 2^-23 +constexpr double TWO_N24 = (5.960464477539063e-008); //!< 2^-24 +constexpr double TWO_N25 = (2.980232238769531e-008); //!< 2^-25 +constexpr double TWO_N27 = (7.450580596923828e-009); //!< 2^-27 +constexpr double TWO_N29 = (1.862645149230957e-009); //!< 2^-29 +constexpr double TWO_N30 = (9.313225746154785e-010); //!< 2^-30 +constexpr double TWO_N31 = (4.656612873077393e-010); //!< 2^-31 +constexpr double TWO_N32 = (2.328306436538696e-010); //!< 2^-32 +constexpr double TWO_N33 = (1.164153218269348e-010); //!< 2^-33 +constexpr double TWO_N34 = (5.82076609134674e-011); //!< 2^-34 +constexpr double TWO_N35 = (2.91038304567337e-011); //!< 2^-35 +constexpr double TWO_N38 = (3.637978807091713e-012); //!< 2^-38 +constexpr double TWO_N39 = (1.818989403545856e-012); //!< 2^-39 +constexpr double TWO_N40 = (9.094947017729280e-013); //!< 2^-40 +constexpr double TWO_N43 = (1.136868377216160e-013); //!< 2^-43 +constexpr double TWO_N44 = (5.684341886080802e-14); //!< 2^-44 +constexpr double TWO_N46 = (1.4210854715202e-014); //!< 2^-46 +constexpr double TWO_N48 = (3.552713678800501e-15); //!< 2^-46 -const double TWO_N50 = (8.881784197001252e-016); //!< 2^-50 -const double TWO_N51 = (4.44089209850063e-016); //!< 2^-51 -const double TWO_N55 = (2.775557561562891e-017); //!< 2^-55 -const double TWO_N57 = (6.938893903907228e-18); //!< 2^-57 -const double TWO_N59 = (1.73472347597681e-018); //!< 2^-59 -const double TWO_N60 = (8.673617379884036e-19); //!< 2^-60 -const double TWO_N66 = (1.3552527156068805425093160010874271392822265625e-20); //!< 2^-66 -const double TWO_N68 = (3.388131789017201e-21); //!< 2^-68 +constexpr double TWO_N50 = (8.881784197001252e-016); //!< 2^-50 +constexpr double TWO_N51 = (4.44089209850063e-016); //!< 2^-51 +constexpr double TWO_N55 = (2.775557561562891e-017); //!< 2^-55 +constexpr double TWO_N57 = (6.938893903907228e-18); //!< 2^-57 +constexpr double TWO_N59 = (1.73472347597681e-018); //!< 2^-59 +constexpr double TWO_N60 = (8.673617379884036e-19); //!< 2^-60 +constexpr double TWO_N66 = (1.3552527156068805425093160010874271392822265625e-20); //!< 2^-66 +constexpr double TWO_N68 = (3.388131789017201e-21); //!< 2^-68 +constexpr double PI_TWO_N19 = (5.992112452678286e-006); //!< Pi*2^-19 +constexpr double PI_TWO_N43 = (3.571577341960839e-013); //!< Pi*2^-43 +constexpr double PI_TWO_N31 = (1.462918079267160e-009); //!< Pi*2^-31 +constexpr double PI_TWO_N38 = (1.142904749427469e-011); //!< Pi*2^-38 +constexpr 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 +constexpr double D2R = (PI / 180.0); //!< deg to rad +constexpr double R2D = (180.0 / PI); //!< rad to deg +constexpr double SC2RAD = 3.1415926535898; //!< semi-circle to radian (IS-GPS) +constexpr double AS2R = (D2R / 3600.0); //!< arc sec to radian -const double D2R = (PI / 180.0); //!< deg to rad -const double R2D = (180.0 / PI); //!< rad to deg -const double SC2RAD = 3.1415926535898; //!< semi-circle to radian (IS-GPS) -const double AS2R = (D2R / 3600.0); //!< arc sec to radian - -const double DEFAULT_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Default Earth rotation rate, [rad/s] -const double SPEED_OF_LIGHT = 299792458.0; //!< [m/s] -const double SPEED_OF_LIGHT_MS = 299792.4580; //!< [m/ms] -const double AU = 149597870691.0; //!< 1 Astronomical Unit AU (m) distance from Earth to the Sun. +constexpr double DEFAULT_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Default Earth rotation rate, [rad/s] +constexpr double SPEED_OF_LIGHT = 299792458.0; //!< [m/s] +constexpr double SPEED_OF_LIGHT_MS = 299792.4580; //!< [m/ms] +constexpr double AU = 149597870691.0; //!< 1 Astronomical Unit AU (m) distance from Earth to the Sun. #endif // GNSS_SDR_MATH_CONSTANTS_H diff --git a/src/core/system_parameters/gnss_frequencies.h b/src/core/system_parameters/gnss_frequencies.h index cc1eae123..781f39657 100644 --- a/src/core/system_parameters/gnss_frequencies.h +++ b/src/core/system_parameters/gnss_frequencies.h @@ -22,20 +22,20 @@ #ifndef GNSS_SDR_GNSS_FREQUENCIES_H #define GNSS_SDR_GNSS_FREQUENCIES_H -const double FREQ1 = 1.57542e9; //!< L1/E1 frequency (Hz) -const double FREQ2 = 1.22760e9; //!< L2 frequency (Hz) -const double FREQ5 = 1.17645e9; //!< L5/E5a frequency (Hz) -const double FREQ6 = 1.27875e9; //!< E6/LEX frequency (Hz) -const double FREQ7 = 1.20714e9; //!< E5b frequency (Hz) -const double FREQ8 = 1.191795e9; //!< E5a+b frequency (Hz) -const double FREQ9 = 2.492028e9; //!< S frequency (Hz) -const double FREQ1_GLO = 1.60200e9; //!< GLONASS G1 base frequency (Hz) -const double DFRQ1_GLO = 0.56250e6; //!< GLONASS G1 bias frequency (Hz/n) -const double FREQ2_GLO = 1.24600e9; //!< GLONASS G2 base frequency (Hz) -const double DFRQ2_GLO = 0.43750e6; //!< GLONASS G2 bias frequency (Hz/n) -const double FREQ3_GLO = 1.202025e9; //!< GLONASS G3 frequency (Hz) -const double FREQ1_BDS = 1.561098e9; //!< BeiDou B1 frequency (Hz) -const double FREQ2_BDS = 1.20714e9; //!< BeiDou B2 frequency (Hz) -const double FREQ3_BDS = 1.26852e9; //!< BeiDou B3 frequency (Hz) +constexpr double FREQ1 = 1.57542e9; //!< L1/E1 frequency (Hz) +constexpr double FREQ2 = 1.22760e9; //!< L2 frequency (Hz) +constexpr double FREQ5 = 1.17645e9; //!< L5/E5a frequency (Hz) +constexpr double FREQ6 = 1.27875e9; //!< E6/LEX frequency (Hz) +constexpr double FREQ7 = 1.20714e9; //!< E5b frequency (Hz) +constexpr double FREQ8 = 1.191795e9; //!< E5a+b frequency (Hz) +constexpr double FREQ9 = 2.492028e9; //!< S frequency (Hz) +constexpr double FREQ1_GLO = 1.60200e9; //!< GLONASS G1 base frequency (Hz) +constexpr double DFRQ1_GLO = 0.56250e6; //!< GLONASS G1 bias frequency (Hz/n) +constexpr double FREQ2_GLO = 1.24600e9; //!< GLONASS G2 base frequency (Hz) +constexpr double DFRQ2_GLO = 0.43750e6; //!< GLONASS G2 bias frequency (Hz/n) +constexpr double FREQ3_GLO = 1.202025e9; //!< GLONASS G3 frequency (Hz) +constexpr double FREQ1_BDS = 1.561098e9; //!< BeiDou B1 frequency (Hz) +constexpr double FREQ2_BDS = 1.20714e9; //!< BeiDou B2 frequency (Hz) +constexpr double FREQ3_BDS = 1.26852e9; //!< BeiDou B3 frequency (Hz) #endif diff --git a/src/core/system_parameters/gnss_obs_codes.h b/src/core/system_parameters/gnss_obs_codes.h index be765a03e..689b7ab06 100644 --- a/src/core/system_parameters/gnss_obs_codes.h +++ b/src/core/system_parameters/gnss_obs_codes.h @@ -24,63 +24,63 @@ #include -const uint32_t CODE_NONE = 0; //!< obs code: none or unknown -const uint32_t CODE_L1C = 1; //!< obs code: L1C/A,G1C/A,E1C (GPS,GLO,GAL,QZS,SBS) -const uint32_t CODE_L1P = 2; //!< obs code: L1P,G1P (GPS,GLO) -const uint32_t CODE_L1W = 3; //!< obs code: L1 Z-track (GPS) -const uint32_t CODE_L1Y = 4; //!< obs code: L1Y (GPS) -const uint32_t CODE_L1M = 5; //!< obs code: L1M (GPS) -const uint32_t CODE_L1N = 6; //!< obs code: L1codeless (GPS) -const uint32_t CODE_L1S = 7; //!< obs code: L1C(D) (GPS,QZS) -const uint32_t CODE_L1L = 8; //!< obs code: L1C(P) (GPS,QZS) -const uint32_t CODE_L1E = 9; //!< (not used) -const uint32_t CODE_L1A = 10; //!< obs code: E1A (GAL) -const uint32_t CODE_L1B = 11; //!< obs code: E1B (GAL) -const uint32_t CODE_L1X = 12; //!< obs code: E1B+C,L1C(D+P) (GAL,QZS) -const uint32_t CODE_L1Z = 13; //!< obs code: E1A+B+C,L1SAIF (GAL,QZS) -const uint32_t CODE_L2C = 14; //!< obs code: L2C/A,G1C/A (GPS,GLO) -const uint32_t CODE_L2D = 15; //!< obs code: L2 L1C/A-(P2-P1) (GPS) -const uint32_t CODE_L2S = 16; //!< obs code: L2C(M) (GPS,QZS) -const uint32_t CODE_L2L = 17; //!< obs code: L2C(L) (GPS,QZS) -const uint32_t CODE_L2X = 18; //!< obs code: L2C(M+L),B1I+Q (GPS,QZS,BDS) -const uint32_t CODE_L2P = 19; //!< obs code: L2P,G2P (GPS,GLO) -const uint32_t CODE_L2W = 20; //!< obs code: L2 Z-track (GPS) -const uint32_t CODE_L2Y = 21; //!< obs code: L2Y (GPS) -const uint32_t CODE_L2M = 22; //!< obs code: L2M (GPS) -const uint32_t CODE_L2N = 23; //!< obs code: L2codeless (GPS) -const uint32_t CODE_L5I = 24; //!< obs code: L5/E5aI (GPS,GAL,QZS,SBS) -const uint32_t CODE_L5Q = 25; //!< obs code: L5/E5aQ (GPS,GAL,QZS,SBS) -const uint32_t CODE_L5X = 26; //!< obs code: L5/E5aI+Q/L5B+C (GPS,GAL,QZS,IRN,SBS) -const uint32_t CODE_L7I = 27; //!< obs code: E5bI,B2I (GAL,BDS) -const uint32_t CODE_L7Q = 28; //!< obs code: E5bQ,B2Q (GAL,BDS) -const uint32_t CODE_L7X = 29; //!< obs code: E5bI+Q,B2I+Q (GAL,BDS) -const uint32_t CODE_L6A = 30; //!< obs code: E6A (GAL) -const uint32_t CODE_L6B = 31; //!< obs code: E6B (GAL) -const uint32_t CODE_L6C = 32; //!< obs code: E6C (GAL) -const uint32_t CODE_L6X = 33; //!< obs code: E6B+C,LEXS+L,B3I+Q (GAL,QZS,BDS) -const uint32_t CODE_L6Z = 34; //!< obs code: E6A+B+C (GAL) -const uint32_t CODE_L6S = 35; //!< obs code: LEXS (QZS) -const uint32_t CODE_L6L = 36; //!< obs code: LEXL (QZS) -const uint32_t CODE_L8I = 37; //!< obs code: E5(a+b)I (GAL) -const uint32_t CODE_L8Q = 38; //!< obs code: E5(a+b)Q (GAL) -const uint32_t CODE_L8X = 39; //!< obs code: E5(a+b)I+Q (GAL) -const uint32_t CODE_L2I = 40; //!< obs code: B1I (BDS) -const uint32_t CODE_L2Q = 41; //!< obs code: B1Q (BDS) -const uint32_t CODE_L6I = 42; //!< obs code: B3I (BDS) -const uint32_t CODE_L6Q = 43; //!< obs code: B3Q (BDS) -const uint32_t CODE_L3I = 44; //!< obs code: G3I (GLO) -const uint32_t CODE_L3Q = 45; //!< obs code: G3Q (GLO) -const uint32_t CODE_L3X = 46; //!< obs code: G3I+Q (GLO) -const uint32_t CODE_L1I = 47; //!< obs code: B1I (BDS) -const uint32_t CODE_L1Q = 48; //!< obs code: B1Q (BDS) -const uint32_t CODE_L5A = 49; //!< obs code: L5A SPS (IRN) -const uint32_t CODE_L5B = 50; //!< obs code: L5B RS(D) (IRN) -const uint32_t CODE_L5C = 51; //!< obs code: L5C RS(P) (IRN) -const uint32_t CODE_L9A = 52; //!< obs code: SA SPS (IRN) -const uint32_t CODE_L9B = 53; //!< obs code: SB RS(D) (IRN) -const uint32_t CODE_L9C = 54; //!< obs code: SC RS(P) (IRN) -const uint32_t CODE_L9X = 55; //!< obs code: SB+C (IRN) -const int32_t MAXCODE = 55; //!< max number of obs code +constexpr uint32_t CODE_NONE = 0; //!< obs code: none or unknown +constexpr uint32_t CODE_L1C = 1; //!< obs code: L1C/A,G1C/A,E1C (GPS,GLO,GAL,QZS,SBS) +constexpr uint32_t CODE_L1P = 2; //!< obs code: L1P,G1P (GPS,GLO) +constexpr uint32_t CODE_L1W = 3; //!< obs code: L1 Z-track (GPS) +constexpr uint32_t CODE_L1Y = 4; //!< obs code: L1Y (GPS) +constexpr uint32_t CODE_L1M = 5; //!< obs code: L1M (GPS) +constexpr uint32_t CODE_L1N = 6; //!< obs code: L1codeless (GPS) +constexpr uint32_t CODE_L1S = 7; //!< obs code: L1C(D) (GPS,QZS) +constexpr uint32_t CODE_L1L = 8; //!< obs code: L1C(P) (GPS,QZS) +constexpr uint32_t CODE_L1E = 9; //!< (not used) +constexpr uint32_t CODE_L1A = 10; //!< obs code: E1A (GAL) +constexpr uint32_t CODE_L1B = 11; //!< obs code: E1B (GAL) +constexpr uint32_t CODE_L1X = 12; //!< obs code: E1B+C,L1C(D+P) (GAL,QZS) +constexpr uint32_t CODE_L1Z = 13; //!< obs code: E1A+B+C,L1SAIF (GAL,QZS) +constexpr uint32_t CODE_L2C = 14; //!< obs code: L2C/A,G1C/A (GPS,GLO) +constexpr uint32_t CODE_L2D = 15; //!< obs code: L2 L1C/A-(P2-P1) (GPS) +constexpr uint32_t CODE_L2S = 16; //!< obs code: L2C(M) (GPS,QZS) +constexpr uint32_t CODE_L2L = 17; //!< obs code: L2C(L) (GPS,QZS) +constexpr uint32_t CODE_L2X = 18; //!< obs code: L2C(M+L),B1I+Q (GPS,QZS,BDS) +constexpr uint32_t CODE_L2P = 19; //!< obs code: L2P,G2P (GPS,GLO) +constexpr uint32_t CODE_L2W = 20; //!< obs code: L2 Z-track (GPS) +constexpr uint32_t CODE_L2Y = 21; //!< obs code: L2Y (GPS) +constexpr uint32_t CODE_L2M = 22; //!< obs code: L2M (GPS) +constexpr uint32_t CODE_L2N = 23; //!< obs code: L2codeless (GPS) +constexpr uint32_t CODE_L5I = 24; //!< obs code: L5/E5aI (GPS,GAL,QZS,SBS) +constexpr uint32_t CODE_L5Q = 25; //!< obs code: L5/E5aQ (GPS,GAL,QZS,SBS) +constexpr uint32_t CODE_L5X = 26; //!< obs code: L5/E5aI+Q/L5B+C (GPS,GAL,QZS,IRN,SBS) +constexpr uint32_t CODE_L7I = 27; //!< obs code: E5bI,B2I (GAL,BDS) +constexpr uint32_t CODE_L7Q = 28; //!< obs code: E5bQ,B2Q (GAL,BDS) +constexpr uint32_t CODE_L7X = 29; //!< obs code: E5bI+Q,B2I+Q (GAL,BDS) +constexpr uint32_t CODE_L6A = 30; //!< obs code: E6A (GAL) +constexpr uint32_t CODE_L6B = 31; //!< obs code: E6B (GAL) +constexpr uint32_t CODE_L6C = 32; //!< obs code: E6C (GAL) +constexpr uint32_t CODE_L6X = 33; //!< obs code: E6B+C,LEXS+L,B3I+Q (GAL,QZS,BDS) +constexpr uint32_t CODE_L6Z = 34; //!< obs code: E6A+B+C (GAL) +constexpr uint32_t CODE_L6S = 35; //!< obs code: LEXS (QZS) +constexpr uint32_t CODE_L6L = 36; //!< obs code: LEXL (QZS) +constexpr uint32_t CODE_L8I = 37; //!< obs code: E5(a+b)I (GAL) +constexpr uint32_t CODE_L8Q = 38; //!< obs code: E5(a+b)Q (GAL) +constexpr uint32_t CODE_L8X = 39; //!< obs code: E5(a+b)I+Q (GAL) +constexpr uint32_t CODE_L2I = 40; //!< obs code: B1I (BDS) +constexpr uint32_t CODE_L2Q = 41; //!< obs code: B1Q (BDS) +constexpr uint32_t CODE_L6I = 42; //!< obs code: B3I (BDS) +constexpr uint32_t CODE_L6Q = 43; //!< obs code: B3Q (BDS) +constexpr uint32_t CODE_L3I = 44; //!< obs code: G3I (GLO) +constexpr uint32_t CODE_L3Q = 45; //!< obs code: G3Q (GLO) +constexpr uint32_t CODE_L3X = 46; //!< obs code: G3I+Q (GLO) +constexpr uint32_t CODE_L1I = 47; //!< obs code: B1I (BDS) +constexpr uint32_t CODE_L1Q = 48; //!< obs code: B1Q (BDS) +constexpr uint32_t CODE_L5A = 49; //!< obs code: L5A SPS (IRN) +constexpr uint32_t CODE_L5B = 50; //!< obs code: L5B RS(D) (IRN) +constexpr uint32_t CODE_L5C = 51; //!< obs code: L5C RS(P) (IRN) +constexpr uint32_t CODE_L9A = 52; //!< obs code: SA SPS (IRN) +constexpr uint32_t CODE_L9B = 53; //!< obs code: SB RS(D) (IRN) +constexpr uint32_t CODE_L9C = 54; //!< obs code: SC RS(P) (IRN) +constexpr uint32_t CODE_L9X = 55; //!< obs code: SB+C (IRN) +constexpr int32_t MAXCODE = 55; //!< max number of obs code #endif