2013-03-20 18:19:26 +00:00
|
|
|
/*!
|
|
|
|
* \file gps_l1_ca_pcps_acquisition.cc
|
|
|
|
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
|
|
|
|
* GPS L1 C/A Signals
|
|
|
|
* \authors <ul>
|
|
|
|
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
|
|
|
|
* <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
|
|
|
* </ul>
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2013-03-20 18:19:26 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2013-03-20 18:19:26 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gps_l1_ca_pcps_assisted_acquisition.h"
|
2014-01-14 23:22:54 +00:00
|
|
|
#include "GPS_L1_CA.h"
|
|
|
|
#include "configuration_interface.h"
|
2018-02-18 17:37:38 +00:00
|
|
|
#include "gnss_sdr_flags.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "gps_sdr_signal_processing.h"
|
|
|
|
#include <glog/logging.h>
|
2018-02-18 17:37:38 +00:00
|
|
|
|
2013-03-20 18:19:26 +00:00
|
|
|
|
|
|
|
GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
|
2020-06-29 07:07:41 +00:00
|
|
|
const ConfigurationInterface* configuration,
|
2018-12-02 04:29:11 +00:00
|
|
|
const std::string& role,
|
|
|
|
unsigned int in_streams,
|
|
|
|
unsigned int out_streams) : role_(role),
|
|
|
|
in_streams_(in_streams),
|
|
|
|
out_streams_(out_streams)
|
2013-03-20 18:19:26 +00:00
|
|
|
{
|
2020-07-09 22:37:55 +00:00
|
|
|
const std::string default_item_type("gr_complex");
|
2013-03-20 18:19:26 +00:00
|
|
|
std::string default_dump_filename = "./data/acquisition.dat";
|
|
|
|
|
|
|
|
DLOG(INFO) << "role " << role;
|
|
|
|
|
2016-01-05 09:59:37 +00:00
|
|
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
2018-12-02 04:29:11 +00:00
|
|
|
int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
|
2017-09-02 09:24:44 +00:00
|
|
|
fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
2013-03-20 18:19:26 +00:00
|
|
|
dump_ = configuration->property(role + ".dump", false);
|
2013-04-02 14:02:55 +00:00
|
|
|
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
|
2019-02-11 20:13:02 +00:00
|
|
|
if (FLAGS_doppler_max != 0)
|
|
|
|
{
|
|
|
|
doppler_max_ = FLAGS_doppler_max;
|
|
|
|
}
|
2018-02-18 17:37:38 +00:00
|
|
|
doppler_min_ = configuration->property(role + ".doppler_min", -doppler_max_);
|
2013-08-28 17:17:57 +00:00
|
|
|
sampled_ms_ = configuration->property(role + ".coherent_integration_time_ms", 1);
|
2018-03-03 01:03:39 +00:00
|
|
|
max_dwells_ = configuration->property(role + ".max_dwells", 1);
|
2016-01-05 09:59:37 +00:00
|
|
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
2013-03-20 18:19:26 +00:00
|
|
|
|
2019-08-18 20:16:13 +00:00
|
|
|
// --- Find number of samples per spreading code -------------------------
|
2020-07-09 22:37:55 +00:00
|
|
|
vector_length_ = static_cast<unsigned int>(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)));
|
2013-03-20 18:19:26 +00:00
|
|
|
|
2020-05-07 19:47:45 +00:00
|
|
|
code_.reserve(vector_length_);
|
2013-03-20 18:19:26 +00:00
|
|
|
|
2018-12-02 04:29:11 +00:00
|
|
|
if (item_type_ == "gr_complex")
|
2015-05-15 17:38:51 +00:00
|
|
|
{
|
|
|
|
item_size_ = sizeof(gr_complex);
|
2016-05-09 14:44:54 +00:00
|
|
|
acquisition_cc_ = pcps_make_assisted_acquisition_cc(max_dwells_, sampled_ms_,
|
2018-06-06 15:25:03 +00:00
|
|
|
doppler_max_, doppler_min_, fs_in_, vector_length_,
|
2018-03-03 01:03:39 +00:00
|
|
|
dump_, dump_filename_);
|
2015-05-15 17:38:51 +00:00
|
|
|
}
|
2013-03-20 18:19:26 +00:00
|
|
|
else
|
2015-05-15 17:38:51 +00:00
|
|
|
{
|
|
|
|
item_size_ = sizeof(gr_complex);
|
|
|
|
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
|
|
|
}
|
2016-05-06 17:04:55 +00:00
|
|
|
|
2015-05-15 17:38:51 +00:00
|
|
|
channel_ = 0;
|
2016-05-06 17:04:55 +00:00
|
|
|
threshold_ = 0.0;
|
|
|
|
doppler_step_ = 0;
|
2018-12-02 04:29:11 +00:00
|
|
|
gnss_synchro_ = nullptr;
|
2019-06-28 23:28:30 +00:00
|
|
|
|
2018-06-03 17:11:16 +00:00
|
|
|
if (in_streams_ > 1)
|
|
|
|
{
|
|
|
|
LOG(ERROR) << "This implementation only supports one input stream";
|
|
|
|
}
|
|
|
|
if (out_streams_ > 0)
|
|
|
|
{
|
|
|
|
LOG(ERROR) << "This implementation does not provide an output stream";
|
|
|
|
}
|
2013-03-20 18:19:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-12-02 04:29:11 +00:00
|
|
|
void GpsL1CaPcpsAssistedAcquisition::stop_acquisition()
|
|
|
|
{
|
2020-06-27 07:52:59 +00:00
|
|
|
acquisition_cc_->set_active(false);
|
|
|
|
acquisition_cc_->set_state(0);
|
2018-12-02 04:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-20 18:19:26 +00:00
|
|
|
void GpsL1CaPcpsAssistedAcquisition::set_threshold(float threshold)
|
|
|
|
{
|
|
|
|
threshold_ = threshold;
|
|
|
|
acquisition_cc_->set_threshold(threshold_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GpsL1CaPcpsAssistedAcquisition::set_doppler_max(unsigned int doppler_max)
|
|
|
|
{
|
|
|
|
doppler_max_ = doppler_max;
|
|
|
|
acquisition_cc_->set_doppler_max(doppler_max_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GpsL1CaPcpsAssistedAcquisition::set_doppler_step(unsigned int doppler_step)
|
|
|
|
{
|
|
|
|
doppler_step_ = doppler_step;
|
|
|
|
acquisition_cc_->set_doppler_step(doppler_step_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GpsL1CaPcpsAssistedAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
|
|
|
|
{
|
|
|
|
gnss_synchro_ = gnss_synchro;
|
|
|
|
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
signed int GpsL1CaPcpsAssistedAcquisition::mag()
|
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
return acquisition_cc_->mag();
|
2013-03-20 18:19:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-23 18:03:07 +00:00
|
|
|
void GpsL1CaPcpsAssistedAcquisition::init()
|
|
|
|
{
|
|
|
|
acquisition_cc_->init();
|
2013-03-20 18:19:26 +00:00
|
|
|
}
|
|
|
|
|
2019-07-27 09:22:08 +00:00
|
|
|
|
2013-07-23 18:03:07 +00:00
|
|
|
void GpsL1CaPcpsAssistedAcquisition::set_local_code()
|
|
|
|
{
|
2019-07-27 09:22:08 +00:00
|
|
|
gps_l1_ca_code_gen_complex_sampled(code_, gnss_synchro_->PRN, fs_in_, 0);
|
2020-05-07 19:47:45 +00:00
|
|
|
acquisition_cc_->set_local_code(code_.data());
|
2013-07-23 18:03:07 +00:00
|
|
|
}
|
2013-03-20 18:19:26 +00:00
|
|
|
|
2019-07-27 09:22:08 +00:00
|
|
|
|
2013-03-20 18:19:26 +00:00
|
|
|
void GpsL1CaPcpsAssistedAcquisition::reset()
|
|
|
|
{
|
2016-01-05 09:59:37 +00:00
|
|
|
acquisition_cc_->set_active(true);
|
2013-03-20 18:19:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
void GpsL1CaPcpsAssistedAcquisition::connect(gr::top_block_sptr top_block)
|
2013-03-20 18:19:26 +00:00
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
if (top_block)
|
|
|
|
{ /* top_block is not null */
|
|
|
|
};
|
2019-08-18 20:16:13 +00:00
|
|
|
// nothing to disconnect, now the tracking uses gr_sync_decimator
|
2013-03-20 18:19:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
void GpsL1CaPcpsAssistedAcquisition::disconnect(gr::top_block_sptr top_block)
|
2013-03-20 18:19:26 +00:00
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
if (top_block)
|
|
|
|
{ /* top_block is not null */
|
|
|
|
};
|
2019-08-18 20:16:13 +00:00
|
|
|
// nothing to disconnect, now the tracking uses gr_sync_decimator
|
2013-03-20 18:19:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
gr::basic_block_sptr GpsL1CaPcpsAssistedAcquisition::get_left_block()
|
2013-03-20 18:19:26 +00:00
|
|
|
{
|
|
|
|
return acquisition_cc_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
gr::basic_block_sptr GpsL1CaPcpsAssistedAcquisition::get_right_block()
|
2013-03-20 18:19:26 +00:00
|
|
|
{
|
|
|
|
return acquisition_cc_;
|
|
|
|
}
|