|
3-phase PV router
|
Implements an Exponentially Weighted Moving Average (EWMA). More...
#include <ewma_avg.hpp>

Public Member Functions | |
| void | addValue (int32_t input) |
| Add a new value and update the EMA, DEMA, and TEMA. | |
| auto | getAverageD () const |
| Get the Double Exponentially Weighted Moving Average (DEMA). | |
| auto | getAverageS () const |
| Get the Exponentially Weighted Moving Average (EMA). | |
| auto | getAverageT () const |
| Get the Triple Exponentially Weighted Moving Average (TEMA). | |
Private Attributes | |
| int32_t | ema { 0 } |
| int32_t | ema_ema { 0 } |
| int32_t | ema_ema_ema { 0 } |
| int32_t | ema_ema_ema_raw { 0 } |
| int32_t | ema_ema_raw { 0 } |
| int32_t | ema_raw { 0 } |
Implements an Exponentially Weighted Moving Average (EWMA).
The EWMA_average class calculates the Exponentially Weighted Moving Average (EMA), Double EMA (DEMA), and Triple EMA (TEMA) for a given input series. It uses integer math for efficiency, making it suitable for systems with limited computational power.
| A | The smoothing factor, which determines the weight of recent values in the average. |
For PV router applications, cloud immunity is crucial to prevent relay chattering:
TEMA (getAverageT()) is recommended for relay control as it provides:
Filter Comparison:
Tuning Guidelines:
delay_minutes * 60 / sample_period_secondsDefinition at line 107 of file ewma_avg.hpp.
|
inline |
Add a new value and update the EMA, DEMA, and TEMA.
This method processes a new input value and updates the Exponentially Weighted Moving Average (EMA), Double EMA (DEMA), and Triple EMA (TEMA).
| input | The new input value to process. |
Definition at line 118 of file ewma_avg.hpp.


|
inline |
Get the Double Exponentially Weighted Moving Average (DEMA).
Definition at line 145 of file ewma_avg.hpp.

|
inline |
Get the Exponentially Weighted Moving Average (EMA).
Definition at line 135 of file ewma_avg.hpp.

|
inline |
Get the Triple Exponentially Weighted Moving Average (TEMA).
Definition at line 155 of file ewma_avg.hpp.

|
private |
EMA value.
Definition at line 166 of file ewma_avg.hpp.
|
private |
DEMA value.
Definition at line 164 of file ewma_avg.hpp.
|
private |
TEMA value.
Definition at line 162 of file ewma_avg.hpp.
|
private |
Raw value for TEMA calculation.
Definition at line 161 of file ewma_avg.hpp.
|
private |
Raw value for DEMA calculation.
Definition at line 163 of file ewma_avg.hpp.
|
private |
Raw value for EMA calculation.
Definition at line 165 of file ewma_avg.hpp.