1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-02-01 19:59:15 +00:00

Galileo E1b/c tracking improvement and code cleaning

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@255 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas 2012-10-24 08:02:51 +00:00
parent 1aea9db69f
commit d85f65ed4c
15 changed files with 90 additions and 136 deletions

View File

@ -7,7 +7,7 @@
;######### GLOBAL OPTIONS ################## ;######### GLOBAL OPTIONS ##################
;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz]. ;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz].
GNSS-SDR.internal_fs_hz=8000000 GNSS-SDR.internal_fs_hz=4000000
;######### CONTROL_THREAD CONFIG ############ ;######### CONTROL_THREAD CONFIG ############
ControlThread.wait_for_flowgraph=false ControlThread.wait_for_flowgraph=false
@ -17,13 +17,13 @@ ControlThread.wait_for_flowgraph=false
SignalSource.implementation=File_Signal_Source SignalSource.implementation=File_Signal_Source
;#filename: path to file with the captured GNSS signal samples to be processed ;#filename: path to file with the captured GNSS signal samples to be processed
SignalSource.filename=/media/DATA/Proyectos/Signals/cttc_2012_07_26/cp_cttc_2012_07_26_n6_8Msps.dat SignalSource.filename=/media/DATALOGGER_/signals/CTTC captures/cp_cttc_1_galileo_4Msps.dat
;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. ;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
SignalSource.item_type=gr_complex SignalSource.item_type=gr_complex
;#sampling_frequency: Original Signal sampling frequency in [Hz] ;#sampling_frequency: Original Signal sampling frequency in [Hz]
SignalSource.sampling_frequency=8000000 SignalSource.sampling_frequency=4000000
;#freq: RF front-end center frequency in [Hz] ;#freq: RF front-end center frequency in [Hz]
SignalSource.freq=1575420000 SignalSource.freq=1575420000
@ -157,7 +157,7 @@ Resampler.dump_filename=../data/resampler.dat
Resampler.item_type=gr_complex Resampler.item_type=gr_complex
;#sample_freq_in: the sample frequency of the input signal ;#sample_freq_in: the sample frequency of the input signal
Resampler.sample_freq_in=8000000 Resampler.sample_freq_in=4000000
;#sample_freq_out: the desired sample frequency of the output signal ;#sample_freq_out: the desired sample frequency of the output signal
Resampler.sample_freq_out=2000000 Resampler.sample_freq_out=2000000
@ -165,7 +165,7 @@ Resampler.sample_freq_out=2000000
;######### CHANNELS GLOBAL CONFIG ############ ;######### CHANNELS GLOBAL CONFIG ############
;#count: Number of available satellite channels. ;#count: Number of available satellite channels.
Channels.count=2 Channels.count=1
;#in_acquisition: Number of channels simultaneously acquiring ;#in_acquisition: Number of channels simultaneously acquiring
Channels.in_acquisition=1 Channels.in_acquisition=1
@ -234,14 +234,14 @@ Channel0.system=Galileo
Channel0.signal=1B Channel0.signal=1B
;#satellite: Satellite PRN ID for this channel. Disable this option to random search ;#satellite: Satellite PRN ID for this channel. Disable this option to random search
Channel0.satellite=11 Channel0.satellite=12
Channel0.repeat_satellite=true Channel0.repeat_satellite=true
;######### CHANNEL 1 CONFIG ############ ;######### CHANNEL 1 CONFIG ############
Channel1.system=Galileo Channel1.system=Galileo
Channel1.signal=1B Channel1.signal=1B
Channel1.satellite=12 Channel1.satellite=11
Channel1.repeat_satellite=true Channel1.repeat_satellite=true
;######### CHANNEL 2 CONFIG ############ ;######### CHANNEL 2 CONFIG ############
@ -251,41 +251,6 @@ Channel2.signal=1C
;Channel2.satellite=16 ;Channel2.satellite=16
Channel2.repeat_satellite=false Channel2.repeat_satellite=false
;######### CHANNEL 3 CONFIG ############
Channel3.system=GPS
Channel3.signal=1C
;Channel3.satellite=21
Channel3.repeat_satellite=false
;######### CHANNEL 4 CONFIG ############
Channel4.system=GPS
Channel4.signal=1C
;Channel4.satellite=3
Channel4.repeat_satellite=false
;######### CHANNEL 5 CONFIG ############
Channel5.system=GPS
Channel5.signal=1C
;Channel5.satellite=21
;Channel5.repeat_satellite=false
;######### CHANNEL 6 CONFIG ############
Channel6.system=GPS
Channel6.signal=1C
;Channel6.satellite=21
;Channel6.repeat_satellite=false
;######### CHANNEL 7 CONFIG ############
Channel7.system=GPS
Channel7.signal=1C
;Channel7.satellite=21
;Channel7.repeat_satellite=false
;######### ACQUISITION GLOBAL CONFIG ############ ;######### ACQUISITION GLOBAL CONFIG ############
;#dump: Enable or disable the acquisition internal data file logging [true] or [false] ;#dump: Enable or disable the acquisition internal data file logging [true] or [false]
@ -305,7 +270,7 @@ Acquisition.sampled_ms=4
;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition] ;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition]
Acquisition0.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition Acquisition0.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition
;#threshold: Acquisition threshold ;#threshold: Acquisition threshold
Acquisition0.threshold=50 Acquisition0.threshold=70
;#doppler_max: Maximum expected Doppler shift [Hz] ;#doppler_max: Maximum expected Doppler shift [Hz]
Acquisition0.doppler_max=10000 Acquisition0.doppler_max=10000
;#doppler_max: Doppler step in the grid search [Hz] ;#doppler_max: Doppler step in the grid search [Hz]
@ -315,7 +280,7 @@ Acquisition0.cboc=true
;######### ACQUISITION CH 1 CONFIG ############ ;######### ACQUISITION CH 1 CONFIG ############
Acquisition1.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition Acquisition1.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition
Acquisition1.threshold=50 Acquisition1.threshold=70
Acquisition1.doppler_max=10000 Acquisition1.doppler_max=10000
Acquisition1.doppler_step=125 Acquisition1.doppler_step=125
Acquisition1.cboc=true Acquisition1.cboc=true
@ -388,7 +353,7 @@ Tracking.dump=true
Tracking.dump_filename=../data/veml_tracking_ch_ Tracking.dump_filename=../data/veml_tracking_ch_
;#pll_bw_hz: PLL loop filter bandwidth [Hz] ;#pll_bw_hz: PLL loop filter bandwidth [Hz]
Tracking.pll_bw_hz=30.0; Tracking.pll_bw_hz=15.0;
;#dll_bw_hz: DLL loop filter bandwidth [Hz] ;#dll_bw_hz: DLL loop filter bandwidth [Hz]
Tracking.dll_bw_hz=2.0; Tracking.dll_bw_hz=2.0;

