2018-03-24 18:42:04 +00:00
|
|
|
/*!
|
|
|
|
* \file glonass_l2_ca_dll_pll_tracking_cc.h
|
|
|
|
* \brief Implementation of a code DLL + carrier PLL tracking block
|
|
|
|
* \author Damian Miralles, 2018. dmiralles2009(at)gmail.com
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Code DLL + carrier PLL according to the algorithms described in:
|
|
|
|
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
|
|
|
|
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency
|
|
|
|
* Approach, Birkha user, 2007
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-03-24 18:42:04 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2018-03-24 18:42:04 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2018-03-24 18:42:04 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-03-24 18:42:04 +00:00
|
|
|
*/
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H
|
|
|
|
#define GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H
|
2018-03-24 18:42:04 +00:00
|
|
|
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "cpu_multicorrelator.h"
|
2020-11-03 19:51:57 +00:00
|
|
|
#include "gnss_block_interface.h"
|
2018-03-24 18:42:04 +00:00
|
|
|
#include "gnss_synchro.h"
|
|
|
|
#include "tracking_2nd_DLL_filter.h"
|
|
|
|
#include "tracking_2nd_PLL_filter.h"
|
|
|
|
#include <gnuradio/block.h>
|
2019-10-26 20:24:42 +00:00
|
|
|
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
2018-03-24 18:42:04 +00:00
|
|
|
#include <fstream>
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup Tracking
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup Tracking_gnuradio_blocks
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
2018-03-24 18:42:04 +00:00
|
|
|
class Glonass_L2_Ca_Dll_Pll_Tracking_cc;
|
|
|
|
|
2020-11-03 19:51:57 +00:00
|
|
|
using glonass_l2_ca_dll_pll_tracking_cc_sptr = gnss_shared_ptr<Glonass_L2_Ca_Dll_Pll_Tracking_cc>;
|
2018-03-24 18:42:04 +00:00
|
|
|
|
|
|
|
glonass_l2_ca_dll_pll_tracking_cc_sptr
|
2018-06-06 15:25:03 +00:00
|
|
|
glonass_l2_ca_dll_pll_make_tracking_cc(
|
2018-08-12 22:54:23 +00:00
|
|
|
int64_t fs_in, uint32_t vector_length,
|
2018-03-24 18:42:04 +00:00
|
|
|
bool dump,
|
2019-09-11 22:31:34 +00:00
|
|
|
const std::string& dump_filename,
|
2018-03-24 18:42:04 +00:00
|
|
|
float pll_bw_hz,
|
|
|
|
float dll_bw_hz,
|
|
|
|
float early_late_space_chips);
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief This class implements a DLL + PLL tracking loop block
|
|
|
|
*/
|
|
|
|
class Glonass_L2_Ca_Dll_Pll_Tracking_cc : public gr::block
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
~Glonass_L2_Ca_Dll_Pll_Tracking_cc();
|
|
|
|
|
2018-08-12 22:54:23 +00:00
|
|
|
void set_channel(uint32_t channel);
|
2018-03-24 18:42:04 +00:00
|
|
|
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
|
|
|
void start_tracking();
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend glonass_l2_ca_dll_pll_tracking_cc_sptr
|
2018-06-06 15:25:03 +00:00
|
|
|
glonass_l2_ca_dll_pll_make_tracking_cc(
|
2018-08-12 22:54:23 +00:00
|
|
|
int64_t fs_in, uint32_t vector_length,
|
2018-03-24 18:42:04 +00:00
|
|
|
bool dump,
|
2019-09-11 22:31:34 +00:00
|
|
|
const std::string& dump_filename,
|
2018-03-24 18:42:04 +00:00
|
|
|
float pll_bw_hz,
|
|
|
|
float dll_bw_hz,
|
|
|
|
float early_late_space_chips);
|
|
|
|
|
2018-06-06 15:25:03 +00:00
|
|
|
Glonass_L2_Ca_Dll_Pll_Tracking_cc(
|
2018-08-12 22:54:23 +00:00
|
|
|
int64_t fs_in, uint32_t vector_length,
|
2018-03-24 18:42:04 +00:00
|
|
|
bool dump,
|
2019-09-11 22:31:34 +00:00
|
|
|
const std::string& dump_filename,
|
2018-03-24 18:42:04 +00:00
|
|
|
float pll_bw_hz,
|
|
|
|
float dll_bw_hz,
|
|
|
|
float early_late_space_chips);
|
|
|
|
|
2020-07-20 09:27:39 +00:00
|
|
|
void check_carrier_phase_coherent_initialization();
|
|
|
|
|
2020-07-01 17:52:52 +00:00
|
|
|
int32_t save_matfile() const;
|
|
|
|
|
|
|
|
volk_gnsssdr::vector<gr_complex> d_ca_code;
|
|
|
|
volk_gnsssdr::vector<gr_complex> d_correlator_outs;
|
|
|
|
volk_gnsssdr::vector<gr_complex> d_Prompt_buffer;
|
|
|
|
volk_gnsssdr::vector<float> d_local_code_shift_chips;
|
|
|
|
|
|
|
|
Cpu_Multicorrelator multicorrelator_cpu;
|
|
|
|
|
|
|
|
// PLL and DLL filter library
|
|
|
|
Tracking_2nd_DLL_filter d_code_loop_filter;
|
|
|
|
Tracking_2nd_PLL_filter d_carrier_loop_filter;
|
|
|
|
|
|
|
|
// file dump
|
|
|
|
std::string d_dump_filename;
|
|
|
|
std::ofstream d_dump_file;
|
|
|
|
|
|
|
|
std::map<std::string, std::string> systemName;
|
|
|
|
std::string sys;
|
2018-03-24 18:42:04 +00:00
|
|
|
|
|
|
|
Gnss_Synchro* d_acquisition_gnss_synchro;
|
|
|
|
|
2020-07-01 17:52:52 +00:00
|
|
|
// tracking configuration vars
|
2018-08-10 18:34:03 +00:00
|
|
|
int64_t d_fs_in;
|
|
|
|
int64_t d_glonass_freq_ch;
|
2018-03-24 18:42:04 +00:00
|
|
|
double d_early_late_spc_chips;
|
2020-07-01 17:52:52 +00:00
|
|
|
uint32_t d_vector_length;
|
|
|
|
uint32_t d_channel;
|
2018-03-24 18:42:04 +00:00
|
|
|
|
|
|
|
// remaining code phase and carrier phase between tracking loops
|
|
|
|
double d_rem_code_phase_samples;
|
|
|
|
double d_rem_code_phase_chips;
|
2020-07-10 17:52:28 +00:00
|
|
|
float d_rem_carr_phase_rad;
|
2018-03-24 18:42:04 +00:00
|
|
|
|
|
|
|
// acquisition
|
|
|
|
double d_acq_code_phase_samples;
|
|
|
|
double d_acq_carrier_doppler_hz;
|
2020-07-01 17:52:52 +00:00
|
|
|
|
2018-03-24 18:42:04 +00:00
|
|
|
// correlator
|
2018-08-12 22:54:23 +00:00
|
|
|
int32_t d_n_correlator_taps;
|
2019-10-26 20:24:42 +00:00
|
|
|
|
2018-03-24 18:42:04 +00:00
|
|
|
// tracking vars
|
|
|
|
double d_code_freq_chips;
|
|
|
|
double d_code_phase_step_chips;
|
|
|
|
double d_carrier_doppler_hz;
|
|
|
|
double d_carrier_doppler_phase_step_rad;
|
|
|
|
double d_carrier_frequency_hz;
|
|
|
|
double d_carrier_phase_step_rad;
|
|
|
|
double d_acc_carrier_phase_rad;
|
|
|
|
double d_code_phase_samples;
|
|
|
|
|
2019-08-18 20:16:13 +00:00
|
|
|
// PRN period in samples
|
2018-08-12 22:54:23 +00:00
|
|
|
int32_t d_current_prn_length_samples;
|
2018-03-24 18:42:04 +00:00
|
|
|
|
2019-08-18 20:16:13 +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-03-24 18:42:04 +00:00
|
|
|
|
|
|
|
// CN0 estimation and lock detector
|
|
|
|
double d_carrier_lock_test;
|
|
|
|
double d_CN0_SNV_dB_Hz;
|
|
|
|
double d_carrier_lock_threshold;
|
2020-07-01 17:52:52 +00:00
|
|
|
int32_t d_cn0_estimation_counter;
|
2018-08-12 22:54:23 +00:00
|
|
|
int32_t d_carrier_lock_fail_counter;
|
2018-03-24 18:42:04 +00:00
|
|
|
|
|
|
|
// control vars
|
|
|
|
bool d_enable_tracking;
|
|
|
|
bool d_pull_in;
|
2020-07-20 09:27:39 +00:00
|
|
|
bool d_acc_carrier_phase_initialized;
|
2018-03-24 18:42:04 +00:00
|
|
|
|
2020-07-01 17:52:52 +00:00
|
|
|
bool d_dump;
|
2018-03-24 18:42:04 +00:00
|
|
|
};
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H
|