2013-07-15 17:07:10 +00:00
/*!
* \ file galileo_navigation_message . h
2013-11-18 01:37:23 +00:00
* \ brief Implementation of a Galileo I / NAV Data message
2016-10-22 11:46:22 +00:00
* as described in Galileo OS SIS ICD Issue 1.2 ( Nov . 2015 )
2013-07-15 17:07:10 +00:00
* \ author Mara Branzanti 2013. mara . branzanti ( at ) gmail . com
* \ author Javier Arribas , 2013. jarribas ( at ) cttc . es
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
2019-07-26 10:38:20 +00:00
* Copyright ( C ) 2010 - 2019 ( see AUTHORS file for a list of contributors )
2013-07-15 17:07:10 +00:00
*
* GNSS - SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS - SDR .
*
* GNSS - SDR is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
2015-01-08 18:49:59 +00:00
* ( at your option ) any later version .
2013-07-15 17:07:10 +00:00
*
* GNSS - SDR is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2018-05-13 20:49:11 +00:00
* along with GNSS - SDR . If not , see < https : //www.gnu.org/licenses/>.
2013-07-15 17:07:10 +00:00
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
# ifndef GNSS_SDR_GALILEO_NAVIGATION_MESSAGE_H_
# define GNSS_SDR_GALILEO_NAVIGATION_MESSAGE_H_
2018-12-09 21:00:09 +00:00
# include "Galileo_E1.h"
# include "galileo_almanac_helper.h"
2013-08-15 15:14:17 +00:00
# include "galileo_ephemeris.h"
# include "galileo_iono.h"
# include "galileo_utc_model.h"
2018-02-26 02:15:53 +00:00
# include <bitset>
2018-08-10 18:34:03 +00:00
# include <cstdint>
2018-02-26 02:15:53 +00:00
# include <string>
# include <utility>
# include <vector>
2013-08-15 15:14:17 +00:00
2013-11-18 01:37:23 +00:00
/*!
* \ brief This class handles the Galileo I / NAV Data message , as described in the
2016-10-22 11:46:22 +00:00
* Galileo Open Service Signal in Space Interface Control Document ( OS SIS ICD ) , Issue 1.2 ( Nov 2015 ) .
* See https : //www.gsc-europa.eu/system/files/galileo_documents/Galileo_OS_SIS_ICD.pdf
2013-11-18 01:37:23 +00:00
*/
class Galileo_Navigation_Message
{
2013-07-15 17:07:10 +00:00
public :
2019-07-01 21:44:42 +00:00
Galileo_Navigation_Message ( ) ;
2018-08-13 23:13:07 +00:00
int32_t Page_type_time_stamp ;
int32_t flag_even_word ;
2013-11-18 01:37:23 +00:00
std : : string page_Even ;
2013-10-18 09:38:43 +00:00
bool flag_CRC_test ;
2013-11-18 01:37:23 +00:00
bool flag_all_ephemeris ; //!< Flag indicating that all words containing ephemeris have been received
bool flag_ephemeris_1 ; //!< Flag indicating that ephemeris 1/4 (word 1) have been received
bool flag_ephemeris_2 ; //!< Flag indicating that ephemeris 2/4 (word 2) have been received
bool flag_ephemeris_3 ; //!< Flag indicating that ephemeris 3/4 (word 3) have been received
bool flag_ephemeris_4 ; //!< Flag indicating that ephemeris 4/4 (word 4) have been received
2018-03-03 01:03:39 +00:00
bool flag_iono_and_GST ; //!< Flag indicating that ionospheric and GST parameters (word 5) have been received
2013-11-18 01:37:23 +00:00
bool flag_TOW_5 ;
bool flag_TOW_6 ;
2018-03-03 01:03:39 +00:00
bool flag_TOW_set ; //!< it is true when page 5 or page 6 arrives
bool flag_utc_model ; //!< Flag indicating that utc model parameters (word 6) have been received
2013-11-18 01:37:23 +00:00
2018-03-03 01:03:39 +00:00
bool flag_all_almanac ; //!< Flag indicating that all almanac have been received
bool flag_almanac_1 ; //!< Flag indicating that almanac 1/4 (word 7) have been received
bool flag_almanac_2 ; //!< Flag indicating that almanac 2/4 (word 8) have been received
bool flag_almanac_3 ; //!< Flag indicating that almanac 3/4 (word 9) have been received
bool flag_almanac_4 ; //!< Flag indicating that almanac 4/4 (word 10) have been received
2013-11-18 01:37:23 +00:00
2018-08-13 23:13:07 +00:00
int32_t IOD_ephemeris ;
2013-11-18 01:37:23 +00:00
2014-06-13 16:38:16 +00:00
bool flag_GGTO ;
bool flag_GGTO_1 ;
bool flag_GGTO_2 ;
bool flag_GGTO_3 ;
bool flag_GGTO_4 ;
2018-08-13 23:13:07 +00:00
// Word type 1: Ephemeris (1/4)
int32_t IOD_nav_1 ; //!< IOD_nav page 1
2018-12-13 23:42:05 +00:00
int32_t t0e_1 ; //!< Ephemeris reference time [s]
2018-08-13 23:13:07 +00:00
double M0_1 ; //!< Mean anomaly at reference time [semi-circles]
double e_1 ; //!< Eccentricity
double A_1 ; //!< Square root of the semi-major axis [meters^1/2]
// Word type 2: Ephemeris (2/4)
int32_t 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
int32_t IOD_nav_3 ; //
2018-03-03 01:03:39 +00:00
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]
2018-12-13 23:42:05 +00:00
int32_t SISA_3 ;
2013-11-18 01:37:23 +00:00
2018-08-13 23:13:07 +00:00
// Word type 4: Ephemeris (4/4) and Clock correction parameters*/
int32_t IOD_nav_4 ; //
int32_t SV_ID_PRN_4 ; //
2019-08-18 20:16:13 +00:00
double C_ic_4 ; //!< Amplitude of the cosine harmonic correction term to the angle of inclination [radians]
2018-08-13 23:13:07 +00:00
double C_is_4 ; //!< Amplitude of the sine harmonic correction term to the angle of inclination [radians]
// Clock correction parameters
2018-12-13 23:42:05 +00:00
int32_t t0c_4 ; //!< Clock correction data reference Time of Week [sec]
double af0_4 ; //!< SV clock bias correction coefficient [s]
double af1_4 ; //!< SV clock drift correction coefficient [s/s]
double af2_4 ; //!< clock drift rate correction coefficient [s/s^2]
2013-11-18 01:37:23 +00:00
double spare_4 ;
2018-08-13 23:13:07 +00:00
// Word type 5: Ionospheric correction, BGD, signal health and data validity status and GST*/
// Ionospheric correction
2018-03-03 01:03:39 +00:00
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]
2013-11-18 01:37:23 +00:00
2018-08-13 23:13:07 +00:00
// Ionospheric disturbance flag
2018-03-03 01:03:39 +00:00
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]
2013-11-18 01:37:23 +00:00
2018-12-13 23:42:05 +00:00
int32_t E5b_HS_5 ; //!< E5b Signal Health Status
int32_t E1B_HS_5 ; //!< E1B Signal Health Status
bool E5b_DVS_5 ; //!< E5b Data Validity Status
bool E1B_DVS_5 ; //!< E1B Data Validity Status
2018-08-13 23:13:07 +00:00
// GST
2018-12-13 23:42:05 +00:00
int32_t WN_5 ;
int32_t TOW_5 ;
2013-11-18 01:37:23 +00:00
double spare_5 ;
2018-08-13 23:13:07 +00:00
// Word type 6: GST-UTC conversion parameters
2013-11-18 01:37:23 +00:00
double A0_6 ;
double A1_6 ;
2018-12-13 23:42:05 +00:00
int32_t Delta_tLS_6 ;
int32_t t0t_6 ;
int32_t WNot_6 ;
2018-12-02 13:32:22 +00:00
int32_t WN_LSF_6 ;
int32_t DN_6 ;
2018-12-13 23:42:05 +00:00
int32_t Delta_tLSF_6 ;
int32_t TOW_6 ;
2013-11-18 01:37:23 +00:00
2018-08-13 23:13:07 +00:00
// Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number
int32_t IOD_a_7 ;
2018-11-07 21:25:09 +00:00
int32_t WN_a_7 ;
2018-12-02 13:32:22 +00:00
int32_t t0a_7 ;
2018-08-13 23:13:07 +00:00
int32_t SVID1_7 ;
2013-11-18 01:37:23 +00:00
double DELTA_A_7 ;
double e_7 ;
double omega_7 ;
double delta_i_7 ;
double Omega0_7 ;
double Omega_dot_7 ;
double M0_7 ;
2018-08-13 23:13:07 +00:00
// Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)
int32_t IOD_a_8 ;
2013-11-18 01:37:23 +00:00
double af0_8 ;
double af1_8 ;
2018-11-07 21:25:09 +00:00
int32_t E5b_HS_8 ;
int32_t E1B_HS_8 ;
2018-08-13 23:13:07 +00:00
int32_t SVID2_8 ;
2013-11-18 01:37:23 +00:00
double DELTA_A_8 ;
double e_8 ;
double omega_8 ;
double delta_i_8 ;
double Omega0_8 ;
double Omega_dot_8 ;
2018-08-13 23:13:07 +00:00
// Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)
int32_t IOD_a_9 ;
2018-11-07 21:25:09 +00:00
int32_t WN_a_9 ;
2018-12-02 13:32:22 +00:00
int32_t t0a_9 ;
2013-11-18 01:37:23 +00:00
double M0_9 ;
double af0_9 ;
double af1_9 ;
2018-11-07 21:25:09 +00:00
int32_t E5b_HS_9 ;
int32_t E1B_HS_9 ;
2018-08-13 23:13:07 +00:00
int32_t SVID3_9 ;
2013-11-18 01:37:23 +00:00
double DELTA_A_9 ;
double e_9 ;
double omega_9 ;
double delta_i_9 ;
2018-08-13 23:13:07 +00:00
// Word type 10: Almanac for SVID3 (2/2) and GST-GPS conversion parameters
int32_t IOD_a_10 ;
2013-11-18 01:37:23 +00:00
double Omega0_10 ;
double Omega_dot_10 ;
double M0_10 ;
double af0_10 ;
double af1_10 ;
2018-11-07 21:25:09 +00:00
int32_t E5b_HS_10 ;
int32_t E1B_HS_10 ;
2018-08-13 23:13:07 +00:00
2013-11-18 01:37:23 +00:00
// GST-GPS conversion
2018-12-13 23:42:05 +00:00
double A_0G_10 ; //!< Constant term of the offset Delta t systems
double A_1G_10 ; //!< Rate of change of the offset Delta t systems
int32_t t_0G_10 ; //!< Reference time for Galileo/GPS Time Offset (GGTO) data
int32_t WN_0G_10 ; //!< Week Number of Galileo/GPS Time Offset (GGTO) reference
2018-08-13 23:13:07 +00:00
// Word type 0: I/NAV Spare Word
2018-12-13 23:42:05 +00:00
int32_t Time_0 ;
int32_t WN_0 ;
int32_t TOW_0 ;
2013-11-18 01:37:23 +00:00
double Galileo_satClkDrift ;
2018-03-03 01:03:39 +00:00
double Galileo_dtr ; //!< Relativistic clock correction term
2013-11-18 01:37:23 +00:00
// satellite positions
2018-03-03 01:03:39 +00:00
double galileo_satpos_X ; //!< Earth-fixed coordinate x of the satellite [m]. Intersection of the IERS Reference Meridian (IRM) and the plane passing through the origin and normal to the Z-axis.
double galileo_satpos_Y ; //!< Earth-fixed coordinate y of the satellite [m]. Completes a right-handed, Earth-Centered, Earth-Fixed orthogonal coordinate system.
double galileo_satpos_Z ; //!< Earth-fixed coordinate z of the satellite [m]. The direction of the IERS (International Earth Rotation and Reference Systems Service) Reference Pole (IRP).
2018-08-13 23:13:07 +00:00
2013-11-18 01:37:23 +00:00
// Satellite velocity
2018-03-03 01:03:39 +00:00
double galileo_satvel_X ; //!< Earth-fixed velocity coordinate x of the satellite [m]
double galileo_satvel_Y ; //!< Earth-fixed velocity coordinate y of the satellite [m]
double galileo_satvel_Z ; //!< Earth-fixed velocity coordinate z of the satellite [m]
2013-11-18 01:37:23 +00:00
/*
* \ brief 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
*/
2018-08-13 23:13:07 +00:00
void split_page ( std : : string page_string , int32_t flag_even_word ) ;
2013-11-18 01:37:23 +00:00
/*
* \ brief Takes in input Data_jk ( 128 bit ) and split it in ephemeris parameters according ICD 4.3 .5
*
* Takes in input Data_jk ( 128 bit ) and split it in ephemeris parameters according ICD 4.3 .5
*/
2018-12-02 13:32:22 +00:00
int32_t page_jk_decoder ( const char * data_jk ) ;
2013-11-18 01:37:23 +00:00
void reset ( ) ;
/*
* \ brief Returns true if new Ephemeris has arrived . The flag is set to false when the function is executed
*/
bool have_new_ephemeris ( ) ;
/*
* \ brief Returns true if new Iono model has arrived . The flag is set to false when the function is executed
*/
bool have_new_iono_and_GST ( ) ;
/*
* \ brief Returns true if new UTC model has arrived . The flag is set to false when the function is executed
*/
bool have_new_utc_model ( ) ;
/*
* \ brief Returns true if new UTC model has arrived . The flag is set to false when the function is executed
*/
bool have_new_almanac ( ) ;
/*
* \ brief Returns a Galileo_Ephemeris object filled with the latest navigation data received
*/
Galileo_Ephemeris get_ephemeris ( ) ;
/*
* \ brief Returns a Galileo_Iono object filled with the latest navigation data received
*/
Galileo_Iono get_iono ( ) ;
/*
* \ brief Returns a Galileo_Utc_Model object filled with the latest navigation data received
*/
Galileo_Utc_Model get_utc_model ( ) ;
/*
2018-10-24 15:28:12 +00:00
* \ brief Returns a Galileo_Almanac_Helper object filled with the latest navigation data received
2013-11-18 01:37:23 +00:00
*/
2018-10-24 15:28:12 +00:00
Galileo_Almanac_Helper get_almanac ( ) ;
2013-11-18 01:37:23 +00:00
2019-07-01 21:44:42 +00:00
private :
bool CRC_test ( std : : bitset < GALILEO_DATA_FRAME_BITS > bits , uint32_t checksum ) ;
bool read_navigation_bool ( std : : bitset < GALILEO_DATA_JK_BITS > bits , const std : : vector < std : : pair < int32_t , int32_t > > & parameter ) ;
uint64_t read_navigation_unsigned ( std : : bitset < GALILEO_DATA_JK_BITS > bits , const std : : vector < std : : pair < int32_t , int32_t > > & parameter ) ;
uint64_t read_page_type_unsigned ( std : : bitset < GALILEO_PAGE_TYPE_BITS > bits , const std : : vector < std : : pair < int32_t , int32_t > > & parameter ) ;
int64_t read_navigation_signed ( std : : bitset < GALILEO_DATA_JK_BITS > bits , const std : : vector < std : : pair < int32_t , int32_t > > & parameter ) ;
2013-07-15 17:07:10 +00:00
} ;
2020-01-26 21:23:22 +00:00
# endif // GNSS_SDR_GALILEO_NAVIGATION_MESSAGE_H_