diff --git a/src/algorithms/tracking/libs/lock_detectors.cc b/src/algorithms/tracking/libs/lock_detectors.cc index b66e3a15d..6633b893a 100644 --- a/src/algorithms/tracking/libs/lock_detectors.cc +++ b/src/algorithms/tracking/libs/lock_detectors.cc @@ -65,23 +65,23 @@ * where \f$T_{int}\f$ is the coherent integration time, in seconds. * */ -float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, double coh_integration_time_s) +float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, float coh_integration_time_s) { - double SNR = 0.0; - double SNR_dB_Hz = 0.0; - double Psig = 0.0; - double Ptot = 0.0; + float SNR = 0.0; + float SNR_dB_Hz = 0.0; + float Psig = 0.0; + float Ptot = 0.0; for (int i = 0; i < length; i++) { - Psig += std::abs(static_cast(Prompt_buffer[i].real())); - Ptot += static_cast(Prompt_buffer[i].imag()) * static_cast(Prompt_buffer[i].imag()) + static_cast(Prompt_buffer[i].real()) * static_cast(Prompt_buffer[i].real()); + Psig += std::abs(Prompt_buffer[i].real()); + Ptot += Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real(); } - Psig /= static_cast(length); + Psig /= static_cast(length); Psig = Psig * Psig; - Ptot /= static_cast(length); + Ptot /= static_cast(length); SNR = Psig / (Ptot - Psig); - SNR_dB_Hz = 10.0 * log10(SNR) - 10.0 * log10(coh_integration_time_s); - return static_cast(SNR_dB_Hz); + SNR_dB_Hz = 10.0 * std::log10(SNR) - 10.0 * std::log10(coh_integration_time_s); + return SNR_dB_Hz; } diff --git a/src/algorithms/tracking/libs/lock_detectors.h b/src/algorithms/tracking/libs/lock_detectors.h index 90dc90fcb..81d54b651 100644 --- a/src/algorithms/tracking/libs/lock_detectors.h +++ b/src/algorithms/tracking/libs/lock_detectors.h @@ -72,7 +72,7 @@ * IEEE 10th International Symposium on Spread Spectrum Techniques and * Applications, pp.28-30, August 2008. */ -float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, double coh_integration_time_s); +float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, float coh_integration_time_s); /*! \brief A carrier lock detector