GNSS-SDR  0.0.14
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  *
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_GALILEO_TELEMETRY_DECODER_GS_H
21 #define GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H
22 
23 #include "galileo_cnav_message.h"
24 #include "galileo_fnav_message.h"
25 #include "galileo_inav_message.h"
26 #include "gnss_block_interface.h"
27 #include "gnss_satellite.h"
28 #include "tlm_conf.h"
29 #include <boost/circular_buffer.hpp>
30 #include <gnuradio/block.h> // for block
31 #include <gnuradio/types.h> // for gr_vector_const_void_star
32 #include <cstdint>
33 #include <fstream>
34 #include <string>
35 #include <vector>
36 
37 /** \addtogroup Telemetry_Decoder
38  * \{ */
39 /** \addtogroup Telemetry_Decoder_gnuradio_blocks
40  * \{ */
41 
42 
44 
45 using galileo_telemetry_decoder_gs_sptr = gnss_shared_ptr<galileo_telemetry_decoder_gs>;
46 
47 galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs(
48  const Gnss_Satellite &satellite,
49  const Tlm_Conf &conf,
50  int frame_type);
51 
52 /*!
53  * \brief This class implements a block that decodes the INAV and FNAV data defined in Galileo ICD
54  */
55 class galileo_telemetry_decoder_gs : public gr::block
56 {
57 public:
59  void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
60  void set_channel(int32_t channel); //!< Set receiver's channel
61  void reset();
62  int32_t flag_even_word_arrived;
63 
64  /*!
65  * \brief This is where all signal processing takes place
66  */
67  int general_work(int noutput_items, gr_vector_int &ninput_items,
68  gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
69 
70 
71 private:
72  friend galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs(
73  const Gnss_Satellite &satellite,
74  const Tlm_Conf &conf,
75  int frame_type);
76 
77  galileo_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf, int frame_type);
78 
79  const int32_t d_nn = 2; // Coding rate 1/n
80  const int32_t d_KK = 7; // Constraint Length
81 
82  void viterbi_decoder(float *page_part_symbols, int32_t *page_part_bits);
83  void deinterleaver(int32_t rows, int32_t cols, const float *in, float *out);
84  void decode_INAV_word(float *page_part_symbols, int32_t frame_length);
85  void decode_FNAV_word(float *page_symbols, int32_t frame_length);
86  void decode_CNAV_word(float *page_symbols, int32_t page_length);
87 
88  // vars for Viterbi decoder
89  std::vector<int32_t> d_preamble_samples;
90  std::vector<float> d_page_part_symbols;
91  std::vector<int32_t> d_out0;
92  std::vector<int32_t> d_out1;
93  std::vector<int32_t> d_state0;
94  std::vector<int32_t> d_state1;
95 
96  std::string d_dump_filename;
97  std::ofstream d_dump_file;
98 
99  boost::circular_buffer<float> d_symbol_history;
100 
101  Gnss_Satellite d_satellite;
102 
103  // navigation message vars
104  Galileo_Cnav_Message d_cnav_nav;
105  Galileo_Inav_Message d_inav_nav;
106  Galileo_Fnav_Message d_fnav_nav;
107 
108  double d_delta_t; // GPS-GALILEO time offset
109 
110  uint64_t d_sample_counter;
111  uint64_t d_preamble_index;
112  uint64_t d_last_valid_preamble;
113 
114  int32_t d_mm = d_KK - 1;
115  int32_t d_codelength;
116  int32_t d_datalength;
117  int32_t d_frame_type;
118  int32_t d_bits_per_preamble;
119  int32_t d_samples_per_preamble;
120  int32_t d_preamble_period_symbols;
121  int32_t d_CRC_error_counter;
122  int32_t d_channel;
123 
124  uint32_t d_PRN_code_period_ms;
125  uint32_t d_required_symbols;
126  uint32_t d_frame_length_symbols;
127  uint32_t d_stat;
128  uint32_t d_TOW_at_Preamble_ms;
129  uint32_t d_TOW_at_current_symbol_ms;
130  uint32_t d_max_symbols_without_valid_frame;
131 
132  char d_band; // This variable will store which band we are dealing with (Galileo E1 or E5b)
133 
134  bool d_sent_tlm_failed_msg;
135  bool d_flag_frame_sync;
136  bool d_flag_PLL_180_deg_phase_locked;
137  bool d_flag_parity;
138  bool d_flag_preamble;
139  bool d_dump;
140  bool d_dump_mat;
141  bool d_remove_dat;
142 };
143 
144 
145 /** \} */
146 /** \} */
147 #endif // GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H
This class handles the Galileo F/NAV Data message, as described in the Galileo Open Service Signal in...
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
This is where all signal processing takes place.
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 E...
Implementation of a Galileo I/NAV Data message as described in Galileo OS SIS ICD Issue 1...
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.
Implementation of a Galileo CNAV Data message as described in Galileo High Accuracy Service E6-B Sign...
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...