1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 20:50:33 +00:00

Add new tracking block to GPS L2 adapter

This commit is contained in:
Antonio Ramos 2018-03-19 16:52:36 +01:00
parent 7fdb9796e9
commit 02deff9b24
4 changed files with 66 additions and 28 deletions

View File

@ -399,32 +399,32 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
if (d_nav.flag_TOW_5 == true) //page 5 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
{
//TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_current_symbol = d_nav.TOW_5 + GALILEO_INAV_PAGE_PART_SECONDS + (static_cast<double>(required_symbols)) * GALILEO_E1_CODE_PERIOD; //-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND;
d_TOW_at_current_symbol = d_nav.TOW_5 + static_cast<double>(GALILEO_INAV_PAGE_PART_SECONDS) + static_cast<double>(required_symbols - 1) * GALILEO_E1_CODE_PERIOD; //-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND;
d_nav.flag_TOW_5 = false;
}
else if (d_nav.flag_TOW_6 == true) //page 6 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
{
//TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_current_symbol = d_nav.TOW_6 + GALILEO_INAV_PAGE_PART_SECONDS + (static_cast<double>(required_symbols)) * GALILEO_E1_CODE_PERIOD; //-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND;
d_TOW_at_current_symbol = d_nav.TOW_6 + static_cast<double>(GALILEO_INAV_PAGE_PART_SECONDS) + static_cast<double>(required_symbols - 1) * GALILEO_E1_CODE_PERIOD; //-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND;
d_nav.flag_TOW_6 = false;
}
else
{
//this page has no timing information
d_TOW_at_current_symbol = d_TOW_at_current_symbol + GALILEO_E1_CODE_PERIOD; // + GALILEO_INAV_PAGE_PART_SYMBOLS*GALILEO_E1_CODE_PERIOD;
d_TOW_at_current_symbol += GALILEO_E1_CODE_PERIOD; // + GALILEO_INAV_PAGE_PART_SYMBOLS*GALILEO_E1_CODE_PERIOD;
}
}
else //if there is not a new preamble, we define the TOW of the current symbol
{
d_TOW_at_current_symbol = d_TOW_at_current_symbol + GALILEO_E1_CODE_PERIOD;
d_TOW_at_current_symbol += GALILEO_E1_CODE_PERIOD;
}
//if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true)
if (d_nav.flag_GGTO_1 == true and d_nav.flag_GGTO_2 == true and d_nav.flag_GGTO_3 == true and d_nav.flag_GGTO_4 == true) //all GGTO parameters arrived
{
delta_t = d_nav.A_0G_10 + d_nav.A_1G_10 * (d_TOW_at_current_symbol - d_nav.t_0G_10 + 604800.0 * (fmod((d_nav.WN_0 - d_nav.WN_0G_10), 64)));
delta_t = d_nav.A_0G_10 + d_nav.A_1G_10 * (d_TOW_at_current_symbol - d_nav.t_0G_10 + 604800.0 * (fmod((d_nav.WN_0 - d_nav.WN_0G_10), 64.0)));
}
if (d_flag_frame_sync == true and d_nav.flag_TOW_set == true)

View File

