1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 21:23:02 +00:00

Move constants to implementation, fix typos in comments

This commit is contained in:
Carles Fernandez 2019-03-19 20:16:59 +01:00
parent 4bc4fb9988
commit 296d6d66c9
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 8 additions and 15 deletions

View File

@ -4,7 +4,7 @@
* \author Cillian O'Driscoll, 2015. cillian.odriscoll(at)gmail.com
*
* Class implementing a generic 1st, 2nd or 3rd order loop filter. Based
* on the bilinear transform of the standard Weiner filter.
* on the bilinear transform of the standard Wiener filter.
*
* -------------------------------------------------------------------------
*
@ -36,6 +36,8 @@
#include <glog/logging.h>
#include <cmath>
const int MAX_LOOP_ORDER = 3;
const int MAX_LOOP_HISTORY_LENGTH = 4;
Tracking_loop_filter::Tracking_loop_filter(float update_interval,
float noise_bandwidth,
@ -74,7 +76,7 @@ float Tracking_loop_filter::apply(float current_input)
// Now apply the filter coefficients:
float result = 0.0;
// Hanlde the old outputs first:
// Handle the old outputs first:
for (unsigned int ii = 0; ii < d_output_coefficients.size(); ++ii)
{
result += d_output_coefficients[ii] * d_outputs[(d_current_index + ii) % MAX_LOOP_HISTORY_LENGTH];
@ -95,16 +97,13 @@ float Tracking_loop_filter::apply(float current_input)
d_inputs[d_current_index] = current_input;
for (unsigned int ii = 0; ii < d_input_coefficients.size(); ++ii)
{
result += d_input_coefficients[ii] * d_inputs[(d_current_index + ii) % MAX_LOOP_HISTORY_LENGTH];
}
d_outputs[d_current_index] = result;
return result;
}
@ -179,7 +178,6 @@ void Tracking_loop_filter::update_coefficients(void)
d_output_coefficients[0] = 1.0;
}
break;
case 3:
wn = d_noise_bandwidth / 0.7845; // From Kaplan
float a3 = 1.1;
@ -208,7 +206,6 @@ void Tracking_loop_filter::update_coefficients(void)
d_input_coefficients[1] = g1 * T * T / 2.0 - 2.0 * g3;
d_input_coefficients[2] = g3 + T / 2.0 * (-g2 + T / 2.0 * g1);
d_output_coefficients.resize(2);
d_output_coefficients[0] = 2.0;
d_output_coefficients[1] = -1.0;
@ -260,10 +257,9 @@ void Tracking_loop_filter::set_order(int loop_order)
{
if (loop_order < 1 or loop_order > MAX_LOOP_ORDER)
{
LOG(ERROR) << "Ignoring attempt to set loop order to " << loop_order
<< ". Maximum allowed order is: " << MAX_LOOP_ORDER
<< ". Not changing current value of " << d_loop_order;
LOG(WARNING) << "Ignoring attempt to set loop order to " << loop_order
<< ". Maximum allowed order is: " << MAX_LOOP_ORDER
<< ". Not changing current value of " << d_loop_order;
return;
}

View File

@ -4,7 +4,7 @@
* \author Cillian O'Driscoll, 2015. cillian.odriscoll(at)gmail.com
*
* Class implementing a generic 1st, 2nd or 3rd order loop filter. Based
* on the bilinear transform of the standard Weiner filter.
* on the bilinear transform of the standard Wiener filter.
*
* -------------------------------------------------------------------------
*
@ -33,8 +33,6 @@
#ifndef GNSS_SDR_TRACKING_LOOP_FILTER_H_
#define GNSS_SDR_TRACKING_LOOP_FILTER_H_
#define MAX_LOOP_ORDER 3
#define MAX_LOOP_HISTORY_LENGTH 4
#include <vector>
@ -74,7 +72,6 @@ private:
// Compute the filter coefficients:
void update_coefficients(void);
public:
float get_noise_bandwidth(void) const;
float get_update_interval(void) const;