mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 15:23:04 +00:00 
			
		
		
		
	Improving Flexiband signal source multichannel configuration options
This commit is contained in:
		| @@ -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); | ||||
|         } | ||||
| } | ||||
|   | ||||
| @@ -38,6 +38,7 @@ | ||||
| #include <gnuradio/blocks/char_to_float.h> | ||||
| #include <gnuradio/blocks/file_sink.h> | ||||
| #include <gnuradio/blocks/float_to_complex.h> | ||||
| #include <gnuradio/blocks/null_sink.h> | ||||
| #include <gnuradio/hier_block2.h> | ||||
| #include <gnuradio/msg_queue.h> | ||||
| #include <string> | ||||
| @@ -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<boost::shared_ptr<gr::block>> char_to_float; | ||||
|     std::vector<boost::shared_ptr<gr::block>> float_to_complex_; | ||||
|     std::vector<gr::blocks::null_sink::sptr> null_sinks_; | ||||
|  | ||||
|     boost::shared_ptr<gr::msg_queue> queue_; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Javier Arribas
					Javier Arribas