2018-02-12 16:17:39 +00:00
|
|
|
/*!
|
|
|
|
* \file dll_pll_veml_tracking.h
|
2018-03-28 17:54:24 +00:00
|
|
|
* \brief Implementation of a code DLL + carrier PLL tracking block.
|
2018-11-29 16:09:30 +00:00
|
|
|
* \author Javier Arribas, 2018. jarribas(at)cttc.es
|
2018-03-29 07:23:23 +00:00
|
|
|
* \author Antonio Ramos, 2018 antonio.ramosdet(at)gmail.com
|
2018-02-12 16:17:39 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
|
|
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-05-13 20:49:11 +00:00
|
|
|
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
2018-02-12 16:17:39 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GNSS_SDR_DLL_PLL_VEML_TRACKING_H
|
|
|
|
#define GNSS_SDR_DLL_PLL_VEML_TRACKING_H
|
|
|
|
|
2018-06-19 09:36:15 +00:00
|
|
|
#include "dll_pll_conf.h"
|
2018-02-12 16:17:39 +00:00
|
|
|
#include "gnss_synchro.h"
|
|
|
|
#include "tracking_2nd_DLL_filter.h"
|
|
|
|
#include "tracking_2nd_PLL_filter.h"
|
|
|
|
#include "cpu_multicorrelator_real_codes.h"
|
2018-03-28 17:54:24 +00:00
|
|
|
#include <gnuradio/block.h>
|
2018-03-13 11:38:33 +00:00
|
|
|
#include <fstream>
|
|
|
|
#include <string>
|
2018-04-10 23:22:11 +00:00
|
|
|
#include <map>
|
2018-06-19 09:36:15 +00:00
|
|
|
#include <queue>
|
2018-09-11 18:47:32 +00:00
|
|
|
#include <utility>
|
2018-07-13 13:23:20 +00:00
|
|
|
#include <boost/circular_buffer.hpp>
|
2018-02-12 16:17:39 +00:00
|
|
|
|
|
|
|
class dll_pll_veml_tracking;
|
|
|
|
|
|
|
|
typedef boost::shared_ptr<dll_pll_veml_tracking> dll_pll_veml_tracking_sptr;
|
|
|
|
|
2018-06-19 10:56:53 +00:00
|
|
|
dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_);
|
2018-02-12 16:17:39 +00:00
|
|
|
|
|
|
|
/*!
|
2018-03-29 07:23:23 +00:00
|
|
|
* \brief This class implements a code DLL + carrier PLL tracking block.
|
2018-02-12 16:17:39 +00:00
|
|
|
*/
|
2018-03-12 14:16:39 +00:00
|
|
|
class dll_pll_veml_tracking : public gr::block
|
2018-02-12 16:17:39 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
~dll_pll_veml_tracking();
|
|
|
|
|
2018-08-11 10:56:52 +00:00
|
|
|
void set_channel(uint32_t channel);
|
2018-03-12 14:16:39 +00:00
|
|
|
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
|
2018-02-12 16:17:39 +00:00
|
|
|
void start_tracking();
|
2018-10-28 10:07:53 +00:00
|
|
|
void stop_tracking();
|
2018-02-12 16:17:39 +00:00
|
|
|
|
2018-03-12 14:16:39 +00:00
|
|
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
|
|
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
|
|
|
|
|
|
|
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
2018-02-12 16:17:39 +00:00
|
|
|
|
|
|
|
private:
|
2018-06-19 10:56:53 +00:00
|
|
|
friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_);
|
2018-04-05 16:08:49 +00:00
|
|
|
|
2018-06-19 10:56:53 +00:00
|
|
|
dll_pll_veml_tracking(const Dll_Pll_Conf &conf_);
|
2018-07-13 13:23:20 +00:00
|
|
|
void msg_handler_preamble_index(pmt::pmt_t msg);
|
2018-02-12 16:17:39 +00:00
|
|
|
|
2018-04-09 19:09:25 +00:00
|
|
|
bool cn0_and_tracking_lock_status(double coh_integration_time_s);
|
2018-03-13 11:38:33 +00:00
|
|
|
bool acquire_secondary();
|
2018-03-12 14:16:39 +00:00
|
|
|
void do_correlation_step(const gr_complex *input_samples);
|
2018-03-19 10:19:55 +00:00
|
|
|
void run_dll_pll();
|
2018-03-13 11:38:33 +00:00
|
|
|
void update_tracking_vars();
|
2018-02-12 16:17:39 +00:00
|
|
|
void clear_tracking_vars();
|
2018-03-13 11:38:33 +00:00
|
|
|
void save_correlation_results();
|
2018-03-19 10:19:55 +00:00
|
|
|
void log_data(bool integrating);
|
2018-08-11 10:56:52 +00:00
|
|
|
int32_t save_matfile();
|
2018-02-12 16:17:39 +00:00
|
|
|
|
|
|
|
// tracking configuration vars
|
2018-06-19 09:36:15 +00:00
|
|
|
Dll_Pll_Conf trk_parameters;
|
2018-02-13 14:20:30 +00:00
|
|
|
bool d_veml;
|
2018-03-19 10:19:55 +00:00
|
|
|
bool d_cloop;
|
2018-08-11 10:56:52 +00:00
|
|
|
uint32_t d_channel;
|
2018-03-13 11:38:33 +00:00
|
|
|
Gnss_Synchro *d_acquisition_gnss_synchro;
|
2018-02-12 16:17:39 +00:00
|
|
|
|
|
|
|
//Signal parameters
|
2018-03-13 11:38:33 +00:00
|
|
|
bool d_secondary;
|
|
|
|
bool interchange_iq;
|
2018-02-12 16:17:39 +00:00
|
|
|
double d_signal_carrier_freq;
|
|
|
|
double d_code_period;
|
|
|
|
double d_code_chip_rate;
|
2018-08-11 10:56:52 +00:00
|
|
|
uint32_t d_secondary_code_length;
|
|
|
|
uint32_t d_code_length_chips;
|
|
|
|
uint32_t d_code_samples_per_chip; // All signals have 1 sample per chip code except Gal. E1 which has 2 (CBOC disabled) or 12 (CBOC enabled)
|
|
|
|
int32_t d_symbols_per_bit;
|
2018-03-13 11:38:33 +00:00
|
|
|
std::string systemName;
|
|
|
|
std::string signal_type;
|
|
|
|
std::string *d_secondary_code_string;
|
2018-04-12 18:45:13 +00:00
|
|
|
std::string signal_pretty_name;
|
2018-02-12 16:17:39 +00:00
|
|
|
|
2018-08-11 10:56:52 +00:00
|
|
|
int32_t *d_gps_l1ca_preambles_symbols;
|
2018-07-13 13:23:20 +00:00
|
|
|
boost::circular_buffer<float> d_symbol_history;
|
|
|
|
|
2018-02-12 16:17:39 +00:00
|
|
|
//tracking state machine
|
2018-08-11 10:56:52 +00:00
|
|
|
int32_t d_state;
|
2018-02-12 16:17:39 +00:00
|
|
|
//Integration period in samples
|
2018-08-11 10:56:52 +00:00
|
|
|
int32_t d_correlation_length_ms;
|
|
|
|
int32_t d_n_correlator_taps;
|
2018-02-12 16:17:39 +00:00
|
|
|
|
2018-03-12 14:16:39 +00:00
|
|
|
float *d_tracking_code;
|
|
|
|
float *d_data_code;
|
|
|
|
float *d_local_code_shift_chips;
|
2018-03-13 11:38:33 +00:00
|
|
|
float *d_prompt_data_shift;
|
2018-02-12 16:17:39 +00:00
|
|
|
cpu_multicorrelator_real_codes multicorrelator_cpu;
|
2018-03-12 14:16:39 +00:00
|
|
|
cpu_multicorrelator_real_codes correlator_data_cpu; //for data channel
|
2018-03-13 11:38:33 +00:00
|
|
|
/* TODO: currently the multicorrelator does not support adding extra correlator
|
|
|
|
with different local code, thus we need extra multicorrelator instance.
|
|
|
|
Implement this functionality inside multicorrelator class
|
|
|
|
as an enhancement to increase the performance
|
|
|
|
*/
|
|
|
|
gr_complex *d_correlator_outs;
|
2018-02-12 16:17:39 +00:00
|
|
|
gr_complex *d_Very_Early;
|
|
|
|
gr_complex *d_Early;
|
|
|
|
gr_complex *d_Prompt;
|
|
|
|
gr_complex *d_Late;
|
|
|
|
gr_complex *d_Very_Late;
|
|
|
|
|
2018-03-12 14:16:39 +00:00
|
|
|
bool d_enable_extended_integration;
|
2018-08-11 10:56:52 +00:00
|
|
|
int32_t d_extend_correlation_symbols_count;
|
|
|
|
int32_t d_current_symbol;
|
2018-02-12 16:17:39 +00:00
|
|
|
|
|
|
|
gr_complex d_VE_accu;
|
|
|
|
gr_complex d_E_accu;
|
|
|
|
gr_complex d_P_accu;
|
|
|
|
gr_complex d_L_accu;
|
|
|
|
gr_complex d_VL_accu;
|
2018-03-13 11:38:33 +00:00
|
|
|
gr_complex d_last_prompt;
|
2018-02-12 16:17:39 +00:00
|
|
|
|
|
|
|
gr_complex *d_Prompt_Data;
|
|
|
|
|
|
|
|
double d_code_phase_step_chips;
|
2018-08-15 11:38:49 +00:00
|
|
|
double d_code_phase_rate_step_chips;
|
2018-09-11 18:47:32 +00:00
|
|
|
boost::circular_buffer<std::pair<double, double>> d_code_ph_history;
|
2018-02-12 16:17:39 +00:00
|
|
|
double d_carrier_phase_step_rad;
|
2018-08-28 20:26:26 +00:00
|
|
|
double d_carrier_phase_rate_step_rad;
|
2018-09-11 18:47:32 +00:00
|
|
|
boost::circular_buffer<std::pair<double, double>> d_carr_ph_history;
|
2018-02-12 16:17:39 +00:00
|
|
|
// remaining code phase and carrier phase between tracking loops
|
|
|
|
double d_rem_code_phase_samples;
|
2018-09-09 11:40:31 +00:00
|
|
|
float d_rem_carr_phase_rad;
|
2018-02-12 16:17:39 +00:00
|
|
|
|
|
|
|
// PLL and DLL filter library
|
|
|
|
Tracking_2nd_DLL_filter d_code_loop_filter;
|
|
|
|
Tracking_2nd_PLL_filter d_carrier_loop_filter;
|
|
|
|
|
|
|
|
// acquisition
|
|
|
|
double d_acq_code_phase_samples;
|
|
|
|
double d_acq_carrier_doppler_hz;
|
|
|
|
|
|
|
|
// tracking vars
|
|
|
|
double d_carr_error_hz;
|
|
|
|
double d_carr_error_filt_hz;
|
|
|
|
double d_code_error_chips;
|
|
|
|
double d_code_error_filt_chips;
|
|
|
|
double d_code_freq_chips;
|
|
|
|
double d_carrier_doppler_hz;
|
|
|
|
double d_acc_carrier_phase_rad;
|
|
|
|
double d_rem_code_phase_chips;
|
2018-03-13 11:38:33 +00:00
|
|
|
double T_chip_seconds;
|
|
|
|
double T_prn_seconds;
|
|
|
|
double T_prn_samples;
|
|
|
|
double K_blk_samples;
|
2018-03-29 07:23:23 +00:00
|
|
|
// PRN period in samples
|
2018-08-11 10:56:52 +00:00
|
|
|
int32_t d_current_prn_length_samples;
|
2018-03-29 07:23:23 +00:00
|
|
|
// processing samples counters
|
2018-08-10 18:34:03 +00:00
|
|
|
uint64_t d_sample_counter;
|
|
|
|
uint64_t d_acq_sample_stamp;
|
2018-02-12 16:17:39 +00:00
|
|
|
|
|
|
|
// CN0 estimation and lock detector
|
2018-08-11 10:56:52 +00:00
|
|
|
int32_t d_cn0_estimation_counter;
|
|
|
|
int32_t d_carrier_lock_fail_counter;
|
2018-06-19 09:36:15 +00:00
|
|
|
std::deque<float> d_carrier_lock_detector_queue;
|
2018-02-12 16:17:39 +00:00
|
|
|
double d_carrier_lock_test;
|
|
|
|
double d_CN0_SNV_dB_Hz;
|
|
|
|
double d_carrier_lock_threshold;
|
2018-03-13 11:38:33 +00:00
|
|
|
std::deque<gr_complex> d_Prompt_buffer_deque;
|
|
|
|
gr_complex *d_Prompt_buffer;
|
2018-02-12 16:17:39 +00:00
|
|
|
|
|
|
|
// file dump
|
|
|
|
std::ofstream d_dump_file;
|
2018-10-29 23:47:12 +00:00
|
|
|
std::string d_dump_filename;
|
|
|
|
bool d_dump;
|
|
|
|
bool d_dump_mat;
|
2018-02-12 16:17:39 +00:00
|
|
|
};
|
|
|
|
|
2018-03-29 07:23:23 +00:00
|
|
|
#endif // GNSS_SDR_DLL_PLL_VEML_TRACKING_H
|