mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-27 05:27:40 +00:00
GNSS-SDR Major changes:
New tracking libraries:
- tracking_discriminators: Library with a set of code tracking and carrier tracking discriminators that is used by the tracking algorithms. (fully documented, including math algorithms using doxygen!)
- tracking_2rd_DLL_filter: Class that implements 2 order DLL filter for code tracking loop.
- tracking_2rd_PLL_filter: Class that implements 2 order PLL filter for carrier tracking loop.
- tracking_FLL_PLL_filter: Class that implements hybrid FLL and PLL filter for tracking carrier loop.
- CN_estimators: Library with a set of Carrier to Noise estimators and lock detectors. (fully documented, including math algorithms using doxygen!)
Tracking:
- gps_l1_ca_dll_pll_tracking: The existing DLL + PLL tracking module, which is the K.Borre and D.Akos one, is now completely re-factored. Now uses the above described libraries.
- gps_l1_ca_dll_fll_pll_tracking: This is a brand new tracking module, which implements the FLL assisted PLL described in Kaplan (2nd edition). (also documentedwith references)
Configuration options:
- The following tracking parameters are added:
;######### TRACKING CONFIG ############
; Tracking.implementation=GPS_L1_CA_DLL_PLL_Tracking or GPS_L1_CA_DLL_FLL_PLL_Tracking
Tracking.implementation=GPS_L1_CA_DLL_FLL_PLL_Tracking
;PLL filter bandwidth in Hz.
Tracking.pll_bw_hz=50.0;
;DLL filter bandwidth in Hz.
Tracking.dll_bw_hz=2.0;
;FLL filter bandwidth in Hz.
Tracking.fll_bw_hz=50;
;filter order: choice between 2 or 3 at this moment, only for FLL assisted PLL
Tracking.order=2;
;Correlator space in chips units
Tracking.early_late_space_chips=0.5;
Other files have also been modified with minor changes to adapt to new modules or minor bug fixes.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@80 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
141
src/algorithms/tracking/libs/CN_estimators.cc
Normal file
141
src/algorithms/tracking/libs/CN_estimators.cc
Normal file
@@ -0,0 +1,141 @@
|
||||
/*!
|
||||
* \file CN_estimators.cc
|
||||
* \brief Library with a set of Carrier to Noise estimators and lock detectors.
|
||||
* SNV_CN0 is a Carrier-to-Noise (CN0) estimator based on the Signal-to-Noise Variance (SNV) estimator [1].
|
||||
*
|
||||
* Carrier lock detector using normalised estimate of the cosine
|
||||
* of twice the carrier phase error [2].
|
||||
*
|
||||
*
|
||||
* [1] Marco Pini, Emanuela Falletti and Maurizio Fantino, "Performance
|
||||
* Evaluation of C/N0 Estimators using a Real Time GNSS Software Receiver,"
|
||||
* IEEE 10th International Symposium on Spread Spectrum Techniques and
|
||||
* Applications, pp.28-30, August 2008.
|
||||
*
|
||||
*
|
||||
*
|
||||
* [2] Van Dierendonck, A.J. (1996), Global Positioning System: Theory and
|
||||
* Applications,
|
||||
* Volume I, Chapter 8: GPS Receivers, AJ Systems, Los Altos, CA 94024.
|
||||
* Inc.: 329-407.
|
||||
*
|
||||
*
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
#include "CN_estimators.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <math.h>
|
||||
|
||||
/*!
|
||||
* Signal-to-Noise (SNR) (\f$\rho\f$) estimator using the Signal-to-Noise Variance (SNV) estimator:
|
||||
* \f{equation}
|
||||
* \hat{\rho}=\frac{\hat{P}_s}{\hat{P}_n}=\frac{\hat{P}_s}{\hat{P}_{tot}-\hat{P}_s},
|
||||
* \f}
|
||||
* where \f$\hat{P}_s=\left(\frac{1}{N}\sum^{N-1}_{i=0}|Re(Pc(i))|\right)^2\f$ is the estimation of the signal power,
|
||||
* \f$\hat{P}_{tot}=\frac{1}{N}\sum^{N-1}_{i=0}|Pc(i)|^2\f$ is the estimator of the total power, \f$|\cdot|\f$ is the absolute value,
|
||||
* \f$Re(\cdot)\f$ stands for the real part of the value, and \f$Pc(i)\f$ is the prompt correlator output for the sample index i.
|
||||
*
|
||||
* The SNR value is converted to CN0 [dB-Hz], taking to account the receiver bandwidth and the PRN code gain, using the following formula:
|
||||
* \f{equation}
|
||||
* CN0_{dB}=10*log(\hat{\rho})+10*log(\frac{f_s}{2})-10*log(L_{PRN}),
|
||||
* \f}
|
||||
* where \f$f_s\f$ is the sampling frequency and \f$L_{PRN}\f$ is the PRN sequence length.
|
||||
*/
|
||||
float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
|
||||
{
|
||||
// estimate CN0 using buffered values
|
||||
// MATLAB CODE
|
||||
//Psig=((1/N)*sum(abs(imag(x((n-N+1):n)))))^2;
|
||||
//Ptot=(1/N)*sum(abs(x((n-N+1):n)).^2);
|
||||
//SNR_SNV(count)=Psig/(Ptot-Psig);
|
||||
//CN0_SNV_dB=10*log10(SNR_SNV)+10*log10(BW)-10*log10(PRN_length);
|
||||
float SNR, SNR_dB_Hz;
|
||||
float tmp_abs_I,tmp_abs_Q;
|
||||
float Psig,Ptot;
|
||||
//float M2,M4;
|
||||
Psig=0;
|
||||
Ptot=0;
|
||||
for (int i=0;i<length;i++)
|
||||
{
|
||||
tmp_abs_I=std::abs(Prompt_buffer[i].imag());
|
||||
tmp_abs_Q=std::abs(Prompt_buffer[i].real());
|
||||
Psig+=tmp_abs_I;
|
||||
Ptot+=Prompt_buffer[i].imag()*Prompt_buffer[i].imag()+Prompt_buffer[i].real()*Prompt_buffer[i].real();
|
||||
}
|
||||
Psig=Psig/(float)length;
|
||||
Psig=Psig*Psig;
|
||||
SNR=Psig/(Ptot/(float)length-Psig);
|
||||
SNR_dB_Hz=10*log10(SNR)+10*log10(fs_in/2)-10*log10(GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||
return SNR_dB_Hz;
|
||||
}
|
||||
|
||||
/*!
|
||||
* The Carrier Phase Lock Detector block uses the normalised estimate of the cosine of twice the carrier phase error is given by
|
||||
* \f{equation}
|
||||
* C2\phi=\frac{NBD}{NBP},
|
||||
* \f}
|
||||
* where \f$NBD=(\sum^{N-1}_{i=0}|Im(Pc(i))|)^2+(\sum^{N-1}_{i=0}|Re(Pc(i))|)^2\f$,
|
||||
* \f$NBP=\sum^{N-1}_{i=0}Im(Pc(i))^2-\sum^{N-1}_{i=0}Re(Pc(i))^2\f$, and
|
||||
* \f$Pc(i)\f$ is the prompt correlator output for the sample index i.
|
||||
*/
|
||||
|
||||
float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
||||
{
|
||||
/*!
|
||||
* \todo Code lock detector
|
||||
*/
|
||||
// estimate using buffered values
|
||||
// MATLAB CODE
|
||||
// lock detector operation
|
||||
//NBD=sum(abs(imag(x((n-N+1):n))))^2 + sum(abs(real(x((n-N+1):n))))^2;
|
||||
//NBP=sum(imag(x((n-N+1):n)).^2) - sum(real(x((n-N+1):n)).^2);
|
||||
//LOCK(count)=NBD/NBP;
|
||||
float tmp_abs_I,tmp_abs_Q;
|
||||
float tmp_sum_abs_I,tmp_sum_abs_Q;
|
||||
float tmp_sum_sqr_I,tmp_sum_sqr_Q;
|
||||
tmp_sum_abs_I=0;
|
||||
tmp_sum_abs_Q=0;
|
||||
tmp_sum_sqr_I=0;
|
||||
tmp_sum_sqr_Q=0;
|
||||
float NBD,NBP;
|
||||
for (int i=0;i<length;i++)
|
||||
{
|
||||
tmp_abs_I=std::abs(Prompt_buffer[i].imag());
|
||||
tmp_abs_Q=std::abs(Prompt_buffer[i].real());
|
||||
tmp_sum_abs_I+=tmp_abs_I;
|
||||
tmp_sum_abs_Q+=tmp_abs_Q;
|
||||
tmp_sum_sqr_I+=(Prompt_buffer[i].imag()*Prompt_buffer[i].imag());
|
||||
tmp_sum_sqr_Q+=(Prompt_buffer[i].real()*Prompt_buffer[i].real());
|
||||
}
|
||||
NBD=tmp_sum_abs_I*tmp_sum_abs_I+tmp_sum_abs_Q*tmp_sum_abs_Q;
|
||||
NBP=tmp_sum_sqr_I-tmp_sum_sqr_Q;
|
||||
return NBD/NBP;
|
||||
|
||||
}
|
||||
|
||||
42
src/algorithms/tracking/libs/CN_estimators.h
Normal file
42
src/algorithms/tracking/libs/CN_estimators.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*!
|
||||
* \file CN_estimators.h
|
||||
* \brief Library with a set of Carrier to Noise estimators and lock detectors
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Library with a set of Carrier to Noise estimators and lock detectors
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef CN_ESTIMATORS_H_
|
||||
#define CN_ESTIMATORS_H_
|
||||
|
||||
#include <gnuradio/gr_complex.h>
|
||||
|
||||
float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in);
|
||||
|
||||
float carrier_lock_detector(gr_complex* Prompt_buffer, int length);
|
||||
|
||||
#endif
|
||||
7
src/algorithms/tracking/libs/jamfile.jam
Normal file
7
src/algorithms/tracking/libs/jamfile.jam
Normal file
@@ -0,0 +1,7 @@
|
||||
project : build-dir ../../../../build ;
|
||||
|
||||
obj tracking_discriminators : tracking_discriminators.cc ;
|
||||
obj CN_estimators : CN_estimators.cc ;
|
||||
obj tracking_FLL_PLL_filter : tracking_FLL_PLL_filter.cc ;
|
||||
obj tracking_2rd_PLL_filter : tracking_2rd_PLL_filter.cc ;
|
||||
obj tracking_2rd_DLL_filter : tracking_2rd_DLL_filter.cc ;
|
||||
81
src/algorithms/tracking/libs/tracking_2rd_DLL_filter.cc
Normal file
81
src/algorithms/tracking/libs/tracking_2rd_DLL_filter.cc
Normal file
@@ -0,0 +1,81 @@
|
||||
/*!
|
||||
* \file tracking_2rd_DLL_filter.cc
|
||||
* \brief Class that implements 2 order DLL filter for code tracking loop.
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that implements 2 order PLL filter for code tracking loop. The algorithm is described in [1]
|
||||
*
|
||||
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.~H.~Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
||||
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "tracking_2rd_DLL_filter.h"
|
||||
|
||||
|
||||
void tracking_2rd_DLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k){
|
||||
// Solve natural frequency
|
||||
float Wn;
|
||||
Wn = lbw*8*zeta / (4*zeta*zeta + 1);
|
||||
// solve for t1 & t2
|
||||
*tau1 = k / (Wn * Wn);
|
||||
*tau2 = (2.0 * zeta) / Wn;
|
||||
}
|
||||
|
||||
void tracking_2rd_DLL_filter::set_DLL_BW(float dll_bw_hz)
|
||||
{
|
||||
//Calculate filter coefficient values
|
||||
d_dllnoisebandwidth=dll_bw_hz;
|
||||
calculate_lopp_coef(&d_tau1_code, &d_tau2_code, d_dllnoisebandwidth, d_dlldampingratio,1.0);// Calculate filter coefficient values
|
||||
}
|
||||
void tracking_2rd_DLL_filter::initialize(float d_acq_code_phase_samples)
|
||||
{
|
||||
// code tracking loop parameters
|
||||
d_old_code_nco = 0.0;
|
||||
d_old_code_error = 0.0;
|
||||
|
||||
}
|
||||
|
||||
float tracking_2rd_DLL_filter::get_code_nco(float DLL_discriminator)
|
||||
{
|
||||
float code_nco;
|
||||
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_error = DLL_discriminator; //[chips]
|
||||
return code_nco;
|
||||
}
|
||||
|
||||
tracking_2rd_DLL_filter::tracking_2rd_DLL_filter ()
|
||||
{
|
||||
d_pdi_code = 0.001;// Summation interval for code
|
||||
d_dlldampingratio=0.7;
|
||||
}
|
||||
|
||||
tracking_2rd_DLL_filter::~tracking_2rd_DLL_filter ()
|
||||
{
|
||||
|
||||
}
|
||||
61
src/algorithms/tracking/libs/tracking_2rd_DLL_filter.h
Normal file
61
src/algorithms/tracking/libs/tracking_2rd_DLL_filter.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*!
|
||||
* \file tracking_2rd_DLL_filter.h
|
||||
* \brief Class that implements 2 order DLL filter for code tracking loop.
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that implements 2 order PLL filter for code tracking loop. The algorithm is described in [1]
|
||||
*
|
||||
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.~H.~Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
||||
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef TRACKING_2RD_DLL_FILTER_H_
|
||||
#define TRACKING_2RD_DLL_FILTER_H_
|
||||
|
||||
class tracking_2rd_DLL_filter
|
||||
{
|
||||
private:
|
||||
// PLL filter parameters
|
||||
float d_tau1_code;
|
||||
float d_tau2_code;
|
||||
float d_pdi_code;
|
||||
float d_dllnoisebandwidth;
|
||||
float d_dlldampingratio;
|
||||
|
||||
float d_old_code_error;
|
||||
float d_old_code_nco;
|
||||
|
||||
void calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k);
|
||||
public:
|
||||
void set_DLL_BW(float dll_bw_hz);
|
||||
void initialize(float d_acq_code_phase_samples);
|
||||
float get_code_nco(float DLL_discriminator);
|
||||
tracking_2rd_DLL_filter();
|
||||
~tracking_2rd_DLL_filter();
|
||||
};
|
||||
|
||||
#endif
|
||||
80
src/algorithms/tracking/libs/tracking_2rd_PLL_filter.cc
Normal file
80
src/algorithms/tracking/libs/tracking_2rd_PLL_filter.cc
Normal file
@@ -0,0 +1,80 @@
|
||||
/*!
|
||||
* \file tracking_2rd_PLL_filter.cc
|
||||
* \brief Class that implements 2 order PLL filter for tracking carrier loop.
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that implements 2 order PLL filter for tracking carrier loop. The algorithm is described in [1]
|
||||
*
|
||||
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.~H.~Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
||||
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "tracking_2rd_PLL_filter.h"
|
||||
|
||||
|
||||
void tracking_2rd_PLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k){
|
||||
// Solve natural frequency
|
||||
float Wn;
|
||||
Wn = lbw*8*zeta / (4*zeta*zeta + 1);
|
||||
// solve for t1 & t2
|
||||
*tau1 = k / (Wn * Wn);
|
||||
*tau2 = (2.0 * zeta) / Wn;
|
||||
}
|
||||
|
||||
void tracking_2rd_PLL_filter::set_PLL_BW(float pll_bw_hz)
|
||||
{
|
||||
//Calculate filter coefficient values
|
||||
d_pllnoisebandwidth=pll_bw_hz;
|
||||
calculate_lopp_coef(&d_tau1_carr, &d_tau2_carr, d_pllnoisebandwidth, d_plldampingratio,0.25);// Calculate filter coefficient values
|
||||
}
|
||||
void tracking_2rd_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
|
||||
{
|
||||
// carrier/Costas loop parameters
|
||||
d_old_carr_nco = 0.0;
|
||||
d_old_carr_error = 0.0;
|
||||
}
|
||||
|
||||
float tracking_2rd_PLL_filter::get_carrier_nco(float PLL_discriminator)
|
||||
{
|
||||
float carr_nco;
|
||||
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_error = PLL_discriminator;
|
||||
return carr_nco;
|
||||
}
|
||||
|
||||
tracking_2rd_PLL_filter::tracking_2rd_PLL_filter ()
|
||||
{
|
||||
//--- PLL variables --------------------------------------------------------
|
||||
d_pdi_carr = 0.001;// Summation interval for carrier
|
||||
d_plldampingratio=0.65;
|
||||
}
|
||||
|
||||
tracking_2rd_PLL_filter::~tracking_2rd_PLL_filter ()
|
||||
{
|
||||
|
||||
}
|
||||
62
src/algorithms/tracking/libs/tracking_2rd_PLL_filter.h
Normal file
62
src/algorithms/tracking/libs/tracking_2rd_PLL_filter.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*!
|
||||
* \file tracking_2rd_PLL_filter.h
|
||||
* \brief Class that implements 2 order PLL filter for tracking carrier loop
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that implements 2 order PLL filter for tracking carrier loop. The algorithm is described in [1]
|
||||
*
|
||||
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.~H.~Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
||||
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef TRACKING_2RD_PLL_FILTER_H_
|
||||
#define TRACKING_2RD_PLL_FILTER_H_
|
||||
|
||||
class tracking_2rd_PLL_filter
|
||||
{
|
||||
private:
|
||||
// PLL filter parameters
|
||||
float d_tau1_carr;
|
||||
float d_tau2_carr;
|
||||
float d_pdi_carr;
|
||||
|
||||
float d_pllnoisebandwidth;
|
||||
float d_plldampingratio;
|
||||
|
||||
float d_old_carr_error;
|
||||
float d_old_carr_nco;
|
||||
|
||||
void calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k);
|
||||
public:
|
||||
void set_PLL_BW(float pll_bw_hz);
|
||||
void initialize(float d_acq_carrier_doppler_hz);
|
||||
float get_carrier_nco(float PLL_discriminator);
|
||||
tracking_2rd_PLL_filter();
|
||||
~tracking_2rd_PLL_filter();
|
||||
};
|
||||
|
||||
#endif
|
||||
121
src/algorithms/tracking/libs/tracking_FLL_PLL_filter.cc
Normal file
121
src/algorithms/tracking/libs/tracking_FLL_PLL_filter.cc
Normal file
@@ -0,0 +1,121 @@
|
||||
/*!
|
||||
* \file tracking_FLL_PLL_filter.cc
|
||||
* \brief Class that implements hybrid FLL and PLL filter for tracking carrier loop
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that implements hybrid FLL and PLL filter for tracking carrier loop
|
||||
* Filter design (Kaplan 2nd ed., Pag. 181 Fig. 181)
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "tracking_FLL_PLL_filter.h"
|
||||
#include <iostream>
|
||||
|
||||
void tracking_FLL_PLL_filter::set_params(float fll_bw_hz,float pll_bw_hz, int order)
|
||||
{
|
||||
/*!
|
||||
* Filter design (Kaplan 2nd ed., Pag. 181 Fig. 181)
|
||||
*/
|
||||
d_order=order;
|
||||
if (d_order==3)
|
||||
{
|
||||
/*!
|
||||
* 3rd order PLL with 2nd order FLL assist
|
||||
*/
|
||||
d_pll_b3 = 2.400;
|
||||
d_pll_a3 = 1.100;
|
||||
d_pll_a2 = 1.414;
|
||||
d_pll_w0p = pll_bw_hz/0.7845;
|
||||
d_pll_w0p2 = d_pll_w0p*d_pll_w0p;
|
||||
d_pll_w0p3 = d_pll_w0p2*d_pll_w0p;
|
||||
|
||||
d_pll_w0f = fll_bw_hz/0.53;
|
||||
d_pll_w0f2 = d_pll_w0f*d_pll_w0f;
|
||||
}else
|
||||
{
|
||||
/*!
|
||||
* 2rd order PLL with 1st order FLL assist
|
||||
*/
|
||||
d_pll_a2 = 1.414;
|
||||
d_pll_w0p = pll_bw_hz/0.53;
|
||||
d_pll_w0p2 = d_pll_w0p*d_pll_w0p;
|
||||
d_pll_w0f = fll_bw_hz/0.25;
|
||||
}
|
||||
|
||||
}
|
||||
void tracking_FLL_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
|
||||
{
|
||||
if (d_order==3)
|
||||
{
|
||||
d_pll_x = 2.0*d_acq_carrier_doppler_hz;
|
||||
d_pll_w = 0;
|
||||
}else{
|
||||
d_pll_w = d_acq_carrier_doppler_hz;
|
||||
d_pll_x = 0;
|
||||
}
|
||||
std::cout<<" d_pll_x init = "<<d_pll_x<<"\r\n";
|
||||
}
|
||||
|
||||
float tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s)
|
||||
{
|
||||
float carrier_error_hz;
|
||||
if (d_order==3)
|
||||
{
|
||||
/*!
|
||||
* 3rd order PLL with 2nd order FLL assist
|
||||
*/
|
||||
d_pll_w = d_pll_w + correlation_time_s * (d_pll_w0p3 * PLL_discriminator + d_pll_w0f2 * FLL_discriminator);
|
||||
d_pll_x = d_pll_x + correlation_time_s * (0.5*d_pll_w + d_pll_a2 * d_pll_w0f * FLL_discriminator + d_pll_a3 * d_pll_w0p2 * PLL_discriminator);
|
||||
carrier_error_hz = 0.5*d_pll_x + d_pll_b3 * d_pll_w0p * PLL_discriminator;
|
||||
}else
|
||||
{
|
||||
/*!
|
||||
* 2rd order PLL with 1st order FLL assist
|
||||
*/
|
||||
float pll_w_new;
|
||||
pll_w_new = d_pll_w + PLL_discriminator*d_pll_w0p2*correlation_time_s + FLL_discriminator*d_pll_w0f*correlation_time_s ;
|
||||
carrier_error_hz = 0.5*(pll_w_new + d_pll_w)+d_pll_a2 * d_pll_w0p*PLL_discriminator;
|
||||
d_pll_w =pll_w_new;
|
||||
/*std::cout<<" d_pll_w = "<<carrier_error_hz<<
|
||||
", pll_w_new = "<<pll_w_new
|
||||
<<", PLL_discriminator=" <<PLL_discriminator
|
||||
<<" FLL_discriminator ="<<FLL_discriminator
|
||||
<<" correlation_time_s = "<<correlation_time_s<<"\r\n";*/
|
||||
}
|
||||
|
||||
return carrier_error_hz;
|
||||
|
||||
}
|
||||
|
||||
tracking_FLL_PLL_filter::tracking_FLL_PLL_filter ()
|
||||
{
|
||||
}
|
||||
|
||||
tracking_FLL_PLL_filter::~tracking_FLL_PLL_filter ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
59
src/algorithms/tracking/libs/tracking_FLL_PLL_filter.h
Normal file
59
src/algorithms/tracking/libs/tracking_FLL_PLL_filter.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*!
|
||||
* \file tracking_FLL_PLL_filter.h
|
||||
* \brief Class that implements hybrid FLL and PLL filter for tracking carrier loop
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that implements hybrid FLL and PLL filter for tracking carrier loop
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef TRACKING_FLL_PLL_FILTER_H_
|
||||
#define TRACKING_FLL_PLL_FILTER_H_
|
||||
|
||||
class tracking_FLL_PLL_filter
|
||||
{
|
||||
private:
|
||||
// FLL + PLL filter parameters
|
||||
int d_order;
|
||||
float d_pll_w;
|
||||
float d_pll_w0p3;
|
||||
float d_pll_w0f2;
|
||||
float d_pll_x;
|
||||
float d_pll_a2;
|
||||
float d_pll_w0f;
|
||||
float d_pll_a3;
|
||||
float d_pll_w0p2;
|
||||
float d_pll_b3;
|
||||
float d_pll_w0p;
|
||||
public:
|
||||
void set_params(float fll_bw_hz,float pll_bw_hz, int order);
|
||||
void initialize(float d_acq_carrier_doppler_hz);
|
||||
float get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s);
|
||||
tracking_FLL_PLL_filter();
|
||||
~tracking_FLL_PLL_filter();
|
||||
};
|
||||
|
||||
#endif
|
||||
97
src/algorithms/tracking/libs/tracking_discriminators.cc
Normal file
97
src/algorithms/tracking/libs/tracking_discriminators.cc
Normal file
@@ -0,0 +1,97 @@
|
||||
/*!
|
||||
* \file tracking_discriminators.cc
|
||||
* \brief Library with a set of code tracking and carrier tracking discriminators that is used by the tracking algorithms
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "tracking_discriminators.h"
|
||||
#include <math.h>
|
||||
|
||||
// All the outputs are in RADIANS
|
||||
/*!
|
||||
* FLL four quadrant arctan discriminator:
|
||||
* \f{equation}
|
||||
* \frac{\phi_2-\phi_1}{t_2-t1}=\frac{ATAN2(cross,dot)}{t_1-t_2},
|
||||
* \f}
|
||||
* where \f$cross=I_{PS1}Q_{PS2}-I_{PS2}Q_{PS1}\f$ and \f$dot=I_{PS1}I_{PS2}+Q_{PS1}Q_{PS2}\f$,
|
||||
* \f$I_{PS1},Q_{PS1}\f$ are the inphase and quadrature prompt correlator outputs respectively at sample time \f$t_1\f$, and
|
||||
* \f$I_{PS2},Q_{PS2}\f$ are the inphase and quadrature prompt correlator outputs respectively at sample time \f$t_2\f$. The output is in [radians/second].
|
||||
*/
|
||||
|
||||
float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1, float t2)
|
||||
{
|
||||
float cross,dot;
|
||||
dot=prompt_s1.imag()*prompt_s2.imag()+prompt_s1.real()*prompt_s2.real();
|
||||
cross=prompt_s1.imag()*prompt_s2.real()-prompt_s2.imag()*prompt_s1.real();
|
||||
return atan2(cross,dot)/(t2-t1);
|
||||
}
|
||||
|
||||
/*!
|
||||
* PLL four quadrant arctan discriminator:
|
||||
* \f{equation}
|
||||
* \phi=ATAN2(Q_{PS},I_{PS}),
|
||||
* \f}
|
||||
* where \f$I_{PS1},Q_{PS1}\f$ are the inphase and quadrature prompt correlator outputs respectively. The output is in [radians].
|
||||
*/
|
||||
float pll_four_quadrant_atan(gr_complex prompt_s1)
|
||||
{
|
||||
return atan2(prompt_s1.real(),prompt_s1.imag());
|
||||
}
|
||||
|
||||
/*!
|
||||
* PLL Costas loop two quadrant arctan discriminator:
|
||||
* \f{equation}
|
||||
* \phi=ATAN\left(\frac{Q_{PS}}{I_{PS}}\right),
|
||||
* \f}
|
||||
* where \f$I_{PS1},Q_{PS1}\f$ are the inphase and quadrature prompt correlator outputs respectively. The output is in [radians].
|
||||
*/
|
||||
|
||||
float pll_cloop_two_quadrant_atan(gr_complex prompt_s1)
|
||||
{
|
||||
if (prompt_s1.imag()!=0.0)
|
||||
{
|
||||
return atan(prompt_s1.real()/prompt_s1.imag());
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*!
|
||||
* DLL Noncoherent Early minus Late envelope normalized discriminator:
|
||||
* \f{equation}
|
||||
* error=\frac{E-L}{E+L},
|
||||
* \f}
|
||||
* where \f$E=\sqrt{I_{ES}^2,Q_{ES}^2}\f$ is the Early correlator output absolute value and
|
||||
* \f$L=\sqrt{I_{LS}^2,Q_{LS}^2}\f$ is the Late correlator output absolute value. The output is in [chips].
|
||||
*/
|
||||
float dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1)
|
||||
{
|
||||
float P_early, P_late;
|
||||
P_early=std::abs(early_s1);
|
||||
P_late=std::abs(late_s1);
|
||||
return (P_early-P_late)/((P_early+P_late));
|
||||
}
|
||||
47
src/algorithms/tracking/libs/tracking_discriminators.h
Normal file
47
src/algorithms/tracking/libs/tracking_discriminators.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*!
|
||||
* \file tracking_discriminators.h
|
||||
* \brief Library with a set of code tracking and carrier tracking disctiminators
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Library with a set of code tracking and carrier tracking disctiminators that is used by the tracking algorithms
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef TRACKING_DISCRIMINATORS_H_
|
||||
#define TRACKING_DISCRIMINATORS_H_
|
||||
|
||||
#include <gnuradio/gr_complex.h>
|
||||
|
||||
float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1, float t2);
|
||||
|
||||
float pll_four_quadrant_atan(gr_complex prompt_s1);
|
||||
|
||||
float pll_cloop_two_quadrant_atan(gr_complex prompt_s1);
|
||||
|
||||
float dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1);
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user