From dff91e1216f8869f8ce6c67c8b5b37bd15398c3d Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Fri, 29 Mar 2019 17:34:06 +0100 Subject: [PATCH 1/2] Improving Flexiband signal source multichannel configuration options --- .../adapters/flexiband_signal_source.cc | 38 ++++++++++++++----- .../adapters/flexiband_signal_source.h | 5 ++- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc index 598bb4640..ff3f3f9a0 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc @@ -65,22 +65,31 @@ FlexibandSignalSource::FlexibandSignalSource(ConfigurationInterface* configurati usb_packet_buffer_size_ = configuration->property(role + ".usb_packet_buffer", 128); - RF_channels_ = configuration->property(role + ".RF_channels", 1); - + n_channels_ = configuration->property(role + ".total_channels", 0); + if (n_channels_ == 0) + { + n_channels_ = configuration->property(role + ".RF_channels", 1); + } + sel_ch_ = configuration->property(role + ".sel_ch", 1); + if (sel_ch_ > n_channels_) + { + LOG(WARNING) << "Invalid RF channel selection"; + } if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); flexiband_source_ = gr::teleorbit::frontend::make(firmware_filename_.c_str(), gain1_, gain2_, gain3_, AGC_, usb_packet_buffer_size_, signal_file.c_str(), flag_read_file); //create I, Q -> gr_complex type conversion blocks - for (int n = 0; n < (RF_channels_ * 2); n++) + for (int n = 0; n < (n_channels_ * 2); n++) { char_to_float.push_back(gr::blocks::char_to_float::make()); } - for (int n = 0; n < RF_channels_; n++) + for (int n = 0; n < n_channels_; n++) { float_to_complex_.push_back(gr::blocks::float_to_complex::make()); + null_sinks_.push_back(gr::blocks::null_sink::make(sizeof(gr_complex))); } DLOG(INFO) << "Item size " << item_size_; @@ -108,15 +117,16 @@ FlexibandSignalSource::~FlexibandSignalSource() = default; void FlexibandSignalSource::connect(gr::top_block_sptr top_block) { - for (int n = 0; n < (RF_channels_ * 2); n++) + for (int n = 0; n < (n_channels_ * 2); n++) { top_block->connect(flexiband_source_, n, char_to_float.at(n), 0); DLOG(INFO) << "connected flexiband_source_ to char_to_float CH" << n; } - for (int n = 0; n < RF_channels_; n++) + for (int n = 0; n < n_channels_; n++) { top_block->connect(char_to_float.at(n * 2), 0, float_to_complex_.at(n), 0); top_block->connect(char_to_float.at(n * 2 + 1), 0, float_to_complex_.at(n), 1); + top_block->connect(float_to_complex_.at(n), 0, null_sinks_.at(n), 0); DLOG(INFO) << "connected char_to_float to float_to_complex_ CH" << n; } } @@ -124,15 +134,16 @@ void FlexibandSignalSource::connect(gr::top_block_sptr top_block) void FlexibandSignalSource::disconnect(gr::top_block_sptr top_block) { - for (int n = 0; n < (RF_channels_ * 2); n++) + for (int n = 0; n < (n_channels_ * 2); n++) { top_block->disconnect(flexiband_source_, n, char_to_float.at(n), 0); DLOG(INFO) << "disconnect flexiband_source_ to char_to_float CH" << n; } - for (int n = 0; n < RF_channels_; n++) + for (int n = 0; n < n_channels_; n++) { top_block->disconnect(char_to_float.at(n * 2), 0, float_to_complex_.at(n), 0); top_block->disconnect(char_to_float.at(n * 2 + 1), 0, float_to_complex_.at(n), 1); + top_block->disconnect(float_to_complex_.at(n), 0, null_sinks_.at(n), 0); DLOG(INFO) << "disconnect char_to_float to float_to_complex_ CH" << n; } } @@ -152,5 +163,14 @@ gr::basic_block_sptr FlexibandSignalSource::get_right_block() gr::basic_block_sptr FlexibandSignalSource::get_right_block(int RF_channel) { - return float_to_complex_.at(RF_channel); + if (RF_channel == 0) + { + //in the first RF channel, return the signalsource selected channel. + //this trick enables the use of the second or the third frequency of a FlexiBand signal without a dual frequency configuration + return float_to_complex_.at(sel_ch_ - 1); + } + else + { + return float_to_complex_.at(RF_channel); + } } diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.h b/src/algorithms/signal_source/adapters/flexiband_signal_source.h index 40030af6c..7da5839a8 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.h +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.h @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -99,12 +100,14 @@ private: std::string signal_file; bool flag_read_file; - int RF_channels_; + int n_channels_; + int sel_ch_; gr::block_sptr flexiband_source_; std::vector> char_to_float; std::vector> float_to_complex_; + std::vector null_sinks_; boost::shared_ptr queue_; }; From dc6876e1c98f82e5bdf9d5c11033d0a8dd09071a Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Fri, 29 Mar 2019 17:36:05 +0100 Subject: [PATCH 2/2] Adding null sinks to unconnected signal conditioners automatically to enable partial use of multichannel sources --- src/core/receiver/gnss_flowgraph.cc | 23 ++++++++++++++++++++++- src/core/receiver/gnss_flowgraph.h | 22 ++++++++++++---------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 95ea7df45..38563aeed 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -363,6 +363,11 @@ void GNSSFlowgraph::connect() #endif // Signal conditioner (selected_signal_source) >> channels (i) (dependent of their associated SignalSource_ID) + std::vector signal_conditioner_connected; + for (size_t n = 0; n < sig_conditioner_.size(); n++) + { + signal_conditioner_connected.push_back(false); + } for (unsigned int i = 0; i < channels_count_; i++) { #ifndef ENABLE_FPGA @@ -500,10 +505,12 @@ void GNSSFlowgraph::connect() top_block_->disconnect_all(); return; } - + signal_conditioner_connected.at(selected_signal_conditioner_ID) = true; //notify that this signal conditioner is connected DLOG(INFO) << "signal conditioner " << selected_signal_conditioner_ID << " connected to channel " << i; } #endif + + // Signal Source > Signal conditioner >> Channels >> Observables try { @@ -519,6 +526,20 @@ void GNSSFlowgraph::connect() } } + //check for unconnected signal conditioners and connect null_sinks in order to provide configuration flexibility to multiband files or signal sources + if (configuration_->property(sig_source_.at(0)->role() + ".enable_FPGA", false) == false) + { + for (size_t n = 0; n < sig_conditioner_.size(); n++) + { + if (signal_conditioner_connected.at(n) == false) + { + null_sinks_.push_back(gr::blocks::null_sink::make(sizeof(gr_complex))); + top_block_->connect(sig_conditioner_.at(n)->get_right_block(), 0, + null_sinks_.back(), 0); + LOG(INFO) << "Null sink connected to signal conditioner " << n << " due to lack of connection to any channel" << std::endl; + } + } + } // Put channels fixed to a given satellite at the beginning of the vector, then the rest std::vector vector_of_channels; for (unsigned int i = 0; i < channels_count_; i++) diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 189f34dca..32e0ea2e3 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -40,16 +40,17 @@ #include "gnss_sdr_sample_counter.h" #include "gnss_signal.h" #include "pvt_interface.h" -#include // for msg_queue, msg_queue::sptr -#include // for basic_block_sptr, top_block_sptr -#include // for pmt_t -#include // for list -#include // for map -#include // for for shared_ptr, dynamic_pointer_cast -#include // for mutex -#include // for string -#include // for pair -#include // for vector +#include //for null_sink +#include // for msg_queue, msg_queue::sptr +#include // for basic_block_sptr, top_block_sptr +#include // for pmt_t +#include // for list +#include // for map +#include // for for shared_ptr, dynamic_pointer_cast +#include // for mutex +#include // for string +#include // for pair +#include // for vector #if ENABLE_FPGA #include "gnss_sdr_fpga_sample_counter.h" #endif @@ -162,6 +163,7 @@ private: std::vector> sig_source_; std::vector> sig_conditioner_; + std::vector null_sinks_; std::shared_ptr observables_; std::shared_ptr pvt_;