From dceb15acdc4d8783434cbb26daea9251318c0d5d Mon Sep 17 00:00:00 2001 From: Antonio Ramos Date: Tue, 31 Oct 2017 20:28:34 +0100 Subject: [PATCH 1/6] Baseband downconverting PulseBlanking Added an IF to baseband downconverting stage previous to the pulse blanking filter --- .../adapters/pulse_blanking_filter.cc | 26 +++++++++++++++++-- .../adapters/pulse_blanking_filter.h | 2 ++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index e6bcc2632..454434baa 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -32,6 +32,7 @@ #include #include #include "configuration_interface.h" +#include using google::LogMessage; @@ -71,7 +72,13 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, item_size = sizeof(gr_complex); //avoids uninitialization input_size_ = sizeof(gr_complex); //avoids uninitialization } - + float default_if = 0.0; + float if_ = config_->property(role_ + ".if", default_if); + if (if_ > 0.0) + { + const std::vector taps = { 1.0 }; //All-pass filter + freq_xlating_ = gr::filter::freq_xlating_fir_filter_ccf::make(1, taps, if_, config_->property("SignalSource.sampling_frequency", 2000000)); + } if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; @@ -95,6 +102,10 @@ void PulseBlankingFilter::connect(gr::top_block_sptr top_block) { top_block->connect(pulse_blanking_cc_, 0, file_sink_, 0); } + if (config_->property(role_ + ".if", 0.0) > 0.0) + { + top_block->connect(freq_xlating_, 0, pulse_blanking_cc_, 0); + } } else @@ -113,6 +124,10 @@ void PulseBlankingFilter::disconnect(gr::top_block_sptr top_block) { top_block->disconnect(pulse_blanking_cc_, 0, file_sink_, 0); } + if (config_->property(role_ + ".if", 0.0) > 0.0) + { + top_block->disconnect(freq_xlating_, 0, pulse_blanking_cc_, 0); + } } else { @@ -125,7 +140,14 @@ gr::basic_block_sptr PulseBlankingFilter::get_left_block() { if (input_item_type_.compare("gr_complex") == 0) { - return pulse_blanking_cc_; + if (config_->property(role_ + ".if", 0.0) > 0.0) + { + return freq_xlating_; + } + else + { + return pulse_blanking_cc_; + } } else { diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.h b/src/algorithms/input_filter/adapters/pulse_blanking_filter.h index 18b040bcc..238636f28 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.h +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.h @@ -35,6 +35,7 @@ #include #include #include +#include #include "gnss_block_interface.h" #include "pulse_blanking_cc.h" @@ -82,6 +83,7 @@ private: unsigned int out_streams_; gr::blocks::file_sink::sptr file_sink_; pulse_blanking_cc_sptr pulse_blanking_cc_; + gr::filter::freq_xlating_fir_filter_ccf::sptr freq_xlating_; }; #endif // GNSS_SDR_PULSE_BLANKING_FILTER_H_ From 5958d11fd115355a22b2a86ee53e2dcee2af7a1d Mon Sep 17 00:00:00 2001 From: Antonio Ramos Date: Tue, 31 Oct 2017 20:28:34 +0100 Subject: [PATCH 2/6] Baseband downconverting PulseBlanking Added an IF to baseband downconverting stage previous to the pulse blanking filter --- .../adapters/pulse_blanking_filter.cc | 31 +++++++++++++++++-- .../adapters/pulse_blanking_filter.h | 2 ++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index e6bcc2632..cc0b02bed 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -30,7 +30,9 @@ #include "pulse_blanking_filter.h" #include +#include #include +#include #include "configuration_interface.h" using google::LogMessage; @@ -71,7 +73,17 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, item_size = sizeof(gr_complex); //avoids uninitialization input_size_ = sizeof(gr_complex); //avoids uninitialization } - + float default_if = 0.0; + float if_ = config_->property(role_ + ".if", default_if); + if (if_ > 0.0) + { + double default_bw = 2000000.0; + double bw_ = config_->property(role_ + ".bw", default_bw); + double default_tw = bw_ / 15.0; + double tw_ = config_->property(role_ + ".tw", default_tw); + const std::vector taps = gr::filter::firdes::low_pass(1.0, config_->property("SignalSource.sampling_frequency", 2000000.0), bw_ / 2.0, tw_); + freq_xlating_ = gr::filter::freq_xlating_fir_filter_ccf::make(1, taps, if_, config_->property("SignalSource.sampling_frequency", 2000000.0)); + } if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; @@ -95,6 +107,10 @@ void PulseBlankingFilter::connect(gr::top_block_sptr top_block) { top_block->connect(pulse_blanking_cc_, 0, file_sink_, 0); } + if (config_->property(role_ + ".if", 0.0) > 0.0) + { + top_block->connect(freq_xlating_, 0, pulse_blanking_cc_, 0); + } } else @@ -113,6 +129,10 @@ void PulseBlankingFilter::disconnect(gr::top_block_sptr top_block) { top_block->disconnect(pulse_blanking_cc_, 0, file_sink_, 0); } + if (config_->property(role_ + ".if", 0.0) > 0.0) + { + top_block->disconnect(freq_xlating_, 0, pulse_blanking_cc_, 0); + } } else { @@ -125,7 +145,14 @@ gr::basic_block_sptr PulseBlankingFilter::get_left_block() { if (input_item_type_.compare("gr_complex") == 0) { - return pulse_blanking_cc_; + if (config_->property(role_ + ".if", 0.0) > 0.0) + { + return freq_xlating_; + } + else + { + return pulse_blanking_cc_; + } } else { diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.h b/src/algorithms/input_filter/adapters/pulse_blanking_filter.h index 18b040bcc..238636f28 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.h +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.h @@ -35,6 +35,7 @@ #include #include #include +#include #include "gnss_block_interface.h" #include "pulse_blanking_cc.h" @@ -82,6 +83,7 @@ private: unsigned int out_streams_; gr::blocks::file_sink::sptr file_sink_; pulse_blanking_cc_sptr pulse_blanking_cc_; + gr::filter::freq_xlating_fir_filter_ccf::sptr freq_xlating_; }; #endif // GNSS_SDR_PULSE_BLANKING_FILTER_H_ From 03f7cf0b07054a0e429a7542ac62cd53f81e1366 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 6 Nov 2017 10:32:11 +0100 Subject: [PATCH 3/6] Add lowpass filtering Lowpass filtering implementation in freq_xlating --- .../adapters/freq_xlating_fir_filter.cc | 89 ++++++++++--------- .../adapters/pulse_blanking_filter.cc | 18 ++-- .../adapters/pulse_blanking_filter.h | 1 - 3 files changed, 58 insertions(+), 50 deletions(-) diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index d5690f07e..8af287d6f 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include "configuration_interface.h" @@ -343,8 +344,8 @@ void FreqXlatingFirFilter::init() std::string default_output_item_type = "gr_complex"; std::string default_taps_item_type = "float"; std::string default_dump_filename = "../data/input_filter.dat"; - double default_intermediate_freq = 0; - double default_sampling_freq = 4000000; + double default_intermediate_freq = 0.0; + double default_sampling_freq = 4000000.0; int default_number_of_taps = 6; unsigned int default_number_of_bands = 2; std::vector default_bands = { 0.0, 0.4, 0.6, 1.0 }; @@ -364,46 +365,54 @@ void FreqXlatingFirFilter::init() sampling_freq_ = config_->property(role_ + ".sampling_frequency", default_sampling_freq); int number_of_taps = config_->property(role_ + ".number_of_taps", default_number_of_taps); unsigned int number_of_bands = config_->property(role_ + ".number_of_bands", default_number_of_bands); - - std::vector bands; - std::vector ampl; - std::vector error_w; - std::string option; - double option_value; - - for (unsigned int i = 0; i < number_of_bands; i++) - { - option = ".band" + boost::lexical_cast(i + 1) + "_begin"; - option_value = config_->property(role_ + option, default_bands[i]); - bands.push_back(option_value); - - option = ".band" + boost::lexical_cast(i + 1) + "_end"; - option_value = config_->property(role_ + option, default_bands[i]); - bands.push_back(option_value); - - option = ".ampl" + boost::lexical_cast(i + 1) + "_begin"; - option_value = config_->property(role_ + option, default_bands[i]); - ampl.push_back(option_value); - - option = ".ampl" + boost::lexical_cast(i + 1) + "_end"; - option_value = config_->property(role_ + option, default_bands[i]); - ampl.push_back(option_value); - - option = ".band" + boost::lexical_cast(i + 1) + "_error"; - option_value = config_->property(role_ + option, default_bands[i]); - error_w.push_back(option_value); - } - std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type); - int grid_density = config_->property(role_ + ".grid_density", default_grid_density); - std::vector taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, - error_w, filter_type, grid_density); - - taps_.reserve(taps_d.size()); - for (std::vector::iterator it = taps_d.begin(); it != taps_d.end(); it++) + if(filter_type.compare("lowpass") != 0) { - taps_.push_back(float(*it)); - //std::cout<<"TAP="< taps_d; + std::vector bands; + std::vector ampl; + std::vector error_w; + std::string option; + double option_value; + + for (unsigned int i = 0; i < number_of_bands; i++) + { + option = ".band" + boost::lexical_cast(i + 1) + "_begin"; + option_value = config_->property(role_ + option, default_bands[i]); + bands.push_back(option_value); + + option = ".band" + boost::lexical_cast(i + 1) + "_end"; + option_value = config_->property(role_ + option, default_bands[i]); + bands.push_back(option_value); + + option = ".ampl" + boost::lexical_cast(i + 1) + "_begin"; + option_value = config_->property(role_ + option, default_bands[i]); + ampl.push_back(option_value); + + option = ".ampl" + boost::lexical_cast(i + 1) + "_end"; + option_value = config_->property(role_ + option, default_bands[i]); + ampl.push_back(option_value); + + option = ".band" + boost::lexical_cast(i + 1) + "_error"; + option_value = config_->property(role_ + option, default_bands[i]); + error_w.push_back(option_value); + } + + int grid_density = config_->property(role_ + ".grid_density", default_grid_density); + taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density); + taps_.reserve(taps_d.size()); + for (std::vector::iterator it = taps_d.begin(); it != taps_d.end(); it++) + { + taps_.push_back(static_cast(*it)); + } } + else + { + double default_bw = 2000000.0; + double bw_ = config_->property(role_ + ".bw", default_bw); + double default_tw = bw_ / 20.0; + double tw_ = config_->property(role_ + ".tw", default_tw); + taps_ = gr::filter::firdes::low_pass(1.0, sampling_freq_, bw_ / 2.0, tw_); + } } diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index 89a2ff0ac..ea16bd231 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -28,13 +28,13 @@ * ------------------------------------------------------------------------- */ -#include "pulse_blanking_filter.h" #include #include +#include #include #include #include "configuration_interface.h" -#include +#include "pulse_blanking_filter.h" using google::LogMessage; @@ -74,13 +74,13 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, item_size = sizeof(gr_complex); //avoids uninitialization input_size_ = sizeof(gr_complex); //avoids uninitialization } - float default_if = 0.0; - float if_ = config_->property(role_ + ".if", default_if); - if (if_ > 0.0) + double default_if = 0.0; + double if_ = config_->property(role_ + ".if", default_if); + if (std::abs(if_) > 1.0) { double default_bw = 2000000.0; double bw_ = config_->property(role_ + ".bw", default_bw); - double default_tw = bw_ / 15.0; + double default_tw = bw_ / 20.0; double tw_ = config_->property(role_ + ".tw", default_tw); const std::vector taps = gr::filter::firdes::low_pass(1.0, config_->property("SignalSource.sampling_frequency", 2000000.0), bw_ / 2.0, tw_); freq_xlating_ = gr::filter::freq_xlating_fir_filter_ccf::make(1, taps, if_, config_->property("SignalSource.sampling_frequency", 2000000.0)); @@ -108,7 +108,7 @@ void PulseBlankingFilter::connect(gr::top_block_sptr top_block) { top_block->connect(pulse_blanking_cc_, 0, file_sink_, 0); } - if (config_->property(role_ + ".if", 0.0) > 0.0) + if (std::abs(config_->property(role_ + ".if", 0.0)) > 1.0) { top_block->connect(freq_xlating_, 0, pulse_blanking_cc_, 0); } @@ -130,7 +130,7 @@ void PulseBlankingFilter::disconnect(gr::top_block_sptr top_block) { top_block->disconnect(pulse_blanking_cc_, 0, file_sink_, 0); } - if (config_->property(role_ + ".if", 0.0) > 0.0) + if (std::abs(config_->property(role_ + ".if", 0.0)) > 1.0) { top_block->disconnect(freq_xlating_, 0, pulse_blanking_cc_, 0); } @@ -146,7 +146,7 @@ gr::basic_block_sptr PulseBlankingFilter::get_left_block() { if (input_item_type_.compare("gr_complex") == 0) { - if (config_->property(role_ + ".if", 0.0) > 0.0) + if (std::abs(config_->property(role_ + ".if", 0.0)) > 1.0) { return freq_xlating_; } diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.h b/src/algorithms/input_filter/adapters/pulse_blanking_filter.h index 238636f28..e0748a9d2 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.h +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.h @@ -33,7 +33,6 @@ #define GNSS_SDR_PULSE_BLANKING_FILTER_H_ #include -#include #include #include #include "gnss_block_interface.h" From a8ff283bacd0d26691691c7474436cb299feba2b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 6 Nov 2017 19:03:01 +0100 Subject: [PATCH 4/6] Call the Intermediate Frequency parameter "IF" for consistency with the freq_xlating_fir_filter block --- src/algorithms/input_filter/adapters/pulse_blanking_filter.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index 8d3111dc9..e262e3abf 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -75,7 +75,8 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, input_size_ = sizeof(gr_complex); //avoids uninitialization } double default_if = 0.0; - double if_ = config_->property(role_ + ".if", default_if); + double if_aux = config_->property(role_ + ".if", default_if); + double if_ = config_->property(role_ + ".IF", if_aux); if (std::abs(if_) > 1.0) { double default_sampling_freq = 4000000.0; From 8fa965c75cda21c3e676f1c9011b79e62dc67dd8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 6 Nov 2017 19:27:41 +0100 Subject: [PATCH 5/6] Change parameter bw to be the cut-off frequency --- src/algorithms/input_filter/adapters/pulse_blanking_filter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index e262e3abf..9c1c18b82 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -83,9 +83,9 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, double sampling_freq_ = config_->property(role_ + ".sampling_frequency", default_sampling_freq); double default_bw = 2000000.0; double bw_ = config_->property(role_ + ".bw", default_bw); - double default_tw = bw_ / 20.0; + double default_tw = bw_ / 10.0; double tw_ = config_->property(role_ + ".tw", default_tw); - const std::vector taps = gr::filter::firdes::low_pass(1.0, sampling_freq_, bw_ / 2.0, tw_); + const std::vector taps = gr::filter::firdes::low_pass(1.0, sampling_freq_, bw_ , tw_); freq_xlating_ = gr::filter::freq_xlating_fir_filter_ccf::make(1, taps, if_, sampling_freq_); } if (dump_) From 09e9220764feca3c0653fd9d314e5863f11271d7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 6 Nov 2017 23:53:05 +0100 Subject: [PATCH 6/6] Add pull request template --- docs/PULL_REQUEST_TEMPLATE.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 docs/PULL_REQUEST_TEMPLATE.md diff --git a/docs/PULL_REQUEST_TEMPLATE.md b/docs/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..b4e04e2c1 --- /dev/null +++ b/docs/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ +:+1::tada: Hello, and thanks for contributing to [GNSS-SDR](http://gnss-sdr.org)! :tada::+1: + +Before submitting your pull request, please make sure the following is done: + 1. You undertake the [Contributor Covenant Code of Conduct](https://github.com/gnss-sdr/gnss-sdr/blob/master/CODE_OF_CONDUCT.md). + 2. If you are a first-time contributor, after your pull request you will be asked to sign an Individual Contributor License Agreement ([CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement)) before your code gets accepted into `master`. This license is for your protection as a Contributor as well as for the protection of [CTTC](http://www.cttc.es/); it does not change your rights to use your own contributions for any other purpose. Except for the license granted therein to CTTC and recipients of software distributed by CTTC, you reserve all right, title, and interest in and to your contributions. The information you provide in that CLA will be maintained in accordance with [CTTC's privacy policy](http://www.cttc.es/privacy/). + 3. You have read the [Contributing Guidelines](https://github.com/gnss-sdr/gnss-sdr/blob/master/CONTRIBUTING.md). + 4. You have read the [coding style guide](http://gnss-sdr.org/coding-style/). + 5. You have forked the [gnss-sdr upstream repository](https://github.com/gnss-sdr/gnss-sdr) and have created your branch from `next` (or any other currently living branch in the upstream repository). + 6. Please include a description of your changes here. + +**Please feel free to delete this line and the above text once you have read it and in case you want to go on with your pull request.** \ No newline at end of file