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 2fd5667b8..d63abe409 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 @@ -284,46 +284,44 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector } // Galileo_Navigation_Message d_nav; // Now is a class member object, to store the intermediate results from call to call - //std::cout<<"page_string="<push(ephemeris); } - if (d_nav.have_new_iono()==true) + if (d_nav.have_new_iono_and_GST()==true) { Galileo_Iono iono=d_nav.get_iono(); //notice that the read operation will clear the valid flag + std::cout<<"New Galileo IONO model received for SV "<push(iono); } if (d_nav.have_new_utc_model()==true) { Galileo_Utc_Model utc_model=d_nav.get_utc_model(); //notice that the read operation will clear the valid flag + std::cout<<"New Galileo UTC model received for SV "<push(utc_model); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h index 927e351ee..8dec65a00 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h @@ -118,7 +118,7 @@ private: // navigation message vars Galileo_Navigation_Message d_nav; - //ToDo: Update the Galileo_Ephemeris,Galileo_Iono,Galileo_Utc_Model, and Galileo_Almanac classes to store the Galileo parameters + // Galileo ephemeris queue concurrent_queue *d_ephemeris_queue; // ionospheric parameters queue diff --git a/src/core/system_parameters/galileo_navigation_message.cc b/src/core/system_parameters/galileo_navigation_message.cc index 1788d0494..fb1e123a6 100644 --- a/src/core/system_parameters/galileo_navigation_message.cc +++ b/src/core/system_parameters/galileo_navigation_message.cc @@ -45,6 +45,24 @@ typedef boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false> CRC_Galileo_I void Galileo_Navigation_Message::reset() { flag_even_word = 0; + + flag_all_ephemeris = false; // flag indicating that all words containing ephemeris have been received + flag_ephemeris_1 = false; // flag indicating that ephemeris 1/4 (word 1) have been received + flag_ephemeris_2 = false; // flag indicating that ephemeris 2/4 (word 2) have been received + flag_ephemeris_3 = false; // flag indicating that ephemeris 3/4 (word 3) have been received + flag_ephemeris_4 = false; // flag indicating that ephemeris 4/4 (word 4) have been received + + flag_iono_and_GST = false; // flag indicating that ionospheric parameters (word 5) have been received + flag_utc_model = false; // flag indicating that utc model parameters (word 6) have been received + + flag_all_almanac = false; // flag indicating that all almanac have been received + flag_almanac_1 = false; // flag indicating that almanac 1/4 (word 7) have been received + flag_almanac_2 = false; // flag indicating that almanac 2/4 (word 8) have been received + flag_almanac_3 = false; // flag indicating that almanac 3/4 (word 9) have been received + flag_almanac_4 = false; // flag indicating that almanac 4/4 (word 10) have been received + + + /*Word type 1: Ephemeris (1/4)*/ IOD_nav_1 = 0; t0e_1 = 0; @@ -345,7 +363,6 @@ bool Galileo_Navigation_Message::read_navigation_bool(std::bitset page_type_bits (page_number_bits); // from string to bitset + Page_type = (int)read_page_type_unsigned(page_type_bits, type); + std::cout << "Page number (first 6 bits of Data k converted to decimal) = " << Page_type << std::endl; + std::string Data_jk_ephemeris = Data_k + Data_j; + //std::cout<<"Data j k ephemeris" << endl << Data_jk_ephemeris << endl; + + page_jk_decoder(Data_jk_ephemeris.c_str()); // Corresponding to ephemeris_decode.m in matlab code + + /*if (have_new_ephemeris()==true){ + std::cout<<"All ephemeris have been received" << std::endl; + }*/ + + double t_GST; + if ((have_new_iono_and_GST() == true) and (flag_all_ephemeris==true)) + { + std::cout <<"GST and ephemeris parameters have been received, now it is possible to compute satellite position"<< std::endl; + t_GST = Galileo_System_Time(WN_5, TOW_5); + std::cout << "Galileo System Time [sec]: " << t_GST << std::endl; + satellitePosition(t_GST); + flag_all_ephemeris=false; + } + + double t_UTC; + if ((have_new_iono_and_GST() == true) and (have_new_utc_model() == true)) + { + t_UTC = GST_to_UTC_time(t_GST, WN_5); + std::cout << "UTC [sec]: " << t_UTC << std::endl; + } + }else{ // CRC wrong.. discard frame std::cout<<"CRC error!"< page_type_bits (page_number_bits); // from string to bitset - Page_type = (int)read_page_type_unsigned(page_type_bits, type); - std::cout << "Page number (first 6 bits of Data k converted to decimal) = " << Page_type << std::endl; - std::string Data_jk_ephemeris = Data_k + Data_j; - //std::cout<<"Data j k ephemeris" << endl << Data_jk_ephemeris << endl; - - page_jk_decoder(Data_jk_ephemeris.c_str()); // Corresponding to ephemeris_decode.m in matlab code - } } /*end if (page_string.at(0)=='1') */ @@ -445,35 +480,73 @@ void Galileo_Navigation_Message::split_page(const char *page, int flag_even_word //std::cout << "Page even in split page" << std::endl << page_Even << std::endl; std::string tail_Even = page_string.substr (114,6); //std::cout << "tail_even_string: " << tail_Even <