mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-28 05:57:39 +00:00
Merge branch 'next' into unify_tracking
This commit is contained in:
53
src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc
Executable file → Normal file
53
src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc
Executable file → Normal file
@@ -44,9 +44,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -72,9 +71,9 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 5.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 0.5);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 2.0);
|
||||
dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 0.25);
|
||||
int extend_correlation_symbols;
|
||||
@@ -88,7 +87,7 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
|
||||
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename",
|
||||
default_dump_filename); //unused!
|
||||
default_dump_filename); //unused!
|
||||
vector_length = std::round(fs_in / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -96,21 +95,21 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_ = galileo_e1_dll_pll_veml_make_tracking_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
early_late_space_chips,
|
||||
very_early_late_space_chips,
|
||||
early_late_space_narrow_chips,
|
||||
very_early_late_space_narrow_chips,
|
||||
extend_correlation_symbols,
|
||||
track_pilot);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
early_late_space_chips,
|
||||
very_early_late_space_chips,
|
||||
early_late_space_narrow_chips,
|
||||
very_early_late_space_narrow_chips,
|
||||
extend_correlation_symbols,
|
||||
track_pilot);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -125,7 +124,8 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
|
||||
|
||||
|
||||
GalileoE1DllPllVemlTracking::~GalileoE1DllPllVemlTracking()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1DllPllVemlTracking::start_tracking()
|
||||
@@ -152,14 +152,18 @@ void GalileoE1DllPllVemlTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
|
||||
void GalileoE1DllPllVemlTracking::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1DllPllVemlTracking::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
@@ -174,4 +178,3 @@ gr::basic_block_sptr GalileoE1DllPllVemlTracking::get_right_block()
|
||||
{
|
||||
return tracking_;
|
||||
}
|
||||
|
||||
|
||||
8
src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h
Executable file → Normal file
8
src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h
Executable file → Normal file
@@ -52,9 +52,9 @@ class GalileoE1DllPllVemlTracking : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GalileoE1DllPllVemlTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GalileoE1DllPllVemlTracking();
|
||||
|
||||
@@ -102,4 +102,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GALILEO_E1_DLL_PLL_VEML_TRACKING_H_
|
||||
#endif // GNSS_SDR_GALILEO_E1_DLL_PLL_VEML_TRACKING_H_
|
||||
|
||||
@@ -45,9 +45,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -63,20 +62,20 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking(
|
||||
float early_late_space_chips;
|
||||
float very_early_late_space_chips;
|
||||
size_t port_ch0;
|
||||
item_type = configuration->property(role + ".item_type",default_item_type);
|
||||
item_type = configuration->property(role + ".item_type", default_item_type);
|
||||
int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||
fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.15);
|
||||
very_early_late_space_chips = configuration->property(role + ".very_early_late_space_chips", 0.6);
|
||||
port_ch0 = configuration->property(role + ".port_ch0", 2060);
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); //unused!
|
||||
dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); //unused!
|
||||
vector_length = std::round(fs_in / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -84,16 +83,16 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_ = galileo_e1_tcp_connector_make_tracking_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips,
|
||||
very_early_late_space_chips,
|
||||
port_ch0);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips,
|
||||
very_early_late_space_chips,
|
||||
port_ch0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -106,7 +105,8 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking(
|
||||
|
||||
|
||||
GalileoE1TcpConnectorTracking::~GalileoE1TcpConnectorTracking()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1TcpConnectorTracking::start_tracking()
|
||||
@@ -131,13 +131,17 @@ void GalileoE1TcpConnectorTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchr
|
||||
|
||||
void GalileoE1TcpConnectorTracking::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
void GalileoE1TcpConnectorTracking::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
@@ -150,4 +154,3 @@ gr::basic_block_sptr GalileoE1TcpConnectorTracking::get_right_block()
|
||||
{
|
||||
return tracking_;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,9 +53,9 @@ class GalileoE1TcpConnectorTracking : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GalileoE1TcpConnectorTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GalileoE1TcpConnectorTracking();
|
||||
|
||||
@@ -103,4 +103,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GALILEO_E1_TCP_CONNECTOR_TRACKING_H_
|
||||
#endif // GNSS_SDR_GALILEO_E1_TCP_CONNECTOR_TRACKING_H_
|
||||
|
||||
@@ -45,9 +45,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -71,9 +70,9 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 20.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 20.0);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 5.0);
|
||||
dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0);
|
||||
ti_ms = configuration->property(role + ".ti_ms", 3);
|
||||
@@ -81,7 +80,7 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename",
|
||||
default_dump_filename); //unused!
|
||||
default_dump_filename); //unused!
|
||||
vector_length = std::round(fs_in / (Galileo_E5a_CODE_CHIP_RATE_HZ / Galileo_E5a_CODE_LENGTH_CHIPS));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -89,17 +88,17 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_ = galileo_e5a_dll_pll_make_tracking_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
ti_ms,
|
||||
early_late_space_chips);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
ti_ms,
|
||||
early_late_space_chips);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -112,7 +111,8 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
|
||||
|
||||
|
||||
GalileoE5aDllPllTracking::~GalileoE5aDllPllTracking()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GalileoE5aDllPllTracking::start_tracking()
|
||||
@@ -137,13 +137,17 @@ void GalileoE5aDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
|
||||
void GalileoE5aDllPllTracking::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
void GalileoE5aDllPllTracking::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
@@ -156,5 +160,3 @@ gr::basic_block_sptr GalileoE5aDllPllTracking::get_right_block()
|
||||
{
|
||||
return tracking_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ class GalileoE5aDllPllTracking : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GalileoE5aDllPllTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GalileoE5aDllPllTracking();
|
||||
|
||||
|
||||
@@ -47,9 +47,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -71,9 +70,9 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking(
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 20.0);
|
||||
dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0);
|
||||
int extend_correlation_ms;
|
||||
@@ -82,7 +81,7 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking(
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename",
|
||||
default_dump_filename); //unused!
|
||||
default_dump_filename); //unused!
|
||||
vector_length = std::round(fs_in / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -90,34 +89,34 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_cc = glonass_l1_ca_dll_pll_c_aid_make_tracking_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
extend_correlation_ms,
|
||||
early_late_space_chips);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
extend_correlation_ms,
|
||||
early_late_space_chips);
|
||||
DLOG(INFO) << "tracking(" << tracking_cc->unique_id() << ")";
|
||||
}
|
||||
else if(item_type_.compare("cshort") == 0)
|
||||
else if (item_type_.compare("cshort") == 0)
|
||||
{
|
||||
item_size_ = sizeof(lv_16sc_t);
|
||||
tracking_sc = glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
extend_correlation_ms,
|
||||
early_late_space_chips);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
extend_correlation_ms,
|
||||
early_late_space_chips);
|
||||
DLOG(INFO) << "tracking(" << tracking_sc->unique_id() << ")";
|
||||
}
|
||||
else
|
||||
@@ -130,12 +129,12 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking(
|
||||
|
||||
|
||||
GlonassL1CaDllPllCAidTracking::~GlonassL1CaDllPllCAidTracking()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GlonassL1CaDllPllCAidTracking::start_tracking()
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
tracking_cc->start_tracking();
|
||||
@@ -192,14 +191,18 @@ void GlonassL1CaDllPllCAidTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchr
|
||||
|
||||
void GlonassL1CaDllPllCAidTracking::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
|
||||
void GlonassL1CaDllPllCAidTracking::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@ class ConfigurationInterface;
|
||||
class GlonassL1CaDllPllCAidTracking : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GlonassL1CaDllPllCAidTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
GlonassL1CaDllPllCAidTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GlonassL1CaDllPllCAidTracking();
|
||||
|
||||
@@ -105,4 +105,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_H_
|
||||
#endif // GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_H_
|
||||
|
||||
@@ -46,9 +46,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -68,12 +67,12 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking(
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); //unused!
|
||||
dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); //unused!
|
||||
vector_length = std::round(fs_in / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -81,14 +80,14 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_ = glonass_l1_ca_dll_pll_make_tracking_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -101,7 +100,8 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking(
|
||||
|
||||
|
||||
GlonassL1CaDllPllTracking::~GlonassL1CaDllPllTracking()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GlonassL1CaDllPllTracking::start_tracking()
|
||||
@@ -128,14 +128,18 @@ void GlonassL1CaDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
|
||||
void GlonassL1CaDllPllTracking::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
|
||||
void GlonassL1CaDllPllTracking::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ class GlonassL1CaDllPllTracking : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GlonassL1CaDllPllTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GlonassL1CaDllPllTracking();
|
||||
|
||||
@@ -101,4 +101,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GLONASS_L1_CA_DLL_PLL_TRACKING_H_
|
||||
#endif // GNSS_SDR_GLONASS_L1_CA_DLL_PLL_TRACKING_H_
|
||||
|
||||
@@ -46,9 +46,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -70,9 +69,9 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking(
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 20.0);
|
||||
dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0);
|
||||
int extend_correlation_ms;
|
||||
@@ -81,7 +80,7 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking(
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename",
|
||||
default_dump_filename); //unused!
|
||||
default_dump_filename); //unused!
|
||||
vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -89,34 +88,34 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_cc = gps_l1_ca_dll_pll_c_aid_make_tracking_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
extend_correlation_ms,
|
||||
early_late_space_chips);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
extend_correlation_ms,
|
||||
early_late_space_chips);
|
||||
DLOG(INFO) << "tracking(" << tracking_cc->unique_id() << ")";
|
||||
}
|
||||
else if(item_type_.compare("cshort") == 0)
|
||||
else if (item_type_.compare("cshort") == 0)
|
||||
{
|
||||
item_size_ = sizeof(lv_16sc_t);
|
||||
tracking_sc = gps_l1_ca_dll_pll_c_aid_make_tracking_sc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
extend_correlation_ms,
|
||||
early_late_space_chips);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
pll_bw_narrow_hz,
|
||||
dll_bw_narrow_hz,
|
||||
extend_correlation_ms,
|
||||
early_late_space_chips);
|
||||
DLOG(INFO) << "tracking(" << tracking_sc->unique_id() << ")";
|
||||
}
|
||||
else
|
||||
@@ -129,12 +128,12 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking(
|
||||
|
||||
|
||||
GpsL1CaDllPllCAidTracking::~GpsL1CaDllPllCAidTracking()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaDllPllCAidTracking::start_tracking()
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
tracking_cc->start_tracking();
|
||||
@@ -188,13 +187,17 @@ void GpsL1CaDllPllCAidTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
|
||||
void GpsL1CaDllPllCAidTracking::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
void GpsL1CaDllPllCAidTracking::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
|
||||
@@ -52,10 +52,10 @@ class ConfigurationInterface;
|
||||
class GpsL1CaDllPllCAidTracking : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GpsL1CaDllPllCAidTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
GpsL1CaDllPllCAidTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GpsL1CaDllPllCAidTracking();
|
||||
|
||||
@@ -104,4 +104,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_H_
|
||||
#endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_H_
|
||||
|
||||
@@ -46,9 +46,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GpsL1CaDllPllCAidTrackingFpga::GpsL1CaDllPllCAidTrackingFpga(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -72,9 +71,9 @@ GpsL1CaDllPllCAidTrackingFpga::GpsL1CaDllPllCAidTrackingFpga(
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 20.0);
|
||||
dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0);
|
||||
int extend_correlation_ms;
|
||||
@@ -94,19 +93,18 @@ GpsL1CaDllPllCAidTrackingFpga::GpsL1CaDllPllCAidTrackingFpga(
|
||||
{
|
||||
item_size_ = sizeof(lv_16sc_t);
|
||||
tracking_fpga_sc = gps_l1_ca_dll_pll_c_aid_make_tracking_fpga_sc(
|
||||
f_if, fs_in, vector_length, dump, dump_filename, pll_bw_hz,
|
||||
dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz,
|
||||
extend_correlation_ms, early_late_space_chips, device_name,
|
||||
device_base);
|
||||
f_if, fs_in, vector_length, dump, dump_filename, pll_bw_hz,
|
||||
dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz,
|
||||
extend_correlation_ms, early_late_space_chips, device_name,
|
||||
device_base);
|
||||
DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
item_size_ = sizeof(lv_16sc_t);
|
||||
// LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||
LOG(WARNING) << item_type_
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
}
|
||||
|
||||
channel_ = 0;
|
||||
@@ -129,7 +127,7 @@ void GpsL1CaDllPllCAidTrackingFpga::start_tracking()
|
||||
{
|
||||
// LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||
LOG(WARNING) << item_type_
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,13 +147,13 @@ void GpsL1CaDllPllCAidTrackingFpga::set_channel(unsigned int channel)
|
||||
{
|
||||
// LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||
LOG(WARNING) << item_type_
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaDllPllCAidTrackingFpga::set_gnss_synchro(
|
||||
Gnss_Synchro* p_gnss_synchro)
|
||||
Gnss_Synchro* p_gnss_synchro)
|
||||
{
|
||||
if (item_type_.compare("cshort") == 0)
|
||||
{
|
||||
@@ -165,7 +163,7 @@ void GpsL1CaDllPllCAidTrackingFpga::set_gnss_synchro(
|
||||
{
|
||||
// LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||
LOG(WARNING) << item_type_
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +197,7 @@ gr::basic_block_sptr GpsL1CaDllPllCAidTrackingFpga::get_left_block()
|
||||
{
|
||||
//LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||
LOG(WARNING) << item_type_
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -215,7 +213,7 @@ gr::basic_block_sptr GpsL1CaDllPllCAidTrackingFpga::get_right_block()
|
||||
{
|
||||
//LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||
LOG(WARNING) << item_type_
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
<< " the tracking item type for the FPGA tracking test has to be cshort";
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -225,4 +223,3 @@ void GpsL1CaDllPllCAidTrackingFpga::reset(void)
|
||||
{
|
||||
tracking_fpga_sc->reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ class GpsL1CaDllPllCAidTrackingFpga : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GpsL1CaDllPllCAidTrackingFpga(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
std::string role, unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GpsL1CaDllPllCAidTrackingFpga();
|
||||
|
||||
@@ -104,4 +104,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_FPGA__H_
|
||||
#endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_FPGA__H_
|
||||
|
||||
@@ -45,9 +45,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -67,12 +66,12 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); //unused!
|
||||
dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); //unused!
|
||||
vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -80,14 +79,14 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_ = gps_l1_ca_dll_pll_make_tracking_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -100,7 +99,8 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
|
||||
|
||||
|
||||
GpsL1CaDllPllTracking::~GpsL1CaDllPllTracking()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaDllPllTracking::start_tracking()
|
||||
@@ -127,14 +127,18 @@ void GpsL1CaDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
|
||||
void GpsL1CaDllPllTracking::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaDllPllTracking::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
@@ -149,4 +153,3 @@ gr::basic_block_sptr GpsL1CaDllPllTracking::get_right_block()
|
||||
{
|
||||
return tracking_;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ class GpsL1CaDllPllTracking : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GpsL1CaDllPllTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GpsL1CaDllPllTracking();
|
||||
|
||||
@@ -100,4 +100,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_H_
|
||||
#endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_H_
|
||||
|
||||
@@ -45,9 +45,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -68,13 +67,13 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU(
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename",
|
||||
default_dump_filename); //unused!
|
||||
default_dump_filename); //unused!
|
||||
vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -82,14 +81,14 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_ = gps_l1_ca_dll_pll_make_tracking_gpu_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -102,7 +101,8 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU(
|
||||
|
||||
|
||||
GpsL1CaDllPllTrackingGPU::~GpsL1CaDllPllTrackingGPU()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaDllPllTrackingGPU::start_tracking()
|
||||
@@ -126,13 +126,17 @@ void GpsL1CaDllPllTrackingGPU::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
|
||||
void GpsL1CaDllPllTrackingGPU::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
void GpsL1CaDllPllTrackingGPU::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
@@ -145,4 +149,3 @@ gr::basic_block_sptr GpsL1CaDllPllTrackingGPU::get_right_block()
|
||||
{
|
||||
return tracking_;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,10 +50,10 @@ class ConfigurationInterface;
|
||||
class GpsL1CaDllPllTrackingGPU : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GpsL1CaDllPllTrackingGPU(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
GpsL1CaDllPllTrackingGPU(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GpsL1CaDllPllTrackingGPU();
|
||||
|
||||
@@ -100,4 +100,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_GPU_H_
|
||||
#endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_GPU_H_
|
||||
|
||||
@@ -44,9 +44,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -59,7 +58,7 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking(
|
||||
std::string default_item_type = "gr_complex";
|
||||
float early_late_space_chips;
|
||||
size_t port_ch0;
|
||||
item_type = configuration->property(role + ".item_type",default_item_type);
|
||||
item_type = configuration->property(role + ".item_type", default_item_type);
|
||||
//vector_length = configuration->property(role + ".vector_length", 2048);
|
||||
int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||
fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||
@@ -68,7 +67,7 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking(
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
port_ch0 = configuration->property(role + ".port_ch0", 2060);
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); //unused!
|
||||
dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); //unused!
|
||||
vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -76,13 +75,13 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_ = gps_l1_ca_tcp_connector_make_tracking_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
early_late_space_chips,
|
||||
port_ch0);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
early_late_space_chips,
|
||||
port_ch0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -96,7 +95,8 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking(
|
||||
|
||||
|
||||
GpsL1CaTcpConnectorTracking::~GpsL1CaTcpConnectorTracking()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaTcpConnectorTracking::start_tracking()
|
||||
@@ -121,13 +121,17 @@ void GpsL1CaTcpConnectorTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
|
||||
void GpsL1CaTcpConnectorTracking::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
void GpsL1CaTcpConnectorTracking::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
@@ -140,4 +144,3 @@ gr::basic_block_sptr GpsL1CaTcpConnectorTracking::get_right_block()
|
||||
{
|
||||
return tracking_;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,12 +50,11 @@ class ConfigurationInterface;
|
||||
*/
|
||||
class GpsL1CaTcpConnectorTracking : public TrackingInterface
|
||||
{
|
||||
|
||||
public:
|
||||
GpsL1CaTcpConnectorTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
GpsL1CaTcpConnectorTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GpsL1CaTcpConnectorTracking();
|
||||
|
||||
@@ -94,7 +93,6 @@ public:
|
||||
void start_tracking() override;
|
||||
|
||||
private:
|
||||
|
||||
gps_l1_ca_tcp_connector_tracking_cc_sptr tracking_;
|
||||
size_t item_size_;
|
||||
|
||||
@@ -105,4 +103,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GPS_L1_CA_TCP_CONNECTOR_TRACKING_H_
|
||||
#endif // GNSS_SDR_GPS_L1_CA_TCP_CONNECTOR_TRACKING_H_
|
||||
|
||||
@@ -45,9 +45,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GpsL2MDllPllTracking::GpsL2MDllPllTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -67,13 +66,13 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename",
|
||||
default_dump_filename); //unused!
|
||||
default_dump_filename); //unused!
|
||||
vector_length = std::round(static_cast<double>(fs_in) / (static_cast<double>(GPS_L2_M_CODE_RATE_HZ) / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS)));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -81,14 +80,14 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_ = gps_l2_m_dll_pll_make_tracking_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -101,7 +100,8 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
|
||||
|
||||
|
||||
GpsL2MDllPllTracking::~GpsL2MDllPllTracking()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GpsL2MDllPllTracking::start_tracking()
|
||||
@@ -126,13 +126,17 @@ void GpsL2MDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
|
||||
void GpsL2MDllPllTracking::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
void GpsL2MDllPllTracking::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
@@ -145,4 +149,3 @@ gr::basic_block_sptr GpsL2MDllPllTracking::get_right_block()
|
||||
{
|
||||
return tracking_;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ class GpsL2MDllPllTracking : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GpsL2MDllPllTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GpsL2MDllPllTracking();
|
||||
|
||||
@@ -100,4 +100,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_gps_l2_m_dll_pll_tracking_H_
|
||||
#endif // GNSS_SDR_gps_l2_m_dll_pll_tracking_H_
|
||||
|
||||
@@ -45,9 +45,8 @@
|
||||
using google::LogMessage;
|
||||
|
||||
GpsL5iDllPllTracking::GpsL5iDllPllTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
@@ -67,13 +66,13 @@ GpsL5iDllPllTracking::GpsL5iDllPllTracking(
|
||||
f_if = configuration->property(role + ".if", 0);
|
||||
dump = configuration->property(role + ".dump", false);
|
||||
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
|
||||
if(FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
|
||||
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0);
|
||||
if(FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
std::string default_dump_filename = "./track_ch";
|
||||
dump_filename = configuration->property(role + ".dump_filename",
|
||||
default_dump_filename); //unused!
|
||||
default_dump_filename); //unused!
|
||||
vector_length = std::round(static_cast<double>(fs_in) / (static_cast<double>(GPS_L5i_CODE_RATE_HZ) / static_cast<double>(GPS_L5i_CODE_LENGTH_CHIPS)));
|
||||
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
@@ -81,14 +80,14 @@ GpsL5iDllPllTracking::GpsL5iDllPllTracking(
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
tracking_ = gps_l5i_dll_pll_make_tracking_cc(
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips);
|
||||
f_if,
|
||||
fs_in,
|
||||
vector_length,
|
||||
dump,
|
||||
dump_filename,
|
||||
pll_bw_hz,
|
||||
dll_bw_hz,
|
||||
early_late_space_chips);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -101,7 +100,8 @@ GpsL5iDllPllTracking::GpsL5iDllPllTracking(
|
||||
|
||||
|
||||
GpsL5iDllPllTracking::~GpsL5iDllPllTracking()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GpsL5iDllPllTracking::start_tracking()
|
||||
@@ -126,13 +126,17 @@ void GpsL5iDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
|
||||
void GpsL5iDllPllTracking::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
void GpsL5iDllPllTracking::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if(top_block) { /* top_block is not null */};
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||
}
|
||||
|
||||
@@ -145,4 +149,3 @@ gr::basic_block_sptr GpsL5iDllPllTracking::get_right_block()
|
||||
{
|
||||
return tracking_;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@ class GpsL5iDllPllTracking : public TrackingInterface
|
||||
{
|
||||
public:
|
||||
GpsL5iDllPllTracking(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~GpsL5iDllPllTracking();
|
||||
|
||||
@@ -99,4 +99,4 @@ private:
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_gps_l5i_dll_pll_tracking_H_
|
||||
#endif // GNSS_SDR_gps_l5i_dll_pll_tracking_H_
|
||||
|
||||
1029
src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc
Executable file → Normal file
1029
src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
112
src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.h
Executable file → Normal file
112
src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.h
Executable file → Normal file
@@ -48,32 +48,31 @@ typedef boost::shared_ptr<galileo_e1_dll_pll_veml_tracking_cc> galileo_e1_dll_pl
|
||||
|
||||
galileo_e1_dll_pll_veml_tracking_cc_sptr
|
||||
galileo_e1_dll_pll_veml_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
float early_late_space_narrow_chips,
|
||||
float very_early_late_space_narrow_chips,
|
||||
int extend_correlation_symbols,
|
||||
bool track_pilot);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
float early_late_space_narrow_chips,
|
||||
float very_early_late_space_narrow_chips,
|
||||
int extend_correlation_symbols,
|
||||
bool track_pilot);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a code DLL + carrier PLL VEML (Very Early
|
||||
* Minus Late) tracking block for Galileo E1 signals
|
||||
*/
|
||||
class galileo_e1_dll_pll_veml_tracking_cc: public gr::block
|
||||
class galileo_e1_dll_pll_veml_tracking_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~galileo_e1_dll_pll_veml_tracking_cc();
|
||||
|
||||
void set_channel(unsigned int channel);
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
/*!
|
||||
@@ -82,46 +81,45 @@ public:
|
||||
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
||||
* Birkhauser, 2007
|
||||
*/
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
|
||||
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
private:
|
||||
friend galileo_e1_dll_pll_veml_tracking_cc_sptr
|
||||
galileo_e1_dll_pll_veml_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
float early_late_space_narrow_chips,
|
||||
float very_early_late_space_narrow_chips,
|
||||
int extend_correlation_symbols,
|
||||
bool track_pilot);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
float early_late_space_narrow_chips,
|
||||
float very_early_late_space_narrow_chips,
|
||||
int extend_correlation_symbols,
|
||||
bool track_pilot);
|
||||
|
||||
galileo_e1_dll_pll_veml_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
float early_late_space_narrow_chips,
|
||||
float very_early_late_space_narrow_chips,
|
||||
int extend_correlation_symbols,
|
||||
bool track_pilot);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
float early_late_space_narrow_chips,
|
||||
float very_early_late_space_narrow_chips,
|
||||
int extend_correlation_symbols,
|
||||
bool track_pilot);
|
||||
|
||||
bool cn0_and_tracking_lock_status();
|
||||
void do_correlation_step(const gr_complex* input_samples);
|
||||
void do_correlation_step(const gr_complex *input_samples);
|
||||
void run_dll_pll(bool disable_costas_loop);
|
||||
void update_local_code();
|
||||
void update_local_carrier();
|
||||
@@ -135,7 +133,7 @@ private:
|
||||
unsigned int d_vector_length;
|
||||
bool d_dump;
|
||||
|
||||
Gnss_Synchro* d_acquisition_gnss_synchro;
|
||||
Gnss_Synchro *d_acquisition_gnss_synchro;
|
||||
unsigned int d_channel;
|
||||
long d_if_freq;
|
||||
long d_fs_in;
|
||||
@@ -152,17 +150,17 @@ private:
|
||||
double d_early_late_spc_narrow_chips;
|
||||
double d_very_early_late_spc_narrow_chips;
|
||||
|
||||
float* d_tracking_code;
|
||||
float* d_data_code;
|
||||
float* d_local_code_shift_chips;
|
||||
gr_complex* d_correlator_outs;
|
||||
float *d_tracking_code;
|
||||
float *d_data_code;
|
||||
float *d_local_code_shift_chips;
|
||||
gr_complex *d_correlator_outs;
|
||||
cpu_multicorrelator_real_codes multicorrelator_cpu;
|
||||
//todo: currently the multicorrelator does not support adding extra correlator
|
||||
//with different local code, thus we need extra multicorrelator instance.
|
||||
//Implement this functionality inside multicorrelator class
|
||||
//as an enhancement to increase the performance
|
||||
float* d_local_code_data_shift_chips;
|
||||
cpu_multicorrelator_real_codes correlator_data_cpu; //for data channel
|
||||
float *d_local_code_data_shift_chips;
|
||||
cpu_multicorrelator_real_codes correlator_data_cpu; //for data channel
|
||||
|
||||
gr_complex *d_Very_Early;
|
||||
gr_complex *d_Early;
|
||||
@@ -227,7 +225,7 @@ private:
|
||||
// CN0 estimation and lock detector
|
||||
int d_cn0_estimation_counter;
|
||||
std::deque<gr_complex> d_Prompt_buffer_deque;
|
||||
gr_complex* d_Prompt_buffer;
|
||||
gr_complex *d_Prompt_buffer;
|
||||
double d_carrier_lock_test;
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
@@ -243,4 +241,4 @@ private:
|
||||
int save_matfile();
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GALILEO_E1_DLL_PLL_VEML_TRACKING_CC_H
|
||||
#endif //GNSS_SDR_GALILEO_E1_DLL_PLL_VEML_TRACKING_CC_H
|
||||
|
||||
@@ -60,50 +60,49 @@
|
||||
using google::LogMessage;
|
||||
|
||||
galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
size_t port_ch0)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
size_t port_ch0)
|
||||
{
|
||||
return galileo_e1_tcp_connector_tracking_cc_sptr(new Galileo_E1_Tcp_Connector_Tracking_cc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips, very_early_late_space_chips, port_ch0));
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips, very_early_late_space_chips, port_ch0));
|
||||
}
|
||||
|
||||
|
||||
void Galileo_E1_Tcp_Connector_Tracking_cc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void Galileo_E1_Tcp_Connector_Tracking_cc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; // set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; // set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz __attribute__((unused)),
|
||||
float dll_bw_hz __attribute__((unused)),
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
size_t port_ch0):
|
||||
gr::block("Galileo_E1_Tcp_Connector_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz __attribute__((unused)),
|
||||
float dll_bw_hz __attribute__((unused)),
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
size_t port_ch0) : gr::block("Galileo_E1_Tcp_Connector_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
this->set_relative_rate(1.0/vector_length);
|
||||
this->set_relative_rate(1.0 / vector_length);
|
||||
// initialize internal vars
|
||||
d_dump = dump;
|
||||
d_if_freq = if_freq;
|
||||
@@ -113,8 +112,8 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||
|
||||
// Initialize tracking ==========================================
|
||||
//--- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_very_early_late_spc_chips = very_early_late_space_chips; // Define very-early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_very_early_late_spc_chips = very_early_late_space_chips; // Define very-early-late offset (in chips)
|
||||
|
||||
//--- TCP CONNECTOR variables --------------------------------------------------------
|
||||
d_port_ch0 = port_ch0;
|
||||
@@ -124,14 +123,14 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the sinboc(1,1) replica sampled 2x/chip
|
||||
d_ca_code = static_cast<gr_complex*>(volk_gnsssdr_malloc((2*Galileo_E1_B_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc((2 * Galileo_E1_B_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 5; // Very-Early, Early, Prompt, Late, Very-Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_n_correlator_taps = 5; // Very-Early, Early, Prompt, Late, Very-Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
// map memory pointers of correlator outputs
|
||||
d_Very_Early = &d_correlator_outs[0];
|
||||
@@ -140,10 +139,10 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||
d_Late = &d_correlator_outs[3];
|
||||
d_Very_Late = &d_correlator_outs[4];
|
||||
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_very_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_very_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[2] = 0.0;
|
||||
d_local_code_shift_chips[3] = d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[4] = d_very_early_late_spc_chips;
|
||||
@@ -191,25 +190,24 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking()
|
||||
{
|
||||
d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples;
|
||||
d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz;
|
||||
d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples;
|
||||
d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples;
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (2 samples per chip)
|
||||
galileo_e1_code_gen_complex_sampled(d_ca_code,
|
||||
d_acquisition_gnss_synchro->Signal,
|
||||
false,
|
||||
d_acquisition_gnss_synchro->PRN,
|
||||
2 * Galileo_E1_CODE_CHIP_RATE_HZ,
|
||||
0);
|
||||
d_acquisition_gnss_synchro->Signal,
|
||||
false,
|
||||
d_acquisition_gnss_synchro->PRN,
|
||||
2 * Galileo_E1_CODE_CHIP_RATE_HZ,
|
||||
0);
|
||||
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(2*Galileo_E1_B_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(2 * Galileo_E1_B_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -222,7 +220,7 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking()
|
||||
d_current_prn_length_samples = d_vector_length;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking of Galileo E1 signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -241,32 +239,32 @@ Galileo_E1_Tcp_Connector_Tracking_cc::~Galileo_E1_Tcp_Connector_Tracking_cc()
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
delete[] d_Prompt_buffer;
|
||||
d_tcp_com.close_tcp_connection(d_port);
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// process vars
|
||||
float carr_error_filt_hz;
|
||||
@@ -276,7 +274,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
|
||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||
Gnss_Synchro current_synchro_data = Gnss_Synchro();
|
||||
// Block input data and block output stream pointers
|
||||
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
if (d_enable_tracking == true)
|
||||
{
|
||||
@@ -296,25 +294,25 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
||||
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
||||
d_pull_in = false;
|
||||
consume_each(samples_offset); //shift input to perform alignment with local replica
|
||||
consume_each(samples_offset); //shift input to perform alignment with local replica
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs,in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
|
||||
double carr_phase_step_rad = GALILEO_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
double code_phase_step_half_chips = (2.0 * d_code_freq_chips) / (static_cast<double>(d_fs_in));
|
||||
double rem_code_phase_half_chips = d_rem_code_phase_samples * (2.0*d_code_freq_chips / d_fs_in);
|
||||
double rem_code_phase_half_chips = d_rem_code_phase_samples * (2.0 * d_code_freq_chips / d_fs_in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(
|
||||
d_rem_carr_phase_rad,
|
||||
carr_phase_step_rad,
|
||||
rem_code_phase_half_chips,
|
||||
code_phase_step_half_chips,
|
||||
d_correlation_length_samples);
|
||||
d_rem_carr_phase_rad,
|
||||
carr_phase_step_rad,
|
||||
rem_code_phase_half_chips,
|
||||
code_phase_step_half_chips,
|
||||
d_correlation_length_samples);
|
||||
|
||||
// ################## TCP CONNECTOR ##########################################################
|
||||
//! Variable used for control
|
||||
@@ -322,18 +320,18 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
|
||||
|
||||
//! Send and receive a TCP packet
|
||||
boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> tx_variables_array = {{d_control_id,
|
||||
(*d_Very_Early).real(),
|
||||
(*d_Very_Early).imag(),
|
||||
(*d_Early).real(),
|
||||
(*d_Early).imag(),
|
||||
(*d_Late).real(),
|
||||
(*d_Late).imag(),
|
||||
(*d_Very_Late).real(),
|
||||
(*d_Very_Late).imag(),
|
||||
(*d_Prompt).real(),
|
||||
(*d_Prompt).imag(),
|
||||
d_acq_carrier_doppler_hz,
|
||||
1}};
|
||||
(*d_Very_Early).real(),
|
||||
(*d_Very_Early).imag(),
|
||||
(*d_Early).real(),
|
||||
(*d_Early).imag(),
|
||||
(*d_Late).real(),
|
||||
(*d_Late).imag(),
|
||||
(*d_Very_Late).real(),
|
||||
(*d_Very_Late).imag(),
|
||||
(*d_Prompt).real(),
|
||||
(*d_Prompt).imag(),
|
||||
d_acq_carrier_doppler_hz,
|
||||
1}};
|
||||
d_tcp_com.send_receive_tcp_packet_galileo_e1(tx_variables_array, &tcp_data);
|
||||
|
||||
// ################## PLL ##########################################################
|
||||
@@ -344,9 +342,9 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
|
||||
// New code Doppler frequency estimation
|
||||
d_code_freq_chips = Galileo_E1_CODE_CHIP_RATE_HZ + ((d_carrier_doppler_hz * Galileo_E1_CODE_CHIP_RATE_HZ) / Galileo_E1_FREQ_HZ);
|
||||
//carrier phase accumulator for (K) doppler estimation
|
||||
d_acc_carrier_phase_rad -= GPS_TWO_PI*d_carrier_doppler_hz*Galileo_E1_CODE_PERIOD;
|
||||
d_acc_carrier_phase_rad -= GPS_TWO_PI * d_carrier_doppler_hz * Galileo_E1_CODE_PERIOD;
|
||||
//remnant carrier phase to prevent overflow in the code NCO
|
||||
d_rem_carr_phase_rad = d_rem_carr_phase_rad + GPS_TWO_PI*d_carrier_doppler_hz*Galileo_E1_CODE_PERIOD;
|
||||
d_rem_carr_phase_rad = d_rem_carr_phase_rad + GPS_TWO_PI * d_carrier_doppler_hz * Galileo_E1_CODE_PERIOD;
|
||||
d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, GPS_TWO_PI);
|
||||
|
||||
// ################## DLL ##########################################################
|
||||
@@ -354,7 +352,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
|
||||
code_error_filt_chips = tcp_data.proc_pack_code_error;
|
||||
//Code phase accumulator
|
||||
float code_error_filt_secs;
|
||||
code_error_filt_secs = (Galileo_E1_CODE_PERIOD * code_error_filt_chips) / Galileo_E1_CODE_CHIP_RATE_HZ; //[seconds]
|
||||
code_error_filt_secs = (Galileo_E1_CODE_PERIOD * code_error_filt_chips) / Galileo_E1_CODE_CHIP_RATE_HZ; //[seconds]
|
||||
d_acc_code_phase_secs = d_acc_code_phase_secs + code_error_filt_secs;
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
@@ -368,7 +366,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
|
||||
T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||
T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
|
||||
K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast<double>(d_fs_in);
|
||||
d_current_prn_length_samples = round(K_blk_samples); //round to a discrete samples
|
||||
d_current_prn_length_samples = round(K_blk_samples); //round to a discrete samples
|
||||
//d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
|
||||
|
||||
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
|
||||
@@ -401,10 +399,10 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3));//3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,7 +412,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
|
||||
// Tracking_timestamp_secs is aligned with the PRN start sample
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples;
|
||||
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
|
||||
current_synchro_data.Carrier_phase_rads = static_cast<double>(d_acc_carrier_phase_rad);
|
||||
current_synchro_data.Carrier_Doppler_hz = static_cast<double>(d_carrier_doppler_hz);
|
||||
current_synchro_data.CN0_dB_hz = static_cast<double>(d_CN0_SNV_dB_Hz);
|
||||
@@ -423,24 +421,24 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
|
||||
}
|
||||
else
|
||||
{
|
||||
*d_Early = gr_complex(0,0);
|
||||
*d_Prompt = gr_complex(0,0);
|
||||
*d_Late = gr_complex(0,0);
|
||||
*d_Early = gr_complex(0, 0);
|
||||
*d_Prompt = gr_complex(0, 0);
|
||||
*d_Late = gr_complex(0, 0);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples;
|
||||
//! When tracking is disabled an array of 1's is sent to maintain the TCP connection
|
||||
boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> tx_variables_array = {{1,1,1,1,1,1,1,1,1,1,1,1,0}};
|
||||
boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> tx_variables_array = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}};
|
||||
d_tcp_com.send_receive_tcp_packet_galileo_e1(tx_variables_array, &tcp_data);
|
||||
}
|
||||
//assign the GNURadio block output data
|
||||
current_synchro_data.System = {'E'};
|
||||
std::string str_aux = "1B";
|
||||
const char * str = str_aux.c_str(); // get a C style null terminated string
|
||||
std::memcpy(static_cast<void*>(current_synchro_data.Signal), str, 3);
|
||||
const char *str = str_aux.c_str(); // get a C style null terminated string
|
||||
std::memcpy(static_cast<void *>(current_synchro_data.Signal), str, 3);
|
||||
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -458,65 +456,66 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
|
||||
tmp_VL = std::abs<float>(*d_Very_Late);
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_VE), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_VL), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_VE), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_VL), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_rad), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_rad), sizeof(float));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(float));
|
||||
|
||||
//PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_float), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&carr_error_filt_hz), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&carr_error_filt_hz), sizeof(float));
|
||||
|
||||
//DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_float), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_filt_chips), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_filt_chips), sizeof(float));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(float));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_float = d_rem_code_phase_samples;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_float), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
tmp_double = static_cast<double>(d_sample_counter + d_current_prn_length_samples);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
consume_each(d_current_prn_length_samples); // this is needed in gr::block derivates
|
||||
d_sample_counter += d_current_prn_length_samples; //count for the processed samples
|
||||
consume_each(d_current_prn_length_samples); // this is needed in gr::block derivates
|
||||
d_sample_counter += d_current_prn_length_samples; //count for the processed samples
|
||||
|
||||
if (d_enable_tracking)
|
||||
{
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Galileo_E1_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
@@ -527,17 +526,17 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,8 +549,7 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Galileo_E1_Tcp_Connector_Tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void Galileo_E1_Tcp_Connector_Tracking_cc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -55,56 +55,54 @@ typedef boost::shared_ptr<Galileo_E1_Tcp_Connector_Tracking_cc> galileo_e1_tcp_c
|
||||
|
||||
galileo_e1_tcp_connector_tracking_cc_sptr
|
||||
galileo_e1_tcp_connector_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a code DLL + carrier PLL VEML (Very Early
|
||||
* Minus Late) tracking block for Galileo E1 signals
|
||||
*/
|
||||
class Galileo_E1_Tcp_Connector_Tracking_cc: public gr::block
|
||||
class Galileo_E1_Tcp_Connector_Tracking_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~Galileo_E1_Tcp_Connector_Tracking_cc();
|
||||
|
||||
void set_channel(unsigned int channel);
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
|
||||
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
private:
|
||||
friend galileo_e1_tcp_connector_tracking_cc_sptr
|
||||
galileo_e1_tcp_connector_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
|
||||
Galileo_E1_Tcp_Connector_Tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips,
|
||||
float very_early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
|
||||
void update_local_code();
|
||||
|
||||
@@ -114,7 +112,7 @@ private:
|
||||
unsigned int d_vector_length;
|
||||
bool d_dump;
|
||||
|
||||
Gnss_Synchro* d_acquisition_gnss_synchro;
|
||||
Gnss_Synchro *d_acquisition_gnss_synchro;
|
||||
unsigned int d_channel;
|
||||
|
||||
long d_if_freq;
|
||||
@@ -125,7 +123,7 @@ private:
|
||||
float d_early_late_spc_chips;
|
||||
float d_very_early_late_spc_chips;
|
||||
|
||||
gr_complex* d_ca_code;
|
||||
gr_complex *d_ca_code;
|
||||
|
||||
gr_complex *d_Very_Early;
|
||||
gr_complex *d_Early;
|
||||
@@ -143,8 +141,8 @@ private:
|
||||
float d_acq_carrier_doppler_hz;
|
||||
|
||||
// correlator
|
||||
float* d_local_code_shift_chips;
|
||||
gr_complex* d_correlator_outs;
|
||||
float *d_local_code_shift_chips;
|
||||
gr_complex *d_correlator_outs;
|
||||
cpu_multicorrelator multicorrelator_cpu;
|
||||
|
||||
// tracking vars
|
||||
@@ -169,7 +167,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int d_cn0_estimation_counter;
|
||||
gr_complex* d_Prompt_buffer;
|
||||
gr_complex *d_Prompt_buffer;
|
||||
float d_carrier_lock_test;
|
||||
float d_CN0_SNV_dB_Hz;
|
||||
float d_carrier_lock_threshold;
|
||||
@@ -187,4 +185,4 @@ private:
|
||||
std::string sys;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GALILEO_E1_TCP_CONNECTOR_TRACKING_CC_H
|
||||
#endif //GNSS_SDR_GALILEO_E1_TCP_CONNECTOR_TRACKING_CC_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -49,27 +49,25 @@
|
||||
class Galileo_E5a_Dll_Pll_Tracking_cc;
|
||||
|
||||
typedef boost::shared_ptr<Galileo_E5a_Dll_Pll_Tracking_cc>
|
||||
galileo_e5a_dll_pll_tracking_cc_sptr;
|
||||
galileo_e5a_dll_pll_tracking_cc_sptr;
|
||||
|
||||
galileo_e5a_dll_pll_tracking_cc_sptr
|
||||
galileo_e5a_dll_pll_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_narrowhz,
|
||||
float dll_bw_narrow_hz,
|
||||
int ti_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_narrowhz,
|
||||
float dll_bw_narrow_hz,
|
||||
int ti_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class Galileo_E5a_Dll_Pll_Tracking_cc: public gr::block
|
||||
class Galileo_E5a_Dll_Pll_Tracking_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~Galileo_E5a_Dll_Pll_Tracking_cc();
|
||||
@@ -78,36 +76,34 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend galileo_e5a_dll_pll_tracking_cc_sptr
|
||||
galileo_e5a_dll_pll_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int ti_ms,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int ti_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
Galileo_E5a_Dll_Pll_Tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int ti_ms,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int ti_ms,
|
||||
float early_late_space_chips);
|
||||
void acquire_secondary();
|
||||
// tracking configuration vars
|
||||
unsigned int d_vector_length;
|
||||
|
||||
@@ -60,29 +60,29 @@ using google::LogMessage;
|
||||
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr
|
||||
glonass_l1_ca_dll_pll_c_aid_make_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips)
|
||||
{
|
||||
return glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_cc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz,pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips));
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips));
|
||||
}
|
||||
|
||||
|
||||
void glonass_l1_ca_dll_pll_c_aid_tracking_cc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void glonass_l1_ca_dll_pll_c_aid_tracking_cc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::forecast (int noutput_items,
|
||||
void glonass_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pmt_t msg)
|
||||
{
|
||||
//pmt::print(msg);
|
||||
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
|
||||
if (d_enable_extended_integration == false) //avoid re-setting preamble indicator
|
||||
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
|
||||
if (d_enable_extended_integration == false) //avoid re-setting preamble indicator
|
||||
{
|
||||
d_preamble_timestamp_s = pmt::to_double(msg);
|
||||
d_enable_extended_integration = true;
|
||||
@@ -101,25 +101,24 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pm
|
||||
|
||||
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips) :
|
||||
gr::block("glonass_l1_ca_dll_pll_c_aid_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips) : gr::block("glonass_l1_ca_dll_pll_c_aid_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
|
||||
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
|
||||
boost::bind(&glonass_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index, this, _1));
|
||||
boost::bind(&glonass_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index, this, _1));
|
||||
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
// initialize internal vars
|
||||
@@ -140,22 +139,22 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc
|
||||
d_carrier_loop_filter.set_params(10.0, d_pll_bw_hz, 2);
|
||||
|
||||
// --- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex*>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -170,7 +169,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc
|
||||
d_rem_carrier_phase_rad = 0.0;
|
||||
|
||||
// sample synchronization
|
||||
d_sample_counter = 0; //(from trk to tlm)
|
||||
d_sample_counter = 0; //(from trk to tlm)
|
||||
d_acq_sample_stamp = 0;
|
||||
d_enable_tracking = false;
|
||||
d_pull_in = false;
|
||||
@@ -228,7 +227,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
|
||||
long int acq_trk_diff_samples;
|
||||
double acq_trk_diff_seconds;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp);//-d_vector_length;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples;
|
||||
acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
|
||||
// Doppler effect
|
||||
@@ -270,8 +269,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter.initialize(d_carrier_frequency_hz); // The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
d_carrier_loop_filter.initialize(d_carrier_frequency_hz); // The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
glonass_l1_ca_code_gen_complex(d_ca_code, 0);
|
||||
@@ -279,7 +278,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -291,7 +290,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
d_code_phase_samples = d_acq_code_phase_samples;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking start on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -313,40 +312,40 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::~glonass_l1_ca_dll_pll_c_aid_tracking_c
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << "Writing .mat files ...";
|
||||
}
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile();
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << " done." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
delete[] d_Prompt_buffer;
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -357,18 +356,18 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
int number_of_double_vars = 11;
|
||||
int number_of_float_vars = 5;
|
||||
int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
std::ifstream dump_file;
|
||||
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
try
|
||||
{
|
||||
{
|
||||
dump_file.open(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
}
|
||||
catch(const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// count number of epochs and rewind
|
||||
long int num_epoch = 0;
|
||||
if (dump_file.is_open())
|
||||
@@ -381,30 +380,30 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
float * abs_E = new float [num_epoch];
|
||||
float * abs_P = new float [num_epoch];
|
||||
float * abs_L = new float [num_epoch];
|
||||
float * Prompt_I = new float [num_epoch];
|
||||
float * Prompt_Q = new float [num_epoch];
|
||||
unsigned long int * PRN_start_sample_count = new unsigned long int [num_epoch];
|
||||
double * acc_carrier_phase_rad = new double [num_epoch];
|
||||
double * carrier_doppler_hz = new double [num_epoch];
|
||||
double * code_freq_chips = new double [num_epoch];
|
||||
double * carr_error_hz = new double [num_epoch];
|
||||
double * carr_error_filt_hz = new double [num_epoch];
|
||||
double * code_error_chips = new double [num_epoch];
|
||||
double * code_error_filt_chips = new double [num_epoch];
|
||||
double * CN0_SNV_dB_Hz = new double [num_epoch];
|
||||
double * carrier_lock_test = new double [num_epoch];
|
||||
double * aux1 = new double [num_epoch];
|
||||
double * aux2 = new double [num_epoch];
|
||||
unsigned int * PRN = new unsigned int [num_epoch];
|
||||
float *abs_E = new float[num_epoch];
|
||||
float *abs_P = new float[num_epoch];
|
||||
float *abs_L = new float[num_epoch];
|
||||
float *Prompt_I = new float[num_epoch];
|
||||
float *Prompt_Q = new float[num_epoch];
|
||||
unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch];
|
||||
double *acc_carrier_phase_rad = new double[num_epoch];
|
||||
double *carrier_doppler_hz = new double[num_epoch];
|
||||
double *code_freq_chips = new double[num_epoch];
|
||||
double *carr_error_hz = new double[num_epoch];
|
||||
double *carr_error_filt_hz = new double[num_epoch];
|
||||
double *code_error_chips = new double[num_epoch];
|
||||
double *code_error_filt_chips = new double[num_epoch];
|
||||
double *CN0_SNV_dB_Hz = new double[num_epoch];
|
||||
double *carrier_lock_test = new double[num_epoch];
|
||||
double *aux1 = new double[num_epoch];
|
||||
double *aux2 = new double[num_epoch];
|
||||
unsigned int *PRN = new unsigned int[num_epoch];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
if (dump_file.is_open())
|
||||
{
|
||||
for(long int i = 0; i < num_epoch; i++)
|
||||
for (long int i = 0; i < num_epoch; i++)
|
||||
{
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_E[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_P[i]), sizeof(float));
|
||||
@@ -427,10 +426,10 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
}
|
||||
}
|
||||
dump_file.close();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
delete[] abs_E;
|
||||
delete[] abs_P;
|
||||
delete[] abs_L;
|
||||
@@ -450,7 +449,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
delete[] aux2;
|
||||
delete[] PRN;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE MAT FILE
|
||||
mat_t *matfp;
|
||||
@@ -459,79 +458,79 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
filename.erase(filename.length() - 4, 4);
|
||||
filename.append(".mat");
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if(reinterpret_cast<long*>(matfp) != NULL)
|
||||
if (reinterpret_cast<long *>(matfp) != NULL)
|
||||
{
|
||||
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
||||
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
}
|
||||
Mat_Close(matfp);
|
||||
@@ -557,11 +556,11 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
}
|
||||
|
||||
|
||||
int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// Block input data and block output stream pointers
|
||||
const gr_complex* in = reinterpret_cast<const gr_complex*>(input_items[0]); // PRN start block alignment
|
||||
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); // PRN start block alignment
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||
@@ -586,31 +585,31 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
|
||||
d_sample_counter += samples_offset; // count for the processed samples
|
||||
d_sample_counter += samples_offset; // count for the processed samples
|
||||
d_pull_in = false;
|
||||
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GLONASS_TWO_PI;
|
||||
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GLONASS_TWO_PI;
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||
current_synchro_data.fs=d_fs_in;
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs,in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_correlation_length_samples);
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_correlation_length_samples);
|
||||
|
||||
// ####### coherent intergration extension
|
||||
// keep the last symbols
|
||||
d_E_history.push_back(d_correlator_outs[0]); // save early output
|
||||
d_P_history.push_back(d_correlator_outs[1]); // save prompt output
|
||||
d_L_history.push_back(d_correlator_outs[2]); // save late output
|
||||
d_E_history.push_back(d_correlator_outs[0]); // save early output
|
||||
d_P_history.push_back(d_correlator_outs[1]); // save prompt output
|
||||
d_L_history.push_back(d_correlator_outs[2]); // save late output
|
||||
|
||||
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms)
|
||||
{
|
||||
@@ -628,9 +627,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
// compute coherent integration and enable tracking loop
|
||||
// perform coherent integration using correlator output history
|
||||
// std::cout<<"##### RESET COHERENT INTEGRATION ####"<<std::endl;
|
||||
d_correlator_outs[0] = gr_complex(0.0,0.0);
|
||||
d_correlator_outs[1] = gr_complex(0.0,0.0);
|
||||
d_correlator_outs[2] = gr_complex(0.0,0.0);
|
||||
d_correlator_outs[0] = gr_complex(0.0, 0.0);
|
||||
d_correlator_outs[1] = gr_complex(0.0, 0.0);
|
||||
d_correlator_outs[2] = gr_complex(0.0, 0.0);
|
||||
for (int n = 0; n < d_extend_correlation_ms; n++)
|
||||
{
|
||||
d_correlator_outs[0] += d_E_history.at(n);
|
||||
@@ -641,9 +640,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
if (d_preamble_synchronized == false)
|
||||
{
|
||||
d_code_loop_filter.set_DLL_BW(d_dll_bw_narrow_hz);
|
||||
d_carrier_loop_filter.set_params(10.0, d_pll_bw_narrow_hz,2);
|
||||
d_carrier_loop_filter.set_params(10.0, d_pll_bw_narrow_hz, 2);
|
||||
d_preamble_synchronized = true;
|
||||
std::cout << "Enabled " << d_extend_correlation_ms << " [ms] extended correlator for CH "<< d_channel << " : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
||||
std::cout << "Enabled " << d_extend_correlation_ms << " [ms] extended correlator for CH " << d_channel << " : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
||||
<< " pll_bw = " << d_pll_bw_hz << " [Hz], pll_narrow_bw = " << d_pll_bw_narrow_hz << " [Hz]" << std::endl
|
||||
<< " dll_bw = " << d_dll_bw_hz << " [Hz], dll_narrow_bw = " << d_dll_bw_narrow_hz << " [Hz]" << std::endl;
|
||||
}
|
||||
@@ -654,7 +653,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
}
|
||||
else
|
||||
{
|
||||
if(d_preamble_synchronized == true)
|
||||
if (d_preamble_synchronized == true)
|
||||
{
|
||||
// continue extended coherent correlation
|
||||
// Compute the next buffer length based on the period of the PRN sequence and the code phase error estimation
|
||||
@@ -665,7 +664,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
|
||||
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples;
|
||||
// code phase step (Code resampler phase increment per sample) [chips/sample]
|
||||
@@ -702,7 +701,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
{
|
||||
// ################## PLL ##########################################################
|
||||
// Update PLL discriminator [rads/Ti -> Secs/Ti]
|
||||
d_carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GLONASS_TWO_PI; // prompt output
|
||||
d_carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GLONASS_TWO_PI; // prompt output
|
||||
d_carrier_doppler_old_hz = d_carrier_doppler_hz;
|
||||
// Carrier discriminator filter
|
||||
// NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan
|
||||
@@ -715,11 +714,11 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
|
||||
// ################## DLL ##########################################################
|
||||
// DLL discriminator
|
||||
d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti] //early and late
|
||||
d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti] //early and late
|
||||
// Code discriminator filter
|
||||
d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second]
|
||||
d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second]
|
||||
d_code_error_filt_chips_Ti = d_code_error_filt_chips_s * CURRENT_INTEGRATION_TIME_S;
|
||||
code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti]
|
||||
code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti]
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
// keep alignment parameters for the next input buffer
|
||||
@@ -730,12 +729,12 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
double K_prn_samples = round(T_prn_samples);
|
||||
double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
|
||||
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples + code_error_filt_secs_Ti * static_cast<double>(d_fs_in); //(code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti) * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples + code_error_filt_secs_Ti * static_cast<double>(d_fs_in); //(code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti) * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples;
|
||||
|
||||
//################### PLL COMMANDS #################################################
|
||||
//################### PLL COMMANDS #################################################
|
||||
//carrier phase step (NCO phase increment per sample) [rads/sample]
|
||||
d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * d_correlation_length_samples / GLONASS_TWO_PI;
|
||||
@@ -754,7 +753,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
if (d_cn0_estimation_counter < FLAGS_cn0_samples)
|
||||
{
|
||||
// fill buffer with prompt correlator output values
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; // prompt
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; // prompt
|
||||
d_cn0_estimation_counter++;
|
||||
}
|
||||
else
|
||||
@@ -777,9 +776,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3));//3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
@@ -807,7 +806,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples;
|
||||
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
||||
current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles;
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;// todo: project the carrier doppler
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
|
||||
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
||||
}
|
||||
}
|
||||
@@ -815,16 +814,16 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
{
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
current_synchro_data.System = {'R'};
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples;
|
||||
}
|
||||
//assign the GNURadio block output data
|
||||
current_synchro_data.fs=d_fs_in;
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -837,57 +836,57 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __a
|
||||
tmp_P = std::abs<float>(d_correlator_outs[1]);
|
||||
tmp_L = std::abs<float>(d_correlator_outs[2]);
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
//tmp_float=(float)d_sample_counter;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
|
||||
// carrier and code frequency
|
||||
double if_freq_carrier = d_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * static_cast<double>(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&if_freq_carrier), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
double if_freq_carrier = d_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * static_cast<double>(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&if_freq_carrier), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(double));
|
||||
|
||||
//PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
|
||||
//DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_error_filt_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_error_filt_chips_Ti), sizeof(double));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(double));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_double = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
{
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
|
||||
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
|
||||
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
|
||||
}
|
||||
|
||||
|
||||
@@ -901,24 +900,23 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
{
|
||||
}
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void glonass_l1_ca_dll_pll_c_aid_tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void glonass_l1_ca_dll_pll_c_aid_tracking_cc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -54,27 +54,25 @@
|
||||
class glonass_l1_ca_dll_pll_c_aid_tracking_cc;
|
||||
|
||||
typedef boost::shared_ptr<glonass_l1_ca_dll_pll_c_aid_tracking_cc>
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr;
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr;
|
||||
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr
|
||||
glonass_l1_ca_dll_pll_c_aid_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class glonass_l1_ca_dll_pll_c_aid_tracking_cc: public gr::block
|
||||
class glonass_l1_ca_dll_pll_c_aid_tracking_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~glonass_l1_ca_dll_pll_c_aid_tracking_cc();
|
||||
@@ -83,36 +81,34 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr
|
||||
glonass_l1_ca_dll_pll_c_aid_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
// tracking configuration vars
|
||||
unsigned int d_vector_length;
|
||||
@@ -206,4 +202,4 @@ private:
|
||||
int save_matfile();
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_CC_H
|
||||
#endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_CC_H
|
||||
|
||||
@@ -61,30 +61,29 @@ using google::LogMessage;
|
||||
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr
|
||||
glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips)
|
||||
{
|
||||
return glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_sc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips));
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void glonass_l1_ca_dll_pll_c_aid_tracking_sc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void glonass_l1_ca_dll_pll_c_aid_tracking_sc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,8 +91,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::forecast (int noutput_items,
|
||||
void glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pmt_t msg)
|
||||
{
|
||||
//pmt::print(msg);
|
||||
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
|
||||
if (d_enable_extended_integration == false) //avoid re-setting preamble indicator
|
||||
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
|
||||
if (d_enable_extended_integration == false) //avoid re-setting preamble indicator
|
||||
{
|
||||
d_preamble_timestamp_s = pmt::to_double(msg);
|
||||
d_enable_extended_integration = true;
|
||||
@@ -102,24 +101,23 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pm
|
||||
}
|
||||
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips) :
|
||||
gr::block("glonass_l1_ca_dll_pll_c_aid_tracking_sc", gr::io_signature::make(1, 1, sizeof(lv_16sc_t)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips) : gr::block("glonass_l1_ca_dll_pll_c_aid_tracking_sc", gr::io_signature::make(1, 1, sizeof(lv_16sc_t)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
|
||||
boost::bind(&glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index, this, _1));
|
||||
boost::bind(&glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index, this, _1));
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
// initialize internal vars
|
||||
d_dump = dump;
|
||||
@@ -139,25 +137,25 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
|
||||
d_extend_correlation_ms = extend_correlation_ms;
|
||||
|
||||
// --- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex*>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code_16sc = static_cast<lv_16sc_t*>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
|
||||
d_correlator_outs_16sc = static_cast<lv_16sc_t*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0,0);
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0, 0);
|
||||
}
|
||||
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -172,7 +170,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
|
||||
d_rem_carrier_phase_rad = 0.0;
|
||||
|
||||
// sample synchronization
|
||||
d_sample_counter = 0; //(from trk to tlm)
|
||||
d_sample_counter = 0; //(from trk to tlm)
|
||||
d_acq_sample_stamp = 0;
|
||||
d_enable_tracking = false;
|
||||
d_pull_in = false;
|
||||
@@ -228,12 +226,12 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
|
||||
long int acq_trk_diff_samples;
|
||||
double acq_trk_diff_seconds;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp);//-d_vector_length;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples;
|
||||
acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
|
||||
// Doppler effect
|
||||
// Fd=(C/(C+Vr))*F
|
||||
d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch;
|
||||
// new chip and prn sequence periods based on acq Doppler
|
||||
double T_chip_mod_seconds;
|
||||
@@ -261,14 +259,15 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
|
||||
d_acq_code_phase_samples = corrected_acq_phase_samples;
|
||||
|
||||
d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * static_cast<double>(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)));;
|
||||
d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * static_cast<double>(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)));
|
||||
;
|
||||
d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
|
||||
|
||||
d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_frequency_hz / static_cast<double>(d_fs_in);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter.initialize(d_carrier_frequency_hz); // The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
d_carrier_loop_filter.initialize(d_carrier_frequency_hz); // The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
glonass_l1_ca_code_gen_complex(d_ca_code, 0);
|
||||
@@ -277,7 +276,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc, d_local_code_shift_chips);
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_16sc_t(0,0);
|
||||
d_correlator_outs_16sc[n] = lv_16sc_t(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -289,7 +288,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
d_code_phase_samples = d_acq_code_phase_samples;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking start on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -302,8 +301,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
d_preamble_synchronized = true;
|
||||
|
||||
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||
}
|
||||
|
||||
|
||||
@@ -314,18 +313,18 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
int number_of_double_vars = 11;
|
||||
int number_of_float_vars = 5;
|
||||
int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
std::ifstream dump_file;
|
||||
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
try
|
||||
{
|
||||
{
|
||||
dump_file.open(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
}
|
||||
catch(const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// count number of epochs and rewind
|
||||
long int num_epoch = 0;
|
||||
if (dump_file.is_open())
|
||||
@@ -338,30 +337,30 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
float * abs_E = new float [num_epoch];
|
||||
float * abs_P = new float [num_epoch];
|
||||
float * abs_L = new float [num_epoch];
|
||||
float * Prompt_I = new float [num_epoch];
|
||||
float * Prompt_Q = new float [num_epoch];
|
||||
unsigned long int * PRN_start_sample_count = new unsigned long int [num_epoch];
|
||||
double * acc_carrier_phase_rad = new double [num_epoch];
|
||||
double * carrier_doppler_hz = new double [num_epoch];
|
||||
double * code_freq_chips = new double [num_epoch];
|
||||
double * carr_error_hz = new double [num_epoch];
|
||||
double * carr_error_filt_hz = new double [num_epoch];
|
||||
double * code_error_chips = new double [num_epoch];
|
||||
double * code_error_filt_chips = new double [num_epoch];
|
||||
double * CN0_SNV_dB_Hz = new double [num_epoch];
|
||||
double * carrier_lock_test = new double [num_epoch];
|
||||
double * aux1 = new double [num_epoch];
|
||||
double * aux2 = new double [num_epoch];
|
||||
unsigned int * PRN = new unsigned int [num_epoch];
|
||||
float *abs_E = new float[num_epoch];
|
||||
float *abs_P = new float[num_epoch];
|
||||
float *abs_L = new float[num_epoch];
|
||||
float *Prompt_I = new float[num_epoch];
|
||||
float *Prompt_Q = new float[num_epoch];
|
||||
unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch];
|
||||
double *acc_carrier_phase_rad = new double[num_epoch];
|
||||
double *carrier_doppler_hz = new double[num_epoch];
|
||||
double *code_freq_chips = new double[num_epoch];
|
||||
double *carr_error_hz = new double[num_epoch];
|
||||
double *carr_error_filt_hz = new double[num_epoch];
|
||||
double *code_error_chips = new double[num_epoch];
|
||||
double *code_error_filt_chips = new double[num_epoch];
|
||||
double *CN0_SNV_dB_Hz = new double[num_epoch];
|
||||
double *carrier_lock_test = new double[num_epoch];
|
||||
double *aux1 = new double[num_epoch];
|
||||
double *aux2 = new double[num_epoch];
|
||||
unsigned int *PRN = new unsigned int[num_epoch];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
if (dump_file.is_open())
|
||||
{
|
||||
for(long int i = 0; i < num_epoch; i++)
|
||||
for (long int i = 0; i < num_epoch; i++)
|
||||
{
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_E[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_P[i]), sizeof(float));
|
||||
@@ -384,10 +383,10 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
}
|
||||
}
|
||||
dump_file.close();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
delete[] abs_E;
|
||||
delete[] abs_P;
|
||||
delete[] abs_L;
|
||||
@@ -407,7 +406,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
delete[] aux2;
|
||||
delete[] PRN;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE MAT FILE
|
||||
mat_t *matfp;
|
||||
@@ -416,79 +415,79 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
filename.erase(filename.length() - 4, 4);
|
||||
filename.append(".mat");
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if(reinterpret_cast<long*>(matfp) != NULL)
|
||||
if (reinterpret_cast<long *>(matfp) != NULL)
|
||||
{
|
||||
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
||||
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
}
|
||||
Mat_Close(matfp);
|
||||
@@ -516,30 +515,30 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_sc::~glonass_l1_ca_dll_pll_c_aid_tracking_sc()
|
||||
{
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
if(d_dump)
|
||||
{
|
||||
if(d_channel == 0)
|
||||
{
|
||||
std::cout << "Writing .mat files ...";
|
||||
}
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile();
|
||||
if(d_channel == 0)
|
||||
{
|
||||
std::cout << " done." << std::endl;
|
||||
}
|
||||
}
|
||||
if (d_dump)
|
||||
{
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << "Writing .mat files ...";
|
||||
}
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile();
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << " done." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
@@ -551,12 +550,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::~glonass_l1_ca_dll_pll_c_aid_tracking_s
|
||||
}
|
||||
|
||||
|
||||
|
||||
int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// Block input data and block output stream pointers
|
||||
const lv_16sc_t* in = reinterpret_cast<const lv_16sc_t*>(input_items[0]); // PRN start block alignment
|
||||
const lv_16sc_t *in = reinterpret_cast<const lv_16sc_t *>(input_items[0]); // PRN start block alignment
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||
@@ -581,14 +579,14 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
|
||||
d_sample_counter += samples_offset; // count for the processed samples
|
||||
d_sample_counter += samples_offset; // count for the processed samples
|
||||
d_pull_in = false;
|
||||
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GLONASS_TWO_PI;
|
||||
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GLONASS_TWO_PI;
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||
current_synchro_data.fs=d_fs_in;
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -603,9 +601,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
|
||||
// ####### coherent intergration extension
|
||||
// keep the last symbols
|
||||
d_E_history.push_back(d_correlator_outs_16sc[0]); // save early output
|
||||
d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output
|
||||
d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output
|
||||
d_E_history.push_back(d_correlator_outs_16sc[0]); // save early output
|
||||
d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output
|
||||
d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output
|
||||
|
||||
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms)
|
||||
{
|
||||
@@ -623,9 +621,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
// compute coherent integration and enable tracking loop
|
||||
// perform coherent integration using correlator output history
|
||||
// std::cout<<"##### RESET COHERENT INTEGRATION ####"<<std::endl;
|
||||
d_correlator_outs_16sc[0] = lv_cmake(0,0);
|
||||
d_correlator_outs_16sc[1] = lv_cmake(0,0);
|
||||
d_correlator_outs_16sc[2] = lv_cmake(0,0);
|
||||
d_correlator_outs_16sc[0] = lv_cmake(0, 0);
|
||||
d_correlator_outs_16sc[1] = lv_cmake(0, 0);
|
||||
d_correlator_outs_16sc[2] = lv_cmake(0, 0);
|
||||
for (int n = 0; n < d_extend_correlation_ms; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[0] += d_E_history.at(n);
|
||||
@@ -636,9 +634,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
if (d_preamble_synchronized == false)
|
||||
{
|
||||
d_code_loop_filter.set_DLL_BW(d_dll_bw_narrow_hz);
|
||||
d_carrier_loop_filter.set_params(10.0, d_pll_bw_narrow_hz,2);
|
||||
d_carrier_loop_filter.set_params(10.0, d_pll_bw_narrow_hz, 2);
|
||||
d_preamble_synchronized = true;
|
||||
std::cout << "Enabled " << d_extend_correlation_ms << " [ms] extended correlator for CH "<< d_channel << " : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
||||
std::cout << "Enabled " << d_extend_correlation_ms << " [ms] extended correlator for CH " << d_channel << " : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
||||
<< " pll_bw = " << d_pll_bw_hz << " [Hz], pll_narrow_bw = " << d_pll_bw_narrow_hz << " [Hz]" << std::endl
|
||||
<< " dll_bw = " << d_dll_bw_hz << " [Hz], dll_narrow_bw = " << d_dll_bw_narrow_hz << " [Hz]" << std::endl;
|
||||
}
|
||||
@@ -648,7 +646,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
}
|
||||
else
|
||||
{
|
||||
if(d_preamble_synchronized == true)
|
||||
if (d_preamble_synchronized == true)
|
||||
{
|
||||
// continue extended coherent correlation
|
||||
// Compute the next buffer length based on the period of the PRN sequence and the code phase error estimation
|
||||
@@ -659,7 +657,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
|
||||
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples;
|
||||
// code phase step (Code resampler phase increment per sample) [chips/sample]
|
||||
@@ -695,7 +693,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
{
|
||||
// ################## PLL ##########################################################
|
||||
// Update PLL discriminator [rads/Ti -> Secs/Ti]
|
||||
d_carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(std::complex<float>(d_correlator_outs_16sc[1].real(),d_correlator_outs_16sc[1].imag())) / GLONASS_TWO_PI; //prompt output
|
||||
d_carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(std::complex<float>(d_correlator_outs_16sc[1].real(), d_correlator_outs_16sc[1].imag())) / GLONASS_TWO_PI; //prompt output
|
||||
d_carrier_doppler_old_hz = d_carrier_doppler_hz;
|
||||
// Carrier discriminator filter
|
||||
// NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan
|
||||
@@ -708,11 +706,11 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
|
||||
// ################## DLL ##########################################################
|
||||
// DLL discriminator
|
||||
d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(std::complex<float>(d_correlator_outs_16sc[0].real(),d_correlator_outs_16sc[0].imag()), std::complex<float>(d_correlator_outs_16sc[2].real(),d_correlator_outs_16sc[2].imag())); // [chips/Ti] //early and late
|
||||
d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(std::complex<float>(d_correlator_outs_16sc[0].real(), d_correlator_outs_16sc[0].imag()), std::complex<float>(d_correlator_outs_16sc[2].real(), d_correlator_outs_16sc[2].imag())); // [chips/Ti] //early and late
|
||||
// Code discriminator filter
|
||||
d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second]
|
||||
d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second]
|
||||
d_code_error_filt_chips_Ti = d_code_error_filt_chips_s * CURRENT_INTEGRATION_TIME_S;
|
||||
code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti]
|
||||
code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti]
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
// keep alignment parameters for the next input buffer
|
||||
@@ -723,12 +721,12 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
double K_prn_samples = round(T_prn_samples);
|
||||
double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
|
||||
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples + code_error_filt_secs_Ti * static_cast<double>(d_fs_in); //(code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti) * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples + code_error_filt_secs_Ti * static_cast<double>(d_fs_in); //(code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti) * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples;
|
||||
|
||||
//################### PLL COMMANDS #################################################
|
||||
//################### PLL COMMANDS #################################################
|
||||
//carrier phase step (NCO phase increment per sample) [rads/sample]
|
||||
d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * d_correlation_length_samples / GLONASS_TWO_PI;
|
||||
@@ -747,7 +745,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
if (d_cn0_estimation_counter < FLAGS_cn0_samples)
|
||||
{
|
||||
// fill buffer with prompt correlator output values
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = lv_cmake(static_cast<float>(d_correlator_outs_16sc[1].real()), static_cast<float>(d_correlator_outs_16sc[1].imag()) ); // prompt
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = lv_cmake(static_cast<float>(d_correlator_outs_16sc[1].real()), static_cast<float>(d_correlator_outs_16sc[1].imag())); // prompt
|
||||
d_cn0_estimation_counter++;
|
||||
}
|
||||
else
|
||||
@@ -770,9 +768,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3));//3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
@@ -801,7 +799,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples;
|
||||
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
||||
current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles;
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;// todo: project the carrier doppler
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
|
||||
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
||||
}
|
||||
}
|
||||
@@ -809,15 +807,15 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
{
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0,0);
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0, 0);
|
||||
}
|
||||
|
||||
current_synchro_data.System = {'R'};
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples;
|
||||
}
|
||||
current_synchro_data.fs=d_fs_in;
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -826,60 +824,60 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __a
|
||||
double tmp_double;
|
||||
prompt_I = d_correlator_outs_16sc[1].real();
|
||||
prompt_Q = d_correlator_outs_16sc[1].imag();
|
||||
tmp_E = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[0].real(),d_correlator_outs_16sc[0].imag()));
|
||||
tmp_P = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[1].real(),d_correlator_outs_16sc[1].imag()));
|
||||
tmp_L = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[2].real(),d_correlator_outs_16sc[2].imag()));
|
||||
tmp_E = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[0].real(), d_correlator_outs_16sc[0].imag()));
|
||||
tmp_P = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[1].real(), d_correlator_outs_16sc[1].imag()));
|
||||
tmp_L = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[2].real(), d_correlator_outs_16sc[2].imag()));
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
//tmp_float=(float)d_sample_counter;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(double));
|
||||
|
||||
//PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
|
||||
//DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_error_filt_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_error_filt_chips_Ti), sizeof(double));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(double));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_double = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
{
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
|
||||
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
|
||||
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
|
||||
}
|
||||
|
||||
|
||||
@@ -893,23 +891,23 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
{
|
||||
}
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void glonass_l1_ca_dll_pll_c_aid_tracking_sc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void glonass_l1_ca_dll_pll_c_aid_tracking_sc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -55,27 +55,25 @@
|
||||
class glonass_l1_ca_dll_pll_c_aid_tracking_sc;
|
||||
|
||||
typedef boost::shared_ptr<glonass_l1_ca_dll_pll_c_aid_tracking_sc>
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr;
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr;
|
||||
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr
|
||||
glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class glonass_l1_ca_dll_pll_c_aid_tracking_sc: public gr::block
|
||||
class glonass_l1_ca_dll_pll_c_aid_tracking_sc : public gr::block
|
||||
{
|
||||
public:
|
||||
~glonass_l1_ca_dll_pll_c_aid_tracking_sc();
|
||||
@@ -84,36 +82,34 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr
|
||||
glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
glonass_l1_ca_dll_pll_c_aid_tracking_sc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
// tracking configuration vars
|
||||
unsigned int d_vector_length;
|
||||
@@ -209,4 +205,4 @@ private:
|
||||
int save_matfile();
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_SC_H
|
||||
#endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_SC_H
|
||||
|
||||
@@ -58,43 +58,40 @@ using google::LogMessage;
|
||||
|
||||
glonass_l1_ca_dll_pll_tracking_cc_sptr
|
||||
glonass_l1_ca_dll_pll_make_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips)
|
||||
{
|
||||
return glonass_l1_ca_dll_pll_tracking_cc_sptr(new Glonass_L1_Ca_Dll_Pll_Tracking_cc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Glonass_L1_Ca_Dll_Pll_Tracking_cc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void Glonass_L1_Ca_Dll_Pll_Tracking_cc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips) :
|
||||
gr::block("Glonass_L1_Ca_Dll_Pll_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips) : gr::block("Glonass_L1_Ca_Dll_Pll_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
@@ -114,22 +111,22 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc(
|
||||
d_carrier_loop_filter.set_PLL_BW(pll_bw_hz);
|
||||
|
||||
//--- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex*>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -191,12 +188,12 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
|
||||
long int acq_trk_diff_samples;
|
||||
double acq_trk_diff_seconds;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples;
|
||||
acq_trk_diff_seconds = static_cast<float>(acq_trk_diff_samples) / static_cast<float>(d_fs_in);
|
||||
// Doppler effect
|
||||
// Fd=(C/(C+Vr))*F
|
||||
d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch;
|
||||
// new chip and prn sequence periods based on acq Doppler
|
||||
double T_chip_mod_seconds;
|
||||
@@ -204,7 +201,7 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
double T_prn_mod_samples;
|
||||
d_code_freq_chips = radial_velocity * GLONASS_L1_CA_CODE_RATE_HZ;
|
||||
d_code_phase_step_chips = static_cast<double>(d_code_freq_chips) / static_cast<double>(d_fs_in);
|
||||
T_chip_mod_seconds = 1/d_code_freq_chips;
|
||||
T_chip_mod_seconds = 1 / d_code_freq_chips;
|
||||
T_prn_mod_seconds = T_chip_mod_seconds * GLONASS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
T_prn_mod_samples = T_prn_mod_seconds * static_cast<double>(d_fs_in);
|
||||
|
||||
@@ -224,14 +221,14 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
|
||||
d_acq_code_phase_samples = corrected_acq_phase_samples;
|
||||
|
||||
d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
|
||||
d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_frequency_hz / static_cast<double>(d_fs_in);
|
||||
d_carrier_doppler_phase_step_rad = GLONASS_TWO_PI * (d_carrier_doppler_hz) / static_cast<double>(d_fs_in);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter.initialize(); // initialize the carrier filter
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
d_carrier_loop_filter.initialize(); // initialize the carrier filter
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
glonass_l1_ca_code_gen_complex(d_ca_code, 0);
|
||||
@@ -239,7 +236,7 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -251,7 +248,7 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
d_code_phase_samples = d_acq_code_phase_samples;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking of GLONASS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -262,8 +259,8 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
d_enable_tracking = true;
|
||||
|
||||
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_frequency_hz
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,38 +269,38 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::~Glonass_L1_Ca_Dll_Pll_Tracking_cc()
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << "Writing .mat files ...";
|
||||
}
|
||||
Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile();
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << " done." << std::endl;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
delete[] d_Prompt_buffer;
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -314,18 +311,18 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
int number_of_double_vars = 11;
|
||||
int number_of_float_vars = 5;
|
||||
int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
std::ifstream dump_file;
|
||||
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
try
|
||||
{
|
||||
{
|
||||
dump_file.open(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
}
|
||||
catch(const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// count number of epochs and rewind
|
||||
long int num_epoch = 0;
|
||||
if (dump_file.is_open())
|
||||
@@ -338,30 +335,30 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
float * abs_E = new float [num_epoch];
|
||||
float * abs_P = new float [num_epoch];
|
||||
float * abs_L = new float [num_epoch];
|
||||
float * Prompt_I = new float [num_epoch];
|
||||
float * Prompt_Q = new float [num_epoch];
|
||||
unsigned long int * PRN_start_sample_count = new unsigned long int [num_epoch];
|
||||
double * acc_carrier_phase_rad = new double [num_epoch];
|
||||
double * carrier_doppler_hz = new double [num_epoch];
|
||||
double * code_freq_chips = new double [num_epoch];
|
||||
double * carr_error_hz = new double [num_epoch];
|
||||
double * carr_error_filt_hz = new double [num_epoch];
|
||||
double * code_error_chips = new double [num_epoch];
|
||||
double * code_error_filt_chips = new double [num_epoch];
|
||||
double * CN0_SNV_dB_Hz = new double [num_epoch];
|
||||
double * carrier_lock_test = new double [num_epoch];
|
||||
double * aux1 = new double [num_epoch];
|
||||
double * aux2 = new double [num_epoch];
|
||||
unsigned int * PRN = new unsigned int [num_epoch];
|
||||
float *abs_E = new float[num_epoch];
|
||||
float *abs_P = new float[num_epoch];
|
||||
float *abs_L = new float[num_epoch];
|
||||
float *Prompt_I = new float[num_epoch];
|
||||
float *Prompt_Q = new float[num_epoch];
|
||||
unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch];
|
||||
double *acc_carrier_phase_rad = new double[num_epoch];
|
||||
double *carrier_doppler_hz = new double[num_epoch];
|
||||
double *code_freq_chips = new double[num_epoch];
|
||||
double *carr_error_hz = new double[num_epoch];
|
||||
double *carr_error_filt_hz = new double[num_epoch];
|
||||
double *code_error_chips = new double[num_epoch];
|
||||
double *code_error_filt_chips = new double[num_epoch];
|
||||
double *CN0_SNV_dB_Hz = new double[num_epoch];
|
||||
double *carrier_lock_test = new double[num_epoch];
|
||||
double *aux1 = new double[num_epoch];
|
||||
double *aux2 = new double[num_epoch];
|
||||
unsigned int *PRN = new unsigned int[num_epoch];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
if (dump_file.is_open())
|
||||
{
|
||||
for(long int i = 0; i < num_epoch; i++)
|
||||
for (long int i = 0; i < num_epoch; i++)
|
||||
{
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_E[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_P[i]), sizeof(float));
|
||||
@@ -384,10 +381,10 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
}
|
||||
}
|
||||
dump_file.close();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
delete[] abs_E;
|
||||
delete[] abs_P;
|
||||
delete[] abs_L;
|
||||
@@ -407,7 +404,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
delete[] aux2;
|
||||
delete[] PRN;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE MAT FILE
|
||||
mat_t *matfp;
|
||||
@@ -416,79 +413,79 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
filename.erase(filename.length() - 4, 4);
|
||||
filename.append(".mat");
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if(reinterpret_cast<long*>(matfp) != NULL)
|
||||
if (reinterpret_cast<long *>(matfp) != NULL)
|
||||
{
|
||||
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
||||
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
}
|
||||
Mat_Close(matfp);
|
||||
@@ -514,8 +511,8 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
}
|
||||
|
||||
|
||||
int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// process vars
|
||||
double carr_error_hz = 0.0;
|
||||
@@ -524,7 +521,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
double code_error_filt_chips = 0.0;
|
||||
|
||||
// Block input data and block output stream pointers
|
||||
const gr_complex* in = reinterpret_cast<const gr_complex*>(input_items[0]); // PRN start block alignment
|
||||
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); // PRN start block alignment
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||
@@ -544,7 +541,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples));
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
|
||||
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples
|
||||
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples
|
||||
d_pull_in = false;
|
||||
// take into account the carrier cycles accumulated in the pull in signal alignment
|
||||
d_acc_carrier_phase_rad -= d_carrier_doppler_phase_step_rad * samples_offset;
|
||||
@@ -553,7 +550,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
current_synchro_data.correlation_length_ms = 1;
|
||||
*out[0] = current_synchro_data;
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -561,15 +558,15 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_current_prn_length_samples);
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_current_prn_length_samples);
|
||||
|
||||
// ################## PLL ##########################################################
|
||||
// PLL discriminator
|
||||
// Update PLL discriminator [rads/Ti -> Secs/Ti]
|
||||
carr_error_hz = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GLONASS_TWO_PI; // prompt output
|
||||
carr_error_hz = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GLONASS_TWO_PI; // prompt output
|
||||
// Carrier discriminator filter
|
||||
carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz);
|
||||
// New carrier Doppler frequency estimation
|
||||
@@ -579,12 +576,12 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
|
||||
// ################## DLL ##########################################################
|
||||
// DLL discriminator
|
||||
code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti] //early and late
|
||||
code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti] //early and late
|
||||
// Code discriminator filter
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); // [chips/second]
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); // [chips/second]
|
||||
double T_chip_seconds = 1.0 / static_cast<double>(d_code_freq_chips);
|
||||
double T_prn_seconds = T_chip_seconds * GLONASS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips*T_chip_seconds); //[seconds]
|
||||
double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips * T_chip_seconds); //[seconds]
|
||||
//double code_error_filt_secs = (GPS_L1_CA_CODE_PERIOD * code_error_filt_chips) / GLONASS_L1_CA_CODE_RATE_HZ; // [seconds]
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
@@ -594,7 +591,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
//double T_prn_seconds = T_chip_seconds * GLONASS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
|
||||
double K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast<double>(d_fs_in);
|
||||
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
|
||||
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
|
||||
|
||||
//################### PLL COMMANDS #################################################
|
||||
// carrier phase step (NCO phase increment per sample) [rads/sample]
|
||||
@@ -610,14 +607,14 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
// code phase step (Code resampler phase increment per sample) [chips/sample]
|
||||
d_code_phase_step_chips = d_code_freq_chips / static_cast<double>(d_fs_in);
|
||||
// remnant code phase [chips]
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; // rounding error < 1 sample
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; // rounding error < 1 sample
|
||||
d_rem_code_phase_chips = d_code_freq_chips * (d_rem_code_phase_samples / static_cast<double>(d_fs_in));
|
||||
|
||||
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
|
||||
if (d_cn0_estimation_counter < FLAGS_cn0_samples)
|
||||
{
|
||||
// fill buffer with prompt correlator output values
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; //prompt
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; //prompt
|
||||
d_cn0_estimation_counter++;
|
||||
}
|
||||
else
|
||||
@@ -640,9 +637,9 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); // 3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); // 3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
@@ -660,7 +657,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
{
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples;
|
||||
@@ -671,7 +668,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
//assign the GNURadio block output data
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -685,59 +682,58 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribu
|
||||
tmp_P = std::abs<float>(d_correlator_outs[1]);
|
||||
tmp_L = std::abs<float>(d_correlator_outs[2]);
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
tmp_long = d_sample_counter + d_current_prn_length_samples;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_long), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_long), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_rad), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_rad), sizeof(double));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_frequency_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_frequency_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(double));
|
||||
|
||||
// PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&carr_error_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&carr_error_filt_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&carr_error_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&carr_error_filt_hz), sizeof(double));
|
||||
|
||||
// DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_filt_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_filt_chips), sizeof(double));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(double));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_double = d_rem_code_phase_samples;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(d_sample_counter);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_current_prn_length_samples; // count for the processed samples
|
||||
return 1; // output tracking result ALWAYS even in the case of d_enable_tracking==false
|
||||
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_current_prn_length_samples; // count for the processed samples
|
||||
return 1; // output tracking result ALWAYS even in the case of d_enable_tracking==false
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Glonass_L1_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
@@ -748,23 +744,23 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Glonass_L1_Ca_Dll_Pll_Tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void Glonass_L1_Ca_Dll_Pll_Tracking_cc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -51,24 +51,22 @@
|
||||
class Glonass_L1_Ca_Dll_Pll_Tracking_cc;
|
||||
|
||||
typedef boost::shared_ptr<Glonass_L1_Ca_Dll_Pll_Tracking_cc>
|
||||
glonass_l1_ca_dll_pll_tracking_cc_sptr;
|
||||
glonass_l1_ca_dll_pll_tracking_cc_sptr;
|
||||
|
||||
glonass_l1_ca_dll_pll_tracking_cc_sptr
|
||||
glonass_l1_ca_dll_pll_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class Glonass_L1_Ca_Dll_Pll_Tracking_cc: public gr::block
|
||||
class Glonass_L1_Ca_Dll_Pll_Tracking_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~Glonass_L1_Ca_Dll_Pll_Tracking_cc();
|
||||
@@ -77,30 +75,28 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend glonass_l1_ca_dll_pll_tracking_cc_sptr
|
||||
glonass_l1_ca_dll_pll_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
Glonass_L1_Ca_Dll_Pll_Tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
// tracking configuration vars
|
||||
unsigned int d_vector_length;
|
||||
@@ -174,4 +170,4 @@ private:
|
||||
int save_matfile();
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_TRACKING_CC_H
|
||||
#endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_TRACKING_CC_H
|
||||
|
||||
@@ -52,29 +52,29 @@ using google::LogMessage;
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr
|
||||
gps_l1_ca_dll_pll_c_aid_make_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips)
|
||||
{
|
||||
return gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_cc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz,pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips));
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips));
|
||||
}
|
||||
|
||||
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_cc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_cc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::forecast (int noutput_items,
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pmt_t msg)
|
||||
{
|
||||
//pmt::print(msg);
|
||||
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
|
||||
if (d_enable_extended_integration == false) //avoid re-setting preamble indicator
|
||||
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
|
||||
if (d_enable_extended_integration == false) //avoid re-setting preamble indicator
|
||||
{
|
||||
d_preamble_timestamp_s = pmt::to_double(msg);
|
||||
d_enable_extended_integration = true;
|
||||
@@ -93,25 +93,24 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pmt_t
|
||||
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips) :
|
||||
gr::block("gps_l1_ca_dll_pll_c_aid_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips) : gr::block("gps_l1_ca_dll_pll_c_aid_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
|
||||
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
|
||||
boost::bind(&gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index, this, _1));
|
||||
boost::bind(&gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index, this, _1));
|
||||
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
// initialize internal vars
|
||||
@@ -132,22 +131,22 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc(
|
||||
d_carrier_loop_filter.set_params(10.0, d_pll_bw_hz, 2);
|
||||
|
||||
// --- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -162,7 +161,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc(
|
||||
d_rem_carrier_phase_rad = 0.0;
|
||||
|
||||
// sample synchronization
|
||||
d_sample_counter = 0; //(from trk to tlm)
|
||||
d_sample_counter = 0; //(from trk to tlm)
|
||||
d_acq_sample_stamp = 0;
|
||||
d_enable_tracking = false;
|
||||
d_pull_in = false;
|
||||
@@ -215,7 +214,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
|
||||
long int acq_trk_diff_samples;
|
||||
double acq_trk_diff_seconds;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp);//-d_vector_length;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples;
|
||||
acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
|
||||
// Doppler effect
|
||||
@@ -252,8 +251,8 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); // The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); // The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
|
||||
@@ -261,7 +260,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -273,7 +272,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
d_code_phase_samples = d_acq_code_phase_samples;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -295,40 +294,40 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::~gps_l1_ca_dll_pll_c_aid_tracking_cc()
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << "Writing .mat files ...";
|
||||
}
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile();
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << " done." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
delete[] d_Prompt_buffer;
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -339,18 +338,18 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
int number_of_double_vars = 11;
|
||||
int number_of_float_vars = 5;
|
||||
int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
std::ifstream dump_file;
|
||||
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
try
|
||||
{
|
||||
{
|
||||
dump_file.open(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
}
|
||||
catch(const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// count number of epochs and rewind
|
||||
long int num_epoch = 0;
|
||||
if (dump_file.is_open())
|
||||
@@ -363,30 +362,30 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
float * abs_E = new float [num_epoch];
|
||||
float * abs_P = new float [num_epoch];
|
||||
float * abs_L = new float [num_epoch];
|
||||
float * Prompt_I = new float [num_epoch];
|
||||
float * Prompt_Q = new float [num_epoch];
|
||||
unsigned long int * PRN_start_sample_count = new unsigned long int [num_epoch];
|
||||
double * acc_carrier_phase_rad = new double [num_epoch];
|
||||
double * carrier_doppler_hz = new double [num_epoch];
|
||||
double * code_freq_chips = new double [num_epoch];
|
||||
double * carr_error_hz = new double [num_epoch];
|
||||
double * carr_error_filt_hz = new double [num_epoch];
|
||||
double * code_error_chips = new double [num_epoch];
|
||||
double * code_error_filt_chips = new double [num_epoch];
|
||||
double * CN0_SNV_dB_Hz = new double [num_epoch];
|
||||
double * carrier_lock_test = new double [num_epoch];
|
||||
double * aux1 = new double [num_epoch];
|
||||
double * aux2 = new double [num_epoch];
|
||||
unsigned int * PRN = new unsigned int [num_epoch];
|
||||
float *abs_E = new float[num_epoch];
|
||||
float *abs_P = new float[num_epoch];
|
||||
float *abs_L = new float[num_epoch];
|
||||
float *Prompt_I = new float[num_epoch];
|
||||
float *Prompt_Q = new float[num_epoch];
|
||||
unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch];
|
||||
double *acc_carrier_phase_rad = new double[num_epoch];
|
||||
double *carrier_doppler_hz = new double[num_epoch];
|
||||
double *code_freq_chips = new double[num_epoch];
|
||||
double *carr_error_hz = new double[num_epoch];
|
||||
double *carr_error_filt_hz = new double[num_epoch];
|
||||
double *code_error_chips = new double[num_epoch];
|
||||
double *code_error_filt_chips = new double[num_epoch];
|
||||
double *CN0_SNV_dB_Hz = new double[num_epoch];
|
||||
double *carrier_lock_test = new double[num_epoch];
|
||||
double *aux1 = new double[num_epoch];
|
||||
double *aux2 = new double[num_epoch];
|
||||
unsigned int *PRN = new unsigned int[num_epoch];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
if (dump_file.is_open())
|
||||
{
|
||||
for(long int i = 0; i < num_epoch; i++)
|
||||
for (long int i = 0; i < num_epoch; i++)
|
||||
{
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_E[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_P[i]), sizeof(float));
|
||||
@@ -409,10 +408,10 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
}
|
||||
}
|
||||
dump_file.close();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
delete[] abs_E;
|
||||
delete[] abs_P;
|
||||
delete[] abs_L;
|
||||
@@ -432,7 +431,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
delete[] aux2;
|
||||
delete[] PRN;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE MAT FILE
|
||||
mat_t *matfp;
|
||||
@@ -441,79 +440,79 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
filename.erase(filename.length() - 4, 4);
|
||||
filename.append(".mat");
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if(reinterpret_cast<long*>(matfp) != NULL)
|
||||
if (reinterpret_cast<long *>(matfp) != NULL)
|
||||
{
|
||||
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
||||
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
}
|
||||
Mat_Close(matfp);
|
||||
@@ -539,11 +538,11 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
|
||||
}
|
||||
|
||||
|
||||
int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// Block input data and block output stream pointers
|
||||
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||
@@ -568,31 +567,31 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
|
||||
d_sample_counter += samples_offset; // count for the processed samples
|
||||
d_sample_counter += samples_offset; // count for the processed samples
|
||||
d_pull_in = false;
|
||||
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GPS_TWO_PI;
|
||||
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GPS_TWO_PI;
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs,in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_correlation_length_samples);
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_correlation_length_samples);
|
||||
|
||||
// ####### coherent intergration extension
|
||||
// keep the last symbols
|
||||
d_E_history.push_back(d_correlator_outs[0]); // save early output
|
||||
d_P_history.push_back(d_correlator_outs[1]); // save prompt output
|
||||
d_L_history.push_back(d_correlator_outs[2]); // save late output
|
||||
d_E_history.push_back(d_correlator_outs[0]); // save early output
|
||||
d_P_history.push_back(d_correlator_outs[1]); // save prompt output
|
||||
d_L_history.push_back(d_correlator_outs[2]); // save late output
|
||||
|
||||
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms)
|
||||
{
|
||||
@@ -610,9 +609,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
// compute coherent integration and enable tracking loop
|
||||
// perform coherent integration using correlator output history
|
||||
// std::cout<<"##### RESET COHERENT INTEGRATION ####"<<std::endl;
|
||||
d_correlator_outs[0] = gr_complex(0.0,0.0);
|
||||
d_correlator_outs[1] = gr_complex(0.0,0.0);
|
||||
d_correlator_outs[2] = gr_complex(0.0,0.0);
|
||||
d_correlator_outs[0] = gr_complex(0.0, 0.0);
|
||||
d_correlator_outs[1] = gr_complex(0.0, 0.0);
|
||||
d_correlator_outs[2] = gr_complex(0.0, 0.0);
|
||||
for (int n = 0; n < d_extend_correlation_ms; n++)
|
||||
{
|
||||
d_correlator_outs[0] += d_E_history.at(n);
|
||||
@@ -623,9 +622,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
if (d_preamble_synchronized == false)
|
||||
{
|
||||
d_code_loop_filter.set_DLL_BW(d_dll_bw_narrow_hz);
|
||||
d_carrier_loop_filter.set_params(10.0, d_pll_bw_narrow_hz,2);
|
||||
d_carrier_loop_filter.set_params(10.0, d_pll_bw_narrow_hz, 2);
|
||||
d_preamble_synchronized = true;
|
||||
std::cout << "Enabled " << d_extend_correlation_ms << " [ms] extended correlator for CH "<< d_channel << " : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
||||
std::cout << "Enabled " << d_extend_correlation_ms << " [ms] extended correlator for CH " << d_channel << " : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
||||
<< " pll_bw = " << d_pll_bw_hz << " [Hz], pll_narrow_bw = " << d_pll_bw_narrow_hz << " [Hz]" << std::endl
|
||||
<< " dll_bw = " << d_dll_bw_hz << " [Hz], dll_narrow_bw = " << d_dll_bw_narrow_hz << " [Hz]" << std::endl;
|
||||
}
|
||||
@@ -636,7 +635,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
}
|
||||
else
|
||||
{
|
||||
if(d_preamble_synchronized == true)
|
||||
if (d_preamble_synchronized == true)
|
||||
{
|
||||
// continue extended coherent correlation
|
||||
// Compute the next buffer length based on the period of the PRN sequence and the code phase error estimation
|
||||
@@ -647,7 +646,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
|
||||
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples;
|
||||
// code phase step (Code resampler phase increment per sample) [chips/sample]
|
||||
@@ -684,7 +683,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
{
|
||||
// ################## PLL ##########################################################
|
||||
// Update PLL discriminator [rads/Ti -> Secs/Ti]
|
||||
d_carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_TWO_PI; // prompt output
|
||||
d_carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_TWO_PI; // prompt output
|
||||
// Carrier discriminator filter
|
||||
// NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan
|
||||
// Input [s/Ti] -> output [Hz]
|
||||
@@ -696,11 +695,11 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
|
||||
// ################## DLL ##########################################################
|
||||
// DLL discriminator
|
||||
d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti] //early and late
|
||||
d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti] //early and late
|
||||
// Code discriminator filter
|
||||
d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second]
|
||||
d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second]
|
||||
d_code_error_filt_chips_Ti = d_code_error_filt_chips_s * CURRENT_INTEGRATION_TIME_S;
|
||||
code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti]
|
||||
code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti]
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
// keep alignment parameters for the next input buffer
|
||||
@@ -711,12 +710,12 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
double K_prn_samples = round(T_prn_samples);
|
||||
double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
|
||||
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples + code_error_filt_secs_Ti * static_cast<double>(d_fs_in); //(code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti) * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples + code_error_filt_secs_Ti * static_cast<double>(d_fs_in); //(code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti) * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples;
|
||||
|
||||
//################### PLL COMMANDS #################################################
|
||||
//################### PLL COMMANDS #################################################
|
||||
//carrier phase step (NCO phase increment per sample) [rads/sample]
|
||||
d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * d_correlation_length_samples / GPS_TWO_PI;
|
||||
@@ -735,7 +734,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
if (d_cn0_estimation_counter < FLAGS_cn0_samples)
|
||||
{
|
||||
// fill buffer with prompt correlator output values
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; // prompt
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; // prompt
|
||||
d_cn0_estimation_counter++;
|
||||
}
|
||||
else
|
||||
@@ -758,9 +757,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3));//3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
@@ -788,7 +787,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples;
|
||||
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
||||
current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles;
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;// todo: project the carrier doppler
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
|
||||
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
||||
}
|
||||
}
|
||||
@@ -796,7 +795,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
{
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
current_synchro_data.System = {'G'};
|
||||
@@ -805,7 +804,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
//assign the GNURadio block output data
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -818,61 +817,63 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
|
||||
tmp_P = std::abs<float>(d_correlator_outs[1]);
|
||||
tmp_L = std::abs<float>(d_correlator_outs[2]);
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
//tmp_float=(float)d_sample_counter;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(double));
|
||||
|
||||
//PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
|
||||
//DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_error_filt_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_error_filt_chips_Ti), sizeof(double));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(double));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_double = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
{
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
|
||||
if (d_enable_tracking)
|
||||
{
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -886,24 +887,23 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
{
|
||||
}
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_cc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -52,27 +52,25 @@
|
||||
class gps_l1_ca_dll_pll_c_aid_tracking_cc;
|
||||
|
||||
typedef boost::shared_ptr<gps_l1_ca_dll_pll_c_aid_tracking_cc>
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr;
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr;
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr
|
||||
gps_l1_ca_dll_pll_c_aid_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class gps_l1_ca_dll_pll_c_aid_tracking_cc: public gr::block
|
||||
class gps_l1_ca_dll_pll_c_aid_tracking_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~gps_l1_ca_dll_pll_c_aid_tracking_cc();
|
||||
@@ -81,36 +79,34 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr
|
||||
gps_l1_ca_dll_pll_c_aid_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
// tracking configuration vars
|
||||
unsigned int d_vector_length;
|
||||
@@ -200,4 +196,4 @@ private:
|
||||
int save_matfile();
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_CC_H
|
||||
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_CC_H
|
||||
|
||||
@@ -53,27 +53,27 @@
|
||||
using google::LogMessage;
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc_sptr gps_l1_ca_dll_pll_c_aid_make_tracking_fpga_sc(
|
||||
long if_freq, long fs_in, unsigned int vector_length, bool dump,
|
||||
std::string dump_filename, float pll_bw_hz, float dll_bw_hz,
|
||||
float pll_bw_narrow_hz, float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms, float early_late_space_chips,
|
||||
std::string device_name, unsigned int device_base)
|
||||
long if_freq, long fs_in, unsigned int vector_length, bool dump,
|
||||
std::string dump_filename, float pll_bw_hz, float dll_bw_hz,
|
||||
float pll_bw_narrow_hz, float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms, float early_late_space_chips,
|
||||
std::string device_name, unsigned int device_base)
|
||||
{
|
||||
return gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc_sptr(
|
||||
new gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc(if_freq, fs_in,
|
||||
vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz,
|
||||
pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms,
|
||||
early_late_space_chips, device_name, device_base));
|
||||
new gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc(if_freq, fs_in,
|
||||
vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz,
|
||||
pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms,
|
||||
early_late_space_chips, device_name, device_base));
|
||||
}
|
||||
|
||||
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::msg_handler_preamble_index(
|
||||
pmt::pmt_t msg)
|
||||
pmt::pmt_t msg)
|
||||
{
|
||||
DLOG(INFO) << "Extended correlation enabled for Tracking CH "
|
||||
<< d_channel << ": Satellite "
|
||||
<< Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
|
||||
if (d_enable_extended_integration == false) //avoid re-setting preamble indicator
|
||||
if (d_enable_extended_integration == false) //avoid re-setting preamble indicator
|
||||
{
|
||||
d_preamble_timestamp_s = pmt::to_double(msg);
|
||||
d_enable_extended_integration = true;
|
||||
@@ -83,22 +83,21 @@ void gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::msg_handler_preamble_index(
|
||||
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc(
|
||||
long if_freq, long fs_in, unsigned int vector_length, bool dump,
|
||||
std::string dump_filename, float pll_bw_hz, float dll_bw_hz,
|
||||
float pll_bw_narrow_hz, float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms, float early_late_space_chips,
|
||||
std::string device_name, unsigned int device_base) :
|
||||
gr::block("gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc",
|
||||
gr::io_signature::make(0, 0, sizeof(lv_16sc_t)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq, long fs_in, unsigned int vector_length, bool dump,
|
||||
std::string dump_filename, float pll_bw_hz, float dll_bw_hz,
|
||||
float pll_bw_narrow_hz, float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms, float early_late_space_chips,
|
||||
std::string device_name, unsigned int device_base) : gr::block("gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc",
|
||||
gr::io_signature::make(0, 0, sizeof(lv_16sc_t)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
|
||||
boost::bind(
|
||||
&gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::msg_handler_preamble_index,
|
||||
this, _1));
|
||||
boost::bind(
|
||||
&gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::msg_handler_preamble_index,
|
||||
this, _1));
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
// initialize internal vars
|
||||
d_dump = dump;
|
||||
@@ -118,25 +117,25 @@ gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::gps_l1_ca_dll_pll_c_aid_tracking_fpga_
|
||||
d_extend_correlation_ms = extend_correlation_ms;
|
||||
|
||||
// --- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code_16sc = static_cast<lv_16sc_t*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
|
||||
d_correlator_outs_16sc = static_cast<lv_16sc_t*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t),
|
||||
volk_gnsssdr_get_alignment()));
|
||||
d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t),
|
||||
volk_gnsssdr_get_alignment()));
|
||||
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0, 0);
|
||||
}
|
||||
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
@@ -144,7 +143,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::gps_l1_ca_dll_pll_c_aid_tracking_fpga_
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
// create multicorrelator class
|
||||
multicorrelator_fpga_8sc = std::make_shared <fpga_multicorrelator_8sc>(d_n_correlator_taps, device_name, device_base);
|
||||
multicorrelator_fpga_8sc = std::make_shared<fpga_multicorrelator_8sc>(d_n_correlator_taps, device_name, device_base);
|
||||
|
||||
//--- Perform initializations ------------------------------
|
||||
// define initial code frequency basis of NCO
|
||||
@@ -155,7 +154,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::gps_l1_ca_dll_pll_c_aid_tracking_fpga_
|
||||
d_rem_carrier_phase_rad = 0.0;
|
||||
|
||||
// sample synchronization
|
||||
d_sample_counter = 0; //(from trk to tlm)
|
||||
d_sample_counter = 0; //(from trk to tlm)
|
||||
d_acq_sample_stamp = 0;
|
||||
d_enable_tracking = false;
|
||||
d_pull_in = false;
|
||||
@@ -244,8 +243,8 @@ void gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::start_tracking()
|
||||
d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); // The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); // The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
|
||||
@@ -296,49 +295,49 @@ gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::~gps_l1_ca_dll_pll_c_aid_tracking_fpga
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
LOG(WARNING)<< "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << "Writing .mat files ...";
|
||||
}
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::save_matfile();
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << " done." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
volk_gnsssdr_free(d_ca_code_16sc);
|
||||
volk_gnsssdr_free(d_correlator_outs_16sc);
|
||||
delete[] d_Prompt_buffer;
|
||||
multicorrelator_fpga_8sc->free();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
int noutput_items __attribute__((unused)),
|
||||
gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
int noutput_items __attribute__((unused)),
|
||||
gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
// samples offset
|
||||
int samples_offset;
|
||||
@@ -363,10 +362,10 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
double acq_trk_shif_correction_samples;
|
||||
int acq_to_trk_delay_samples;
|
||||
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
|
||||
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod( static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
|
||||
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
|
||||
d_sample_counter += samples_offset; // count for the processed samples
|
||||
d_sample_counter += samples_offset; // count for the processed samples
|
||||
d_pull_in = false;
|
||||
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GPS_TWO_PI;
|
||||
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GPS_TWO_PI;
|
||||
@@ -384,15 +383,15 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
multicorrelator_fpga_8sc->set_output_vectors(d_correlator_outs_16sc);
|
||||
|
||||
multicorrelator_fpga_8sc->Carrier_wipeoff_multicorrelator_resampler(
|
||||
d_rem_carrier_phase_rad, d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips, d_code_phase_step_chips,
|
||||
d_correlation_length_samples);
|
||||
d_rem_carrier_phase_rad, d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips, d_code_phase_step_chips,
|
||||
d_correlation_length_samples);
|
||||
|
||||
// ####### coherent intergration extension
|
||||
// keep the last symbols
|
||||
d_E_history.push_back(d_correlator_outs_16sc[0]); // save early output
|
||||
d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output
|
||||
d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output
|
||||
d_E_history.push_back(d_correlator_outs_16sc[0]); // save early output
|
||||
d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output
|
||||
d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output
|
||||
|
||||
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms)
|
||||
{
|
||||
@@ -433,7 +432,8 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
<< " pll_bw = " << d_pll_bw_hz
|
||||
<< " [Hz], pll_narrow_bw = "
|
||||
<< d_pll_bw_narrow_hz << " [Hz]"
|
||||
<< std::endl << " dll_bw = "
|
||||
<< std::endl
|
||||
<< " dll_bw = "
|
||||
<< d_dll_bw_hz
|
||||
<< " [Hz], dll_narrow_bw = "
|
||||
<< d_dll_bw_narrow_hz << " [Hz]"
|
||||
@@ -456,7 +456,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
|
||||
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples;
|
||||
// code phase step (Code resampler phase increment per sample) [chips/sample]
|
||||
@@ -492,7 +492,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
{
|
||||
// ################## PLL ##########################################################
|
||||
// Update PLL discriminator [rads/Ti -> Secs/Ti]
|
||||
d_carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(std::complex<float>(d_correlator_outs_16sc[1].real(), d_correlator_outs_16sc[1].imag())) / GPS_TWO_PI; //prompt output
|
||||
d_carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(std::complex<float>(d_correlator_outs_16sc[1].real(), d_correlator_outs_16sc[1].imag())) / GPS_TWO_PI; //prompt output
|
||||
|
||||
// Carrier discriminator filter
|
||||
// NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan
|
||||
@@ -506,16 +506,16 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
// ################## DLL ##########################################################
|
||||
// DLL discriminator
|
||||
d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(
|
||||
std::complex<float>(
|
||||
d_correlator_outs_16sc[0].real(),
|
||||
d_correlator_outs_16sc[0].imag()),
|
||||
std::complex<float>(
|
||||
d_correlator_outs_16sc[2].real(),
|
||||
d_correlator_outs_16sc[2].imag())); // [chips/Ti] //early and late
|
||||
std::complex<float>(
|
||||
d_correlator_outs_16sc[0].real(),
|
||||
d_correlator_outs_16sc[0].imag()),
|
||||
std::complex<float>(
|
||||
d_correlator_outs_16sc[2].real(),
|
||||
d_correlator_outs_16sc[2].imag())); // [chips/Ti] //early and late
|
||||
// Code discriminator filter
|
||||
d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second]
|
||||
d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second]
|
||||
d_code_error_filt_chips_Ti = d_code_error_filt_chips_s * CURRENT_INTEGRATION_TIME_S;
|
||||
code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti]
|
||||
code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti]
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
// keep alignment parameters for the next input buffer
|
||||
@@ -526,9 +526,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
double K_prn_samples = round(T_prn_samples);
|
||||
double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
|
||||
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples + code_error_filt_secs_Ti * static_cast<double>(d_fs_in); //(code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti) * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples+ d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples + code_error_filt_secs_Ti * static_cast<double>(d_fs_in); //(code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti) * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples;
|
||||
|
||||
//################### PLL COMMANDS #################################################
|
||||
@@ -551,7 +551,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
{
|
||||
// fill buffer with prompt correlator output values
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = lv_cmake(static_cast<float>(d_correlator_outs_16sc[1].real()),
|
||||
static_cast<float>(d_correlator_outs_16sc[1].imag())); // prompt
|
||||
static_cast<float>(d_correlator_outs_16sc[1].imag())); // prompt
|
||||
d_cn0_estimation_counter++;
|
||||
}
|
||||
else
|
||||
@@ -577,9 +577,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
multicorrelator_fpga_8sc->unlock_channel();
|
||||
}
|
||||
}
|
||||
@@ -608,7 +608,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples;
|
||||
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
||||
current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles;
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
|
||||
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
||||
}
|
||||
}
|
||||
@@ -641,59 +641,61 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
|
||||
try
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
//tmp_float=(float)d_sample_counter;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(double));
|
||||
|
||||
//PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
|
||||
//DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_error_filt_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_error_filt_chips_Ti), sizeof(double));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(double));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_double = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
||||
}
|
||||
}
|
||||
|
||||
//consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
|
||||
if (d_enable_tracking)
|
||||
{
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -717,7 +719,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::set_channel(unsigned int channel)
|
||||
<< d_channel << " Log file: "
|
||||
<< d_dump_filename.c_str();
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel
|
||||
<< " Exception opening trk dump file "
|
||||
@@ -735,18 +737,18 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::save_matfile()
|
||||
int number_of_double_vars = 11;
|
||||
int number_of_float_vars = 5;
|
||||
int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
std::ifstream dump_file;
|
||||
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
try
|
||||
{
|
||||
{
|
||||
dump_file.open(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
}
|
||||
catch(const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// count number of epochs and rewind
|
||||
long int num_epoch = 0;
|
||||
if (dump_file.is_open())
|
||||
@@ -759,30 +761,30 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::save_matfile()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
float * abs_E = new float [num_epoch];
|
||||
float * abs_P = new float [num_epoch];
|
||||
float * abs_L = new float [num_epoch];
|
||||
float * Prompt_I = new float [num_epoch];
|
||||
float * Prompt_Q = new float [num_epoch];
|
||||
unsigned long int * PRN_start_sample_count = new unsigned long int [num_epoch];
|
||||
double * acc_carrier_phase_rad = new double [num_epoch];
|
||||
double * carrier_doppler_hz = new double [num_epoch];
|
||||
double * code_freq_chips = new double [num_epoch];
|
||||
double * carr_error_hz = new double [num_epoch];
|
||||
double * carr_error_filt_hz = new double [num_epoch];
|
||||
double * code_error_chips = new double [num_epoch];
|
||||
double * code_error_filt_chips = new double [num_epoch];
|
||||
double * CN0_SNV_dB_Hz = new double [num_epoch];
|
||||
double * carrier_lock_test = new double [num_epoch];
|
||||
double * aux1 = new double [num_epoch];
|
||||
double * aux2 = new double [num_epoch];
|
||||
unsigned int * PRN = new unsigned int [num_epoch];
|
||||
float *abs_E = new float[num_epoch];
|
||||
float *abs_P = new float[num_epoch];
|
||||
float *abs_L = new float[num_epoch];
|
||||
float *Prompt_I = new float[num_epoch];
|
||||
float *Prompt_Q = new float[num_epoch];
|
||||
unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch];
|
||||
double *acc_carrier_phase_rad = new double[num_epoch];
|
||||
double *carrier_doppler_hz = new double[num_epoch];
|
||||
double *code_freq_chips = new double[num_epoch];
|
||||
double *carr_error_hz = new double[num_epoch];
|
||||
double *carr_error_filt_hz = new double[num_epoch];
|
||||
double *code_error_chips = new double[num_epoch];
|
||||
double *code_error_filt_chips = new double[num_epoch];
|
||||
double *CN0_SNV_dB_Hz = new double[num_epoch];
|
||||
double *carrier_lock_test = new double[num_epoch];
|
||||
double *aux1 = new double[num_epoch];
|
||||
double *aux2 = new double[num_epoch];
|
||||
unsigned int *PRN = new unsigned int[num_epoch];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
if (dump_file.is_open())
|
||||
{
|
||||
for(long int i = 0; i < num_epoch; i++)
|
||||
for (long int i = 0; i < num_epoch; i++)
|
||||
{
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_E[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_P[i]), sizeof(float));
|
||||
@@ -805,10 +807,10 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::save_matfile()
|
||||
}
|
||||
}
|
||||
dump_file.close();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
delete[] abs_E;
|
||||
delete[] abs_P;
|
||||
delete[] abs_L;
|
||||
@@ -828,7 +830,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::save_matfile()
|
||||
delete[] aux2;
|
||||
delete[] PRN;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE MAT FILE
|
||||
mat_t *matfp;
|
||||
@@ -837,79 +839,79 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::save_matfile()
|
||||
filename.erase(filename.length() - 4, 4);
|
||||
filename.append(".mat");
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if(reinterpret_cast<long*>(matfp) != NULL)
|
||||
if (reinterpret_cast<long *>(matfp) != NULL)
|
||||
{
|
||||
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
||||
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
}
|
||||
Mat_Close(matfp);
|
||||
@@ -935,7 +937,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::save_matfile()
|
||||
}
|
||||
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::set_gnss_synchro(
|
||||
Gnss_Synchro* p_gnss_synchro)
|
||||
Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -56,11 +56,10 @@ class gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc;
|
||||
typedef boost::shared_ptr<gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc> gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc_sptr;
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc_sptr
|
||||
gps_l1_ca_dll_pll_c_aid_make_tracking_fpga_sc(long if_freq, long fs_in, unsigned
|
||||
int vector_length, bool dump, std::string dump_filename, float pll_bw_hz,
|
||||
float dll_bw_hz, float pll_bw_narrow_hz, float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms, float early_late_space_chips,
|
||||
std::string device_name, unsigned int device_base);
|
||||
gps_l1_ca_dll_pll_c_aid_make_tracking_fpga_sc(long if_freq, long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz,
|
||||
float dll_bw_hz, float pll_bw_narrow_hz, float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms, float early_late_space_chips,
|
||||
std::string device_name, unsigned int device_base);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
@@ -74,30 +73,29 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
void reset(void);
|
||||
|
||||
private:
|
||||
friend gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc_sptr
|
||||
gps_l1_ca_dll_pll_c_aid_make_tracking_fpga_sc(long if_freq, long fs_in,
|
||||
unsigned
|
||||
int vector_length, bool dump, std::string dump_filename,
|
||||
float pll_bw_hz, float dll_bw_hz, float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz, int extend_correlation_ms,
|
||||
float early_late_space_chips, std::string device_name,
|
||||
unsigned int device_base);
|
||||
unsigned int vector_length, bool dump, std::string dump_filename,
|
||||
float pll_bw_hz, float dll_bw_hz, float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz, int extend_correlation_ms,
|
||||
float early_late_space_chips, std::string device_name,
|
||||
unsigned int device_base);
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc(long if_freq, long fs_in, unsigned
|
||||
int vector_length, bool dump, std::string dump_filename, float pll_bw_hz,
|
||||
float dll_bw_hz, float pll_bw_narrow_hz, float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms, float early_late_space_chips,
|
||||
std::string device_name, unsigned int device_base);
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc(long if_freq, long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz,
|
||||
float dll_bw_hz, float pll_bw_narrow_hz, float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms, float early_late_space_chips,
|
||||
std::string device_name, unsigned int device_base);
|
||||
|
||||
// tracking configuration vars
|
||||
unsigned int d_vector_length;bool d_dump;
|
||||
unsigned int d_vector_length;
|
||||
bool d_dump;
|
||||
|
||||
Gnss_Synchro* d_acquisition_gnss_synchro;
|
||||
unsigned int d_channel;
|
||||
@@ -144,7 +142,9 @@ private:
|
||||
double d_carr_phase_error_secs_Ti;
|
||||
double d_code_error_chips_Ti;
|
||||
double d_preamble_timestamp_s;
|
||||
int d_extend_correlation_ms;bool d_enable_extended_integration;bool d_preamble_synchronized;
|
||||
int d_extend_correlation_ms;
|
||||
bool d_enable_extended_integration;
|
||||
bool d_preamble_synchronized;
|
||||
double d_code_error_filt_chips_s;
|
||||
double d_code_error_filt_chips_Ti;
|
||||
void msg_handler_preamble_index(pmt::pmt_t msg);
|
||||
@@ -170,7 +170,8 @@ private:
|
||||
int d_carrier_lock_fail_counter;
|
||||
|
||||
// control vars
|
||||
bool d_enable_tracking;bool d_pull_in;
|
||||
bool d_enable_tracking;
|
||||
bool d_pull_in;
|
||||
|
||||
// file dump
|
||||
std::string d_dump_filename;
|
||||
@@ -182,4 +183,4 @@ private:
|
||||
int save_matfile();
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_FPGA_SC_H
|
||||
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_FPGA_SC_H
|
||||
|
||||
@@ -53,30 +53,29 @@ using google::LogMessage;
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr
|
||||
gps_l1_ca_dll_pll_c_aid_make_tracking_sc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips)
|
||||
{
|
||||
return gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_sc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips));
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_sc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_sc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,8 +83,8 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::forecast (int noutput_items,
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pmt_t msg)
|
||||
{
|
||||
//pmt::print(msg);
|
||||
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
|
||||
if (d_enable_extended_integration == false) //avoid re-setting preamble indicator
|
||||
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
|
||||
if (d_enable_extended_integration == false) //avoid re-setting preamble indicator
|
||||
{
|
||||
d_preamble_timestamp_s = pmt::to_double(msg);
|
||||
d_enable_extended_integration = true;
|
||||
@@ -94,24 +93,23 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pmt_t
|
||||
}
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips) :
|
||||
gr::block("gps_l1_ca_dll_pll_c_aid_tracking_sc", gr::io_signature::make(1, 1, sizeof(lv_16sc_t)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips) : gr::block("gps_l1_ca_dll_pll_c_aid_tracking_sc", gr::io_signature::make(1, 1, sizeof(lv_16sc_t)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
|
||||
boost::bind(&gps_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index, this, _1));
|
||||
boost::bind(&gps_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index, this, _1));
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
// initialize internal vars
|
||||
d_dump = dump;
|
||||
@@ -131,25 +129,25 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc(
|
||||
d_extend_correlation_ms = extend_correlation_ms;
|
||||
|
||||
// --- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code_16sc = static_cast<lv_16sc_t*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
|
||||
d_correlator_outs_16sc = static_cast<lv_16sc_t*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0,0);
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0, 0);
|
||||
}
|
||||
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -164,7 +162,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc(
|
||||
d_rem_carrier_phase_rad = 0.0;
|
||||
|
||||
// sample synchronization
|
||||
d_sample_counter = 0; //(from trk to tlm)
|
||||
d_sample_counter = 0; //(from trk to tlm)
|
||||
d_acq_sample_stamp = 0;
|
||||
d_enable_tracking = false;
|
||||
d_pull_in = false;
|
||||
@@ -216,7 +214,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
|
||||
long int acq_trk_diff_samples;
|
||||
double acq_trk_diff_seconds;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp);//-d_vector_length;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples;
|
||||
acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
|
||||
// Doppler effect
|
||||
@@ -253,8 +251,8 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); // The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); // The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
|
||||
@@ -263,7 +261,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc, d_local_code_shift_chips);
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_16sc_t(0,0);
|
||||
d_correlator_outs_16sc[n] = lv_16sc_t(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -275,7 +273,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
d_code_phase_samples = d_acq_code_phase_samples;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -288,8 +286,8 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
d_preamble_synchronized = false;
|
||||
|
||||
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||
}
|
||||
|
||||
|
||||
@@ -298,42 +296,41 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::~gps_l1_ca_dll_pll_c_aid_tracking_sc()
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << "Writing .mat files ...";
|
||||
}
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile();
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << " done." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
volk_gnsssdr_free(d_ca_code_16sc);
|
||||
volk_gnsssdr_free(d_correlator_outs_16sc);
|
||||
delete[] d_Prompt_buffer;
|
||||
multicorrelator_cpu_16sc.free();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -344,18 +341,18 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
int number_of_double_vars = 11;
|
||||
int number_of_float_vars = 5;
|
||||
int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
std::ifstream dump_file;
|
||||
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
try
|
||||
{
|
||||
{
|
||||
dump_file.open(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
}
|
||||
catch(const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// count number of epochs and rewind
|
||||
long int num_epoch = 0;
|
||||
if (dump_file.is_open())
|
||||
@@ -368,30 +365,30 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
float * abs_E = new float [num_epoch];
|
||||
float * abs_P = new float [num_epoch];
|
||||
float * abs_L = new float [num_epoch];
|
||||
float * Prompt_I = new float [num_epoch];
|
||||
float * Prompt_Q = new float [num_epoch];
|
||||
unsigned long int * PRN_start_sample_count = new unsigned long int [num_epoch];
|
||||
double * acc_carrier_phase_rad = new double [num_epoch];
|
||||
double * carrier_doppler_hz = new double [num_epoch];
|
||||
double * code_freq_chips = new double [num_epoch];
|
||||
double * carr_error_hz = new double [num_epoch];
|
||||
double * carr_error_filt_hz = new double [num_epoch];
|
||||
double * code_error_chips = new double [num_epoch];
|
||||
double * code_error_filt_chips = new double [num_epoch];
|
||||
double * CN0_SNV_dB_Hz = new double [num_epoch];
|
||||
double * carrier_lock_test = new double [num_epoch];
|
||||
double * aux1 = new double [num_epoch];
|
||||
double * aux2 = new double [num_epoch];
|
||||
unsigned int * PRN = new unsigned int [num_epoch];
|
||||
float *abs_E = new float[num_epoch];
|
||||
float *abs_P = new float[num_epoch];
|
||||
float *abs_L = new float[num_epoch];
|
||||
float *Prompt_I = new float[num_epoch];
|
||||
float *Prompt_Q = new float[num_epoch];
|
||||
unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch];
|
||||
double *acc_carrier_phase_rad = new double[num_epoch];
|
||||
double *carrier_doppler_hz = new double[num_epoch];
|
||||
double *code_freq_chips = new double[num_epoch];
|
||||
double *carr_error_hz = new double[num_epoch];
|
||||
double *carr_error_filt_hz = new double[num_epoch];
|
||||
double *code_error_chips = new double[num_epoch];
|
||||
double *code_error_filt_chips = new double[num_epoch];
|
||||
double *CN0_SNV_dB_Hz = new double[num_epoch];
|
||||
double *carrier_lock_test = new double[num_epoch];
|
||||
double *aux1 = new double[num_epoch];
|
||||
double *aux2 = new double[num_epoch];
|
||||
unsigned int *PRN = new unsigned int[num_epoch];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
if (dump_file.is_open())
|
||||
{
|
||||
for(long int i = 0; i < num_epoch; i++)
|
||||
for (long int i = 0; i < num_epoch; i++)
|
||||
{
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_E[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_P[i]), sizeof(float));
|
||||
@@ -414,10 +411,10 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
}
|
||||
}
|
||||
dump_file.close();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
delete[] abs_E;
|
||||
delete[] abs_P;
|
||||
delete[] abs_L;
|
||||
@@ -437,7 +434,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
delete[] aux2;
|
||||
delete[] PRN;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE MAT FILE
|
||||
mat_t *matfp;
|
||||
@@ -446,79 +443,79 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
filename.erase(filename.length() - 4, 4);
|
||||
filename.append(".mat");
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if(reinterpret_cast<long*>(matfp) != NULL)
|
||||
if (reinterpret_cast<long *>(matfp) != NULL)
|
||||
{
|
||||
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
||||
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
}
|
||||
Mat_Close(matfp);
|
||||
@@ -544,11 +541,11 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
|
||||
}
|
||||
|
||||
|
||||
int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// Block input data and block output stream pointers
|
||||
const lv_16sc_t* in = reinterpret_cast<const lv_16sc_t*>(input_items[0]); //PRN start block alignment
|
||||
const lv_16sc_t *in = reinterpret_cast<const lv_16sc_t *>(input_items[0]); //PRN start block alignment
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||
@@ -573,14 +570,14 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
|
||||
d_sample_counter += samples_offset; // count for the processed samples
|
||||
d_sample_counter += samples_offset; // count for the processed samples
|
||||
d_pull_in = false;
|
||||
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GPS_TWO_PI;
|
||||
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GPS_TWO_PI;
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -595,9 +592,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
|
||||
// ####### coherent intergration extension
|
||||
// keep the last symbols
|
||||
d_E_history.push_back(d_correlator_outs_16sc[0]); // save early output
|
||||
d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output
|
||||
d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output
|
||||
d_E_history.push_back(d_correlator_outs_16sc[0]); // save early output
|
||||
d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output
|
||||
d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output
|
||||
|
||||
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms)
|
||||
{
|
||||
@@ -615,9 +612,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
// compute coherent integration and enable tracking loop
|
||||
// perform coherent integration using correlator output history
|
||||
// std::cout<<"##### RESET COHERENT INTEGRATION ####"<<std::endl;
|
||||
d_correlator_outs_16sc[0] = lv_cmake(0,0);
|
||||
d_correlator_outs_16sc[1] = lv_cmake(0,0);
|
||||
d_correlator_outs_16sc[2] = lv_cmake(0,0);
|
||||
d_correlator_outs_16sc[0] = lv_cmake(0, 0);
|
||||
d_correlator_outs_16sc[1] = lv_cmake(0, 0);
|
||||
d_correlator_outs_16sc[2] = lv_cmake(0, 0);
|
||||
for (int n = 0; n < d_extend_correlation_ms; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[0] += d_E_history.at(n);
|
||||
@@ -628,9 +625,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
if (d_preamble_synchronized == false)
|
||||
{
|
||||
d_code_loop_filter.set_DLL_BW(d_dll_bw_narrow_hz);
|
||||
d_carrier_loop_filter.set_params(10.0, d_pll_bw_narrow_hz,2);
|
||||
d_carrier_loop_filter.set_params(10.0, d_pll_bw_narrow_hz, 2);
|
||||
d_preamble_synchronized = true;
|
||||
std::cout << "Enabled " << d_extend_correlation_ms << " [ms] extended correlator for CH "<< d_channel << " : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
||||
std::cout << "Enabled " << d_extend_correlation_ms << " [ms] extended correlator for CH " << d_channel << " : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
||||
<< " pll_bw = " << d_pll_bw_hz << " [Hz], pll_narrow_bw = " << d_pll_bw_narrow_hz << " [Hz]" << std::endl
|
||||
<< " dll_bw = " << d_dll_bw_hz << " [Hz], dll_narrow_bw = " << d_dll_bw_narrow_hz << " [Hz]" << std::endl;
|
||||
}
|
||||
@@ -640,7 +637,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
}
|
||||
else
|
||||
{
|
||||
if(d_preamble_synchronized == true)
|
||||
if (d_preamble_synchronized == true)
|
||||
{
|
||||
// continue extended coherent correlation
|
||||
// Compute the next buffer length based on the period of the PRN sequence and the code phase error estimation
|
||||
@@ -651,7 +648,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
|
||||
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples;
|
||||
// code phase step (Code resampler phase increment per sample) [chips/sample]
|
||||
@@ -687,7 +684,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
{
|
||||
// ################## PLL ##########################################################
|
||||
// Update PLL discriminator [rads/Ti -> Secs/Ti]
|
||||
d_carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(std::complex<float>(d_correlator_outs_16sc[1].real(),d_correlator_outs_16sc[1].imag())) / GPS_TWO_PI; //prompt output
|
||||
d_carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(std::complex<float>(d_correlator_outs_16sc[1].real(), d_correlator_outs_16sc[1].imag())) / GPS_TWO_PI; //prompt output
|
||||
|
||||
// Carrier discriminator filter
|
||||
// NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan
|
||||
@@ -700,11 +697,11 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
|
||||
// ################## DLL ##########################################################
|
||||
// DLL discriminator
|
||||
d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(std::complex<float>(d_correlator_outs_16sc[0].real(),d_correlator_outs_16sc[0].imag()), std::complex<float>(d_correlator_outs_16sc[2].real(),d_correlator_outs_16sc[2].imag())); // [chips/Ti] //early and late
|
||||
d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(std::complex<float>(d_correlator_outs_16sc[0].real(), d_correlator_outs_16sc[0].imag()), std::complex<float>(d_correlator_outs_16sc[2].real(), d_correlator_outs_16sc[2].imag())); // [chips/Ti] //early and late
|
||||
// Code discriminator filter
|
||||
d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second]
|
||||
d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second]
|
||||
d_code_error_filt_chips_Ti = d_code_error_filt_chips_s * CURRENT_INTEGRATION_TIME_S;
|
||||
code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti]
|
||||
code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti]
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
// keep alignment parameters for the next input buffer
|
||||
@@ -715,12 +712,12 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
double K_prn_samples = round(T_prn_samples);
|
||||
double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
|
||||
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples + code_error_filt_secs_Ti * static_cast<double>(d_fs_in); //(code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti) * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples + code_error_filt_secs_Ti * static_cast<double>(d_fs_in); //(code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti) * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_integer_samples = round(d_rem_code_phase_samples); // round to a discrete number of samples
|
||||
d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples;
|
||||
d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples;
|
||||
|
||||
//################### PLL COMMANDS #################################################
|
||||
//################### PLL COMMANDS #################################################
|
||||
//carrier phase step (NCO phase increment per sample) [rads/sample]
|
||||
d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * d_correlation_length_samples / GPS_TWO_PI;
|
||||
@@ -739,7 +736,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
if (d_cn0_estimation_counter < FLAGS_cn0_samples)
|
||||
{
|
||||
// fill buffer with prompt correlator output values
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = lv_cmake(static_cast<float>(d_correlator_outs_16sc[1].real()), static_cast<float>(d_correlator_outs_16sc[1].imag()) ); // prompt
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = lv_cmake(static_cast<float>(d_correlator_outs_16sc[1].real()), static_cast<float>(d_correlator_outs_16sc[1].imag())); // prompt
|
||||
d_cn0_estimation_counter++;
|
||||
}
|
||||
else
|
||||
@@ -762,9 +759,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3));//3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
@@ -793,7 +790,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples;
|
||||
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
||||
current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles;
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;// todo: project the carrier doppler
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
|
||||
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
||||
}
|
||||
}
|
||||
@@ -801,7 +798,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
{
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0,0);
|
||||
d_correlator_outs_16sc[n] = lv_cmake(0, 0);
|
||||
}
|
||||
|
||||
current_synchro_data.System = {'G'};
|
||||
@@ -809,7 +806,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
}
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -818,65 +815,67 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
|
||||
double tmp_double;
|
||||
prompt_I = d_correlator_outs_16sc[1].real();
|
||||
prompt_Q = d_correlator_outs_16sc[1].imag();
|
||||
tmp_E = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[0].real(),d_correlator_outs_16sc[0].imag()));
|
||||
tmp_P = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[1].real(),d_correlator_outs_16sc[1].imag()));
|
||||
tmp_L = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[2].real(),d_correlator_outs_16sc[2].imag()));
|
||||
tmp_E = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[0].real(), d_correlator_outs_16sc[0].imag()));
|
||||
tmp_P = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[1].real(), d_correlator_outs_16sc[1].imag()));
|
||||
tmp_L = std::abs<float>(std::complex<float>(d_correlator_outs_16sc[2].real(), d_correlator_outs_16sc[2].imag()));
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
//tmp_float=(float)d_sample_counter;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(double));
|
||||
|
||||
//PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
|
||||
//DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_error_filt_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_error_filt_chips_Ti), sizeof(double));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(double));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_double = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
{
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
|
||||
if (d_enable_tracking)
|
||||
{
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -890,23 +889,23 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
{
|
||||
}
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_sc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void gps_l1_ca_dll_pll_c_aid_tracking_sc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -53,27 +53,25 @@
|
||||
class gps_l1_ca_dll_pll_c_aid_tracking_sc;
|
||||
|
||||
typedef boost::shared_ptr<gps_l1_ca_dll_pll_c_aid_tracking_sc>
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr;
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr;
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr
|
||||
gps_l1_ca_dll_pll_c_aid_make_tracking_sc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class gps_l1_ca_dll_pll_c_aid_tracking_sc: public gr::block
|
||||
class gps_l1_ca_dll_pll_c_aid_tracking_sc : public gr::block
|
||||
{
|
||||
public:
|
||||
~gps_l1_ca_dll_pll_c_aid_tracking_sc();
|
||||
@@ -82,36 +80,34 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr
|
||||
gps_l1_ca_dll_pll_c_aid_make_tracking_sc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
gps_l1_ca_dll_pll_c_aid_tracking_sc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float pll_bw_narrow_hz,
|
||||
float dll_bw_narrow_hz,
|
||||
int extend_correlation_ms,
|
||||
float early_late_space_chips);
|
||||
|
||||
// tracking configuration vars
|
||||
unsigned int d_vector_length;
|
||||
@@ -204,4 +200,4 @@ private:
|
||||
int save_matfile();
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_SC_H
|
||||
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_SC_H
|
||||
|
||||
@@ -56,43 +56,40 @@ using google::LogMessage;
|
||||
|
||||
gps_l1_ca_dll_pll_tracking_cc_sptr
|
||||
gps_l1_ca_dll_pll_make_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips)
|
||||
{
|
||||
return gps_l1_ca_dll_pll_tracking_cc_sptr(new Gps_L1_Ca_Dll_Pll_Tracking_cc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Gps_L1_Ca_Dll_Pll_Tracking_cc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void Gps_L1_Ca_Dll_Pll_Tracking_cc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips) :
|
||||
gr::block("Gps_L1_Ca_Dll_Pll_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips) : gr::block("Gps_L1_Ca_Dll_Pll_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
@@ -112,22 +109,22 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc(
|
||||
d_carrier_loop_filter.set_PLL_BW(pll_bw_hz);
|
||||
|
||||
//--- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<float*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<float *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -187,7 +184,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
|
||||
long int acq_trk_diff_samples;
|
||||
double acq_trk_diff_seconds;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
DLOG(INFO) << "Number of samples between Acquisition and Tracking = " << acq_trk_diff_samples;
|
||||
acq_trk_diff_seconds = static_cast<float>(acq_trk_diff_samples) / static_cast<float>(d_fs_in);
|
||||
// Doppler effect
|
||||
@@ -199,7 +196,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
double T_prn_mod_samples;
|
||||
d_code_freq_chips = radial_velocity * GPS_L1_CA_CODE_RATE_HZ;
|
||||
d_code_phase_step_chips = static_cast<double>(d_code_freq_chips) / static_cast<double>(d_fs_in);
|
||||
T_chip_mod_seconds = 1/d_code_freq_chips;
|
||||
T_chip_mod_seconds = 1 / d_code_freq_chips;
|
||||
T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
T_prn_mod_samples = T_prn_mod_seconds * static_cast<double>(d_fs_in);
|
||||
|
||||
@@ -223,8 +220,8 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter.initialize(); // initialize the carrier filter
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
d_carrier_loop_filter.initialize(); // initialize the carrier filter
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
gps_l1_ca_code_gen_float(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
|
||||
@@ -232,7 +229,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -244,7 +241,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
d_code_phase_samples = d_acq_code_phase_samples;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -255,8 +252,8 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
d_enable_tracking = true;
|
||||
|
||||
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||
}
|
||||
|
||||
|
||||
@@ -267,18 +264,18 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
int number_of_double_vars = 11;
|
||||
int number_of_float_vars = 5;
|
||||
int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
std::ifstream dump_file;
|
||||
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
try
|
||||
{
|
||||
{
|
||||
dump_file.open(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
}
|
||||
catch(const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// count number of epochs and rewind
|
||||
long int num_epoch = 0;
|
||||
if (dump_file.is_open())
|
||||
@@ -291,30 +288,30 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
float * abs_E = new float [num_epoch];
|
||||
float * abs_P = new float [num_epoch];
|
||||
float * abs_L = new float [num_epoch];
|
||||
float * Prompt_I = new float [num_epoch];
|
||||
float * Prompt_Q = new float [num_epoch];
|
||||
unsigned long int * PRN_start_sample_count = new unsigned long int [num_epoch];
|
||||
double * acc_carrier_phase_rad = new double [num_epoch];
|
||||
double * carrier_doppler_hz = new double [num_epoch];
|
||||
double * code_freq_chips = new double [num_epoch];
|
||||
double * carr_error_hz = new double [num_epoch];
|
||||
double * carr_error_filt_hz = new double [num_epoch];
|
||||
double * code_error_chips = new double [num_epoch];
|
||||
double * code_error_filt_chips = new double [num_epoch];
|
||||
double * CN0_SNV_dB_Hz = new double [num_epoch];
|
||||
double * carrier_lock_test = new double [num_epoch];
|
||||
double * aux1 = new double [num_epoch];
|
||||
double * aux2 = new double [num_epoch];
|
||||
unsigned int * PRN = new unsigned int [num_epoch];
|
||||
float *abs_E = new float[num_epoch];
|
||||
float *abs_P = new float[num_epoch];
|
||||
float *abs_L = new float[num_epoch];
|
||||
float *Prompt_I = new float[num_epoch];
|
||||
float *Prompt_Q = new float[num_epoch];
|
||||
unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch];
|
||||
double *acc_carrier_phase_rad = new double[num_epoch];
|
||||
double *carrier_doppler_hz = new double[num_epoch];
|
||||
double *code_freq_chips = new double[num_epoch];
|
||||
double *carr_error_hz = new double[num_epoch];
|
||||
double *carr_error_filt_hz = new double[num_epoch];
|
||||
double *code_error_chips = new double[num_epoch];
|
||||
double *code_error_filt_chips = new double[num_epoch];
|
||||
double *CN0_SNV_dB_Hz = new double[num_epoch];
|
||||
double *carrier_lock_test = new double[num_epoch];
|
||||
double *aux1 = new double[num_epoch];
|
||||
double *aux2 = new double[num_epoch];
|
||||
unsigned int *PRN = new unsigned int[num_epoch];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
if (dump_file.is_open())
|
||||
{
|
||||
for(long int i = 0; i < num_epoch; i++)
|
||||
for (long int i = 0; i < num_epoch; i++)
|
||||
{
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_E[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_P[i]), sizeof(float));
|
||||
@@ -337,10 +334,10 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
}
|
||||
}
|
||||
dump_file.close();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
delete[] abs_E;
|
||||
delete[] abs_P;
|
||||
delete[] abs_L;
|
||||
@@ -360,7 +357,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
delete[] aux2;
|
||||
delete[] PRN;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE MAT FILE
|
||||
mat_t *matfp;
|
||||
@@ -369,79 +366,79 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
|
||||
filename.erase(filename.length() - 4, 4);
|
||||
filename.append(".mat");
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if(reinterpret_cast<long*>(matfp) != NULL)
|
||||
if (reinterpret_cast<long *>(matfp) != NULL)
|
||||
{
|
||||
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
||||
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
}
|
||||
Mat_Close(matfp);
|
||||
@@ -472,47 +469,45 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Pll_Tracking_cc()
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << "Writing .mat files ...";
|
||||
}
|
||||
Gps_L1_Ca_Dll_Pll_Tracking_cc::save_matfile();
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << " done." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
delete[] d_Prompt_buffer;
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
gr::thread::scoped_lock lk(d_setlock);
|
||||
// process vars
|
||||
@@ -522,7 +517,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
double code_error_filt_chips = 0.0;
|
||||
|
||||
// Block input data and block output stream pointers
|
||||
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||
@@ -542,7 +537,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples));
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
|
||||
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples
|
||||
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples
|
||||
d_pull_in = false;
|
||||
// take into account the carrier cycles accumulated in the pull in signal alignment
|
||||
d_acc_carrier_phase_rad -= d_carrier_phase_step_rad * samples_offset;
|
||||
@@ -550,7 +545,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
current_synchro_data.correlation_length_ms = 1;
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -558,15 +553,15 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_current_prn_length_samples);
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_current_prn_length_samples);
|
||||
|
||||
// ################## PLL ##########################################################
|
||||
// PLL discriminator
|
||||
// Update PLL discriminator [rads/Ti -> Secs/Ti]
|
||||
carr_error_hz = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_TWO_PI; // prompt output
|
||||
carr_error_hz = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_TWO_PI; // prompt output
|
||||
// Carrier discriminator filter
|
||||
carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz);
|
||||
// New carrier Doppler frequency estimation
|
||||
@@ -576,12 +571,12 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
|
||||
// ################## DLL ##########################################################
|
||||
// DLL discriminator
|
||||
code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti] //early and late
|
||||
code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti] //early and late
|
||||
// Code discriminator filter
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); // [chips/second]
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); // [chips/second]
|
||||
double T_chip_seconds = 1.0 / static_cast<double>(d_code_freq_chips);
|
||||
double T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips*T_chip_seconds); //[seconds]
|
||||
double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips * T_chip_seconds); //[seconds]
|
||||
//double code_error_filt_secs = (GPS_L1_CA_CODE_PERIOD * code_error_filt_chips) / GPS_L1_CA_CODE_RATE_HZ; // [seconds]
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
@@ -591,7 +586,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
//double T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
|
||||
double K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast<double>(d_fs_in);
|
||||
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
|
||||
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
|
||||
|
||||
//################### PLL COMMANDS #################################################
|
||||
// carrier phase step (NCO phase increment per sample) [rads/sample]
|
||||
@@ -606,14 +601,14 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
// code phase step (Code resampler phase increment per sample) [chips/sample]
|
||||
d_code_phase_step_chips = d_code_freq_chips / static_cast<double>(d_fs_in);
|
||||
// remnant code phase [chips]
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; // rounding error < 1 sample
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; // rounding error < 1 sample
|
||||
d_rem_code_phase_chips = d_code_freq_chips * (d_rem_code_phase_samples / static_cast<double>(d_fs_in));
|
||||
|
||||
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
|
||||
if (d_cn0_estimation_counter < FLAGS_cn0_samples)
|
||||
{
|
||||
// fill buffer with prompt correlator output values
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; //prompt
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; //prompt
|
||||
d_cn0_estimation_counter++;
|
||||
}
|
||||
else
|
||||
@@ -636,9 +631,9 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); // 3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); // 3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
@@ -656,7 +651,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
{
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples;
|
||||
@@ -667,7 +662,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
//assign the GNURadio block output data
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -681,61 +676,66 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
|
||||
tmp_P = std::abs<float>(d_correlator_outs[1]);
|
||||
tmp_L = std::abs<float>(d_correlator_outs[2]);
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
tmp_long = d_sample_counter + d_current_prn_length_samples;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_long), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_long), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_rad), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_rad), sizeof(double));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(double));
|
||||
|
||||
// PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&carr_error_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&carr_error_filt_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&carr_error_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&carr_error_filt_hz), sizeof(double));
|
||||
|
||||
// DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_filt_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_filt_chips), sizeof(double));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(double));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_double = d_rem_code_phase_samples;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(d_sample_counter);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_current_prn_length_samples; // count for the processed samples
|
||||
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_current_prn_length_samples; // count for the processed samples
|
||||
|
||||
if(current_synchro_data.Flag_valid_symbol_output) { return 1; }
|
||||
else { return 0; }
|
||||
if (current_synchro_data.Flag_valid_symbol_output)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
@@ -746,23 +746,23 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -50,24 +50,22 @@
|
||||
class Gps_L1_Ca_Dll_Pll_Tracking_cc;
|
||||
|
||||
typedef boost::shared_ptr<Gps_L1_Ca_Dll_Pll_Tracking_cc>
|
||||
gps_l1_ca_dll_pll_tracking_cc_sptr;
|
||||
gps_l1_ca_dll_pll_tracking_cc_sptr;
|
||||
|
||||
gps_l1_ca_dll_pll_tracking_cc_sptr
|
||||
gps_l1_ca_dll_pll_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class Gps_L1_Ca_Dll_Pll_Tracking_cc: public gr::block
|
||||
class Gps_L1_Ca_Dll_Pll_Tracking_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~Gps_L1_Ca_Dll_Pll_Tracking_cc();
|
||||
@@ -76,30 +74,28 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend gps_l1_ca_dll_pll_tracking_cc_sptr
|
||||
gps_l1_ca_dll_pll_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
Gps_L1_Ca_Dll_Pll_Tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
int save_matfile();
|
||||
// tracking configuration vars
|
||||
@@ -168,4 +164,4 @@ private:
|
||||
std::string sys;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_CC_H
|
||||
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_CC_H
|
||||
|
||||
@@ -50,43 +50,40 @@ using google::LogMessage;
|
||||
|
||||
gps_l1_ca_dll_pll_tracking_gpu_cc_sptr
|
||||
gps_l1_ca_dll_pll_make_tracking_gpu_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips)
|
||||
{
|
||||
return gps_l1_ca_dll_pll_tracking_gpu_cc_sptr(new Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips) :
|
||||
gr::block("Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips) : gr::block("Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
@@ -101,26 +98,26 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(
|
||||
|
||||
// Initialize tracking ==========================================
|
||||
d_code_loop_filter.set_DLL_BW(dll_bw_hz);
|
||||
d_carrier_loop_filter.set_params(10.0, pll_bw_hz,2);
|
||||
d_carrier_loop_filter.set_params(10.0, pll_bw_hz, 2);
|
||||
|
||||
//--- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
// Set GPU flags
|
||||
cudaSetDeviceFlags(cudaDeviceMapHost);
|
||||
//allocate host memory
|
||||
//pinned memory mode - use special function to get OS-pinned memory
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
cudaHostAlloc((void**)&d_ca_code, (static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS)* sizeof(gr_complex)), cudaHostAllocMapped || cudaHostAllocWriteCombined);
|
||||
cudaHostAlloc((void **)&d_ca_code, (static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), cudaHostAllocMapped || cudaHostAllocWriteCombined);
|
||||
// Get space for the resampled early / prompt / late local replicas
|
||||
cudaHostAlloc((void**)&d_local_code_shift_chips, d_n_correlator_taps * sizeof(float), cudaHostAllocMapped || cudaHostAllocWriteCombined);
|
||||
cudaHostAlloc((void**)&in_gpu, 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped || cudaHostAllocWriteCombined);
|
||||
cudaHostAlloc((void **)&d_local_code_shift_chips, d_n_correlator_taps * sizeof(float), cudaHostAllocMapped || cudaHostAllocWriteCombined);
|
||||
cudaHostAlloc((void **)&in_gpu, 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped || cudaHostAllocWriteCombined);
|
||||
// correlator outputs (scalar)
|
||||
cudaHostAlloc((void**)&d_correlator_outs ,sizeof(gr_complex)*d_n_correlator_taps, cudaHostAllocMapped || cudaHostAllocWriteCombined );
|
||||
cudaHostAlloc((void **)&d_correlator_outs, sizeof(gr_complex) * d_n_correlator_taps, cudaHostAllocMapped || cudaHostAllocWriteCombined);
|
||||
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -185,7 +182,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking()
|
||||
|
||||
long int acq_trk_diff_samples;
|
||||
double acq_trk_diff_seconds;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp);//-d_vector_length;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples;
|
||||
acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
|
||||
//doppler effect
|
||||
@@ -197,7 +194,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking()
|
||||
double T_prn_mod_samples;
|
||||
d_code_freq_chips = radial_velocity * GPS_L1_CA_CODE_RATE_HZ;
|
||||
d_code_phase_step_chips = static_cast<double>(d_code_freq_chips) / static_cast<double>(d_fs_in);
|
||||
T_chip_mod_seconds = 1/d_code_freq_chips;
|
||||
T_chip_mod_seconds = 1 / d_code_freq_chips;
|
||||
T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
T_prn_mod_samples = T_prn_mod_seconds * static_cast<double>(d_fs_in);
|
||||
|
||||
@@ -222,8 +219,8 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking()
|
||||
d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); //The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); //The carrier loop filter implements the Doppler accumulator
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
|
||||
@@ -232,7 +229,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking()
|
||||
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -244,7 +241,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking()
|
||||
d_code_phase_samples = d_acq_code_phase_samples;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -265,35 +262,36 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::~Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc()
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
try{
|
||||
try
|
||||
{
|
||||
cudaFreeHost(in_gpu);
|
||||
cudaFreeHost(d_correlator_outs);
|
||||
cudaFreeHost(d_local_code_shift_chips);
|
||||
cudaFreeHost(d_ca_code);
|
||||
delete[] d_Prompt_buffer;
|
||||
multicorrelator_gpu->free_cuda();
|
||||
delete(multicorrelator_gpu);
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
delete (multicorrelator_gpu);
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// Block input data and block output stream pointers
|
||||
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||
@@ -325,9 +323,9 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
current_synchro_data.correlation_length_ms = 1;
|
||||
*out[0] = current_synchro_data;
|
||||
d_sample_counter += samples_offset; //count for the processed samples
|
||||
d_sample_counter += samples_offset; //count for the processed samples
|
||||
d_pull_in = false;
|
||||
consume_each(samples_offset); //shift input to perform alignment with local replica
|
||||
consume_each(samples_offset); //shift input to perform alignment with local replica
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -336,11 +334,11 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
|
||||
|
||||
memcpy(in_gpu, in, sizeof(gr_complex) * d_correlation_length_samples);
|
||||
cudaProfilerStart();
|
||||
multicorrelator_gpu->Carrier_wipeoff_multicorrelator_resampler_cuda( static_cast<float>(d_rem_carrier_phase_rad),
|
||||
static_cast<float>(d_carrier_phase_step_rad),
|
||||
static_cast<float>(d_code_phase_step_chips),
|
||||
static_cast<float>(d_rem_code_phase_chips),
|
||||
d_correlation_length_samples, d_n_correlator_taps);
|
||||
multicorrelator_gpu->Carrier_wipeoff_multicorrelator_resampler_cuda(static_cast<float>(d_rem_carrier_phase_rad),
|
||||
static_cast<float>(d_carrier_phase_step_rad),
|
||||
static_cast<float>(d_code_phase_step_chips),
|
||||
static_cast<float>(d_rem_code_phase_chips),
|
||||
d_correlation_length_samples, d_n_correlator_taps);
|
||||
cudaProfilerStop();
|
||||
//std::cout<<"c_out[0]="<<d_correlator_outs[0]<<"c_out[1]="<<d_correlator_outs[1]<<"c_out[2]="<<d_correlator_outs[2]<<std::endl;
|
||||
|
||||
@@ -349,7 +347,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
|
||||
|
||||
// ################## PLL ##########################################################
|
||||
// Update PLL discriminator [rads/Ti -> Secs/Ti]
|
||||
carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_TWO_PI; //prompt output
|
||||
carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_TWO_PI; //prompt output
|
||||
// Carrier discriminator filter
|
||||
// NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan
|
||||
//d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_phase_error_filt_secs_ti/INTEGRATION_TIME;
|
||||
@@ -362,13 +360,13 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
|
||||
|
||||
// ################## DLL ##########################################################
|
||||
// DLL discriminator
|
||||
code_error_chips_Ti = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); //[chips/Ti] //early and late
|
||||
code_error_chips_Ti = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); //[chips/Ti] //early and late
|
||||
// Code discriminator filter
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips_Ti); //input [chips/Ti] -> output [chips/second]
|
||||
code_error_filt_secs_Ti = code_error_filt_chips*CURRENT_INTEGRATION_TIME_S/d_code_freq_chips; // [s/Ti]
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips_Ti); //input [chips/Ti] -> output [chips/second]
|
||||
code_error_filt_secs_Ti = code_error_filt_chips * CURRENT_INTEGRATION_TIME_S / d_code_freq_chips; // [s/Ti]
|
||||
// DLL code error estimation [s/Ti]
|
||||
// TODO: PLL carrier aid to DLL is disabled. Re-enable it and measure performance
|
||||
dll_code_error_secs_Ti = - code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti;
|
||||
dll_code_error_secs_Ti = -code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti;
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
// keep alignment parameters for the next input buffer
|
||||
@@ -382,12 +380,12 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
|
||||
T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
|
||||
K_blk_samples = T_prn_samples + d_rem_code_phase_samples - dll_code_error_secs_Ti * static_cast<double>(d_fs_in);
|
||||
|
||||
d_correlation_length_samples = round(K_blk_samples); //round to a discrete samples
|
||||
old_d_rem_code_phase_samples=d_rem_code_phase_samples;
|
||||
d_rem_code_phase_samples = K_blk_samples - static_cast<double>(d_correlation_length_samples); //rounding error < 1 sample
|
||||
d_correlation_length_samples = round(K_blk_samples); //round to a discrete samples
|
||||
old_d_rem_code_phase_samples = d_rem_code_phase_samples;
|
||||
d_rem_code_phase_samples = K_blk_samples - static_cast<double>(d_correlation_length_samples); //rounding error < 1 sample
|
||||
|
||||
// UPDATE REMNANT CARRIER PHASE
|
||||
CORRECTED_INTEGRATION_TIME_S = (static_cast<double>(d_correlation_length_samples)/static_cast<double>(d_fs_in));
|
||||
CORRECTED_INTEGRATION_TIME_S = (static_cast<double>(d_correlation_length_samples) / static_cast<double>(d_fs_in));
|
||||
//remnant carrier phase [rad]
|
||||
d_rem_carrier_phase_rad = fmod(d_rem_carrier_phase_rad + GPS_TWO_PI * d_carrier_doppler_hz * CORRECTED_INTEGRATION_TIME_S, GPS_TWO_PI);
|
||||
// UPDATE CARRIER PHASE ACCUULATOR
|
||||
@@ -408,7 +406,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
|
||||
if (d_cn0_estimation_counter < FLAGS_cn0_samples)
|
||||
{
|
||||
// fill buffer with prompt correlator output values
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; //prompt
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; //prompt
|
||||
d_cn0_estimation_counter++;
|
||||
}
|
||||
else
|
||||
@@ -431,9 +429,9 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3));//3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,15 +444,13 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
||||
current_synchro_data.Flag_valid_symbol_output = true;
|
||||
current_synchro_data.correlation_length_ms=1;
|
||||
|
||||
current_synchro_data.correlation_length_ms = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
current_synchro_data.System = {'G'};
|
||||
@@ -466,7 +462,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -479,61 +475,63 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
|
||||
tmp_P = std::abs<float>(d_correlator_outs[1]);
|
||||
tmp_L = std::abs<float>(d_correlator_outs[2]);
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
//tmp_float=(float)d_sample_counter;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_cycles), sizeof(double));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(double));
|
||||
|
||||
//PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&carr_phase_error_secs_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
|
||||
//DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_filt_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_chips_Ti), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_filt_chips), sizeof(double));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(double));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_double = d_rem_code_phase_samples;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
{
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_correlation_length_samples; //count for the processed samples
|
||||
|
||||
if (d_enable_tracking)
|
||||
{
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -547,23 +545,23 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||
}
|
||||
catch (const std::ifstream::failure* e)
|
||||
{
|
||||
}
|
||||
catch (const std::ifstream::failure *e)
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -48,56 +48,55 @@
|
||||
class Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc;
|
||||
|
||||
typedef boost::shared_ptr<Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc>
|
||||
gps_l1_ca_dll_pll_tracking_gpu_cc_sptr;
|
||||
gps_l1_ca_dll_pll_tracking_gpu_cc_sptr;
|
||||
|
||||
gps_l1_ca_dll_pll_tracking_gpu_cc_sptr
|
||||
gps_l1_ca_dll_pll_make_tracking_gpu_cc(long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc: public gr::block
|
||||
class Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc();
|
||||
|
||||
void set_channel(unsigned int channel);
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||
|
||||
private:
|
||||
friend gps_l1_ca_dll_pll_tracking_gpu_cc_sptr
|
||||
gps_l1_ca_dll_pll_make_tracking_gpu_cc(long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
void update_local_code();
|
||||
void update_local_carrier();
|
||||
|
||||
@@ -105,7 +104,7 @@ private:
|
||||
unsigned int d_vector_length;
|
||||
bool d_dump;
|
||||
|
||||
Gnss_Synchro* d_acquisition_gnss_synchro;
|
||||
Gnss_Synchro *d_acquisition_gnss_synchro;
|
||||
unsigned int d_channel;
|
||||
|
||||
long d_if_freq;
|
||||
@@ -116,11 +115,11 @@ private:
|
||||
|
||||
|
||||
//GPU HOST PINNED MEMORY IN/OUT VECTORS
|
||||
gr_complex* in_gpu;
|
||||
float* d_local_code_shift_chips;
|
||||
gr_complex* d_correlator_outs;
|
||||
gr_complex *in_gpu;
|
||||
float *d_local_code_shift_chips;
|
||||
gr_complex *d_correlator_outs;
|
||||
cuda_multicorrelator *multicorrelator_gpu;
|
||||
gr_complex* d_ca_code;
|
||||
gr_complex *d_ca_code;
|
||||
|
||||
gr_complex *d_Early;
|
||||
gr_complex *d_Prompt;
|
||||
@@ -158,7 +157,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int d_cn0_estimation_counter;
|
||||
gr_complex* d_Prompt_buffer;
|
||||
gr_complex *d_Prompt_buffer;
|
||||
double d_carrier_lock_test;
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
@@ -176,4 +175,4 @@ private:
|
||||
std::string sys;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_GPU_CC_H
|
||||
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_GPU_CC_H
|
||||
|
||||
@@ -58,41 +58,38 @@ using google::LogMessage;
|
||||
|
||||
gps_l1_ca_tcp_connector_tracking_cc_sptr
|
||||
gps_l1_ca_tcp_connector_make_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float early_late_space_chips,
|
||||
size_t port_ch0)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float early_late_space_chips,
|
||||
size_t port_ch0)
|
||||
{
|
||||
return gps_l1_ca_tcp_connector_tracking_cc_sptr(new Gps_L1_Ca_Tcp_Connector_Tracking_cc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, early_late_space_chips, port_ch0));
|
||||
fs_in, vector_length, dump, dump_filename, early_late_space_chips, port_ch0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float early_late_space_chips,
|
||||
size_t port_ch0) :
|
||||
gr::block("Gps_L1_Ca_Tcp_Connector_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float early_late_space_chips,
|
||||
size_t port_ch0) : gr::block("Gps_L1_Ca_Tcp_Connector_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
@@ -105,7 +102,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
|
||||
d_dump_filename = dump_filename;
|
||||
|
||||
//--- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
//--- TCP CONNECTOR variables --------------------------------------------------------
|
||||
d_port_ch0 = port_ch0;
|
||||
@@ -115,23 +112,23 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex*>(volk_gnsssdr_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Very-Early, Early, Prompt, Late, Very-Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_n_correlator_taps = 3; // Very-Early, Early, Prompt, Late, Very-Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
}
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
// map memory pointers of correlator outputs
|
||||
d_Early = &d_correlator_outs[0];
|
||||
d_Prompt = &d_correlator_outs[1];
|
||||
d_Late = &d_correlator_outs[2];
|
||||
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -192,24 +189,24 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
|
||||
|
||||
d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples;
|
||||
d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz;
|
||||
d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples;
|
||||
d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples;
|
||||
|
||||
long int acq_trk_diff_samples;
|
||||
float acq_trk_diff_seconds;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp);
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp);
|
||||
std::cout << "acq_trk_diff_samples=" << acq_trk_diff_samples << std::endl;
|
||||
acq_trk_diff_seconds = static_cast<float>(acq_trk_diff_samples) / static_cast<float>(d_fs_in);
|
||||
//doppler effect
|
||||
// Fd=(C/(C+Vr))*F
|
||||
float radial_velocity;
|
||||
radial_velocity = (GPS_L1_FREQ_HZ + d_acq_carrier_doppler_hz)/GPS_L1_FREQ_HZ;
|
||||
radial_velocity = (GPS_L1_FREQ_HZ + d_acq_carrier_doppler_hz) / GPS_L1_FREQ_HZ;
|
||||
// new chip and prn sequence periods based on acq Doppler
|
||||
float T_chip_mod_seconds;
|
||||
float T_prn_mod_seconds;
|
||||
float T_prn_mod_samples;
|
||||
d_code_freq_hz = radial_velocity * GPS_L1_CA_CODE_RATE_HZ;
|
||||
d_code_phase_step_chips = static_cast<double>(d_code_freq_hz) / static_cast<double>(d_fs_in);
|
||||
T_chip_mod_seconds = 1/d_code_freq_hz;
|
||||
T_chip_mod_seconds = 1 / d_code_freq_hz;
|
||||
T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
T_prn_mod_samples = T_prn_mod_seconds * static_cast<float>(d_fs_in);
|
||||
|
||||
@@ -238,7 +235,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -251,7 +248,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
|
||||
d_code_phase_samples = d_acq_code_phase_samples;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -262,8 +259,8 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
|
||||
d_enable_tracking = true;
|
||||
|
||||
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,32 +269,32 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::~Gps_L1_Ca_Tcp_Connector_Tracking_cc()
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
d_tcp_com.close_tcp_connection(d_port);
|
||||
delete[] d_Prompt_buffer;
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// process vars
|
||||
float carr_error;
|
||||
@@ -310,7 +307,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
|
||||
Gnss_Synchro current_synchro_data = Gnss_Synchro();
|
||||
|
||||
// Block input data and block output stream pointers
|
||||
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
if (d_enable_tracking == true)
|
||||
@@ -334,9 +331,9 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
d_sample_counter_seconds = d_sample_counter_seconds + (static_cast<double>(samples_offset) / static_cast<double>(d_fs_in));
|
||||
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
||||
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
||||
d_pull_in = false;
|
||||
consume_each(samples_offset); //shift input to perform alignement with local replica
|
||||
consume_each(samples_offset); //shift input to perform alignement with local replica
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -347,30 +344,30 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
|
||||
|
||||
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs,in);
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
|
||||
double carr_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
double rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in);
|
||||
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad,
|
||||
carr_phase_step_rad,
|
||||
rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_current_prn_length_samples);
|
||||
carr_phase_step_rad,
|
||||
rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_current_prn_length_samples);
|
||||
|
||||
//! Variable used for control
|
||||
d_control_id++;
|
||||
|
||||
//! Send and receive a TCP packet
|
||||
boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> tx_variables_array = {{d_control_id,
|
||||
(*d_Early).real(),
|
||||
(*d_Early).imag(),
|
||||
(*d_Late).real(),
|
||||
(*d_Late).imag(),
|
||||
(*d_Prompt).real(),
|
||||
(*d_Prompt).imag(),
|
||||
d_acq_carrier_doppler_hz,
|
||||
1}};
|
||||
(*d_Early).real(),
|
||||
(*d_Early).imag(),
|
||||
(*d_Late).real(),
|
||||
(*d_Late).imag(),
|
||||
(*d_Prompt).real(),
|
||||
(*d_Prompt).imag(),
|
||||
d_acq_carrier_doppler_hz,
|
||||
1}};
|
||||
d_tcp_com.send_receive_tcp_packet_gps_l1_ca(tx_variables_array, &tcp_data);
|
||||
|
||||
//! Recover the tracking data
|
||||
@@ -379,12 +376,12 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
|
||||
// Modify carrier freq based on NCO command
|
||||
d_carrier_doppler_hz = tcp_data.proc_pack_carrier_doppler_hz;
|
||||
// Modify code freq based on NCO command
|
||||
code_nco = 1/(1/GPS_L1_CA_CODE_RATE_HZ - code_error/GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||
code_nco = 1 / (1 / GPS_L1_CA_CODE_RATE_HZ - code_error / GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||
d_code_freq_hz = code_nco;
|
||||
|
||||
// Update the phasestep based on code freq (variable) and
|
||||
// sampling frequency (fixed)
|
||||
d_code_phase_step_chips = d_code_freq_hz / static_cast<float>(d_fs_in); //[chips]
|
||||
d_code_phase_step_chips = d_code_freq_hz / static_cast<float>(d_fs_in); //[chips]
|
||||
// variable code PRN sample block size
|
||||
double T_chip_seconds;
|
||||
double T_prn_seconds;
|
||||
@@ -394,7 +391,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
|
||||
T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
|
||||
d_rem_code_phase_samples = d_next_rem_code_phase_samples;
|
||||
K_blk_samples = T_prn_samples + d_rem_code_phase_samples;//-code_error*(double)d_fs_in;
|
||||
K_blk_samples = T_prn_samples + d_rem_code_phase_samples; //-code_error*(double)d_fs_in;
|
||||
|
||||
// Update the current PRN delay (code phase in samples)
|
||||
double T_prn_true_seconds = GPS_L1_CA_CODE_LENGTH_CHIPS / GPS_L1_CA_CODE_RATE_HZ;
|
||||
@@ -406,8 +403,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
|
||||
}
|
||||
|
||||
d_code_phase_samples = fmod(d_code_phase_samples, T_prn_true_samples);
|
||||
d_next_prn_length_samples = round(K_blk_samples); //round to a discrete samples
|
||||
d_next_rem_code_phase_samples = K_blk_samples - d_next_prn_length_samples; //rounding error
|
||||
d_next_prn_length_samples = round(K_blk_samples); //round to a discrete samples
|
||||
d_next_rem_code_phase_samples = K_blk_samples - d_next_prn_length_samples; //rounding error
|
||||
|
||||
/*!
|
||||
* \todo Improve the lock detection algorithm!
|
||||
@@ -438,10 +435,9 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3));//3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,38 +446,37 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
|
||||
current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt).real());
|
||||
current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt).imag());
|
||||
//compute remnant code phase samples AFTER the Tracking timestamp
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples;
|
||||
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
||||
current_synchro_data.Carrier_phase_rads = static_cast<double>(d_acc_carrier_phase_rad);
|
||||
current_synchro_data.Carrier_Doppler_hz = static_cast<double>(d_carrier_doppler_hz);
|
||||
current_synchro_data.CN0_dB_hz = static_cast<double>(d_CN0_SNV_dB_Hz);
|
||||
current_synchro_data.Flag_valid_symbol_output = true;
|
||||
current_synchro_data.correlation_length_ms=1;
|
||||
current_synchro_data.correlation_length_ms = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
*d_Early = gr_complex(0,0);
|
||||
*d_Prompt = gr_complex(0,0);
|
||||
*d_Late = gr_complex(0,0);
|
||||
*d_Early = gr_complex(0, 0);
|
||||
*d_Prompt = gr_complex(0, 0);
|
||||
*d_Late = gr_complex(0, 0);
|
||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples;
|
||||
//! When tracking is disabled an array of 1's is sent to maintain the TCP connection
|
||||
boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> tx_variables_array = {{1,1,1,1,1,1,1,1,0}};
|
||||
boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> tx_variables_array = {{1, 1, 1, 1, 1, 1, 1, 1, 0}};
|
||||
d_tcp_com.send_receive_tcp_packet_gps_l1_ca(tx_variables_array, &tcp_data);
|
||||
}
|
||||
|
||||
//assign the GNURadio block output data
|
||||
current_synchro_data.System = {'G'};
|
||||
std::string str_aux = "1C";
|
||||
const char * str = str_aux.c_str(); // get a C style null terminated string
|
||||
std::memcpy(static_cast<void*>(current_synchro_data.Signal), str, 3);
|
||||
const char *str = str_aux.c_str(); // get a C style null terminated string
|
||||
std::memcpy(static_cast<void *>(current_synchro_data.Signal), str, 3);
|
||||
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -494,65 +489,66 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
|
||||
tmp_P = std::abs<float>(*d_Prompt);
|
||||
tmp_L = std::abs<float>(*d_Late);
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
//tmp_float=(float)d_sample_counter;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_rad), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_rad), sizeof(float));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_hz), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_hz), sizeof(float));
|
||||
|
||||
//PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&carr_error), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&carr_nco), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&carr_error), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&carr_nco), sizeof(float));
|
||||
|
||||
//DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_nco), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_nco), sizeof(float));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(float));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_float = 0;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_float), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter_seconds), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter_seconds), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter_seconds = d_sample_counter_seconds + ( static_cast<double>(d_current_prn_length_samples) / static_cast<double>(d_fs_in) );
|
||||
d_sample_counter += d_current_prn_length_samples; //count for the processed samples
|
||||
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter_seconds = d_sample_counter_seconds + (static_cast<double>(d_current_prn_length_samples) / static_cast<double>(d_fs_in));
|
||||
d_sample_counter += d_current_prn_length_samples; //count for the processed samples
|
||||
|
||||
if (d_enable_tracking)
|
||||
{
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
@@ -563,17 +559,17 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,8 +582,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel)
|
||||
}
|
||||
|
||||
|
||||
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
|
||||
}
|
||||
|
||||
@@ -46,31 +46,29 @@
|
||||
#include "tcp_communication.h"
|
||||
|
||||
|
||||
|
||||
class Gps_L1_Ca_Tcp_Connector_Tracking_cc;
|
||||
|
||||
typedef boost::shared_ptr<Gps_L1_Ca_Tcp_Connector_Tracking_cc> gps_l1_ca_tcp_connector_tracking_cc_sptr;
|
||||
|
||||
gps_l1_ca_tcp_connector_tracking_cc_sptr
|
||||
gps_l1_ca_tcp_connector_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class Gps_L1_Ca_Tcp_Connector_Tracking_cc: public gr::block
|
||||
class Gps_L1_Ca_Tcp_Connector_Tracking_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~Gps_L1_Ca_Tcp_Connector_Tracking_cc();
|
||||
|
||||
void set_channel(unsigned int channel);
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
/*
|
||||
@@ -78,33 +76,32 @@ public:
|
||||
*
|
||||
* The user must override work to define the signal processing code
|
||||
*/
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
|
||||
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
private:
|
||||
friend gps_l1_ca_tcp_connector_tracking_cc_sptr
|
||||
gps_l1_ca_tcp_connector_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
|
||||
Gps_L1_Ca_Tcp_Connector_Tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float early_late_space_chips,
|
||||
size_t port_ch0);
|
||||
|
||||
// tracking configuration vars
|
||||
unsigned int d_vector_length;
|
||||
bool d_dump;
|
||||
|
||||
Gnss_Synchro* d_acquisition_gnss_synchro;
|
||||
Gnss_Synchro *d_acquisition_gnss_synchro;
|
||||
unsigned int d_channel;
|
||||
|
||||
long d_if_freq;
|
||||
@@ -115,7 +112,7 @@ private:
|
||||
|
||||
double d_code_phase_step_chips;
|
||||
|
||||
gr_complex* d_ca_code;
|
||||
gr_complex *d_ca_code;
|
||||
|
||||
gr_complex *d_Early;
|
||||
gr_complex *d_Prompt;
|
||||
@@ -130,8 +127,8 @@ private:
|
||||
float d_acq_code_phase_samples;
|
||||
float d_acq_carrier_doppler_hz;
|
||||
// correlator
|
||||
float* d_local_code_shift_chips;
|
||||
gr_complex* d_correlator_outs;
|
||||
float *d_local_code_shift_chips;
|
||||
gr_complex *d_correlator_outs;
|
||||
cpu_multicorrelator multicorrelator_cpu;
|
||||
|
||||
// tracking vars
|
||||
@@ -156,7 +153,7 @@ private:
|
||||
|
||||
// CN0 estimation and lock detector
|
||||
int d_cn0_estimation_counter;
|
||||
gr_complex* d_Prompt_buffer;
|
||||
gr_complex *d_Prompt_buffer;
|
||||
float d_carrier_lock_test;
|
||||
float d_CN0_SNV_dB_Hz;
|
||||
float d_carrier_lock_threshold;
|
||||
@@ -174,4 +171,4 @@ private:
|
||||
std::string sys;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GPS_L1_CA_TCP_CONNECTOR_TRACKING_CC_H
|
||||
#endif //GNSS_SDR_GPS_L1_CA_TCP_CONNECTOR_TRACKING_CC_H
|
||||
|
||||
@@ -55,41 +55,40 @@ using google::LogMessage;
|
||||
|
||||
gps_l2_m_dll_pll_tracking_cc_sptr
|
||||
gps_l2_m_dll_pll_make_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips)
|
||||
{
|
||||
return gps_l2_m_dll_pll_tracking_cc_sptr(new gps_l2_m_dll_pll_tracking_cc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||
}
|
||||
|
||||
|
||||
void gps_l2_m_dll_pll_tracking_cc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void gps_l2_m_dll_pll_tracking_cc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gps_l2_m_dll_pll_tracking_cc::gps_l2_m_dll_pll_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips) :
|
||||
gr::block("gps_l2_m_dll_pll_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips) : gr::block("gps_l2_m_dll_pll_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
@@ -104,30 +103,30 @@ gps_l2_m_dll_pll_tracking_cc::gps_l2_m_dll_pll_tracking_cc(
|
||||
d_current_prn_length_samples = static_cast<int>(d_vector_length);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter=Tracking_2nd_PLL_filter(GPS_L2_M_PERIOD);
|
||||
d_code_loop_filter=Tracking_2nd_DLL_filter(GPS_L2_M_PERIOD);
|
||||
d_carrier_loop_filter = Tracking_2nd_PLL_filter(GPS_L2_M_PERIOD);
|
||||
d_code_loop_filter = Tracking_2nd_DLL_filter(GPS_L2_M_PERIOD);
|
||||
|
||||
// Initialize tracking ==========================================
|
||||
d_code_loop_filter.set_DLL_BW(dll_bw_hz);
|
||||
d_carrier_loop_filter.set_PLL_BW(pll_bw_hz);
|
||||
|
||||
//--- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -188,7 +187,7 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking()
|
||||
|
||||
long int acq_trk_diff_samples;
|
||||
double acq_trk_diff_seconds;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples;
|
||||
acq_trk_diff_seconds = static_cast<float>(acq_trk_diff_samples) / static_cast<float>(d_fs_in);
|
||||
// Doppler effect
|
||||
@@ -200,7 +199,7 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking()
|
||||
double T_prn_mod_samples;
|
||||
d_code_freq_chips = radial_velocity * GPS_L2_M_CODE_RATE_HZ;
|
||||
d_code_phase_step_chips = static_cast<double>(d_code_freq_chips) / static_cast<double>(d_fs_in);
|
||||
T_chip_mod_seconds = 1/d_code_freq_chips;
|
||||
T_chip_mod_seconds = 1 / d_code_freq_chips;
|
||||
T_prn_mod_seconds = T_chip_mod_seconds * GPS_L2_M_CODE_LENGTH_CHIPS;
|
||||
T_prn_mod_samples = T_prn_mod_seconds * static_cast<double>(d_fs_in);
|
||||
|
||||
@@ -224,8 +223,8 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking()
|
||||
d_carrier_phase_step_rad = GPS_L2_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter.initialize(); // initialize the carrier filter
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
d_carrier_loop_filter.initialize(); // initialize the carrier filter
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
gps_l2c_m_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN);
|
||||
@@ -233,7 +232,7 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking()
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GPS_L2_M_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -245,7 +244,7 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking()
|
||||
d_code_phase_samples = d_acq_code_phase_samples;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking of GPS L2CM signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -268,18 +267,18 @@ int gps_l2_m_dll_pll_tracking_cc::save_matfile()
|
||||
int number_of_double_vars = 11;
|
||||
int number_of_float_vars = 5;
|
||||
int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
std::ifstream dump_file;
|
||||
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
try
|
||||
{
|
||||
{
|
||||
dump_file.open(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
}
|
||||
catch(const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// count number of epochs and rewind
|
||||
long int num_epoch = 0;
|
||||
if (dump_file.is_open())
|
||||
@@ -292,30 +291,30 @@ int gps_l2_m_dll_pll_tracking_cc::save_matfile()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
float * abs_E = new float [num_epoch];
|
||||
float * abs_P = new float [num_epoch];
|
||||
float * abs_L = new float [num_epoch];
|
||||
float * Prompt_I = new float [num_epoch];
|
||||
float * Prompt_Q = new float [num_epoch];
|
||||
unsigned long int * PRN_start_sample_count = new unsigned long int [num_epoch];
|
||||
double * acc_carrier_phase_rad = new double [num_epoch];
|
||||
double * carrier_doppler_hz = new double [num_epoch];
|
||||
double * code_freq_chips = new double [num_epoch];
|
||||
double * carr_error_hz = new double [num_epoch];
|
||||
double * carr_error_filt_hz = new double [num_epoch];
|
||||
double * code_error_chips = new double [num_epoch];
|
||||
double * code_error_filt_chips = new double [num_epoch];
|
||||
double * CN0_SNV_dB_Hz = new double [num_epoch];
|
||||
double * carrier_lock_test = new double [num_epoch];
|
||||
double * aux1 = new double [num_epoch];
|
||||
double * aux2 = new double [num_epoch];
|
||||
unsigned int * PRN = new unsigned int [num_epoch];
|
||||
float *abs_E = new float[num_epoch];
|
||||
float *abs_P = new float[num_epoch];
|
||||
float *abs_L = new float[num_epoch];
|
||||
float *Prompt_I = new float[num_epoch];
|
||||
float *Prompt_Q = new float[num_epoch];
|
||||
unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch];
|
||||
double *acc_carrier_phase_rad = new double[num_epoch];
|
||||
double *carrier_doppler_hz = new double[num_epoch];
|
||||
double *code_freq_chips = new double[num_epoch];
|
||||
double *carr_error_hz = new double[num_epoch];
|
||||
double *carr_error_filt_hz = new double[num_epoch];
|
||||
double *code_error_chips = new double[num_epoch];
|
||||
double *code_error_filt_chips = new double[num_epoch];
|
||||
double *CN0_SNV_dB_Hz = new double[num_epoch];
|
||||
double *carrier_lock_test = new double[num_epoch];
|
||||
double *aux1 = new double[num_epoch];
|
||||
double *aux2 = new double[num_epoch];
|
||||
unsigned int *PRN = new unsigned int[num_epoch];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
if (dump_file.is_open())
|
||||
{
|
||||
for(long int i = 0; i < num_epoch; i++)
|
||||
for (long int i = 0; i < num_epoch; i++)
|
||||
{
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_E[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_P[i]), sizeof(float));
|
||||
@@ -338,10 +337,10 @@ int gps_l2_m_dll_pll_tracking_cc::save_matfile()
|
||||
}
|
||||
}
|
||||
dump_file.close();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
delete[] abs_E;
|
||||
delete[] abs_P;
|
||||
delete[] abs_L;
|
||||
@@ -361,7 +360,7 @@ int gps_l2_m_dll_pll_tracking_cc::save_matfile()
|
||||
delete[] aux2;
|
||||
delete[] PRN;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE MAT FILE
|
||||
mat_t *matfp;
|
||||
@@ -370,79 +369,79 @@ int gps_l2_m_dll_pll_tracking_cc::save_matfile()
|
||||
filename.erase(filename.length() - 4, 4);
|
||||
filename.append(".mat");
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if(reinterpret_cast<long*>(matfp) != NULL)
|
||||
if (reinterpret_cast<long *>(matfp) != NULL)
|
||||
{
|
||||
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
||||
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
}
|
||||
Mat_Close(matfp);
|
||||
@@ -473,43 +472,43 @@ gps_l2_m_dll_pll_tracking_cc::~gps_l2_m_dll_pll_tracking_cc()
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << "Writing .mat files ...";
|
||||
}
|
||||
gps_l2_m_dll_pll_tracking_cc::save_matfile();
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << " done." << std::endl;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
delete[] d_Prompt_buffer;
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int gps_l2_m_dll_pll_tracking_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// process vars
|
||||
double carr_error_hz = 0;
|
||||
@@ -521,7 +520,7 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
Gnss_Synchro current_synchro_data = Gnss_Synchro();
|
||||
|
||||
// Block input data and block output stream pointers
|
||||
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
if (d_enable_tracking == true)
|
||||
@@ -538,7 +537,7 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples));
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
|
||||
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples
|
||||
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples
|
||||
d_pull_in = false;
|
||||
// take into account the carrier cycles accumulated in the pull in signal alignment
|
||||
d_acc_carrier_phase_rad -= d_carrier_phase_step_rad * samples_offset;
|
||||
@@ -546,7 +545,7 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
current_synchro_data.correlation_length_ms = 20;
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -554,10 +553,10 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_current_prn_length_samples);
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_current_prn_length_samples);
|
||||
|
||||
// ################## PLL ##########################################################
|
||||
// PLL discriminator
|
||||
@@ -572,12 +571,12 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
|
||||
// ################## DLL ##########################################################
|
||||
// DLL discriminator
|
||||
code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti]
|
||||
code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti]
|
||||
// Code discriminator filter
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second]
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second]
|
||||
double T_chip_seconds = 1.0 / static_cast<double>(d_code_freq_chips);
|
||||
double T_prn_seconds = T_chip_seconds * GPS_L2_M_CODE_LENGTH_CHIPS;
|
||||
double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips*T_chip_seconds); //[seconds]
|
||||
double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips * T_chip_seconds); //[seconds]
|
||||
//double code_error_filt_secs = (GPS_L2_M_PERIOD * code_error_filt_chips) / GPS_L2_M_CODE_RATE_HZ; //[seconds]
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
@@ -585,7 +584,7 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
|
||||
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
|
||||
double K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast<double>(d_fs_in);
|
||||
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
|
||||
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
|
||||
|
||||
//################### PLL COMMANDS #################################################
|
||||
// carrier phase step (NCO phase increment per sample) [rads/sample]
|
||||
@@ -600,7 +599,7 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
// code phase step (Code resampler phase increment per sample) [chips/sample]
|
||||
d_code_phase_step_chips = d_code_freq_chips / static_cast<double>(d_fs_in);
|
||||
// remnant code phase [chips]
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; // rounding error < 1 sample
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; // rounding error < 1 sample
|
||||
d_rem_code_phase_chips = d_code_freq_chips * (d_rem_code_phase_samples / static_cast<double>(d_fs_in));
|
||||
|
||||
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
|
||||
@@ -630,9 +629,9 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3));//3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
@@ -650,7 +649,7 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
{
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples;
|
||||
current_synchro_data.correlation_length_ms = 20;
|
||||
@@ -659,7 +658,7 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -672,55 +671,61 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
|
||||
tmp_P = std::abs<float>(d_correlator_outs[1]);
|
||||
tmp_L = std::abs<float>(d_correlator_outs[2]);
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
//tmp_float=(float)d_sample_counter;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_rad), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_rad), sizeof(double));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(double));
|
||||
|
||||
//PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&carr_error_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&carr_error_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
|
||||
//DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_filt_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_filt_chips), sizeof(double));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(double));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_double = d_rem_code_phase_samples;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(d_sample_counter + d_current_prn_length_samples);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (std::ifstream::failure& e)
|
||||
{
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (std::ifstream::failure &e)
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
consume_each(d_current_prn_length_samples);
|
||||
d_sample_counter += d_current_prn_length_samples;
|
||||
if(current_synchro_data.Flag_valid_symbol_output) { return 1; }
|
||||
else{ return 0; }
|
||||
if (current_synchro_data.Flag_valid_symbol_output)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -734,23 +739,23 @@ void gps_l2_m_dll_pll_tracking_cc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||
}
|
||||
catch (std::ifstream::failure& e)
|
||||
{
|
||||
}
|
||||
catch (std::ifstream::failure &e)
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void gps_l2_m_dll_pll_tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void gps_l2_m_dll_pll_tracking_cc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -48,24 +48,22 @@
|
||||
class gps_l2_m_dll_pll_tracking_cc;
|
||||
|
||||
typedef boost::shared_ptr<gps_l2_m_dll_pll_tracking_cc>
|
||||
gps_l2_m_dll_pll_tracking_cc_sptr;
|
||||
gps_l2_m_dll_pll_tracking_cc_sptr;
|
||||
|
||||
gps_l2_m_dll_pll_tracking_cc_sptr
|
||||
gps_l2_m_dll_pll_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class gps_l2_m_dll_pll_tracking_cc: public gr::block
|
||||
class gps_l2_m_dll_pll_tracking_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~gps_l2_m_dll_pll_tracking_cc();
|
||||
@@ -74,30 +72,28 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend gps_l2_m_dll_pll_tracking_cc_sptr
|
||||
gps_l2_m_dll_pll_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
gps_l2_m_dll_pll_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
// tracking configuration vars
|
||||
unsigned int d_vector_length;
|
||||
@@ -166,4 +162,4 @@ private:
|
||||
int save_matfile();
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GPS_L2_M_DLL_PLL_TRACKING_CC_H
|
||||
#endif //GNSS_SDR_GPS_L2_M_DLL_PLL_TRACKING_CC_H
|
||||
|
||||
@@ -56,41 +56,40 @@ using google::LogMessage;
|
||||
|
||||
gps_l5i_dll_pll_tracking_cc_sptr
|
||||
gps_l5i_dll_pll_make_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips)
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips)
|
||||
{
|
||||
return gps_l5i_dll_pll_tracking_cc_sptr(new gps_l5i_dll_pll_tracking_cc(if_freq,
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||
fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||
}
|
||||
|
||||
|
||||
void gps_l5i_dll_pll_tracking_cc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
void gps_l5i_dll_pll_tracking_cc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if (noutput_items != 0)
|
||||
{
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gps_l5i_dll_pll_tracking_cc::gps_l5i_dll_pll_tracking_cc(
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips) :
|
||||
gr::block("gps_l5i_dll_pll_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips) : gr::block("gps_l5i_dll_pll_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
@@ -105,30 +104,30 @@ gps_l5i_dll_pll_tracking_cc::gps_l5i_dll_pll_tracking_cc(
|
||||
d_current_prn_length_samples = static_cast<int>(d_vector_length);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter=Tracking_2nd_PLL_filter(GPS_L5i_PERIOD);
|
||||
d_code_loop_filter=Tracking_2nd_DLL_filter(GPS_L5i_PERIOD);
|
||||
d_carrier_loop_filter = Tracking_2nd_PLL_filter(GPS_L5i_PERIOD);
|
||||
d_code_loop_filter = Tracking_2nd_DLL_filter(GPS_L5i_PERIOD);
|
||||
|
||||
// Initialize tracking ==========================================
|
||||
d_code_loop_filter.set_DLL_BW(dll_bw_hz);
|
||||
d_carrier_loop_filter.set_PLL_BW(pll_bw_hz);
|
||||
|
||||
//--- DLL variables --------------------------------------------------------
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = static_cast<gr_complex*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L5i_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L5i_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -189,7 +188,7 @@ void gps_l5i_dll_pll_tracking_cc::start_tracking()
|
||||
|
||||
long int acq_trk_diff_samples;
|
||||
double acq_trk_diff_seconds;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp); //-d_vector_length;
|
||||
DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples;
|
||||
acq_trk_diff_seconds = static_cast<float>(acq_trk_diff_samples) / static_cast<float>(d_fs_in);
|
||||
// Doppler effect
|
||||
@@ -201,7 +200,7 @@ void gps_l5i_dll_pll_tracking_cc::start_tracking()
|
||||
double T_prn_mod_samples;
|
||||
d_code_freq_chips = radial_velocity * GPS_L5i_CODE_RATE_HZ;
|
||||
d_code_phase_step_chips = static_cast<double>(d_code_freq_chips) / static_cast<double>(d_fs_in);
|
||||
T_chip_mod_seconds = 1/d_code_freq_chips;
|
||||
T_chip_mod_seconds = 1 / d_code_freq_chips;
|
||||
T_prn_mod_seconds = T_chip_mod_seconds * GPS_L5i_CODE_LENGTH_CHIPS;
|
||||
T_prn_mod_samples = T_prn_mod_seconds * static_cast<double>(d_fs_in);
|
||||
|
||||
@@ -225,8 +224,8 @@ void gps_l5i_dll_pll_tracking_cc::start_tracking()
|
||||
d_carrier_phase_step_rad = GPS_L5_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
||||
|
||||
// DLL/PLL filter initialization
|
||||
d_carrier_loop_filter.initialize(); // initialize the carrier filter
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
d_carrier_loop_filter.initialize(); // initialize the carrier filter
|
||||
d_code_loop_filter.initialize(); // initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
gps_l5i_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN);
|
||||
@@ -234,7 +233,7 @@ void gps_l5i_dll_pll_tracking_cc::start_tracking()
|
||||
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GPS_L5i_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
@@ -246,7 +245,7 @@ void gps_l5i_dll_pll_tracking_cc::start_tracking()
|
||||
d_code_phase_samples = d_acq_code_phase_samples;
|
||||
|
||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||
sys = sys_.substr(0,1);
|
||||
sys = sys_.substr(0, 1);
|
||||
|
||||
// DEBUG OUTPUT
|
||||
std::cout << "Tracking of GPS L5i signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||
@@ -269,18 +268,18 @@ int gps_l5i_dll_pll_tracking_cc::save_matfile()
|
||||
int number_of_double_vars = 11;
|
||||
int number_of_float_vars = 5;
|
||||
int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
std::ifstream dump_file;
|
||||
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
try
|
||||
{
|
||||
{
|
||||
dump_file.open(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
}
|
||||
catch(const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// count number of epochs and rewind
|
||||
long int num_epoch = 0;
|
||||
if (dump_file.is_open())
|
||||
@@ -293,30 +292,30 @@ int gps_l5i_dll_pll_tracking_cc::save_matfile()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
float * abs_E = new float [num_epoch];
|
||||
float * abs_P = new float [num_epoch];
|
||||
float * abs_L = new float [num_epoch];
|
||||
float * Prompt_I = new float [num_epoch];
|
||||
float * Prompt_Q = new float [num_epoch];
|
||||
unsigned long int * PRN_start_sample_count = new unsigned long int [num_epoch];
|
||||
double * acc_carrier_phase_rad = new double [num_epoch];
|
||||
double * carrier_doppler_hz = new double [num_epoch];
|
||||
double * code_freq_chips = new double [num_epoch];
|
||||
double * carr_error_hz = new double [num_epoch];
|
||||
double * carr_error_filt_hz = new double [num_epoch];
|
||||
double * code_error_chips = new double [num_epoch];
|
||||
double * code_error_filt_chips = new double [num_epoch];
|
||||
double * CN0_SNV_dB_Hz = new double [num_epoch];
|
||||
double * carrier_lock_test = new double [num_epoch];
|
||||
double * aux1 = new double [num_epoch];
|
||||
double * aux2 = new double [num_epoch];
|
||||
unsigned int * PRN = new unsigned int [num_epoch];
|
||||
float *abs_E = new float[num_epoch];
|
||||
float *abs_P = new float[num_epoch];
|
||||
float *abs_L = new float[num_epoch];
|
||||
float *Prompt_I = new float[num_epoch];
|
||||
float *Prompt_Q = new float[num_epoch];
|
||||
unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch];
|
||||
double *acc_carrier_phase_rad = new double[num_epoch];
|
||||
double *carrier_doppler_hz = new double[num_epoch];
|
||||
double *code_freq_chips = new double[num_epoch];
|
||||
double *carr_error_hz = new double[num_epoch];
|
||||
double *carr_error_filt_hz = new double[num_epoch];
|
||||
double *code_error_chips = new double[num_epoch];
|
||||
double *code_error_filt_chips = new double[num_epoch];
|
||||
double *CN0_SNV_dB_Hz = new double[num_epoch];
|
||||
double *carrier_lock_test = new double[num_epoch];
|
||||
double *aux1 = new double[num_epoch];
|
||||
double *aux2 = new double[num_epoch];
|
||||
unsigned int *PRN = new unsigned int[num_epoch];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
if (dump_file.is_open())
|
||||
{
|
||||
for(long int i = 0; i < num_epoch; i++)
|
||||
for (long int i = 0; i < num_epoch; i++)
|
||||
{
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_E[i]), sizeof(float));
|
||||
dump_file.read(reinterpret_cast<char *>(&abs_P[i]), sizeof(float));
|
||||
@@ -339,10 +338,10 @@ int gps_l5i_dll_pll_tracking_cc::save_matfile()
|
||||
}
|
||||
}
|
||||
dump_file.close();
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
{
|
||||
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
|
||||
delete[] abs_E;
|
||||
delete[] abs_P;
|
||||
delete[] abs_L;
|
||||
@@ -362,7 +361,7 @@ int gps_l5i_dll_pll_tracking_cc::save_matfile()
|
||||
delete[] aux2;
|
||||
delete[] PRN;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE MAT FILE
|
||||
mat_t *matfp;
|
||||
@@ -371,79 +370,79 @@ int gps_l5i_dll_pll_tracking_cc::save_matfile()
|
||||
filename.erase(filename.length() - 4, 4);
|
||||
filename.append(".mat");
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if(reinterpret_cast<long*>(matfp) != NULL)
|
||||
if (reinterpret_cast<long *>(matfp) != NULL)
|
||||
{
|
||||
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
||||
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
}
|
||||
Mat_Close(matfp);
|
||||
@@ -474,43 +473,43 @@ gps_l5i_dll_pll_tracking_cc::~gps_l5i_dll_pll_tracking_cc()
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << "Writing .mat files ...";
|
||||
}
|
||||
gps_l5i_dll_pll_tracking_cc::save_matfile();
|
||||
if(d_channel == 0)
|
||||
if (d_channel == 0)
|
||||
{
|
||||
std::cout << " done." << std::endl;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
{
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
delete[] d_Prompt_buffer;
|
||||
multicorrelator_cpu.free();
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
int gps_l5i_dll_pll_tracking_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// process vars
|
||||
double carr_error_hz = 0;
|
||||
@@ -522,7 +521,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
Gnss_Synchro current_synchro_data = Gnss_Synchro();
|
||||
|
||||
// Block input data and block output stream pointers
|
||||
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
if (d_enable_tracking == true)
|
||||
@@ -539,7 +538,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples));
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
|
||||
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples
|
||||
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples
|
||||
d_pull_in = false;
|
||||
// take into account the carrier cycles accumulated in the pull in signal alignment
|
||||
d_acc_carrier_phase_rad -= d_carrier_phase_step_rad * samples_offset;
|
||||
@@ -547,7 +546,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
current_synchro_data.correlation_length_ms = 1;
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -555,10 +554,10 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
// perform carrier wipe-off and compute Early, Prompt and Late correlation
|
||||
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
|
||||
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_current_prn_length_samples);
|
||||
d_carrier_phase_step_rad,
|
||||
d_rem_code_phase_chips,
|
||||
d_code_phase_step_chips,
|
||||
d_current_prn_length_samples);
|
||||
|
||||
// ################## PLL ##########################################################
|
||||
// PLL discriminator
|
||||
@@ -573,12 +572,12 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
|
||||
// ################## DLL ##########################################################
|
||||
// DLL discriminator
|
||||
code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti]
|
||||
code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti]
|
||||
// Code discriminator filter
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second]
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second]
|
||||
double T_chip_seconds = 1.0 / static_cast<double>(d_code_freq_chips);
|
||||
double T_prn_seconds = T_chip_seconds * GPS_L5i_CODE_LENGTH_CHIPS;
|
||||
double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips * T_chip_seconds); //[seconds]
|
||||
double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips * T_chip_seconds); //[seconds]
|
||||
//double code_error_filt_secs = (GPS_L5i_PERIOD * code_error_filt_chips) / GPS_L5i_CODE_RATE_HZ; //[seconds]
|
||||
|
||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||
@@ -586,7 +585,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
|
||||
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
|
||||
double K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast<double>(d_fs_in);
|
||||
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
|
||||
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
|
||||
|
||||
//################### PLL COMMANDS #################################################
|
||||
// carrier phase step (NCO phase increment per sample) [rads/sample]
|
||||
@@ -601,7 +600,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
// code phase step (Code resampler phase increment per sample) [chips/sample]
|
||||
d_code_phase_step_chips = d_code_freq_chips / static_cast<double>(d_fs_in);
|
||||
// remnant code phase [chips]
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; // rounding error < 1 sample
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; // rounding error < 1 sample
|
||||
d_rem_code_phase_chips = d_code_freq_chips * (d_rem_code_phase_samples / static_cast<double>(d_fs_in));
|
||||
|
||||
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
|
||||
@@ -631,9 +630,9 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3));//3 -> loss of lock
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); //3 -> loss of lock
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
}
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
@@ -651,7 +650,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
{
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples;
|
||||
current_synchro_data.correlation_length_ms = 1;
|
||||
@@ -660,7 +659,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
current_synchro_data.fs = d_fs_in;
|
||||
*out[0] = current_synchro_data;
|
||||
|
||||
if(d_dump)
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
float prompt_I;
|
||||
@@ -673,55 +672,61 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((
|
||||
tmp_P = std::abs<float>(d_correlator_outs[1]);
|
||||
tmp_L = std::abs<float>(d_correlator_outs[2]);
|
||||
try
|
||||
{
|
||||
{
|
||||
// EPR
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_E), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_P), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_L), sizeof(float));
|
||||
// PROMPT I and Q (to analyze navigation symbols)
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
|
||||
// PRN start sample stamp
|
||||
//tmp_float=(float)d_sample_counter;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_sample_counter), sizeof(unsigned long int));
|
||||
// accumulated carrier phase
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_rad), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_acc_carrier_phase_rad), sizeof(double));
|
||||
|
||||
// carrier and code frequency
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_code_freq_chips), sizeof(double));
|
||||
|
||||
//PLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&carr_error_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&carr_error_hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_doppler_hz), sizeof(double));
|
||||
|
||||
//DLL commands
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&code_error_filt_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_chips), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&code_error_filt_chips), sizeof(double));
|
||||
|
||||
// CN0 and carrier lock test
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_carrier_lock_test), sizeof(double));
|
||||
|
||||
// AUX vars (for debug purposes)
|
||||
tmp_double = d_rem_code_phase_samples;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(d_sample_counter + d_current_prn_length_samples);
|
||||
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
|
||||
// PRN
|
||||
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (std::ifstream::failure& e)
|
||||
{
|
||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int));
|
||||
}
|
||||
catch (std::ifstream::failure &e)
|
||||
{
|
||||
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_current_prn_length_samples; // count for the processed samples
|
||||
if (current_synchro_data.Flag_valid_symbol_output)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
|
||||
d_sample_counter += d_current_prn_length_samples; // count for the processed samples
|
||||
if(current_synchro_data.Flag_valid_symbol_output) { return 1; }
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
|
||||
@@ -735,23 +740,23 @@ void gps_l5i_dll_pll_tracking_cc::set_channel(unsigned int channel)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||
}
|
||||
catch (std::ifstream::failure& e)
|
||||
{
|
||||
}
|
||||
catch (std::ifstream::failure &e)
|
||||
{
|
||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void gps_l5i_dll_pll_tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
void gps_l5i_dll_pll_tracking_cc::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
@@ -48,24 +48,22 @@
|
||||
class gps_l5i_dll_pll_tracking_cc;
|
||||
|
||||
typedef boost::shared_ptr<gps_l5i_dll_pll_tracking_cc>
|
||||
gps_l5i_dll_pll_tracking_cc_sptr;
|
||||
gps_l5i_dll_pll_tracking_cc_sptr;
|
||||
|
||||
gps_l5i_dll_pll_tracking_cc_sptr
|
||||
gps_l5i_dll_pll_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
*/
|
||||
class gps_l5i_dll_pll_tracking_cc: public gr::block
|
||||
class gps_l5i_dll_pll_tracking_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~gps_l5i_dll_pll_tracking_cc();
|
||||
@@ -74,30 +72,28 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void start_tracking();
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
|
||||
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend gps_l5i_dll_pll_tracking_cc_sptr
|
||||
gps_l5i_dll_pll_make_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
gps_l5i_dll_pll_tracking_cc(long if_freq,
|
||||
long fs_in, unsigned
|
||||
int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
long fs_in, unsigned int vector_length,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
float pll_bw_hz,
|
||||
float dll_bw_hz,
|
||||
float early_late_space_chips);
|
||||
|
||||
// tracking configuration vars
|
||||
unsigned int d_vector_length;
|
||||
@@ -166,4 +162,4 @@ private:
|
||||
int save_matfile();
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_GPS_L5i_DLL_PLL_TRACKING_CC_H
|
||||
#endif //GNSS_SDR_GPS_L5i_DLL_PLL_TRACKING_CC_H
|
||||
|
||||
@@ -31,10 +31,10 @@ endif(ENABLE_CUDA)
|
||||
|
||||
|
||||
|
||||
set(TRACKING_LIB_SOURCES
|
||||
set(TRACKING_LIB_SOURCES
|
||||
cpu_multicorrelator.cc
|
||||
cpu_multicorrelator_real_codes.cc
|
||||
cpu_multicorrelator_16sc.cc
|
||||
cpu_multicorrelator_16sc.cc
|
||||
lock_detectors.cc
|
||||
tcp_communication.cc
|
||||
tcp_packet_data.cc
|
||||
@@ -74,11 +74,10 @@ file(GLOB TRACKING_LIB_HEADERS "*.h")
|
||||
list(SORT TRACKING_LIB_HEADERS)
|
||||
add_library(tracking_lib ${TRACKING_LIB_SOURCES} ${TRACKING_LIB_HEADERS})
|
||||
source_group(Headers FILES ${TRACKING_LIB_HEADERS})
|
||||
target_link_libraries(tracking_lib ${OPT_TRACKING_LIBRARIES} ${VOLK_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES})
|
||||
target_link_libraries(tracking_lib ${OPT_TRACKING_LIBRARIES} ${VOLK_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES})
|
||||
|
||||
if(VOLK_GNSSSDR_FOUND)
|
||||
add_dependencies(tracking_lib glog-${glog_RELEASE})
|
||||
else(VOLK_GNSSSDR_FOUND)
|
||||
add_dependencies(tracking_lib glog-${glog_RELEASE} volk_gnsssdr_module)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ cpu_multicorrelator::cpu_multicorrelator()
|
||||
|
||||
cpu_multicorrelator::~cpu_multicorrelator()
|
||||
{
|
||||
if(d_local_codes_resampled != nullptr)
|
||||
if (d_local_codes_resampled != nullptr)
|
||||
{
|
||||
cpu_multicorrelator::free();
|
||||
}
|
||||
@@ -59,8 +59,8 @@ cpu_multicorrelator::~cpu_multicorrelator()
|
||||
|
||||
|
||||
bool cpu_multicorrelator::init(
|
||||
int max_signal_length_samples,
|
||||
int n_correlators)
|
||||
int max_signal_length_samples,
|
||||
int n_correlators)
|
||||
{
|
||||
// ALLOCATE MEMORY FOR INTERNAL vectors
|
||||
size_t size = max_signal_length_samples * sizeof(std::complex<float>);
|
||||
@@ -75,11 +75,10 @@ bool cpu_multicorrelator::init(
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool cpu_multicorrelator::set_local_code_and_taps(
|
||||
int code_length_chips,
|
||||
const std::complex<float>* local_code_in,
|
||||
float *shifts_chips)
|
||||
int code_length_chips,
|
||||
const std::complex<float>* local_code_in,
|
||||
float* shifts_chips)
|
||||
{
|
||||
d_local_code_in = local_code_in;
|
||||
d_shifts_chips = shifts_chips;
|
||||
@@ -100,29 +99,29 @@ bool cpu_multicorrelator::set_input_output_vectors(std::complex<float>* corr_out
|
||||
void cpu_multicorrelator::update_local_code(int correlator_length_samples, float rem_code_phase_chips, float code_phase_step_chips)
|
||||
{
|
||||
volk_gnsssdr_32fc_xn_resampler_32fc_xn(d_local_codes_resampled,
|
||||
d_local_code_in,
|
||||
rem_code_phase_chips,
|
||||
code_phase_step_chips,
|
||||
d_shifts_chips,
|
||||
d_code_length_chips,
|
||||
d_n_correlators,
|
||||
correlator_length_samples);
|
||||
d_local_code_in,
|
||||
rem_code_phase_chips,
|
||||
code_phase_step_chips,
|
||||
d_shifts_chips,
|
||||
d_code_length_chips,
|
||||
d_n_correlators,
|
||||
correlator_length_samples);
|
||||
}
|
||||
|
||||
|
||||
bool cpu_multicorrelator::Carrier_wipeoff_multicorrelator_resampler(
|
||||
float rem_carrier_phase_in_rad,
|
||||
float phase_step_rad,
|
||||
float rem_code_phase_chips,
|
||||
float code_phase_step_chips,
|
||||
int signal_length_samples)
|
||||
float rem_carrier_phase_in_rad,
|
||||
float phase_step_rad,
|
||||
float rem_code_phase_chips,
|
||||
float code_phase_step_chips,
|
||||
int signal_length_samples)
|
||||
{
|
||||
update_local_code(signal_length_samples, rem_code_phase_chips, code_phase_step_chips);
|
||||
// Regenerate phase at each call in order to avoid numerical issues
|
||||
lv_32fc_t phase_offset_as_complex[1];
|
||||
phase_offset_as_complex[0] = lv_cmake(std::cos(rem_carrier_phase_in_rad), -std::sin(rem_carrier_phase_in_rad));
|
||||
// call VOLK_GNSSSDR kernel
|
||||
volk_gnsssdr_32fc_x2_rotator_dot_prod_32fc_xn(d_corr_out, d_sig_in, std::exp(lv_32fc_t(0, - phase_step_rad)), phase_offset_as_complex, const_cast<const lv_32fc_t**>(d_local_codes_resampled), d_n_correlators, signal_length_samples);
|
||||
volk_gnsssdr_32fc_x2_rotator_dot_prod_32fc_xn(d_corr_out, d_sig_in, std::exp(lv_32fc_t(0, -phase_step_rad)), phase_offset_as_complex, const_cast<const lv_32fc_t**>(d_local_codes_resampled), d_n_correlators, signal_length_samples);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -141,4 +140,3 @@ bool cpu_multicorrelator::free()
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ public:
|
||||
cpu_multicorrelator();
|
||||
~cpu_multicorrelator();
|
||||
bool init(int max_signal_length_samples, int n_correlators);
|
||||
bool set_local_code_and_taps(int code_length_chips, const std::complex<float>* local_code_in, float *shifts_chips);
|
||||
bool set_input_output_vectors(std::complex<float>* corr_out, const std::complex<float>* sig_in);
|
||||
bool set_local_code_and_taps(int code_length_chips, const std::complex<float> *local_code_in, float *shifts_chips);
|
||||
bool set_input_output_vectors(std::complex<float> *corr_out, const std::complex<float> *sig_in);
|
||||
void update_local_code(int correlator_length_samples, float rem_code_phase_chips, float code_phase_step_chips);
|
||||
bool Carrier_wipeoff_multicorrelator_resampler(float rem_carrier_phase_in_rad, float phase_step_rad, float rem_code_phase_chips, float code_phase_step_chips, int signal_length_samples);
|
||||
bool free();
|
||||
|
||||
@@ -36,10 +36,9 @@
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
bool cpu_multicorrelator_16sc::init(
|
||||
int max_signal_length_samples,
|
||||
int n_correlators)
|
||||
int max_signal_length_samples,
|
||||
int n_correlators)
|
||||
{
|
||||
// ALLOCATE MEMORY FOR INTERNAL vectors
|
||||
size_t size = max_signal_length_samples * sizeof(lv_16sc_t);
|
||||
@@ -55,11 +54,10 @@ bool cpu_multicorrelator_16sc::init(
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool cpu_multicorrelator_16sc::set_local_code_and_taps(
|
||||
int code_length_chips,
|
||||
const lv_16sc_t* local_code_in,
|
||||
float *shifts_chips)
|
||||
int code_length_chips,
|
||||
const lv_16sc_t* local_code_in,
|
||||
float* shifts_chips)
|
||||
{
|
||||
d_local_code_in = local_code_in;
|
||||
d_shifts_chips = shifts_chips;
|
||||
@@ -80,22 +78,22 @@ bool cpu_multicorrelator_16sc::set_input_output_vectors(lv_16sc_t* corr_out, con
|
||||
void cpu_multicorrelator_16sc::update_local_code(int correlator_length_samples, float rem_code_phase_chips, float code_phase_step_chips)
|
||||
{
|
||||
volk_gnsssdr_16ic_xn_resampler_16ic_xn(d_local_codes_resampled,
|
||||
d_local_code_in,
|
||||
rem_code_phase_chips,
|
||||
code_phase_step_chips,
|
||||
d_shifts_chips,
|
||||
d_code_length_chips,
|
||||
d_n_correlators,
|
||||
correlator_length_samples);
|
||||
d_local_code_in,
|
||||
rem_code_phase_chips,
|
||||
code_phase_step_chips,
|
||||
d_shifts_chips,
|
||||
d_code_length_chips,
|
||||
d_n_correlators,
|
||||
correlator_length_samples);
|
||||
}
|
||||
|
||||
|
||||
bool cpu_multicorrelator_16sc::Carrier_wipeoff_multicorrelator_resampler(
|
||||
float rem_carrier_phase_in_rad,
|
||||
float phase_step_rad,
|
||||
float rem_code_phase_chips,
|
||||
float code_phase_step_chips,
|
||||
int signal_length_samples)
|
||||
float rem_carrier_phase_in_rad,
|
||||
float phase_step_rad,
|
||||
float rem_code_phase_chips,
|
||||
float code_phase_step_chips,
|
||||
int signal_length_samples)
|
||||
{
|
||||
update_local_code(signal_length_samples, rem_code_phase_chips, code_phase_step_chips);
|
||||
// Regenerate phase at each call in order to avoid numerical issues
|
||||
@@ -121,7 +119,7 @@ cpu_multicorrelator_16sc::cpu_multicorrelator_16sc()
|
||||
|
||||
cpu_multicorrelator_16sc::~cpu_multicorrelator_16sc()
|
||||
{
|
||||
if(d_local_codes_resampled != nullptr)
|
||||
if (d_local_codes_resampled != nullptr)
|
||||
{
|
||||
cpu_multicorrelator_16sc::free();
|
||||
}
|
||||
@@ -142,4 +140,3 @@ bool cpu_multicorrelator_16sc::free()
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ public:
|
||||
cpu_multicorrelator_16sc();
|
||||
~cpu_multicorrelator_16sc();
|
||||
bool init(int max_signal_length_samples, int n_correlators);
|
||||
bool set_local_code_and_taps(int code_length_chips, const lv_16sc_t* local_code_in, float *shifts_chips);
|
||||
bool set_input_output_vectors(lv_16sc_t* corr_out, const lv_16sc_t* sig_in);
|
||||
bool set_local_code_and_taps(int code_length_chips, const lv_16sc_t *local_code_in, float *shifts_chips);
|
||||
bool set_input_output_vectors(lv_16sc_t *corr_out, const lv_16sc_t *sig_in);
|
||||
void update_local_code(int correlator_length_samples, float rem_code_phase_chips, float code_phase_step_chips);
|
||||
bool Carrier_wipeoff_multicorrelator_resampler(float rem_carrier_phase_in_rad, float phase_step_rad, float rem_code_phase_chips, float code_phase_step_chips, int signal_length_samples);
|
||||
bool free();
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
cpu_multicorrelator_real_codes::cpu_multicorrelator_real_codes()
|
||||
{
|
||||
d_sig_in = nullptr;
|
||||
@@ -53,7 +52,7 @@ cpu_multicorrelator_real_codes::cpu_multicorrelator_real_codes()
|
||||
|
||||
cpu_multicorrelator_real_codes::~cpu_multicorrelator_real_codes()
|
||||
{
|
||||
if(d_local_codes_resampled != nullptr)
|
||||
if (d_local_codes_resampled != nullptr)
|
||||
{
|
||||
cpu_multicorrelator_real_codes::free();
|
||||
}
|
||||
@@ -61,8 +60,8 @@ cpu_multicorrelator_real_codes::~cpu_multicorrelator_real_codes()
|
||||
|
||||
|
||||
bool cpu_multicorrelator_real_codes::init(
|
||||
int max_signal_length_samples,
|
||||
int n_correlators)
|
||||
int max_signal_length_samples,
|
||||
int n_correlators)
|
||||
{
|
||||
// ALLOCATE MEMORY FOR INTERNAL vectors
|
||||
size_t size = max_signal_length_samples * sizeof(float);
|
||||
@@ -77,11 +76,10 @@ bool cpu_multicorrelator_real_codes::init(
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool cpu_multicorrelator_real_codes::set_local_code_and_taps(
|
||||
int code_length_chips,
|
||||
const float* local_code_in,
|
||||
float *shifts_chips)
|
||||
int code_length_chips,
|
||||
const float* local_code_in,
|
||||
float* shifts_chips)
|
||||
{
|
||||
d_local_code_in = local_code_in;
|
||||
d_shifts_chips = shifts_chips;
|
||||
@@ -102,29 +100,29 @@ bool cpu_multicorrelator_real_codes::set_input_output_vectors(std::complex<float
|
||||
void cpu_multicorrelator_real_codes::update_local_code(int correlator_length_samples, float rem_code_phase_chips, float code_phase_step_chips)
|
||||
{
|
||||
volk_gnsssdr_32f_xn_resampler_32f_xn(d_local_codes_resampled,
|
||||
d_local_code_in,
|
||||
rem_code_phase_chips,
|
||||
code_phase_step_chips,
|
||||
d_shifts_chips,
|
||||
d_code_length_chips,
|
||||
d_n_correlators,
|
||||
correlator_length_samples);
|
||||
d_local_code_in,
|
||||
rem_code_phase_chips,
|
||||
code_phase_step_chips,
|
||||
d_shifts_chips,
|
||||
d_code_length_chips,
|
||||
d_n_correlators,
|
||||
correlator_length_samples);
|
||||
}
|
||||
|
||||
|
||||
bool cpu_multicorrelator_real_codes::Carrier_wipeoff_multicorrelator_resampler(
|
||||
float rem_carrier_phase_in_rad,
|
||||
float phase_step_rad,
|
||||
float rem_code_phase_chips,
|
||||
float code_phase_step_chips,
|
||||
int signal_length_samples)
|
||||
float rem_carrier_phase_in_rad,
|
||||
float phase_step_rad,
|
||||
float rem_code_phase_chips,
|
||||
float code_phase_step_chips,
|
||||
int signal_length_samples)
|
||||
{
|
||||
update_local_code(signal_length_samples, rem_code_phase_chips, code_phase_step_chips);
|
||||
// Regenerate phase at each call in order to avoid numerical issues
|
||||
lv_32fc_t phase_offset_as_complex[1];
|
||||
phase_offset_as_complex[0] = lv_cmake(std::cos(rem_carrier_phase_in_rad), -std::sin(rem_carrier_phase_in_rad));
|
||||
// call VOLK_GNSSSDR kernel
|
||||
volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn(d_corr_out, d_sig_in, std::exp(lv_32fc_t(0, - phase_step_rad)), phase_offset_as_complex, (const float**)d_local_codes_resampled, d_n_correlators, signal_length_samples);
|
||||
volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn(d_corr_out, d_sig_in, std::exp(lv_32fc_t(0, -phase_step_rad)), phase_offset_as_complex, (const float**)d_local_codes_resampled, d_n_correlators, signal_length_samples);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -143,5 +141,3 @@ bool cpu_multicorrelator_real_codes::free()
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
cpu_multicorrelator_real_codes();
|
||||
~cpu_multicorrelator_real_codes();
|
||||
bool init(int max_signal_length_samples, int n_correlators);
|
||||
bool set_local_code_and_taps(int code_length_chips, const float* local_code_in, float *shifts_chips);
|
||||
bool set_input_output_vectors(std::complex<float>* corr_out, const std::complex<float>* sig_in);
|
||||
bool set_local_code_and_taps(int code_length_chips, const float *local_code_in, float *shifts_chips);
|
||||
bool set_input_output_vectors(std::complex<float> *corr_out, const std::complex<float> *sig_in);
|
||||
void update_local_code(int correlator_length_samples, float rem_code_phase_chips, float code_phase_step_chips);
|
||||
bool Carrier_wipeoff_multicorrelator_resampler(float rem_carrier_phase_in_rad, float phase_step_rad, float rem_code_phase_chips, float code_phase_step_chips, int signal_length_samples);
|
||||
bool free();
|
||||
@@ -67,4 +67,3 @@ private:
|
||||
|
||||
|
||||
#endif /* CPU_MULTICORRELATOR_REAL_CODES_H_ */
|
||||
|
||||
|
||||
@@ -54,22 +54,26 @@ struct GPU_Complex
|
||||
{
|
||||
float r;
|
||||
float i;
|
||||
CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex() {};
|
||||
CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex( float a, float b ) : r(a), i(b) {}
|
||||
CUDA_CALLABLE_MEMBER_DEVICE float magnitude2( void ) { return r * r + i * i; }
|
||||
CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex(){};
|
||||
CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex(float a, float b) : r(a), i(b) {}
|
||||
CUDA_CALLABLE_MEMBER_DEVICE float magnitude2(void) { return r * r + i * i; }
|
||||
CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex operator*(const GPU_Complex& a)
|
||||
{
|
||||
#ifdef __CUDACC__
|
||||
return GPU_Complex(__fmul_rn(r, a.r) - __fmul_rn(i, a.i), __fmul_rn(i, a.r) + __fmul_rn(r, a.i));
|
||||
#else
|
||||
return GPU_Complex(r*a.r - i*a.i, i*a.r + r*a.i);
|
||||
return GPU_Complex(r * a.r - i * a.i, i * a.r + r * a.i);
|
||||
#endif
|
||||
}
|
||||
CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex operator+(const GPU_Complex& a)
|
||||
{
|
||||
return GPU_Complex(r + a.r, i + a.i);
|
||||
}
|
||||
CUDA_CALLABLE_MEMBER_DEVICE void operator+=(const GPU_Complex& a) { r += a.r; i += a.i; }
|
||||
CUDA_CALLABLE_MEMBER_DEVICE void operator+=(const GPU_Complex& a)
|
||||
{
|
||||
r += a.r;
|
||||
i += a.i;
|
||||
}
|
||||
CUDA_CALLABLE_MEMBER_DEVICE void multiply_acc(const GPU_Complex& a, const GPU_Complex& b)
|
||||
{
|
||||
//c=a*b+c
|
||||
@@ -82,10 +86,9 @@ struct GPU_Complex
|
||||
i = __fmaf_rn(a.i, b.r, i);
|
||||
i = __fmaf_rn(a.r, b.i, i);
|
||||
#else
|
||||
r = (a.r*b.r - a.i*b.i) + r;
|
||||
i = (a.i*b.r - a.r*b.i) + i;
|
||||
r = (a.r * b.r - a.i * b.i) + r;
|
||||
i = (a.i * b.r - a.r * b.i) + i;
|
||||
#endif
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -93,18 +96,18 @@ struct GPU_Complex_Short
|
||||
{
|
||||
float r;
|
||||
float i;
|
||||
CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex_Short( short int a, short int b ) : r(a), i(b) {}
|
||||
CUDA_CALLABLE_MEMBER_DEVICE float magnitude2( void )
|
||||
CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex_Short(short int a, short int b) : r(a), i(b) {}
|
||||
CUDA_CALLABLE_MEMBER_DEVICE float magnitude2(void)
|
||||
{
|
||||
return r * r + i * i;
|
||||
}
|
||||
CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex_Short operator*(const GPU_Complex_Short& a)
|
||||
{
|
||||
return GPU_Complex_Short(r*a.r - i*a.i, i*a.r + r*a.i);
|
||||
return GPU_Complex_Short(r * a.r - i * a.i, i * a.r + r * a.i);
|
||||
}
|
||||
CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex_Short operator+(const GPU_Complex_Short& a)
|
||||
{
|
||||
return GPU_Complex_Short(r+a.r, i+a.i);
|
||||
return GPU_Complex_Short(r + a.r, i + a.i);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -117,44 +120,41 @@ class cuda_multicorrelator
|
||||
public:
|
||||
cuda_multicorrelator();
|
||||
bool init_cuda_integrated_resampler(
|
||||
int signal_length_samples,
|
||||
int code_length_chips,
|
||||
int n_correlators
|
||||
);
|
||||
int signal_length_samples,
|
||||
int code_length_chips,
|
||||
int n_correlators);
|
||||
bool set_local_code_and_taps(
|
||||
int code_length_chips,
|
||||
const std::complex<float>* local_codes_in,
|
||||
float *shifts_chips,
|
||||
int n_correlators
|
||||
);
|
||||
int code_length_chips,
|
||||
const std::complex<float>* local_codes_in,
|
||||
float* shifts_chips,
|
||||
int n_correlators);
|
||||
bool set_input_output_vectors(
|
||||
std::complex<float>* corr_out,
|
||||
std::complex<float>* sig_in
|
||||
);
|
||||
std::complex<float>* corr_out,
|
||||
std::complex<float>* sig_in);
|
||||
|
||||
bool free_cuda();
|
||||
bool Carrier_wipeoff_multicorrelator_resampler_cuda(
|
||||
float rem_carrier_phase_in_rad,
|
||||
float phase_step_rad,
|
||||
float code_phase_step_chips,
|
||||
float rem_code_phase_chips,
|
||||
int signal_length_samples,
|
||||
int n_correlators);
|
||||
float rem_carrier_phase_in_rad,
|
||||
float phase_step_rad,
|
||||
float code_phase_step_chips,
|
||||
float rem_code_phase_chips,
|
||||
int signal_length_samples,
|
||||
int n_correlators);
|
||||
|
||||
private:
|
||||
// Allocate the device input vectors
|
||||
GPU_Complex *d_sig_in;
|
||||
GPU_Complex *d_nco_in;
|
||||
GPU_Complex *d_sig_doppler_wiped;
|
||||
GPU_Complex *d_local_codes_in;
|
||||
GPU_Complex *d_corr_out;
|
||||
GPU_Complex* d_sig_in;
|
||||
GPU_Complex* d_nco_in;
|
||||
GPU_Complex* d_sig_doppler_wiped;
|
||||
GPU_Complex* d_local_codes_in;
|
||||
GPU_Complex* d_corr_out;
|
||||
|
||||
//
|
||||
std::complex<float> *d_sig_in_cpu;
|
||||
std::complex<float> *d_corr_out_cpu;
|
||||
std::complex<float>* d_sig_in_cpu;
|
||||
std::complex<float>* d_corr_out_cpu;
|
||||
|
||||
int *d_shifts_samples;
|
||||
float *d_shifts_chips;
|
||||
int* d_shifts_samples;
|
||||
float* d_shifts_chips;
|
||||
int d_code_length_chips;
|
||||
|
||||
int selected_gps_device;
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
#define CODE_RESAMPLER_NUM_BITS_PRECISION 20
|
||||
#define CODE_PHASE_STEP_CHIPS_NUM_NBITS CODE_RESAMPLER_NUM_BITS_PRECISION
|
||||
#define pwrtwo(x) (1 << (x))
|
||||
#define MAX_CODE_RESAMPLER_COUNTER pwrtwo(CODE_PHASE_STEP_CHIPS_NUM_NBITS) // 2^CODE_PHASE_STEP_CHIPS_NUM_NBITS
|
||||
#define MAX_CODE_RESAMPLER_COUNTER pwrtwo(CODE_PHASE_STEP_CHIPS_NUM_NBITS) // 2^CODE_PHASE_STEP_CHIPS_NUM_NBITS
|
||||
#define PHASE_CARR_NBITS 32
|
||||
#define PHASE_CARR_NBITS_INT 1
|
||||
#define PHASE_CARR_NBITS_FRAC PHASE_CARR_NBITS - PHASE_CARR_NBITS_INT
|
||||
@@ -84,7 +84,7 @@ void fpga_multicorrelator_8sc::set_initial_sample(int samples_offset)
|
||||
|
||||
|
||||
bool fpga_multicorrelator_8sc::set_local_code_and_taps(int code_length_chips,
|
||||
const lv_16sc_t* local_code_in, float *shifts_chips)
|
||||
const lv_16sc_t* local_code_in, float* shifts_chips)
|
||||
{
|
||||
d_local_code_in = local_code_in;
|
||||
d_shifts_chips = shifts_chips;
|
||||
@@ -115,9 +115,9 @@ void fpga_multicorrelator_8sc::update_local_code(float rem_code_phase_chips)
|
||||
|
||||
|
||||
bool fpga_multicorrelator_8sc::Carrier_wipeoff_multicorrelator_resampler(
|
||||
float rem_carrier_phase_in_rad, float phase_step_rad,
|
||||
float rem_code_phase_chips, float code_phase_step_chips,
|
||||
int signal_length_samples)
|
||||
float rem_carrier_phase_in_rad, float phase_step_rad,
|
||||
float rem_code_phase_chips, float code_phase_step_chips,
|
||||
int signal_length_samples)
|
||||
{
|
||||
update_local_code(rem_code_phase_chips);
|
||||
|
||||
@@ -147,7 +147,7 @@ bool fpga_multicorrelator_8sc::Carrier_wipeoff_multicorrelator_resampler(
|
||||
|
||||
|
||||
fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int n_correlators,
|
||||
std::string device_name, unsigned int device_base)
|
||||
std::string device_name, unsigned int device_base)
|
||||
{
|
||||
d_n_correlators = n_correlators;
|
||||
d_device_name = device_name;
|
||||
@@ -157,9 +157,9 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int n_correlators,
|
||||
|
||||
// instantiate variable length vectors
|
||||
d_initial_index = static_cast<unsigned*>(volk_gnsssdr_malloc(
|
||||
n_correlators * sizeof(unsigned), volk_gnsssdr_get_alignment()));
|
||||
n_correlators * sizeof(unsigned), volk_gnsssdr_get_alignment()));
|
||||
d_initial_interp_counter = static_cast<unsigned*>(volk_gnsssdr_malloc(
|
||||
n_correlators * sizeof(unsigned), volk_gnsssdr_get_alignment()));
|
||||
n_correlators * sizeof(unsigned), volk_gnsssdr_get_alignment()));
|
||||
|
||||
d_local_code_in = nullptr;
|
||||
d_shifts_chips = nullptr;
|
||||
@@ -187,7 +187,7 @@ fpga_multicorrelator_8sc::~fpga_multicorrelator_8sc()
|
||||
bool fpga_multicorrelator_8sc::free()
|
||||
{
|
||||
// unlock the hardware
|
||||
fpga_multicorrelator_8sc::unlock_channel(); // unlock the channel
|
||||
fpga_multicorrelator_8sc::unlock_channel(); // unlock the channel
|
||||
|
||||
// free the FPGA dynamically created variables
|
||||
if (d_initial_index != nullptr)
|
||||
@@ -208,7 +208,7 @@ bool fpga_multicorrelator_8sc::free()
|
||||
|
||||
void fpga_multicorrelator_8sc::set_channel(unsigned int channel)
|
||||
{
|
||||
char device_io_name[MAX_LENGTH_DEVICEIO_NAME]; // driver io name
|
||||
char device_io_name[MAX_LENGTH_DEVICEIO_NAME]; // driver io name
|
||||
|
||||
d_channel = channel;
|
||||
|
||||
@@ -226,13 +226,13 @@ void fpga_multicorrelator_8sc::set_channel(unsigned int channel)
|
||||
LOG(WARNING) << "Cannot open deviceio" << device_io_name;
|
||||
}
|
||||
|
||||
d_map_base = reinterpret_cast<volatile unsigned *>(mmap(NULL, PAGE_SIZE,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0));
|
||||
d_map_base = reinterpret_cast<volatile unsigned*>(mmap(NULL, PAGE_SIZE,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0));
|
||||
|
||||
if (d_map_base == reinterpret_cast<void*>(-1))
|
||||
{
|
||||
LOG(WARNING) << "Cannot map the FPGA tracking module "
|
||||
<< d_channel << "into user memory";
|
||||
<< d_channel << "into user memory";
|
||||
}
|
||||
|
||||
// sanity check : check test register
|
||||
@@ -251,7 +251,7 @@ void fpga_multicorrelator_8sc::set_channel(unsigned int channel)
|
||||
|
||||
|
||||
unsigned fpga_multicorrelator_8sc::fpga_acquisition_test_register(
|
||||
unsigned writeval)
|
||||
unsigned writeval)
|
||||
{
|
||||
unsigned readval;
|
||||
// write value to test register
|
||||
@@ -285,11 +285,9 @@ void fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(void)
|
||||
code_chip = 0;
|
||||
}
|
||||
// copy the local code to the FPGA memory one by one
|
||||
d_map_base[11] = LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY
|
||||
| code_chip | select_fpga_correlator;
|
||||
d_map_base[11] = LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY | code_chip | select_fpga_correlator;
|
||||
}
|
||||
select_fpga_correlator = select_fpga_correlator
|
||||
+ LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT;
|
||||
select_fpga_correlator = select_fpga_correlator + LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,21 +301,21 @@ void fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters(void)
|
||||
{
|
||||
// initial index calculation
|
||||
temp_calculation = floor(
|
||||
d_shifts_chips[i] + d_rem_code_phase_chips);
|
||||
d_shifts_chips[i] + d_rem_code_phase_chips);
|
||||
if (temp_calculation < 0)
|
||||
{
|
||||
temp_calculation = temp_calculation + d_code_length_chips; // % operator does not work as in Matlab with negative numbers
|
||||
temp_calculation = temp_calculation + d_code_length_chips; // % operator does not work as in Matlab with negative numbers
|
||||
}
|
||||
d_initial_index[i] = static_cast<unsigned>( (static_cast<int>(temp_calculation)) % d_code_length_chips);
|
||||
d_initial_index[i] = static_cast<unsigned>((static_cast<int>(temp_calculation)) % d_code_length_chips);
|
||||
|
||||
// initial interpolator counter calculation
|
||||
temp_calculation = fmod(d_shifts_chips[i] + d_rem_code_phase_chips,
|
||||
1.0);
|
||||
1.0);
|
||||
if (temp_calculation < 0)
|
||||
{
|
||||
temp_calculation = temp_calculation + 1.0; // fmod operator does not work as in Matlab with negative numbers
|
||||
temp_calculation = temp_calculation + 1.0; // fmod operator does not work as in Matlab with negative numbers
|
||||
}
|
||||
d_initial_interp_counter[i] = static_cast<unsigned>( floor( MAX_CODE_RESAMPLER_COUNTER * temp_calculation));
|
||||
d_initial_interp_counter[i] = static_cast<unsigned>(floor(MAX_CODE_RESAMPLER_COUNTER * temp_calculation));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +328,7 @@ void fpga_multicorrelator_8sc::fpga_configure_code_parameters_in_fpga(void)
|
||||
d_map_base[1 + i] = d_initial_index[i];
|
||||
d_map_base[1 + d_n_correlators + i] = d_initial_interp_counter[i];
|
||||
}
|
||||
d_map_base[8] = d_code_length_chips - 1; // number of samples - 1
|
||||
d_map_base[8] = d_code_length_chips - 1; // number of samples - 1
|
||||
}
|
||||
|
||||
|
||||
@@ -338,33 +336,30 @@ void fpga_multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void)
|
||||
{
|
||||
float d_rem_carrier_phase_in_rad_temp;
|
||||
|
||||
d_code_phase_step_chips_num = static_cast<unsigned>( roundf(MAX_CODE_RESAMPLER_COUNTER * d_code_phase_step_chips));
|
||||
d_code_phase_step_chips_num = static_cast<unsigned>(roundf(MAX_CODE_RESAMPLER_COUNTER * d_code_phase_step_chips));
|
||||
|
||||
if (d_rem_carrier_phase_in_rad > M_PI)
|
||||
{
|
||||
d_rem_carrier_phase_in_rad_temp = -2 * M_PI
|
||||
+ d_rem_carrier_phase_in_rad;
|
||||
d_rem_carrier_phase_in_rad_temp = -2 * M_PI + d_rem_carrier_phase_in_rad;
|
||||
}
|
||||
else if (d_rem_carrier_phase_in_rad < -M_PI)
|
||||
{
|
||||
d_rem_carrier_phase_in_rad_temp = 2 * M_PI
|
||||
+ d_rem_carrier_phase_in_rad;
|
||||
d_rem_carrier_phase_in_rad_temp = 2 * M_PI + d_rem_carrier_phase_in_rad;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_rem_carrier_phase_in_rad_temp = d_rem_carrier_phase_in_rad;
|
||||
}
|
||||
|
||||
d_rem_carr_phase_rad_int = static_cast<int>( roundf(
|
||||
(fabs(d_rem_carrier_phase_in_rad_temp) / M_PI)
|
||||
* pow(2, PHASE_CARR_NBITS_FRAC)));
|
||||
d_rem_carr_phase_rad_int = static_cast<int>(roundf(
|
||||
(fabs(d_rem_carrier_phase_in_rad_temp) / M_PI) * pow(2, PHASE_CARR_NBITS_FRAC)));
|
||||
|
||||
if (d_rem_carrier_phase_in_rad_temp < 0)
|
||||
{
|
||||
d_rem_carr_phase_rad_int = -d_rem_carr_phase_rad_int;
|
||||
}
|
||||
d_phase_step_rad_int = static_cast<int>( roundf(
|
||||
(fabs(d_phase_step_rad) / M_PI) * pow(2, PHASE_CARR_NBITS_FRAC))); // the FPGA accepts a range for the phase step between -pi and +pi
|
||||
d_phase_step_rad_int = static_cast<int>(roundf(
|
||||
(fabs(d_phase_step_rad) / M_PI) * pow(2, PHASE_CARR_NBITS_FRAC))); // the FPGA accepts a range for the phase step between -pi and +pi
|
||||
|
||||
if (d_phase_step_rad < 0)
|
||||
{
|
||||
@@ -389,7 +384,7 @@ void fpga_multicorrelator_8sc::fpga_launch_multicorrelator_fpga(void)
|
||||
int reenable = 1;
|
||||
write(d_device_descriptor, reinterpret_cast<void*>(&reenable), sizeof(int));
|
||||
|
||||
d_map_base[14] = 0; // writing anything to reg 14 launches the tracking
|
||||
d_map_base[14] = 0; // writing anything to reg 14 launches the tracking
|
||||
}
|
||||
|
||||
|
||||
@@ -402,18 +397,18 @@ void fpga_multicorrelator_8sc::read_tracking_gps_results(void)
|
||||
for (k = 0; k < d_n_correlators; k++)
|
||||
{
|
||||
readval_real = d_map_base[1 + k];
|
||||
if (readval_real >= 1048576) // 0x100000 (21 bits two's complement)
|
||||
if (readval_real >= 1048576) // 0x100000 (21 bits two's complement)
|
||||
{
|
||||
readval_real = -2097152 + readval_real;
|
||||
}
|
||||
readval_real = readval_real * 2; // the results are shifted two bits to the left due to the complex multiplier in the FPGA
|
||||
readval_real = readval_real * 2; // the results are shifted two bits to the left due to the complex multiplier in the FPGA
|
||||
|
||||
readval_imag = d_map_base[1 + d_n_correlators + k];
|
||||
if (readval_imag >= 1048576) // 0x100000 (21 bits two's complement)
|
||||
if (readval_imag >= 1048576) // 0x100000 (21 bits two's complement)
|
||||
{
|
||||
readval_imag = -2097152 + readval_imag;
|
||||
}
|
||||
readval_imag = readval_imag * 2; // the results are shifted two bits to the left due to the complex multiplier in the FPGA
|
||||
readval_imag = readval_imag * 2; // the results are shifted two bits to the left due to the complex multiplier in the FPGA
|
||||
|
||||
d_corr_out[k] = lv_cmake(readval_real, readval_imag);
|
||||
}
|
||||
@@ -423,13 +418,12 @@ void fpga_multicorrelator_8sc::read_tracking_gps_results(void)
|
||||
void fpga_multicorrelator_8sc::unlock_channel(void)
|
||||
{
|
||||
// unlock the channel to let the next samples go through
|
||||
d_map_base[12] = 1; // unlock the channel
|
||||
d_map_base[12] = 1; // unlock the channel
|
||||
}
|
||||
|
||||
|
||||
void fpga_multicorrelator_8sc::lock_channel(void)
|
||||
{
|
||||
// lock the channel for processing
|
||||
d_map_base[12] = 0; // lock the channel
|
||||
d_map_base[12] = 0; // lock the channel
|
||||
}
|
||||
|
||||
|
||||
@@ -48,14 +48,18 @@ class fpga_multicorrelator_8sc
|
||||
{
|
||||
public:
|
||||
fpga_multicorrelator_8sc(int n_correlators, std::string device_name,
|
||||
unsigned int device_base);
|
||||
~fpga_multicorrelator_8sc();bool set_local_code_and_taps(
|
||||
int code_length_chips, const lv_16sc_t* local_code_in,
|
||||
float *shifts_chips);bool set_output_vectors(lv_16sc_t* corr_out);
|
||||
void update_local_code(float rem_code_phase_chips);bool Carrier_wipeoff_multicorrelator_resampler(
|
||||
float rem_carrier_phase_in_rad, float phase_step_rad,
|
||||
float rem_code_phase_chips, float code_phase_step_chips,
|
||||
int signal_length_samples);bool free();
|
||||
unsigned int device_base);
|
||||
~fpga_multicorrelator_8sc();
|
||||
bool set_local_code_and_taps(
|
||||
int code_length_chips, const lv_16sc_t *local_code_in,
|
||||
float *shifts_chips);
|
||||
bool set_output_vectors(lv_16sc_t *corr_out);
|
||||
void update_local_code(float rem_code_phase_chips);
|
||||
bool Carrier_wipeoff_multicorrelator_resampler(
|
||||
float rem_carrier_phase_in_rad, float phase_step_rad,
|
||||
float rem_code_phase_chips, float code_phase_step_chips,
|
||||
int signal_length_samples);
|
||||
bool free();
|
||||
|
||||
void set_channel(unsigned int channel);
|
||||
void set_initial_sample(int samples_offset);
|
||||
@@ -70,12 +74,12 @@ private:
|
||||
int d_n_correlators;
|
||||
|
||||
// data related to the hardware module and the driver
|
||||
int d_device_descriptor; // driver descriptor
|
||||
volatile unsigned *d_map_base; // driver memory map
|
||||
int d_device_descriptor; // driver descriptor
|
||||
volatile unsigned *d_map_base; // driver memory map
|
||||
|
||||
// configuration data received from the interface
|
||||
unsigned int d_channel; // channel number
|
||||
unsigned d_ncorrelators; // number of correlators
|
||||
unsigned int d_channel; // channel number
|
||||
unsigned d_ncorrelators; // number of correlators
|
||||
unsigned d_correlator_length_samples;
|
||||
float d_rem_code_phase_chips;
|
||||
float d_code_phase_step_chips;
|
||||
@@ -108,7 +112,6 @@ private:
|
||||
void read_tracking_gps_results(void);
|
||||
|
||||
//void unlock_channel(void);
|
||||
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_FPGA_MULTICORRELATOR_H_ */
|
||||
|
||||
@@ -71,17 +71,16 @@ float cn0_svn_estimator(gr_complex* Prompt_buffer, int length, long fs_in, doubl
|
||||
double SNR_dB_Hz = 0;
|
||||
double Psig = 0;
|
||||
double Ptot = 0;
|
||||
for (int i=0; i<length; i++)
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
Psig += std::abs(static_cast<double>(Prompt_buffer[i].real()));
|
||||
Ptot += static_cast<double>(Prompt_buffer[i].imag()) * static_cast<double>(Prompt_buffer[i].imag())
|
||||
+ static_cast<double>(Prompt_buffer[i].real()) * static_cast<double>(Prompt_buffer[i].real());
|
||||
Ptot += static_cast<double>(Prompt_buffer[i].imag()) * static_cast<double>(Prompt_buffer[i].imag()) + static_cast<double>(Prompt_buffer[i].real()) * static_cast<double>(Prompt_buffer[i].real());
|
||||
}
|
||||
Psig = Psig / static_cast<double>(length);
|
||||
Psig = Psig * Psig;
|
||||
Ptot = Ptot / static_cast<double>(length);
|
||||
SNR = Psig / (Ptot - Psig);
|
||||
SNR_dB_Hz = 10 * log10(SNR) + 10 * log10(static_cast<double>(fs_in)/2) - 10 * log10(code_length);
|
||||
SNR_dB_Hz = 10 * log10(SNR) + 10 * log10(static_cast<double>(fs_in) / 2) - 10 * log10(code_length);
|
||||
return static_cast<float>(SNR_dB_Hz);
|
||||
}
|
||||
|
||||
@@ -101,12 +100,12 @@ float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
||||
float tmp_sum_Q = 0;
|
||||
float NBD = 0;
|
||||
float NBP = 0;
|
||||
for (int i=0; i<length; i++)
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
tmp_sum_I += Prompt_buffer[i].real();
|
||||
tmp_sum_Q += Prompt_buffer[i].imag();
|
||||
}
|
||||
NBP = tmp_sum_I*tmp_sum_I + tmp_sum_Q*tmp_sum_Q;
|
||||
NBD = tmp_sum_I*tmp_sum_I - tmp_sum_Q*tmp_sum_Q;
|
||||
return NBD/NBP;
|
||||
NBP = tmp_sum_I * tmp_sum_I + tmp_sum_Q * tmp_sum_Q;
|
||||
NBD = tmp_sum_I * tmp_sum_I - tmp_sum_Q * tmp_sum_Q;
|
||||
return NBD / NBP;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
float cn0_svn_estimator(gr_complex* Prompt_buffer, int length, long fs_in, double code_length);
|
||||
|
||||
|
||||
|
||||
/*! \brief A carrier lock detector
|
||||
*
|
||||
* The Carrier Phase Lock Detector block uses the estimate of the cosine of twice the carrier phase error is given by
|
||||
|
||||
@@ -35,19 +35,20 @@
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
tcp_communication::tcp_communication() : tcp_socket_(io_service_)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
tcp_communication::~tcp_communication()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int tcp_communication::listen_tcp_connection(size_t d_port_, size_t d_port_ch0_)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
// Specify IP type and port
|
||||
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), d_port_);
|
||||
boost::asio::ip::tcp::acceptor acceptor(io_service_, endpoint);
|
||||
@@ -65,25 +66,25 @@ int tcp_communication::listen_tcp_connection(size_t d_port_, size_t d_port_ch0_)
|
||||
acceptor.accept(tcp_socket_);
|
||||
|
||||
std::cout << "Socket accepted on port " << d_port_ << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cerr << "Exception: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void tcp_communication::send_receive_tcp_packet_galileo_e1(boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> buf, tcp_packet_data *tcp_data_)
|
||||
void tcp_communication::send_receive_tcp_packet_galileo_e1(boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> buf, tcp_packet_data* tcp_data_)
|
||||
{
|
||||
int controlc = 0;
|
||||
boost::array<float, NUM_RX_VARIABLES> readbuf;
|
||||
float d_control_id_ = buf.data()[0];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
// Send a TCP packet
|
||||
tcp_socket_.write_some(boost::asio::buffer(buf));
|
||||
|
||||
@@ -100,25 +101,25 @@ void tcp_communication::send_receive_tcp_packet_galileo_e1(boost::array<float, N
|
||||
tcp_data_->proc_pack_code_error = readbuf.data()[1];
|
||||
tcp_data_->proc_pack_carr_error = readbuf.data()[2];
|
||||
tcp_data_->proc_pack_carrier_doppler_hz = readbuf.data()[3];
|
||||
}
|
||||
}
|
||||
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cerr << "Exception: " << e.what() << ". Please press Ctrl+C to end the program." << std::endl;
|
||||
std::cin >> controlc;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void tcp_communication::send_receive_tcp_packet_gps_l1_ca(boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> buf, tcp_packet_data *tcp_data_)
|
||||
void tcp_communication::send_receive_tcp_packet_gps_l1_ca(boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> buf, tcp_packet_data* tcp_data_)
|
||||
{
|
||||
int controlc = 0;
|
||||
boost::array<float, NUM_RX_VARIABLES> readbuf;
|
||||
float d_control_id_ = buf.data()[0];
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
// Send a TCP packet
|
||||
tcp_socket_.write_some(boost::asio::buffer(buf));
|
||||
|
||||
@@ -135,13 +136,13 @@ void tcp_communication::send_receive_tcp_packet_gps_l1_ca(boost::array<float, NU
|
||||
tcp_data_->proc_pack_code_error = readbuf.data()[1];
|
||||
tcp_data_->proc_pack_carr_error = readbuf.data()[2];
|
||||
tcp_data_->proc_pack_carrier_doppler_hz = readbuf.data()[3];
|
||||
}
|
||||
}
|
||||
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cerr << "Exception: " << e.what() << ". Please press Ctrl+C to end the program." << std::endl;
|
||||
std::cin >> controlc;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,62 +38,60 @@
|
||||
#include "tracking_2nd_DLL_filter.h"
|
||||
|
||||
|
||||
void Tracking_2nd_DLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k)
|
||||
void Tracking_2nd_DLL_filter::calculate_lopp_coef(float* tau1, float* tau2, float lbw, float zeta, float k)
|
||||
{
|
||||
// Solve natural frequency
|
||||
float Wn;
|
||||
Wn = lbw*8*zeta / (4*zeta*zeta + 1);
|
||||
Wn = lbw * 8 * zeta / (4 * zeta * zeta + 1);
|
||||
// solve for t1 & t2
|
||||
*tau1 = k / (Wn * Wn);
|
||||
*tau2 = (2.0 * zeta) / Wn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Tracking_2nd_DLL_filter::set_DLL_BW(float dll_bw_hz)
|
||||
{
|
||||
//Calculate filter coefficient values
|
||||
d_dllnoisebandwidth = dll_bw_hz;
|
||||
calculate_lopp_coef(&d_tau1_code, &d_tau2_code, d_dllnoisebandwidth, d_dlldampingratio, 1.0);// Calculate filter coefficient values
|
||||
d_dllnoisebandwidth = dll_bw_hz;
|
||||
calculate_lopp_coef(&d_tau1_code, &d_tau2_code, d_dllnoisebandwidth, d_dlldampingratio, 1.0); // Calculate filter coefficient values
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Tracking_2nd_DLL_filter::initialize()
|
||||
{
|
||||
// code tracking loop parameters
|
||||
d_old_code_nco = 0.0;
|
||||
d_old_code_nco = 0.0;
|
||||
d_old_code_error = 0.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
float Tracking_2nd_DLL_filter::get_code_nco(float DLL_discriminator)
|
||||
{
|
||||
float code_nco;
|
||||
code_nco = d_old_code_nco + (d_tau2_code/d_tau1_code)*(DLL_discriminator - d_old_code_error) + (DLL_discriminator+d_old_code_error) * (d_pdi_code/(2*d_tau1_code));
|
||||
code_nco = d_old_code_nco + (d_tau2_code / d_tau1_code) * (DLL_discriminator - d_old_code_error) + (DLL_discriminator + d_old_code_error) * (d_pdi_code / (2 * d_tau1_code));
|
||||
//code_nco = d_old_code_nco + (d_tau2_code/d_tau1_code)*(DLL_discriminator - d_old_code_error) + DLL_discriminator * (d_pdi_code/d_tau1_code);
|
||||
d_old_code_nco = code_nco;
|
||||
d_old_code_error = DLL_discriminator; //[chips]
|
||||
d_old_code_nco = code_nco;
|
||||
d_old_code_error = DLL_discriminator; //[chips]
|
||||
return code_nco;
|
||||
}
|
||||
|
||||
Tracking_2nd_DLL_filter::Tracking_2nd_DLL_filter (float pdi_code)
|
||||
Tracking_2nd_DLL_filter::Tracking_2nd_DLL_filter(float pdi_code)
|
||||
{
|
||||
d_pdi_code = pdi_code;// Summation interval for code
|
||||
d_pdi_code = pdi_code; // Summation interval for code
|
||||
d_dlldampingratio = 0.7;
|
||||
}
|
||||
|
||||
Tracking_2nd_DLL_filter::Tracking_2nd_DLL_filter ()
|
||||
Tracking_2nd_DLL_filter::Tracking_2nd_DLL_filter()
|
||||
{
|
||||
d_pdi_code = 0.001;// Summation interval for code
|
||||
d_pdi_code = 0.001; // Summation interval for code
|
||||
d_dlldampingratio = 0.7;
|
||||
}
|
||||
|
||||
Tracking_2nd_DLL_filter::~Tracking_2nd_DLL_filter ()
|
||||
{}
|
||||
Tracking_2nd_DLL_filter::~Tracking_2nd_DLL_filter()
|
||||
{
|
||||
}
|
||||
|
||||
void Tracking_2nd_DLL_filter::set_pdi(float pdi_code)
|
||||
{
|
||||
d_pdi_code = pdi_code; // Summation interval for code
|
||||
d_pdi_code = pdi_code; // Summation interval for code
|
||||
}
|
||||
|
||||
@@ -56,13 +56,13 @@ private:
|
||||
float d_dlldampingratio = 0;
|
||||
float d_old_code_error = 0;
|
||||
float d_old_code_nco = 0;
|
||||
void calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k);
|
||||
void calculate_lopp_coef(float* tau1, float* tau2, float lbw, float zeta, float k);
|
||||
|
||||
public:
|
||||
void set_DLL_BW(float dll_bw_hz); //! Set DLL filter bandwidth [Hz]
|
||||
void set_pdi(float pdi_code); //! Set Summation interval for code [s]
|
||||
void initialize(); //! Start tracking with acquisition information
|
||||
float get_code_nco(float DLL_discriminator); //! Numerically controlled oscillator
|
||||
void set_DLL_BW(float dll_bw_hz); //! Set DLL filter bandwidth [Hz]
|
||||
void set_pdi(float pdi_code); //! Set Summation interval for code [s]
|
||||
void initialize(); //! Start tracking with acquisition information
|
||||
float get_code_nco(float DLL_discriminator); //! Numerically controlled oscillator
|
||||
Tracking_2nd_DLL_filter(float pdi_code);
|
||||
Tracking_2nd_DLL_filter();
|
||||
~Tracking_2nd_DLL_filter();
|
||||
|
||||
@@ -37,31 +37,29 @@
|
||||
#include "tracking_2nd_PLL_filter.h"
|
||||
|
||||
|
||||
void Tracking_2nd_PLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k)
|
||||
void Tracking_2nd_PLL_filter::calculate_lopp_coef(float* tau1, float* tau2, float lbw, float zeta, float k)
|
||||
{
|
||||
// Solve natural frequency
|
||||
float Wn;
|
||||
Wn = lbw*8*zeta / (4*zeta*zeta + 1);
|
||||
Wn = lbw * 8 * zeta / (4 * zeta * zeta + 1);
|
||||
// solve for t1 & t2
|
||||
*tau1 = k / (Wn * Wn);
|
||||
*tau2 = (2.0 * zeta) / Wn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Tracking_2nd_PLL_filter::set_PLL_BW(float pll_bw_hz)
|
||||
{
|
||||
//Calculate filter coefficient values
|
||||
d_pllnoisebandwidth = pll_bw_hz;
|
||||
calculate_lopp_coef(&d_tau1_carr, &d_tau2_carr, d_pllnoisebandwidth, d_plldampingratio, 0.25); // Calculate filter coefficient values
|
||||
calculate_lopp_coef(&d_tau1_carr, &d_tau2_carr, d_pllnoisebandwidth, d_plldampingratio, 0.25); // Calculate filter coefficient values
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Tracking_2nd_PLL_filter::initialize()
|
||||
{
|
||||
// carrier/Costas loop parameters
|
||||
d_old_carr_nco = 0.0;
|
||||
d_old_carr_nco = 0.0;
|
||||
d_old_carr_error = 0.0;
|
||||
}
|
||||
|
||||
@@ -74,36 +72,35 @@ void Tracking_2nd_PLL_filter::initialize()
|
||||
float Tracking_2nd_PLL_filter::get_carrier_nco(float PLL_discriminator)
|
||||
{
|
||||
float carr_nco;
|
||||
carr_nco = d_old_carr_nco + (d_tau2_carr/d_tau1_carr)*(PLL_discriminator - d_old_carr_error) + (PLL_discriminator + d_old_carr_error) * (d_pdi_carr/(2*d_tau1_carr));
|
||||
carr_nco = d_old_carr_nco + (d_tau2_carr / d_tau1_carr) * (PLL_discriminator - d_old_carr_error) + (PLL_discriminator + d_old_carr_error) * (d_pdi_carr / (2 * d_tau1_carr));
|
||||
//carr_nco = d_old_carr_nco + (d_tau2_carr/d_tau1_carr)*(PLL_discriminator - d_old_carr_error) + PLL_discriminator * (d_pdi_carr/d_tau1_carr);
|
||||
d_old_carr_nco = carr_nco;
|
||||
d_old_carr_nco = carr_nco;
|
||||
d_old_carr_error = PLL_discriminator;
|
||||
return carr_nco;
|
||||
}
|
||||
|
||||
Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter (float pdi_carr)
|
||||
Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter(float pdi_carr)
|
||||
{
|
||||
//--- PLL variables --------------------------------------------------------
|
||||
d_pdi_carr = pdi_carr;// Summation interval for carrier
|
||||
d_pdi_carr = pdi_carr; // Summation interval for carrier
|
||||
//d_plldampingratio = 0.65;
|
||||
d_plldampingratio = 0.7;
|
||||
}
|
||||
|
||||
|
||||
Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter ()
|
||||
Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter()
|
||||
{
|
||||
//--- PLL variables --------------------------------------------------------
|
||||
d_pdi_carr = 0.001;// Summation interval for carrier
|
||||
d_pdi_carr = 0.001; // Summation interval for carrier
|
||||
d_plldampingratio = 0.7;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Tracking_2nd_PLL_filter::~Tracking_2nd_PLL_filter ()
|
||||
{}
|
||||
Tracking_2nd_PLL_filter::~Tracking_2nd_PLL_filter()
|
||||
{
|
||||
}
|
||||
|
||||
void Tracking_2nd_PLL_filter::set_pdi(float pdi_carr)
|
||||
{
|
||||
d_pdi_carr = pdi_carr; // Summation interval for code
|
||||
d_pdi_carr = pdi_carr; // Summation interval for code
|
||||
}
|
||||
|
||||
@@ -58,11 +58,11 @@ private:
|
||||
float d_old_carr_error = 0;
|
||||
float d_old_carr_nco = 0;
|
||||
|
||||
void calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k);
|
||||
void calculate_lopp_coef(float* tau1, float* tau2, float lbw, float zeta, float k);
|
||||
|
||||
public:
|
||||
void set_PLL_BW(float pll_bw_hz); //! Set PLL loop bandwidth [Hz]
|
||||
void set_pdi(float pdi_carr); //! Set Summation interval for code [s]
|
||||
void set_pdi(float pdi_carr); //! Set Summation interval for code [s]
|
||||
void initialize();
|
||||
float get_carrier_nco(float PLL_discriminator);
|
||||
Tracking_2nd_PLL_filter(float pdi_carr);
|
||||
|
||||
@@ -68,9 +68,6 @@ void Tracking_FLL_PLL_filter::set_params(float fll_bw_hz, float pll_bw_hz, int o
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Tracking_FLL_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
|
||||
{
|
||||
if (d_order == 3)
|
||||
@@ -86,9 +83,6 @@ void Tracking_FLL_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
float Tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s)
|
||||
{
|
||||
float carrier_error_hz;
|
||||
@@ -98,8 +92,8 @@ float Tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float
|
||||
* 3rd order PLL with 2nd order FLL assist
|
||||
*/
|
||||
d_pll_w = d_pll_w + correlation_time_s * (d_pll_w0p3 * PLL_discriminator + d_pll_w0f2 * FLL_discriminator);
|
||||
d_pll_x = d_pll_x + correlation_time_s * (0.5*d_pll_w + d_pll_a2 * d_pll_w0f * FLL_discriminator + d_pll_a3 * d_pll_w0p2 * PLL_discriminator);
|
||||
carrier_error_hz = 0.5*d_pll_x + d_pll_b3 * d_pll_w0p * PLL_discriminator;
|
||||
d_pll_x = d_pll_x + correlation_time_s * (0.5 * d_pll_w + d_pll_a2 * d_pll_w0f * FLL_discriminator + d_pll_a3 * d_pll_w0p2 * PLL_discriminator);
|
||||
carrier_error_hz = 0.5 * d_pll_x + d_pll_b3 * d_pll_w0p * PLL_discriminator;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -118,11 +112,10 @@ float Tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float
|
||||
}
|
||||
|
||||
return carrier_error_hz;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Tracking_FLL_PLL_filter::Tracking_FLL_PLL_filter ()
|
||||
Tracking_FLL_PLL_filter::Tracking_FLL_PLL_filter()
|
||||
{
|
||||
d_order = 0;
|
||||
d_pll_w = 0;
|
||||
@@ -138,6 +131,6 @@ Tracking_FLL_PLL_filter::Tracking_FLL_PLL_filter ()
|
||||
}
|
||||
|
||||
|
||||
Tracking_FLL_PLL_filter::~Tracking_FLL_PLL_filter ()
|
||||
{}
|
||||
|
||||
Tracking_FLL_PLL_filter::~Tracking_FLL_PLL_filter()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ private:
|
||||
float d_pll_w0p2;
|
||||
float d_pll_b3;
|
||||
float d_pll_w0p;
|
||||
|
||||
public:
|
||||
void set_params(float fll_bw_hz, float pll_bw_hz, int order);
|
||||
void initialize(float d_acq_carrier_doppler_hz);
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
double fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2, double t1, double t2)
|
||||
{
|
||||
double cross, dot;
|
||||
dot = prompt_s1.real()*prompt_s2.real() + prompt_s1.imag()*prompt_s2.imag();
|
||||
cross = prompt_s1.real()*prompt_s2.imag() - prompt_s2.real()*prompt_s1.imag();
|
||||
return atan2(cross, dot) / (t2-t1);
|
||||
dot = prompt_s1.real() * prompt_s2.real() + prompt_s1.imag() * prompt_s2.imag();
|
||||
cross = prompt_s1.real() * prompt_s2.imag() - prompt_s2.real() * prompt_s1.imag();
|
||||
return atan2(cross, dot) / (t2 - t1);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,8 +100,8 @@ double dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1)
|
||||
{
|
||||
double P_early, P_late;
|
||||
P_early = std::abs(early_s1);
|
||||
P_late = std::abs(late_s1);
|
||||
if( P_early + P_late == 0.0 )
|
||||
P_late = std::abs(late_s1);
|
||||
if (P_early + P_late == 0.0)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
@@ -124,8 +124,8 @@ double dll_nc_vemlp_normalized(gr_complex very_early_s1, gr_complex early_s1, gr
|
||||
{
|
||||
double P_early, P_late;
|
||||
P_early = std::sqrt(std::norm(very_early_s1) + std::norm(early_s1));
|
||||
P_late = std::sqrt(std::norm(very_late_s1) + std::norm(late_s1));
|
||||
if( P_early + P_late == 0.0 )
|
||||
P_late = std::sqrt(std::norm(very_late_s1) + std::norm(late_s1));
|
||||
if (P_early + P_late == 0.0)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@@ -40,30 +40,30 @@
|
||||
#define MAX_LOOP_ORDER 3
|
||||
#define MAX_HISTORY_LENGTH 4
|
||||
|
||||
Tracking_loop_filter::Tracking_loop_filter( float update_interval,
|
||||
float noise_bandwidth,
|
||||
int loop_order,
|
||||
bool include_last_integrator )
|
||||
: d_loop_order( loop_order ),
|
||||
d_current_index( 0 ),
|
||||
d_include_last_integrator( include_last_integrator ),
|
||||
d_noise_bandwidth( noise_bandwidth ),
|
||||
d_update_interval( update_interval )
|
||||
Tracking_loop_filter::Tracking_loop_filter(float update_interval,
|
||||
float noise_bandwidth,
|
||||
int loop_order,
|
||||
bool include_last_integrator)
|
||||
: d_loop_order(loop_order),
|
||||
d_current_index(0),
|
||||
d_include_last_integrator(include_last_integrator),
|
||||
d_noise_bandwidth(noise_bandwidth),
|
||||
d_update_interval(update_interval)
|
||||
{
|
||||
d_inputs.resize( MAX_HISTORY_LENGTH, 0.0 );
|
||||
d_outputs.resize( MAX_HISTORY_LENGTH, 0.0 );
|
||||
d_inputs.resize(MAX_HISTORY_LENGTH, 0.0);
|
||||
d_outputs.resize(MAX_HISTORY_LENGTH, 0.0);
|
||||
update_coefficients();
|
||||
}
|
||||
|
||||
Tracking_loop_filter::Tracking_loop_filter()
|
||||
: d_loop_order( 2 ),
|
||||
d_current_index( 0 ),
|
||||
d_include_last_integrator( false ),
|
||||
d_noise_bandwidth( 15.0 ),
|
||||
d_update_interval( 0.001 )
|
||||
: d_loop_order(2),
|
||||
d_current_index(0),
|
||||
d_include_last_integrator(false),
|
||||
d_noise_bandwidth(15.0),
|
||||
d_update_interval(0.001)
|
||||
{
|
||||
d_inputs.resize( MAX_HISTORY_LENGTH, 0.0 );
|
||||
d_outputs.resize( MAX_HISTORY_LENGTH, 0.0 );
|
||||
d_inputs.resize(MAX_HISTORY_LENGTH, 0.0);
|
||||
d_outputs.resize(MAX_HISTORY_LENGTH, 0.0);
|
||||
update_coefficients();
|
||||
}
|
||||
|
||||
@@ -72,17 +72,16 @@ Tracking_loop_filter::~Tracking_loop_filter()
|
||||
// Don't need to do anything here
|
||||
}
|
||||
|
||||
float Tracking_loop_filter::apply( float current_input )
|
||||
float Tracking_loop_filter::apply(float current_input)
|
||||
{
|
||||
|
||||
// Now apply the filter coefficients:
|
||||
float result = 0;
|
||||
float result = 0;
|
||||
|
||||
// Hanlde the old outputs first:
|
||||
for( unsigned int ii=0; ii < d_output_coefficients.size(); ++ii )
|
||||
{
|
||||
result += d_output_coefficients[ii] * d_outputs[ (d_current_index+ii)%MAX_HISTORY_LENGTH ];
|
||||
}
|
||||
for (unsigned int ii = 0; ii < d_output_coefficients.size(); ++ii)
|
||||
{
|
||||
result += d_output_coefficients[ii] * d_outputs[(d_current_index + ii) % MAX_HISTORY_LENGTH];
|
||||
}
|
||||
|
||||
// Now update the index to handle the inputs.
|
||||
// DO NOT CHANGE THE ORDER OF THE ABOVE AND BELOW CODE
|
||||
@@ -92,18 +91,18 @@ float Tracking_loop_filter::apply( float current_input )
|
||||
// the current input/output is at d_current_index, the nth previous
|
||||
// input/output is at (d_current_index+n)%d_loop_order
|
||||
d_current_index--;
|
||||
if( d_current_index < 0 )
|
||||
{
|
||||
d_current_index += MAX_HISTORY_LENGTH;
|
||||
}
|
||||
if (d_current_index < 0)
|
||||
{
|
||||
d_current_index += MAX_HISTORY_LENGTH;
|
||||
}
|
||||
|
||||
d_inputs[d_current_index] = current_input;
|
||||
|
||||
|
||||
for( unsigned int ii=0; ii < d_input_coefficients.size(); ++ii )
|
||||
{
|
||||
result += d_input_coefficients[ii] * d_inputs[ (d_current_index+ii)%MAX_HISTORY_LENGTH ];
|
||||
}
|
||||
for (unsigned int ii = 0; ii < d_input_coefficients.size(); ++ii)
|
||||
{
|
||||
result += d_input_coefficients[ii] * d_inputs[(d_current_index + ii) % MAX_HISTORY_LENGTH];
|
||||
}
|
||||
|
||||
|
||||
d_outputs[d_current_index] = result;
|
||||
@@ -112,7 +111,7 @@ float Tracking_loop_filter::apply( float current_input )
|
||||
return result;
|
||||
}
|
||||
|
||||
void Tracking_loop_filter::update_coefficients( void )
|
||||
void Tracking_loop_filter::update_coefficients(void)
|
||||
{
|
||||
// Analog gains:
|
||||
float g1;
|
||||
@@ -123,7 +122,7 @@ void Tracking_loop_filter::update_coefficients( void )
|
||||
float wn;
|
||||
float T = d_update_interval;
|
||||
|
||||
float zeta = 1/std::sqrt(2);
|
||||
float zeta = 1 / std::sqrt(2);
|
||||
|
||||
// The following is based on the bilinear transform approximation of
|
||||
// the analog integrator. The loop format is from Kaplan & Hegarty
|
||||
@@ -135,150 +134,147 @@ void Tracking_loop_filter::update_coefficients( void )
|
||||
// The bilinear transform approximates 1/s as
|
||||
// T/2(1 + z^-1)/(1-z^-1) in the z domain.
|
||||
|
||||
switch( d_loop_order )
|
||||
{
|
||||
switch (d_loop_order)
|
||||
{
|
||||
case 1:
|
||||
wn = d_noise_bandwidth*4.0;
|
||||
wn = d_noise_bandwidth * 4.0;
|
||||
g1 = wn;
|
||||
if( d_include_last_integrator )
|
||||
{
|
||||
d_input_coefficients.resize(2);
|
||||
d_input_coefficients[0] = g1*T/2.0;
|
||||
d_input_coefficients[1] = g1*T/2.0;
|
||||
if (d_include_last_integrator)
|
||||
{
|
||||
d_input_coefficients.resize(2);
|
||||
d_input_coefficients[0] = g1 * T / 2.0;
|
||||
d_input_coefficients[1] = g1 * T / 2.0;
|
||||
|
||||
d_output_coefficients.resize(1);
|
||||
d_output_coefficients[0] = 1;
|
||||
}
|
||||
d_output_coefficients.resize(1);
|
||||
d_output_coefficients[0] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_input_coefficients.resize(1);
|
||||
d_input_coefficients[0] = g1;
|
||||
{
|
||||
d_input_coefficients.resize(1);
|
||||
d_input_coefficients[0] = g1;
|
||||
|
||||
d_output_coefficients.resize(0);
|
||||
}
|
||||
d_output_coefficients.resize(0);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
wn = d_noise_bandwidth * (8*zeta)/ (4*zeta*zeta + 1 );
|
||||
g1 = wn*wn;
|
||||
g2 = wn*2*zeta;
|
||||
if( d_include_last_integrator )
|
||||
{
|
||||
d_input_coefficients.resize(3);
|
||||
d_input_coefficients[0] = T/2*( g1*T/2 + g2 );
|
||||
d_input_coefficients[1] = T*T/2*g1;
|
||||
d_input_coefficients[2] = T/2*( g1*T/2 - g2 );
|
||||
wn = d_noise_bandwidth * (8 * zeta) / (4 * zeta * zeta + 1);
|
||||
g1 = wn * wn;
|
||||
g2 = wn * 2 * zeta;
|
||||
if (d_include_last_integrator)
|
||||
{
|
||||
d_input_coefficients.resize(3);
|
||||
d_input_coefficients[0] = T / 2 * (g1 * T / 2 + g2);
|
||||
d_input_coefficients[1] = T * T / 2 * g1;
|
||||
d_input_coefficients[2] = T / 2 * (g1 * T / 2 - g2);
|
||||
|
||||
d_output_coefficients.resize(2);
|
||||
d_output_coefficients[0] = 2;
|
||||
d_output_coefficients[1] = -1;
|
||||
}
|
||||
d_output_coefficients.resize(2);
|
||||
d_output_coefficients[0] = 2;
|
||||
d_output_coefficients[1] = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_input_coefficients.resize(2);
|
||||
d_input_coefficients[0] = ( g1*T/2.0+g2 );
|
||||
d_input_coefficients[1] = g1*T/2-g2;
|
||||
{
|
||||
d_input_coefficients.resize(2);
|
||||
d_input_coefficients[0] = (g1 * T / 2.0 + g2);
|
||||
d_input_coefficients[1] = g1 * T / 2 - g2;
|
||||
|
||||
d_output_coefficients.resize(1);
|
||||
d_output_coefficients[0] = 1;
|
||||
}
|
||||
d_output_coefficients.resize(1);
|
||||
d_output_coefficients[0] = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
wn = d_noise_bandwidth / 0.7845; // From Kaplan
|
||||
wn = d_noise_bandwidth / 0.7845; // From Kaplan
|
||||
float a3 = 1.1;
|
||||
float b3 = 2.4;
|
||||
g1 = wn*wn*wn;
|
||||
g2 = a3*wn*wn;
|
||||
g3 = b3*wn;
|
||||
g1 = wn * wn * wn;
|
||||
g2 = a3 * wn * wn;
|
||||
g3 = b3 * wn;
|
||||
|
||||
if( d_include_last_integrator )
|
||||
{
|
||||
d_input_coefficients.resize(4);
|
||||
d_input_coefficients[0] = T/2*( g3 + T/2*( g2 + T/2*g1 ) );
|
||||
d_input_coefficients[1] = T/2*( -g3 + T/2*( g2 + 3*T/2*g1 ) );
|
||||
d_input_coefficients[2] = T/2*( -g3 - T/2*( g2 - 3*T/2*g1 ) );
|
||||
d_input_coefficients[3] = T/2*( g3 - T/2*( g2 - T/2*g1 ) );
|
||||
if (d_include_last_integrator)
|
||||
{
|
||||
d_input_coefficients.resize(4);
|
||||
d_input_coefficients[0] = T / 2 * (g3 + T / 2 * (g2 + T / 2 * g1));
|
||||
d_input_coefficients[1] = T / 2 * (-g3 + T / 2 * (g2 + 3 * T / 2 * g1));
|
||||
d_input_coefficients[2] = T / 2 * (-g3 - T / 2 * (g2 - 3 * T / 2 * g1));
|
||||
d_input_coefficients[3] = T / 2 * (g3 - T / 2 * (g2 - T / 2 * g1));
|
||||
|
||||
d_output_coefficients.resize(3);
|
||||
d_output_coefficients[0] = 3;
|
||||
d_output_coefficients[1] = -3;
|
||||
d_output_coefficients[2] = 1;
|
||||
}
|
||||
d_output_coefficients.resize(3);
|
||||
d_output_coefficients[0] = 3;
|
||||
d_output_coefficients[1] = -3;
|
||||
d_output_coefficients[2] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_input_coefficients.resize(3);
|
||||
d_input_coefficients[0] = g3 + T/2*( g2 + T/2*g1 );
|
||||
d_input_coefficients[1] = g1*T*T/2 -2*g3;
|
||||
d_input_coefficients[2] = g3 + T/2*( -g2 + T/2*g1 );
|
||||
{
|
||||
d_input_coefficients.resize(3);
|
||||
d_input_coefficients[0] = g3 + T / 2 * (g2 + T / 2 * g1);
|
||||
d_input_coefficients[1] = g1 * T * T / 2 - 2 * g3;
|
||||
d_input_coefficients[2] = g3 + T / 2 * (-g2 + T / 2 * g1);
|
||||
|
||||
|
||||
d_output_coefficients.resize(2);
|
||||
d_output_coefficients[0] = 2;
|
||||
d_output_coefficients[1] = -1;
|
||||
}
|
||||
d_output_coefficients.resize(2);
|
||||
d_output_coefficients[0] = 2;
|
||||
d_output_coefficients[1] = -1;
|
||||
}
|
||||
break;
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
void Tracking_loop_filter::set_noise_bandwidth( float noise_bandwidth )
|
||||
void Tracking_loop_filter::set_noise_bandwidth(float noise_bandwidth)
|
||||
{
|
||||
d_noise_bandwidth = noise_bandwidth;
|
||||
update_coefficients();
|
||||
}
|
||||
|
||||
float Tracking_loop_filter::get_noise_bandwidth( void ) const
|
||||
float Tracking_loop_filter::get_noise_bandwidth(void) const
|
||||
{
|
||||
return d_noise_bandwidth;
|
||||
}
|
||||
|
||||
void Tracking_loop_filter::set_update_interval( float update_interval )
|
||||
void Tracking_loop_filter::set_update_interval(float update_interval)
|
||||
{
|
||||
d_update_interval = update_interval;
|
||||
update_coefficients();
|
||||
}
|
||||
|
||||
float Tracking_loop_filter::get_update_interval( void ) const
|
||||
float Tracking_loop_filter::get_update_interval(void) const
|
||||
{
|
||||
return d_update_interval;
|
||||
}
|
||||
|
||||
void Tracking_loop_filter::set_include_last_integrator( bool include_last_integrator )
|
||||
void Tracking_loop_filter::set_include_last_integrator(bool include_last_integrator)
|
||||
{
|
||||
d_include_last_integrator = include_last_integrator;
|
||||
update_coefficients();
|
||||
}
|
||||
|
||||
bool Tracking_loop_filter::get_include_last_integrator( void ) const
|
||||
bool Tracking_loop_filter::get_include_last_integrator(void) const
|
||||
{
|
||||
return d_include_last_integrator;
|
||||
}
|
||||
|
||||
void Tracking_loop_filter::set_order( int loop_order )
|
||||
void Tracking_loop_filter::set_order(int loop_order)
|
||||
{
|
||||
if( loop_order < 1 || loop_order > MAX_LOOP_ORDER )
|
||||
{
|
||||
LOG(ERROR) << "Ignoring attempt to set loop order to " << loop_order
|
||||
<< ". Maximum allowed order is: " << MAX_LOOP_ORDER
|
||||
<< ". Not changing current value of " << d_loop_order;
|
||||
if (loop_order < 1 || loop_order > MAX_LOOP_ORDER)
|
||||
{
|
||||
LOG(ERROR) << "Ignoring attempt to set loop order to " << loop_order
|
||||
<< ". Maximum allowed order is: " << MAX_LOOP_ORDER
|
||||
<< ". Not changing current value of " << d_loop_order;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
d_loop_order = loop_order;
|
||||
update_coefficients();
|
||||
}
|
||||
|
||||
int Tracking_loop_filter::get_order( void ) const
|
||||
int Tracking_loop_filter::get_order(void) const
|
||||
{
|
||||
return d_loop_order;
|
||||
}
|
||||
|
||||
void Tracking_loop_filter::initialize( float initial_output )
|
||||
void Tracking_loop_filter::initialize(float initial_output)
|
||||
{
|
||||
d_inputs.assign( MAX_HISTORY_LENGTH, 0.0 );
|
||||
d_outputs.assign( MAX_HISTORY_LENGTH, initial_output );
|
||||
d_inputs.assign(MAX_HISTORY_LENGTH, 0.0);
|
||||
d_outputs.assign(MAX_HISTORY_LENGTH, initial_output);
|
||||
d_current_index = MAX_HISTORY_LENGTH - 1;
|
||||
}
|
||||
|
||||
@@ -45,12 +45,12 @@ class Tracking_loop_filter
|
||||
{
|
||||
private:
|
||||
// Store the last inputs and outputs:
|
||||
std::vector< float > d_inputs;
|
||||
std::vector< float > d_outputs;
|
||||
std::vector<float> d_inputs;
|
||||
std::vector<float> d_outputs;
|
||||
|
||||
// Store the filter coefficients:
|
||||
std::vector< float > d_input_coefficients;
|
||||
std::vector< float > d_output_coefficients;
|
||||
std::vector<float> d_input_coefficients;
|
||||
std::vector<float> d_output_coefficients;
|
||||
|
||||
// The loop order:
|
||||
int d_loop_order;
|
||||
@@ -79,17 +79,17 @@ public:
|
||||
bool get_include_last_integrator(void) const;
|
||||
int get_order(void) const;
|
||||
|
||||
void set_noise_bandwidth( float noise_bandwidth );
|
||||
void set_update_interval( float update_interval );
|
||||
void set_include_last_integrator( bool include_last_integrator );
|
||||
void set_order( int loop_order );
|
||||
void set_noise_bandwidth(float noise_bandwidth);
|
||||
void set_update_interval(float update_interval);
|
||||
void set_include_last_integrator(bool include_last_integrator);
|
||||
void set_order(int loop_order);
|
||||
|
||||
void initialize(float initial_output = 0.0);
|
||||
float apply(float current_input );
|
||||
float apply(float current_input);
|
||||
|
||||
Tracking_loop_filter(float update_interval, float noise_bandwidth,
|
||||
int loop_order = 2,
|
||||
bool include_last_integrator = false );
|
||||
int loop_order = 2,
|
||||
bool include_last_integrator = false);
|
||||
|
||||
Tracking_loop_filter();
|
||||
~Tracking_loop_filter();
|
||||
|
||||
Reference in New Issue
Block a user