1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-10 03:50:04 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2019-04-01 00:49:19 +02:00
commit 422fe372a2
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 67 additions and 21 deletions

View File

@ -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;
}
}
@ -151,6 +162,15 @@ gr::basic_block_sptr FlexibandSignalSource::get_right_block()
}
gr::basic_block_sptr FlexibandSignalSource::get_right_block(int 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);
}
}

View File

@ -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_;
};

View File

@ -363,6 +363,11 @@ void GNSSFlowgraph::connect()
#endif
// Signal conditioner (selected_signal_source) >> channels (i) (dependent of their associated SignalSource_ID)
std::vector<bool> 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<unsigned int> vector_of_channels;
for (unsigned int i = 0; i < channels_count_; i++)

View File

@ -40,6 +40,7 @@
#include "gnss_sdr_sample_counter.h"
#include "gnss_signal.h"
#include "pvt_interface.h"
#include <gnuradio/blocks/null_sink.h> //for null_sink
#include <gnuradio/msg_queue.h> // for msg_queue, msg_queue::sptr
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
#include <pmt/pmt.h> // for pmt_t
@ -162,6 +163,7 @@ private:
std::vector<std::shared_ptr<GNSSBlockInterface>> sig_source_;
std::vector<std::shared_ptr<GNSSBlockInterface>> sig_conditioner_;
std::vector<gr::blocks::null_sink::sptr> null_sinks_;
std::shared_ptr<GNSSBlockInterface> observables_;
std::shared_ptr<GNSSBlockInterface> pvt_;