1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

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

This commit is contained in:
Carles Fernandez 2018-11-11 20:35:42 +01:00
commit 75c10da0c3
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 97 additions and 73 deletions

View File

@ -1233,7 +1233,7 @@ else(PugiXML_FOUND)
if(CMAKE_VERSION VERSION_LESS 3.2)
ExternalProject_Add(
pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/pugixml
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/zeux/pugixml
GIT_TAG v${GNSSSDR_PUGIXML_LOCAL_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
@ -1246,7 +1246,7 @@ else(PugiXML_FOUND)
else(CMAKE_VERSION VERSION_LESS 3.2)
ExternalProject_Add(
pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/pugixml
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/zeux/pugixml
GIT_TAG v${GNSSSDR_PUGIXML_LOCAL_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}

View File

@ -59,7 +59,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface*
adc_bits_ = configuration->property(role + ".adc_bits", 4);
n_channels_ = configuration->property(role + ".total_channels", 1);
sel_ch_ = configuration->property(role + ".sel_ch", 1);
item_size_ = sizeof(int);
item_size_ = sizeof(int32_t);
int64_t bytes_seek = configuration->property(role + ".bytes_to_skip", 65536);
double sample_size_byte = static_cast<double>(adc_bits_) / 4.0;
@ -69,17 +69,22 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface*
}
if (n_channels_ > 1)
{
for (uint32_t i = 0; i < (n_channels_ - 1); i++)
for (uint32_t i = 0; i < n_channels_; i++)
{
null_sinks_.push_back(gr::blocks::null_sink::make(item_size_));
null_sinks_.push_back(gr::blocks::null_sink::make(sizeof(gr_complex)));
unpack_spir_vec_.push_back(make_unpack_spir_gss6450_samples(adc_bits_));
if (endian_swap_)
{
endian_vec_.push_back(gr::blocks::endian_swap::make(item_size_));
}
}
DLOG(INFO) << "NUMBER OF NULL SINKS = " << null_sinks_.size();
}
try
{
file_source_ = gr::blocks::file_source::make(item_size_, filename_.c_str(), repeat_);
file_source_->seek(bytes_seek / item_size_, SEEK_SET);
unpack_spir_ = make_unpack_spir_gss6450_samples(adc_bits_);
deint_ = gr::blocks::deinterleave::make(item_size_);
}
catch (const std::exception& e)
@ -143,22 +148,19 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface*
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
valve_ = gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue_);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
for (uint32_t i = 0; i < (n_channels_); i++)
{
valve_vec_.push_back(gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue_));
if (dump_)
{
sink_vec_.push_back(gr::blocks::file_sink::make(sizeof(gr_complex), dump_filename_.c_str()));
}
if (enable_throttle_control_)
{
throttle_vec_.push_back(gr::blocks::throttle::make(sizeof(gr_complex), sampling_frequency_));
}
}
if (dump_)
{
sink_ = gr::blocks::file_sink::make(sizeof(gr_complex), dump_filename_.c_str());
DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")";
}
if (enable_throttle_control_)
{
throttle_ = gr::blocks::throttle::make(sizeof(gr_complex), sampling_frequency_);
}
if (endian_swap_)
{
endian_ = gr::blocks::endian_swap::make(item_size_);
}
DLOG(INFO) << "File source filename " << filename_;
DLOG(INFO) << "Samples " << samples_;
DLOG(INFO) << "Sampling frequency " << sampling_frequency_;
@ -188,15 +190,17 @@ void SpirGSS6450FileSignalSource::connect(gr::top_block_sptr top_block)
if (samples_ > 0)
{
top_block->connect(file_source_, 0, deint_, 0);
if (endian_swap_)
{
top_block->connect(deint_, sel_ch_ - 1, endian_, 0);
top_block->connect(endian_, 0, unpack_spir_, 0);
top_block->connect(deint_, sel_ch_ - 1, endian_vec_.at(sel_ch_ - 1), 0);
top_block->connect(endian_vec_.at(sel_ch_ - 1), 0, unpack_spir_vec_.at(sel_ch_ - 1), 0);
}
else
{
top_block->connect(deint_, sel_ch_ - 1, unpack_spir_, 0);
top_block->connect(deint_, sel_ch_ - 1, unpack_spir_vec_.at(sel_ch_ - 1), 0);
}
if (n_channels_ > 1)
{
uint32_t aux = 0;
@ -204,23 +208,37 @@ void SpirGSS6450FileSignalSource::connect(gr::top_block_sptr top_block)
{
if (i != (sel_ch_ - 1))
{
top_block->connect(deint_, i, null_sinks_.at(aux), 0);
if (endian_swap_)
{
top_block->connect(deint_, i, endian_vec_.at(i), 0);
top_block->connect(endian_vec_.at(i), 0, unpack_spir_vec_.at(i), 0);
}
else
{
top_block->connect(deint_, i, unpack_spir_vec_.at(i), 0);
}
aux++;
}
}
}
if (enable_throttle_control_)
for (uint32_t i = 0; i < n_channels_; i++)
{
top_block->connect(unpack_spir_, 0, throttle_, 0);
top_block->connect(throttle_, 0, valve_, 0);
}
else
{
top_block->connect(unpack_spir_, 0, valve_, 0);
}
if (dump_)
{
top_block->connect(valve_, 0, sink_, 0);
if (enable_throttle_control_)
{
top_block->connect(unpack_spir_vec_.at(i), 0, throttle_vec_.at(i), 0);
top_block->connect(throttle_vec_.at(i), 0, valve_vec_.at(i), 0);
}
else
{
top_block->connect(unpack_spir_vec_.at(i), 0, valve_vec_.at(i), 0);
}
if (dump_)
{
top_block->connect(valve_vec_.at(i), 0, sink_vec_.at(i), 0);
}
top_block->connect(valve_vec_.at(i), 0, null_sinks_.at(i), 0);
}
}
else
@ -237,12 +255,12 @@ void SpirGSS6450FileSignalSource::disconnect(gr::top_block_sptr top_block)
top_block->disconnect(file_source_, 0, deint_, 0);
if (endian_swap_)
{
top_block->disconnect(deint_, sel_ch_ - 1, endian_, 0);
top_block->disconnect(endian_, 0, unpack_spir_, 0);
top_block->disconnect(deint_, sel_ch_ - 1, endian_vec_.at(sel_ch_ - 1), 0);
top_block->disconnect(endian_vec_.at(sel_ch_ - 1), 0, unpack_spir_vec_.at(sel_ch_ - 1), 0);
}
else
{
top_block->disconnect(deint_, sel_ch_ - 1, unpack_spir_, 0);
top_block->disconnect(deint_, sel_ch_ - 1, unpack_spir_vec_.at(sel_ch_ - 1), 0);
}
if (n_channels_ > 1)
{
@ -251,23 +269,38 @@ void SpirGSS6450FileSignalSource::disconnect(gr::top_block_sptr top_block)
{
if (i != (sel_ch_ - 1))
{
top_block->disconnect(deint_, i, null_sinks_.at(aux), 0);
if (endian_swap_)
{
top_block->disconnect(deint_, i, endian_vec_.at(i), 0);
top_block->disconnect(endian_vec_.at(i), 0, unpack_spir_vec_.at(i), 0);
}
else
{
top_block->disconnect(deint_, i, unpack_spir_vec_.at(i), 0);
}
aux++;
}
}
}
if (enable_throttle_control_)
for (uint32_t i = 0; i < (n_channels_); i++)
{
top_block->disconnect(unpack_spir_, 0, throttle_, 0);
top_block->disconnect(throttle_, 0, valve_, 0);
}
else
{
top_block->disconnect(unpack_spir_, 0, valve_, 0);
}
if (dump_)
{
top_block->disconnect(valve_, 0, sink_, 0);
if (enable_throttle_control_)
{
top_block->disconnect(unpack_spir_vec_.at(i), 0, throttle_vec_.at(i), 0);
top_block->disconnect(throttle_vec_.at(i), 0, valve_vec_.at(i), 0);
}
else
{
top_block->disconnect(unpack_spir_vec_.at(i), 0, valve_vec_.at(i), 0);
}
if (dump_)
{
top_block->disconnect(valve_vec_.at(i), 0, sink_vec_.at(i), 0);
}
top_block->disconnect(valve_vec_.at(i), 0, null_sinks_.at(i), 0);
}
}
else
@ -283,22 +316,12 @@ gr::basic_block_sptr SpirGSS6450FileSignalSource::get_left_block()
return gr::blocks::file_source::sptr();
}
gr::basic_block_sptr SpirGSS6450FileSignalSource::get_right_block(int RF_channel)
{
return valve_vec_.at(RF_channel);
}
gr::basic_block_sptr SpirGSS6450FileSignalSource::get_right_block()
{
if (samples_ > 0)
{
return valve_;
}
else
{
if (enable_throttle_control_)
{
return throttle_;
}
else
{
return unpack_spir_;
}
}
return valve_vec_.at(0);
}

