3-phase PV router
|
Template class for implementing a sliding average. More...
#include <movingAvg.h>
Public Member Functions | |
void | addValue (const T &_value) |
Add a value. | |
void | clear () |
Reset everything. | |
void | fillValue (const T &_value) |
auto | getAverage () const |
Get the sliding average. | |
auto | getElement (uint8_t idx) const |
constexpr uint8_t | getSize () const |
Private Member Functions | |
void | _addValue (const T &_value) |
void | _clear_sub () |
auto | _getAverage () const |
Private Attributes | |
T | _ar [DURATION_IN_MINUTES] {} |
uint8_t | _idx { 0 } |
T | _sub_ar [VALUES_PER_MINUTE] {} |
uint8_t | _sub_idx { 0 } |
conditional< is_floating_point< T >::value, T, int32_t >::type | _sub_sum { 0 } |
conditional< is_floating_point< T >::value, T, int32_t >::type | _sum { 0 } |
Static Private Attributes | |
static constexpr float | invD { 1.0 / VALUES_PER_MINUTE } |
static constexpr float | invN { 1.0 / DURATION_IN_MINUTES } |
Template class for implementing a sliding average.
T | Type of values to be stored |
DURATION_IN_MINUTES | Size of main array |
VALUES_PER_MINUTE | Size of sub array |
Drawback of this method: the average is updated only every minutes !
Definition at line 40 of file movingAvg.h.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
Add a value.
_value | Value to be added |
Definition at line 81 of file movingAvg.h.
|
inline |
Reset everything.
Definition at line 47 of file movingAvg.h.
|
inline |
Definition at line 95 of file movingAvg.h.
|
inline |
Get the sliding average.
Definition at line 115 of file movingAvg.h.
|
inline |
Definition at line 133 of file movingAvg.h.
|
inlineconstexpr |
Definition at line 146 of file movingAvg.h.
|
private |
Definition at line 196 of file movingAvg.h.
|
private |
Definition at line 190 of file movingAvg.h.
|
private |
Definition at line 195 of file movingAvg.h.
|
private |
Definition at line 191 of file movingAvg.h.
|
private |
Definition at line 193 of file movingAvg.h.
|
private |
Definition at line 192 of file movingAvg.h.
|
staticconstexprprivate |
Definition at line 198 of file movingAvg.h.
|
staticconstexprprivate |
Definition at line 199 of file movingAvg.h.