GNSS-SDR  0.0.14
An Open Source GNSS Software Defined Receiver
notch_cc.h
Go to the documentation of this file.
1 /*!
2  * \file notch_cc.h
3  * \brief Implements a notch filter algorithm
4  * \author Antonio Ramos (antonio.ramosdet(at)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 
18 #ifndef GNSS_SDR_NOTCH_CC_H
19 #define GNSS_SDR_NOTCH_CC_H
20 
21 #include "gnss_block_interface.h"
22 #include <gnuradio/block.h>
23 #include <gnuradio/fft/fft.h>
24 #include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
25 #include <cstdint>
26 #include <memory>
27 
28 /** \addtogroup Input_Filter
29  * \{ */
30 /** \addtogroup Input_filter_gnuradio_blocks
31  * \{ */
32 
33 
34 class Notch;
35 
36 using notch_sptr = gnss_shared_ptr<Notch>;
37 
38 notch_sptr make_notch_filter(
39  float pfa,
40  float p_c_factor,
41  int32_t length,
42  int32_t n_segments_est,
43  int32_t n_segments_reset);
44 
45 /*!
46  * \brief This class implements a real-time software-defined multi state notch filter
47  */
48 class Notch : public gr::block
49 {
50 public:
51  ~Notch() = default;
52 
53  int general_work(int noutput_items, gr_vector_int &ninput_items,
54  gr_vector_const_void_star &input_items,
55  gr_vector_void_star &output_items);
56 
57 private:
58  friend notch_sptr make_notch_filter(float pfa, float p_c_factor, int32_t length, int32_t n_segments_est, int32_t n_segments_reset);
59  Notch(float pfa, float p_c_factor, int32_t length, int32_t n_segments_est, int32_t n_segments_reset);
60 #if GNURADIO_FFT_USES_TEMPLATES
61  std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_;
62 #else
63  std::unique_ptr<gr::fft::fft_complex> d_fft_;
64 #endif
65  volk_gnsssdr::vector<gr_complex> c_samples_;
66  volk_gnsssdr::vector<float> angle_;
67  volk_gnsssdr::vector<float> power_spect_;
68  gr_complex last_out_;
69  gr_complex z_0_;
70  gr_complex p_c_factor_;
71  float pfa_;
72  float noise_pow_est_;
73  float thres_;
74  int32_t length_;
75  int32_t n_deg_fred_;
76  uint32_t n_segments_;
77  uint32_t n_segments_est_;
78  uint32_t n_segments_reset_;
79  bool filter_state_;
80 };
81 
82 
83 /** \} */
84 /** \} */
85 #endif // GNSS_SDR_NOTCH_CC_H
This class implements a real-time software-defined multi state notch filter.
Definition: notch_cc.h:48
This interface represents a GNSS block.