GNSS-SDR  0.0.19
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 "gnss_sdr_fft.h"
23 #include <gnuradio/block.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 
61  std::unique_ptr<gnss_fft_complex_fwd> d_fft_;
62  volk_gnsssdr::vector<gr_complex> c_samples_;
63  volk_gnsssdr::vector<float> angle_;
64  volk_gnsssdr::vector<float> power_spect_;
65  gr_complex last_out_;
66  gr_complex z_0_;
67  gr_complex p_c_factor_;
68  float pfa_;
69  float noise_pow_est_;
70  float thres_;
71  int32_t length_;
72  int32_t n_deg_fred_;
73  uint32_t n_segments_;
74  uint32_t n_segments_est_;
75  uint32_t n_segments_reset_;
76  bool filter_state_;
77 };
78 
79 
80 /** \} */
81 /** \} */
82 #endif // GNSS_SDR_NOTCH_CC_H
This class implements a real-time software-defined multi state notch filter.
Definition: notch_cc.h:48
Helper file for FFT interface.
This interface represents a GNSS block.