View File

@ -79,16 +79,12 @@ galileo_e1_dll_pll_veml_make_tracking_cc(
fs_in, vector_length, queue, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips, very_early_late_space_chips)); fs_in, vector_length, queue, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips, very_early_late_space_chips));
} }
void galileo_e1_dll_pll_veml_tracking_cc::forecast (int noutput_items, void galileo_e1_dll_pll_veml_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_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc( galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc(
long if_freq, long if_freq,
long fs_in, long fs_in,
@ -112,8 +108,8 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_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_code_loop_filter = Tracking_2nd_DLL_filter(Galileo_E1_CODE_PERIOD);
d_carrier_loop_filter = Tracking_2nd_PLL_filter(0.004); d_carrier_loop_filter = Tracking_2nd_PLL_filter(Galileo_E1_CODE_PERIOD);
// Initialize tracking ========================================== // Initialize tracking ==========================================
@ -159,8 +155,6 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc(
d_rem_code_phase_samples = 0.0; d_rem_code_phase_samples = 0.0;
// Residual carrier phase // Residual carrier phase
d_rem_carr_phase_rad = 0.0; d_rem_carr_phase_rad = 0.0;
// Phase step
d_code_phase_step_chips = d_code_freq_chips / (float)d_fs_in; //[chips]
// sample synchronization // sample synchronization
d_sample_counter = 0; d_sample_counter = 0;
@ -181,15 +175,9 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc(
d_carrier_lock_fail_counter = 0; d_carrier_lock_fail_counter = 0;
d_carrier_lock_threshold = CARRIER_LOCK_THRESHOLD; d_carrier_lock_threshold = CARRIER_LOCK_THRESHOLD;
//systemName["G"] = std::string("GPS");
//systemName["R"] = std::string("GLONASS");
//systemName["S"] = std::string("SBAS");
systemName["E"] = std::string("Galileo"); systemName["E"] = std::string("Galileo");
//systemName["C"] = std::string("Compass");
} }
void galileo_e1_dll_pll_veml_tracking_cc::start_tracking() void galileo_e1_dll_pll_veml_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;
@ -197,10 +185,8 @@ void galileo_e1_dll_pll_veml_tracking_cc::start_tracking()
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 // DLL/PLL filter initialization
d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); //initialize the carrier filter d_carrier_loop_filter.initialize(); //initialize the carrier filter
// THE PARAMETER IS NOT USED!! d_code_loop_filter.initialize(); //initialize the code filter
d_code_loop_filter.initialize(d_acq_code_phase_samples); //initialize the code filter
// THE PARAMETER IS NOT USED!!
// 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);
@ -213,12 +199,11 @@ void galileo_e1_dll_pll_veml_tracking_cc::start_tracking()
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; // Never used? 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_next_prn_length_samples = d_vector_length; d_current_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);
@ -236,9 +221,6 @@ void galileo_e1_dll_pll_veml_tracking_cc::start_tracking()
} }
void galileo_e1_dll_pll_veml_tracking_cc::update_local_code() void galileo_e1_dll_pll_veml_tracking_cc::update_local_code()
{ {
double tcode_half_chips; double tcode_half_chips;
@ -275,27 +257,20 @@ void galileo_e1_dll_pll_veml_tracking_cc::update_local_code()
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_dll_pll_veml_tracking_cc::update_local_carrier() void galileo_e1_dll_pll_veml_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; // Why here????
} }
galileo_e1_dll_pll_veml_tracking_cc::~galileo_e1_dll_pll_veml_tracking_cc() galileo_e1_dll_pll_veml_tracking_cc::~galileo_e1_dll_pll_veml_tracking_cc()
{ {
d_dump_file.close(); d_dump_file.close();
@ -331,16 +306,14 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
if (d_pull_in == true) if (d_pull_in == true)
{ {
/* /*
* 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)
*/ */
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_seconds = d_sample_counter_seconds + (((double)samples_offset) / (double)d_fs_in);
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
d_pull_in = false; d_pull_in = false;
d_debug_counter++; d_debug_counter++;
@ -350,7 +323,6 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
// 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;
@ -358,11 +330,7 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
const gr_complex* in = (gr_complex*) input_items[0]; const gr_complex* in = (gr_complex*) input_items[0];
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
// Update the prn length based on code freq (variable) and sampling frequency (fixed) // Generate local code and carrier replicas (using \hat{f}_d(k-1))
// variable code PRN sample block size
d_current_prn_length_samples = d_next_prn_length_samples;
// Generate local code and carrier replicas
update_local_code(); update_local_code();
update_local_carrier(); update_local_carrier();
@ -382,38 +350,46 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
d_Very_Late, d_Very_Late,
is_unaligned()); is_unaligned());
// ################## PLL ##########################################################
// PLL discriminator // PLL discriminator
carr_error_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / (float)GPS_TWO_PI; carr_error_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / (float)GPS_TWO_PI;
// Implement carrier loop filter and generate NCO command // Carrier discriminator filter
carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz); carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz);
// Modify carrier freq based on NCO command // New carrier Doppler frequency estimation
d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_error_filt_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 // DLL discriminator
code_error_chips = dll_nc_vemlp_normalized(*d_Very_Early, *d_Early, *d_Late, *d_Very_Late); code_error_chips = dll_nc_vemlp_normalized(*d_Very_Early, *d_Early, *d_Late, *d_Very_Late); //[chips/Ti]
// Implement code loop filter and generate NCO command // Code discriminator filter
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second]
// Modify code freq based on NCO command //Code phase accumulator
d_code_freq_chips = Galileo_E1_CODE_CHIP_RATE_HZ + (((d_carrier_doppler_hz + d_if_freq) * Galileo_E1_CODE_CHIP_RATE_HZ) / Galileo_E1_FREQ_HZ) - code_error_filt_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_chips / (float)d_fs_in; //[chips] //code_error_filt_secs=T_prn_seconds*code_error_filt_chips*T_chip_seconds*(float)d_fs_in; //[seconds]
d_acc_code_phase_secs=d_acc_code_phase_secs+code_error_filt_secs;
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
// keep alignment parameters for the next input buffer // keep alignment parameters for the next input buffer
float T_chip_seconds; float T_chip_seconds;
float T_prn_seconds; float T_prn_seconds;
float T_prn_samples; float T_prn_samples;
float K_blk_samples; float K_blk_samples;
// Compute the next buffer lenght based in the new period of the PRN sequence and the code phase error estimation
T_chip_seconds = 1 / d_code_freq_chips; T_chip_seconds = 1 / d_code_freq_chips;
T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS; T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS;
T_prn_samples = T_prn_seconds * d_fs_in; T_prn_samples = T_prn_seconds * (float)d_fs_in;
d_rem_code_phase_samples = d_next_rem_code_phase_samples; K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs*(float)d_fs_in;
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_next_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
d_next_rem_code_phase_samples = K_blk_samples - d_next_prn_length_samples; //rounding error
/*!
* \todo Improve the lock detection algorithm!
*/
// ####### CN0 ESTIMATION AND LOCK DETECTORS ###### // ####### CN0 ESTIMATION AND LOCK DETECTORS ######
if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES) if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES)
{ {
@ -443,8 +419,6 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER) if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
{ {
std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ; std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ;
//tracking_message = 3; //loss of lock
//d_channel_internal_queue->push(tracking_message);
ControlMessageFactory* cmf = new ControlMessageFactory(); ControlMessageFactory* cmf = new ControlMessageFactory();
if (d_queue != gr_msg_queue_sptr()) if (d_queue != gr_msg_queue_sptr())
{ {
@ -462,7 +436,7 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag(); current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag();
// Tracking_timestamp_secs is aligned with the PRN start sample // Tracking_timestamp_secs is aligned with the PRN start sample
current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter + current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter +
(double)d_next_prn_length_samples + (double)d_next_rem_code_phase_samples) / (double)d_fs_in; (double)d_current_prn_length_samples + (double)d_rem_code_phase_samples) / (double)d_fs_in;
// This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0 // This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0
current_synchro_data.Code_phase_secs = 0; current_synchro_data.Code_phase_secs = 0;
current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad; current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad;
@ -482,10 +456,7 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl;
std::cout << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) std::cout << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
<< ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
//if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock!
//std::cout<<"d_carrier_lock_test="<<d_carrier_lock_test<<std::endl;
//std::cout<<"d_carrier_lock_fail_counter="<<d_carrier_lock_fail_counter<<std::endl;
} }
} }
else else

