mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 20:50:33 +00:00
Merge branch 'antonioramosdet-two_step_acquisition' into next
This commit is contained in:
commit
343c8a5c53
@ -45,6 +45,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
|||||||
ConfigurationInterface* configuration, std::string role,
|
ConfigurationInterface* configuration, std::string role,
|
||||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||||
{
|
{
|
||||||
|
pcpsconf_t acq_parameters;
|
||||||
configuration_ = configuration;
|
configuration_ = configuration;
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_filename = "./data/acquisition.dat";
|
std::string default_dump_filename = "./data/acquisition.dat";
|
||||||
@ -55,32 +56,33 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
|||||||
|
|
||||||
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
|
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
|
||||||
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||||
|
acq_parameters.fs_in = fs_in_;
|
||||||
if_ = configuration_->property(role + ".if", 0);
|
if_ = configuration_->property(role + ".if", 0);
|
||||||
|
acq_parameters.freq = if_;
|
||||||
dump_ = configuration_->property(role + ".dump", false);
|
dump_ = configuration_->property(role + ".dump", false);
|
||||||
|
acq_parameters.dump = dump_;
|
||||||
blocking_ = configuration_->property(role + ".blocking", true);
|
blocking_ = configuration_->property(role + ".blocking", true);
|
||||||
|
acq_parameters.blocking = blocking_;
|
||||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||||
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 4);
|
acq_parameters.doppler_max = doppler_max_;
|
||||||
|
sampled_ms_ = 4;
|
||||||
if (sampled_ms_ % 4 != 0)
|
acq_parameters.sampled_ms = sampled_ms_;
|
||||||
{
|
|
||||||
sampled_ms_ = static_cast<int>(sampled_ms_ / 4) * 4;
|
|
||||||
LOG(WARNING) << "coherent_integration_time should be multiple of "
|
|
||||||
<< "Galileo code length (4 ms). coherent_integration_time = "
|
|
||||||
<< sampled_ms_ << " ms will be used.";
|
|
||||||
}
|
|
||||||
|
|
||||||
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
||||||
|
acq_parameters.bit_transition_flag = bit_transition_flag_;
|
||||||
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
||||||
acquire_pilot_ = configuration_->property(role + ".acquire_pilot", false); //will be true in future versions
|
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
|
||||||
|
acquire_pilot_ = configuration_->property(role + ".acquire_pilot", false); //will be true in future versions
|
||||||
|
|
||||||
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
||||||
|
acq_parameters.max_dwells = max_dwells_;
|
||||||
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
||||||
|
acq_parameters.dump_filename = dump_filename_;
|
||||||
//--- Find number of samples per spreading code (4 ms) -----------------
|
//--- Find number of samples per spreading code (4 ms) -----------------
|
||||||
code_length_ = round(fs_in_ / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS));
|
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS)));
|
||||||
int samples_per_ms = round(code_length_ / 4.0);
|
acq_parameters.samples_per_code = code_length_;
|
||||||
|
int samples_per_ms = static_cast<int>(std::round(static_cast<double>(fs_in_) * 0.001));
|
||||||
|
acq_parameters.samples_per_ms = samples_per_ms;
|
||||||
vector_length_ = sampled_ms_ * samples_per_ms;
|
vector_length_ = sampled_ms_ * samples_per_ms;
|
||||||
|
|
||||||
if (bit_transition_flag_)
|
if (bit_transition_flag_)
|
||||||
@ -98,10 +100,11 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
|||||||
{
|
{
|
||||||
item_size_ = sizeof(gr_complex);
|
item_size_ = sizeof(gr_complex);
|
||||||
}
|
}
|
||||||
acquisition_ = pcps_make_acquisition(sampled_ms_, max_dwells_,
|
acq_parameters.it_size = item_size_;
|
||||||
doppler_max_, if_, fs_in_, samples_per_ms, code_length_,
|
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||||
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, blocking_,
|
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||||
dump_filename_, item_size_);
|
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||||
|
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||||
|
|
||||||
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
||||||
|
@ -44,6 +44,7 @@ using google::LogMessage;
|
|||||||
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
|
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
|
||||||
std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||||
{
|
{
|
||||||
|
pcpsconf_t acq_parameters;
|
||||||
configuration_ = configuration;
|
configuration_ = configuration;
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_filename = "../data/acquisition.dat";
|
std::string default_dump_filename = "../data/acquisition.dat";
|
||||||
@ -54,6 +55,8 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
|
|||||||
|
|
||||||
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000);
|
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000);
|
||||||
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||||
|
acq_parameters.fs_in = fs_in_;
|
||||||
|
acq_parameters.freq = 0;
|
||||||
acq_pilot_ = configuration_->property(role + ".acquire_pilot", false);
|
acq_pilot_ = configuration_->property(role + ".acquire_pilot", false);
|
||||||
acq_iq_ = configuration_->property(role + ".acquire_iq", false);
|
acq_iq_ = configuration_->property(role + ".acquire_iq", false);
|
||||||
if (acq_iq_)
|
if (acq_iq_)
|
||||||
@ -61,17 +64,23 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
|
|||||||
acq_pilot_ = false;
|
acq_pilot_ = false;
|
||||||
}
|
}
|
||||||
dump_ = configuration_->property(role + ".dump", false);
|
dump_ = configuration_->property(role + ".dump", false);
|
||||||
|
acq_parameters.dump = dump_;
|
||||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||||
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
|
acq_parameters.doppler_max = doppler_max_;
|
||||||
|
sampled_ms_ = 1;
|
||||||
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
||||||
|
acq_parameters.max_dwells = max_dwells_;
|
||||||
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
||||||
|
acq_parameters.dump_filename = dump_filename_;
|
||||||
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
||||||
|
acq_parameters.bit_transition_flag = bit_transition_flag_;
|
||||||
use_CFAR_ = configuration_->property(role + ".use_CFAR_algorithm", false);
|
use_CFAR_ = configuration_->property(role + ".use_CFAR_algorithm", false);
|
||||||
|
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_;
|
||||||
blocking_ = configuration_->property(role + ".blocking", true);
|
blocking_ = configuration_->property(role + ".blocking", true);
|
||||||
|
acq_parameters.blocking = blocking_;
|
||||||
//--- Find number of samples per spreading code (1ms)-------------------------
|
//--- Find number of samples per spreading code (1ms)-------------------------
|
||||||
code_length_ = round(static_cast<double>(fs_in_) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast<double>(Galileo_E5a_CODE_LENGTH_CHIPS));
|
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast<double>(Galileo_E5a_CODE_LENGTH_CHIPS)));
|
||||||
vector_length_ = code_length_ * sampled_ms_;
|
vector_length_ = code_length_ * sampled_ms_;
|
||||||
|
|
||||||
code_ = new gr_complex[vector_length_];
|
code_ = new gr_complex[vector_length_];
|
||||||
@ -89,10 +98,14 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
|
|||||||
item_size_ = sizeof(gr_complex);
|
item_size_ = sizeof(gr_complex);
|
||||||
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
||||||
}
|
}
|
||||||
|
acq_parameters.it_size = item_size_;
|
||||||
acquisition_ = pcps_make_acquisition(sampled_ms_, max_dwells_, doppler_max_, 0, fs_in_,
|
acq_parameters.samples_per_code = code_length_;
|
||||||
code_length_, code_length_, bit_transition_flag_, use_CFAR_, dump_, blocking_,
|
acq_parameters.samples_per_ms = code_length_;
|
||||||
dump_filename_, item_size_);
|
acq_parameters.sampled_ms = sampled_ms_;
|
||||||
|
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||||
|
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||||
|
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||||
|
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||||
|
|
||||||
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
||||||
channel_ = 0;
|
channel_ = 0;
|
||||||
|
@ -46,6 +46,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
|||||||
ConfigurationInterface* configuration, std::string role,
|
ConfigurationInterface* configuration, std::string role,
|
||||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||||
{
|
{
|
||||||
|
pcpsconf_t acq_parameters;
|
||||||
configuration_ = configuration;
|
configuration_ = configuration;
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_filename = "./data/acquisition.dat";
|
std::string default_dump_filename = "./data/acquisition.dat";
|
||||||
@ -56,22 +57,28 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
|||||||
|
|
||||||
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
|
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||||
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||||
|
acq_parameters.fs_in = fs_in_;
|
||||||
if_ = configuration_->property(role + ".if", 0);
|
if_ = configuration_->property(role + ".if", 0);
|
||||||
|
acq_parameters.freq = if_;
|
||||||
dump_ = configuration_->property(role + ".dump", false);
|
dump_ = configuration_->property(role + ".dump", false);
|
||||||
|
acq_parameters.dump = dump_;
|
||||||
blocking_ = configuration_->property(role + ".blocking", true);
|
blocking_ = configuration_->property(role + ".blocking", true);
|
||||||
|
acq_parameters.blocking = blocking_;
|
||||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||||
|
acq_parameters.doppler_max = doppler_max_;
|
||||||
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
|
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
|
||||||
|
acq_parameters.sampled_ms = sampled_ms_;
|
||||||
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
||||||
|
acq_parameters.bit_transition_flag = bit_transition_flag_;
|
||||||
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
||||||
|
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
|
||||||
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
||||||
|
acq_parameters.max_dwells = max_dwells_;
|
||||||
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
||||||
|
acq_parameters.dump_filename = dump_filename_;
|
||||||
//--- Find number of samples per spreading code -------------------------
|
//--- Find number of samples per spreading code -------------------------
|
||||||
code_length_ = round(fs_in_ / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS)));
|
||||||
|
|
||||||
vector_length_ = code_length_ * sampled_ms_;
|
vector_length_ = code_length_ * sampled_ms_;
|
||||||
|
|
||||||
@ -90,9 +97,14 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
|||||||
{
|
{
|
||||||
item_size_ = sizeof(gr_complex);
|
item_size_ = sizeof(gr_complex);
|
||||||
}
|
}
|
||||||
acquisition_ = pcps_make_acquisition(sampled_ms_, max_dwells_,
|
acq_parameters.it_size = item_size_;
|
||||||
doppler_max_, if_, fs_in_, code_length_, code_length_,
|
acq_parameters.sampled_ms = sampled_ms_;
|
||||||
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, blocking_, dump_filename_, item_size_);
|
acq_parameters.samples_per_ms = code_length_;
|
||||||
|
acq_parameters.samples_per_code = code_length_;
|
||||||
|
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||||
|
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||||
|
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||||
|
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||||
|
|
||||||
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
||||||
|
@ -45,6 +45,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
|||||||
ConfigurationInterface* configuration, std::string role,
|
ConfigurationInterface* configuration, std::string role,
|
||||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||||
{
|
{
|
||||||
|
pcpsconf_t acq_parameters;
|
||||||
configuration_ = configuration;
|
configuration_ = configuration;
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_filename = "./data/acquisition.dat";
|
std::string default_dump_filename = "./data/acquisition.dat";
|
||||||
@ -55,22 +56,27 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
|||||||
|
|
||||||
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
|
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||||
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||||
|
acq_parameters.fs_in = fs_in_;
|
||||||
if_ = configuration_->property(role + ".if", 0);
|
if_ = configuration_->property(role + ".if", 0);
|
||||||
|
acq_parameters.freq = if_;
|
||||||
dump_ = configuration_->property(role + ".dump", false);
|
dump_ = configuration_->property(role + ".dump", false);
|
||||||
|
acq_parameters.dump = dump_;
|
||||||
blocking_ = configuration_->property(role + ".blocking", true);
|
blocking_ = configuration_->property(role + ".blocking", true);
|
||||||
|
acq_parameters.blocking = blocking_;
|
||||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||||
|
acq_parameters.doppler_max = doppler_max_;
|
||||||
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
|
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
|
||||||
|
|
||||||
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
||||||
|
acq_parameters.bit_transition_flag = bit_transition_flag_;
|
||||||
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
||||||
|
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
|
||||||
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
||||||
|
|
||||||
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
||||||
|
acq_parameters.dump_filename = dump_filename_;
|
||||||
//--- Find number of samples per spreading code -------------------------
|
//--- Find number of samples per spreading code -------------------------
|
||||||
code_length_ = round(fs_in_ / (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS));
|
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS)));
|
||||||
|
|
||||||
vector_length_ = code_length_ * sampled_ms_;
|
vector_length_ = code_length_ * sampled_ms_;
|
||||||
|
|
||||||
@ -89,9 +95,14 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
|||||||
{
|
{
|
||||||
item_size_ = sizeof(gr_complex);
|
item_size_ = sizeof(gr_complex);
|
||||||
}
|
}
|
||||||
acquisition_ = pcps_make_acquisition(sampled_ms_, max_dwells_,
|
acq_parameters.it_size = item_size_;
|
||||||
doppler_max_, if_, fs_in_, code_length_, code_length_,
|
acq_parameters.sampled_ms = sampled_ms_;
|
||||||
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, blocking_, dump_filename_, item_size_);
|
acq_parameters.samples_per_ms = code_length_;
|
||||||
|
acq_parameters.samples_per_code = code_length_;
|
||||||
|
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||||
|
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||||
|
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||||
|
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||||
|
|
||||||
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
||||||
|
@ -48,6 +48,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
|||||||
ConfigurationInterface* configuration, std::string role,
|
ConfigurationInterface* configuration, std::string role,
|
||||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||||
{
|
{
|
||||||
|
pcpsconf_t acq_parameters;
|
||||||
configuration_ = configuration;
|
configuration_ = configuration;
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_filename = "./data/acquisition.dat";
|
std::string default_dump_filename = "./data/acquisition.dat";
|
||||||
@ -57,22 +58,31 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
|||||||
item_type_ = configuration_->property(role + ".item_type", default_item_type);
|
item_type_ = configuration_->property(role + ".item_type", default_item_type);
|
||||||
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
|
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||||
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||||
|
acq_parameters.fs_in = fs_in_;
|
||||||
if_ = configuration_->property(role + ".if", 0);
|
if_ = configuration_->property(role + ".if", 0);
|
||||||
|
acq_parameters.freq = if_;
|
||||||
dump_ = configuration_->property(role + ".dump", false);
|
dump_ = configuration_->property(role + ".dump", false);
|
||||||
|
acq_parameters.dump = dump_;
|
||||||
blocking_ = configuration_->property(role + ".blocking", true);
|
blocking_ = configuration_->property(role + ".blocking", true);
|
||||||
|
acq_parameters.blocking = blocking_;
|
||||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||||
|
acq_parameters.doppler_max = doppler_max_;
|
||||||
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
|
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
|
||||||
|
acq_parameters.sampled_ms = sampled_ms_;
|
||||||
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
||||||
|
acq_parameters.bit_transition_flag = bit_transition_flag_;
|
||||||
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
||||||
|
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
|
||||||
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
||||||
|
acq_parameters.max_dwells = max_dwells_;
|
||||||
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
||||||
|
acq_parameters.dump_filename = dump_filename_;
|
||||||
|
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||||
|
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||||
|
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||||
//--- Find number of samples per spreading code -------------------------
|
//--- Find number of samples per spreading code -------------------------
|
||||||
code_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
|
||||||
|
|
||||||
vector_length_ = code_length_ * sampled_ms_;
|
vector_length_ = code_length_ * sampled_ms_;
|
||||||
|
|
||||||
@ -91,9 +101,10 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
|||||||
{
|
{
|
||||||
item_size_ = sizeof(gr_complex);
|
item_size_ = sizeof(gr_complex);
|
||||||
}
|
}
|
||||||
acquisition_ = pcps_make_acquisition(sampled_ms_, max_dwells_,
|
acq_parameters.samples_per_ms = code_length_;
|
||||||
doppler_max_, if_, fs_in_, code_length_, code_length_,
|
acq_parameters.samples_per_code = code_length_;
|
||||||
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, blocking_, dump_filename_, item_size_);
|
acq_parameters.it_size = item_size_;
|
||||||
|
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||||
|
|
||||||
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
||||||
|
@ -46,6 +46,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
|||||||
ConfigurationInterface* configuration, std::string role,
|
ConfigurationInterface* configuration, std::string role,
|
||||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||||
{
|
{
|
||||||
|
pcpsconf_t acq_parameters;
|
||||||
configuration_ = configuration;
|
configuration_ = configuration;
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_filename = "./data/acquisition.dat";
|
std::string default_dump_filename = "./data/acquisition.dat";
|
||||||
@ -57,21 +58,26 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
|||||||
|
|
||||||
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
|
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||||
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||||
|
acq_parameters.fs_in = fs_in_;
|
||||||
if_ = configuration_->property(role + ".if", 0);
|
if_ = configuration_->property(role + ".if", 0);
|
||||||
|
acq_parameters.freq = if_;
|
||||||
dump_ = configuration_->property(role + ".dump", false);
|
dump_ = configuration_->property(role + ".dump", false);
|
||||||
|
acq_parameters.dump = dump_;
|
||||||
blocking_ = configuration_->property(role + ".blocking", true);
|
blocking_ = configuration_->property(role + ".blocking", true);
|
||||||
|
acq_parameters.blocking = blocking_;
|
||||||
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
|
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
|
||||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||||
|
acq_parameters.doppler_max = doppler_max_;
|
||||||
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
||||||
|
acq_parameters.bit_transition_flag = bit_transition_flag_;
|
||||||
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
||||||
|
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
|
||||||
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
||||||
|
acq_parameters.max_dwells = max_dwells_;
|
||||||
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
||||||
|
acq_parameters.dump_filename = dump_filename_;
|
||||||
//--- Find number of samples per spreading code -------------------------
|
//--- Find number of samples per spreading code -------------------------
|
||||||
code_length_ = round(static_cast<double>(fs_in_) / (GPS_L2_M_CODE_RATE_HZ / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS)));
|
code_length_ = std::round(static_cast<double>(fs_in_) / (GPS_L2_M_CODE_RATE_HZ / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS)));
|
||||||
|
|
||||||
vector_length_ = code_length_;
|
vector_length_ = code_length_;
|
||||||
|
|
||||||
@ -90,10 +96,14 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
|||||||
{
|
{
|
||||||
item_size_ = sizeof(gr_complex);
|
item_size_ = sizeof(gr_complex);
|
||||||
}
|
}
|
||||||
acquisition_ = pcps_make_acquisition(1, max_dwells_,
|
acq_parameters.samples_per_ms = static_cast<int>(std::round(static_cast<double>(fs_in_) * 0.001));
|
||||||
doppler_max_, if_, fs_in_, code_length_, code_length_,
|
acq_parameters.samples_per_code = code_length_;
|
||||||
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, blocking_,
|
acq_parameters.it_size = item_size_;
|
||||||
dump_filename_, item_size_);
|
acq_parameters.sampled_ms = 20;
|
||||||
|
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||||
|
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||||
|
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", true);
|
||||||
|
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||||
|
|
||||||
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
||||||
|
@ -46,6 +46,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
|||||||
ConfigurationInterface* configuration, std::string role,
|
ConfigurationInterface* configuration, std::string role,
|
||||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||||
{
|
{
|
||||||
|
pcpsconf_t acq_parameters;
|
||||||
configuration_ = configuration;
|
configuration_ = configuration;
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_filename = "./data/acquisition.dat";
|
std::string default_dump_filename = "./data/acquisition.dat";
|
||||||
@ -56,21 +57,26 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
|||||||
|
|
||||||
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
|
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||||
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||||
|
acq_parameters.fs_in = fs_in_;
|
||||||
if_ = configuration_->property(role + ".if", 0);
|
if_ = configuration_->property(role + ".if", 0);
|
||||||
|
acq_parameters.freq = if_;
|
||||||
dump_ = configuration_->property(role + ".dump", false);
|
dump_ = configuration_->property(role + ".dump", false);
|
||||||
|
acq_parameters.dump = dump_;
|
||||||
blocking_ = configuration_->property(role + ".blocking", true);
|
blocking_ = configuration_->property(role + ".blocking", true);
|
||||||
|
acq_parameters.blocking = blocking_;
|
||||||
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
|
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
|
||||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||||
|
acq_parameters.doppler_max = doppler_max_;
|
||||||
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
|
||||||
|
acq_parameters.bit_transition_flag = bit_transition_flag_;
|
||||||
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
|
||||||
|
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
|
||||||
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
|
||||||
|
acq_parameters.max_dwells = max_dwells_;
|
||||||
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
||||||
|
acq_parameters.dump_filename = dump_filename_;
|
||||||
//--- Find number of samples per spreading code -------------------------
|
//--- Find number of samples per spreading code -------------------------
|
||||||
code_length_ = round(static_cast<double>(fs_in_) / (GPS_L5i_CODE_RATE_HZ / static_cast<double>(GPS_L5i_CODE_LENGTH_CHIPS)));
|
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / (GPS_L5i_CODE_RATE_HZ / static_cast<double>(GPS_L5i_CODE_LENGTH_CHIPS))));
|
||||||
|
|
||||||
vector_length_ = code_length_;
|
vector_length_ = code_length_;
|
||||||
|
|
||||||
@ -89,10 +95,14 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
|||||||
{
|
{
|
||||||
item_size_ = sizeof(gr_complex);
|
item_size_ = sizeof(gr_complex);
|
||||||
}
|
}
|
||||||
acquisition_ = pcps_make_acquisition(1, max_dwells_,
|
acq_parameters.samples_per_code = code_length_;
|
||||||
doppler_max_, if_, fs_in_, code_length_, code_length_,
|
acq_parameters.samples_per_ms = code_length_;
|
||||||
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, blocking_,
|
acq_parameters.it_size = item_size_;
|
||||||
dump_filename_, item_size_);
|
acq_parameters.sampled_ms = 1;
|
||||||
|
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||||
|
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||||
|
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||||
|
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||||
|
|
||||||
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
||||||
|
@ -45,57 +45,34 @@
|
|||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
pcps_acquisition_sptr pcps_make_acquisition(
|
pcps_acquisition_sptr pcps_make_acquisition(pcpsconf_t conf_)
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
|
||||||
unsigned int doppler_max, long freq, long fs_in,
|
|
||||||
int samples_per_ms, int samples_per_code,
|
|
||||||
bool bit_transition_flag, bool use_CFAR_algorithm_flag,
|
|
||||||
bool dump, bool blocking,
|
|
||||||
std::string dump_filename, size_t it_size)
|
|
||||||
{
|
{
|
||||||
return pcps_acquisition_sptr(
|
return pcps_acquisition_sptr(new pcps_acquisition(conf_));
|
||||||
new pcps_acquisition(sampled_ms, max_dwells, doppler_max, freq, fs_in, samples_per_ms,
|
|
||||||
samples_per_code, bit_transition_flag, use_CFAR_algorithm_flag, dump, blocking, dump_filename, it_size));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pcps_acquisition::pcps_acquisition(
|
pcps_acquisition::pcps_acquisition(pcpsconf_t conf_) : gr::block("pcps_acquisition",
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
gr::io_signature::make(1, 1, conf_.it_size * conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2 : 1)),
|
||||||
unsigned int doppler_max, long freq, long fs_in,
|
gr::io_signature::make(0, 0, conf_.it_size * conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2 : 1)))
|
||||||
int samples_per_ms, int samples_per_code,
|
|
||||||
bool bit_transition_flag, bool use_CFAR_algorithm_flag,
|
|
||||||
bool dump, bool blocking,
|
|
||||||
std::string dump_filename,
|
|
||||||
size_t it_size) : gr::block("pcps_acquisition",
|
|
||||||
gr::io_signature::make(1, 1, it_size * sampled_ms * samples_per_ms * (bit_transition_flag ? 2 : 1)),
|
|
||||||
gr::io_signature::make(0, 0, it_size * sampled_ms * samples_per_ms * (bit_transition_flag ? 2 : 1)))
|
|
||||||
{
|
{
|
||||||
this->message_port_register_out(pmt::mp("events"));
|
this->message_port_register_out(pmt::mp("events"));
|
||||||
|
|
||||||
|
acq_parameters = conf_;
|
||||||
d_sample_counter = 0; // SAMPLE COUNTER
|
d_sample_counter = 0; // SAMPLE COUNTER
|
||||||
d_active = false;
|
d_active = false;
|
||||||
d_state = 0;
|
d_state = 0;
|
||||||
d_freq = freq;
|
d_old_freq = conf_.freq;
|
||||||
d_old_freq = freq;
|
|
||||||
d_fs_in = fs_in;
|
|
||||||
d_samples_per_ms = samples_per_ms;
|
|
||||||
d_samples_per_code = samples_per_code;
|
|
||||||
d_sampled_ms = sampled_ms;
|
|
||||||
d_max_dwells = max_dwells;
|
|
||||||
d_well_count = 0;
|
d_well_count = 0;
|
||||||
d_doppler_max = doppler_max;
|
d_fft_size = acq_parameters.sampled_ms * acq_parameters.samples_per_ms;
|
||||||
d_fft_size = d_sampled_ms * d_samples_per_ms;
|
|
||||||
d_mag = 0;
|
d_mag = 0;
|
||||||
d_input_power = 0.0;
|
d_input_power = 0.0;
|
||||||
d_num_doppler_bins = 0;
|
d_num_doppler_bins = 0;
|
||||||
d_bit_transition_flag = bit_transition_flag;
|
|
||||||
d_use_CFAR_algorithm_flag = use_CFAR_algorithm_flag;
|
|
||||||
d_threshold = 0.0;
|
d_threshold = 0.0;
|
||||||
d_doppler_step = 0;
|
d_doppler_step = 0;
|
||||||
d_code_phase = 0;
|
d_doppler_center_step_two = 0.0;
|
||||||
d_test_statistics = 0.0;
|
d_test_statistics = 0.0;
|
||||||
d_channel = 0;
|
d_channel = 0;
|
||||||
if (it_size == sizeof(gr_complex))
|
if (conf_.it_size == sizeof(gr_complex))
|
||||||
{
|
{
|
||||||
d_cshort = false;
|
d_cshort = false;
|
||||||
}
|
}
|
||||||
@ -114,10 +91,10 @@ pcps_acquisition::pcps_acquisition(
|
|||||||
//
|
//
|
||||||
// We can avoid this by doing linear correlation, effectively doubling the
|
// We can avoid this by doing linear correlation, effectively doubling the
|
||||||
// size of the input buffer and padding the code with zeros.
|
// size of the input buffer and padding the code with zeros.
|
||||||
if (d_bit_transition_flag)
|
if (acq_parameters.bit_transition_flag)
|
||||||
{
|
{
|
||||||
d_fft_size *= 2;
|
d_fft_size *= 2;
|
||||||
d_max_dwells = 1; //Activation of d_bit_transition_flag invalidates the value of d_max_dwells
|
acq_parameters.max_dwells = 1; //Activation of acq_parameters.bit_transition_flag invalidates the value of acq_parameters.max_dwells
|
||||||
}
|
}
|
||||||
|
|
||||||
d_fft_codes = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
d_fft_codes = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||||
@ -129,12 +106,9 @@ pcps_acquisition::pcps_acquisition(
|
|||||||
// Inverse FFT
|
// Inverse FFT
|
||||||
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
||||||
|
|
||||||
// For dumping samples into a file
|
|
||||||
d_dump = dump;
|
|
||||||
d_dump_filename = dump_filename;
|
|
||||||
d_gnss_synchro = 0;
|
d_gnss_synchro = 0;
|
||||||
d_grid_doppler_wipeoffs = 0;
|
d_grid_doppler_wipeoffs = nullptr;
|
||||||
d_blocking = blocking;
|
d_grid_doppler_wipeoffs_step_two = nullptr;
|
||||||
d_worker_active = false;
|
d_worker_active = false;
|
||||||
d_data_buffer = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
d_data_buffer = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||||
if (d_cshort)
|
if (d_cshort)
|
||||||
@ -146,6 +120,7 @@ pcps_acquisition::pcps_acquisition(
|
|||||||
d_data_buffer_sc = nullptr;
|
d_data_buffer_sc = nullptr;
|
||||||
}
|
}
|
||||||
grid_ = arma::fmat();
|
grid_ = arma::fmat();
|
||||||
|
d_step_two = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -159,6 +134,14 @@ pcps_acquisition::~pcps_acquisition()
|
|||||||
}
|
}
|
||||||
delete[] d_grid_doppler_wipeoffs;
|
delete[] d_grid_doppler_wipeoffs;
|
||||||
}
|
}
|
||||||
|
if (acq_parameters.make_2_steps)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < acq_parameters.num_doppler_bins_step2; i++)
|
||||||
|
{
|
||||||
|
volk_gnsssdr_free(d_grid_doppler_wipeoffs_step_two[i]);
|
||||||
|
}
|
||||||
|
delete[] d_grid_doppler_wipeoffs_step_two;
|
||||||
|
}
|
||||||
volk_gnsssdr_free(d_fft_codes);
|
volk_gnsssdr_free(d_fft_codes);
|
||||||
volk_gnsssdr_free(d_magnitude);
|
volk_gnsssdr_free(d_magnitude);
|
||||||
delete d_ifft;
|
delete d_ifft;
|
||||||
@ -174,7 +157,7 @@ pcps_acquisition::~pcps_acquisition()
|
|||||||
void pcps_acquisition::set_local_code(std::complex<float>* code)
|
void pcps_acquisition::set_local_code(std::complex<float>* code)
|
||||||
{
|
{
|
||||||
// reset the intermediate frequency
|
// reset the intermediate frequency
|
||||||
d_freq = d_old_freq;
|
acq_parameters.freq = d_old_freq;
|
||||||
// This will check if it's fdma, if yes will update the intermediate frequency and the doppler grid
|
// This will check if it's fdma, if yes will update the intermediate frequency and the doppler grid
|
||||||
if (is_fdma())
|
if (is_fdma())
|
||||||
{
|
{
|
||||||
@ -185,7 +168,7 @@ void pcps_acquisition::set_local_code(std::complex<float>* code)
|
|||||||
// [ 0 0 0 ... 0 c_0 c_1 ... c_L]
|
// [ 0 0 0 ... 0 c_0 c_1 ... c_L]
|
||||||
// where c_i is the local code and there are L zeros and L chips
|
// where c_i is the local code and there are L zeros and L chips
|
||||||
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
|
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
|
||||||
if (d_bit_transition_flag)
|
if (acq_parameters.bit_transition_flag)
|
||||||
{
|
{
|
||||||
int offset = d_fft_size / 2;
|
int offset = d_fft_size / 2;
|
||||||
std::fill_n(d_fft_if->get_inbuf(), offset, gr_complex(0.0, 0.0));
|
std::fill_n(d_fft_if->get_inbuf(), offset, gr_complex(0.0, 0.0));
|
||||||
@ -206,14 +189,14 @@ bool pcps_acquisition::is_fdma()
|
|||||||
// Dealing with FDMA system
|
// Dealing with FDMA system
|
||||||
if (strcmp(d_gnss_synchro->Signal, "1G") == 0)
|
if (strcmp(d_gnss_synchro->Signal, "1G") == 0)
|
||||||
{
|
{
|
||||||
d_freq += DFRQ1_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN);
|
acq_parameters.freq += DFRQ1_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN);
|
||||||
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
|
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << acq_parameters.freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (strcmp(d_gnss_synchro->Signal, "2G") == 0)
|
else if (strcmp(d_gnss_synchro->Signal, "2G") == 0)
|
||||||
{
|
{
|
||||||
d_freq += DFRQ2_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN);
|
acq_parameters.freq += DFRQ2_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN);
|
||||||
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
|
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << acq_parameters.freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -225,7 +208,7 @@ bool pcps_acquisition::is_fdma()
|
|||||||
|
|
||||||
void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq)
|
void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq)
|
||||||
{
|
{
|
||||||
float phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(d_fs_in);
|
float phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.fs_in);
|
||||||
float _phase[1];
|
float _phase[1];
|
||||||
_phase[0] = 0;
|
_phase[0] = 0;
|
||||||
volk_gnsssdr_s32f_sincos_32fc(carrier_vector, -phase_step_rad, _phase, correlator_length_samples);
|
volk_gnsssdr_s32f_sincos_32fc(carrier_vector, -phase_step_rad, _phase, correlator_length_samples);
|
||||||
@ -245,22 +228,29 @@ void pcps_acquisition::init()
|
|||||||
d_mag = 0.0;
|
d_mag = 0.0;
|
||||||
d_input_power = 0.0;
|
d_input_power = 0.0;
|
||||||
|
|
||||||
d_num_doppler_bins = static_cast<unsigned int>(std::ceil(static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step)));
|
d_num_doppler_bins = static_cast<unsigned int>(std::ceil(static_cast<double>(static_cast<int>(acq_parameters.doppler_max) - static_cast<int>(-acq_parameters.doppler_max)) / static_cast<double>(d_doppler_step)));
|
||||||
|
|
||||||
// Create the carrier Doppler wipeoff signals
|
// Create the carrier Doppler wipeoff signals
|
||||||
d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins];
|
d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins];
|
||||||
|
if (acq_parameters.make_2_steps)
|
||||||
|
{
|
||||||
|
d_grid_doppler_wipeoffs_step_two = new gr_complex*[acq_parameters.num_doppler_bins_step2];
|
||||||
|
for (unsigned int doppler_index = 0; doppler_index < acq_parameters.num_doppler_bins_step2; doppler_index++)
|
||||||
|
{
|
||||||
|
d_grid_doppler_wipeoffs_step_two[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||||
|
}
|
||||||
|
}
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||||
int doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
int doppler = -static_cast<int>(acq_parameters.doppler_max) + d_doppler_step * doppler_index;
|
||||||
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_freq + doppler);
|
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, acq_parameters.freq + doppler);
|
||||||
}
|
}
|
||||||
d_worker_active = false;
|
d_worker_active = false;
|
||||||
|
|
||||||
if (d_dump)
|
if (acq_parameters.dump)
|
||||||
{
|
{
|
||||||
unsigned int effective_fft_size = (d_bit_transition_flag ? (d_fft_size / 2) : d_fft_size);
|
unsigned int effective_fft_size = (acq_parameters.bit_transition_flag ? (d_fft_size / 2) : d_fft_size);
|
||||||
grid_ = arma::fmat(effective_fft_size, d_num_doppler_bins, arma::fill::zeros);
|
grid_ = arma::fmat(effective_fft_size, d_num_doppler_bins, arma::fill::zeros);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,12 +260,19 @@ void pcps_acquisition::update_grid_doppler_wipeoffs()
|
|||||||
{
|
{
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
int doppler = -static_cast<int>(acq_parameters.doppler_max) + d_doppler_step * doppler_index;
|
||||||
int doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, acq_parameters.freq + doppler);
|
||||||
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_freq + doppler);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pcps_acquisition::update_grid_doppler_wipeoffs_step2()
|
||||||
|
{
|
||||||
|
for (unsigned int doppler_index = 0; doppler_index < acq_parameters.num_doppler_bins_step2; doppler_index++)
|
||||||
|
{
|
||||||
|
float doppler = (static_cast<float>(doppler_index) - static_cast<float>(acq_parameters.num_doppler_bins_step2) / 2.0) * acq_parameters.doppler_step2;
|
||||||
|
update_local_carrier(d_grid_doppler_wipeoffs_step_two[doppler_index], d_fft_size, d_doppler_center_step_two + doppler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void pcps_acquisition::set_state(int state)
|
void pcps_acquisition::set_state(int state)
|
||||||
{
|
{
|
||||||
@ -354,10 +351,17 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
gr::thread::scoped_lock lk(d_setlock);
|
gr::thread::scoped_lock lk(d_setlock);
|
||||||
if (!d_active || d_worker_active)
|
if (!d_active or d_worker_active)
|
||||||
{
|
{
|
||||||
d_sample_counter += d_fft_size * ninput_items[0];
|
d_sample_counter += d_fft_size * ninput_items[0];
|
||||||
consume_each(ninput_items[0]);
|
consume_each(ninput_items[0]);
|
||||||
|
if (d_step_two)
|
||||||
|
{
|
||||||
|
d_doppler_center_step_two = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
|
||||||
|
update_grid_doppler_wipeoffs_step2();
|
||||||
|
d_state = 0;
|
||||||
|
d_active = true;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +394,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
memcpy(d_data_buffer, input_items[0], d_fft_size * sizeof(gr_complex));
|
memcpy(d_data_buffer, input_items[0], d_fft_size * sizeof(gr_complex));
|
||||||
}
|
}
|
||||||
if (d_blocking)
|
if (acq_parameters.blocking)
|
||||||
{
|
{
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
acquisition_core(d_sample_counter);
|
acquisition_core(d_sample_counter);
|
||||||
@ -414,11 +418,10 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
|||||||
gr::thread::scoped_lock lk(d_setlock);
|
gr::thread::scoped_lock lk(d_setlock);
|
||||||
|
|
||||||
// initialize acquisition algorithm
|
// initialize acquisition algorithm
|
||||||
int doppler;
|
|
||||||
uint32_t indext = 0;
|
uint32_t indext = 0;
|
||||||
float magt = 0.0;
|
float magt = 0.0;
|
||||||
const gr_complex* in = d_data_buffer; //Get the input samples pointer
|
const gr_complex* in = d_data_buffer; //Get the input samples pointer
|
||||||
int effective_fft_size = (d_bit_transition_flag ? d_fft_size / 2 : d_fft_size);
|
int effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size);
|
||||||
if (d_cshort)
|
if (d_cshort)
|
||||||
{
|
{
|
||||||
volk_gnsssdr_16ic_convert_32fc(d_data_buffer, d_data_buffer_sc, d_fft_size);
|
volk_gnsssdr_16ic_convert_32fc(d_data_buffer, d_data_buffer_sc, d_fft_size);
|
||||||
@ -432,12 +435,12 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
|||||||
DLOG(INFO) << "Channel: " << d_channel
|
DLOG(INFO) << "Channel: " << d_channel
|
||||||
<< " , doing acquisition of satellite: " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN
|
<< " , doing acquisition of satellite: " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN
|
||||||
<< " ,sample stamp: " << samp_count << ", threshold: "
|
<< " ,sample stamp: " << samp_count << ", threshold: "
|
||||||
<< d_threshold << ", doppler_max: " << d_doppler_max
|
<< d_threshold << ", doppler_max: " << acq_parameters.doppler_max
|
||||||
<< ", doppler_step: " << d_doppler_step
|
<< ", doppler_step: " << d_doppler_step
|
||||||
<< ", use_CFAR_algorithm_flag: " << (d_use_CFAR_algorithm_flag ? "true" : "false");
|
<< ", use_CFAR_algorithm_flag: " << (acq_parameters.use_CFAR_algorithm_flag ? "true" : "false");
|
||||||
|
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
if (d_use_CFAR_algorithm_flag)
|
if (acq_parameters.use_CFAR_algorithm_flag)
|
||||||
{
|
{
|
||||||
// 1- (optional) Compute the input signal power estimation
|
// 1- (optional) Compute the input signal power estimation
|
||||||
volk_32fc_magnitude_squared_32f(d_magnitude, in, d_fft_size);
|
volk_32fc_magnitude_squared_32f(d_magnitude, in, d_fft_size);
|
||||||
@ -445,142 +448,241 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
|||||||
d_input_power /= static_cast<float>(d_fft_size);
|
d_input_power /= static_cast<float>(d_fft_size);
|
||||||
}
|
}
|
||||||
// 2- Doppler frequency search loop
|
// 2- Doppler frequency search loop
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
if (!d_step_two)
|
||||||
{
|
{
|
||||||
// doppler search steps
|
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
|
||||||
|
|
||||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
|
||||||
|
|
||||||
// 3- Perform the FFT-based convolution (parallel time search)
|
|
||||||
// Compute the FFT of the carrier wiped--off incoming signal
|
|
||||||
d_fft_if->execute();
|
|
||||||
|
|
||||||
// Multiply carrier wiped--off, Fourier transformed incoming signal
|
|
||||||
// with the local FFT'd code reference using SIMD operations with VOLK library
|
|
||||||
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size);
|
|
||||||
|
|
||||||
// compute the inverse FFT
|
|
||||||
d_ifft->execute();
|
|
||||||
|
|
||||||
// Search maximum
|
|
||||||
size_t offset = (d_bit_transition_flag ? effective_fft_size : 0);
|
|
||||||
volk_32fc_magnitude_squared_32f(d_magnitude, d_ifft->get_outbuf() + offset, effective_fft_size);
|
|
||||||
volk_gnsssdr_32f_index_max_32u(&indext, d_magnitude, effective_fft_size);
|
|
||||||
magt = d_magnitude[indext];
|
|
||||||
|
|
||||||
if (d_use_CFAR_algorithm_flag)
|
|
||||||
{
|
{
|
||||||
// Normalize the maximum value to correct the scale factor introduced by FFTW
|
// doppler search steps
|
||||||
magt = d_magnitude[indext] / (fft_normalization_factor * fft_normalization_factor);
|
int doppler = -static_cast<int>(acq_parameters.doppler_max) + d_doppler_step * doppler_index;
|
||||||
}
|
|
||||||
// 4- record the maximum peak and the associated synchronization parameters
|
|
||||||
if (d_mag < magt)
|
|
||||||
{
|
|
||||||
d_mag = magt;
|
|
||||||
|
|
||||||
if (!d_use_CFAR_algorithm_flag)
|
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
||||||
|
|
||||||
|
// 3- Perform the FFT-based convolution (parallel time search)
|
||||||
|
// Compute the FFT of the carrier wiped--off incoming signal
|
||||||
|
d_fft_if->execute();
|
||||||
|
|
||||||
|
// Multiply carrier wiped--off, Fourier transformed incoming signal
|
||||||
|
// with the local FFT'd code reference using SIMD operations with VOLK library
|
||||||
|
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size);
|
||||||
|
|
||||||
|
// compute the inverse FFT
|
||||||
|
d_ifft->execute();
|
||||||
|
|
||||||
|
// Search maximum
|
||||||
|
size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0);
|
||||||
|
volk_32fc_magnitude_squared_32f(d_magnitude, d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||||
|
volk_gnsssdr_32f_index_max_32u(&indext, d_magnitude, effective_fft_size);
|
||||||
|
magt = d_magnitude[indext];
|
||||||
|
|
||||||
|
if (acq_parameters.use_CFAR_algorithm_flag)
|
||||||
{
|
{
|
||||||
// Search grid noise floor approximation for this doppler line
|
// Normalize the maximum value to correct the scale factor introduced by FFTW
|
||||||
volk_32f_accumulator_s32f(&d_input_power, d_magnitude, effective_fft_size);
|
magt = d_magnitude[indext] / (fft_normalization_factor * fft_normalization_factor);
|
||||||
d_input_power = (d_input_power - d_mag) / (effective_fft_size - 1);
|
|
||||||
}
|
}
|
||||||
|
// 4- record the maximum peak and the associated synchronization parameters
|
||||||
// In case that d_bit_transition_flag = true, we compare the potentially
|
if (d_mag < magt)
|
||||||
// new maximum test statistics (d_mag/d_input_power) with the value in
|
|
||||||
// d_test_statistics. When the second dwell is being processed, the value
|
|
||||||
// of d_mag/d_input_power could be lower than d_test_statistics (i.e,
|
|
||||||
// the maximum test statistics in the previous dwell is greater than
|
|
||||||
// current d_mag/d_input_power). Note that d_test_statistics is not
|
|
||||||
// restarted between consecutive dwells in multidwell operation.
|
|
||||||
|
|
||||||
if (d_test_statistics < (d_mag / d_input_power) || !d_bit_transition_flag)
|
|
||||||
{
|
{
|
||||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % d_samples_per_code);
|
d_mag = magt;
|
||||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
|
||||||
d_gnss_synchro->Acq_samplestamp_samples = samp_count;
|
|
||||||
|
|
||||||
// 5- Compute the test statistics and compare to the threshold
|
if (!acq_parameters.use_CFAR_algorithm_flag)
|
||||||
//d_test_statistics = 2 * d_fft_size * d_mag / d_input_power;
|
|
||||||
d_test_statistics = d_mag / d_input_power;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Record results to file if required
|
|
||||||
if (d_dump)
|
|
||||||
{
|
|
||||||
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size);
|
|
||||||
if (doppler_index == (d_num_doppler_bins - 1))
|
|
||||||
{
|
|
||||||
std::string filename = d_dump_filename;
|
|
||||||
filename.append("_");
|
|
||||||
filename.append(1, d_gnss_synchro->System);
|
|
||||||
filename.append("_");
|
|
||||||
filename.append(1, d_gnss_synchro->Signal[0]);
|
|
||||||
filename.append(1, d_gnss_synchro->Signal[1]);
|
|
||||||
filename.append("_sat_");
|
|
||||||
filename.append(std::to_string(d_gnss_synchro->PRN));
|
|
||||||
filename.append(".mat");
|
|
||||||
mat_t* matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
|
||||||
if (matfp == NULL)
|
|
||||||
{
|
{
|
||||||
std::cout << "Unable to create or open Acquisition dump file" << std::endl;
|
// Search grid noise floor approximation for this doppler line
|
||||||
d_dump = false;
|
volk_32f_accumulator_s32f(&d_input_power, d_magnitude, effective_fft_size);
|
||||||
|
d_input_power = (d_input_power - d_mag) / (effective_fft_size - 1);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// In case that acq_parameters.bit_transition_flag = true, we compare the potentially
|
||||||
|
// new maximum test statistics (d_mag/d_input_power) with the value in
|
||||||
|
// d_test_statistics. When the second dwell is being processed, the value
|
||||||
|
// of d_mag/d_input_power could be lower than d_test_statistics (i.e,
|
||||||
|
// the maximum test statistics in the previous dwell is greater than
|
||||||
|
// current d_mag/d_input_power). Note that d_test_statistics is not
|
||||||
|
// restarted between consecutive dwells in multidwell operation.
|
||||||
|
|
||||||
|
if (d_test_statistics < (d_mag / d_input_power) or !acq_parameters.bit_transition_flag)
|
||||||
{
|
{
|
||||||
size_t dims[2] = {static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_bins)};
|
d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % acq_parameters.samples_per_code);
|
||||||
matvar_t* matvar = Mat_VarCreate("grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0);
|
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
d_gnss_synchro->Acq_samplestamp_samples = samp_count;
|
||||||
Mat_VarFree(matvar);
|
|
||||||
|
|
||||||
dims[0] = static_cast<size_t>(1);
|
// 5- Compute the test statistics and compare to the threshold
|
||||||
dims[1] = static_cast<size_t>(1);
|
//d_test_statistics = 2 * d_fft_size * d_mag / d_input_power;
|
||||||
matvar = Mat_VarCreate("doppler_max", MAT_C_SINGLE, MAT_T_UINT32, 1, dims, &d_doppler_max, 0);
|
d_test_statistics = d_mag / d_input_power;
|
||||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
}
|
||||||
Mat_VarFree(matvar);
|
}
|
||||||
|
// Record results to file if required
|
||||||
|
if (acq_parameters.dump)
|
||||||
|
{
|
||||||
|
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size);
|
||||||
|
if (doppler_index == (d_num_doppler_bins - 1))
|
||||||
|
{
|
||||||
|
std::string filename = acq_parameters.dump_filename;
|
||||||
|
filename.append("_");
|
||||||
|
filename.append(1, d_gnss_synchro->System);
|
||||||
|
filename.append("_");
|
||||||
|
filename.append(1, d_gnss_synchro->Signal[0]);
|
||||||
|
filename.append(1, d_gnss_synchro->Signal[1]);
|
||||||
|
filename.append("_sat_");
|
||||||
|
filename.append(std::to_string(d_gnss_synchro->PRN));
|
||||||
|
filename.append(".mat");
|
||||||
|
mat_t* matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||||
|
if (matfp == NULL)
|
||||||
|
{
|
||||||
|
std::cout << "Unable to create or open Acquisition dump file" << std::endl;
|
||||||
|
acq_parameters.dump = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_t dims[2] = {static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_bins)};
|
||||||
|
matvar_t* matvar = Mat_VarCreate("grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
matvar = Mat_VarCreate("doppler_step", MAT_C_SINGLE, MAT_T_UINT32, 1, dims, &d_doppler_step, 0);
|
dims[0] = static_cast<size_t>(1);
|
||||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
dims[1] = static_cast<size_t>(1);
|
||||||
Mat_VarFree(matvar);
|
matvar = Mat_VarCreate("doppler_max", MAT_C_SINGLE, MAT_T_UINT32, 1, dims, &acq_parameters.doppler_max, 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
Mat_Close(matfp);
|
matvar = Mat_VarCreate("doppler_step", MAT_C_SINGLE, MAT_T_UINT32, 1, dims, &d_doppler_step, 0);
|
||||||
|
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||||
|
Mat_VarFree(matvar);
|
||||||
|
|
||||||
|
Mat_Close(matfp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (unsigned int doppler_index = 0; doppler_index < acq_parameters.num_doppler_bins_step2; doppler_index++)
|
||||||
|
{
|
||||||
|
// doppler search steps
|
||||||
|
float doppler = d_doppler_center_step_two + (static_cast<float>(doppler_index) - static_cast<float>(acq_parameters.num_doppler_bins_step2) / 2.0) * acq_parameters.doppler_step2;
|
||||||
|
|
||||||
|
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs_step_two[doppler_index], d_fft_size);
|
||||||
|
|
||||||
|
// 3- Perform the FFT-based convolution (parallel time search)
|
||||||
|
// Compute the FFT of the carrier wiped--off incoming signal
|
||||||
|
d_fft_if->execute();
|
||||||
|
|
||||||
|
// Multiply carrier wiped--off, Fourier transformed incoming signal
|
||||||
|
// with the local FFT'd code reference using SIMD operations with VOLK library
|
||||||
|
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size);
|
||||||
|
|
||||||
|
// compute the inverse FFT
|
||||||
|
d_ifft->execute();
|
||||||
|
|
||||||
|
// Search maximum
|
||||||
|
size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0);
|
||||||
|
volk_32fc_magnitude_squared_32f(d_magnitude, d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||||
|
volk_gnsssdr_32f_index_max_32u(&indext, d_magnitude, effective_fft_size);
|
||||||
|
magt = d_magnitude[indext];
|
||||||
|
|
||||||
|
if (acq_parameters.use_CFAR_algorithm_flag)
|
||||||
|
{
|
||||||
|
// Normalize the maximum value to correct the scale factor introduced by FFTW
|
||||||
|
magt = d_magnitude[indext] / (fft_normalization_factor * fft_normalization_factor);
|
||||||
|
}
|
||||||
|
// 4- record the maximum peak and the associated synchronization parameters
|
||||||
|
if (d_mag < magt)
|
||||||
|
{
|
||||||
|
d_mag = magt;
|
||||||
|
|
||||||
|
if (!acq_parameters.use_CFAR_algorithm_flag)
|
||||||
|
{
|
||||||
|
// Search grid noise floor approximation for this doppler line
|
||||||
|
volk_32f_accumulator_s32f(&d_input_power, d_magnitude, effective_fft_size);
|
||||||
|
d_input_power = (d_input_power - d_mag) / (effective_fft_size - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// In case that acq_parameters.bit_transition_flag = true, we compare the potentially
|
||||||
|
// new maximum test statistics (d_mag/d_input_power) with the value in
|
||||||
|
// d_test_statistics. When the second dwell is being processed, the value
|
||||||
|
// of d_mag/d_input_power could be lower than d_test_statistics (i.e,
|
||||||
|
// the maximum test statistics in the previous dwell is greater than
|
||||||
|
// current d_mag/d_input_power). Note that d_test_statistics is not
|
||||||
|
// restarted between consecutive dwells in multidwell operation.
|
||||||
|
|
||||||
|
if (d_test_statistics < (d_mag / d_input_power) or !acq_parameters.bit_transition_flag)
|
||||||
|
{
|
||||||
|
d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % acq_parameters.samples_per_code);
|
||||||
|
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||||
|
d_gnss_synchro->Acq_samplestamp_samples = samp_count;
|
||||||
|
|
||||||
|
// 5- Compute the test statistics and compare to the threshold
|
||||||
|
//d_test_statistics = 2 * d_fft_size * d_mag / d_input_power;
|
||||||
|
d_test_statistics = d_mag / d_input_power;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lk.lock();
|
lk.lock();
|
||||||
if (!d_bit_transition_flag)
|
if (!acq_parameters.bit_transition_flag)
|
||||||
{
|
{
|
||||||
if (d_test_statistics > d_threshold)
|
if (d_test_statistics > d_threshold)
|
||||||
{
|
{
|
||||||
d_state = 0; // Positive acquisition
|
|
||||||
d_active = false;
|
d_active = false;
|
||||||
send_positive_acquisition();
|
if (acq_parameters.make_2_steps)
|
||||||
|
{
|
||||||
|
if (d_step_two)
|
||||||
|
{
|
||||||
|
send_positive_acquisition();
|
||||||
|
d_step_two = false;
|
||||||
|
d_state = 0; // Positive acquisition
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_step_two = true; // Clear input buffer and make small grid acquisition
|
||||||
|
d_state = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
send_positive_acquisition();
|
||||||
|
d_state = 0; // Positive acquisition
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (d_well_count == d_max_dwells)
|
else if (d_well_count == acq_parameters.max_dwells)
|
||||||
{
|
{
|
||||||
d_state = 0;
|
d_state = 0;
|
||||||
d_active = false;
|
d_active = false;
|
||||||
|
d_step_two = false;
|
||||||
send_negative_acquisition();
|
send_negative_acquisition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (d_well_count == d_max_dwells) // d_max_dwells = 2
|
d_active = false;
|
||||||
|
if (d_test_statistics > d_threshold)
|
||||||
{
|
{
|
||||||
if (d_test_statistics > d_threshold)
|
if (acq_parameters.make_2_steps)
|
||||||
{
|
{
|
||||||
d_state = 0; // Positive acquisition
|
if (d_step_two)
|
||||||
d_active = false;
|
{
|
||||||
send_positive_acquisition();
|
send_positive_acquisition();
|
||||||
|
d_step_two = false;
|
||||||
|
d_state = 0; // Positive acquisition
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_step_two = true; // Clear input buffer and make small grid acquisition
|
||||||
|
d_state = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_state = 0; // Negative acquisition
|
send_positive_acquisition();
|
||||||
d_active = false;
|
d_state = 0; // Positive acquisition
|
||||||
send_negative_acquisition();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_state = 0; // Negative acquisition
|
||||||
|
d_step_two = false;
|
||||||
|
send_negative_acquisition();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
d_worker_active = false;
|
d_worker_active = false;
|
||||||
}
|
}
|
||||||
|
@ -59,18 +59,33 @@
|
|||||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
/* pcps acquisition configuration */
|
||||||
|
unsigned int sampled_ms;
|
||||||
|
unsigned int max_dwells;
|
||||||
|
unsigned int doppler_max;
|
||||||
|
unsigned int num_doppler_bins_step2;
|
||||||
|
float doppler_step2;
|
||||||
|
long freq;
|
||||||
|
long fs_in;
|
||||||
|
int samples_per_ms;
|
||||||
|
int samples_per_code;
|
||||||
|
bool bit_transition_flag;
|
||||||
|
bool use_CFAR_algorithm_flag;
|
||||||
|
bool dump;
|
||||||
|
bool blocking;
|
||||||
|
bool make_2_steps;
|
||||||
|
std::string dump_filename;
|
||||||
|
size_t it_size;
|
||||||
|
} pcpsconf_t;
|
||||||
|
|
||||||
class pcps_acquisition;
|
class pcps_acquisition;
|
||||||
|
|
||||||
typedef boost::shared_ptr<pcps_acquisition> pcps_acquisition_sptr;
|
typedef boost::shared_ptr<pcps_acquisition> pcps_acquisition_sptr;
|
||||||
|
|
||||||
pcps_acquisition_sptr
|
pcps_acquisition_sptr
|
||||||
pcps_make_acquisition(unsigned int sampled_ms, unsigned int max_dwells,
|
pcps_make_acquisition(pcpsconf_t conf_);
|
||||||
unsigned int doppler_max, long freq, long fs_in,
|
|
||||||
int samples_per_ms, int samples_per_code,
|
|
||||||
bool bit_transition_flag, bool use_CFAR_algorithm_flag,
|
|
||||||
bool dump, bool blocking,
|
|
||||||
std::string dump_filename, size_t it_size);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a Parallel Code Phase Search Acquisition.
|
* \brief This class implements a Parallel Code Phase Search Acquisition.
|
||||||
@ -82,22 +97,13 @@ class pcps_acquisition : public gr::block
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
friend pcps_acquisition_sptr
|
friend pcps_acquisition_sptr
|
||||||
pcps_make_acquisition(unsigned int sampled_ms, unsigned int max_dwells,
|
pcps_make_acquisition(pcpsconf_t conf_);
|
||||||
unsigned int doppler_max, long freq, long fs_in,
|
|
||||||
int samples_per_ms, int samples_per_code,
|
|
||||||
bool bit_transition_flag, bool use_CFAR_algorithm_flag,
|
|
||||||
bool dump, bool blocking,
|
|
||||||
std::string dump_filename, size_t it_size);
|
|
||||||
|
|
||||||
pcps_acquisition(unsigned int sampled_ms, unsigned int max_dwells,
|
pcps_acquisition(pcpsconf_t conf_);
|
||||||
unsigned int doppler_max, long freq, long fs_in,
|
|
||||||
int samples_per_ms, int samples_per_code,
|
|
||||||
bool bit_transition_flag, bool use_CFAR_algorithm_flag,
|
|
||||||
bool dump, bool blocking,
|
|
||||||
std::string dump_filename, size_t it_size);
|
|
||||||
|
|
||||||
void update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq);
|
void update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq);
|
||||||
void update_grid_doppler_wipeoffs();
|
void update_grid_doppler_wipeoffs();
|
||||||
|
void update_grid_doppler_wipeoffs_step2();
|
||||||
bool is_fdma();
|
bool is_fdma();
|
||||||
|
|
||||||
void acquisition_core(unsigned long int samp_count);
|
void acquisition_core(unsigned long int samp_count);
|
||||||
@ -106,42 +112,33 @@ private:
|
|||||||
|
|
||||||
void send_positive_acquisition();
|
void send_positive_acquisition();
|
||||||
|
|
||||||
bool d_bit_transition_flag;
|
pcpsconf_t acq_parameters;
|
||||||
bool d_use_CFAR_algorithm_flag;
|
|
||||||
bool d_active;
|
bool d_active;
|
||||||
bool d_dump;
|
|
||||||
bool d_worker_active;
|
bool d_worker_active;
|
||||||
bool d_blocking;
|
|
||||||
bool d_cshort;
|
bool d_cshort;
|
||||||
|
bool d_step_two;
|
||||||
float d_threshold;
|
float d_threshold;
|
||||||
float d_mag;
|
float d_mag;
|
||||||
float d_input_power;
|
float d_input_power;
|
||||||
float d_test_statistics;
|
float d_test_statistics;
|
||||||
float* d_magnitude;
|
float* d_magnitude;
|
||||||
long d_fs_in;
|
|
||||||
long d_freq;
|
|
||||||
long d_old_freq;
|
long d_old_freq;
|
||||||
int d_samples_per_ms;
|
|
||||||
int d_samples_per_code;
|
|
||||||
int d_state;
|
int d_state;
|
||||||
unsigned int d_channel;
|
unsigned int d_channel;
|
||||||
unsigned int d_doppler_max;
|
|
||||||
unsigned int d_doppler_step;
|
unsigned int d_doppler_step;
|
||||||
unsigned int d_sampled_ms;
|
float d_doppler_center_step_two;
|
||||||
unsigned int d_max_dwells;
|
|
||||||
unsigned int d_well_count;
|
unsigned int d_well_count;
|
||||||
unsigned int d_fft_size;
|
unsigned int d_fft_size;
|
||||||
unsigned int d_num_doppler_bins;
|
unsigned int d_num_doppler_bins;
|
||||||
unsigned int d_code_phase;
|
|
||||||
unsigned long int d_sample_counter;
|
unsigned long int d_sample_counter;
|
||||||
gr_complex** d_grid_doppler_wipeoffs;
|
gr_complex** d_grid_doppler_wipeoffs;
|
||||||
|
gr_complex** d_grid_doppler_wipeoffs_step_two;
|
||||||
gr_complex* d_fft_codes;
|
gr_complex* d_fft_codes;
|
||||||
gr_complex* d_data_buffer;
|
gr_complex* d_data_buffer;
|
||||||
lv_16sc_t* d_data_buffer_sc;
|
lv_16sc_t* d_data_buffer_sc;
|
||||||
gr::fft::fft_complex* d_fft_if;
|
gr::fft::fft_complex* d_fft_if;
|
||||||
gr::fft::fft_complex* d_ifft;
|
gr::fft::fft_complex* d_ifft;
|
||||||
Gnss_Synchro* d_gnss_synchro;
|
Gnss_Synchro* d_gnss_synchro;
|
||||||
std::string d_dump_filename;
|
|
||||||
arma::fmat grid_;
|
arma::fmat grid_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -223,7 +220,7 @@ public:
|
|||||||
inline void set_doppler_max(unsigned int doppler_max)
|
inline void set_doppler_max(unsigned int doppler_max)
|
||||||
{
|
{
|
||||||
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
|
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
|
||||||
d_doppler_max = doppler_max;
|
acq_parameters.doppler_max = doppler_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -168,6 +168,7 @@ void GpsL2MPcpsAcquisitionTest::init()
|
|||||||
config->set_property("Acquisition_2S.doppler_max", std::to_string(doppler_max));
|
config->set_property("Acquisition_2S.doppler_max", std::to_string(doppler_max));
|
||||||
config->set_property("Acquisition_2S.doppler_step", std::to_string(doppler_step));
|
config->set_property("Acquisition_2S.doppler_step", std::to_string(doppler_step));
|
||||||
config->set_property("Acquisition_2S.repeat_satellite", "false");
|
config->set_property("Acquisition_2S.repeat_satellite", "false");
|
||||||
|
config->set_property("Acquisition_2S.make_two_steps", "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user