mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-28 22:17:39 +00:00
Implementation of Differential Arctangent Discriminator for FLL
This commit is contained in:
@@ -33,10 +33,26 @@
|
||||
*/
|
||||
|
||||
#include "tracking_discriminators.h"
|
||||
#include "MATH_CONSTANTS.h"
|
||||
#include <cmath>
|
||||
|
||||
// All the outputs are in RADIANS
|
||||
|
||||
double phase_unwrap(double phase_rad)
|
||||
{
|
||||
if (phase_rad >= HALF_PI)
|
||||
{
|
||||
return phase_rad - PI;
|
||||
}
|
||||
else if (phase_rad <= -HALF_PI)
|
||||
{
|
||||
return phase_rad + PI;
|
||||
}
|
||||
else
|
||||
{
|
||||
return phase_rad;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* FLL four quadrant arctan discriminator:
|
||||
* \f{equation}
|
||||
@@ -54,6 +70,22 @@ double fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2, double
|
||||
return atan2(cross, dot) / (t2 - t1);
|
||||
}
|
||||
|
||||
/*
|
||||
* FLL differential arctan discriminator:
|
||||
* \f{equation}
|
||||
* e_{atan}(k)=\frac{1}{t_1-t_2}\text{phase_unwrap}(\tan^-1(\frac{Q(k)}{I(k)})-\tan^-1(\frac{Q(k-1)}{I(k-1)}))
|
||||
* \f}
|
||||
* The output is in [radians/second].
|
||||
*/
|
||||
double fll_diff_atan(gr_complex prompt_s1, gr_complex prompt_s2, double t1, double t2)
|
||||
{
|
||||
double diff_atan = atan(prompt_s2.imag() / prompt_s2.real()) - atan(prompt_s1.imag() / prompt_s1.real());
|
||||
if (std::isnan(diff_atan))
|
||||
{
|
||||
diff_atan = 0;
|
||||
}
|
||||
return phase_unwrap(diff_atan) / (t2 - t1);
|
||||
}
|
||||
|
||||
/*
|
||||
* PLL four quadrant arctan discriminator:
|
||||
|
||||
@@ -52,6 +52,19 @@
|
||||
*/
|
||||
double fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2, double t1, double t2);
|
||||
|
||||
/*
|
||||
* FLL differential arctan discriminator:
|
||||
* \f{equation}
|
||||
* e_{atan}(k)=\frac{1}{t_1-t_2}\text{phase_unwrap}(\tan^-1(\frac{Q(k)}{I(k)})-\tan^-1(\frac{Q(k-1)}{I(k-1)}))
|
||||
* \f}
|
||||
* The output is in [radians/second].
|
||||
*/
|
||||
double fll_diff_atan(gr_complex prompt_s1, gr_complex prompt_s2, double t1, double t2);
|
||||
|
||||
/*! \brief Phase unwrapping function, input is [rad]
|
||||
*
|
||||
*/
|
||||
double phase_unwrap(double phase_rad);
|
||||
|
||||
/*! \brief PLL four quadrant arctan discriminator
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user