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