1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-15 15:47:42 +00:00

First version of Galileo E1 DLL PLL Very Early Minus Late Tracking. Added some functions in Matlab to analyze the results.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@234 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Luis Esteve
2012-08-28 13:38:33 +00:00
parent 2bb7afc0ee
commit 45d7220dae
23 changed files with 2021 additions and 27 deletions

View File

@@ -42,6 +42,7 @@
*/
#include "CN_estimators.h"
#include "GPS_L1_CA.h"
#include "Galileo_E1.h"
#include <gnuradio/gr_complex.h>
#include <math.h>
@@ -87,6 +88,47 @@ float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
return SNR_dB_Hz;
}
/*
* 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 galileo_e1_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_imag;
float Psig, Ptot;
Psig = 0;
Ptot = 0;
for (int i=0; i<length; i++)
{
tmp_abs_imag = std::abs(Prompt_buffer[i].imag());
Psig += tmp_abs_imag;
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(Galileo_E1_B_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}

View File

@@ -56,6 +56,7 @@
* Applications, pp.28-30, August 2008.
*/
float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in);
float galileo_e1_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in);
/*! \brief A carrier lock detector
*

View File

@@ -109,6 +109,39 @@ void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr
}
}
void Correlator::Carrier_wipeoff_and_VEPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* VE_code,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* VL_code,gr_complex* VE_out,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,gr_complex* VL_out,bool input_vector_aligned)
{
gr_complex* bb_signal;
gr_complex* input_aligned;
//todo: do something if posix_memalign fails
if (posix_memalign((void**)&bb_signal, 16, signal_length_samples * sizeof(gr_complex)) == 0) {};
if (input_vector_aligned==false)
{
//todo: do something if posix_memalign fails
if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){};
memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex));
volk_32fc_x2_multiply_32fc_a(bb_signal, input_aligned, carrier, signal_length_samples);
}else{
//use directly the input vector
volk_32fc_x2_multiply_32fc_a(bb_signal, input, carrier, signal_length_samples);
}
volk_32fc_x2_dot_prod_32fc_a(VE_out, bb_signal, VE_code, signal_length_samples * sizeof(gr_complex));
volk_32fc_x2_dot_prod_32fc_a(E_out, bb_signal, E_code, signal_length_samples * sizeof(gr_complex));
volk_32fc_x2_dot_prod_32fc_a(P_out, bb_signal, P_code, signal_length_samples * sizeof(gr_complex));
volk_32fc_x2_dot_prod_32fc_a(L_out, bb_signal, L_code, signal_length_samples * sizeof(gr_complex));
volk_32fc_x2_dot_prod_32fc_a(VL_out, bb_signal, VL_code, signal_length_samples * sizeof(gr_complex));
free(bb_signal);
if (input_vector_aligned==false)
{
free(input_aligned);
}
}
void Correlator::cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a()
{
//

View File

@@ -51,6 +51,7 @@ class Correlator
public:
void Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out);
void Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,bool input_vector_aligned);
void Carrier_wipeoff_and_VEPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* VE_code,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* VL_code,gr_complex* VE_out,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,gr_complex* VL_out,bool input_vector_aligned);
Correlator();
~Correlator();
private:

View File

@@ -77,7 +77,11 @@ float Tracking_2nd_DLL_filter::get_code_nco(float DLL_discriminator)
return code_nco;
}
Tracking_2nd_DLL_filter::Tracking_2nd_DLL_filter (float pdi_code)
{
d_pdi_code = pdi_code;// Summation interval for code
d_dlldampingratio = 0.7;
}
Tracking_2nd_DLL_filter::Tracking_2nd_DLL_filter ()
{
@@ -85,7 +89,6 @@ Tracking_2nd_DLL_filter::Tracking_2nd_DLL_filter ()
d_dlldampingratio = 0.7;
}
Tracking_2nd_DLL_filter::~Tracking_2nd_DLL_filter ()
{}

View File

@@ -62,6 +62,7 @@ public:
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
float get_code_nco(float DLL_discriminator); //! Numerically controlled oscillator
Tracking_2nd_DLL_filter(float pdi_code);
Tracking_2nd_DLL_filter();
~Tracking_2nd_DLL_filter();
};

View File

@@ -77,6 +77,12 @@ float Tracking_2nd_PLL_filter::get_carrier_nco(float PLL_discriminator)
return carr_nco;
}
Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter (float pdi_carr)
{
//--- PLL variables --------------------------------------------------------
d_pdi_carr = pdi_carr;// Summation interval for carrier
d_plldampingratio=0.65;
}
Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter ()

View File

@@ -63,6 +63,7 @@ public:
void set_PLL_BW(float pll_bw_hz); //! Set PLL loop bandwidth [Hz]
void initialize(float d_acq_carrier_doppler_hz);
float get_carrier_nco(float PLL_discriminator);
Tracking_2nd_PLL_filter(float pdi_carr);
Tracking_2nd_PLL_filter();
~Tracking_2nd_PLL_filter();
};

View File

@@ -3,11 +3,12 @@
* \brief Implementation of a 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
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
*
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@@ -91,8 +92,8 @@ float pll_cloop_two_quadrant_atan(gr_complex prompt_s1)
* \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].
* 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)
{
@@ -101,3 +102,19 @@ float dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1)
P_late = std::abs(late_s1);
return (P_early - P_late) / ((P_early + P_late));
}
/*
* DLL Noncoherent Very Early Minus Late Power (VEMLP) normalized discriminator:
* \f{equation}
* error=\frac{E-L}{E+L},
* \f}
* where \f$E=\sqrt{I_{VE}^2+Q_{VE}^2+I_{E}^2+Q_{E}^2}\f$ and
* \f$L=\sqrt{I_{VL}^2+Q_{VL}^2+I_{L}^2+Q_{L}^2}\f$ . The output is in [chips].
*/
float dll_nc_vemlp_normalized(gr_complex very_early_s1, gr_complex early_s1, gr_complex late_s1, gr_complex very_late_s1)
{
float P_early, P_late;
P_early = std::sqrt(std::norm(very_early_s1)+std::norm(early_s1));
P_late = std::sqrt(std::norm(very_late_s1)+std::norm(late_s1));
return (P_early - P_late) / ((P_early + P_late));
}

View File

@@ -3,13 +3,14 @@
* \brief Interface of a library with a set of code tracking and carrier
* tracking discriminators.
* \author Javier Arribas, 2011. jarribas(at)cttc.es
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
*
* Library with a set of code tracking and carrier tracking discriminators
* that is used by the tracking algorithms.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@@ -84,4 +85,16 @@ 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);
/*! \brief DLL Noncoherent Very Early Minus Late Power (VEMLP) normalized discriminator
*
* DLL Noncoherent Very Early Minus Late Power (VEMLP) normalized discriminator:
* \f{equation}
* error=\frac{E-L}{E+L},
* \f}
* where \f$E=\sqrt{I_{VE}^2+Q_{VE}^2+I_{E}^2+Q_{E}^2}\f$ and
* \f$L=\sqrt{I_{VL}^2+Q_{VL}^2+I_{L}^2+Q_{L}^2}\f$ . The output is in [chips].
*/
float dll_nc_vemlp_normalized(gr_complex very_early_s1, gr_complex early_s1, gr_complex late_s1, gr_complex very_late_s1);
#endif