mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-20 10:07:42 +00:00
TCP connector for Galileo tracking improved. Code cleaning in Galileo tracking
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@259 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
@@ -99,7 +99,6 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc(
|
|||||||
gr_block ("galileo_e1_dll_pll_veml_tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)),
|
gr_block ("galileo_e1_dll_pll_veml_tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)),
|
||||||
gr_make_io_signature(1, 1, sizeof(Gnss_Synchro)))
|
gr_make_io_signature(1, 1, sizeof(Gnss_Synchro)))
|
||||||
{
|
{
|
||||||
d_debug_counter = 0;
|
|
||||||
this->set_relative_rate(1.0/vector_length);
|
this->set_relative_rate(1.0/vector_length);
|
||||||
// initialize internal vars
|
// initialize internal vars
|
||||||
d_queue = queue;
|
d_queue = queue;
|
||||||
@@ -316,7 +315,6 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
|
|||||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||||
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;
|
d_pull_in = false;
|
||||||
d_debug_counter++;
|
|
||||||
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@@ -172,7 +172,6 @@ private:
|
|||||||
|
|
||||||
//PRN period in samples
|
//PRN period in samples
|
||||||
int d_current_prn_length_samples;
|
int d_current_prn_length_samples;
|
||||||
//double d_sample_counter_seconds;
|
|
||||||
|
|
||||||
//processing samples counters
|
//processing samples counters
|
||||||
unsigned long int d_sample_counter;
|
unsigned long int d_sample_counter;
|
||||||
@@ -197,8 +196,6 @@ private:
|
|||||||
std::map<std::string, std::string> systemName;
|
std::map<std::string, std::string> systemName;
|
||||||
std::string sys;
|
std::string sys;
|
||||||
|
|
||||||
//debug
|
|
||||||
int d_debug_counter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //GNSS_SDR_GALILEO_E1_DLL_PLL_VEML_TRACKING_CC_H
|
#endif //GNSS_SDR_GALILEO_E1_DLL_PLL_VEML_TRACKING_CC_H
|
||||||
|
@@ -86,15 +86,12 @@ galileo_e1_tcp_connector_make_tracking_cc(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Galileo_E1_Tcp_Connector_Tracking_cc::forecast (int noutput_items,
|
void Galileo_E1_Tcp_Connector_Tracking_cc::forecast (int noutput_items,
|
||||||
gr_vector_int &ninput_items_required)
|
gr_vector_int &ninput_items_required)
|
||||||
{
|
{
|
||||||
ninput_items_required[0] = (int)d_vector_length*2; //set the required available samples in each call
|
ninput_items_required[0] = (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(
|
Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||||
long if_freq,
|
long if_freq,
|
||||||
long fs_in,
|
long fs_in,
|
||||||
@@ -118,14 +115,8 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
|||||||
d_fs_in = fs_in;
|
d_fs_in = fs_in;
|
||||||
d_vector_length = vector_length;
|
d_vector_length = vector_length;
|
||||||
d_dump_filename = dump_filename;
|
d_dump_filename = dump_filename;
|
||||||
d_code_loop_filter=Tracking_2nd_DLL_filter(0.004);
|
|
||||||
d_carrier_loop_filter=Tracking_2nd_PLL_filter(0.004);
|
|
||||||
|
|
||||||
// Initialize tracking ==========================================
|
// Initialize tracking ==========================================
|
||||||
|
|
||||||
d_code_loop_filter.set_DLL_BW(dll_bw_hz);
|
|
||||||
d_carrier_loop_filter.set_PLL_BW(pll_bw_hz);
|
|
||||||
|
|
||||||
//--- DLL variables --------------------------------------------------------
|
//--- 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)
|
||||||
d_very_early_late_spc_chips = very_early_late_space_chips; // Define very-early-late offset (in chips)
|
d_very_early_late_spc_chips = very_early_late_space_chips; // Define very-early-late offset (in chips)
|
||||||
@@ -138,11 +129,8 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
|||||||
|
|
||||||
// Initialization of local code replica
|
// Initialization of local code replica
|
||||||
// Get space for a vector with the sinboc(1,1) replica sampled 2x/chip
|
// Get space for a vector with the sinboc(1,1) replica sampled 2x/chip
|
||||||
// int d_ca_code_size = (int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS + 4);
|
|
||||||
d_ca_code = new gr_complex[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS + 4)];
|
d_ca_code = new gr_complex[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS + 4)];
|
||||||
|
|
||||||
// std::cout << "d_ca_code_size = " << d_ca_code_size << std::endl;
|
|
||||||
|
|
||||||
/* If an array is partitioned for more than one thread to operate on,
|
/* If an array is partitioned for more than one thread to operate on,
|
||||||
* having the sub-array boundaries unaligned to cache lines could lead
|
* having the sub-array boundaries unaligned to cache lines could lead
|
||||||
* to performance degradation. Here we allocate memory
|
* to performance degradation. Here we allocate memory
|
||||||
@@ -167,17 +155,14 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
|||||||
|
|
||||||
//--- Perform initializations ------------------------------
|
//--- Perform initializations ------------------------------
|
||||||
// define initial code frequency basis of NCO
|
// define initial code frequency basis of NCO
|
||||||
d_code_freq_hz = Galileo_E1_CODE_CHIP_RATE_HZ;
|
d_code_freq_chips = Galileo_E1_CODE_CHIP_RATE_HZ;
|
||||||
// define residual code phase (in chips)
|
// define residual code phase (in chips)
|
||||||
d_rem_code_phase_samples = 0.0;
|
d_rem_code_phase_samples = 0.0;
|
||||||
// define residual carrier phase
|
// define residual carrier phase
|
||||||
d_rem_carr_phase_rad = 0.0;
|
d_rem_carr_phase_rad = 0.0;
|
||||||
// define phase step
|
|
||||||
d_code_phase_step_chips = d_code_freq_hz / (float)d_fs_in; //[chips]
|
|
||||||
|
|
||||||
// sample synchronization
|
// sample synchronization
|
||||||
d_sample_counter = 0;
|
d_sample_counter = 0;
|
||||||
//d_sample_counter_seconds = 0;
|
|
||||||
d_acq_sample_stamp = 0;
|
d_acq_sample_stamp = 0;
|
||||||
|
|
||||||
d_enable_tracking = false;
|
d_enable_tracking = false;
|
||||||
@@ -203,33 +188,27 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
|||||||
|
|
||||||
void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking()
|
void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking()
|
||||||
{
|
{
|
||||||
|
|
||||||
d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples;
|
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_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;
|
||||||
|
|
||||||
// DLL/PLL filter initialization
|
|
||||||
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 2 (2 samples per chip)
|
// generate local reference ALWAYS starting at chip 2 (2 samples per chip)
|
||||||
galileo_e1_code_gen_complex_sampled(&d_ca_code[2],d_acquisition_gnss_synchro->Signal, false, d_acquisition_gnss_synchro->PRN, 2*Galileo_E1_CODE_CHIP_RATE_HZ, 0);
|
galileo_e1_code_gen_complex_sampled(&d_ca_code[2],d_acquisition_gnss_synchro->Signal, false, d_acquisition_gnss_synchro->PRN, 2*Galileo_E1_CODE_CHIP_RATE_HZ, 0);
|
||||||
|
// Fill head and tail
|
||||||
d_ca_code[0] = d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS)];
|
d_ca_code[0] = d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS)];
|
||||||
d_ca_code[1] = d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS+1)];
|
d_ca_code[1] = d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS+1)];
|
||||||
d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS+2)] = d_ca_code[2];
|
d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS+2)] = d_ca_code[2];
|
||||||
d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS+3)] = d_ca_code[3];
|
d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS+3)] = d_ca_code[3];
|
||||||
|
|
||||||
d_carrier_lock_fail_counter = 0;
|
d_carrier_lock_fail_counter = 0;
|
||||||
d_rem_code_phase_samples = 0.0;
|
d_rem_code_phase_samples = 0.0;
|
||||||
d_rem_carr_phase_rad = 0;
|
d_rem_carr_phase_rad = 0;
|
||||||
d_next_rem_code_phase_samples = 0;
|
|
||||||
d_acc_carrier_phase_rad = 0;
|
d_acc_carrier_phase_rad = 0;
|
||||||
|
|
||||||
d_code_phase_samples = d_acq_code_phase_samples;
|
d_acc_code_phase_secs = 0;
|
||||||
d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
|
d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
|
||||||
|
d_current_prn_length_samples = d_vector_length;
|
||||||
d_next_prn_length_samples = d_vector_length;
|
|
||||||
|
|
||||||
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
std::string sys_ = &d_acquisition_gnss_synchro->System;
|
||||||
sys = sys_.substr(0,1);
|
sys = sys_.substr(0,1);
|
||||||
@@ -249,7 +228,6 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking()
|
|||||||
|
|
||||||
void Galileo_E1_Tcp_Connector_Tracking_cc::update_local_code()
|
void Galileo_E1_Tcp_Connector_Tracking_cc::update_local_code()
|
||||||
{
|
{
|
||||||
|
|
||||||
double tcode_half_chips;
|
double tcode_half_chips;
|
||||||
float rem_code_phase_half_chips;
|
float rem_code_phase_half_chips;
|
||||||
int associated_chip_index;
|
int associated_chip_index;
|
||||||
@@ -260,18 +238,17 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::update_local_code()
|
|||||||
int very_early_late_spc_samples;
|
int very_early_late_spc_samples;
|
||||||
int epl_loop_length_samples;
|
int epl_loop_length_samples;
|
||||||
|
|
||||||
// unified loop for E, P, L code vectors
|
// unified loop for VE, E, P, L, VL code vectors
|
||||||
code_phase_step_chips = ((double)d_code_freq_hz) / ((double)d_fs_in);
|
code_phase_step_chips = ((double)d_code_freq_chips) / ((double)d_fs_in);
|
||||||
code_phase_step_half_chips = (2.0*(double)d_code_freq_hz) / ((double)d_fs_in);
|
code_phase_step_half_chips = (2.0*(double)d_code_freq_chips) / ((double)d_fs_in);
|
||||||
|
|
||||||
rem_code_phase_half_chips = d_rem_code_phase_samples * (2*d_code_freq_hz / d_fs_in);
|
rem_code_phase_half_chips = d_rem_code_phase_samples * (2*d_code_freq_chips / d_fs_in);
|
||||||
tcode_half_chips = -(double)rem_code_phase_half_chips;
|
tcode_half_chips = -(double)rem_code_phase_half_chips;
|
||||||
|
|
||||||
early_late_spc_samples=round(d_early_late_spc_chips/code_phase_step_chips);
|
early_late_spc_samples = round(d_early_late_spc_chips / code_phase_step_chips);
|
||||||
very_early_late_spc_samples=round(d_very_early_late_spc_chips/code_phase_step_chips);
|
very_early_late_spc_samples = round(d_very_early_late_spc_chips / code_phase_step_chips);
|
||||||
|
|
||||||
epl_loop_length_samples=d_current_prn_length_samples+very_early_late_spc_samples*2;
|
|
||||||
|
|
||||||
|
epl_loop_length_samples = d_current_prn_length_samples + very_early_late_spc_samples*2;
|
||||||
|
|
||||||
for (int i=0; i<epl_loop_length_samples; i++)
|
for (int i=0; i<epl_loop_length_samples; i++)
|
||||||
{
|
{
|
||||||
@@ -279,34 +256,27 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::update_local_code()
|
|||||||
d_very_early_code[i] = d_ca_code[associated_chip_index];
|
d_very_early_code[i] = d_ca_code[associated_chip_index];
|
||||||
tcode_half_chips = tcode_half_chips + code_phase_step_half_chips;
|
tcode_half_chips = tcode_half_chips + code_phase_step_half_chips;
|
||||||
}
|
}
|
||||||
memcpy(d_early_code,&d_very_early_code[very_early_late_spc_samples-early_late_spc_samples],d_current_prn_length_samples* sizeof(gr_complex));
|
memcpy(d_early_code, &d_very_early_code[very_early_late_spc_samples - early_late_spc_samples], d_current_prn_length_samples* sizeof(gr_complex));
|
||||||
memcpy(d_prompt_code,&d_very_early_code[very_early_late_spc_samples],d_current_prn_length_samples* sizeof(gr_complex));
|
memcpy(d_prompt_code, &d_very_early_code[very_early_late_spc_samples], d_current_prn_length_samples* sizeof(gr_complex));
|
||||||
memcpy(d_late_code,&d_very_early_code[2*very_early_late_spc_samples-early_late_spc_samples],d_current_prn_length_samples* sizeof(gr_complex));
|
memcpy(d_late_code, &d_very_early_code[2*very_early_late_spc_samples - early_late_spc_samples], d_current_prn_length_samples* sizeof(gr_complex));
|
||||||
memcpy(d_very_late_code,&d_very_early_code[2*very_early_late_spc_samples],d_current_prn_length_samples* sizeof(gr_complex));
|
memcpy(d_very_late_code, &d_very_early_code[2*very_early_late_spc_samples], d_current_prn_length_samples* sizeof(gr_complex));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Galileo_E1_Tcp_Connector_Tracking_cc::update_local_carrier()
|
void Galileo_E1_Tcp_Connector_Tracking_cc::update_local_carrier()
|
||||||
{
|
{
|
||||||
float phase_rad, phase_step_rad;
|
float phase_rad, phase_step_rad;
|
||||||
|
// Compute the carrier phase step for the K-1 carrier doppler estimation
|
||||||
phase_step_rad = (float)GPS_TWO_PI*d_carrier_doppler_hz / (float)d_fs_in;
|
phase_step_rad = (float)GPS_TWO_PI*d_carrier_doppler_hz / (float)d_fs_in;
|
||||||
|
// Initialize the carrier phase with the remanent carrier phase of the K-2 loop
|
||||||
phase_rad = d_rem_carr_phase_rad;
|
phase_rad = d_rem_carr_phase_rad;
|
||||||
for(int i = 0; i < d_current_prn_length_samples; i++)
|
for(int i = 0; i < d_current_prn_length_samples; i++)
|
||||||
{
|
{
|
||||||
d_carr_sign[i] = gr_complex(cos(phase_rad), -sin(phase_rad));
|
d_carr_sign[i] = gr_complex(cos(phase_rad), -sin(phase_rad));
|
||||||
phase_rad += phase_step_rad;
|
phase_rad += phase_step_rad;
|
||||||
}
|
}
|
||||||
d_rem_carr_phase_rad = fmod(phase_rad, GPS_TWO_PI);
|
|
||||||
d_acc_carrier_phase_rad = d_acc_carrier_phase_rad + d_rem_carr_phase_rad;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Galileo_E1_Tcp_Connector_Tracking_cc::~Galileo_E1_Tcp_Connector_Tracking_cc()
|
Galileo_E1_Tcp_Connector_Tracking_cc::~Galileo_E1_Tcp_Connector_Tracking_cc()
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
@@ -335,45 +305,40 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve
|
|||||||
{
|
{
|
||||||
|
|
||||||
// process vars
|
// process vars
|
||||||
float carr_nco_hz;
|
float carr_error_filt_hz;
|
||||||
float code_nco_chips;
|
float code_error_filt_chips;
|
||||||
|
|
||||||
tcp_packet_data tcp_data;
|
tcp_packet_data tcp_data;
|
||||||
|
|
||||||
if (d_enable_tracking == true)
|
if (d_enable_tracking == true)
|
||||||
{
|
{
|
||||||
/*
|
if (d_pull_in == true)
|
||||||
* Receiver signal alignment
|
{
|
||||||
*/
|
/*
|
||||||
if (d_pull_in == true)
|
* Signal alignment (skip samples until the incoming signal is aligned with local replica)
|
||||||
{
|
*/
|
||||||
int samples_offset;
|
int samples_offset;
|
||||||
float acq_trk_shif_correction_samples;
|
float acq_trk_shif_correction_samples;
|
||||||
int acq_to_trk_delay_samples;
|
int acq_to_trk_delay_samples;
|
||||||
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
|
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
|
||||||
acq_trk_shif_correction_samples = d_next_prn_length_samples - fmod((float)acq_to_trk_delay_samples, (float)d_next_prn_length_samples);
|
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod((float)acq_to_trk_delay_samples, (float)d_current_prn_length_samples);
|
||||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||||
// /todo: Check if the sample counter sent to the next block as a time reference should be incremented AFTER sended or BEFORE
|
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
||||||
//d_sample_counter_seconds = d_sample_counter_seconds + (((double)samples_offset) / (double)d_fs_in);
|
d_pull_in = false;
|
||||||
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
consume_each(samples_offset); //shift input to perform alignment with local replica
|
||||||
d_pull_in = false;
|
return 1;
|
||||||
consume_each(samples_offset); //shift input to perform alignement with local replica
|
}
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||||
Gnss_Synchro current_synchro_data;
|
Gnss_Synchro current_synchro_data;
|
||||||
// Fill the acquisition data
|
// Fill the acquisition data
|
||||||
current_synchro_data = *d_acquisition_gnss_synchro;
|
current_synchro_data = *d_acquisition_gnss_synchro;
|
||||||
|
|
||||||
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignement
|
// Block input data and block output stream pointers
|
||||||
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
|
const gr_complex* in = (gr_complex*) input_items[0];
|
||||||
|
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
|
||||||
// Update the prn length based on code freq (variable) and
|
|
||||||
// sampling frequency (fixed)
|
|
||||||
// variable code PRN sample block size
|
|
||||||
d_current_prn_length_samples = d_next_prn_length_samples;
|
|
||||||
|
|
||||||
|
// Generate local code and carrier replicas (using \hat{f}_d(k-1))
|
||||||
update_local_code();
|
update_local_code();
|
||||||
update_local_carrier();
|
update_local_carrier();
|
||||||
|
|
||||||
@@ -393,7 +358,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve
|
|||||||
d_Very_Late,
|
d_Very_Late,
|
||||||
is_unaligned());
|
is_unaligned());
|
||||||
|
|
||||||
|
// ################## TCP CONNECTOR ##########################################################
|
||||||
//! Variable used for control
|
//! Variable used for control
|
||||||
d_control_id++;
|
d_control_id++;
|
||||||
|
|
||||||
@@ -401,71 +366,81 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve
|
|||||||
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}};
|
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_tcp_com.send_receive_tcp_packet_galileo_e1(tx_variables_array, &tcp_data);
|
d_tcp_com.send_receive_tcp_packet_galileo_e1(tx_variables_array, &tcp_data);
|
||||||
|
|
||||||
|
// ################## PLL ##########################################################
|
||||||
// PLL discriminator, carrier loop filter implementation and NCO command generation (TCP_connector)
|
// PLL discriminator, carrier loop filter implementation and NCO command generation (TCP_connector)
|
||||||
carr_nco_hz = tcp_data.proc_pack_carr_error;
|
carr_error_filt_hz = tcp_data.proc_pack_carr_error;
|
||||||
// Modify carrier freq based on NCO command (TCP_connector)
|
// New carrier Doppler frequency estimation
|
||||||
d_carrier_doppler_hz = tcp_data.proc_pack_carrier_doppler_hz;
|
d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_error_filt_hz;
|
||||||
|
// 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=d_acc_carrier_phase_rad+GPS_TWO_PI*d_carrier_doppler_hz*Galileo_E1_CODE_PERIOD;
|
||||||
|
//remanent 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=fmod(d_rem_carr_phase_rad,GPS_TWO_PI);
|
||||||
|
|
||||||
|
// ################## DLL ##########################################################
|
||||||
// DLL discriminator, carrier loop filter implementation and NCO command generation (TCP_connector)
|
// DLL discriminator, carrier loop filter implementation and NCO command generation (TCP_connector)
|
||||||
code_nco_chips = tcp_data.proc_pack_code_error;
|
code_error_filt_chips = tcp_data.proc_pack_code_error;
|
||||||
// Modify code freq based on NCO command
|
//Code phase accumulator
|
||||||
d_code_freq_hz = Galileo_E1_CODE_CHIP_RATE_HZ + (d_carrier_doppler_hz * Galileo_E1_CODE_CHIP_RATE_HZ) / Galileo_E1_FREQ_HZ - code_nco_chips;
|
float code_error_filt_secs;
|
||||||
// Update the phase step based on code freq (variable) and sampling frequency (fixed)
|
code_error_filt_secs=(Galileo_E1_CODE_PERIOD*code_error_filt_chips)/Galileo_E1_CODE_CHIP_RATE_HZ; //[seconds]
|
||||||
d_code_phase_step_chips = d_code_freq_hz / (float)d_fs_in; //[chips]
|
d_acc_code_phase_secs=d_acc_code_phase_secs+code_error_filt_secs;
|
||||||
|
|
||||||
// keep alignment parameters for the next input buffer
|
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||||
float T_chip_seconds;
|
// keep alignment parameters for the next input buffer
|
||||||
float T_prn_seconds;
|
float T_chip_seconds;
|
||||||
float T_prn_samples;
|
float T_prn_seconds;
|
||||||
float K_blk_samples;
|
float T_prn_samples;
|
||||||
T_chip_seconds = 1 / d_code_freq_hz;
|
float K_blk_samples;
|
||||||
T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
// Compute the next buffer lenght based in the new period of the PRN sequence and the code phase error estimation
|
||||||
T_prn_samples = T_prn_seconds * d_fs_in;
|
T_chip_seconds = 1 / d_code_freq_chips;
|
||||||
d_rem_code_phase_samples = d_next_rem_code_phase_samples;
|
T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||||
K_blk_samples = T_prn_samples + d_rem_code_phase_samples;
|
T_prn_samples = T_prn_seconds * (float)d_fs_in;
|
||||||
d_next_prn_length_samples = round(K_blk_samples); //round to a discrete samples
|
K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs*(float)d_fs_in;
|
||||||
d_next_rem_code_phase_samples = K_blk_samples - d_next_prn_length_samples; //rounding error
|
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 ######
|
||||||
* \todo Improve the lock detection algorithm!
|
if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES)
|
||||||
*/
|
{
|
||||||
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
|
// fill buffer with prompt correlator output values
|
||||||
if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES)
|
d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt;
|
||||||
{
|
d_cn0_estimation_counter++;
|
||||||
// fill buffer with prompt correlator output values
|
}
|
||||||
d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt;
|
else
|
||||||
d_cn0_estimation_counter++;
|
{
|
||||||
}
|
d_cn0_estimation_counter = 0;
|
||||||
else
|
|
||||||
{
|
|
||||||
d_cn0_estimation_counter = 0;
|
|
||||||
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, Galileo_E1_B_CODE_LENGTH_CHIPS);
|
|
||||||
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
|
||||||
|
|
||||||
// ###### TRACKING UNLOCK NOTIFICATION #####
|
// Code lock indicator
|
||||||
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, Galileo_E1_B_CODE_LENGTH_CHIPS);
|
||||||
{
|
|
||||||
d_carrier_lock_fail_counter++;
|
// Carrier lock indicator
|
||||||
}
|
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
||||||
else
|
|
||||||
{
|
// Loss of lock detection
|
||||||
if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--;
|
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
||||||
}
|
{
|
||||||
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
|
d_carrier_lock_fail_counter++;
|
||||||
{
|
}
|
||||||
std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ;
|
else
|
||||||
//tracking_message = 3; //loss of lock
|
{
|
||||||
//d_channel_internal_queue->push(tracking_message);
|
if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--;
|
||||||
ControlMessageFactory* cmf = new ControlMessageFactory();
|
}
|
||||||
if (d_queue != gr_msg_queue_sptr()) {
|
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
|
||||||
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
|
{
|
||||||
}
|
std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ;
|
||||||
delete cmf;
|
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||||
d_carrier_lock_fail_counter = 0;
|
if (d_queue != gr_msg_queue_sptr())
|
||||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
{
|
||||||
|
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
|
||||||
|
}
|
||||||
|
delete cmf;
|
||||||
|
d_carrier_lock_fail_counter = 0;
|
||||||
|
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ########### Output the tracking data to navigation and PVT ##########
|
// ########### Output the tracking data to navigation and PVT ##########
|
||||||
|
|
||||||
@@ -554,15 +529,15 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve
|
|||||||
|
|
||||||
// carrier and code frequency
|
// carrier and code frequency
|
||||||
d_dump_file.write((char*)&d_carrier_doppler_hz, sizeof(float));
|
d_dump_file.write((char*)&d_carrier_doppler_hz, sizeof(float));
|
||||||
d_dump_file.write((char*)&d_code_freq_hz, sizeof(float));
|
d_dump_file.write((char*)&d_code_freq_chips, sizeof(float));
|
||||||
|
|
||||||
//PLL commands
|
//PLL commands
|
||||||
d_dump_file.write((char*)&tmp_float, sizeof(float));
|
d_dump_file.write((char*)&tmp_float, sizeof(float));
|
||||||
d_dump_file.write((char*)&carr_nco_hz, sizeof(float));
|
d_dump_file.write((char*)&carr_error_filt_hz, sizeof(float));
|
||||||
|
|
||||||
//DLL commands
|
//DLL commands
|
||||||
d_dump_file.write((char*)&tmp_float, sizeof(float));
|
d_dump_file.write((char*)&tmp_float, sizeof(float));
|
||||||
d_dump_file.write((char*)&code_nco_chips, sizeof(float));
|
d_dump_file.write((char*)&code_error_filt_chips, sizeof(float));
|
||||||
|
|
||||||
// CN0 and carrier lock test
|
// CN0 and carrier lock test
|
||||||
d_dump_file.write((char*)&d_CN0_SNV_dB_Hz, sizeof(float));
|
d_dump_file.write((char*)&d_CN0_SNV_dB_Hz, sizeof(float));
|
||||||
|
@@ -47,8 +47,6 @@
|
|||||||
|
|
||||||
#include "concurrent_queue.h"
|
#include "concurrent_queue.h"
|
||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
#include "tracking_2nd_DLL_filter.h"
|
|
||||||
#include "tracking_2nd_PLL_filter.h"
|
|
||||||
#include "correlator.h"
|
#include "correlator.h"
|
||||||
#include "tcp_communication.h"
|
#include "tcp_communication.h"
|
||||||
|
|
||||||
@@ -139,8 +137,6 @@ private:
|
|||||||
float d_early_late_spc_chips;
|
float d_early_late_spc_chips;
|
||||||
float d_very_early_late_spc_chips;
|
float d_very_early_late_spc_chips;
|
||||||
|
|
||||||
float d_code_phase_step_chips;
|
|
||||||
|
|
||||||
gr_complex* d_ca_code;
|
gr_complex* d_ca_code;
|
||||||
|
|
||||||
gr_complex* d_very_early_code;
|
gr_complex* d_very_early_code;
|
||||||
@@ -161,10 +157,6 @@ private:
|
|||||||
float d_next_rem_code_phase_samples;
|
float d_next_rem_code_phase_samples;
|
||||||
float d_rem_carr_phase_rad;
|
float d_rem_carr_phase_rad;
|
||||||
|
|
||||||
// PLL and DLL filter library
|
|
||||||
Tracking_2nd_DLL_filter d_code_loop_filter;
|
|
||||||
Tracking_2nd_PLL_filter d_carrier_loop_filter;
|
|
||||||
|
|
||||||
// acquisition
|
// acquisition
|
||||||
float d_acq_code_phase_samples;
|
float d_acq_code_phase_samples;
|
||||||
float d_acq_carrier_doppler_hz;
|
float d_acq_carrier_doppler_hz;
|
||||||
@@ -173,9 +165,10 @@ private:
|
|||||||
Correlator d_correlator;
|
Correlator d_correlator;
|
||||||
|
|
||||||
// tracking vars
|
// tracking vars
|
||||||
float d_code_freq_hz;
|
float d_code_freq_chips;
|
||||||
float d_carrier_doppler_hz;
|
float d_carrier_doppler_hz;
|
||||||
float d_acc_carrier_phase_rad;
|
float d_acc_carrier_phase_rad;
|
||||||
|
float d_acc_code_phase_secs;
|
||||||
float d_code_phase_samples;
|
float d_code_phase_samples;
|
||||||
size_t d_port_ch0;
|
size_t d_port_ch0;
|
||||||
size_t d_port;
|
size_t d_port;
|
||||||
|
Reference in New Issue
Block a user