GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
signal_generator_c.h
Go to the documentation of this file.
1 /*!
2  * \file signal_generator_c.h
3  * \brief GNU Radio source block that generates synthesized GNSS signal.
4  * \author Marc Molina, 2013. marc.molina.pena@gmail.com
5  *
6  * -----------------------------------------------------------------------------
7  *
8  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9  * This file is part of GNSS-SDR.
10  *
11  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12  * SPDX-License-Identifier: GPL-3.0-or-later
13  *
14  * -----------------------------------------------------------------------------
15  */
16 
17 #ifndef GNSS_SDR_SIGNAL_GENERATOR_C_H
18 #define GNSS_SDR_SIGNAL_GENERATOR_C_H
19 
20 #include "gnss_block_interface.h"
21 #include <gnuradio/block.h>
22 #include <random>
23 #include <string>
24 #include <vector>
25 
26 
27 class signal_generator_c;
28 
29 using signal_generator_c_sptr = gnss_shared_ptr<signal_generator_c>;
30 
31 /*!
32  * \brief Return a shared_ptr to a new instance of gen_source.
33  *
34  * To avoid accidental use of raw pointers, gen_source's
35  * constructor is private. signal_make_generator_c is the public
36  * interface for creating new instances.
37  */
38 signal_generator_c_sptr signal_make_generator_c(
39  const std::vector<std::string> &signal1,
40  const std::vector<std::string> &system,
41  const std::vector<unsigned int> &PRN,
42  const std::vector<float> &CN0_dB,
43  const std::vector<float> &doppler_Hz,
44  const std::vector<unsigned int> &delay_chips,
45  const std::vector<unsigned int> &delay_sec,
46  bool data_flag,
47  bool noise_flag,
48  unsigned int fs_in,
49  unsigned int vector_length,
50  float BW_BB);
51 
52 /*!
53  * \brief This class generates synthesized GNSS signal.
54  * \ingroup block
55  *
56  * \sa gen_source for a version that subclasses gr_block.
57  */
58 class signal_generator_c : public gr::block
59 {
60 public:
61  ~signal_generator_c() = default; // public destructor
62 
63  // Where all the action really happens
64  int general_work(int noutput_items,
65  gr_vector_int &ninput_items,
66  gr_vector_const_void_star &input_items,
67  gr_vector_void_star &output_items);
68 
69 private:
70  friend signal_generator_c_sptr signal_make_generator_c(
71  const std::vector<std::string> &signal1,
72  const std::vector<std::string> &system,
73  const std::vector<unsigned int> &PRN,
74  const std::vector<float> &CN0_dB,
75  const std::vector<float> &doppler_Hz,
76  const std::vector<unsigned int> &delay_chips,
77  const std::vector<unsigned int> &delay_sec,
78  bool data_flag,
79  bool noise_flag,
80  unsigned int fs_in,
81  unsigned int vector_length,
82  float BW_BB);
83 
85  std::vector<std::string> signal1,
86  std::vector<std::string> system,
87  const std::vector<unsigned int> &PRN,
88  std::vector<float> CN0_dB,
89  std::vector<float> doppler_Hz,
90  std::vector<unsigned int> delay_chips,
91  std::vector<unsigned int> delay_sec,
92  bool data_flag,
93  bool noise_flag,
94  unsigned int fs_in,
95  unsigned int vector_length,
96  float BW_BB);
97 
98  void init();
99 
100  void generate_codes();
101 
102  std::random_device r;
103  std::uniform_int_distribution<int> uniform_dist;
104  std::normal_distribution<float> normal_dist;
105  std::vector<std::string> signal_;
106  std::vector<std::string> system_;
107  std::vector<std::vector<gr_complex>> sampled_code_data_;
108  std::vector<std::vector<gr_complex>> sampled_code_pilot_;
109  std::vector<gr_complex> current_data_bits_;
110  std::vector<gr_complex> complex_phase_;
111  std::vector<float> CN0_dB_;
112  std::vector<float> doppler_Hz_;
113  std::vector<float> start_phase_rad_;
114  std::vector<unsigned int> PRN_;
115  std::vector<unsigned int> delay_chips_;
116  std::vector<unsigned int> delay_sec_;
117  std::vector<unsigned int> samples_per_code_;
118  std::vector<unsigned int> num_of_codes_per_vector_;
119  std::vector<unsigned int> data_bit_duration_ms_;
120  std::vector<unsigned int> ms_counter_;
121  std::vector<signed int> current_data_bit_int_;
122  std::vector<signed int> data_modulation_;
123  std::vector<signed int> pilot_modulation_;
124  float BW_BB_;
125  unsigned int work_counter_{};
126  unsigned int fs_in_;
127  unsigned int num_sats_;
128  unsigned int vector_length_;
129  bool data_flag_;
130  bool noise_flag_;
131 };
132 
133 #endif // GNSS_SDR_SIGNAL_GENERATOR_C_H
This class generates synthesized GNSS signal.
This interface represents a GNSS block.
signal_generator_c_sptr signal_make_generator_c(const std::vector< std::string > &signal1, const std::vector< std::string > &system, const std::vector< unsigned int > &PRN, const std::vector< float > &CN0_dB, const std::vector< float > &doppler_Hz, const std::vector< unsigned int > &delay_chips, const std::vector< unsigned int > &delay_sec, bool data_flag, bool noise_flag, unsigned int fs_in, unsigned int vector_length, float BW_BB)
Return a shared_ptr to a new instance of gen_source.
friend signal_generator_c_sptr signal_make_generator_c(const std::vector< std::string > &signal1, const std::vector< std::string > &system, const std::vector< unsigned int > &PRN, const std::vector< float > &CN0_dB, const std::vector< float > &doppler_Hz, const std::vector< unsigned int > &delay_chips, const std::vector< unsigned int > &delay_sec, bool data_flag, bool noise_flag, unsigned int fs_in, unsigned int vector_length, float BW_BB)
Return a shared_ptr to a new instance of gen_source.