GNSS-SDR  0.0.14
An Open Source GNSS Software Defined Receiver
galileo_inav_message.h
Go to the documentation of this file.
1 /*!
2  * \file galileo_inav_message.h
3  * \brief Implementation of a Galileo I/NAV Data message
4  * as described in Galileo OS SIS ICD Issue 1.2 (Nov. 2015)
5  * \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
6  * \author Javier Arribas, 2013. jarribas(at)cttc.es
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
11  * This file is part of GNSS-SDR.
12  *
13  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
14  * SPDX-License-Identifier: GPL-3.0-or-later
15  *
16  * -----------------------------------------------------------------------------
17  */
18 
19 #ifndef GNSS_SDR_GALILEO_INAV_MESSAGE_H
20 #define GNSS_SDR_GALILEO_INAV_MESSAGE_H
21 
22 #include "Galileo_INAV.h"
23 #include "galileo_almanac_helper.h"
24 #include "galileo_ephemeris.h"
25 #include "galileo_iono.h"
26 #include "galileo_utc_model.h"
27 #include <bitset>
28 #include <cstdint>
29 #include <string>
30 #include <utility>
31 #include <vector>
32 
33 /** \addtogroup Core
34  * \{ */
35 /** \addtogroup System_Parameters
36  * \{ */
37 
38 
39 /*!
40  * \brief This class handles the Galileo I/NAV Data message, as described in the
41  * Galileo Open Service Signal in Space Interface Control Document (OS SIS ICD), Issue 1.2 (Nov 2015).
42  * See https://www.gsc-europa.eu/sites/default/files/sites/all/files/Galileo-OS-SIS-ICD.pdf
43  */
45 {
46 public:
47  Galileo_Inav_Message() = default;
48 
49  /*
50  * \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
51  */
52  void split_page(std::string page_string, int32_t flag_even_word);
53 
54  /*
55  * \brief Takes in input Data_jk (128 bit) and split it in ephemeris parameters according ICD 4.3.5
56  *
57  * Takes in input Data_jk (128 bit) and split it in ephemeris parameters according ICD 4.3.5
58  */
59  int32_t page_jk_decoder(const char* data_jk);
60 
61  /*
62  * \brief Returns true if new Ephemeris has arrived. The flag is set to false when the function is executed
63  */
64  bool have_new_ephemeris();
65 
66  /*
67  * \brief Returns true if new Iono model has arrived. The flag is set to false when the function is executed
68  */
69  bool have_new_iono_and_GST();
70 
71  /*
72  * \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed
73  */
74  bool have_new_utc_model();
75 
76  /*
77  * \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed
78  */
79  bool have_new_almanac();
80 
81  /*
82  * \brief Returns a Galileo_Ephemeris object filled with the latest navigation data received
83  */
84  Galileo_Ephemeris get_ephemeris() const;
85 
86  /*
87  * \brief Returns a Galileo_Iono object filled with the latest navigation data received
88  */
89  Galileo_Iono get_iono() const;
90 
91  /*
92  * \brief Returns a Galileo_Utc_Model object filled with the latest navigation data received
93  */
94  Galileo_Utc_Model get_utc_model() const;
95 
96  /*
97  * \brief Returns a Galileo_Almanac_Helper object filled with the latest navigation data received
98  */
99  Galileo_Almanac_Helper get_almanac() const;
100 
101  inline bool get_flag_CRC_test() const
102  {
103  return flag_CRC_test;
104  }
105 
106  inline bool get_flag_TOW_set() const
107  {
108  return flag_TOW_set;
109  }
110 
111  inline void set_flag_TOW_set(bool flag_tow)
112  {
113  flag_TOW_set = flag_tow;
114  }
115 
116  inline int32_t get_Galileo_week() const
117  {
118  return WN_0;
119  }
120 
121  inline int32_t get_TOW5() const
122  {
123  return TOW_5;
124  }
125 
126  inline int32_t get_TOW6() const
127  {
128  return TOW_6;
129  }
130 
131  inline bool is_TOW5_set() const
132  {
133  return flag_TOW_5;
134  }
135 
136  inline void set_TOW5_flag(bool flag_tow5)
137  {
138  flag_TOW_5 = flag_tow5;
139  }
140 
141  inline bool is_TOW6_set() const
142  {
143  return flag_TOW_6;
144  }
145 
146  inline void set_TOW6_flag(bool flag_tow6)
147  {
148  flag_TOW_6 = flag_tow6;
149  }
150 
151  inline bool get_flag_GGTO() const
152  {
153  return (flag_GGTO_1 == true and flag_GGTO_2 == true and flag_GGTO_3 == true and flag_GGTO_4 == true);
154  }
155 
156  inline double get_A0G() const
157  {
158  return A_0G_10;
159  }
160 
161  inline double get_A1G() const
162  {
163  return A_1G_10;
164  }
165 
166  inline double get_t0G() const
167  {
168  return t_0G_10;
169  }
170 
171  inline double get_WN0G() const
172  {
173  return WN_0G_10;
174  }
175 
176 private:
177  bool CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> bits, uint32_t checksum) const;
178  bool read_navigation_bool(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter) const;
179  uint64_t read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter) const;
180  uint64_t read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter) const;
181  int64_t read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter) const;
182 
183  std::string page_Even{};
184 
185  int32_t Page_type_time_stamp{};
186  int32_t IOD_ephemeris{};
187 
188  // Word type 1: Ephemeris (1/4)
189  int32_t IOD_nav_1{}; // IOD_nav page 1
190  int32_t t0e_1{}; // Ephemeris reference time [s]
191  double M0_1{}; // Mean anomaly at reference time [semi-circles]
192  double e_1{}; // Eccentricity
193  double A_1{}; // Square root of the semi-major axis [meters^1/2]
194 
195  // Word type 2: Ephemeris (2/4)
196  int32_t IOD_nav_2{}; // IOD_nav page 2
197  double OMEGA_0_2{}; // Longitude of ascending node of orbital plane at weekly epoch [semi-circles]
198  double i_0_2{}; // Inclination angle at reference time [semi-circles]
199  double omega_2{}; // Argument of perigee [semi-circles]
200  double iDot_2{}; // Rate of inclination angle [semi-circles/sec]
201 
202  // Word type 3: Ephemeris (3/4) and SISA
203  int32_t IOD_nav_3{}; //
204  double OMEGA_dot_3{}; // Rate of right ascension [semi-circles/sec]
205  double delta_n_3{}; // Mean motion difference from computed value [semi-circles/sec]
206  double C_uc_3{}; // Amplitude of the cosine harmonic correction term to the argument of latitude [radians]
207  double C_us_3{}; // Amplitude of the sine harmonic correction term to the argument of latitude [radians]
208  double C_rc_3{}; // Amplitude of the cosine harmonic correction term to the orbit radius [meters]
209  double C_rs_3{}; // Amplitude of the sine harmonic correction term to the orbit radius [meters]
210  int32_t SISA_3{};
211 
212  // Word type 4: Ephemeris (4/4) and Clock correction parameters*/
213  int32_t IOD_nav_4{}; //
214  int32_t SV_ID_PRN_4{}; //
215  double C_ic_4{}; // Amplitude of the cosine harmonic correction term to the angle of inclination [radians]
216  double C_is_4{}; // Amplitude of the sine harmonic correction term to the angle of inclination [radians]
217 
218  // Clock correction parameters
219  int32_t t0c_4{}; // Clock correction data reference Time of Week [sec]
220  double af0_4{}; // SV clock bias correction coefficient [s]
221  double af1_4{}; // SV clock drift correction coefficient [s/s]
222  double af2_4{}; // clock drift rate correction coefficient [s/s^2]
223  double spare_4{};
224 
225  // Word type 5: Ionospheric correction, BGD, signal health and data validity status and GST*/
226  // Ionospheric correction
227  double ai0_5{}; // Effective Ionisation Level 1st order parameter [sfu]
228  double ai1_5{}; // Effective Ionisation Level 2st order parameter [sfu/degree]
229  double ai2_5{}; // Effective Ionisation Level 3st order parameter [sfu/degree]
230 
231  // Ionospheric disturbance flag
232  bool Region1_flag_5{}; // Ionospheric Disturbance Flag for region 1
233  bool Region2_flag_5{}; // Ionospheric Disturbance Flag for region 2
234  bool Region3_flag_5{}; // Ionospheric Disturbance Flag for region 3
235  bool Region4_flag_5{}; // Ionospheric Disturbance Flag for region 4
236  bool Region5_flag_5{}; // Ionospheric Disturbance Flag for region 5
237  double BGD_E1E5a_5{}; // E1-E5a Broadcast Group Delay [s]
238  double BGD_E1E5b_5{}; // E1-E5b Broadcast Group Delay [s]
239 
240  int32_t E5b_HS_5{}; // E5b Signal Health Status
241  int32_t E1B_HS_5{}; // E1B Signal Health Status
242  bool E5b_DVS_5{}; // E5b Data Validity Status
243  bool E1B_DVS_5{}; // E1B Data Validity Status
244 
245  // GST
246  int32_t WN_5{};
247  int32_t TOW_5{};
248  double spare_5{};
249 
250  // Word type 6: GST-UTC conversion parameters
251  double A0_6{};
252  double A1_6{};
253  int32_t Delta_tLS_6{};
254  int32_t t0t_6{};
255  int32_t WNot_6{};
256  int32_t WN_LSF_6{};
257  int32_t DN_6{};
258  int32_t Delta_tLSF_6{};
259  int32_t TOW_6{};
260 
261  // Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number
262  int32_t IOD_a_7{};
263  int32_t WN_a_7{};
264  int32_t t0a_7{};
265  int32_t SVID1_7{};
266  double DELTA_A_7{};
267  double e_7{};
268  double omega_7{};
269  double delta_i_7{};
270  double Omega0_7{};
271  double Omega_dot_7{};
272  double M0_7{};
273 
274  // Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)
275  int32_t IOD_a_8{};
276  double af0_8{};
277  double af1_8{};
278  int32_t E5b_HS_8{};
279  int32_t E1B_HS_8{};
280  int32_t SVID2_8{};
281  double DELTA_A_8{};
282  double e_8{};
283  double omega_8{};
284  double delta_i_8{};
285  double Omega0_8{};
286  double Omega_dot_8{};
287 
288  // Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)
289  int32_t IOD_a_9{};
290  int32_t WN_a_9{};
291  int32_t t0a_9{};
292  double M0_9{};
293  double af0_9{};
294  double af1_9{};
295  int32_t E5b_HS_9{};
296  int32_t E1B_HS_9{};
297  int32_t SVID3_9{};
298  double DELTA_A_9{};
299  double e_9{};
300  double omega_9{};
301  double delta_i_9{};
302 
303  // Word type 10: Almanac for SVID3 (2/2) and GST-GPS conversion parameters
304  int32_t IOD_a_10{};
305  double Omega0_10{};
306  double Omega_dot_10{};
307  double M0_10{};
308  double af0_10{};
309  double af1_10{};
310  int32_t E5b_HS_10{};
311  int32_t E1B_HS_10{};
312 
313  // GST-GPS conversion
314  double A_0G_10{}; // Constant term of the offset Delta t systems
315  double A_1G_10{}; // Rate of change of the offset Delta t systems
316  int32_t t_0G_10{}; // Reference time for Galileo/GPS Time Offset (GGTO) data
317  int32_t WN_0G_10{}; // Week Number of Galileo/GPS Time Offset (GGTO) reference
318 
319  // Word type 0: I/NAV Spare Word
320  int32_t Time_0{};
321  int32_t WN_0{};
322  int32_t TOW_0{};
323 
324  double Galileo_satClkDrift{};
325 
326  bool flag_CRC_test{};
327  bool flag_all_ephemeris{}; // Flag indicating that all words containing ephemeris have been received
328  bool flag_ephemeris_1{}; // Flag indicating that ephemeris 1/4 (word 1) have been received
329  bool flag_ephemeris_2{}; // Flag indicating that ephemeris 2/4 (word 2) have been received
330  bool flag_ephemeris_3{}; // Flag indicating that ephemeris 3/4 (word 3) have been received
331  bool flag_ephemeris_4{}; // Flag indicating that ephemeris 4/4 (word 4) have been received
332 
333  bool flag_iono_and_GST{}; // Flag indicating that ionospheric and GST parameters (word 5) have been received
334  bool flag_TOW_5{};
335  bool flag_TOW_6{};
336  bool flag_TOW_set{}; // it is true when page 5 or page 6 arrives
337  bool flag_utc_model{}; // Flag indicating that utc model parameters (word 6) have been received
338 
339  bool flag_all_almanac{}; // Flag indicating that all Almanac data have been received
340  bool flag_almanac_1{}; // Flag indicating that almanac 1/4 (word 7) have been received
341  bool flag_almanac_2{}; // Flag indicating that almanac 2/4 (word 8) have been received
342  bool flag_almanac_3{}; // Flag indicating that almanac 3/4 (word 9) have been received
343  bool flag_almanac_4{}; // Flag indicating that almanac 4/4 (word 10) have been received
344 
345  bool flag_GGTO_1{};
346  bool flag_GGTO_2{};
347  bool flag_GGTO_3{};
348  bool flag_GGTO_4{};
349 };
350 
351 
352 /** \} */
353 /** \} */
354 #endif // GNSS_SDR_GALILEO_INAV_MESSAGE_H
This class is a storage for the GALILEO ALMANAC data as described in GALILEO ICD. ...
This class handles the Galileo I/NAV Data message, as described in the Galileo Open Service Signal in...
This class is a storage for the GALILEO IONOSPHERIC data as described in Galileo ICD paragraph 5...
Definition: galileo_iono.h:36
Interface of a Galileo UTC MODEL storage.
Interface of a Galileo ALMANAC storage helper.
This class is a storage and orbital model functions for the Galileo SV ephemeris data as described in...
This class is a storage for the GALILEO UTC MODEL data as described in Galileo ICD https://www...
Interface of a Galileo Ionospheric Model storage.
Interface of a Galileo EPHEMERIS storage.
Galileo INAV mesage constants.