View File

@ -79,6 +79,7 @@ public:
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
gr::basic_block_sptr get_right_block(int RF_channel) override;
gr::basic_block_sptr get_right_block() override;
inline std::string filename() const
@ -124,12 +125,12 @@ private:
uint32_t sel_ch_;
gr::blocks::file_source::sptr file_source_;
gr::blocks::deinterleave::sptr deint_;
gr::blocks::endian_swap::sptr endian_;
std::vector<gr::blocks::endian_swap::sptr> endian_vec_;
std::vector<gr::blocks::null_sink::sptr> null_sinks_;
unpack_spir_gss6450_samples_sptr unpack_spir_;
boost::shared_ptr<gr::block> valve_;
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::vector<unpack_spir_gss6450_samples_sptr> unpack_spir_vec_;
std::vector<boost::shared_ptr<gr::block>> valve_vec_;
std::vector<gr::blocks::file_sink::sptr> sink_vec_;
std::vector<gr::blocks::throttle::sptr> throttle_vec_;
gr::msg_queue::sptr queue_;
size_t item_size_;
};

View File

@ -40,7 +40,7 @@ unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples(unsigned int a
unpack_spir_gss6450_samples::unpack_spir_gss6450_samples(unsigned int adc_nbit) : gr::sync_interpolator("unpack_spir_gss6450_samples",
gr::io_signature::make(1, 1, sizeof(int)),
gr::io_signature::make(1, 1, sizeof(int32_t)),
gr::io_signature::make(1, 1, sizeof(gr_complex)), 16 / adc_nbit)
{
adc_bits = adc_nbit;