GNU Radio's IRIDIUM Package
fft_burst_tagger_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2020 Free Software Foundation, Inc.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_IRIDIUM_FFT_BURST_TAGGER_IMPL_H
22 #define INCLUDED_IRIDIUM_FFT_BURST_TAGGER_IMPL_H
23 
25 #include <gnuradio/fft/fft.h>
26 
27 namespace gr {
28  namespace iridium {
29 
30  struct burst {
31  uint64_t start;
32  uint64_t stop;
33  uint64_t last_active;
35  float magnitude;
36  float noise;
37  uint64_t id;
38  };
39 
40  struct peak {
41  int bin;
43  };
44 
46  {
47  private:
48  bool d_history_primed;
49  bool d_debug;
50  bool d_offline;
51 
52  int d_fft_size;
53  int d_burst_pre_len;
54  int d_history_size;
55  int d_burst_width;
56  int d_history_index;
57  int d_burst_post_len;
58  int d_max_bursts;
59  int d_sample_rate;
60  uint64_t d_index;
61  uint64_t d_burst_id;
62  uint64_t d_n_tagged_bursts;
63  uint64_t d_sample_count;
64  uint64_t d_last_rx_time_offset;
65  uint64_t d_last_rx_time_timestamp;
66 
67  float * d_window_f;
68  float * d_magnitude_f;
69  float * d_magnitude_shifted_f;
70  float * d_baseline_sum_f;
71  float * d_baseline_history_f;
72  float * d_relative_magnitude_f;
73  float * d_burst_mask_f;
74  float * d_ones_f;
75  float d_threshold;
76  double d_center_frequency;
77  float d_window_enbw;
78 
79  FILE * d_burst_debug_file;
80 
81  gr::fft::fft_complex *d_fft;
82  std::vector<peak> d_peaks;
83  std::vector<burst> d_bursts;
84  std::vector<burst> d_new_bursts;
85  std::vector<burst> d_gone_bursts;
86 
87  bool update_filters_pre(void);
88  void update_filters_post(void);
89  void extract_peaks(void);
90  void save_peaks_to_debug_file(char * filename);
91  void remove_peaks_around_bursts(void);
92  void update_burst_mask(void);
93  void update_bursts(void);
94  void delete_gone_bursts(void);
95  void create_new_bursts(void);
96  void mask_burst(burst &b);
97  void tag_new_bursts(void);
98  void tag_gone_bursts(int noutput_items);
99 
100  public:
101  fft_burst_tagger_impl(double center_frequency, int fft_size, int sample_rate,
102  int burst_pre_len, int burst_post_len, int burst_width,
103  int max_bursts, float threshold, int history_size,
104  bool offline, bool debug);
106 
107  uint64_t get_n_tagged_bursts();
108  uint64_t get_sample_count();
109 
110  int work(int noutput_items,
111  gr_vector_const_void_star &input_items,
112  gr_vector_void_star &output_items);
113  };
114 
115  } // namespace iridium
116 } // namespace gr
117 
118 #endif /* INCLUDED_IRIDIUM_FFT_BURST_TAGGER_IMPL_H */
119 
int bin
Definition: fft_burst_tagger_impl.h:41
uint64_t id
Definition: fft_burst_tagger_impl.h:37
Definition: fft_burst_tagger_impl.h:45
Definition: fft_burst_tagger_impl.h:30
uint64_t start
Definition: fft_burst_tagger_impl.h:31
<+description of block+>
Definition: fft_burst_tagger.h:35
float noise
Definition: fft_burst_tagger_impl.h:36
Definition: fft_burst_tagger_impl.h:40
uint64_t stop
Definition: fft_burst_tagger_impl.h:32
uint64_t last_active
Definition: fft_burst_tagger_impl.h:33
Definition: burst_downmix.h:27
int center_bin
Definition: fft_burst_tagger_impl.h:34
float relative_magnitude
Definition: fft_burst_tagger_impl.h:42
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Definition: iridium.h:2
float magnitude
Definition: fft_burst_tagger_impl.h:35
fft_burst_tagger_impl(double center_frequency, int fft_size, int sample_rate, int burst_pre_len, int burst_post_len, int burst_width, int max_bursts, float threshold, int history_size, bool offline, bool debug)