GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
galileo_fnav_message.h
Go to the documentation of this file.
1 /*!
2  * \file galileo_fnav_message.h
3  * \brief Implementation of a Galileo F/NAV Data message
4  * as described in Galileo OS SIS ICD Issue 1.2 (Nov. 2015)
5  * \author Marc Sales, 2014. marcsales92(at)gmail.com
6  * \based on work from:
7  * <ul>
8  * <li> Javier Arribas, 2011. jarribas(at)cttc.es
9  * </ul>
10  *
11  *
12  * -----------------------------------------------------------------------------
13  *
14  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
15  * This file is part of GNSS-SDR.
16  *
17  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
18  * SPDX-License-Identifier: GPL-3.0-or-later
19  *
20  * -----------------------------------------------------------------------------
21  */
22 
23 #ifndef GNSS_SDR_GALILEO_FNAV_MESSAGE_H
24 #define GNSS_SDR_GALILEO_FNAV_MESSAGE_H
25 
26 
27 #include "Galileo_E5a.h"
28 #include "Galileo_FNAV.h"
29 #include "galileo_almanac_helper.h"
30 #include "galileo_ephemeris.h"
31 #include "galileo_iono.h"
32 #include "galileo_utc_model.h"
33 #include <bitset>
34 #include <cstdint>
35 #include <string>
36 #include <utility>
37 #include <vector>
38 
39 /** \addtogroup Core
40  * \{ */
41 /** \addtogroup System_Parameters
42  * \{ */
43 
44 
45 /*!
46  * \brief This class handles the Galileo F/NAV Data message, as described in the
47  * Galileo Open Service Signal in Space Interface Control Document (OS SIS ICD), Issue 2.0 (Jan. 2021).
48  * See https://www.gsc-europa.eu/sites/default/files/sites/all/files/Galileo_OS_SIS_ICD_v2.0.pdf
49  */
51 {
52 public:
53  Galileo_Fnav_Message() = default;
54 
55  void split_page(const std::string& page_string);
56  bool have_new_ephemeris();
57  bool have_new_iono_and_GST();
58  bool have_new_utc_model();
59  bool have_new_almanac();
60  Galileo_Ephemeris get_ephemeris() const;
61  Galileo_Iono get_iono() const;
62  Galileo_Utc_Model get_utc_model() const;
63  Galileo_Almanac_Helper get_almanac() const;
64 
65  inline int32_t get_TOW1() const
66  {
67  return FNAV_TOW_1;
68  }
69 
70  inline int32_t get_TOW2() const
71  {
72  return FNAV_TOW_2;
73  }
74 
75  inline int32_t get_TOW3() const
76  {
77  return FNAV_TOW_3;
78  }
79 
80  inline int32_t get_TOW4() const
81  {
82  return FNAV_TOW_4;
83  }
84 
85  inline bool get_flag_CRC_test() const
86  {
87  return flag_CRC_test;
88  }
89 
90  inline bool get_flag_TOW_set() const
91  {
92  return flag_TOW_set;
93  }
94 
95  inline void set_flag_TOW_set(bool flag_tow)
96  {
97  flag_TOW_set = flag_tow;
98  }
99 
100  inline bool is_TOW1_set() const
101  {
102  return flag_TOW_1;
103  }
104 
105  inline void set_TOW1_flag(bool flag_tow1)
106  {
107  flag_TOW_1 = flag_tow1;
108  }
109 
110  inline bool is_TOW2_set() const
111  {
112  return flag_TOW_2;
113  }
114 
115  inline void set_TOW2_flag(bool flag_tow2)
116  {
117  flag_TOW_2 = flag_tow2;
118  }
119 
120  inline bool is_TOW3_set() const
121  {
122  return flag_TOW_3;
123  }
124 
125  inline void set_TOW3_flag(bool flag_tow3)
126  {
127  flag_TOW_3 = flag_tow3;
128  }
129 
130  inline bool is_TOW4_set() const
131  {
132  return flag_TOW_4;
133  }
134 
135  inline void set_TOW4_flag(bool flag_tow4)
136  {
137  flag_TOW_4 = flag_tow4;
138  }
139 
140 private:
141  bool CRC_test(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, uint32_t checksum) const;
142  void decode_page(const std::string& data);
143  uint64_t read_navigation_unsigned(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
144  int64_t read_navigation_signed(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
145 
146  std::string omega0_1{};
147  // std::string omega0_2{};
148  // bool omega_flag{};
149 
150  int32_t IOD_ephemeris{};
151 
152  int32_t page_type{};
153  // WORD 1 SVID, Clock correction, SISA, Ionospheric correction, BGD, GST, Signal
154  // health and Data validity status
155  int32_t FNAV_SV_ID_PRN_1{};
156  int32_t FNAV_IODnav_1{};
157  int32_t FNAV_t0c_1{};
158  double FNAV_af0_1{};
159  double FNAV_af1_1{};
160  double FNAV_af2_1{};
161  int32_t FNAV_SISA_1{};
162  double FNAV_ai0_1{};
163  double FNAV_ai1_1{};
164  double FNAV_ai2_1{};
165  double FNAV_BGD_1{};
166  int32_t FNAV_E5ahs_1{};
167  int32_t FNAV_WN_1{};
168  int32_t FNAV_TOW_1{};
169  bool FNAV_region1_1{};
170  bool FNAV_region2_1{};
171  bool FNAV_region3_1{};
172  bool FNAV_region4_1{};
173  bool FNAV_region5_1{};
174  bool FNAV_E5advs_1{};
175 
176  // WORD 2 Ephemeris (1/3) and GST
177  int32_t FNAV_IODnav_2{};
178  double FNAV_M0_2{};
179  double FNAV_omegadot_2{};
180  double FNAV_e_2{};
181  double FNAV_a12_2{};
182  double FNAV_omega0_2{};
183  double FNAV_idot_2{};
184  int32_t FNAV_WN_2{};
185  int32_t FNAV_TOW_2{};
186 
187  // WORD 3 Ephemeris (2/3) and GST
188  int32_t FNAV_IODnav_3{};
189  double FNAV_i0_3{};
190  double FNAV_w_3{};
191  double FNAV_deltan_3{};
192  double FNAV_Cuc_3{};
193  double FNAV_Cus_3{};
194  double FNAV_Crc_3{};
195  double FNAV_Crs_3{};
196  int32_t FNAV_t0e_3{};
197  int32_t FNAV_WN_3{};
198  int32_t FNAV_TOW_3{};
199 
200  // WORD 4 Ephemeris (3/3), GST-UTC conversion, GST-GPS conversion and TOW.
201  // Note that the clock is repeated in this page type
202  int32_t FNAV_IODnav_4{};
203  double FNAV_Cic_4{};
204  double FNAV_Cis_4{};
205  double FNAV_A0_4{};
206  double FNAV_A1_4{};
207  int32_t FNAV_deltatls_4{};
208  int32_t FNAV_t0t_4{};
209  int32_t FNAV_WNot_4{};
210  int32_t FNAV_WNlsf_4{};
211  int32_t FNAV_DN_4{};
212  int32_t FNAV_deltatlsf_4{};
213  int32_t FNAV_t0g_4{};
214  double FNAV_A0g_4{};
215  double FNAV_A1g_4{};
216  int32_t FNAV_WN0g_4{};
217  int32_t FNAV_TOW_4{};
218 
219  // WORD 5 Almanac (SVID1 and SVID2(1/2)), Week Number and almanac reference time
220  int32_t FNAV_IODa_5{};
221  int32_t FNAV_WNa_5{};
222  int32_t FNAV_t0a_5{};
223  int32_t FNAV_SVID1_5{};
224  double FNAV_Deltaa12_1_5{};
225  double FNAV_e_1_5{};
226  double FNAV_w_1_5{};
227  double FNAV_deltai_1_5{};
228  double FNAV_Omega0_1_5{};
229  double FNAV_Omegadot_1_5{};
230  double FNAV_M0_1_5{};
231  double FNAV_af0_1_5{};
232  double FNAV_af1_1_5{};
233  uint32_t FNAV_E5ahs_1_5{};
234  int32_t FNAV_SVID2_5{};
235  double FNAV_Deltaa12_2_5{};
236  double FNAV_e_2_5{};
237  double FNAV_w_2_5{};
238  double FNAV_deltai_2_5{};
239 
240  // WORD 6 Almanac (SVID2(2/2) and SVID3)
241  int32_t FNAV_IODa_6{};
242  double FNAV_Omega0_2_6{};
243  double FNAV_Omegadot_2_6{};
244  double FNAV_M0_2_6{};
245  double FNAV_af0_2_6{};
246  double FNAV_af1_2_6{};
247  int32_t FNAV_E5ahs_2_6{};
248  int32_t FNAV_SVID3_6{};
249  double FNAV_Deltaa12_3_6{};
250  double FNAV_e_3_6{};
251  double FNAV_w_3_6{};
252  double FNAV_deltai_3_6{};
253  double FNAV_Omega0_3_6{};
254  double FNAV_Omegadot_3_6{};
255  double FNAV_M0_3_6{};
256  double FNAV_af0_3_6{};
257  double FNAV_af1_3_6{};
258  int32_t FNAV_E5ahs_3_6{};
259 
260  bool flag_CRC_test{};
261  bool flag_all_ephemeris{}; // Flag indicating that all words containing ephemeris have been received
262  bool flag_ephemeris_1{}; // Flag indicating that ephemeris 1/3 (word 2) have been received
263  bool flag_ephemeris_2{}; // Flag indicating that ephemeris 2/3 (word 3) have been received
264  bool flag_ephemeris_3{}; // Flag indicating that ephemeris 3/3 (word 4) have been received
265 
266  bool flag_iono_and_GST{}; // Flag indicating that ionospheric and GST parameters (word 1) have been received
267  bool flag_TOW_1{};
268  bool flag_TOW_2{};
269  bool flag_TOW_3{};
270  bool flag_TOW_4{};
271  bool flag_TOW_set{}; // it is true when page 1,2,3 or 4 arrives
272  bool flag_utc_model{}; // Flag indicating that utc model parameters (word 4) have been received
273 
274  bool flag_all_almanac{}; // Flag indicating that all Almanac data have been received
275  bool flag_almanac_1{}; // Flag indicating that almanac 1/2 (word 5) have been received
276  bool flag_almanac_2{}; // Flag indicating that almanac 2/2 (word 6) have been received
277 };
278 
279 
280 /** \} */
281 /** \} */
282 #endif // GNSS_SDR_GALILEO_FNAV_MESSAGE_H
Defines system parameters for Galileo E5a signal and NAV data.
This class handles the Galileo F/NAV Data message, as described in the Galileo Open Service Signal in...
Galileo FNAV mesage constants.
This class is a storage for the GALILEO ALMANAC data as described in GALILEO ICD. ...
This class is a storage for the GALILEO IONOSPHERIC data as described in Galileo ICD paragraph 5...
Definition: galileo_iono.h:37
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.