mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-27 05:27:40 +00:00
Trim CN0 smoother parameters. Add it to the FPGA block
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "exponential_smoother.h"
|
||||
#include <iostream> ///////////////
|
||||
#include <iterator>
|
||||
#include <numeric>
|
||||
|
||||
@@ -40,11 +39,11 @@ Exponential_Smoother::Exponential_Smoother()
|
||||
alpha_ = 0.001;
|
||||
old_value_ = 0.0;
|
||||
one_minus_alpha_ = 1.0 - alpha_;
|
||||
samples_for_initialization_ = 500;
|
||||
samples_for_initialization_ = 200;
|
||||
initializing_ = true;
|
||||
init_counter_ = 0;
|
||||
min_value_ = 25;
|
||||
offset_ = 9.0;
|
||||
min_value_ = 25.0;
|
||||
offset_ = 12.0;
|
||||
init_buffer_.reserve(samples_for_initialization_);
|
||||
}
|
||||
|
||||
@@ -117,7 +116,7 @@ float Exponential_Smoother::smooth(float raw)
|
||||
init_buffer_.push_back(smoothed_value);
|
||||
if (init_counter_ == samples_for_initialization_)
|
||||
{
|
||||
old_value_ = std::accumulate(std::begin(init_buffer_), std::end(init_buffer_), 0.0) / static_cast<float>(init_buffer_.size());
|
||||
old_value_ = std::accumulate(std::begin(init_buffer_), std::end(init_buffer_), 0.0f) / static_cast<float>(init_buffer_.size());
|
||||
if (old_value_ < (min_value_ + offset_))
|
||||
{
|
||||
// flush buffer and start again
|
||||
|
||||
@@ -49,8 +49,8 @@ class Exponential_Smoother
|
||||
public:
|
||||
Exponential_Smoother(); //!< Constructor
|
||||
~Exponential_Smoother(); //!< Destructor
|
||||
void set_alpha(float alpha); //!< 0 < alpha < 1. The higher, the most responsive, but more variance. Default value: 0.0001
|
||||
void set_samples_for_initialization(int num_samples); //!< Number of samples averaged for initialization. Default value:
|
||||
void set_alpha(float alpha); //!< 0 < alpha < 1. The higher, the most responsive, but more variance. Default value: 0.001
|
||||
void set_samples_for_initialization(int num_samples); //!< Number of samples averaged for initialization. Default value: 200
|
||||
void reset();
|
||||
void set_min_value(float value);
|
||||
void set_offset(float offset);
|
||||
|
||||
Reference in New Issue
Block a user