3-phase PV router
|
This class implements the relay management engine. More...
#include <utils_relay.h>
Public Member Functions | |
constexpr | RelayEngine (const relayOutput(&ref)[N]) |
Construct a list of relays. | |
constexpr | RelayEngine (integral_constant< uint8_t, D > ic, const relayOutput(&ref)[N]) |
Construct a list of relays with a custom sliding average. | |
constexpr const auto & | get_relay (uint8_t idx) const |
Get the relay object. | |
constexpr auto | get_size () const |
Get the number of relays. | |
void | inc_duration () const |
Increment the duration's state of each relay. | |
void | initializePins () const |
Initialize the pins used by the relays. | |
void | printConfiguration () const |
Print the configuration of each relay. | |
void | proceed_relays () const |
Proceed all relays in increasing order (surplus) or decreasing order (import) | |
Static Public Member Functions | |
static auto | get_average () |
Get the current average. | |
static void | update_average (int16_t currentPower) |
Update the sliding average. | |
Private Attributes | |
const relayOutput | relay [N] |
uint8_t | settle_change { 60 } |
Static Private Attributes | |
static EWMA_average< D *60/DATALOG_PERIOD_IN_SECONDS > | ewma_average |
This class implements the relay management engine.
D | The duration in minutes of the sliding average |
N | The number of relays to be used. This parameter is deduced automatically. |
Definition at line 252 of file utils_relay.h.
|
inlineexplicitconstexpr |
Construct a list of relays.
Definition at line 259 of file utils_relay.h.
|
inlineconstexpr |
Construct a list of relays with a custom sliding average.
Definition at line 268 of file utils_relay.h.
|
inlinestatic |
Get the current average.
Definition at line 299 of file utils_relay.h.
|
inlineconstexpr |
Get the relay object.
idx | The index of the relay |
Definition at line 289 of file utils_relay.h.
|
inlineconstexpr |
Get the number of relays.
Definition at line 278 of file utils_relay.h.
void RelayEngine< N, D >::inc_duration |
Increment the duration's state of each relay.
Definition at line 402 of file utils_relay.h.
|
inline |
Initialize the pins used by the relays.
Definition at line 368 of file utils_relay.h.
|
inline |
Print the configuration of each relay.
Definition at line 382 of file utils_relay.h.
|
inline |
Proceed all relays in increasing order (surplus) or decreasing order (import)
Definition at line 328 of file utils_relay.h.
|
inlinestatic |
Update the sliding average.
currentPower | Current power at the grid |
Definition at line 309 of file utils_relay.h.
|
inlinestaticprivate |
EWMA average
Definition at line 399 of file utils_relay.h.
|
private |
Array of relays
Definition at line 395 of file utils_relay.h.
|
mutableprivate |
Delay in seconds until next change occurs
Definition at line 397 of file utils_relay.h.