GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
gps_l1_ca_telemetry_decoder_gs.h
Go to the documentation of this file.
1 /*!
2  * \file gps_l1_ca_telemetry_decoder_gs.h
3  * \brief Interface of a NAV message demodulator block based on
4  * Kay Borre book MATLAB-based GPS receiver
5  * \author Javier Arribas, 2011. jarribas(at)cttc.es
6  * \author Carles Fernandez Prades, 2011-2026. cfernandez(at)cttc.es
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-2026 (see AUTHORS file for a list of contributors)
14  * SPDX-License-Identifier: GPL-3.0-or-later
15  *
16  * -----------------------------------------------------------------------------
17  */
18 
19 #ifndef GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_GS_H
20 #define GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_GS_H
21 
22 #include "GPS_L1_CA.h"
23 #include "gnss_synchro.h"
24 #include "gnss_time.h" // for timetags produced by Tracking
25 #include "gps_navigation_message.h"
26 #include "nav_message_packet.h"
28 #include "tlm_conf.h"
29 #include <boost/circular_buffer.hpp>
30 #include <gnuradio/types.h> // for gr_vector_const_void_star
31 #include <array> // for array
32 
33 
34 /** \addtogroup Telemetry_Decoder
35  * \{ */
36 /** \addtogroup Telemetry_Decoder_gnuradio_blocks telemetry_decoder_gr_blocks
37  * GNU Radio blocks for the demodulation of GNSS navigation messages.
38  * \{ */
39 
40 enum class L1LnavSystem
41 {
42  GPS,
43  QZSS
44 };
45 
47 
48 using gps_l1_ca_telemetry_decoder_gs_sptr = gnss_shared_ptr<gps_l1_ca_telemetry_decoder_gs>;
49 
50 gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs(
51  const Gnss_Satellite &satellite,
52  const Tlm_Conf &conf,
53  L1LnavSystem system = L1LnavSystem::GPS);
54 
55 /*!
56  * \brief This class implements a block that decodes the NAV data defined in IS-GPS-200M
57  */
59 {
60 public:
62  void set_satellite(const Gnss_Satellite &satellite) override; //!< Set satellite PRN
63  void set_channel(int channel) override; //!< Set receiver's channel
64  void reset() override;
65 
66  /*!
67  * \brief This is where all signal processing takes place
68  */
69  int general_work(int noutput_items, gr_vector_int &ninput_items,
70  gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
71 
72 private:
73  friend gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs(
74  const Gnss_Satellite &satellite,
75  const Tlm_Conf &conf,
76  L1LnavSystem system);
77 
78  gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf, L1LnavSystem system);
79 
80  void check_tlm_separation();
81  void frame_synchronization(const Gnss_Synchro &current_gs);
82  bool is_PLL_180_deg_phase_locked();
83  bool gps_word_parityCheck(uint32_t gpsword);
84  bool decode_subframe(double cn0, bool flag_invert);
85  bool is_tow_consistent(uint32_t decoded_tow_s);
86 
87  L1LnavSystem d_system;
88  std::unique_ptr<Gps_Navigation_Message> d_nav;
89  Gnss_Satellite d_satellite;
90  Nav_Message_Packet d_nav_msg_packet;
91  std::unique_ptr<Tlm_CRC_Stats> d_Tlm_CRC_Stats;
92 
93  std::array<int32_t, GPS_CA_PREAMBLE_LENGTH_BITS> d_preamble_samples{};
94 
95  std::string d_dump_filename;
96  std::ofstream d_dump_file;
97 
98  boost::circular_buffer<float> d_symbol_history;
99 
100  uint64_t d_sample_counter;
101  uint64_t d_preamble_index;
102  uint64_t d_last_valid_preamble;
103 
104  int32_t d_bits_per_preamble;
105  int32_t d_samples_per_preamble;
106  int32_t d_preamble_period_symbols;
107  int32_t d_CRC_error_counter;
108  int32_t d_channel;
109 
110  uint32_t d_required_symbols;
111  uint32_t d_prev_GPS_frame_4bytes;
112  uint32_t d_max_symbols_without_valid_frame;
113  uint32_t d_stat;
114  uint32_t d_TOW_at_Preamble_ms;
115  uint32_t d_TOW_at_current_symbol_ms;
116  uint32_t d_last_decoded_tow_s;
117  uint64_t d_last_decoded_tow_sample_counter;
118 
119  bool d_flag_frame_sync;
120  bool d_flag_preamble;
121  bool d_sent_tlm_failed_msg;
122  bool d_flag_PLL_180_deg_phase_locked;
123  bool d_flag_TOW_set;
124  bool d_dump;
125  bool d_dump_mat;
126  bool d_remove_dat;
127  bool d_enable_navdata_monitor;
128  bool d_dump_crc_stats;
129  bool d_tow_to_trk;
130  bool d_have_last_decoded_tow;
131 };
132 
133 
134 /** \} */
135 /** \} */
136 #endif // GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_GS_H
class that stores both the receiver time, relative to the receiver start and the GNSS time (absolute)...
Common base class for telemetry decoder GNU Radio implementations.
void set_channel(int channel) override
Set receiver&#39;s channel.
Defines system parameters for GPS L1 C/A signal and NAV data.
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.
Class that contains all the configuration parameters for generic telemetry decoder block...
This class implements a block that decodes the NAV data defined in IS-GPS-200M.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
void set_satellite(const Gnss_Satellite &satellite) override
Set satellite PRN.
This class represents a GNSS satellite.
Base class for telemetry decoder GNU Radio blocks.
Interface of a GPS NAV Data message decoder.
Interface of the Gnss_Synchro class.