GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
galileo_telemetry_decoder_gs.h
Go to the documentation of this file.
1 /*!
2  * \file galileo_telemetry_decoder_gs.h
3  * \brief Implementation of a Galileo unified INAV and FNAV message demodulator
4  * block
5  * \author Javier Arribas 2018. jarribas(at)cttc.es
6  * \author Carles Fernandez, 2021-2022. cfernandez(at)cttc.es
7  *
8  *
9  * -----------------------------------------------------------------------------
10  *
11  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
12  * This file is part of GNSS-SDR.
13  *
14  * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
15  * SPDX-License-Identifier: GPL-3.0-or-later
16  *
17  * -----------------------------------------------------------------------------
18  */
19 
20 
21 #ifndef GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H
22 #define GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H
23 
24 #include "galileo_cnav_message.h" // for Galileo_Cnav_Message
25 #include "galileo_fnav_message.h" // for Galileo_Fnav_Message
26 #include "galileo_inav_message.h" // for Galileo_Inav_Message
27 #include "gnss_block_interface.h" // for gnss_shared_ptr (adapts smart pointer type to GNU Radio version)
28 #include "gnss_satellite.h" // for Gnss_Satellite
29 #include "gnss_time.h" // for GnssTime
30 #include "nav_message_packet.h" // for Nav_Message_Packet
31 #include "tlm_conf.h" // for Tlm_Conf
32 #include <boost/circular_buffer.hpp> // for boost::circular_buffer
33 #include <gnuradio/block.h> // for block
34 #include <gnuradio/types.h> // for gr_vector_const_void_star
35 #include <pmt/pmt.h> // for pmt::pmt_t
36 #include <cstdint> // for int32_t, uint32_t
37 #include <fstream> // for std::ofstream
38 #include <memory> // for std::unique_ptr
39 #include <string> // for std::string
40 #include <vector> // for std::vector
41 
42 /** \addtogroup Telemetry_Decoder
43  * \{ */
44 /** \addtogroup Telemetry_Decoder_gnuradio_blocks
45  * \{ */
46 
47 class Viterbi_Decoder; // forward declaration
48 class Tlm_CRC_Stats; // forward declaration
49 class galileo_telemetry_decoder_gs; // forward declaration
50 
51 using galileo_telemetry_decoder_gs_sptr = gnss_shared_ptr<galileo_telemetry_decoder_gs>;
52 
53 galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs(
54  const Gnss_Satellite &satellite,
55  const Tlm_Conf &conf,
56  int frame_type);
57 
58 /*!
59  * \brief This class implements a block that decodes the INAV and FNAV data defined in Galileo ICD
60  */
61 class galileo_telemetry_decoder_gs : public gr::block
62 {
63 public:
64  ~galileo_telemetry_decoder_gs() override;
65  void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
66  void set_channel(int32_t channel); //!< Set receiver's channel
67  void reset();
68 
69  /*!
70  * \brief This is where all signal processing takes place
71  */
72  int general_work(int noutput_items, gr_vector_int &ninput_items,
73  gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
74 
75 private:
76  friend galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs(
77  const Gnss_Satellite &satellite,
78  const Tlm_Conf &conf,
79  int frame_type);
80 
81  galileo_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf, int frame_type);
82 
83  void check_tlm_separation();
84  void msg_handler_read_galileo_tow_map(const pmt::pmt_t &msg);
85  void deinterleaver(int32_t rows, int32_t cols, const float *in, float *out);
86  void decode_INAV_word(float *page_part_symbols, int32_t frame_length, double cn0);
87  void decode_FNAV_word(float *page_symbols, int32_t frame_length, double cn0);
88  void decode_CNAV_word(uint64_t time_stamp, float *page_symbols, int32_t page_length, double cn0);
89 
90  std::unique_ptr<Viterbi_Decoder> d_viterbi;
91  std::vector<int32_t> d_preamble_samples;
92  std::vector<float> d_page_part_symbols;
93 
94  std::string d_dump_filename;
95  std::ofstream d_dump_file;
96 
97  boost::circular_buffer<float> d_symbol_history;
98 
99  Gnss_Satellite d_satellite;
100 
101  // navigation message vars
102  Galileo_Cnav_Message d_cnav_nav;
103  Galileo_Inav_Message d_inav_nav;
104  Galileo_Fnav_Message d_fnav_nav;
105 
106  Nav_Message_Packet d_nav_msg_packet;
107  GnssTime d_current_timetag{};
108 
109  std::unique_ptr<Tlm_CRC_Stats> d_Tlm_CRC_Stats;
110 
111  double d_delta_t; // GPS-GALILEO time offset
112 
113  uint64_t d_symbol_counter;
114  uint64_t d_preamble_index;
115  uint64_t d_last_valid_preamble;
116  uint64_t d_received_sample_counter;
117 
118  int32_t d_mm;
119  int32_t d_codelength;
120  int32_t d_datalength;
121  int32_t d_frame_type;
122  int32_t d_bits_per_preamble;
123  int32_t d_samples_per_preamble;
124  int32_t d_preamble_period_symbols;
125  int32_t d_CRC_error_counter;
126  int32_t d_channel;
127  int32_t d_flag_even_word_arrived;
128 
129  uint32_t d_PRN_code_period_ms;
130  uint32_t d_required_symbols;
131  uint32_t d_frame_length_symbols;
132  uint32_t d_stat;
133  uint32_t d_TOW_at_Preamble_ms;
134  uint32_t d_TOW_at_current_symbol_ms;
135  uint32_t d_max_symbols_without_valid_frame;
136  uint32_t d_received_tow_ms;
137 
138  char d_band; // This variable will store which band we are dealing with (Galileo E1 or E5b)
139 
140  bool d_sent_tlm_failed_msg;
141  bool d_flag_frame_sync;
142  bool d_flag_PLL_180_deg_phase_locked;
143  bool d_flag_preamble;
144  bool d_dump;
145  bool d_dump_mat;
146  bool d_remove_dat;
147  bool d_first_eph_sent;
148  bool d_cnav_dummy_page;
149  bool d_print_cnav_page;
150  bool d_enable_navdata_monitor;
151  bool d_dump_crc_stats;
152  bool d_enable_reed_solomon_inav;
153  bool d_valid_timetag;
154  bool d_E6_TOW_set;
155  bool d_there_are_e6_channels;
156  bool d_use_ced;
157 };
158 
159 
160 /** \} */
161 /** \} */
162 #endif // GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H
class that stores both the receiver time, relative to the receiver start and the GNSS time (absolute)...
This class handles the Galileo F/NAV Data message, as described in the Galileo Open Service Signal in...
Class that computes the telemetry CRC statistics.
Definition: tlm_crc_stats.h:32
Class that contains all the configuration parameters for generic telemetry decoder block...
void set_satellite(const Gnss_Satellite &satellite)
Set satellite PRN.
This class handles the Galileo CNAV Data message, as described in the Galileo High Accuracy Service S...
Implementation of a Galileo I/NAV Data message as described in Galileo OS SIS ICD Issue 2...
This interface represents a GNSS block.
Interface of the Gnss_Satellite class.
This class handles the Galileo I/NAV Data message, as described in the Galileo Open Service Signal in...
This class represents a GNSS satellite.
Class that implements a Viterbi decoder.
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override
This is where all signal processing takes place.
Implementation of a Galileo CNAV Data message as described in Galileo High Accuracy Service Signal-In...
Implementation of a Galileo F/NAV Data message as described in Galileo OS SIS ICD Issue 1...
void set_channel(int32_t channel)
Set receiver&#39;s channel.
This class implements a block that decodes the INAV and FNAV data defined in Galileo ICD...