3-phase PV router
Loading...
Searching...
No Matches
LoadPriorities Namespace Reference

Classes

struct  Bucket
 The fixed levels of the energy bucket, in bucket units. More...
 
struct  Switching
 The switching decision, once per mains cycle, and its state. More...
 

Functions

template<uint8_t N>
uint8_t nextToAdd (const uint8_t(&priorities)[N])
 The next logical load to switch ON: the first one OFF, in priority order.
 
template<uint8_t N>
uint8_t nextToRemove (const uint8_t(&priorities)[N])
 The next logical load to switch OFF: the last one ON, in priority order.
 
template<uint8_t N>
void rotate (uint8_t(&priorities)[N])
 Rotates the priorities by one: the last load becomes the first, the others move down one place. Each load keeps its state.
 
template<bool CALIBRATION, uint8_t N, typename IsOverridden>
void toPhysical (const uint8_t(&priorities)[N], LoadStates(&physical)[N], const bool diversionEnabled, IsOverridden isOverridden)
 Maps the logical load states to the physical ones.
 

Function Documentation

◆ nextToAdd()

template<uint8_t N>
uint8_t LoadPriorities::nextToAdd ( const uint8_t(&) priorities[N])
inline

The next logical load to switch ON: the first one OFF, in priority order.

Returns
its position in the priority array, or N if every load is ON

Definition at line 56 of file load_priorities.h.

Here is the caller graph for this function:

◆ nextToRemove()

template<uint8_t N>
uint8_t LoadPriorities::nextToRemove ( const uint8_t(&) priorities[N])
inline

The next logical load to switch OFF: the last one ON, in priority order.

Returns
its position in the priority array, or N if every load is OFF

Definition at line 75 of file load_priorities.h.

Here is the caller graph for this function:

◆ rotate()

template<uint8_t N>
void LoadPriorities::rotate ( uint8_t(&) priorities[N])
inline

Rotates the priorities by one: the last load becomes the first, the others move down one place. Each load keeps its state.

Note
Nothing to do with a single load. The loop below would start at 0 there, read priorities[-1], and wrap around: 255 writes past the array, in the ISR.

Definition at line 97 of file load_priorities.h.

Here is the caller graph for this function:

◆ toPhysical()

template<bool CALIBRATION, uint8_t N, typename IsOverridden>
void LoadPriorities::toPhysical ( const uint8_t(&) priorities[N],
LoadStates(&) physical[N],
const bool diversionEnabled,
IsOverridden isOverridden )
inline

Maps the logical load states to the physical ones.

Template Parameters
CALIBRATIONevery load stays OFF (calibration mode)
Parameters
isOverriddencallable, physical load number -> true if its override is active
Precondition
The load numbers of priorities are 0..N-1, each once: they index physical unchecked. validation.h checks loadPrioritiesAtStartup at compile time (check_load_priorities()), and rotate() only reorders them.

Definition at line 123 of file load_priorities.h.

Here is the caller graph for this function: