1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-16 20:23:02 +00:00

Improved Pulse Blanking Filter

Number of signal segments for estimating the noise power is passed now as a parameter in the configuration file
This commit is contained in:
Antonio Ramos 2017-07-12 09:12:56 +02:00
parent cbe54da10f
commit 8f1fcb382a
4 changed files with 25 additions and 17 deletions

View File

@ -42,7 +42,6 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration,
out_streams_(out_streams) out_streams_(out_streams)
{ {
size_t item_size; size_t item_size;
std::string default_input_item_type = "gr_complex"; std::string default_input_item_type = "gr_complex";
std::string default_output_item_type = "gr_complex"; std::string default_output_item_type = "gr_complex";
std::string default_dump_filename = "../data/input_filter.dat"; std::string default_dump_filename = "../data/input_filter.dat";
@ -53,15 +52,19 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration,
output_item_type_ = config_->property(role_ + ".output_item_type", default_output_item_type); output_item_type_ = config_->property(role_ + ".output_item_type", default_output_item_type);
dump_ = config_->property(role_ + ".dump", false); dump_ = config_->property(role_ + ".dump", false);
dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename); dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename);
float default_pfa_ = 0.001; float default_pfa_ = 0.01;
float pfa = config_->property(role_ + ".pfa", default_pfa_); float pfa = config_->property(role_ + ".pfa", default_pfa_);
int default_length_ = 32; int default_length_ = 16;
int length_ = config_->property(role_ + ".length", default_length_); int length_ = config_->property(role_ + ".length", default_length_);
int default_n_segments_est = 25000;
int n_segments_est = config_->property(role_ + ".segments_estimation", default_n_segments_est);
int default_n_segments_reset = 500000;
int n_segments_reset = config_->property(role_ + ".segments_reset", default_n_segments_reset);
if (input_item_type_.compare("gr_complex") == 0) if (input_item_type_.compare("gr_complex") == 0)
{ {
item_size = sizeof(gr_complex); //output item_size = sizeof(gr_complex); //output
input_size_ = sizeof(gr_complex); //input input_size_ = sizeof(gr_complex); //input
pulse_blanking_cc_ = make_pulse_blanking_cc(pfa, length_); pulse_blanking_cc_ = make_pulse_blanking_cc(pfa, length_, n_segments_est, n_segments_reset);
} }
else else
{ {

View File

@ -39,9 +39,6 @@
class ConfigurationInterface; class ConfigurationInterface;
/*!
* \brief TODO
*/
class PulseBlankingFilter: public GNSSBlockInterface class PulseBlankingFilter: public GNSSBlockInterface
{ {
public: public:

View File

@ -34,15 +34,19 @@
#include <complex> #include <complex>
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <volk/volk.h> #include <volk/volk.h>
#include <glog/logging.h>
pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int length_) using google::LogMessage;
pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int length_,
int n_segments_est, int n_segments_reset)
{ {
return pulse_blanking_cc_sptr(new pulse_blanking_cc(pfa, length_)); return pulse_blanking_cc_sptr(new pulse_blanking_cc(pfa, length_, n_segments_est, n_segments_reset));
} }
pulse_blanking_cc::pulse_blanking_cc(float pfa, int length_) : gr::block("pulse_blanking_cc", pulse_blanking_cc::pulse_blanking_cc(float pfa, int length_, int n_segments_est, int n_segments_reset) : gr::block("pulse_blanking_cc",
gr::io_signature::make (1, 1, sizeof(gr_complex)), gr::io_signature::make (1, 1, sizeof(gr_complex)),
gr::io_signature::make (1, 1, sizeof(gr_complex))) gr::io_signature::make (1, 1, sizeof(gr_complex)))
{ {
@ -53,8 +57,8 @@ pulse_blanking_cc::pulse_blanking_cc(float pfa, int length_) : gr::block("pulse_
set_output_multiple(length_); set_output_multiple(length_);
last_filtered = false; last_filtered = false;
n_segments = 0; n_segments = 0;
n_segments_est = 8; this->n_segments_est = n_segments_est;
n_segments_reset = 10000; this->n_segments_reset = n_segments_reset;
noise_power_estimation = 0.0; noise_power_estimation = 0.0;
n_deg_fred = 2*length_; n_deg_fred = 2*length_;
boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred); boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred);
@ -64,13 +68,13 @@ pulse_blanking_cc::pulse_blanking_cc(float pfa, int length_) : gr::block("pulse_
for (int aux = 0; aux < length_; aux++) for (int aux = 0; aux < length_; aux++)
{ {
zeros_[aux] = gr_complex(0, 0); zeros_[aux] = gr_complex(0, 0);
} }
} }
pulse_blanking_cc::~pulse_blanking_cc() pulse_blanking_cc::~pulse_blanking_cc()
{ {
volk_free(zeros_); volk_free(zeros_);
volk_free(magnitude); volk_free(magnitude);
} }
int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
@ -87,7 +91,7 @@ int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)),
if((n_segments < n_segments_est) && (last_filtered == false)) if((n_segments < n_segments_est) && (last_filtered == false))
{ {
noise_power_estimation = (((float) n_segments) * noise_power_estimation + segment_energy / ((float)n_deg_fred)) / ((float)(n_segments + 1)); noise_power_estimation = (((float) n_segments) * noise_power_estimation + segment_energy / ((float)n_deg_fred)) / ((float)(n_segments + 1));
memcpy(out, in, sizeof(gr_complex)*length_); memcpy(out, in, sizeof(gr_complex)*length_);
} }
else else
{ {

View File

@ -38,12 +38,13 @@ class pulse_blanking_cc;
typedef boost::shared_ptr<pulse_blanking_cc> pulse_blanking_cc_sptr; typedef boost::shared_ptr<pulse_blanking_cc> pulse_blanking_cc_sptr;
pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int length_); pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int length_, int n_segments_est, int n_segments_reset);
class pulse_blanking_cc : public gr::block class pulse_blanking_cc : public gr::block
{ {
private: private:
int length_; int length_;
int n_segments; int n_segments;
int n_segments_est; int n_segments_est;
@ -55,13 +56,16 @@ private:
float pfa; float pfa;
float* magnitude; float* magnitude;
gr_complex* zeros_; gr_complex* zeros_;
public: public:
pulse_blanking_cc(float pfa, int length_);
pulse_blanking_cc(float pfa, int length_, int n_segments_est, int n_segments_reset);
~pulse_blanking_cc(); ~pulse_blanking_cc();
int general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), int 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); gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
}; };
#endif #endif