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