mirror of https://github.com/gnss-sdr/gnss-sdr
Minor changes
This commit is contained in:
parent
026f2eea84
commit
74e8af01f9
|
@ -37,8 +37,8 @@
|
||||||
#include "dll_pll_veml_tracking.h"
|
#include "dll_pll_veml_tracking.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <algorithm>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
@ -95,7 +95,10 @@ dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(
|
||||||
void dll_pll_veml_tracking::forecast(int noutput_items,
|
void dll_pll_veml_tracking::forecast(int noutput_items,
|
||||||
gr_vector_int &ninput_items_required)
|
gr_vector_int &ninput_items_required)
|
||||||
{
|
{
|
||||||
if (noutput_items != 0) { ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; }
|
if (noutput_items != 0)
|
||||||
|
{
|
||||||
|
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,8 +108,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
float pll_bw_narrow_hz, float dll_bw_narrow_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_chips, float very_early_late_space_chips,
|
||||||
float early_late_space_narrow_chips, float very_early_late_space_narrow_chips,
|
float early_late_space_narrow_chips, float very_early_late_space_narrow_chips,
|
||||||
int extend_correlation_symbols, bool track_pilot, char system, char signal[3], bool veml):
|
int extend_correlation_symbols, bool track_pilot, char system, char signal[3], bool veml) : gr::block("dll_pll_veml_tracking", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||||
gr::block("dll_pll_veml_tracking", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
|
||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||||
{
|
{
|
||||||
// Telemetry bit synchronization message port input
|
// Telemetry bit synchronization message port input
|
||||||
|
@ -117,6 +119,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
// initialize internal vars
|
// initialize internal vars
|
||||||
d_dump = dump;
|
d_dump = dump;
|
||||||
d_veml = veml;
|
d_veml = veml;
|
||||||
|
d_track_pilot = track_pilot;
|
||||||
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;
|
||||||
|
@ -124,33 +127,42 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
d_code_chip_rate = 0.0;
|
d_code_chip_rate = 0.0;
|
||||||
d_signal_carrier_freq = 0.0;
|
d_signal_carrier_freq = 0.0;
|
||||||
d_code_length_chips = 0;
|
d_code_length_chips = 0;
|
||||||
|
d_secondary = false;
|
||||||
|
d_secondary_code_length = 0;
|
||||||
|
d_secondary_code_string = nullptr;
|
||||||
if((system - 'G') == 0)
|
d_correlation_length_ms = 0;
|
||||||
|
signal_type = std::string(signal);
|
||||||
|
if (system == 'G')
|
||||||
{
|
{
|
||||||
systemName["G"] = std::string("GPS");
|
systemName = "GPS";
|
||||||
sys = "G";
|
if (signal_type.compare("1C") == 0)
|
||||||
if(std::string(signal).compare("1C") == 0)
|
|
||||||
{
|
{
|
||||||
d_signal_carrier_freq = GPS_L1_FREQ_HZ;
|
d_signal_carrier_freq = GPS_L1_FREQ_HZ;
|
||||||
d_code_period = GPS_L1_CA_CODE_PERIOD;
|
d_code_period = GPS_L1_CA_CODE_PERIOD;
|
||||||
d_code_chip_rate = GPS_L1_CA_CODE_RATE_HZ;
|
d_code_chip_rate = GPS_L1_CA_CODE_RATE_HZ;
|
||||||
|
d_correlation_length_ms = 1;
|
||||||
d_code_length_chips = static_cast<unsigned int>(GPS_L1_CA_CODE_LENGTH_CHIPS);
|
d_code_length_chips = static_cast<unsigned int>(GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||||
|
d_secondary = false;
|
||||||
|
d_track_pilot = false;
|
||||||
}
|
}
|
||||||
else if(std::string(signal).compare("2S") == 0)
|
else if (signal_type.compare("2S") == 0)
|
||||||
{
|
{
|
||||||
d_signal_carrier_freq = GPS_L2_FREQ_HZ;
|
d_signal_carrier_freq = GPS_L2_FREQ_HZ;
|
||||||
d_code_period = GPS_L2_M_PERIOD;
|
d_code_period = GPS_L2_M_PERIOD;
|
||||||
d_code_chip_rate = GPS_L2_M_CODE_RATE_HZ;
|
d_code_chip_rate = GPS_L2_M_CODE_RATE_HZ;
|
||||||
d_code_length_chips = static_cast<unsigned int>(GPS_L2_M_CODE_LENGTH_CHIPS);
|
d_code_length_chips = static_cast<unsigned int>(GPS_L2_M_CODE_LENGTH_CHIPS);
|
||||||
|
d_correlation_length_ms = 20;
|
||||||
|
d_secondary = false;
|
||||||
|
d_track_pilot = false;
|
||||||
}
|
}
|
||||||
else if(std::string(signal).compare("L5") == 0)
|
else if (signal_type.compare("L5") == 0)
|
||||||
{
|
{
|
||||||
d_signal_carrier_freq = GPS_L5_FREQ_HZ;
|
d_signal_carrier_freq = GPS_L5_FREQ_HZ;
|
||||||
d_code_period = GPS_L5i_PERIOD;
|
d_code_period = GPS_L5i_PERIOD;
|
||||||
d_code_chip_rate = GPS_L5i_CODE_RATE_HZ;
|
d_code_chip_rate = GPS_L5i_CODE_RATE_HZ;
|
||||||
|
d_correlation_length_ms = 1;
|
||||||
d_code_length_chips = static_cast<unsigned int>(GPS_L5i_CODE_LENGTH_CHIPS);
|
d_code_length_chips = static_cast<unsigned int>(GPS_L5i_CODE_LENGTH_CHIPS);
|
||||||
|
d_secondary = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -158,23 +170,44 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
std::cout << "Invalid Signal argument when instantiating tracking blocks" << std::endl;
|
std::cout << "Invalid Signal argument when instantiating tracking blocks" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if((system - 'E') == 0)
|
else if (system == 'E')
|
||||||
{
|
{
|
||||||
systemName["E"] = std::string("Galileo");
|
systemName = "Galileo";
|
||||||
sys = "E";
|
if (signal_type.compare("1B") == 0)
|
||||||
if(std::string(signal).compare("1B") == 0)
|
|
||||||
{
|
{
|
||||||
d_signal_carrier_freq = Galileo_E1_FREQ_HZ;
|
d_signal_carrier_freq = Galileo_E1_FREQ_HZ;
|
||||||
d_code_period = Galileo_E1_CODE_PERIOD;
|
d_code_period = Galileo_E1_CODE_PERIOD;
|
||||||
d_code_chip_rate = Galileo_E1_CODE_CHIP_RATE_HZ;
|
d_code_chip_rate = Galileo_E1_CODE_CHIP_RATE_HZ;
|
||||||
d_code_length_chips = static_cast<unsigned int>(Galileo_E1_B_CODE_LENGTH_CHIPS);
|
d_code_length_chips = static_cast<unsigned int>(Galileo_E1_B_CODE_LENGTH_CHIPS);
|
||||||
|
d_correlation_length_ms = 4;
|
||||||
|
d_secondary = true;
|
||||||
|
if (d_track_pilot)
|
||||||
|
{
|
||||||
|
d_secondary_code_length = static_cast<unsigned int>(Galileo_E1_C_SECONDARY_CODE_LENGTH);
|
||||||
|
d_secondary_code_string = const_cast<std::string *>(&Galileo_E1_C_SECONDARY_CODE);
|
||||||
}
|
}
|
||||||
else if(std::string(signal).compare("5X") == 0)
|
else
|
||||||
|
{
|
||||||
|
d_secondary = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (signal_type.compare("5X") == 0)
|
||||||
{
|
{
|
||||||
d_signal_carrier_freq = Galileo_E5a_FREQ_HZ;
|
d_signal_carrier_freq = Galileo_E5a_FREQ_HZ;
|
||||||
d_code_period = GALILEO_E5a_CODE_PERIOD;
|
d_code_period = GALILEO_E5a_CODE_PERIOD;
|
||||||
d_code_chip_rate = Galileo_E5a_CODE_CHIP_RATE_HZ;
|
d_code_chip_rate = Galileo_E5a_CODE_CHIP_RATE_HZ;
|
||||||
|
d_correlation_length_ms = 1;
|
||||||
d_code_length_chips = static_cast<unsigned int>(Galileo_E5a_CODE_LENGTH_CHIPS);
|
d_code_length_chips = static_cast<unsigned int>(Galileo_E5a_CODE_LENGTH_CHIPS);
|
||||||
|
d_secondary = true;
|
||||||
|
if (d_track_pilot)
|
||||||
|
{
|
||||||
|
d_secondary_code_length = static_cast<unsigned int>(Galileo_E5a_Q_SECONDARY_CODE_LENGTH);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_secondary_code_length = static_cast<unsigned int>(Galileo_E5a_I_SECONDARY_CODE_LENGTH);
|
||||||
|
d_secondary_code_string = const_cast<std::string *>(&Galileo_E5a_I_SECONDARY_CODE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -189,7 +222,6 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
d_code_loop_filter = Tracking_2nd_DLL_filter(d_code_period);
|
d_code_loop_filter = Tracking_2nd_DLL_filter(d_code_period);
|
||||||
d_carrier_loop_filter = Tracking_2nd_PLL_filter(d_code_period);
|
d_carrier_loop_filter = Tracking_2nd_PLL_filter(d_code_period);
|
||||||
|
|
||||||
|
@ -215,16 +247,21 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
d_tracking_code = static_cast<float *>(volk_gnsssdr_malloc(2 * d_code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
|
d_tracking_code = static_cast<float *>(volk_gnsssdr_malloc(2 * d_code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
|
|
||||||
// correlator outputs (scalar)
|
// correlator outputs (scalar)
|
||||||
if(d_veml) { d_n_correlator_taps = 5; } // Very-Early, Early, Prompt, Late, Very-Late
|
if (d_veml)
|
||||||
else { d_n_correlator_taps = 3; }
|
{
|
||||||
|
// Very-Early, Early, Prompt, Late, Very-Late
|
||||||
|
d_n_correlator_taps = 5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Early, Prompt, Late
|
||||||
|
d_n_correlator_taps = 3;
|
||||||
|
}
|
||||||
|
|
||||||
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), 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()));
|
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
|
std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||||
|
|
||||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
|
||||||
{
|
|
||||||
d_correlator_outs[n] = gr_complex(0,0);
|
|
||||||
}
|
|
||||||
// map memory pointers of correlator outputs
|
// map memory pointers of correlator outputs
|
||||||
if (d_veml)
|
if (d_veml)
|
||||||
{
|
{
|
||||||
|
@ -238,7 +275,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
d_local_code_shift_chips[2] = 0.0;
|
d_local_code_shift_chips[2] = 0.0;
|
||||||
d_local_code_shift_chips[3] = d_early_late_spc_chips;
|
d_local_code_shift_chips[3] = d_early_late_spc_chips;
|
||||||
d_local_code_shift_chips[4] = d_very_early_late_spc_chips;
|
d_local_code_shift_chips[4] = d_very_early_late_spc_chips;
|
||||||
|
d_null_shift = &d_local_code_shift_chips[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -250,6 +287,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
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[1] = 0.0;
|
||||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||||
|
d_null_shift = &d_local_code_shift_chips[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
d_correlation_length_samples = d_vector_length;
|
d_correlation_length_samples = d_vector_length;
|
||||||
|
@ -257,7 +295,6 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
|
|
||||||
d_extend_correlation_symbols = extend_correlation_symbols;
|
d_extend_correlation_symbols = extend_correlation_symbols;
|
||||||
// Enable Data component prompt correlator (slave to Pilot prompt) if tracking uses Pilot signal
|
// Enable Data component prompt correlator (slave to Pilot prompt) if tracking uses Pilot signal
|
||||||
d_track_pilot = track_pilot;
|
|
||||||
if (d_track_pilot)
|
if (d_track_pilot)
|
||||||
{
|
{
|
||||||
// extended integration control
|
// extended integration control
|
||||||
|
@ -270,11 +307,9 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
d_enable_extended_integration = false;
|
d_enable_extended_integration = false;
|
||||||
}
|
}
|
||||||
// Extra correlator for the data component
|
// Extra correlator for the data component
|
||||||
d_local_code_data_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(sizeof(float), volk_gnsssdr_get_alignment()));
|
|
||||||
d_local_code_data_shift_chips[0] = 0.0;
|
|
||||||
correlator_data_cpu.init(2 * d_correlation_length_samples, 1);
|
correlator_data_cpu.init(2 * d_correlation_length_samples, 1);
|
||||||
d_Prompt_Data = static_cast<gr_complex *>(volk_gnsssdr_malloc(sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
d_Prompt_Data = static_cast<gr_complex *>(volk_gnsssdr_malloc(sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||||
d_Prompt_Data[0] = gr_complex(0,0);
|
d_Prompt_Data[0] = gr_complex(0.0, 0.0);
|
||||||
d_data_code = static_cast<float *>(volk_gnsssdr_malloc(2 * d_code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
|
d_data_code = static_cast<float *>(volk_gnsssdr_malloc(2 * d_code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -283,7 +318,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
d_enable_extended_integration = false;
|
d_enable_extended_integration = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--- Initializations ------------------------------
|
//--- Initializations ---//
|
||||||
// Initial code frequency basis of NCO
|
// Initial code frequency basis of NCO
|
||||||
d_code_freq_chips = d_code_chip_rate;
|
d_code_freq_chips = d_code_chip_rate;
|
||||||
// Residual code phase (in chips)
|
// Residual code phase (in chips)
|
||||||
|
@ -293,7 +328,6 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(
|
||||||
|
|
||||||
// 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_current_prn_length_samples = static_cast<int>(d_vector_length);
|
d_current_prn_length_samples = static_cast<int>(d_vector_length);
|
||||||
|
@ -358,7 +392,7 @@ void dll_pll_veml_tracking::start_tracking()
|
||||||
double corrected_acq_phase_samples = fmod(d_acq_code_phase_samples + T_prn_diff_seconds * N_prn_diff * d_fs_in, T_prn_true_samples);
|
double corrected_acq_phase_samples = fmod(d_acq_code_phase_samples + T_prn_diff_seconds * N_prn_diff * d_fs_in, T_prn_true_samples);
|
||||||
if (corrected_acq_phase_samples < 0.0)
|
if (corrected_acq_phase_samples < 0.0)
|
||||||
{
|
{
|
||||||
corrected_acq_phase_samples = T_prn_mod_samples + corrected_acq_phase_samples;
|
corrected_acq_phase_samples += T_prn_mod_samples;
|
||||||
}
|
}
|
||||||
double delay_correction_samples = d_acq_code_phase_samples - corrected_acq_phase_samples;
|
double delay_correction_samples = d_acq_code_phase_samples - corrected_acq_phase_samples;
|
||||||
|
|
||||||
|
@ -378,8 +412,8 @@ void dll_pll_veml_tracking::start_tracking()
|
||||||
d_acquisition_gnss_synchro->PRN, Galileo_E1_CODE_CHIP_RATE_HZ, 0);
|
d_acquisition_gnss_synchro->PRN, Galileo_E1_CODE_CHIP_RATE_HZ, 0);
|
||||||
galileo_e1_code_gen_float_sampled(d_data_code, d_acquisition_gnss_synchro->Signal, false,
|
galileo_e1_code_gen_float_sampled(d_data_code, d_acquisition_gnss_synchro->Signal, false,
|
||||||
d_acquisition_gnss_synchro->PRN, Galileo_E1_CODE_CHIP_RATE_HZ, 0);
|
d_acquisition_gnss_synchro->PRN, Galileo_E1_CODE_CHIP_RATE_HZ, 0);
|
||||||
d_Prompt_Data[0] = gr_complex(0,0);
|
d_Prompt_Data[0] = gr_complex(0.0, 0.0);
|
||||||
correlator_data_cpu.set_local_code_and_taps(d_code_length_chips, d_data_code, d_local_code_shift_chips);
|
correlator_data_cpu.set_local_code_and_taps(d_code_length_chips, d_data_code, d_null_shift);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -388,10 +422,7 @@ void dll_pll_veml_tracking::start_tracking()
|
||||||
}
|
}
|
||||||
|
|
||||||
multicorrelator_cpu.set_local_code_and_taps(d_code_length_chips, d_tracking_code, d_local_code_shift_chips);
|
multicorrelator_cpu.set_local_code_and_taps(d_code_length_chips, d_tracking_code, d_local_code_shift_chips);
|
||||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0));
|
||||||
{
|
|
||||||
d_correlator_outs[n] = gr_complex(0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -402,8 +433,8 @@ void dll_pll_veml_tracking::start_tracking()
|
||||||
d_code_phase_samples = d_acq_code_phase_samples;
|
d_code_phase_samples = d_acq_code_phase_samples;
|
||||||
|
|
||||||
// DEBUG OUTPUT
|
// 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;
|
std::cout << "Tracking of " << systemName << " " << signal_type << " signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||||
LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel;
|
LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel;
|
||||||
|
|
||||||
// enable tracking pull-in
|
// enable tracking pull-in
|
||||||
d_state = 1;
|
d_state = 1;
|
||||||
|
@ -448,7 +479,6 @@ dll_pll_veml_tracking::~dll_pll_veml_tracking()
|
||||||
{
|
{
|
||||||
volk_gnsssdr_free(d_Prompt_Data);
|
volk_gnsssdr_free(d_Prompt_Data);
|
||||||
volk_gnsssdr_free(d_data_code);
|
volk_gnsssdr_free(d_data_code);
|
||||||
volk_gnsssdr_free(d_local_code_data_shift_chips);
|
|
||||||
correlator_data_cpu.free();
|
correlator_data_cpu.free();
|
||||||
}
|
}
|
||||||
delete[] d_Prompt_buffer;
|
delete[] d_Prompt_buffer;
|
||||||
|
@ -465,11 +495,11 @@ bool dll_pll_veml_tracking::acquire_secondary()
|
||||||
{
|
{
|
||||||
//******* preamble correlation ********
|
//******* preamble correlation ********
|
||||||
int corr_value = 0;
|
int corr_value = 0;
|
||||||
for (unsigned int i = 0; i < Galileo_E1_C_SECONDARY_CODE_LENGTH; i++)
|
for (unsigned int i = 0; i < d_secondary_code_length; i++)
|
||||||
{
|
{
|
||||||
if (d_Prompt_buffer_deque.at(i).real() < 0) // symbols clipping
|
if (d_Prompt_buffer_deque.at(i).real() < 0.0) // symbols clipping
|
||||||
{
|
{
|
||||||
if (Galileo_E1_C_SECONDARY_CODE.at(i) == '0')
|
if (d_secondary_code_string->at(i) == '0')
|
||||||
{
|
{
|
||||||
corr_value++;
|
corr_value++;
|
||||||
}
|
}
|
||||||
|
@ -480,7 +510,7 @@ bool dll_pll_veml_tracking::acquire_secondary()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Galileo_E1_C_SECONDARY_CODE.at(i) == '0')
|
if (d_secondary_code_string->at(i) == '0')
|
||||||
{
|
{
|
||||||
corr_value--;
|
corr_value--;
|
||||||
}
|
}
|
||||||
|
@ -491,7 +521,7 @@ bool dll_pll_veml_tracking::acquire_secondary()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abs(corr_value) == Galileo_E1_C_SECONDARY_CODE_LENGTH)
|
if (abs(corr_value) == d_secondary_code_length)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -516,7 +546,7 @@ bool dll_pll_veml_tracking::cn0_and_tracking_lock_status()
|
||||||
{
|
{
|
||||||
d_cn0_estimation_counter = 0;
|
d_cn0_estimation_counter = 0;
|
||||||
// Code lock indicator
|
// Code lock indicator
|
||||||
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, DLL_PLL_CN0_ESTIMATION_SAMPLES, d_fs_in, Galileo_E1_B_CODE_LENGTH_CHIPS);
|
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, DLL_PLL_CN0_ESTIMATION_SAMPLES, d_fs_in, static_cast<double>(d_code_length_chips));
|
||||||
// Carrier lock indicator
|
// Carrier lock indicator
|
||||||
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, DLL_PLL_CN0_ESTIMATION_SAMPLES);
|
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, DLL_PLL_CN0_ESTIMATION_SAMPLES);
|
||||||
// Loss of lock detection
|
// Loss of lock detection
|
||||||
|
@ -595,7 +625,7 @@ void dll_pll_veml_tracking::run_dll_pll(bool disable_costas_loop)
|
||||||
// New carrier Doppler frequency estimation
|
// New carrier Doppler frequency estimation
|
||||||
d_carrier_doppler_hz = d_acq_carrier_doppler_hz + d_carr_error_filt_hz;
|
d_carrier_doppler_hz = d_acq_carrier_doppler_hz + d_carr_error_filt_hz;
|
||||||
// New code Doppler frequency estimation
|
// 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);
|
d_code_freq_chips = (1.0 + d_carrier_doppler_hz / d_signal_carrier_freq) * d_code_chip_rate;
|
||||||
|
|
||||||
// ################## DLL ##########################################################
|
// ################## DLL ##########################################################
|
||||||
// DLL discriminator
|
// DLL discriminator
|
||||||
|
@ -607,11 +637,14 @@ void dll_pll_veml_tracking::run_dll_pll(bool disable_costas_loop)
|
||||||
|
|
||||||
void dll_pll_veml_tracking::clear_tracking_vars()
|
void dll_pll_veml_tracking::clear_tracking_vars()
|
||||||
{
|
{
|
||||||
*d_Very_Early = gr_complex(0,0);
|
if (d_veml)
|
||||||
*d_Early = gr_complex(0,0);
|
{
|
||||||
*d_Prompt = gr_complex(0,0);
|
*d_Very_Early = gr_complex(0.0, 0.0);
|
||||||
*d_Late = gr_complex(0,0);
|
*d_Very_Late = gr_complex(0.0, 0.0);
|
||||||
*d_Very_Late= gr_complex(0,0);
|
}
|
||||||
|
*d_Early = gr_complex(0.0, 0.0);
|
||||||
|
*d_Prompt = gr_complex(0.0, 0.0);
|
||||||
|
*d_Late = gr_complex(0.0, 0.0);
|
||||||
d_carr_error_hz = 0.0;
|
d_carr_error_hz = 0.0;
|
||||||
d_carr_error_filt_hz = 0.0;
|
d_carr_error_filt_hz = 0.0;
|
||||||
d_code_error_chips = 0.0;
|
d_code_error_chips = 0.0;
|
||||||
|
@ -634,11 +667,19 @@ void dll_pll_veml_tracking::log_data()
|
||||||
prompt_I = static_cast<double>(d_P_accu.real());
|
prompt_I = static_cast<double>(d_P_accu.real());
|
||||||
prompt_Q = static_cast<double>(d_P_accu.imag());
|
prompt_Q = static_cast<double>(d_P_accu.imag());
|
||||||
|
|
||||||
|
if (d_veml)
|
||||||
|
{
|
||||||
tmp_VE = std::abs<float>(d_VE_accu);
|
tmp_VE = std::abs<float>(d_VE_accu);
|
||||||
|
tmp_VL = std::abs<float>(d_VL_accu);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmp_VE = 0.0;
|
||||||
|
tmp_VL = 0.0;
|
||||||
|
}
|
||||||
tmp_E = std::abs<float>(d_E_accu);
|
tmp_E = std::abs<float>(d_E_accu);
|
||||||
tmp_P = std::abs<float>(d_P_accu);
|
tmp_P = std::abs<float>(d_P_accu);
|
||||||
tmp_L = std::abs<float>(d_L_accu);
|
tmp_L = std::abs<float>(d_L_accu);
|
||||||
tmp_VL = std::abs<float>(d_VL_accu);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -697,87 +738,77 @@ int dll_pll_veml_tracking::general_work (int noutput_items __attribute__((unused
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
gr::thread::scoped_lock l(d_setlock);
|
gr::thread::scoped_lock l(d_setlock);
|
||||||
|
|
||||||
// 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 **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
|
||||||
Gnss_Synchro current_synchro_data = Gnss_Synchro();
|
Gnss_Synchro current_synchro_data = Gnss_Synchro();
|
||||||
|
|
||||||
switch (d_state)
|
switch (d_state)
|
||||||
{
|
{
|
||||||
case 0: // standby - bypass
|
case 0: // Standby - Pass Through
|
||||||
{
|
{
|
||||||
current_synchro_data.Tracking_sample_counter = d_sample_counter;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: // pull-in
|
case 1: // Pull-in
|
||||||
{
|
{
|
||||||
/*
|
// Signal alignment (skip samples until the incoming signal is aligned with local replica)
|
||||||
* Signal alignment (skip samples until the incoming signal is aligned with local replica)
|
|
||||||
*/
|
|
||||||
// Fill the acquisition data
|
// Fill the acquisition data
|
||||||
current_synchro_data = *d_acquisition_gnss_synchro;
|
int acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
|
||||||
int samples_offset;
|
double acq_trk_shif_correction_samples = d_current_prn_length_samples - std::fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_current_prn_length_samples));
|
||||||
double acq_trk_shif_correction_samples;
|
int samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||||
int acq_to_trk_delay_samples;
|
d_sample_counter += samples_offset; // count for the processed samples
|
||||||
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
|
|
||||||
acq_trk_shif_correction_samples = d_current_prn_length_samples - std::fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(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;
|
|
||||||
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
|
|
||||||
consume_each(samples_offset); // shift input to perform alignment with local replica
|
consume_each(samples_offset); // shift input to perform alignment with local replica
|
||||||
d_state = 2; // next state is the symbol synchronization
|
d_state = 2; // next state is the symbol synchronization
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case 2: // wide tracking and symbol synchronization
|
case 2: // Wide tracking and symbol synchronization
|
||||||
{
|
{
|
||||||
// Fill the acquisition data
|
// Fill the acquisition data
|
||||||
current_synchro_data = *d_acquisition_gnss_synchro;
|
current_synchro_data = *d_acquisition_gnss_synchro;
|
||||||
// Current NCO and code generator parameters
|
// Current NCO and code generator parameters
|
||||||
d_carrier_phase_step_rad = GALILEO_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
d_carrier_phase_step_rad = GALILEO_TWO_PI * d_carrier_doppler_hz / d_fs_in;
|
||||||
d_code_phase_step_chips = d_code_freq_chips / static_cast<double>(d_fs_in);
|
d_code_phase_step_chips = d_code_freq_chips / d_fs_in;
|
||||||
d_rem_code_phase_chips = d_rem_code_phase_samples * d_code_freq_chips / d_fs_in;
|
d_rem_code_phase_chips = d_rem_code_phase_samples * d_code_phase_step_chips;
|
||||||
// perform a correlation step
|
// Perform a correlation step
|
||||||
do_correlation_step(in);
|
do_correlation_step(in);
|
||||||
// save single correlation step variables
|
// Save single correlation step variables
|
||||||
|
if (d_veml)
|
||||||
|
{
|
||||||
d_VE_accu = *d_Very_Early;
|
d_VE_accu = *d_Very_Early;
|
||||||
|
d_VL_accu = *d_Very_Late;
|
||||||
|
}
|
||||||
d_E_accu = *d_Early;
|
d_E_accu = *d_Early;
|
||||||
d_P_accu = *d_Prompt;
|
d_P_accu = *d_Prompt;
|
||||||
d_L_accu = *d_Late;
|
d_L_accu = *d_Late;
|
||||||
d_VL_accu = *d_Very_Late;
|
|
||||||
// check lock status
|
// Check lock status
|
||||||
if (cn0_and_tracking_lock_status() == false)
|
if (!cn0_and_tracking_lock_status())
|
||||||
{
|
{
|
||||||
clear_tracking_vars();
|
clear_tracking_vars();
|
||||||
d_state = 0; // loss-of-lock detected
|
d_state = 0; // loss-of-lock detected
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// perform DLL/PLL tracking loop computations
|
// Perform DLL/PLL tracking loop computations
|
||||||
run_dll_pll(false);
|
run_dll_pll(false);
|
||||||
|
|
||||||
// ################## PLL COMMANDS #################################################
|
// ################## PLL COMMANDS #################################################
|
||||||
// carrier phase accumulator for (K) Doppler estimation-
|
// carrier phase accumulator for (K) Doppler estimation-
|
||||||
d_acc_carrier_phase_rad -= GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / static_cast<double>(d_fs_in);
|
d_acc_carrier_phase_rad -= GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / d_fs_in;
|
||||||
// remnant carrier phase to prevent overflow in the code NCO
|
// remanent carrier phase to prevent overflow in the code NCO
|
||||||
d_rem_carr_phase_rad = d_rem_carr_phase_rad + GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / static_cast<double>(d_fs_in);
|
d_rem_carr_phase_rad = d_rem_carr_phase_rad + GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / d_fs_in;
|
||||||
d_rem_carr_phase_rad = std::fmod(d_rem_carr_phase_rad, GALILEO_TWO_PI);
|
d_rem_carr_phase_rad = std::fmod(d_rem_carr_phase_rad, GALILEO_TWO_PI);
|
||||||
|
|
||||||
// ################## DLL COMMANDS #################################################
|
// ################## DLL COMMANDS #################################################
|
||||||
// Code error from DLL
|
// Code error from DLL
|
||||||
double code_error_filt_secs;
|
double code_error_filt_secs = d_code_period * d_code_error_filt_chips / d_code_chip_rate; // [seconds]
|
||||||
code_error_filt_secs = (Galileo_E1_CODE_PERIOD * d_code_error_filt_chips) / Galileo_E1_CODE_CHIP_RATE_HZ; // [seconds]
|
|
||||||
|
|
||||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||||
// keep alignment parameters for the next input buffer
|
// keep alignment parameters for the next input buffer
|
||||||
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
|
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
|
||||||
double T_chip_seconds = 1.0 / d_code_freq_chips;
|
double T_chip_seconds = 1.0 / d_code_freq_chips;
|
||||||
double T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
double T_prn_seconds = T_chip_seconds * static_cast<double>(d_code_length_chips);
|
||||||
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
|
double T_prn_samples = T_prn_seconds * 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);
|
double K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * 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
|
||||||
|
|
||||||
// ########### Output the tracking results to Telemetry block ##########
|
// ########### Output the tracking results to Telemetry block ##########
|
||||||
|
@ -791,7 +822,6 @@ int dll_pll_veml_tracking::general_work (int noutput_items __attribute__((unused
|
||||||
current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt).real());
|
current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt).real());
|
||||||
current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt).imag());
|
current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt).imag());
|
||||||
}
|
}
|
||||||
current_synchro_data.Tracking_sample_counter = d_sample_counter;
|
|
||||||
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
||||||
// compute remnant code phase samples AFTER the Tracking timestamp
|
// 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
|
||||||
|
@ -799,50 +829,53 @@ int dll_pll_veml_tracking::general_work (int noutput_items __attribute__((unused
|
||||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||||
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
||||||
current_synchro_data.Flag_valid_symbol_output = true;
|
current_synchro_data.Flag_valid_symbol_output = true;
|
||||||
current_synchro_data.correlation_length_ms = Galileo_E1_CODE_PERIOD_MS;
|
current_synchro_data.correlation_length_ms = d_correlation_length_ms;
|
||||||
|
|
||||||
// enable write dump file this cycle (valid DLL/PLL cycle)
|
// enable write dump file this cycle (valid DLL/PLL cycle)
|
||||||
log_data();
|
log_data();
|
||||||
|
|
||||||
//std::cout<<(d_Prompt->real()>0);
|
|
||||||
if (d_enable_extended_integration)
|
if (d_enable_extended_integration)
|
||||||
{
|
{
|
||||||
// ####### SECONDARY CODE LOCK #####
|
// ####### SECONDARY CODE LOCK #####
|
||||||
d_Prompt_buffer_deque.push_back(*d_Prompt);
|
d_Prompt_buffer_deque.push_back(*d_Prompt);
|
||||||
if (d_Prompt_buffer_deque.size() == Galileo_E1_C_SECONDARY_CODE_LENGTH)
|
if (d_Prompt_buffer_deque.size() == d_secondary_code_length)
|
||||||
{
|
{
|
||||||
if (acquire_secondary() == true)
|
if (acquire_secondary())
|
||||||
{
|
{
|
||||||
d_extend_correlation_symbols_count = 0;
|
d_extend_correlation_symbols_count = 0;
|
||||||
// reset extended correlator
|
// reset extended correlator
|
||||||
d_VE_accu = gr_complex(0,0);
|
d_VE_accu = gr_complex(0.0, 0.0);
|
||||||
d_E_accu = gr_complex(0,0);
|
d_E_accu = gr_complex(0.0, 0.0);
|
||||||
d_P_accu = gr_complex(0,0);
|
d_P_accu = gr_complex(0.0, 0.0);
|
||||||
d_L_accu = gr_complex(0,0);
|
d_L_accu = gr_complex(0.0, 0.0);
|
||||||
d_VL_accu = gr_complex(0,0);
|
d_VL_accu = gr_complex(0.0, 0.0);
|
||||||
d_Prompt_buffer_deque.clear();
|
d_Prompt_buffer_deque.clear();
|
||||||
d_current_symbol = 0;
|
d_current_symbol = 0;
|
||||||
d_code_loop_filter.set_DLL_BW(d_dll_bw_narrow_hz);
|
d_code_loop_filter.set_DLL_BW(d_dll_bw_narrow_hz);
|
||||||
d_carrier_loop_filter.set_PLL_BW(d_pll_bw_narrow_hz);
|
d_carrier_loop_filter.set_PLL_BW(d_pll_bw_narrow_hz);
|
||||||
|
|
||||||
// Set TAPs delay values [chips]
|
// Set narrow taps delay values [chips]
|
||||||
|
if (d_veml)
|
||||||
|
{
|
||||||
d_local_code_shift_chips[0] = -d_very_early_late_spc_narrow_chips;
|
d_local_code_shift_chips[0] = -d_very_early_late_spc_narrow_chips;
|
||||||
d_local_code_shift_chips[1] = -d_early_late_spc_narrow_chips;
|
d_local_code_shift_chips[1] = -d_early_late_spc_narrow_chips;
|
||||||
d_local_code_shift_chips[2] = 0.0;
|
|
||||||
d_local_code_shift_chips[3] = d_early_late_spc_narrow_chips;
|
d_local_code_shift_chips[3] = d_early_late_spc_narrow_chips;
|
||||||
d_local_code_shift_chips[4] = d_very_early_late_spc_narrow_chips;
|
d_local_code_shift_chips[4] = d_very_early_late_spc_narrow_chips;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_local_code_shift_chips[0] = -d_early_late_spc_narrow_chips;
|
||||||
|
d_local_code_shift_chips[2] = d_early_late_spc_narrow_chips;
|
||||||
|
}
|
||||||
LOG(INFO) << "Enabled " << d_extend_correlation_symbols << " [symbols] extended correlator for CH "
|
LOG(INFO) << "Enabled " << d_extend_correlation_symbols << " [symbols] extended correlator for CH "
|
||||||
<< d_channel
|
<< d_channel
|
||||||
<< " : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
|
<< " : Satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN);
|
||||||
std::cout << "Enabled " << d_extend_correlation_symbols << " [symbols] extended correlator for CH "
|
std::cout << "Enabled " << d_extend_correlation_symbols << " [symbols] extended correlator for CH "
|
||||||
<< d_channel
|
<< d_channel
|
||||||
<< " : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
|
<< " : Satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl;
|
||||||
//std::cout << " pll_bw = " << d_pll_bw_hz << " [Hz], pll_narrow_bw = " << d_pll_bw_narrow_hz << " [Hz]" << std::endl;
|
|
||||||
//std::cout << " dll_bw = " << d_dll_bw_hz << " [Hz], dll_narrow_bw = " << d_dll_bw_narrow_hz << " [Hz]" << std::endl;
|
|
||||||
|
|
||||||
// UPDATE INTEGRATION TIME
|
// UPDATE INTEGRATION TIME
|
||||||
double new_correlation_time_s = static_cast<double>(d_extend_correlation_symbols) * Galileo_E1_CODE_PERIOD;
|
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_carrier_loop_filter.set_pdi(new_correlation_time_s);
|
||||||
d_code_loop_filter.set_pdi(new_correlation_time_s);
|
d_code_loop_filter.set_pdi(new_correlation_time_s);
|
||||||
|
|
||||||
|
@ -860,31 +893,37 @@ int dll_pll_veml_tracking::general_work (int noutput_items __attribute__((unused
|
||||||
// Fill the acquisition data
|
// Fill the acquisition data
|
||||||
current_synchro_data = *d_acquisition_gnss_synchro;
|
current_synchro_data = *d_acquisition_gnss_synchro;
|
||||||
// Current NCO and code generator parameters
|
// Current NCO and code generator parameters
|
||||||
d_carrier_phase_step_rad = GALILEO_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
|
d_carrier_phase_step_rad = GALILEO_TWO_PI * d_carrier_doppler_hz / d_fs_in;
|
||||||
d_code_phase_step_chips = d_code_freq_chips / static_cast<double>(d_fs_in);
|
d_code_phase_step_chips = d_code_freq_chips / d_fs_in;
|
||||||
d_rem_code_phase_chips = d_rem_code_phase_samples * d_code_freq_chips / d_fs_in;
|
d_rem_code_phase_chips = d_rem_code_phase_samples * d_code_freq_chips / d_fs_in;
|
||||||
// perform a correlation step
|
// perform a correlation step
|
||||||
do_correlation_step(in);
|
do_correlation_step(in);
|
||||||
// correct the integration sign using the current symbol of the secondary code
|
// correct the integration sign using the current symbol of the secondary code
|
||||||
if (Galileo_E1_C_SECONDARY_CODE.at(d_current_symbol) == '0')
|
if (d_secondary_code_string->at(d_current_symbol) == '0')
|
||||||
|
{
|
||||||
|
if (d_veml)
|
||||||
{
|
{
|
||||||
d_VE_accu += *d_Very_Early;
|
d_VE_accu += *d_Very_Early;
|
||||||
|
d_VL_accu += *d_Very_Late;
|
||||||
|
}
|
||||||
d_E_accu += *d_Early;
|
d_E_accu += *d_Early;
|
||||||
d_P_accu += *d_Prompt;
|
d_P_accu += *d_Prompt;
|
||||||
d_L_accu += *d_Late;
|
d_L_accu += *d_Late;
|
||||||
d_VL_accu += *d_Very_Late;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (d_veml)
|
||||||
{
|
{
|
||||||
d_VE_accu -= *d_Very_Early;
|
d_VE_accu -= *d_Very_Early;
|
||||||
|
d_VL_accu -= *d_Very_Late;
|
||||||
|
}
|
||||||
d_E_accu -= *d_Early;
|
d_E_accu -= *d_Early;
|
||||||
d_P_accu -= *d_Prompt;
|
d_P_accu -= *d_Prompt;
|
||||||
d_L_accu -= *d_Late;
|
d_L_accu -= *d_Late;
|
||||||
d_VL_accu -= *d_Very_Late;
|
|
||||||
}
|
}
|
||||||
d_current_symbol++;
|
d_current_symbol++;
|
||||||
// secondary code roll-up
|
// secondary code roll-up
|
||||||
d_current_symbol = d_current_symbol % Galileo_E1_C_SECONDARY_CODE_LENGTH;
|
d_current_symbol %= d_secondary_code_length;
|
||||||
|
|
||||||
// PLL/DLL not enabled, we are in the middle of a coherent integration
|
// PLL/DLL not enabled, we are in the middle of a coherent integration
|
||||||
// keep alignment parameters for the next input buffer
|
// keep alignment parameters for the next input buffer
|
||||||
|
@ -892,32 +931,31 @@ int dll_pll_veml_tracking::general_work (int noutput_items __attribute__((unused
|
||||||
|
|
||||||
// ################## PLL ##########################################################
|
// ################## PLL ##########################################################
|
||||||
// carrier phase accumulator for (K) Doppler estimation-
|
// carrier phase accumulator for (K) Doppler estimation-
|
||||||
d_acc_carrier_phase_rad -= GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / static_cast<double>(d_fs_in);
|
d_acc_carrier_phase_rad -= GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / d_fs_in;
|
||||||
// remnant carrier phase to prevent overflow in the code NCO
|
// remnant carrier phase to prevent overflow in the code NCO
|
||||||
d_rem_carr_phase_rad = d_rem_carr_phase_rad + GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / static_cast<double>(d_fs_in);
|
d_rem_carr_phase_rad = d_rem_carr_phase_rad + GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / d_fs_in;
|
||||||
d_rem_carr_phase_rad = std::fmod(d_rem_carr_phase_rad, GALILEO_TWO_PI);
|
d_rem_carr_phase_rad = std::fmod(d_rem_carr_phase_rad, GALILEO_TWO_PI);
|
||||||
|
|
||||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||||
// keep alignment parameters for the next input buffer
|
// keep alignment parameters for the next input buffer
|
||||||
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
|
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
|
||||||
double T_chip_seconds = 1.0 / d_code_freq_chips;
|
double T_chip_seconds = 1.0 / d_code_freq_chips;
|
||||||
double T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
double T_prn_seconds = T_chip_seconds * static_cast<double>(d_code_length_chips);
|
||||||
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
|
double T_prn_samples = T_prn_seconds * d_fs_in;
|
||||||
double K_blk_samples = T_prn_samples + d_rem_code_phase_samples;
|
double K_blk_samples = T_prn_samples + d_rem_code_phase_samples;
|
||||||
d_current_prn_length_samples = round(K_blk_samples); //round to a discrete samples
|
d_current_prn_length_samples = static_cast<int>(round(K_blk_samples)); //round to a discrete samples
|
||||||
|
|
||||||
// ########### Output the tracking results to Telemetry block ##########
|
// ########### Output the tracking results to Telemetry block ##########
|
||||||
current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt_Data).real());
|
current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt_Data).real());
|
||||||
current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt_Data).imag());
|
current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt_Data).imag());
|
||||||
current_synchro_data.Tracking_sample_counter = d_sample_counter;
|
|
||||||
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
||||||
// compute remnant code phase samples AFTER the Tracking timestamp
|
// 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 - static_cast<double>(d_current_prn_length_samples); //rounding error < 1 sample
|
||||||
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;
|
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;
|
||||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||||
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
||||||
current_synchro_data.Flag_valid_symbol_output = true;
|
current_synchro_data.Flag_valid_symbol_output = true;
|
||||||
current_synchro_data.correlation_length_ms = Galileo_E1_CODE_PERIOD_MS;
|
current_synchro_data.correlation_length_ms = d_correlation_length_ms;
|
||||||
|
|
||||||
d_extend_correlation_symbols_count++;
|
d_extend_correlation_symbols_count++;
|
||||||
if (d_extend_correlation_symbols_count >= (d_extend_correlation_symbols - 1))
|
if (d_extend_correlation_symbols_count >= (d_extend_correlation_symbols - 1))
|
||||||
|
@ -935,28 +973,34 @@ int dll_pll_veml_tracking::general_work (int noutput_items __attribute__((unused
|
||||||
do_correlation_step(in);
|
do_correlation_step(in);
|
||||||
|
|
||||||
// correct the integration using the current symbol
|
// correct the integration using the current symbol
|
||||||
if (Galileo_E1_C_SECONDARY_CODE.at(d_current_symbol) == '0')
|
if (d_secondary_code_string->at(d_current_symbol) == '0')
|
||||||
|
{
|
||||||
|
if (d_veml)
|
||||||
{
|
{
|
||||||
d_VE_accu += *d_Very_Early;
|
d_VE_accu += *d_Very_Early;
|
||||||
|
d_VL_accu += *d_Very_Late;
|
||||||
|
}
|
||||||
d_E_accu += *d_Early;
|
d_E_accu += *d_Early;
|
||||||
d_P_accu += *d_Prompt;
|
d_P_accu += *d_Prompt;
|
||||||
d_L_accu += *d_Late;
|
d_L_accu += *d_Late;
|
||||||
d_VL_accu += *d_Very_Late;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (d_veml)
|
||||||
{
|
{
|
||||||
d_VE_accu -= *d_Very_Early;
|
d_VE_accu -= *d_Very_Early;
|
||||||
|
d_VL_accu -= *d_Very_Late;
|
||||||
|
}
|
||||||
d_E_accu -= *d_Early;
|
d_E_accu -= *d_Early;
|
||||||
d_P_accu -= *d_Prompt;
|
d_P_accu -= *d_Prompt;
|
||||||
d_L_accu -= *d_Late;
|
d_L_accu -= *d_Late;
|
||||||
d_VL_accu -= *d_Very_Late;
|
|
||||||
}
|
}
|
||||||
d_current_symbol++;
|
d_current_symbol++;
|
||||||
// secondary code roll-up
|
// secondary code roll-up
|
||||||
d_current_symbol = d_current_symbol % Galileo_E1_C_SECONDARY_CODE_LENGTH;
|
d_current_symbol %= d_secondary_code_length;
|
||||||
|
|
||||||
// check lock status
|
// check lock status
|
||||||
if (cn0_and_tracking_lock_status() == false)
|
if (!cn0_and_tracking_lock_status())
|
||||||
{
|
{
|
||||||
clear_tracking_vars();
|
clear_tracking_vars();
|
||||||
d_state = 0; // loss-of-lock detected
|
d_state = 0; // loss-of-lock detected
|
||||||
|
@ -967,45 +1011,43 @@ int dll_pll_veml_tracking::general_work (int noutput_items __attribute__((unused
|
||||||
|
|
||||||
// ################## PLL ##########################################################
|
// ################## PLL ##########################################################
|
||||||
// carrier phase accumulator for (K) Doppler estimation-
|
// carrier phase accumulator for (K) Doppler estimation-
|
||||||
d_acc_carrier_phase_rad -= GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / static_cast<double>(d_fs_in);
|
d_acc_carrier_phase_rad -= GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / d_fs_in;
|
||||||
// remnant carrier phase to prevent overflow in the code NCO
|
// remnant carrier phase to prevent overflow in the code NCO
|
||||||
d_rem_carr_phase_rad = d_rem_carr_phase_rad + GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / static_cast<double>(d_fs_in);
|
d_rem_carr_phase_rad = d_rem_carr_phase_rad + GALILEO_TWO_PI * d_carrier_doppler_hz * static_cast<double>(d_current_prn_length_samples) / d_fs_in;
|
||||||
d_rem_carr_phase_rad = std::fmod(d_rem_carr_phase_rad, GALILEO_TWO_PI);
|
d_rem_carr_phase_rad = std::fmod(d_rem_carr_phase_rad, GALILEO_TWO_PI);
|
||||||
|
|
||||||
// ################## DLL ##########################################################
|
// ################## DLL ##########################################################
|
||||||
// Code phase accumulator
|
// Code phase accumulator
|
||||||
double code_error_filt_secs;
|
double code_error_filt_secs = d_code_period * d_code_error_filt_chips / d_code_chip_rate; //[seconds]
|
||||||
code_error_filt_secs = (Galileo_E1_CODE_PERIOD * d_code_error_filt_chips) / Galileo_E1_CODE_CHIP_RATE_HZ; //[seconds]
|
|
||||||
|
|
||||||
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
|
||||||
// keep alignment parameters for the next input buffer
|
// keep alignment parameters for the next input buffer
|
||||||
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
|
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
|
||||||
double T_chip_seconds = 1.0 / d_code_freq_chips;
|
double T_chip_seconds = 1.0 / d_code_freq_chips;
|
||||||
double T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
double T_prn_seconds = T_chip_seconds * static_cast<double>(d_code_length_chips);
|
||||||
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
|
double T_prn_samples = T_prn_seconds * 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);
|
double K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * d_fs_in;
|
||||||
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
|
d_current_prn_length_samples = static_cast<int>(round(K_blk_samples)); // round to a discrete number of samples
|
||||||
|
|
||||||
// ########### Output the tracking results to Telemetry block ##########
|
// ########### Output the tracking results to Telemetry block ##########
|
||||||
current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt_Data).real());
|
current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt_Data).real());
|
||||||
current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt_Data).imag());
|
current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt_Data).imag());
|
||||||
current_synchro_data.Tracking_sample_counter = d_sample_counter;
|
|
||||||
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
|
||||||
// compute remnant code phase samples AFTER the Tracking timestamp
|
// 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 - static_cast<double>(d_current_prn_length_samples); //rounding error < 1 sample
|
||||||
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;
|
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;
|
||||||
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
|
||||||
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
|
||||||
current_synchro_data.Flag_valid_symbol_output = true;
|
current_synchro_data.Flag_valid_symbol_output = true;
|
||||||
current_synchro_data.correlation_length_ms = Galileo_E1_CODE_PERIOD_MS;
|
current_synchro_data.correlation_length_ms = d_correlation_length_ms;
|
||||||
// enable write dump file this cycle (valid DLL/PLL cycle)
|
// enable write dump file this cycle (valid DLL/PLL cycle)
|
||||||
log_data();
|
log_data();
|
||||||
// reset extended correlator
|
// reset extended correlator
|
||||||
d_VE_accu = gr_complex(0,0);
|
d_VE_accu = gr_complex(0.0, 0.0);
|
||||||
d_E_accu = gr_complex(0,0);
|
d_E_accu = gr_complex(0.0, 0.0);
|
||||||
d_P_accu = gr_complex(0,0);
|
d_P_accu = gr_complex(0.0, 0.0);
|
||||||
d_L_accu = gr_complex(0,0);
|
d_L_accu = gr_complex(0.0, 0.0);
|
||||||
d_VL_accu = gr_complex(0,0);
|
d_VL_accu = gr_complex(0.0, 0.0);
|
||||||
d_state = 3; //new coherent integration (correlation time extension) cycle
|
d_state = 3; //new coherent integration (correlation time extension) cycle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1017,14 +1059,14 @@ int dll_pll_veml_tracking::general_work (int noutput_items __attribute__((unused
|
||||||
// const char * str = str_aux.c_str(); // get a C style null terminated string
|
// 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);
|
// std::memcpy(static_cast<void*>(current_synchro_data.Signal), str, 3);
|
||||||
|
|
||||||
current_synchro_data.fs = d_fs_in;
|
consume_each(d_current_prn_length_samples);
|
||||||
*out[0] = current_synchro_data;
|
d_sample_counter += d_current_prn_length_samples;
|
||||||
|
|
||||||
consume_each(d_current_prn_length_samples); // this is required for gr_block derivates
|
|
||||||
d_sample_counter += d_current_prn_length_samples; // count for the processed samples
|
|
||||||
|
|
||||||
if (current_synchro_data.Flag_valid_symbol_output)
|
if (current_synchro_data.Flag_valid_symbol_output)
|
||||||
{
|
{
|
||||||
|
current_synchro_data.fs = static_cast<long int>(d_fs_in);
|
||||||
|
current_synchro_data.Tracking_sample_counter = d_sample_counter;
|
||||||
|
*out[0] = current_synchro_data;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1260,13 +1302,12 @@ int dll_pll_veml_tracking::save_matfile()
|
||||||
void dll_pll_veml_tracking::set_channel(unsigned int channel)
|
void dll_pll_veml_tracking::set_channel(unsigned int channel)
|
||||||
{
|
{
|
||||||
gr::thread::scoped_lock l(d_setlock);
|
gr::thread::scoped_lock l(d_setlock);
|
||||||
|
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
LOG(INFO) << "Tracking Channel set to " << d_channel;
|
LOG(INFO) << "Tracking Channel set to " << d_channel;
|
||||||
// ############# ENABLE DATA FILE LOG #################
|
// ############# ENABLE DATA FILE LOG #################
|
||||||
if (d_dump == true)
|
if (d_dump)
|
||||||
{
|
{
|
||||||
if (d_dump_file.is_open() == false)
|
if (!d_dump_file.is_open())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1288,6 +1329,5 @@ void dll_pll_veml_tracking::set_channel(unsigned int channel)
|
||||||
void dll_pll_veml_tracking::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
void dll_pll_veml_tracking::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||||
{
|
{
|
||||||
gr::thread::scoped_lock l(d_setlock);
|
gr::thread::scoped_lock l(d_setlock);
|
||||||
|
|
||||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
|
||||||
#include <gnuradio/block.h>
|
#include <gnuradio/block.h>
|
||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
#include "tracking_2nd_DLL_filter.h"
|
#include "tracking_2nd_DLL_filter.h"
|
||||||
|
@ -83,6 +82,7 @@ public:
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_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:
|
private:
|
||||||
friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(double fs_in, unsigned int vector_length,
|
friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(double fs_in, unsigned int vector_length,
|
||||||
bool dump, std::string dump_filename,
|
bool dump, std::string dump_filename,
|
||||||
|
@ -93,8 +93,7 @@ private:
|
||||||
int extend_correlation_symbols, bool track_pilot,
|
int extend_correlation_symbols, bool track_pilot,
|
||||||
char system, char signal[3], bool veml);
|
char system, char signal[3], bool veml);
|
||||||
|
|
||||||
dll_pll_veml_tracking(double fs_in, unsigned
|
dll_pll_veml_tracking(double fs_in, unsigned int vector_length,
|
||||||
int vector_length,
|
|
||||||
bool dump,
|
bool dump,
|
||||||
std::string dump_filename,
|
std::string dump_filename,
|
||||||
float pll_bw_hz,
|
float pll_bw_hz,
|
||||||
|
@ -121,10 +120,13 @@ private:
|
||||||
void log_data();
|
void log_data();
|
||||||
|
|
||||||
// tracking configuration vars
|
// tracking configuration vars
|
||||||
unsigned int d_vector_length;
|
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
bool d_veml;
|
bool d_veml;
|
||||||
|
bool d_secondary;
|
||||||
|
unsigned int d_secondary_code_length;
|
||||||
|
std::string *d_secondary_code_string;
|
||||||
Gnss_Synchro *d_acquisition_gnss_synchro;
|
Gnss_Synchro *d_acquisition_gnss_synchro;
|
||||||
|
unsigned int d_vector_length;
|
||||||
unsigned int d_channel;
|
unsigned int d_channel;
|
||||||
// long d_fs_in;
|
// long d_fs_in;
|
||||||
double d_fs_in;
|
double d_fs_in;
|
||||||
|
@ -141,23 +143,23 @@ private:
|
||||||
|
|
||||||
//Integration period in samples
|
//Integration period in samples
|
||||||
int d_correlation_length_samples;
|
int d_correlation_length_samples;
|
||||||
|
int d_correlation_length_ms;
|
||||||
int d_n_correlator_taps;
|
int d_n_correlator_taps;
|
||||||
double d_early_late_spc_chips;
|
double d_early_late_spc_chips;
|
||||||
double d_very_early_late_spc_chips;
|
double d_very_early_late_spc_chips;
|
||||||
|
|
||||||
double d_early_late_spc_narrow_chips;
|
double d_early_late_spc_narrow_chips;
|
||||||
double d_very_early_late_spc_narrow_chips;
|
double d_very_early_late_spc_narrow_chips;
|
||||||
|
|
||||||
float *d_tracking_code;
|
float *d_tracking_code;
|
||||||
float *d_data_code;
|
float *d_data_code;
|
||||||
float *d_local_code_shift_chips;
|
float *d_local_code_shift_chips;
|
||||||
|
float *d_null_shift;
|
||||||
gr_complex *d_correlator_outs;
|
gr_complex *d_correlator_outs;
|
||||||
cpu_multicorrelator_real_codes multicorrelator_cpu;
|
cpu_multicorrelator_real_codes multicorrelator_cpu;
|
||||||
//todo: currently the multicorrelator does not support adding extra correlator
|
//TODO: currently the multicorrelator does not support adding extra correlator
|
||||||
//with different local code, thus we need extra multicorrelator instance.
|
//with different local code, thus we need extra multicorrelator instance.
|
||||||
//Implement this functionality inside multicorrelator class
|
//Implement this functionality inside multicorrelator class
|
||||||
//as an enhancement to increase the performance
|
//as an enhancement to increase the performance
|
||||||
float* d_local_code_data_shift_chips;
|
|
||||||
cpu_multicorrelator_real_codes correlator_data_cpu; //for data channel
|
cpu_multicorrelator_real_codes correlator_data_cpu; //for data channel
|
||||||
|
|
||||||
gr_complex *d_Very_Early;
|
gr_complex *d_Very_Early;
|
||||||
|
@ -166,9 +168,9 @@ private:
|
||||||
gr_complex *d_Late;
|
gr_complex *d_Late;
|
||||||
gr_complex *d_Very_Late;
|
gr_complex *d_Very_Late;
|
||||||
|
|
||||||
|
bool d_enable_extended_integration;
|
||||||
int d_extend_correlation_symbols;
|
int d_extend_correlation_symbols;
|
||||||
int d_extend_correlation_symbols_count;
|
int d_extend_correlation_symbols_count;
|
||||||
bool d_enable_extended_integration;
|
|
||||||
int d_current_symbol;
|
int d_current_symbol;
|
||||||
|
|
||||||
gr_complex d_VE_accu;
|
gr_complex d_VE_accu;
|
||||||
|
@ -233,8 +235,8 @@ private:
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
std::map<std::string, std::string> systemName;
|
std::string systemName;
|
||||||
std::string sys;
|
std::string signal_type;
|
||||||
|
|
||||||
int save_matfile();
|
int save_matfile();
|
||||||
};
|
};
|
||||||
|
|
|
@ -122,7 +122,7 @@ bool cpu_multicorrelator_real_codes::Carrier_wipeoff_multicorrelator_resampler(
|
||||||
lv_32fc_t phase_offset_as_complex[1];
|
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));
|
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
|
// 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.0, -phase_step_rad)), phase_offset_as_complex, (const float**)d_local_codes_resampled, d_n_correlators, signal_length_samples);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,20 +67,20 @@
|
||||||
*/
|
*/
|
||||||
float cn0_svn_estimator(gr_complex* Prompt_buffer, int length, long fs_in, double code_length)
|
float cn0_svn_estimator(gr_complex* Prompt_buffer, int length, long fs_in, double code_length)
|
||||||
{
|
{
|
||||||
double SNR = 0;
|
double SNR = 0.0;
|
||||||
double SNR_dB_Hz = 0;
|
double SNR_dB_Hz = 0.0;
|
||||||
double Psig = 0;
|
double Psig = 0.0;
|
||||||
double Ptot = 0;
|
double Ptot = 0.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()));
|
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 /= static_cast<double>(length);
|
||||||
Psig = Psig * Psig;
|
Psig = Psig * Psig;
|
||||||
Ptot = Ptot / static_cast<double>(length);
|
Ptot /= static_cast<double>(length);
|
||||||
SNR = Psig / (Ptot - Psig);
|
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.0 * log10(SNR) + 10.0 * log10(static_cast<double>(fs_in) / 2.0) - 10.0 * log10(code_length);
|
||||||
return static_cast<float>(SNR_dB_Hz);
|
return static_cast<float>(SNR_dB_Hz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,10 +96,10 @@ float cn0_svn_estimator(gr_complex* Prompt_buffer, int length, long fs_in, doubl
|
||||||
*/
|
*/
|
||||||
float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
||||||
{
|
{
|
||||||
float tmp_sum_I = 0;
|
float tmp_sum_I = 0.0;
|
||||||
float tmp_sum_Q = 0;
|
float tmp_sum_Q = 0.0;
|
||||||
float NBD = 0;
|
float NBD = 0.0;
|
||||||
float NBP = 0;
|
float NBP = 0.0;
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
tmp_sum_I += Prompt_buffer[i].real();
|
tmp_sum_I += Prompt_buffer[i].real();
|
||||||
|
|
|
@ -41,11 +41,10 @@
|
||||||
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
|
// Solve natural frequency
|
||||||
float Wn;
|
float Wn = lbw * 8.0 * zeta / (4.0 * zeta * zeta + 1.0);
|
||||||
Wn = lbw * 8 * zeta / (4 * zeta * zeta + 1);
|
|
||||||
// solve for t1 & t2
|
// solve for t1 & t2
|
||||||
*tau1 = k / (Wn * Wn);
|
*tau1 = k / (Wn * Wn);
|
||||||
*tau2 = (2.0 * zeta) / Wn;
|
*tau2 = 2.0 * zeta / Wn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,9 +66,7 @@ void Tracking_2nd_DLL_filter::initialize()
|
||||||
|
|
||||||
float Tracking_2nd_DLL_filter::get_code_nco(float DLL_discriminator)
|
float Tracking_2nd_DLL_filter::get_code_nco(float DLL_discriminator)
|
||||||
{
|
{
|
||||||
float code_nco;
|
float 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.0 * 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_nco = code_nco;
|
||||||
d_old_code_error = DLL_discriminator; //[chips]
|
d_old_code_error = DLL_discriminator; //[chips]
|
||||||
return code_nco;
|
return code_nco;
|
||||||
|
|
|
@ -49,13 +49,13 @@ class Tracking_2nd_DLL_filter
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// PLL filter parameters
|
// PLL filter parameters
|
||||||
float d_tau1_code = 0;
|
float d_tau1_code = 0.0;
|
||||||
float d_tau2_code = 0;
|
float d_tau2_code = 0.0;
|
||||||
float d_pdi_code = 0;
|
float d_pdi_code = 0.0;
|
||||||
float d_dllnoisebandwidth = 0;
|
float d_dllnoisebandwidth = 0.0;
|
||||||
float d_dlldampingratio = 0;
|
float d_dlldampingratio = 0.0;
|
||||||
float d_old_code_error = 0;
|
float d_old_code_error = 0.0;
|
||||||
float d_old_code_nco = 0;
|
float d_old_code_nco = 0.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:
|
public:
|
||||||
|
|
|
@ -40,11 +40,10 @@
|
||||||
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
|
// Solve natural frequency
|
||||||
float Wn;
|
float Wn = lbw * 8.0 * zeta / (4.0 * zeta * zeta + 1.0);
|
||||||
Wn = lbw * 8 * zeta / (4 * zeta * zeta + 1);
|
|
||||||
// solve for t1 & t2
|
// solve for t1 & t2
|
||||||
*tau1 = k / (Wn * Wn);
|
*tau1 = k / (Wn * Wn);
|
||||||
*tau2 = (2.0 * zeta) / Wn;
|
*tau2 = 2.0 * zeta / Wn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,8 +70,7 @@ void Tracking_2nd_PLL_filter::initialize()
|
||||||
*/
|
*/
|
||||||
float Tracking_2nd_PLL_filter::get_carrier_nco(float PLL_discriminator)
|
float Tracking_2nd_PLL_filter::get_carrier_nco(float PLL_discriminator)
|
||||||
{
|
{
|
||||||
float carr_nco;
|
float 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.0 * 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);
|
//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;
|
d_old_carr_error = PLL_discriminator;
|
||||||
|
|
|
@ -48,15 +48,15 @@ class Tracking_2nd_PLL_filter
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// PLL filter parameters
|
// PLL filter parameters
|
||||||
float d_tau1_carr = 0;
|
float d_tau1_carr = 0.0;
|
||||||
float d_tau2_carr = 0;
|
float d_tau2_carr = 0.0;
|
||||||
float d_pdi_carr = 0;
|
float d_pdi_carr = 0.0;
|
||||||
|
|
||||||
float d_pllnoisebandwidth = 0;
|
float d_pllnoisebandwidth = 0.0;
|
||||||
float d_plldampingratio = 0;
|
float d_plldampingratio = 0.0;
|
||||||
|
|
||||||
float d_old_carr_error = 0;
|
float d_old_carr_error = 0.0;
|
||||||
float d_old_carr_nco = 0;
|
float d_old_carr_nco = 0.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);
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ double pll_cloop_two_quadrant_atan(gr_complex prompt_s1)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ double dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0.5 * (P_early - P_late) / ((P_early + P_late));
|
return 0.5 * (P_early - P_late) / (P_early + P_late);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,6 +131,6 @@ double dll_nc_vemlp_normalized(gr_complex very_early_s1, gr_complex early_s1, gr
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (P_early - P_late) / ((P_early + P_late));
|
return (P_early - P_late) / (P_early + P_late);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,6 @@
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
|
||||||
#define MAX_LOOP_ORDER 3
|
|
||||||
#define MAX_HISTORY_LENGTH 4
|
|
||||||
|
|
||||||
Tracking_loop_filter::Tracking_loop_filter(float update_interval,
|
Tracking_loop_filter::Tracking_loop_filter(float update_interval,
|
||||||
float noise_bandwidth,
|
float noise_bandwidth,
|
||||||
int loop_order,
|
int loop_order,
|
||||||
|
@ -50,8 +47,8 @@ Tracking_loop_filter::Tracking_loop_filter(float update_interval,
|
||||||
d_noise_bandwidth(noise_bandwidth),
|
d_noise_bandwidth(noise_bandwidth),
|
||||||
d_update_interval(update_interval)
|
d_update_interval(update_interval)
|
||||||
{
|
{
|
||||||
d_inputs.resize(MAX_HISTORY_LENGTH, 0.0);
|
d_inputs.resize(MAX_LOOP_HISTORY_LENGTH, 0.0);
|
||||||
d_outputs.resize(MAX_HISTORY_LENGTH, 0.0);
|
d_outputs.resize(MAX_LOOP_HISTORY_LENGTH, 0.0);
|
||||||
update_coefficients();
|
update_coefficients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +59,8 @@ Tracking_loop_filter::Tracking_loop_filter()
|
||||||
d_noise_bandwidth(15.0),
|
d_noise_bandwidth(15.0),
|
||||||
d_update_interval(0.001)
|
d_update_interval(0.001)
|
||||||
{
|
{
|
||||||
d_inputs.resize(MAX_HISTORY_LENGTH, 0.0);
|
d_inputs.resize(MAX_LOOP_HISTORY_LENGTH, 0.0);
|
||||||
d_outputs.resize(MAX_HISTORY_LENGTH, 0.0);
|
d_outputs.resize(MAX_LOOP_HISTORY_LENGTH, 0.0);
|
||||||
update_coefficients();
|
update_coefficients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,12 +72,12 @@ Tracking_loop_filter::~Tracking_loop_filter()
|
||||||
float Tracking_loop_filter::apply(float current_input)
|
float Tracking_loop_filter::apply(float current_input)
|
||||||
{
|
{
|
||||||
// Now apply the filter coefficients:
|
// Now apply the filter coefficients:
|
||||||
float result = 0;
|
float result = 0.0;
|
||||||
|
|
||||||
// Hanlde the old outputs first:
|
// Hanlde the old outputs first:
|
||||||
for (unsigned int ii = 0; ii < d_output_coefficients.size(); ++ii)
|
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];
|
result += d_output_coefficients[ii] * d_outputs[(d_current_index + ii) % MAX_LOOP_HISTORY_LENGTH];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now update the index to handle the inputs.
|
// Now update the index to handle the inputs.
|
||||||
|
@ -93,7 +90,7 @@ float Tracking_loop_filter::apply(float current_input)
|
||||||
d_current_index--;
|
d_current_index--;
|
||||||
if (d_current_index < 0)
|
if (d_current_index < 0)
|
||||||
{
|
{
|
||||||
d_current_index += MAX_HISTORY_LENGTH;
|
d_current_index += MAX_LOOP_HISTORY_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
d_inputs[d_current_index] = current_input;
|
d_inputs[d_current_index] = current_input;
|
||||||
|
@ -101,7 +98,7 @@ float Tracking_loop_filter::apply(float current_input)
|
||||||
|
|
||||||
for (unsigned int ii = 0; ii < d_input_coefficients.size(); ++ii)
|
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];
|
result += d_input_coefficients[ii] * d_inputs[(d_current_index + ii) % MAX_LOOP_HISTORY_LENGTH];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +119,7 @@ void Tracking_loop_filter::update_coefficients(void)
|
||||||
float wn;
|
float wn;
|
||||||
float T = d_update_interval;
|
float T = d_update_interval;
|
||||||
|
|
||||||
float zeta = 1 / std::sqrt(2);
|
float zeta = 1.0 / std::sqrt(2.0);
|
||||||
|
|
||||||
// The following is based on the bilinear transform approximation of
|
// The following is based on the bilinear transform approximation of
|
||||||
// the analog integrator. The loop format is from Kaplan & Hegarty
|
// the analog integrator. The loop format is from Kaplan & Hegarty
|
||||||
|
@ -146,7 +143,7 @@ void Tracking_loop_filter::update_coefficients(void)
|
||||||
d_input_coefficients[1] = g1 * T / 2.0;
|
d_input_coefficients[1] = g1 * T / 2.0;
|
||||||
|
|
||||||
d_output_coefficients.resize(1);
|
d_output_coefficients.resize(1);
|
||||||
d_output_coefficients[0] = 1;
|
d_output_coefficients[0] = 1.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -157,28 +154,28 @@ void Tracking_loop_filter::update_coefficients(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
wn = d_noise_bandwidth * (8 * zeta) / (4 * zeta * zeta + 1);
|
wn = d_noise_bandwidth * (8.0 * zeta) / (4.0 * zeta * zeta + 1.0);
|
||||||
g1 = wn * wn;
|
g1 = wn * wn;
|
||||||
g2 = wn * 2 * zeta;
|
g2 = wn * 2.0 * zeta;
|
||||||
if (d_include_last_integrator)
|
if (d_include_last_integrator)
|
||||||
{
|
{
|
||||||
d_input_coefficients.resize(3);
|
d_input_coefficients.resize(3);
|
||||||
d_input_coefficients[0] = T / 2 * (g1 * T / 2 + g2);
|
d_input_coefficients[0] = T / 2.0 * (g1 * T / 2.0 + g2);
|
||||||
d_input_coefficients[1] = T * T / 2 * g1;
|
d_input_coefficients[1] = T * T / 2.0 * g1;
|
||||||
d_input_coefficients[2] = T / 2 * (g1 * T / 2 - g2);
|
d_input_coefficients[2] = T / 2.0 * (g1 * T / 2.0 - g2);
|
||||||
|
|
||||||
d_output_coefficients.resize(2);
|
d_output_coefficients.resize(2);
|
||||||
d_output_coefficients[0] = 2;
|
d_output_coefficients[0] = 2.0;
|
||||||
d_output_coefficients[1] = -1;
|
d_output_coefficients[1] = -1.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_input_coefficients.resize(2);
|
d_input_coefficients.resize(2);
|
||||||
d_input_coefficients[0] = (g1 * T / 2.0 + g2);
|
d_input_coefficients[0] = (g1 * T / 2.0 + g2);
|
||||||
d_input_coefficients[1] = g1 * T / 2 - g2;
|
d_input_coefficients[1] = g1 * T / 2.0 - g2;
|
||||||
|
|
||||||
d_output_coefficients.resize(1);
|
d_output_coefficients.resize(1);
|
||||||
d_output_coefficients[0] = 1;
|
d_output_coefficients[0] = 1.0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -193,27 +190,27 @@ void Tracking_loop_filter::update_coefficients(void)
|
||||||
if (d_include_last_integrator)
|
if (d_include_last_integrator)
|
||||||
{
|
{
|
||||||
d_input_coefficients.resize(4);
|
d_input_coefficients.resize(4);
|
||||||
d_input_coefficients[0] = T / 2 * (g3 + T / 2 * (g2 + T / 2 * g1));
|
d_input_coefficients[0] = T / 2.0 * (g3 + T / 2.0 * (g2 + T / 2.0 * g1));
|
||||||
d_input_coefficients[1] = T / 2 * (-g3 + T / 2 * (g2 + 3 * T / 2 * g1));
|
d_input_coefficients[1] = T / 2.0 * (-g3 + T / 2.0 * (g2 + 3.0 * T / 2.0 * g1));
|
||||||
d_input_coefficients[2] = T / 2 * (-g3 - T / 2 * (g2 - 3 * T / 2 * g1));
|
d_input_coefficients[2] = T / 2.0 * (-g3 - T / 2.0 * (g2 - 3.0 * T / 2.0 * g1));
|
||||||
d_input_coefficients[3] = T / 2 * (g3 - T / 2 * (g2 - T / 2 * g1));
|
d_input_coefficients[3] = T / 2.0 * (g3 - T / 2.0 * (g2 - T / 2.0 * g1));
|
||||||
|
|
||||||
d_output_coefficients.resize(3);
|
d_output_coefficients.resize(3);
|
||||||
d_output_coefficients[0] = 3;
|
d_output_coefficients[0] = 3.0;
|
||||||
d_output_coefficients[1] = -3;
|
d_output_coefficients[1] = -3.0;
|
||||||
d_output_coefficients[2] = 1;
|
d_output_coefficients[2] = 1.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_input_coefficients.resize(3);
|
d_input_coefficients.resize(3);
|
||||||
d_input_coefficients[0] = g3 + T / 2 * (g2 + T / 2 * g1);
|
d_input_coefficients[0] = g3 + T / 2.0 * (g2 + T / 2.0 * g1);
|
||||||
d_input_coefficients[1] = g1 * T * T / 2 - 2 * g3;
|
d_input_coefficients[1] = g1 * T * T / 2.0 - 2.0 * g3;
|
||||||
d_input_coefficients[2] = g3 + T / 2 * (-g2 + T / 2 * g1);
|
d_input_coefficients[2] = g3 + T / 2.0 * (-g2 + T / 2.0 * g1);
|
||||||
|
|
||||||
|
|
||||||
d_output_coefficients.resize(2);
|
d_output_coefficients.resize(2);
|
||||||
d_output_coefficients[0] = 2;
|
d_output_coefficients[0] = 2.0;
|
||||||
d_output_coefficients[1] = -1;
|
d_output_coefficients[1] = -1.0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
@ -254,7 +251,7 @@ bool Tracking_loop_filter::get_include_last_integrator(void) const
|
||||||
|
|
||||||
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)
|
if (loop_order < 1 or loop_order > MAX_LOOP_ORDER)
|
||||||
{
|
{
|
||||||
LOG(ERROR) << "Ignoring attempt to set loop order to " << loop_order
|
LOG(ERROR) << "Ignoring attempt to set loop order to " << loop_order
|
||||||
<< ". Maximum allowed order is: " << MAX_LOOP_ORDER
|
<< ". Maximum allowed order is: " << MAX_LOOP_ORDER
|
||||||
|
@ -274,7 +271,7 @@ int Tracking_loop_filter::get_order(void) const
|
||||||
|
|
||||||
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_inputs.assign(MAX_LOOP_HISTORY_LENGTH, 0.0);
|
||||||
d_outputs.assign(MAX_HISTORY_LENGTH, initial_output);
|
d_outputs.assign(MAX_LOOP_HISTORY_LENGTH, initial_output);
|
||||||
d_current_index = MAX_HISTORY_LENGTH - 1;
|
d_current_index = MAX_LOOP_HISTORY_LENGTH - 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
#ifndef GNSS_SDR_TRACKING_LOOP_FILTER_H_
|
#ifndef GNSS_SDR_TRACKING_LOOP_FILTER_H_
|
||||||
#define GNSS_SDR_TRACKING_LOOP_FILTER_H_
|
#define GNSS_SDR_TRACKING_LOOP_FILTER_H_
|
||||||
|
#define MAX_LOOP_ORDER 3
|
||||||
|
#define MAX_LOOP_HISTORY_LENGTH 4
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue