diff --git a/src/algorithms/input_filter/adapters/notch_filter.cc b/src/algorithms/input_filter/adapters/notch_filter.cc
index 665d634b0..31fb6a93d 100644
--- a/src/algorithms/input_filter/adapters/notch_filter.cc
+++ b/src/algorithms/input_filter/adapters/notch_filter.cc
@@ -47,17 +47,25 @@ NotchFilter::NotchFilter(ConfigurationInterface* configuration, std::string role
out_streams_(out_streams)
{
size_t item_size_;
+ double pfa;
+ double default_pfa = 0.001;
+ double p_c_factor;
+ double default_p_c_factor = 0.9;
+ unsigned int length_;
+ unsigned int default_length_ = 5;
std::string default_item_type = "gr_complex";
std::string default_dump_file = "./data/input_filter.dat";
item_type_ = configuration->property(role + ".item_type", default_item_type);
dump_ = configuration->property(role + ".dump", false);
DLOG(INFO) << "dump_ is " << dump_;
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
-
+ pfa = configuration->property(role + ".pfa", default_pfa);
+ p_c_factor = configuration->property(role + ".p_c_factor", default_p_c_factor);
+ length_ = configuration->property(role + ".length", default_length_);
if (item_type_.compare("gr_complex") == 0)
{
item_size_ = sizeof(gr_complex);
- notch_filter_ = make_notch_filter();
+ notch_filter_ = make_notch_filter(pfa, p_c_factor, length_);
DLOG(INFO) << "Item size " << item_size_;
DLOG(INFO) << "input filter(" << notch_filter_->unique_id() << ")";
diff --git a/src/algorithms/input_filter/adapters/notch_filter.h b/src/algorithms/input_filter/adapters/notch_filter.h
index 31ae255ba..9341cd77b 100644
--- a/src/algorithms/input_filter/adapters/notch_filter.h
+++ b/src/algorithms/input_filter/adapters/notch_filter.h
@@ -70,7 +70,6 @@ public:
private:
- ConfigurationInterface* config_;
bool dump_;
std::string dump_filename_;
std::string role_;
diff --git a/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc b/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc
index e69de29bb..a802c67a0 100644
--- a/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc
+++ b/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc
@@ -0,0 +1,64 @@
+/*!
+ * \file notch_cc.cc
+ * \brief Implements a multi state notch filter algorithm
+ * \author Antonio Ramos (antonio.ramosdet(at)gmail.com)
+ *
+ * -------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
+ *
+ * GNSS-SDR is a software defined Global Navigation
+ * Satellite Systems receiver
+ *
+ * This file is part of GNSS-SDR.
+ *
+ * GNSS-SDR is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GNSS-SDR is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNSS-SDR. If not, see .
+ *
+ * -------------------------------------------------------------------------
+ */
+
+#include "notch_cc.h"
+#include
+#include
+#include
+#include
+#include
+
+notch_sptr make_notch_filter(double pfa, double p_c_factor,
+ unsigned int length_)
+{
+ return notch_sptr(new Notch(pfa, p_c_factor, length_));
+}
+
+Notch::Notch(double pfa, double p_c_factor, unsigned int length_) : gr::block("Notch",
+ gr::io_signature::make (1, 1, sizeof(gr_complex)),
+ gr::io_signature::make (1, 1, sizeof(gr_complex)))
+{
+ this->pfa = pfa;
+ this->noise_pow_est = 0.0;
+ this->p_c_factor = p_c_factor;
+ this->length_ = length_;
+ filter_state_ = 0;
+ n_deg_fred = 2 * length_;
+ z_0 = gr_complex(0 , 0);
+ thres_ =
+
+}
+
+
+int Notch::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
+ gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
+{
+
+}
diff --git a/src/algorithms/input_filter/gnuradio_blocks/notch_cc.h b/src/algorithms/input_filter/gnuradio_blocks/notch_cc.h
index a3727c73f..6a34d0955 100644
--- a/src/algorithms/input_filter/gnuradio_blocks/notch_cc.h
+++ b/src/algorithms/input_filter/gnuradio_blocks/notch_cc.h
@@ -31,6 +31,44 @@
#ifndef GNSS_SDR_NOTCH_H_
#define GNSS_SDR_NOTCH_H_
+#include
+#include
+class Notch;
-#endif //GNSS_SDR_NOTCH_H_
\ No newline at end of file
+typedef boost::shared_ptr notch_sptr;
+
+notch_sptr make_notch_filter(double pfa, double p_c_factor,
+ unsigned int length_);
+
+/*!
+ * \brief This class implements a real-time software-defined multi state notch filter
+ */
+
+class Notch: public gr::block
+{
+private:
+
+ friend notch_sptr make_notch_filter(double pfa, double p_c_factor,
+ unsigned int length_);
+ double pfa;
+ double noise_pow_est;
+ double p_c_factor;
+ double thres_;
+ unsigned int length_;
+ unsigned int n_deg_fred;
+ unsigned int filter_state_;
+ gr_complex z_0;
+
+
+public:
+
+ Notch(double pfa, double p_c_factor, unsigned int length_);
+
+ ~Notch();
+
+ int work (int noutput_items, gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif //GNSS_SDR_NOTCH_H_