mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-07 16:00:35 +00:00
Changed the "CN_estimators" library name by the more informative "lock_detectors". The CN0 estimators for GPS L1 C/A and Galileo E1 have been unified
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@254 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
3628453c52
commit
1aea9db69f
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* 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
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
* Satellite Systems receiver
|
* Satellite Systems receiver
|
||||||
@ -38,7 +38,7 @@
|
|||||||
#include "galileo_e1_dll_pll_veml_tracking_cc.h"
|
#include "galileo_e1_dll_pll_veml_tracking_cc.h"
|
||||||
#include "galileo_e1_signal_processing.h"
|
#include "galileo_e1_signal_processing.h"
|
||||||
#include "tracking_discriminators.h"
|
#include "tracking_discriminators.h"
|
||||||
#include "CN_estimators.h"
|
#include "lock_detectors.h"
|
||||||
#include "GPS_L1_CA.h"
|
#include "GPS_L1_CA.h"
|
||||||
#include "Galileo_E1.h"
|
#include "Galileo_E1.h"
|
||||||
#include "control_message_factory.h"
|
#include "control_message_factory.h"
|
||||||
@ -188,6 +188,8 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc(
|
|||||||
//systemName["C"] = std::string("Compass");
|
//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;
|
||||||
@ -315,6 +317,7 @@ galileo_e1_dll_pll_veml_tracking_cc::~galileo_e1_dll_pll_veml_tracking_cc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vector_int &ninput_items,
|
int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vector_int &ninput_items,
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
@ -423,7 +426,7 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
|
|||||||
d_cn0_estimation_counter = 0;
|
d_cn0_estimation_counter = 0;
|
||||||
|
|
||||||
// Code lock indicator
|
// Code lock indicator
|
||||||
d_CN0_SNV_dB_Hz = galileo_e1_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
|
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, Galileo_E1_B_CODE_LENGTH_CHIPS);
|
||||||
|
|
||||||
// Carrier lock indicator
|
// Carrier lock indicator
|
||||||
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
||||||
@ -599,6 +602,8 @@ void galileo_e1_dll_pll_veml_tracking_cc::set_channel_queue(concurrent_queue<int
|
|||||||
d_channel_internal_queue = channel_internal_queue;
|
d_channel_internal_queue = channel_internal_queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1_dll_pll_veml_tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
void galileo_e1_dll_pll_veml_tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||||
{
|
{
|
||||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include "galileo_e1_tcp_connector_tracking_cc.h"
|
#include "galileo_e1_tcp_connector_tracking_cc.h"
|
||||||
#include "galileo_e1_signal_processing.h"
|
#include "galileo_e1_signal_processing.h"
|
||||||
#include "tracking_discriminators.h"
|
#include "tracking_discriminators.h"
|
||||||
#include "CN_estimators.h"
|
#include "lock_detectors.h"
|
||||||
#include "GPS_L1_CA.h"
|
#include "GPS_L1_CA.h"
|
||||||
#include "Galileo_E1.h"
|
#include "Galileo_E1.h"
|
||||||
#include "control_message_factory.h"
|
#include "control_message_factory.h"
|
||||||
@ -439,8 +439,9 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_cn0_estimation_counter = 0;
|
d_cn0_estimation_counter = 0;
|
||||||
d_CN0_SNV_dB_Hz = galileo_e1_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
|
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, Galileo_E1_B_CODE_LENGTH_CHIPS);
|
||||||
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
||||||
|
|
||||||
// ###### TRACKING UNLOCK NOTIFICATION #####
|
// ###### TRACKING UNLOCK NOTIFICATION #####
|
||||||
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include "gps_sdr_signal_processing.h"
|
#include "gps_sdr_signal_processing.h"
|
||||||
#include "GPS_L1_CA.h"
|
#include "GPS_L1_CA.h"
|
||||||
#include "tracking_discriminators.h"
|
#include "tracking_discriminators.h"
|
||||||
#include "CN_estimators.h"
|
#include "lock_detectors.h"
|
||||||
#include "tracking_FLL_PLL_filter.h"
|
#include "tracking_FLL_PLL_filter.h"
|
||||||
#include "control_message_factory.h"
|
#include "control_message_factory.h"
|
||||||
#include "gnss_flowgraph.h"
|
#include "gnss_flowgraph.h"
|
||||||
@ -162,7 +162,7 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(
|
|||||||
d_CN0_SNV_dB_Hz = 0;
|
d_CN0_SNV_dB_Hz = 0;
|
||||||
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["G"] = std::string("GPS");
|
||||||
systemName["R"] = std::string("GLONASS");
|
systemName["R"] = std::string("GLONASS");
|
||||||
systemName["S"] = std::string("SBAS");
|
systemName["S"] = std::string("SBAS");
|
||||||
@ -471,7 +471,9 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_cn0_estimation_counter = 0;
|
d_cn0_estimation_counter = 0;
|
||||||
d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
|
//d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
|
||||||
|
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||||
|
|
||||||
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
||||||
// ###### TRACKING UNLOCK NOTIFICATION #####
|
// ###### TRACKING UNLOCK NOTIFICATION #####
|
||||||
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "gps_l1_ca_dll_pll_optim_tracking_cc.h"
|
#include "gps_l1_ca_dll_pll_optim_tracking_cc.h"
|
||||||
#include "gps_sdr_signal_processing.h"
|
#include "gps_sdr_signal_processing.h"
|
||||||
#include "tracking_discriminators.h"
|
#include "tracking_discriminators.h"
|
||||||
#include "CN_estimators.h"
|
#include "lock_detectors.h"
|
||||||
#include "GPS_L1_CA.h"
|
#include "GPS_L1_CA.h"
|
||||||
#include "control_message_factory.h"
|
#include "control_message_factory.h"
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
@ -507,8 +507,9 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_cn0_estimation_counter = 0;
|
d_cn0_estimation_counter = 0;
|
||||||
d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
|
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||||
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
||||||
|
|
||||||
// ###### TRACKING UNLOCK NOTIFICATION #####
|
// ###### TRACKING UNLOCK NOTIFICATION #####
|
||||||
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
||||||
{
|
{
|
||||||
@ -524,7 +525,8 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec
|
|||||||
//tracking_message = 3; //loss of lock
|
//tracking_message = 3; //loss of lock
|
||||||
//d_channel_internal_queue->push(tracking_message);
|
//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())
|
||||||
|
{
|
||||||
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
|
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
|
||||||
}
|
}
|
||||||
delete cmf;
|
delete cmf;
|
||||||
@ -540,9 +542,11 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec
|
|||||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).real();
|
current_synchro_data.Prompt_I = (double)(*d_Prompt).real();
|
||||||
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+(double)d_next_prn_length_samples+(double)d_next_rem_code_phase_samples)/(double)d_fs_in;
|
current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter +
|
||||||
// This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0
|
(double)d_next_prn_length_samples + (double)d_next_rem_code_phase_samples) / (double)d_fs_in;
|
||||||
current_synchro_data.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.Carrier_phase_rads = (double)d_acc_carrier_phase_rad;
|
current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad;
|
||||||
current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz;
|
current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz;
|
||||||
*out[0] = current_synchro_data;
|
*out[0] = current_synchro_data;
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "gps_l1_ca_dll_pll_tracking_cc.h"
|
#include "gps_l1_ca_dll_pll_tracking_cc.h"
|
||||||
#include "gps_sdr_signal_processing.h"
|
#include "gps_sdr_signal_processing.h"
|
||||||
#include "tracking_discriminators.h"
|
#include "tracking_discriminators.h"
|
||||||
#include "CN_estimators.h"
|
#include "lock_detectors.h"
|
||||||
#include "GPS_L1_CA.h"
|
#include "GPS_L1_CA.h"
|
||||||
#include "control_message_factory.h"
|
#include "control_message_factory.h"
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
@ -467,8 +467,9 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_cn0_estimation_counter = 0;
|
d_cn0_estimation_counter = 0;
|
||||||
d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
|
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||||
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
||||||
|
|
||||||
// ###### TRACKING UNLOCK NOTIFICATION #####
|
// ###### TRACKING UNLOCK NOTIFICATION #####
|
||||||
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#include "gps_l1_ca_tcp_connector_tracking_cc.h"
|
#include "gps_l1_ca_tcp_connector_tracking_cc.h"
|
||||||
#include "gps_sdr_signal_processing.h"
|
#include "gps_sdr_signal_processing.h"
|
||||||
#include "tracking_discriminators.h"
|
#include "tracking_discriminators.h"
|
||||||
#include "CN_estimators.h"
|
#include "lock_detectors.h"
|
||||||
#include "GPS_L1_CA.h"
|
#include "GPS_L1_CA.h"
|
||||||
#include "control_message_factory.h"
|
#include "control_message_factory.h"
|
||||||
#include "tcp_communication.h"
|
#include "tcp_communication.h"
|
||||||
@ -51,7 +51,6 @@
|
|||||||
#include <gnuradio/gr_io_signature.h>
|
#include <gnuradio/gr_io_signature.h>
|
||||||
#include <glog/log_severity.h>
|
#include <glog/log_severity.h>
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include "tcp_packet_data.h"
|
#include "tcp_packet_data.h"
|
||||||
|
|
||||||
@ -503,8 +502,9 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_cn0_estimation_counter = 0;
|
d_cn0_estimation_counter = 0;
|
||||||
d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
|
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||||
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
||||||
|
|
||||||
// ###### TRACKING UNLOCK NOTIFICATION #####
|
// ###### TRACKING UNLOCK NOTIFICATION #####
|
||||||
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
project : build-dir ../../../../build ;
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
obj tracking_discriminators : tracking_discriminators.cc ;
|
obj tracking_discriminators : tracking_discriminators.cc ;
|
||||||
obj CN_estimators : CN_estimators.cc ;
|
obj lock_detectors : lock_detectors.cc ;
|
||||||
obj tracking_FLL_PLL_filter : tracking_FLL_PLL_filter.cc ;
|
obj tracking_FLL_PLL_filter : tracking_FLL_PLL_filter.cc ;
|
||||||
obj tracking_2nd_PLL_filter : tracking_2nd_PLL_filter.cc ;
|
obj tracking_2nd_PLL_filter : tracking_2nd_PLL_filter.cc ;
|
||||||
obj tracking_2nd_DLL_filter : tracking_2nd_DLL_filter.cc ;
|
obj tracking_2nd_DLL_filter : tracking_2nd_DLL_filter.cc ;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
* \file CN_estimators.cc
|
* \file lock_detectors.cc
|
||||||
* \brief Implementation of a library with a set of Carrier to Noise
|
* \brief Implementation of a library with a set of code and carrier phase lock detectors.
|
||||||
* estimators and lock detectors.
|
|
||||||
*
|
*
|
||||||
* SNV_CN0 is a Carrier-to-Noise (CN0) estimator
|
* SNV_CN0 is a Carrier-to-Noise (CN0) estimator
|
||||||
* based on the Signal-to-Noise Variance (SNV) estimator [1].
|
* based on the Signal-to-Noise Variance (SNV) estimator [1].
|
||||||
@ -46,7 +45,8 @@
|
|||||||
*
|
*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#include "CN_estimators.h"
|
|
||||||
|
#include "lock_detectors.h"
|
||||||
#include "GPS_L1_CA.h"
|
#include "GPS_L1_CA.h"
|
||||||
#include "Galileo_E1.h"
|
#include "Galileo_E1.h"
|
||||||
#include <gnuradio/gr_complex.h>
|
#include <gnuradio/gr_complex.h>
|
||||||
@ -68,73 +68,28 @@
|
|||||||
* where \f$f_s\f$ is the sampling frequency and \f$L_{PRN}\f$ is the PRN sequence length.
|
* 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)
|
float cn0_svn_estimator(gr_complex* Prompt_buffer, int length, long fs_in, double code_length)
|
||||||
{
|
{
|
||||||
// estimate CN0 using buffered values
|
float SNR = 0;
|
||||||
// MATLAB CODE
|
float SNR_dB_Hz = 0;
|
||||||
// SNR_SNV(count)=Psig/(Ptot-Psig);
|
float Psig = 0;
|
||||||
// CN0_SNV_dB=10*log10(SNR_SNV)+10*log10(BW)-10*log10(PRN_length);
|
float Ptot = 0;
|
||||||
float SNR, SNR_dB_Hz;
|
|
||||||
float tmp_abs_real;
|
|
||||||
float Psig, Ptot;
|
|
||||||
Psig = 0;
|
|
||||||
Ptot = 0;
|
|
||||||
for (int i=0; i<length; i++)
|
for (int i=0; i<length; i++)
|
||||||
{
|
{
|
||||||
tmp_abs_real = std::abs(Prompt_buffer[i].real());
|
Psig += std::abs(Prompt_buffer[i].real());
|
||||||
Psig += tmp_abs_real;
|
|
||||||
Ptot += Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real();
|
Ptot += Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real();
|
||||||
}
|
}
|
||||||
Psig = Psig / (float)length;
|
Psig = Psig / (float)length;
|
||||||
Psig = Psig * Psig;
|
Psig = Psig * Psig;
|
||||||
SNR = Psig / (Ptot / (float)length - Psig);
|
Ptot = Ptot / (float)length;
|
||||||
SNR_dB_Hz = 10 * log10(SNR) + 10 * log10(fs_in/2) - 10 * log10(GPS_L1_CA_CODE_LENGTH_CHIPS);
|
SNR = Psig / (Ptot - Psig);
|
||||||
return SNR_dB_Hz;
|
SNR_dB_Hz = 10 * log10(SNR) + 10 * log10(fs_in/2) - 10 * log10((float)code_length);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
// 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_real;
|
|
||||||
float Psig, Ptot;
|
|
||||||
Psig = 0;
|
|
||||||
Ptot = 0;
|
|
||||||
for (int i=0; i<length; i++)
|
|
||||||
{
|
|
||||||
tmp_abs_real= std::abs(Prompt_buffer[i].real());
|
|
||||||
Psig += tmp_abs_real;
|
|
||||||
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;
|
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
|
* The estimate of the cosine of twice the carrier phase error is given by
|
||||||
* \f{equation}
|
* \f{equation}
|
||||||
* \cos(2\phi)=\frac{NBD}{NBP},
|
* \cos(2\phi)=\frac{NBD}{NBP},
|
||||||
* \f}
|
* \f}
|
||||||
@ -144,15 +99,10 @@ float galileo_e1_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
|
|||||||
*/
|
*/
|
||||||
float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
||||||
{
|
{
|
||||||
/*
|
float tmp_sum_I = 0;
|
||||||
* carrier lock detector
|
float tmp_sum_Q = 0;
|
||||||
*/
|
float NBD = 0;
|
||||||
// estimate using buffered values
|
float NBP = 0;
|
||||||
|
|
||||||
float tmp_sum_I, tmp_sum_Q;
|
|
||||||
tmp_sum_I = 0;
|
|
||||||
tmp_sum_Q = 0;
|
|
||||||
float NBD,NBP;
|
|
||||||
for (int i=0; i<length; i++)
|
for (int i=0; i<length; i++)
|
||||||
{
|
{
|
||||||
tmp_sum_I += Prompt_buffer[i].real();
|
tmp_sum_I += Prompt_buffer[i].real();
|
||||||
@ -162,4 +112,3 @@ float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
|||||||
NBD = tmp_sum_I*tmp_sum_I - tmp_sum_Q*tmp_sum_Q;
|
NBD = tmp_sum_I*tmp_sum_I - tmp_sum_Q*tmp_sum_Q;
|
||||||
return NBD/NBP;
|
return NBD/NBP;
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
* \file CN_estimators.h
|
* \file lock_detectors.h
|
||||||
* \brief Interface of a library with a set of Carrier to Noise
|
* \brief Interface of a library with a set of code and carrier phase lock detectors.
|
||||||
* estimators and lock detectors.
|
|
||||||
*
|
*
|
||||||
* SNV_CN0 is a Carrier-to-Noise (CN0) estimator
|
* SNV_CN0 is a Carrier-to-Noise (CN0) estimator
|
||||||
* based on the Signal-to-Noise Variance (SNV) estimator [1].
|
* based on the Signal-to-Noise Variance (SNV) estimator [1].
|
||||||
@ -23,7 +22,7 @@
|
|||||||
* </ul>
|
* </ul>
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* 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
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
* Satellite Systems receiver
|
* Satellite Systems receiver
|
||||||
@ -46,33 +45,12 @@
|
|||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GNSS_SDR_CN_ESTIMATORS_H_
|
#ifndef GNSS_SDR_LOCK_DETECTORS_H_
|
||||||
#define GNSS_SDR_CN_ESTIMATORS_H_
|
#define GNSS_SDR_LOCK_DETECTORS_H_
|
||||||
|
|
||||||
#include <gnuradio/gr_complex.h>
|
#include <gnuradio/gr_complex.h>
|
||||||
|
|
||||||
/*! \brief CN0_SNV is a Carrier-to-Noise (CN0) estimator
|
|
||||||
* based on the Signal-to-Noise Variance (SNV) estimator
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* Ref: 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.
|
|
||||||
*/
|
|
||||||
float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in);
|
|
||||||
/*! \brief CN0_SNV is a Carrier-to-Noise (CN0) estimator
|
/*! \brief CN0_SNV is a Carrier-to-Noise (CN0) estimator
|
||||||
* based on the Signal-to-Noise Variance (SNV) estimator
|
* based on the Signal-to-Noise Variance (SNV) estimator
|
||||||
*
|
*
|
||||||
@ -94,11 +72,13 @@ float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in);
|
|||||||
* IEEE 10th International Symposium on Spread Spectrum Techniques and
|
* IEEE 10th International Symposium on Spread Spectrum Techniques and
|
||||||
* Applications, pp.28-30, August 2008.
|
* Applications, pp.28-30, August 2008.
|
||||||
*/
|
*/
|
||||||
float galileo_e1_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in);
|
float cn0_svn_estimator(gr_complex* Prompt_buffer, int length, long fs_in, double code_length);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief A carrier lock detector
|
/*! \brief A carrier lock detector
|
||||||
*
|
*
|
||||||
* The Carrier Phase Lock Detector block uses the normalised estimate of the cosine of twice the carrier phase error is given by
|
* The Carrier Phase Lock Detector block uses the estimate of the cosine of twice the carrier phase error is given by
|
||||||
* \f{equation}
|
* \f{equation}
|
||||||
* C2\phi=\frac{NBD}{NBP},
|
* C2\phi=\frac{NBD}{NBP},
|
||||||
* \f}
|
* \f}
|
@ -63,7 +63,7 @@ exe gnss-sdr : main.cc
|
|||||||
../algorithms/tracking/gnuradio_blocks//galileo_e1_dll_pll_veml_tracking_cc
|
../algorithms/tracking/gnuradio_blocks//galileo_e1_dll_pll_veml_tracking_cc
|
||||||
../algorithms/tracking/gnuradio_blocks//galileo_e1_tcp_connector_tracking_cc
|
../algorithms/tracking/gnuradio_blocks//galileo_e1_tcp_connector_tracking_cc
|
||||||
../algorithms/tracking/libs//tracking_discriminators
|
../algorithms/tracking/libs//tracking_discriminators
|
||||||
../algorithms/tracking/libs//CN_estimators
|
../algorithms/tracking/libs//lock_detectors
|
||||||
../algorithms/tracking/libs//tracking_FLL_PLL_filter
|
../algorithms/tracking/libs//tracking_FLL_PLL_filter
|
||||||
../algorithms/tracking/libs//tracking_2nd_PLL_filter
|
../algorithms/tracking/libs//tracking_2nd_PLL_filter
|
||||||
../algorithms/tracking/libs//tracking_2nd_DLL_filter
|
../algorithms/tracking/libs//tracking_2nd_DLL_filter
|
||||||
|
@ -60,7 +60,7 @@ exe run_tests : test_main.cc
|
|||||||
../algorithms/tracking/gnuradio_blocks//galileo_e1_dll_pll_veml_tracking_cc
|
../algorithms/tracking/gnuradio_blocks//galileo_e1_dll_pll_veml_tracking_cc
|
||||||
../algorithms/tracking/gnuradio_blocks//galileo_e1_tcp_connector_tracking_cc
|
../algorithms/tracking/gnuradio_blocks//galileo_e1_tcp_connector_tracking_cc
|
||||||
../algorithms/tracking/libs//tracking_discriminators
|
../algorithms/tracking/libs//tracking_discriminators
|
||||||
../algorithms/tracking/libs//CN_estimators
|
../algorithms/tracking/libs//lock_detectors
|
||||||
../algorithms/tracking/libs//tracking_FLL_PLL_filter
|
../algorithms/tracking/libs//tracking_FLL_PLL_filter
|
||||||
../algorithms/tracking/libs//tracking_2nd_PLL_filter
|
../algorithms/tracking/libs//tracking_2nd_PLL_filter
|
||||||
../algorithms/tracking/libs//tracking_2nd_DLL_filter
|
../algorithms/tracking/libs//tracking_2nd_DLL_filter
|
||||||
|
Loading…
Reference in New Issue
Block a user