View File

@ -134,8 +134,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;
@ -153,7 +151,6 @@ private:
// remaining code phase and carrier phase between tracking loops // remaining code phase and carrier phase between tracking loops
float d_rem_code_phase_samples; float d_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 // PLL and DLL filter library
@ -170,12 +167,11 @@ private:
// tracking vars // tracking vars
float d_code_freq_chips; float d_code_freq_chips;
float d_carrier_doppler_hz; float d_carrier_doppler_hz;
float d_acc_carrier_phase_rad; double d_acc_carrier_phase_rad;
float d_code_phase_samples; double d_acc_code_phase_secs;
//PRN period in samples //PRN period in samples
int d_current_prn_length_samples; int d_current_prn_length_samples;
int d_next_prn_length_samples;
//double d_sample_counter_seconds; //double d_sample_counter_seconds;
//processing samples counters //processing samples counters

View File

@ -209,8 +209,8 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking()
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 // DLL/PLL filter initialization
d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); //initialize the carrier filter d_carrier_loop_filter.initialize(); //initialize the carrier filter
d_code_loop_filter.initialize(d_acq_code_phase_samples); //initialize the code 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)

View File

@ -124,6 +124,9 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(
// Initialize tracking variables ========================================== // Initialize tracking variables ==========================================
d_carrier_loop_filter.set_params(fll_bw_hz,pll_bw_hz,order); d_carrier_loop_filter.set_params(fll_bw_hz,pll_bw_hz,order);
d_code_loop_filter=Tracking_2nd_DLL_filter(GPS_L1_CA_CODE_PERIOD);
d_code_loop_filter.set_DLL_BW(dll_bw_hz);
// Get space for a vector with the C/A code replica sampled 1x/chip // Get space for a vector with the C/A code replica sampled 1x/chip
d_ca_code = new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 2]; d_ca_code = new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 2];
@ -346,6 +349,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
{ {
double code_error_chips = 0; double code_error_chips = 0;
double code_error_filt_chips =0;
double correlation_time_s = 0; double correlation_time_s = 0;
double PLL_discriminator_hz = 0; double PLL_discriminator_hz = 0;
double carr_nco_hz = 0; double carr_nco_hz = 0;
@ -433,6 +437,8 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
*/ */
// Compute DLL error // Compute DLL error
code_error_chips = dll_nc_e_minus_l_normalized(*d_Early,*d_Late); code_error_chips = dll_nc_e_minus_l_normalized(*d_Early,*d_Late);
// Compute DLL filtered error
code_error_filt_chips=d_code_loop_filter.get_code_nco(code_error_chips);
//compute FLL error //compute FLL error
correlation_time_s = ((double)d_current_prn_length_samples) / d_fs_in; correlation_time_s = ((double)d_current_prn_length_samples) / d_fs_in;
@ -456,7 +462,9 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
*/ */
carr_nco_hz = d_carrier_loop_filter.get_carrier_error(d_FLL_discriminator_hz, PLL_discriminator_hz, correlation_time_s); carr_nco_hz = d_carrier_loop_filter.get_carrier_error(d_FLL_discriminator_hz, PLL_discriminator_hz, correlation_time_s);
d_carrier_doppler_hz = d_if_freq + carr_nco_hz; d_carrier_doppler_hz = d_if_freq + carr_nco_hz;
d_code_freq_hz = GPS_L1_CA_CODE_RATE_HZ + (((d_carrier_doppler_hz + d_if_freq) * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ) - code_error_chips;
d_code_freq_hz = GPS_L1_CA_CODE_RATE_HZ + (((d_carrier_doppler_hz + d_if_freq) * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ);
/*! /*!
* \todo Improve the lock detection algorithm! * \todo Improve the lock detection algorithm!
@ -528,7 +536,12 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
T_chip_seconds = 1/d_code_freq_hz; T_chip_seconds = 1/d_code_freq_hz;
T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
T_prn_samples = T_prn_seconds * d_fs_in; T_prn_samples = T_prn_seconds * d_fs_in;
K_blk_samples = T_prn_samples + d_rem_code_phase_samples;
float code_error_filt_samples;
code_error_filt_samples=T_prn_seconds*code_error_filt_chips*T_chip_seconds*(float)d_fs_in; //[seconds]
d_acc_code_phase_samples=d_acc_code_phase_samples+code_error_filt_samples;
K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_samples;
d_current_prn_length_samples = round(K_blk_samples); //round to a discrete sample d_current_prn_length_samples = round(K_blk_samples); //round to a discrete sample
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error
@ -598,7 +611,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
//DLL commands //DLL commands
tmp_float=(float)code_error_chips; tmp_float=(float)code_error_chips;
d_dump_file.write((char*)&tmp_float, sizeof(float)); d_dump_file.write((char*)&tmp_float, sizeof(float));
tmp_float=(float)d_code_phase_samples; tmp_float=(float)code_error_filt_chips;
d_dump_file.write((char*)&tmp_float, sizeof(float)); d_dump_file.write((char*)&tmp_float, sizeof(float));
// CN0 and carrier lock test // CN0 and carrier lock test

View File

@ -47,6 +47,7 @@
#include "concurrent_queue.h" #include "concurrent_queue.h"
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include "tracking_FLL_PLL_filter.h" #include "tracking_FLL_PLL_filter.h"
#include "tracking_2nd_DLL_filter.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
//#include "GPS_L1_CA.h" //#include "GPS_L1_CA.h"
#include "correlator.h" #include "correlator.h"
@ -184,6 +185,9 @@ private:
double d_FLL_discriminator_hz; // This is a class variable because FLL needs to have memory double d_FLL_discriminator_hz; // This is a class variable because FLL needs to have memory
Tracking_FLL_PLL_filter d_carrier_loop_filter; Tracking_FLL_PLL_filter d_carrier_loop_filter;
double d_acc_carrier_phase_rad; double d_acc_carrier_phase_rad;
double d_acc_code_phase_samples;
Tracking_2nd_DLL_filter d_code_loop_filter;
unsigned long int d_sample_counter; unsigned long int d_sample_counter;

View File

@ -229,8 +229,8 @@ void Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::start_tracking()
d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
// DLL/PLL filter initialization // DLL/PLL filter initialization
d_carrier_loop_filter.initialize(d_carrier_doppler_hz); //initialize the carrier filter d_carrier_loop_filter.initialize(); //initialize the carrier filter
d_code_loop_filter.initialize(d_acq_code_phase_samples); //initialize the code filter d_code_loop_filter.initialize(); //initialize the code filter
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0); gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);

View File

@ -227,8 +227,8 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
// DLL/PLL filter initialization // DLL/PLL filter initialization
d_carrier_loop_filter.initialize(d_carrier_doppler_hz); //initialize the carrier filter d_carrier_loop_filter.initialize(); //initialize the carrier filter
d_code_loop_filter.initialize(d_acq_code_phase_samples); //initialize the code filter d_code_loop_filter.initialize(); //initialize the code filter
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0); gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);

View File

@ -248,8 +248,8 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
// DLL/PLL filter initialization // DLL/PLL filter initialization
d_carrier_loop_filter.initialize(d_carrier_doppler_hz); //initialize the carrier filter d_carrier_loop_filter.initialize(); //initialize the carrier filter
d_code_loop_filter.initialize(d_acq_code_phase_samples); //initialize the code filter d_code_loop_filter.initialize(); //initialize the code filter
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0); gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);

View File

@ -59,7 +59,7 @@ void Tracking_2nd_DLL_filter::set_DLL_BW(float dll_bw_hz)
void Tracking_2nd_DLL_filter::initialize(float d_acq_code_phase_samples) void Tracking_2nd_DLL_filter::initialize()
{ {
// code tracking loop parameters // code tracking loop parameters
d_old_code_nco = 0.0; d_old_code_nco = 0.0;

View File

@ -60,7 +60,7 @@ private:
public: public:
void set_DLL_BW(float dll_bw_hz); //! Set DLL filter bandwidth [Hz] void set_DLL_BW(float dll_bw_hz); //! Set DLL filter bandwidth [Hz]
void initialize(float d_acq_code_phase_samples); //! Start tracking with acquisition information void initialize(); //! Start tracking with acquisition information
float get_code_nco(float DLL_discriminator); //! Numerically controlled oscillator float get_code_nco(float DLL_discriminator); //! Numerically controlled oscillator
Tracking_2nd_DLL_filter(float pdi_code); Tracking_2nd_DLL_filter(float pdi_code);
Tracking_2nd_DLL_filter(); Tracking_2nd_DLL_filter();

View File

@ -58,7 +58,7 @@ void Tracking_2nd_PLL_filter::set_PLL_BW(float pll_bw_hz)
void Tracking_2nd_PLL_filter::initialize(float d_acq_carrier_doppler_hz) void Tracking_2nd_PLL_filter::initialize()
{ {
// carrier/Costas loop parameters // carrier/Costas loop parameters
d_old_carr_nco = 0.0; d_old_carr_nco = 0.0;
@ -66,8 +66,11 @@ void Tracking_2nd_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
} }
/*
* PLL second order FIR filter
* Req Input in [Hz/Ti]
* The output is in [Hz/s].
*/
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;

View File

@ -61,7 +61,7 @@ private:
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:
void set_PLL_BW(float pll_bw_hz); //! Set PLL loop bandwidth [Hz] void set_PLL_BW(float pll_bw_hz); //! Set PLL loop bandwidth [Hz]
void initialize(float d_acq_carrier_doppler_hz); void initialize();
float get_carrier_nco(float PLL_discriminator); float get_carrier_nco(float PLL_discriminator);
Tracking_2nd_PLL_filter(float pdi_carr); Tracking_2nd_PLL_filter(float pdi_carr);
Tracking_2nd_PLL_filter(); Tracking_2nd_PLL_filter();

View File

@ -49,6 +49,7 @@ const double F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)]
const double GPS_L1_FREQ_HZ = 1.57542e9; //!< L1 [Hz] const double GPS_L1_FREQ_HZ = 1.57542e9; //!< L1 [Hz]
const double GPS_L1_CA_CODE_RATE_HZ = 1.023e6; //!< GPS L1 C/A code rate [chips/s] const double GPS_L1_CA_CODE_RATE_HZ = 1.023e6; //!< GPS L1 C/A code rate [chips/s]
const double GPS_L1_CA_CODE_LENGTH_CHIPS = 1023.0; //!< GPS L1 C/A code length [chips] const double GPS_L1_CA_CODE_LENGTH_CHIPS = 1023.0; //!< GPS L1 C/A code length [chips]
const double GPS_L1_CA_CODE_PERIOD = 0.001; //!< GPS L1 C/A code period [seconds]
/*! /*!
* \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms * \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms

View File

@ -38,6 +38,7 @@
// carrier and code frequencies // carrier and code frequencies
const double Galileo_E1_FREQ_HZ = 1.57542e9; //!< E1 [Hz] const double Galileo_E1_FREQ_HZ = 1.57542e9; //!< E1 [Hz]
const double Galileo_E1_CODE_CHIP_RATE_HZ = 1.023e6; //!< Galileo E1 code rate [chips/s] const double Galileo_E1_CODE_CHIP_RATE_HZ = 1.023e6; //!< Galileo E1 code rate [chips/s]
const double Galileo_E1_CODE_PERIOD = 0.004; //!< Galileo E1 code period [s]
const double Galileo_E1_SUB_CARRIER_A_RATE_HZ = 1.023e6; //!< Galileo E1 sub-carrier 'a' rate [Hz] const double Galileo_E1_SUB_CARRIER_A_RATE_HZ = 1.023e6; //!< Galileo E1 sub-carrier 'a' rate [Hz]
const double Galileo_E1_SUB_CARRIER_B_RATE_HZ = 6.138e6; //!< Galileo E1 sub-carrier 'b' rate [Hz] const double Galileo_E1_SUB_CARRIER_B_RATE_HZ = 6.138e6; //!< Galileo E1 sub-carrier 'b' rate [Hz]
const double Galileo_E1_B_CODE_LENGTH_CHIPS = 4092.0; //!< Galileo E1-B code length [chips] const double Galileo_E1_B_CODE_LENGTH_CHIPS = 4092.0; //!< Galileo E1-B code length [chips]