GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
glonass_gnav_navigation_message.h
Go to the documentation of this file.
1/*!
2 * \file glonass_gnav_navigation_message.h
3 * \brief Interface of a GLONASS GNAV Data message decoder as described in GLONASS ICD (Edition 5.1)
4 * \note Code added as part of GSoC 2017 program
5 * \author Damian Miralles, 2017. dmiralles2009(at)gmail.com
6 * \see <a href="http://russianspacesystems.ru/wp-content/uploads/2016/08/ICD_GLONASS_eng_v5.1.pdf">GLONASS ICD</a>
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
20#ifndef GNSS_SDR_GLONASS_GNAV_NAVIGATION_MESSAGE_H
21#define GNSS_SDR_GLONASS_GNAV_NAVIGATION_MESSAGE_H
22
23
24#include "GLONASS_L1_L2_CA.h"
28#include <bitset>
29#include <cstdint>
30#include <string>
31#include <utility> // for pair
32#include <vector> // for vector
33
34/** \addtogroup Core
35 * \{ */
36/** \addtogroup System_Parameters
37 * \{ */
38
39
40/*!
41 * \brief This class decodes a GLONASS GNAV Data message as described in GLONASS ICD (Edition 5.1)
42 * \note Code added as part of GSoC 2017 program
43 * \see <a href="http://russianspacesystems.ru/wp-content/uploads/2016/08/ICD_GLONASS_eng_v5.1.pdf">GLONASS ICD</a>
44 */
46{
47public:
48 /*!
49 * Default constructor
50 */
52
53 /*!
54 * \brief Compute CRC for GLONASS GNAV strings
55 * \param bits Bits of the string message where to compute CRC
56 */
57 bool CRC_test(std::bitset<GLONASS_GNAV_STRING_BITS>& bits) const;
58
59 /*!
60 * \brief Computes the frame number being decoded given the satellite slot number
61 * \param satellite_slot_number [in] Satellite slot number identifier
62 * \returns Frame number being decoded, 0 if operation was not successful.
63 */
64 uint32_t get_frame_number(uint32_t satellite_slot_number);
65
66 /*!
67 * \brief Obtain a GLONASS GNAV SV Ephemeris class filled with current SV data
68 */
70 {
71 return gnav_ephemeris;
72 }
73
74 /*!
75 * \brief Obtain a GLONASS GNAV UTC model parameters class filled with current SV data
76 */
78 {
79 return gnav_utc_model;
80 }
81
82 /*!
83 * \brief Returns a Glonass_Gnav_Almanac object filled with the latest navigation data received
84 * \param satellite_slot_number Slot number identifier for the satellite
85 * \returns Returns the Glonass_Gnav_Almanac object for the input slot number
86 */
87 Glonass_Gnav_Almanac get_almanac(uint32_t satellite_slot_number) const;
88
89 /*!
90 * \brief Returns true if a new Glonass_Gnav_Ephemeris object has arrived.
91 */
93
94 /*!
95 * \brief Returns true if new Glonass_Gnav_Utc_Model object has arrived
96 */
98
99 /*!
100 * \brief Returns true if new Glonass_Gnav_Almanac object has arrived.
101 */
103
104 /*!
105 * \brief Decodes the GLONASS GNAV string
106 * \param frame_string [in] is the string message within the parsed frame
107 * \returns Returns the ID of the decoded string
108 */
109 int32_t string_decoder(const std::string& frame_string);
110
111 inline bool get_flag_CRC_test() const
112 {
113 return flag_CRC_test;
114 }
115
116 inline void set_rf_link(int32_t rf_link)
117 {
118 gnav_ephemeris.i_satellite_freq_channel = rf_link;
119 }
120
121 inline uint32_t get_alm_satellite_slot_number() const
122 {
123 return i_alm_satellite_slot_number;
124 }
125
126 inline bool get_flag_update_slot_number() const
127 {
128 return flag_update_slot_number;
129 }
130
131 inline void set_flag_update_slot_number(bool flag_slot)
132 {
133 flag_update_slot_number = flag_slot;
134 }
135
136 inline bool get_flag_TOW_new() const
137 {
138 return flag_TOW_new;
139 }
140
141 inline void set_flag_TOW_new(bool tow_new)
142 {
143 flag_TOW_new = tow_new;
144 }
145
146 inline bool is_flag_TOW_set() const
147 {
148 return flag_TOW_set;
149 }
150
151 inline void set_flag_ephemeris_str_1(bool ephemeris_str_1)
152 {
153 flag_ephemeris_str_1 = ephemeris_str_1;
154 }
155
156 inline void set_flag_ephemeris_str_2(bool ephemeris_str_2)
157 {
158 flag_ephemeris_str_2 = ephemeris_str_2;
159 }
160
161 inline void set_flag_ephemeris_str_3(bool ephemeris_str_3)
162 {
163 flag_ephemeris_str_3 = ephemeris_str_3;
164 }
165
166 inline void set_flag_ephemeris_str_4(bool ephemeris_str_4)
167 {
168 flag_ephemeris_str_4 = ephemeris_str_4;
169 }
170
171private:
172 uint64_t read_navigation_unsigned(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
173 int64_t read_navigation_signed(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
174 bool read_navigation_bool(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
175
176 Glonass_Gnav_Ephemeris gnav_ephemeris{}; // Ephemeris information decoded
177 Glonass_Gnav_Utc_Model gnav_utc_model{}; // UTC model information
178 Glonass_Gnav_Almanac gnav_almanac[GLONASS_CA_NBR_SATS]{}; // Almanac information for all 24 satellites
179
180 double d_previous_tb{}; // Previous iode for the Glonass_Gnav_Ephemeris object. Used to determine when new data arrives
181 double d_previous_Na[GLONASS_CA_NBR_SATS]{}; // Previous time for almanac of the Glonass_Gnav_Almanac object
182
183 uint32_t d_frame_ID{};
184 uint32_t d_string_ID{};
185 uint32_t i_alm_satellite_slot_number{}; // SV Orbit Slot Number
186
187 bool flag_CRC_test{};
188 bool flag_update_slot_number{};
189
190 // Ephemeris Flags and control variables
191 bool flag_all_ephemeris{}; // Flag indicating that all strings containing ephemeris have been received
192 bool flag_ephemeris_str_1{}; // Flag indicating that ephemeris 1/4 (string 1) have been received
193 bool flag_ephemeris_str_2{}; // Flag indicating that ephemeris 2/4 (string 2) have been received
194 bool flag_ephemeris_str_3{}; // Flag indicating that ephemeris 3/4 (string 3) have been received
195 bool flag_ephemeris_str_4{}; // Flag indicating that ephemeris 4/4 (string 4) have been received
196
197 // Almanac Flags
198 bool flag_almanac_str_6{}; // Flag indicating that almanac of string 6 have been received
199 bool flag_almanac_str_7{}; // Flag indicating that almanac of string 7 have been received
200 bool flag_almanac_str_8{}; // Flag indicating that almanac of string 8 have been received
201 bool flag_almanac_str_9{}; // Flag indicating that almanac of string 9 have been received
202 bool flag_almanac_str_10{}; // Flag indicating that almanac of string 10 have been received
203 bool flag_almanac_str_11{}; // Flag indicating that almanac of string 11 have been received
204 bool flag_almanac_str_12{}; // Flag indicating that almanac of string 12 have been received
205 bool flag_almanac_str_13{}; // Flag indicating that almanac of string 13 have been received
206 bool flag_almanac_str_14{}; // Flag indicating that almanac of string 14 have been received
207 bool flag_almanac_str_15{}; // Flag indicating that almanac of string 15 have been received
208
209 // UTC and System Clocks Flags
210 bool flag_utc_model_str_5{}; // Clock info send in string 5 of navigation data
211
212 bool flag_TOW_set{}; // Flag indicating when the TOW has been set
213 bool flag_TOW_new{}; // Flag indicating when a new TOW has been computed
214};
215
216
217/** \} */
218/** \} */
219#endif // GNSS_SDR_GLONASS_GNAV_NAVIGATION_MESSAGE_H
Defines system parameters for GLONASS L1 C/A signal and NAV data.
This class is a storage for the GLONASS SV ALMANAC data as described GLONASS ICD (Edition 5....
This class is a storage and orbital model functions for the GLONASS SV ephemeris data as described in...
int32_t i_satellite_freq_channel
SV Frequency Channel Number.
uint32_t get_frame_number(uint32_t satellite_slot_number)
Computes the frame number being decoded given the satellite slot number.
bool have_new_ephemeris()
Returns true if a new Glonass_Gnav_Ephemeris object has arrived.
bool have_new_almanac()
Returns true if new Glonass_Gnav_Almanac object has arrived.
Glonass_Gnav_Ephemeris get_ephemeris() const
Obtain a GLONASS GNAV SV Ephemeris class filled with current SV data.
bool CRC_test(std::bitset< GLONASS_GNAV_STRING_BITS > &bits) const
Compute CRC for GLONASS GNAV strings.
Glonass_Gnav_Almanac get_almanac(uint32_t satellite_slot_number) const
Returns a Glonass_Gnav_Almanac object filled with the latest navigation data received.
bool have_new_utc_model()
Returns true if new Glonass_Gnav_Utc_Model object has arrived.
Glonass_Gnav_Utc_Model get_utc_model() const
Obtain a GLONASS GNAV UTC model parameters class filled with current SV data.
int32_t string_decoder(const std::string &frame_string)
Decodes the GLONASS GNAV string.
This class is a storage for the GLONASS GNAV UTC MODEL data as described in GLONASS ICD (Edition 5....
Interface of a GLONASS GNAV ALMANAC storage.
Interface of a GLONASS EPHEMERIS storage.
Interface of a GLONASS GNAV UTC MODEL storage.