@ -39,6 +39,7 @@
#include "configuration_interface.h"
#include "GPS_L2C.h"
#include "gnss_sdr_flags.h"
#include "display.h"
#include <glog/logging.h>
@ -52,7 +53,6 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
//################# CONFIGURATION PARAMETERS ########################
int fs_in;
int vector_length;
int f_if;
bool dump;
std::string dump_filename;
std::string item_type;
@ -63,31 +63,46 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
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);
pll_bw_hz = configuration->property(role + ".pll_bw_hz", 2.0);
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);
dll_bw_hz = configuration->property(role + ".dll_bw_hz", 0.75);
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
unified_ = configuration->property(role + ".unified", false);
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!
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)));
int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1);
if (symbols_extended_correlator != 1)
{
std::cout << TEXT_RED << "WARNING: Extended coherent integration is not allowed in GPS L2. Coherent integration has been set to 20 ms (1 symbol)" << TEXT_RESET << std::endl;
}
//################# MAKE TRACKING GNURadio object ###################
if (item_type.compare("gr_complex") == 0)
{
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);
if (unified_)
{
char sig_[3] = "2S";
item_size_ = sizeof(gr_complex);
tracking_unified_ = dll_pll_veml_make_tracking(
fs_in, vector_length, dump, dump_filename,
pll_bw_hz, dll_bw_hz, pll_bw_hz, dll_bw_hz,
early_late_space_chips,
early_late_space_chips,
early_late_space_chips,
early_late_space_chips,
1, false, 'G', sig_);
}
else
{
tracking_ = gps_l2_m_dll_pll_make_tracking_cc(
0, fs_in, vector_length, dump,
dump_filename, pll_bw_hz, dll_bw_hz,
early_late_space_chips);
}
}
else
{
@ -106,7 +121,10 @@ GpsL2MDllPllTracking::~GpsL2MDllPllTracking()
void GpsL2MDllPllTracking::start_tracking()
{
tracking_->start_tracking();
if (unified_)
tracking_unified_->start_tracking();
else
tracking_->start_tracking();
}
/*
@ -115,13 +133,19 @@ void GpsL2MDllPllTracking::start_tracking()
void GpsL2MDllPllTracking::set_channel(unsigned int channel)
{
channel_ = channel;
tracking_->set_channel(channel);
if (unified_)
tracking_unified_->set_channel(channel);
else
tracking_->set_channel(channel);
}
void GpsL2MDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
{
tracking_->set_gnss_synchro(p_gnss_synchro);
if (unified_)
tracking_unified_->set_gnss_synchro(p_gnss_synchro);
else
tracking_->set_gnss_synchro(p_gnss_synchro);
}
void GpsL2MDllPllTracking::connect(gr::top_block_sptr top_block)
@ -142,10 +166,16 @@ void GpsL2MDllPllTracking::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GpsL2MDllPllTracking::get_left_block()
{
return tracking_;
if (unified_)
return tracking_unified_;
else
return tracking_;
}
gr::basic_block_sptr GpsL2MDllPllTracking::get_right_block()
{
return tracking_;
if (unified_)
return tracking_unified_;
else
return tracking_;
}

View File

@ -40,6 +40,7 @@
#include "tracking_interface.h"
#include "gps_l2_m_dll_pll_tracking_cc.h"
#include "dll_pll_veml_tracking.h"
#include <string>
class ConfigurationInterface;
@ -93,11 +94,13 @@ public:
private:
gps_l2_m_dll_pll_tracking_cc_sptr tracking_;
dll_pll_veml_tracking_sptr tracking_unified_;
size_t item_size_;
unsigned int channel_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
bool unified_;
};
#endif // GNSS_SDR_gps_l2_m_dll_pll_tracking_H_

View File

@ -887,6 +887,7 @@ void dll_pll_veml_tracking::log_data(bool integrating)
tmp_L = std::abs<float>(d_L_accu);
if (integrating)
{
//TODO: Improve this solution!
// It compensates the amplitude difference while integrating
float scale_factor = static_cast<float>(d_extend_correlation_symbols) / static_cast<float>(d_extend_correlation_symbols_count);
tmp_VE *= scale_factor;
@ -1027,7 +1028,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
d_Prompt_buffer_deque.pop_front();
}
}
else //Signal does not have secondary code. Search a bit transition by sign change
else if (d_symbols_per_bit > 1) //Signal does not have secondary code. Search a bit transition by sign change
{
if (d_synchonizing)
{
@ -1058,6 +1059,10 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
d_current_symbol = 1;
}
}
else
{
next_state = true;
}
if (next_state)
{ // reset extended correlator
d_VE_accu = gr_complex(0.0, 0.0);
@ -1089,9 +1094,9 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
if (d_enable_extended_integration)
{
d_extend_correlation_symbols_count = 0;
float new_correlation_time_s = static_cast<float>(d_extend_correlation_symbols) * static_cast<float>(d_code_period);
d_carrier_loop_filter.set_pdi(new_correlation_time_s);
d_code_loop_filter.set_pdi(new_correlation_time_s);
float new_correlation_time = static_cast<float>(d_extend_correlation_symbols) * static_cast<float>(d_code_period);
d_carrier_loop_filter.set_pdi(new_correlation_time);
d_code_loop_filter.set_pdi(new_correlation_time);
d_state = 3; // next state is the extended correlator integrator
LOG(INFO) << "Enabled " << d_extend_correlation_symbols << " [symbols] extended correlator for CH "
<< d_channel