|
3-phase PV router
|
The switching decision, once per mains cycle, and its state. More...
#include <load_priorities.h>
Public Member Functions | |
| void | onHighEnergy (uint8_t(&priorities)[N], const int32_t &energy, const int32_t capacity) |
| The energy level is high: may switch the next load ON. | |
| void | onLowEnergy (uint8_t(&priorities)[N], const int32_t &energy) |
| The energy level is low: may switch the last load ON to OFF. | |
| void | onNewCycle (uint8_t(&priorities)[N], const int32_t &energy, const Bucket &bucket) |
| The decision of one mains cycle: may switch one load ON or OFF. | |
Public Attributes | |
| uint8_t | activeLoad { N } |
| int32_t | lowerThreshold { 0 } |
| uint8_t | postTransitionCount { 0 } |
| bool | recentTransition { false } |
| int32_t | upperThreshold { 0 } |
Static Public Attributes | |
| static constexpr uint8_t | POST_TRANSITION_MAX_COUNT { 3 } |
The switching decision, once per mains cycle, and its state.
| N | number of loads |
Definition at line 152 of file load_priorities.h.
|
inline |
The energy level is high: may switch the next load ON.
During a post-transition period, the upper threshold follows any increase of the energy level, and only the load switched last may switch.
Definition at line 209 of file load_priorities.h.


|
inline |
The energy level is low: may switch the last load ON to OFF.
During a post-transition period, the lower threshold follows any decrease of the energy level, and only the load switched last may switch.
Definition at line 251 of file load_priorities.h.


|
inline |
The decision of one mains cycle: may switch one load ON or OFF.
Not inlined on purpose, as updatePhysicalLoadStates() in processing.h: inlined, it grew the ISR by 76 bytes, with 4 more registers to save and a stack frame on every call. Called once per mains cycle, it costs a call and a return there. Grid simulator: average 0.1 cycle less, one-off max 2 to 8 cycles more; with remote loads, 32 cycles less on average and 77 less at most.
| energy | the level of the energy bucket |
Definition at line 173 of file load_priorities.h.


| uint8_t LoadPriorities::Switching< N >::activeLoad { N } |
the logical load switched last
Definition at line 160 of file load_priorities.h.
| int32_t LoadPriorities::Switching< N >::lowerThreshold { 0 } |
dynamic lower threshold
Definition at line 156 of file load_priorities.h.
|
staticconstexpr |
allows each transition to take effect
Definition at line 154 of file load_priorities.h.
| uint8_t LoadPriorities::Switching< N >::postTransitionCount { 0 } |
counts the number of cycles since the last transition
Definition at line 159 of file load_priorities.h.
| bool LoadPriorities::Switching< N >::recentTransition { false } |
a load state has been recently toggled
Definition at line 158 of file load_priorities.h.
| int32_t LoadPriorities::Switching< N >::upperThreshold { 0 } |
dynamic upper threshold
Definition at line 157 of file load_priorities.h.