diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index 7dfe27b62..cedad7741 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -42,7 +42,6 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, out_streams_(out_streams) { size_t item_size; - std::string default_input_item_type = "gr_complex"; std::string default_output_item_type = "gr_complex"; 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); dump_ = config_->property(role_ + ".dump", false); 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_); - int default_length_ = 32; + int default_length_ = 16; 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) { item_size = sizeof(gr_complex); //output 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 { diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.h b/src/algorithms/input_filter/adapters/pulse_blanking_filter.h index 4382e4281..041ba2251 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.h +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.h @@ -39,9 +39,6 @@ class ConfigurationInterface; -/*! - * \brief TODO - */ class PulseBlankingFilter: public GNSSBlockInterface { public: diff --git a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc index c7cfc0475..ec758e511 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc +++ b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc @@ -34,15 +34,19 @@ #include #include #include +#include -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))) { @@ -53,8 +57,8 @@ pulse_blanking_cc::pulse_blanking_cc(float pfa, int length_) : gr::block("pulse_ set_output_multiple(length_); last_filtered = false; n_segments = 0; - n_segments_est = 8; - n_segments_reset = 10000; + this->n_segments_est = n_segments_est; + this->n_segments_reset = n_segments_reset; noise_power_estimation = 0.0; n_deg_fred = 2*length_; boost::math::chi_squared_distribution 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++) { zeros_[aux] = gr_complex(0, 0); - } + } } pulse_blanking_cc::~pulse_blanking_cc() { 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)), @@ -87,7 +91,7 @@ int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)), 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)); - memcpy(out, in, sizeof(gr_complex)*length_); + memcpy(out, in, sizeof(gr_complex)*length_); } else { diff --git a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.h b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.h index 620e4731f..1bb9a7550 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.h +++ b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.h @@ -38,12 +38,13 @@ class pulse_blanking_cc; typedef boost::shared_ptr 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 { private: + int length_; int n_segments; int n_segments_est; @@ -55,13 +56,16 @@ private: float pfa; float* magnitude; gr_complex* zeros_; + 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(); 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); + }; #endif