2018-03-24 18:42:04 +00:00
|
|
|
/*!
|
|
|
|
* \file glonass_l2_ca_dll_pll_tracking.cc
|
|
|
|
* \brief Interface of an adapter of a DLL+PLL tracking loop block
|
|
|
|
* for Glonass L2 C/A to a TrackingInterface
|
|
|
|
* \author Damian Miralles, 2018, dmiralles2009(at)gmail.com *
|
|
|
|
*
|
|
|
|
* Code DLL + carrier PLL according to the algorithms described in:
|
|
|
|
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
|
|
|
|
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency
|
|
|
|
* Approach, Birkha user, 2007
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-03-24 18:42:04 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2018-03-24 18:42:04 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2018-03-24 18:42:04 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-03-24 18:42:04 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "glonass_l2_ca_dll_pll_tracking.h"
|
|
|
|
#include "GLONASS_L1_L2_CA.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "configuration_interface.h"
|
2018-03-24 18:42:04 +00:00
|
|
|
#include "gnss_sdr_flags.h"
|
2024-04-29 06:27:33 +00:00
|
|
|
|
|
|
|
#if USE_GLOG_AND_GFLAGS
|
2018-03-24 18:42:04 +00:00
|
|
|
#include <glog/logging.h>
|
2024-04-29 06:27:33 +00:00
|
|
|
#else
|
|
|
|
#include <absl/log/log.h>
|
|
|
|
#endif
|
2018-03-24 18:42:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking(
|
2022-12-08 16:39:16 +00:00
|
|
|
const ConfigurationInterface* configuration,
|
|
|
|
const std::string& role,
|
|
|
|
unsigned int in_streams,
|
|
|
|
unsigned int out_streams)
|
|
|
|
: role_(role),
|
|
|
|
item_size_(sizeof(gr_complex)),
|
|
|
|
channel_(0),
|
|
|
|
in_streams_(in_streams),
|
|
|
|
out_streams_(out_streams)
|
2018-03-24 18:42:04 +00:00
|
|
|
{
|
2019-07-28 10:01:11 +00:00
|
|
|
// ################# CONFIGURATION PARAMETERS ########################
|
2020-07-09 22:37:55 +00:00
|
|
|
const std::string default_item_type("gr_complex");
|
2022-12-08 16:39:16 +00:00
|
|
|
std::string item_type = configuration->property(role_ + ".item_type", default_item_type);
|
2018-03-24 18:42:04 +00:00
|
|
|
int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
|
2020-07-09 22:37:55 +00:00
|
|
|
int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
2022-12-08 16:39:16 +00:00
|
|
|
bool dump = configuration->property(role_ + ".dump", false);
|
|
|
|
float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast<float>(50.0));
|
2024-04-29 06:27:33 +00:00
|
|
|
#if USE_GLOG_AND_GFLAGS
|
2019-02-11 20:13:02 +00:00
|
|
|
if (FLAGS_pll_bw_hz != 0.0)
|
|
|
|
{
|
|
|
|
pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
|
|
|
}
|
2024-04-29 06:27:33 +00:00
|
|
|
#else
|
|
|
|
if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0)
|
|
|
|
{
|
|
|
|
pll_bw_hz = static_cast<float>(absl::GetFlag(FLAGS_pll_bw_hz));
|
|
|
|
}
|
|
|
|
#endif
|
2022-12-08 16:39:16 +00:00
|
|
|
float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast<float>(2.0));
|
2024-04-29 06:27:33 +00:00
|
|
|
#if USE_GLOG_AND_GFLAGS
|
2019-02-11 20:13:02 +00:00
|
|
|
if (FLAGS_dll_bw_hz != 0.0)
|
|
|
|
{
|
|
|
|
dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
|
|
|
}
|
2024-04-29 06:27:33 +00:00
|
|
|
#else
|
|
|
|
if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0)
|
|
|
|
{
|
|
|
|
dll_bw_hz = static_cast<float>(absl::GetFlag(FLAGS_dll_bw_hz));
|
|
|
|
}
|
|
|
|
#endif
|
2022-12-08 16:39:16 +00:00
|
|
|
float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast<float>(0.5));
|
2020-07-09 22:37:55 +00:00
|
|
|
const std::string default_dump_filename("./track_ch");
|
2022-12-08 16:39:16 +00:00
|
|
|
std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename);
|
2020-07-17 08:48:37 +00:00
|
|
|
const auto vector_length = static_cast<int>(std::round(fs_in / (GLONASS_L2_CA_CODE_RATE_CPS / GLONASS_L2_CA_CODE_LENGTH_CHIPS)));
|
2018-03-24 18:42:04 +00:00
|
|
|
|
2019-07-28 10:01:11 +00:00
|
|
|
// ################# MAKE TRACKING GNURadio object ###################
|
2022-12-08 16:39:16 +00:00
|
|
|
DLOG(INFO) << "role " << role_;
|
2018-12-03 11:52:17 +00:00
|
|
|
if (item_type == "gr_complex")
|
2018-03-24 18:42:04 +00:00
|
|
|
{
|
2022-12-08 16:39:16 +00:00
|
|
|
tracking_sptr_ = glonass_l2_ca_dll_pll_make_tracking_cc(
|
2018-03-24 18:42:04 +00:00
|
|
|
fs_in,
|
|
|
|
vector_length,
|
|
|
|
dump,
|
|
|
|
dump_filename,
|
|
|
|
pll_bw_hz,
|
|
|
|
dll_bw_hz,
|
|
|
|
early_late_space_chips);
|
2022-12-08 16:39:16 +00:00
|
|
|
DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")";
|
2018-03-24 18:42:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-26 13:01:28 +00:00
|
|
|
item_size_ = 0;
|
2022-12-08 16:39:16 +00:00
|
|
|
tracking_sptr_ = nullptr;
|
2018-03-24 18:42:04 +00:00
|
|
|
LOG(WARNING) << item_type << " unknown tracking item type.";
|
|
|
|
}
|
2022-12-08 16:39:16 +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_ > 1)
|
|
|
|
{
|
|
|
|
LOG(ERROR) << "This implementation only supports one output stream";
|
|
|
|
}
|
2018-03-24 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-12-03 10:12:10 +00:00
|
|
|
void GlonassL2CaDllPllTracking::stop_tracking()
|
2018-03-24 18:42:04 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GlonassL2CaDllPllTracking::start_tracking()
|
|
|
|
{
|
2022-12-08 16:39:16 +00:00
|
|
|
tracking_sptr_->start_tracking();
|
2018-03-24 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set tracking channel unique ID
|
|
|
|
*/
|
|
|
|
void GlonassL2CaDllPllTracking::set_channel(unsigned int channel)
|
|
|
|
{
|
|
|
|
channel_ = channel;
|
2022-12-08 16:39:16 +00:00
|
|
|
tracking_sptr_->set_channel(channel);
|
2018-03-24 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GlonassL2CaDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
|
|
|
{
|
2022-12-08 16:39:16 +00:00
|
|
|
tracking_sptr_->set_gnss_synchro(p_gnss_synchro);
|
2018-03-24 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GlonassL2CaDllPllTracking::connect(gr::top_block_sptr top_block)
|
|
|
|
{
|
|
|
|
if (top_block)
|
|
|
|
{ /* top_block is not null */
|
|
|
|
};
|
2019-07-28 10:01:11 +00:00
|
|
|
// nothing to connect, now the tracking uses gr_sync_decimator
|
2018-03-24 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GlonassL2CaDllPllTracking::disconnect(gr::top_block_sptr top_block)
|
|
|
|
{
|
|
|
|
if (top_block)
|
|
|
|
{ /* top_block is not null */
|
|
|
|
};
|
2019-07-28 10:01:11 +00:00
|
|
|
// nothing to disconnect, now the tracking uses gr_sync_decimator
|
2018-03-24 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gr::basic_block_sptr GlonassL2CaDllPllTracking::get_left_block()
|
|
|
|
{
|
2022-12-08 16:39:16 +00:00
|
|
|
return tracking_sptr_;
|
2018-03-24 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gr::basic_block_sptr GlonassL2CaDllPllTracking::get_right_block()
|
|
|
|
{
|
2022-12-08 16:39:16 +00:00
|
|
|
return tracking_sptr_;
|
2018-03-24 18:42:04 +00:00
|
|
|
}
|