1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-05 23:10:34 +00:00

Add cshort implementation to GpsL2MPcpsAcquisition

This commit is contained in:
Luis Esteve 2016-05-13 00:07:21 +02:00
parent 77b7ac24d2
commit 2e6bcdbdd2
2 changed files with 30 additions and 31 deletions

View File

@ -80,25 +80,25 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
code_ = new gr_complex[vector_length_]; code_ = new gr_complex[vector_length_];
// if (item_type_.compare("gr_complex") == 0 ) if (item_type_.compare("cshort") == 0 )
// {
item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_make_acquisition_cc(1, max_dwells_,
doppler_max_, if_, fs_in_, code_length_, code_length_,
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_);
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")";
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")";
// }
if (item_type_.compare("cshort") == 0)
{ {
cshort_to_float_x2_ = make_cshort_to_float_x2(); item_size_ = sizeof(lv_16sc_t);
float_to_complex_ = gr::blocks::float_to_complex::make(); acquisition_sc_ = pcps_make_acquisition_sc(1, max_dwells_,
doppler_max_, if_, fs_in_, code_length_, code_length_,
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_);
DLOG(INFO) << "acquisition(" << acquisition_sc_->unique_id() << ")";
}else{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_make_acquisition_cc(1, max_dwells_,
doppler_max_, if_, fs_in_, code_length_, code_length_,
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_);
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")";
} }
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")";
if (item_type_.compare("cbyte") == 0) if (item_type_.compare("cbyte") == 0)
{ {
cbyte_to_float_x2_ = make_complex_byte_to_float_x2(); cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
@ -274,10 +274,7 @@ void GpsL2MPcpsAcquisition::connect(gr::top_block_sptr top_block)
} }
else if (item_type_.compare("cshort") == 0) else if (item_type_.compare("cshort") == 0)
{ {
top_block->connect(cshort_to_float_x2_, 0, float_to_complex_, 0); top_block->connect(stream_to_vector_, 0, acquisition_sc_, 0);
top_block->connect(cshort_to_float_x2_, 1, float_to_complex_, 1);
top_block->connect(float_to_complex_, 0, stream_to_vector_, 0);
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
} }
else if (item_type_.compare("cbyte") == 0) else if (item_type_.compare("cbyte") == 0)
{ {
@ -290,7 +287,6 @@ void GpsL2MPcpsAcquisition::connect(gr::top_block_sptr top_block)
{ {
LOG(WARNING) << item_type_ << " unknown acquisition item type"; LOG(WARNING) << item_type_ << " unknown acquisition item type";
} }
} }
@ -302,12 +298,7 @@ void GpsL2MPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
} }
else if (item_type_.compare("cshort") == 0) else if (item_type_.compare("cshort") == 0)
{ {
// Since a short-based acq implementation is not available, top_block->disconnect(stream_to_vector_, 0, acquisition_sc_, 0);
// we just convert cshorts to gr_complex
top_block->disconnect(cshort_to_float_x2_, 0, float_to_complex_, 0);
top_block->disconnect(cshort_to_float_x2_, 1, float_to_complex_, 1);
top_block->disconnect(float_to_complex_, 0, stream_to_vector_, 0);
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
} }
else if (item_type_.compare("cbyte") == 0) else if (item_type_.compare("cbyte") == 0)
{ {
@ -333,7 +324,7 @@ gr::basic_block_sptr GpsL2MPcpsAcquisition::get_left_block()
} }
else if (item_type_.compare("cshort") == 0) else if (item_type_.compare("cshort") == 0)
{ {
return cshort_to_float_x2_; return stream_to_vector_;
} }
else if (item_type_.compare("cbyte") == 0) else if (item_type_.compare("cbyte") == 0)
{ {
@ -349,6 +340,13 @@ gr::basic_block_sptr GpsL2MPcpsAcquisition::get_left_block()
gr::basic_block_sptr GpsL2MPcpsAcquisition::get_right_block() gr::basic_block_sptr GpsL2MPcpsAcquisition::get_right_block()
{ {
return acquisition_cc_; if (item_type_.compare("cshort") == 0)
{
return acquisition_sc_;
}
else
{
return acquisition_cc_;
}
} }

View File

@ -40,8 +40,9 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "acquisition_interface.h" #include "acquisition_interface.h"
#include "pcps_acquisition_cc.h" #include "pcps_acquisition_cc.h"
#include "cshort_to_float_x2.h" #include "pcps_acquisition_sc.h"
#include "complex_byte_to_float_x2.h" #include "complex_byte_to_float_x2.h"
#include <volk_gnsssdr/volk_gnsssdr.h>
@ -137,9 +138,9 @@ public:
private: private:
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_acquisition_cc_sptr acquisition_cc_; pcps_acquisition_cc_sptr acquisition_cc_;
pcps_acquisition_sc_sptr acquisition_sc_;
gr::blocks::stream_to_vector::sptr stream_to_vector_; gr::blocks::stream_to_vector::sptr stream_to_vector_;
gr::blocks::float_to_complex::sptr float_to_complex_; gr::blocks::float_to_complex::sptr float_to_complex_;
cshort_to_float_x2_sptr cshort_to_float_x2_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_; complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_; size_t item_size_;
std::string item_type_; std::string item_type_;