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