mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
New lines in notch filter files
Adapter is ready and gnuradio block in progress
This commit is contained in:
parent
93de803b41
commit
cf516566d6
@ -47,17 +47,25 @@ NotchFilter::NotchFilter(ConfigurationInterface* configuration, std::string role
|
|||||||
out_streams_(out_streams)
|
out_streams_(out_streams)
|
||||||
{
|
{
|
||||||
size_t item_size_;
|
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_item_type = "gr_complex";
|
||||||
std::string default_dump_file = "./data/input_filter.dat";
|
std::string default_dump_file = "./data/input_filter.dat";
|
||||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||||
dump_ = configuration->property(role + ".dump", false);
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
DLOG(INFO) << "dump_ is " << dump_;
|
DLOG(INFO) << "dump_ is " << dump_;
|
||||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
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)
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
{
|
{
|
||||||
item_size_ = sizeof(gr_complex);
|
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) << "Item size " << item_size_;
|
||||||
DLOG(INFO) << "input filter(" << notch_filter_->unique_id() << ")";
|
DLOG(INFO) << "input filter(" << notch_filter_->unique_id() << ")";
|
||||||
|
|
||||||
|
@ -70,7 +70,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ConfigurationInterface* config_;
|
|
||||||
bool dump_;
|
bool dump_;
|
||||||
std::string dump_filename_;
|
std::string dump_filename_;
|
||||||
std::string role_;
|
std::string role_;
|
||||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "notch_cc.h"
|
||||||
|
#include <boost/math/distributions/chi_squared.hpp>
|
||||||
|
#include <cmath>
|
||||||
|
#include <complex>
|
||||||
|
#include <gnuradio/block.h>
|
||||||
|
#include <gnuradio/io_signature.h>
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -31,6 +31,44 @@
|
|||||||
#ifndef GNSS_SDR_NOTCH_H_
|
#ifndef GNSS_SDR_NOTCH_H_
|
||||||
#define GNSS_SDR_NOTCH_H_
|
#define GNSS_SDR_NOTCH_H_
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <gnuradio/block.h>
|
||||||
|
|
||||||
|
class Notch;
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<Notch> 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_
|
#endif //GNSS_SDR_NOTCH_H_
|
Loading…
Reference in New Issue
Block a user