From 01dd425e58c77e448e3edaf9226bafa97d9a74f8 Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Tue, 30 Jul 2013 16:40:20 +0000 Subject: [PATCH] Mara Branzanti contribution for Google Summer of Code (GSoC 2013) - Galileo Telemetry page decoder - Galileo Ephemeris and almanac decoder (still experimental!) git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@399 64b25241-fba3-4117-9849-534c7e92360d --- README | 5 + .../galileo_e1b_telemetry_decoder_cc.cc | 98 +- .../galileo_e1b_telemetry_decoder_cc.h | 2 + src/core/system_parameters/Galileo_E1.h | 213 +++- src/core/system_parameters/MATH_CONSTANTS.h | 14 + .../galileo_navigation_message.cc | 1007 ++++++++++------- .../galileo_navigation_message.h | 165 ++- .../gps_navigation_message.h | 2 +- 8 files changed, 987 insertions(+), 519 deletions(-) diff --git a/README b/README index 25735d328..d71af80fd 100644 --- a/README +++ b/README @@ -215,6 +215,11 @@ By default, CMake will build the Release version, meaning that the compiler will $ cd gnss-sdr/build $ cmake -DCMAKE_BUILD_TYPE=Debug ../ + +for eclipse +cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DECLIPSE_CDT4_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_VERSION=3.7 -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8 ../ + + $ make $ make install diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc index b8fc4bb6c..4d165fa6a 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc @@ -229,8 +229,8 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector if (abs(preamble_diff - GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS) < 1) { - //std::cout<<"d_sample_counter="<0) -// { -// std::cout<<",1"; -// }else{ -// std::cout<<",0"; -// } -// } -// std::cout<<"]"<0) -// { -// std::cout<<",1"; -// }else{ -// std::cout<<",0"; -// } -// } -// std::cout<<"]"<0) -// { -// std::cout<<",1"; -// }else{ -// std::cout<<",0"; -// } -// } -// std::cout<<"]"<0) + { + page_String.push_back('1'); + //std::cout<<",1"; + }else{ + page_String.push_back('0'); + //std::cout<<",0"; + } + + //sprintf(&page_String[i], "%d", page_part_bits[i]); // this produces a memory core dumped... + } + //std::cout<<"]"<> type({{1,6}}); +const std::vector> PAGE_TYPE_bit({{1,6}});; + +/*Page 1 - Word type 1: Ephemeris (1/4)*/ +const std::vector> IOD_nav_1_bit({{7,10}}); +const std::vector> T0E_1_bit({{17,14}}); +const double t0e_1_LSB = 60; +const std::vector> M0_1_bit({{31,32}}); +const double M0_1_LSB = TWO_N31; +const std::vector> e_1_bit({{63,32}}); +const double e_1_LSB = TWO_N33; +const std::vector> A_1_bit({{95,32}}); +const 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 = TWO_N31; +const std::vector> i_0_2_bit({{49,32}}); +const double i_0_2_LSB = TWO_N31; +const std::vector> omega_2_bit({{81,32}}); +const double omega_2_LSB = TWO_N31; +const std::vector> iDot_2_bit({{113,14}}); +const double iDot_2_LSB = 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 = TWO_N43; +const std::vector> delta_n_3_bit({{41,16}}); +const double delta_n_3_LSB = TWO_N43; +const std::vector> C_uc_3_bit({{57,16}}); +const double C_uc_3_LSB = TWO_N29; +const std::vector> C_us_3_bit({{73,16}}); +const double C_us_3_LSB = TWO_N29; +const std::vector> C_rc_3_bit({{89,16}}); +const double C_rc_3_LSB = TWO_N5; +const std::vector> C_rs_3_bit({{105,16}}); +const double C_rs_3_LSB = TWO_N5; +const std::vector> SISA_3_bit({{121,8}}); + + +/*Word type 4: Ephemeris (4/4) and Clock correction parameters*/ +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; +const std::vector> C_is_4_bit({{39,16}}); +const double C_is_4_LSB = TWO_N29; +const std::vector> t0c_4_bit({{55,14}}); // +const double t0c_4_LSB = 60; +const std::vector> af0_4_bit({{69,31}}); // +const double af0_4_LSB = TWO_N34; +const std::vector> af1_4_bit({{100,21}}); // +const double af1_4_LSB = TWO_N46; +const std::vector> af2_4_bit({{121,6}}); +const double af2_4_LSB = TWO_N59; +const std::vector> spare_4_bit({{121,6}}); +//last two bits are reserved + + +/*Word type 5: Ionospheric correction, BGD, signal health and data validity status and GST*/ +/*Ionospheric correction*/ +/*Az*/ +const std::vector> ai0_5_bit({{7,11}}); // +const double ai0_5_LSB = TWO_N2; +const std::vector> ai1_5_bit({{18,11}}); // +const double ai1_5_LSB = TWO_N8; +const std::vector> ai2_5_bit({{29,14}}); // +const 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}}); // +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_E1E5a_5_bit({{48,10}}); // +const double BGD_E1E5a_5_LSB = TWO_N32; +const std::vector> BGD_E1E5b_5_bit({{58,10}}); // +const double BGD_E1E5b_5_LSB = TWO_N35; +const std::vector> E5b_HS_5_bit({{68,2}}); // +const std::vector> E1B_HS_5_bit({{70,2}}); // +const std::vector> E5b_DVS_5_bit({{72,1}}); // +const std::vector> E1B_DVS_5_bit({{73,1}}); // +/*GST*/ +const std::vector> WN_5_bit({{74,12}}); +const std::vector> TOW_5_bit({{86,20}}); +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; +const std::vector> A1_6_bit({{39,24}}); +const double A1_6_LSB = TWO_N50; +const std::vector> Delta_tLS_6_bit({{63,8}}); +const std::vector> t0t_6_bit({{71,8}}); +const double t0t_6_LSB = 3600; +const std::vector> WNot_6_bit({{79,8}}); +const std::vector> WN_LSF_6_bit({{86,8}}); +const std::vector> DN_6_bit({{95,3}}); +const std::vector> Delta_tLSF_6_bit({{97,8}}); +const std::vector> TOW_6_bit({{106,20}}); + +/* Page 7 */ +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 double t0a_7_LSB = 600; +const std::vector>SVID1_7_bit({{23,6}}); +const std::vector>Delta_alpha_7_bit({{29,13}}); +const double Delta_alpha_7_LSB = TWO_N9; +const std::vector>e_7_bit({{42,11}}); +const double e_7_LSB = TWO_N16; +const std::vector>omega_7_bit({{53,16}}); +const double omega_7_LSB = TWO_N15; +const std::vector>delta_i_7_bit({{69,11}}); +const double delta_i_7_LSB = TWO_N14; +const std::vector>Omega0_7_bit({{80,16}}); +const double Omega0_7_LSB = TWO_N15; +const std::vector>Omega_dot_7_bit({{96,11}}); +const double Omega_dot_7_LSB = TWO_N33; +const std::vector>M0_7_bit({{107,16}}); +const 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; +const std::vector>af1_8_bit({{27,13}}); +const double af1_8_LSB = TWO_N38; +const std::vector>E5b_HS_8_bit({{40,2}}); +const std::vector>E1B_HS_8_bit({{42,2}}); +const std::vector>SVID2_8_bit({{44,6}}); +const std::vector>DELTA_A_8_bit({{50,13}}); +const double DELTA_A_8_LSB = TWO_N9; +const std::vector>e_8_bit({{63,11}}); +const double e_8_LSB = TWO_N16; +const std::vector>omega_8_bit({{74,16}}); +const double omega_8_LSB = TWO_N15; +const std::vector>delta_i_8_bit({{90,11}}); +const double delta_i_8_LSB = TWO_N14; +const std::vector>Omega0_8_bit({{101,16}}); +const double Omega0_8_LSB = TWO_N15; +const std::vector>Omega_dot_8_bit({{117,11}}); +const 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 double t0a_9_LSB = 600; +const std::vector>M0_9_bit({{23,16}}); +const double M0_9_LSB = TWO_N15; +const std::vector>af0_9_bit({{39,16}}); +const double af0_9_LSB = TWO_N19; +const std::vector>af1_9_bit({{54,13}}); +const double af1_9_LSB = TWO_N38; +const std::vector>E5b_HS_9_bit({{68,2}}); +const std::vector>E1B_HS_9_bit({{70,2}}); +const std::vector>SVID3_9_bit({{72,6}}); +const std::vector>DELTA_A_9_bit({{78,13}}); +const double DELTA_A_9_LSB = TWO_N9; +const std::vector>e_9_bit({{91,11}}); +const double e_9_LSB = TWO_N16; +const std::vector>omega_9_bit({{102,16}}); +const double omega_9_LSB = TWO_N15; +const std::vector>delta_i_9_bit({{118,11}}); +const 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; +const std::vector>Omega_dot_10_bit({{27,11}}); +const double Omega_dot_10_LSB = TWO_N33; +const std::vector>M0_10_bit({{38,16}}); +const double M0_10_LSB = TWO_N15; +const std::vector>af0_10_bit({{54,16}}); +const double af0_10_LSB = TWO_N19; +const std::vector>af1_10_bit({{70,13}}); +const double af1_10_LSB = TWO_N38; +const std::vector>E5b_HS_10_bit({{83,2}}); +const std::vector>E1B_HS_10_bit({{85,2}}); +const std::vector> A_0G_10_bit({{87,16}}); +const double A_0G_10_LSB = TWO_N35; +const std::vector>A_1G_10_bit({{103,12}}); +const double A_1G_10_LSB = TWO_N51; + +const std::vector>t_0G_10_bit({{115,9}}); +const double t_0G_10_LSB = 3600; +const std::vector>WN_0G_10_bit({{123,6}}); + + +/* Page 0 */ +const std::vector>Time_0_bit({{7,2}}); +const std::vector>WN_0_bit({{97,12}}); +const std::vector> TOW_0_bit({{109,20}}); + + -/*Page 1*/ -const std::vector> PAGE_TYPE_bit({{1,6}}); -const std::vector> IOD_nav_page1({{7,10}}); -const std::vector> T0E_bit({{17,14}}); -const double t0e_LSB = 60; -const std::vector> M0_bit({{31,32}}); -const double M0_LSB = TWO_N31; -const std::vector> e_bit({{63,32}}); -const double e_LSB = TWO_N33; -const std::vector> A_bit({{95,32}}); -const double A_LSB = TWO_N19; // Galileo E1 primary codes diff --git a/src/core/system_parameters/MATH_CONSTANTS.h b/src/core/system_parameters/MATH_CONSTANTS.h index 147783631..b8eeabb92 100644 --- a/src/core/system_parameters/MATH_CONSTANTS.h +++ b/src/core/system_parameters/MATH_CONSTANTS.h @@ -51,8 +51,15 @@ const double TWO_P32 = (4294967296.0); //!< 2^32 this is too big for const double TWO_P56 = (7.205759403792794e+016); //!< 2^56 const 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_N8 = (0.00390625); //!< 2^-8 +const double TWO_N9 = (0.001953125); //!< 2^-9 + 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_N19 = (1.907348632812500e-006); //!< 2^-19 const double TWO_N20 = (9.536743164062500e-007); //!< 2^-20 const double TWO_N21 = (4.768371582031250e-007); //!< 2^-21 @@ -64,10 +71,17 @@ 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_N43 = (1.136868377216160e-013); //!< 2^-43 +const double TWO_N46 = (1.4210854715202e-014); //!< 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_N59 = (1.73472347597681e-018); //!< 2^-59 const double PI_TWO_N19 = (5.992112452678286e-006); //!< Pi*2^-19 const double PI_TWO_N43 = (3.571577341960839e-013); //!< Pi*2^-43 diff --git a/src/core/system_parameters/galileo_navigation_message.cc b/src/core/system_parameters/galileo_navigation_message.cc index c232536ac..4f3a53eba 100644 --- a/src/core/system_parameters/galileo_navigation_message.cc +++ b/src/core/system_parameters/galileo_navigation_message.cc @@ -31,154 +31,155 @@ #include "galileo_navigation_message.h" #include "boost/date_time/posix_time/posix_time.hpp" +#include +#include +#include using namespace std; void Galileo_Navigation_Message::reset() { - + flag_even_word = 0; /*Word type 1: Ephemeris (1/4)*/ - IOD_nav_1 = 0; - t0e = 0; - M0 = 0; - e = 0; - A = 0; + IOD_nav_1 = 0; + t0e_1 = 0; + M0_1 = 0; + e_1 = 0; + A_1 = 0; - /*d_TOW_SF1 = 0; - d_TOW_SF2 = 0; - d_TOW_SF3 = 0; - d_TOW_SF4 = 0; - d_TOW_SF5 = 0; + /*Word type 2: Ephemeris (2/4)*/ + IOD_nav_2 = 0; // IOD_nav page 2 + OMEGA_0_2 = 0; // Longitude of ascending node of orbital plane at weekly epoch [semi-circles] + i_0_2 = 0; // Inclination angle at reference time [semi-circles] + omega_2 = 0; // Argument of perigee [semi-circles] + iDot_2 = 0; // Rate of inclination angle [semi-circles/sec] - d_IODE_SF2 = 0; - d_IODE_SF3 = 0; - d_Crs = 0; - d_Delta_n = 0; - d_M_0 = 0; - d_Cuc = 0; - d_e_eccentricity = 0; - d_Cus = 0; - d_sqrt_A = 0; - d_Toe = 0; - d_Toc = 0; - d_Cic = 0; - d_OMEGA0 = 0; - d_Cis = 0; - d_i_0 = 0; - d_Crc = 0; - d_OMEGA = 0; - d_OMEGA_DOT = 0; - d_IDOT = 0; - i_code_on_L2 = 0; - i_GPS_week = 0; - b_L2_P_data_flag = false; - i_SV_accuracy = 0; - i_SV_health = 0; - d_TGD = 0; - d_IODC = -1; - i_AODO = 0; - b_fit_interval_flag = false; - d_spare1 = 0; - d_spare2 = 0; + /*Word type 3: Ephemeris (3/4) and SISA*/ + IOD_nav_3 = 0; // + OMEGA_dot_3 = 0; // Rate of right ascension [semi-circles/sec] + delta_n_3 = 0; // Mean motion difference from computed value [semi-circles/sec] + C_uc_3 = 0; // Amplitude of the cosine harmonic correction term to the argument of latitude [radians] + C_us_3 = 0; // Amplitude of the sine harmonic correction term to the argument of latitude [radians] + C_rc_3 = 0; // Amplitude of the cosine harmonic correction term to the orbit radius [meters] + C_rs_3 = 0; // Amplitude of the sine harmonic correction term to the orbit radius [meters] + SISA_3 = 0; // - d_A_f0 = 0; - d_A_f1 = 0; - d_A_f2 = 0; - //clock terms - //d_master_clock=0; - d_dtr = 0; - d_satClkCorr = 0; + /*Word type 4: Ephemeris (4/4) and Clock correction parameters*/ + IOD_nav_4 = 0; // + SV_ID_PRN_4 = 0; // + C_ic_4 = 0; // Amplitude of the cosine harmonic correction term to the angle of inclination [radians] + C_is_4 = 0; // Amplitude of the sine harmonic correction term to the angle of inclination [radians] + /*Clock correction parameters*/ + t0c_4 = 0; // + af0_4 = 0; // + af1_4 = 0; // + af2_4 = 0; // + spare_4 = 0; - // satellite positions - d_satpos_X = 0; - d_satpos_Y = 0; - d_satpos_Z = 0; + /*Word type 5: Ionospheric correction, BGD, signal health and data validity status and GST*/ + /*Ionospheric correction*/ + /*Az*/ + ai0_5 = 0; // + ai1_5 = 0; // + ai2_5 = 0; // + /*Ionospheric disturbance flag*/ + Region1_flag_5 = 0; //Region1_flag_5; + Region2_flag_5 = 0; // + Region3_flag_5 = 0; // + Region4_flag_5 = 0; // + Region5_flag_5 = 0; // + BGD_E1E5a_5 = 0; // + BGD_E1E5b_5 = 0; // + E5b_HS_5 = 0; // + E1B_HS_5 = 0; // + E5b_DVS_5 = 0; // + E1B_DVS_5 = 0; // + /*GST*/ + WN_5 = 0; + TOW_5 = 0; + spare_5 = 0; - // info - i_channel_ID = 0; - i_satellite_PRN = 0; + /*Word type 6: GST-UTC conversion parameters*/ + A0_6 = 0; + A1_6 = 0; + Delta_tLS_6 = 0; + t0t_6 = 0; + WNot_6 = 0; + WN_LSF_6 = 0; + DN_6 = 0; + Delta_tLSF_6 = 0; + TOW_6 = 0; - // time synchro - d_subframe_timestamp_ms = 0; - // flags - b_alert_flag = false; - b_integrity_status_flag = false; - b_antispoofing_flag = false; + /*Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number*/ + IOD_a_7 = 0; + WN_a_7 = 0; + t0a_7 = 0; + SVID1_7 = 0; + Delta_alpha_7 = 0; + e_7 = 0; + omega_7 = 0; + delta_i_7 = 0; + Omega0_7 = 0; + Omega_dot_7 = 0; + M0_7 = 0; + + /*Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)*/ + IOD_a_8 = 0; + af0_8 = 0; + af1_8 = 0; + E5b_HS_8 = 0; + E1B_HS_8 = 0; + SVID2_8 = 0; + DELTA_A_8 = 0; + e_8 = 0; + omega_8 = 0; + delta_i_8 = 0; + Omega0_8 = 0; + Omega_dot_8 = 0; + + /*Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)*/ + + IOD_a_9 = 0; + WN_a_9 = 0; + t0a_9 = 0; + M0_9 = 0; + af0_9 = 0; + af1_9 = 0; + E5b_HS_9 = 0; + E1B_HS_9 = 0; + SVID3_9 = 0; + DELTA_A_9 = 0; + e_9 = 0; + omega_9 = 0; + delta_i_9 = 0; + + /*Word type 10: Almanac for SVID3 (2/2) and GST-GPS conversion parameters*/ + + IOD_a_10 = 0; + Omega0_10 = 0; + Omega_dot_10 = 0; + M0_10 = 0; + af0_10 = 0; + af1_10 = 0; + E5b_HS_10 = 0; + E1B_HS_10 = 0; + A_0G_10 = 0; + A_1G_10 = 0; + t_0G_10 = 0; + WN_0G_10 = 0; + + /*Word type 0: I/NAV Spare Word*/ + + Time_0 = 0; + WN_0 = 0; + TOW_0 = 0; - // Ionosphere and UTC - flag_iono_valid = false; - flag_utc_model_valid = true; - d_alpha0 = 0; - d_alpha1 = 0; - d_alpha2 = 0; - d_alpha3 = 0; - d_beta0 = 0; - d_beta1 = 0; - d_beta2 = 0; - d_beta3 = 0; - d_A1 = 0; - d_A0 = 0; - d_t_OT = 0; - i_WN_T = 0; - d_DeltaT_LS = 0; - i_WN_LSF = 0; - i_DN = 0; - d_DeltaT_LSF= 0; - //Almanac - d_Toa = 0; - i_WN_A = 0; - for (int i=1; i < 32; i++ ) - { - almanacHealth[i] = 0; - } - // Satellite velocity - d_satvel_X = 0; - d_satvel_Y = 0; - d_satvel_Z = 0; - //Plane A (info from http://www.navcen.uscg.gov/?Do=constellationStatus) - satelliteBlock[9] = "IIA"; - satelliteBlock[31] = "IIR-M"; - satelliteBlock[8] = "IIA"; - satelliteBlock[7] = "IIR-M"; - satelliteBlock[27] = "IIA"; - //Plane B - satelliteBlock[16] = "IIR"; - satelliteBlock[25] = "IIF"; - satelliteBlock[28] = "IIR"; - satelliteBlock[12] = "IIR-M"; - satelliteBlock[30] = "IIA"; - //Plane C - satelliteBlock[29] = "IIR-M"; - satelliteBlock[3] = "IIA"; - satelliteBlock[19] = "IIR"; - satelliteBlock[17] = "IIR-M"; - satelliteBlock[6] = "IIA"; - //Plane D - satelliteBlock[2] = "IIR"; - satelliteBlock[1] = "IIF"; - satelliteBlock[21] = "IIR"; - satelliteBlock[4] = "IIA"; - satelliteBlock[11] = "IIR"; - satelliteBlock[24] = "IIA"; // Decommissioned from active service on 04 Nov 2011 - //Plane E - satelliteBlock[20] = "IIR"; - satelliteBlock[22] = "IIR"; - satelliteBlock[5] = "IIR-M"; - satelliteBlock[18] = "IIR"; - satelliteBlock[32] = "IIA"; - satelliteBlock[10] = "IIA"; - //Plane F - satelliteBlock[14] = "IIR"; - satelliteBlock[15] = "IIR-M"; - satelliteBlock[13] = "IIR"; - satelliteBlock[23] = "IIR"; - satelliteBlock[26] = "IIA";*/ } @@ -227,7 +228,7 @@ unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitse -/*signed long int Galileo_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector > parameter) +signed long int Galileo_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector > parameter) { signed long int value = 0; int num_of_slices = parameter.size(); @@ -236,7 +237,7 @@ unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitse if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system { // read the MSB and perform the sign extension - if (bits[GALILEO_SUBFRAME_BITS - parameter[0].first] == 1) + if (bits[GALILEO_DATA_JK_BITS - parameter[0].first] == 1) { value ^= 0xFFFFFFFFFFFFFFFF; //64 bits variable } @@ -251,7 +252,7 @@ unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitse { value <<= 1; //shift left value &= 0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable) - if (bits[GALILEO_SUBFRAME_BITS - parameter[i].first - j] == 1) + if (bits[GALILEO_DATA_JK_BITS - parameter[i].first - j] == 1) { value += 1; // insert the bit } @@ -261,7 +262,7 @@ unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitse else // we assume we are in a 32 bits system { // read the MSB and perform the sign extension - if (bits[GALILEO_SUBFRAME_BITS - parameter[0].first] == 1) + if (bits[GALILEO_DATA_JK_BITS - parameter[0].first] == 1) { value ^= 0xFFFFFFFF; } @@ -276,7 +277,7 @@ unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitse { value <<= 1; //shift left value &= 0xFFFFFFFE; //reset the corresponding bit - if (bits[GALILEO_SUBFRAME_BITS - parameter[i].first - j] == 1) + if (bits[GALILEO_DATA_JK_BITS - parameter[i].first - j] == 1) { value += 1; // insert the bit } @@ -284,13 +285,13 @@ unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitse } } return value; -}*/ +} -/*bool Galileo_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector > parameter) +bool Galileo_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector > parameter) { bool value; - if (bits[GALILEO_SUBFRAME_BITS - parameter[0].first] == 1) + if (bits[GALILEO_DATA_JK_BITS - parameter[0].first] == 1) { value = true; } @@ -299,8 +300,7 @@ unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitse value = false; } return value; -}*/ - +} /*void Galileo_Navigation_Message::print_galileo_word_bytes(unsigned int GPS_word) { @@ -311,65 +311,80 @@ unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitse -void Galileo_Navigation_Message::split_page(char *page){ +void Galileo_Navigation_Message::split_page(const char *page, int flag_even_word){ cout << "--------------------------------------------------------------------------" << endl; cout << "Entered in Galileo_Navigation_Message::split_page(char *page)" << endl << endl;; char Even_bit[2]={'\0'}, Odd_bit[2]={'\0'}, Page_type_Odd[2]={'\0'}, Page_type_even[2]={'\0'}, tail_Even[7]={'\0'}; //HO DATO A TUTTI UNO SPAZIO IN PIÙ PER L'ULTIMO CARATTERE - char page_Odd[121]={'\0'}, page_INAV[235]={'\0'}; + char page_Odd[121]={'\0'}; + char page_INAV[235]={'\0'}; char Data_j[16]={'\0'}, Data_k[112]={'\0'}, page_number_bits[6]={'\0'}; - char Data_jk_ephemeris[128]={'\0'}; + char Data_jk_ephemeris[129]={'\0'}; char Reserved_1[40]={'\0'}; char SAR[22]={'\0'}; char Spare[2]={'\0'}; char CRC_data[24]={'\0'}; char Reserved_2[8]={'\0'}; char Tail_odd[6]={'\0'}; - char correct_tail[7]="000000"; - int flag_even_word_arrived=1; /*******************REMEMBER TO CHANGE flag_even_word_arrived=0 *****+**********/ + //char correct_tail[7]="000000"; + char correct_tail[7]="011110"; //the viterbi decoder output change the tail to this value (why?) + int Page_type=0; - + static char page_Even[114]; /* Test to decode page 1 even joined to its corresponding - The Even pages given here are without their tails bits*/ - char page_Even[115]="000000010001011111010111101101100111110110101110101111100011001000000000001101110101110010000100101010100000010011"; - //test to detect page 3------> char page_Even[115]="000000110001011111111111111100001001100110001000110001011111110011111100110001011000111110000011011111000011110000"; - //test to detect page 10-----> char page_Even[115]="000010101111101010101010101010101010101010101010101010101010101010101010101010101010111100000000000000000000000000"; - //test to detect page 5------> char page_Even[115]="000001010010000010000000100010000010111010100000011111110001111111000111111001011000110010110011111111110110000000"; - //test to detect page 2------> char page_Even[115]="000000100001011111110010111010111100000010111100000010011100000000100001011110100111000111100111000000100000000010"; + The Even pages given here are without their tails bits*/ + //test to detect page 1------> char page_Even[115]="000000010001011111010111101101100111110110101110101111100011001000000000001101110101110010000100101010100000010011"; + //test to detect page 2------> char page_Even[115]="000000100001011111110010111010111100000010111100000010011100000000100001011110100111000111100111000000100000000010"; + //test to detect page 3------>char page_Even[115]="000000110001011111111111111100001001100110001000110001011111110011111100110001011000111110000011011111000011110000"; + //test to detect page 4------>char page_Even[115]="000001000001011111001100000000000000101100000000000111010101111011011000000001000101001111101010011100000000010110:// + /*test to detect page 5------>char page_Even[115]="000001010010000010000000100010000010111010100000011111110001111111000111111001011000110010110011111111110110000000";*/ + //test to detect page 10-----> char page_Even[115]="000010101111101010101010101010101010101010101010101010101010101010101010101010101010111100000000000000000000000000"; + //test to detect page 6------>char page_Even[115]="000001100000000000000000000000011100001100000000000000000000000000100011010111111010001101000011100001000110101101 + /* test to detect page 7------> char page_Even[115]="000001111111101001011111010011000000000110100000001110010111111110010111110111101001000001110000111111110000101101"; */ + /* test to detect page 8------> char page_Even[115]="000010001111000000100001111100000011000001111010100000000000110100000001111010011110111000011110111101001000001110"; */ + /* test to detect page 9------> char page_Even[115]="000010011111101001011111111000101110001100000000011010100000000010111111100000001010101010101010101010101010101010"; */ + /* test to detect page 10------> char page_Even[115]="000010101111101010101010101010101010101010101010101010101010101010101010101010101010111100000000000000000000000000"; */ + /* test to detect page 0------> char page_Even[115]="000000001001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010010110001100101";*/ cout << "Start decoding Galileo I/NAV " << endl; +// cout<<"page input"< data_jk_bits (str); - //cout << "Data_jk_bits (bitset) "<< endl << data_jk_bits << endl; + //std::cout << "Data_jk_bits (bitset) "<< endl << data_jk_bits << endl; page_number = (int)read_navigation_unsigned(data_jk_bits, PAGE_TYPE_bit); - cout << "Page number (for the test it must return page 1) = " << page_number << endl; + std::cout << "Page number = " << page_number << endl; switch (page_number) { - case 1: /*Word type 1: Ephemeris (1/4)*/ + case 1: /*Word type 1: Ephemeris (1/4)*/ + IOD_nav_1=(int)read_navigation_unsigned(data_jk_bits, IOD_nav_1_bit); + std::cout<<"IOD_nav_1= "<< IOD_nav_1 < bits, const std::vector > parameter); + bool read_navigation_bool(std::bitset bits, const std::vector > parameter); //void print_galileo_word_bytes(unsigned int GPS_word); unsigned long int read_navigation_unsigned(std::bitset bits, const std::vector< std::pair > parameter); unsigned long int read_page_type_unsigned(std::bitset bits, const std::vector< std::pair > parameter); - //signed long int read_navigation_signed(std::bitset bits, const std::vector > parameter); + signed long int read_navigation_signed(std::bitset bits, const std::vector > parameter); int x,y; public: + int flag_even_word; /*Word type 1: Ephemeris (1/4)*/ - int IOD_nav_1; // IOD_nav page 1 - double t0e; // Ephemeris reference time [s] - double M0; // Mean anomaly at reference time [semi-circles] - double e; // Eccentricity - double A; // Square root of the semi-major axis [metres^1/2] + int IOD_nav_1; // IOD_nav page 1 + double t0e_1; // Ephemeris reference time [s] + double M0_1; // Mean anomaly at reference time [semi-circles] + double e_1; // Eccentricity + double A_1; // Square root of the semi-major axis [metres^1/2] - /*Word type 2: Ephemeris (2/4)*/ + /*Word type 2: Ephemeris (2/4)*/ + int IOD_nav_2; // IOD_nav page 2 + double OMEGA_0_2; // Longitude of ascending node of orbital plane at weekly epoch [semi-circles] + double i_0_2; // Inclination angle at reference time [semi-circles] + double omega_2; // Argument of perigee [semi-circles] + double iDot_2; // Rate of inclination angle [semi-circles/sec] - /*Word type 3: Ephemeris (3/4) and SISA*/ + /*Word type 3: Ephemeris (3/4) and SISA*/ + int IOD_nav_3; // + double OMEGA_dot_3; // Rate of right ascension [semi-circles/sec] + double delta_n_3; // Mean motion difference from computed value [semi-circles/sec] + double C_uc_3; // Amplitude of the cosine harmonic correction term to the argument of latitude [radians] + double C_us_3; // Amplitude of the sine harmonic correction term to the argument of latitude [radians] + double C_rc_3; // Amplitude of the cosine harmonic correction term to the orbit radius [meters] + double C_rs_3; // Amplitude of the sine harmonic correction term to the orbit radius [meters] + double SISA_3; // - /*Word type 4: Ephemeris (4/4) and Clock correction parameters*/ - - /*Word type 5: Ionospheric correction, BGD, signal health and data validity status and GST*/ - - /*Word type 6: GST-UTC conversion parameters*/ - - /*Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number*/ - - /*Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)*/ - - /*Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)*/ - - /*Word type 10: Almanac for SVID3 (2/2) and GST-GPS conversion parameters*/ - - /*Word type 0: I/NAV Spare Word*/ + /*Word type 4: Ephemeris (4/4) and Clock correction parameters*/ + int IOD_nav_4; // + int SV_ID_PRN_4; // + double C_ic_4; // Amplitude of the cosine harmonic correction term to the angle of inclination [radians] + double C_is_4; // Amplitude of the sine harmonic correction term to the angle of inclination [radians] + /*Clock correction parameters*/ + double t0c_4; //Clock correction data reference Time of Week [sec] + double af0_4; //SV clock bias correction coefficient [s] + double af1_4; //SV clock drift correction coefficient [s/s] + double af2_4; //SV clock drift rate correction coefficient [s/s^2] + double spare_4; - void split_page(char *page); /* Takes in input a page (Odd or Even) of 120 bit, split it according ICD 4.3.2.3 and join Data_k with Data_j*/ + /*Word type 5: Ionospheric correction, BGD, signal health and data validity status and GST*/ + /*Ionospheric correction*/ + /*Az*/ + double ai0_5; //Effective Ionisation Level 1st order parameter [sfu] + double ai1_5; //Effective Ionisation Level 2st order parameter [sfu/degree] + double ai2_5; //Effective Ionisation Level 3st order parameter [sfu/degree] + + /*Ionospheric disturbance flag*/ + bool Region1_flag_5; // Ionospheric Disturbance Flag for region 1 + bool Region2_flag_5; // Ionospheric Disturbance Flag for region 2 + bool Region3_flag_5; // Ionospheric Disturbance Flag for region 3 + bool Region4_flag_5; // Ionospheric Disturbance Flag for region 4 + bool Region5_flag_5; // Ionospheric Disturbance Flag for region 5 + double BGD_E1E5a_5; //E1-E5a Broadcast Group Delay [s] + double BGD_E1E5b_5; //E1-E5b Broadcast Group Delay [s] + + double E5b_HS_5; // + double E1B_HS_5; // + double E5b_DVS_5; // + double E1B_DVS_5; // + /*GST*/ + double WN_5; + double TOW_5; + + double spare_5; + /*Word type 6: GST-UTC conversion parameters*/ + + double A0_6; + double A1_6; + double Delta_tLS_6; + double t0t_6; + double WNot_6; + double WN_LSF_6; + double DN_6; + double Delta_tLSF_6; + double TOW_6; + + /*Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number*/ + int IOD_a_7; + double WN_a_7; + double t0a_7; + int SVID1_7; + double Delta_alpha_7; + double e_7; + double omega_7; + double delta_i_7; + double Omega0_7; + double Omega_dot_7; + double M0_7; + + /*Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)*/ + int IOD_a_8; + double af0_8; + double af1_8; + double E5b_HS_8; + double E1B_HS_8; + int SVID2_8; + double DELTA_A_8; + double e_8; + double omega_8; + double delta_i_8; + double Omega0_8; + double Omega_dot_8; + + /*Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)*/ + + int IOD_a_9; + double WN_a_9; + double t0a_9; + double M0_9; + double af0_9; + double af1_9; + double E5b_HS_9; + double E1B_HS_9; + int SVID3_9; + double DELTA_A_9; + double e_9; + double omega_9; + double delta_i_9; + + + /*Word type 10: Almanac for SVID3 (2/2) and GST-GPS conversion parameters*/ + + int IOD_a_10; + double Omega0_10; + double Omega_dot_10; + double M0_10; + double af0_10; + double af1_10; + double E5b_HS_10; + double E1B_HS_10; + double A_0G_10; + double A_1G_10; + double t_0G_10; + double WN_0G_10; + + + + /*Word type 0: I/NAV Spare Word*/ + double Time_0; + double WN_0; + double TOW_0; + + + + void split_page(const char *page, int flag_even_word); /* Takes in input a page (Odd or Even) of 120 bit, split it according ICD 4.3.2.3 and join Data_k with Data_j*/ int page_jk_decoder(char *data_jk); /* Takes in input Data_jk (128 bit) and split it in ephemeris parameters according ICD 4.3.5*/ diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index 3213f74a2..d37d084d9 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -45,7 +45,7 @@ #include "gps_iono.h" #include "gps_almanac.h" #include "gps_utc_model.h" - +#include "GPS_L1_CA.h" /*!