mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-04-18 16:53:15 +00:00
Make lighter comparisons
This commit is contained in:
parent
11a77ee918
commit
8e4dcd08be
@ -40,7 +40,6 @@
|
||||
#include <cstddef>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
@ -874,7 +873,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
// PLL commands
|
||||
auto aux = static_cast<float>(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S);
|
||||
if (std::fabs(aux) > std::numeric_limits<float>::epsilon())
|
||||
if (aux != 0.0)
|
||||
{
|
||||
tmp_float = 1.0 / aux;
|
||||
}
|
||||
@ -884,7 +883,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
|
||||
}
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S);
|
||||
if (std::fabs(aux) > std::numeric_limits<float>::epsilon())
|
||||
if (aux != 0.0)
|
||||
{
|
||||
tmp_float = 1.0 / aux;
|
||||
}
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <cstddef>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
@ -876,7 +875,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
// PLL commands
|
||||
auto aux = static_cast<float>(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S);
|
||||
if (std::fabs(aux) > std::numeric_limits<float>::epsilon())
|
||||
if (aux != 0.0)
|
||||
{
|
||||
tmp_float = 1.0 / aux;
|
||||
}
|
||||
@ -886,7 +885,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
|
||||
}
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S);
|
||||
if (std::fabs(aux) > std::numeric_limits<float>::epsilon())
|
||||
if (aux != 0.0)
|
||||
{
|
||||
tmp_float = 1.0 / aux;
|
||||
}
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include <cstddef>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
@ -869,7 +868,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
// PLL commands
|
||||
auto aux = static_cast<float>(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S);
|
||||
if (std::fabs(aux) > std::numeric_limits<float>::epsilon())
|
||||
if (aux != 0.0)
|
||||
{
|
||||
tmp_float = 1.0 / aux;
|
||||
}
|
||||
@ -879,7 +878,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
|
||||
}
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S);
|
||||
if (std::fabs(aux) > std::numeric_limits<float>::epsilon())
|
||||
if (aux != 0.0)
|
||||
{
|
||||
tmp_float = 1.0 / aux;
|
||||
}
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include <cstddef>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
@ -873,7 +872,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
// PLL commands
|
||||
auto aux = static_cast<float>(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S);
|
||||
if (std::fabs(aux) > std::numeric_limits<float>::epsilon())
|
||||
if (aux != 0.0)
|
||||
{
|
||||
tmp_float = 1.0 / aux;
|
||||
}
|
||||
@ -883,7 +882,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
|
||||
}
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_float), sizeof(float));
|
||||
aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S);
|
||||
if (std::fabs(aux) > std::numeric_limits<float>::epsilon())
|
||||
if (aux != 0.0)
|
||||
{
|
||||
tmp_float = 1.0 / aux;
|
||||
}
|
||||
|
@ -34,7 +34,6 @@
|
||||
|
||||
#include "lock_detectors.h"
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
/*
|
||||
* Signal-to-Noise (SNR) (\f$\rho\f$) estimator using the Signal-to-Noise Variance (SNV) estimator:
|
||||
@ -58,8 +57,7 @@ float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, float coh_i
|
||||
float SNR_dB_Hz = 0.0;
|
||||
float Psig = 0.0;
|
||||
float Ptot = 0.0;
|
||||
const float epsilon = std::numeric_limits<float>::epsilon();
|
||||
if (length == 0 || coh_integration_time_s < epsilon)
|
||||
if (length == 0 || coh_integration_time_s == 0.0)
|
||||
{
|
||||
return -100.0;
|
||||
}
|
||||
@ -72,14 +70,11 @@ float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, float coh_i
|
||||
Psig = Psig * Psig;
|
||||
Ptot /= static_cast<float>(length);
|
||||
float aux = Ptot - Psig;
|
||||
if (aux > epsilon)
|
||||
{
|
||||
SNR = Psig / aux;
|
||||
}
|
||||
else
|
||||
if (aux == 0.0)
|
||||
{
|
||||
return -100.0;
|
||||
}
|
||||
SNR = Psig / aux;
|
||||
SNR_dB_Hz = 10.0F * std::log10(SNR) - 10.0F * std::log10(coh_integration_time_s);
|
||||
return SNR_dB_Hz;
|
||||
}
|
||||
@ -110,8 +105,7 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_
|
||||
float m_4 = 0.0;
|
||||
float aux;
|
||||
const auto n = static_cast<float>(length);
|
||||
const float epsilon = std::numeric_limits<float>::epsilon();
|
||||
if (length == 0 || coh_integration_time_s <= epsilon)
|
||||
if (length == 0 || coh_integration_time_s == 0.0)
|
||||
{
|
||||
return -100.0;
|
||||
}
|
||||
@ -131,7 +125,7 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_
|
||||
if (std::isnan(aux))
|
||||
{
|
||||
denominator = m_2 - Psig;
|
||||
if (std::fabs(denominator) < epsilon)
|
||||
if (denominator == 0)
|
||||
{
|
||||
return -100.0;
|
||||
}
|
||||
@ -140,14 +134,14 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_
|
||||
else
|
||||
{
|
||||
denominator = m_2 - aux;
|
||||
if (std::fabs(denominator) < epsilon)
|
||||
if (denominator == 0)
|
||||
{
|
||||
return -100.0;
|
||||
}
|
||||
SNR_aux = aux / denominator;
|
||||
}
|
||||
|
||||
if (std::fabs(SNR_aux) < epsilon)
|
||||
if (SNR_aux == 0)
|
||||
{
|
||||
return -100.0;
|
||||
}
|
||||
@ -179,7 +173,7 @@ float carrier_lock_detector(const gr_complex* Prompt_buffer, int length)
|
||||
}
|
||||
NBP = 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;
|
||||
if (NBP < std::numeric_limits<float>::epsilon())
|
||||
if (NBP == 0)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user