3-phase PV router
Loading...
Searching...
No Matches
RelayDiverter< N, D > Class Template Reference

Manages a collection of relays and their behavior based on surplus and import thresholds. More...

#include <utils_relay.h>

Inheritance diagram for RelayDiverter< N, D >:
Collaboration diagram for RelayDiverter< N, D >:

Public Member Functions

constexpr RelayDiverter (const RelayEngine< N, D > &relays)
 The relays of config.h.
 
constexpr RelayDiverter (const relayOutput(&ref)[N])
 Construct a list of relays.
 
template<uint16_t V>
constexpr RelayDiverter (integral_constant< uint16_t, V >, const relayOutput(&ref)[N])
 Construct a list of relays with a custom sliding average, given with MINUTES().
 
constexpr RelayDiverter (integral_constant< uint8_t, D >, const relayOutput(&ref)[N])
 Construct a list of relays with a custom sliding average.
 
void printRelayEngineConfiguration () const
 Print the configuration of each relay.
 
- Public Member Functions inherited from RelayLogic::Engine< relayOutput, N, 10 >
constexpr Engine (const relayOutput(&ref)[N])
 Construct a list of relays.
 
constexpr const auto & get_relay (uint8_t idx) const
 Get the relay object.
 
void inc_duration () const
 Increment the duration's state of each relay.
 
void proceed_relays (const uint16_t overrideBitmask, const bool diversionEnabled=true) const
 Proceed all relays: OFF in decreasing order, ON in increasing order.
 
constexpr auto size () const
 Get the number of relays.
 

Private Types

using Base = RelayLogic::Engine< relayOutput, N, D >
 

Private Member Functions

template<uint8_t... I>
constexpr RelayDiverter (const RelayEngine< N, D > &relays, index_sequence< I... >)
 

Additional Inherited Members

- Static Public Member Functions inherited from RelayLogic::Engine< relayOutput, N, 10 >
static auto get_average ()
 Get the current average.
 
static void update_average (int16_t currentPower)
 Update the sliding average.
 
- Protected Attributes inherited from RelayLogic::Engine< relayOutput, N, 10 >
const relayOutput relay [N]
 

Detailed Description

template<uint8_t N, uint8_t D = 10>
class RelayDiverter< N, D >

Manages a collection of relays and their behavior based on surplus and import thresholds.

The decisions are those of RelayLogic::Engine (relay_engine.h), on relays that drive their pins (relayOutput). Here, the constructors, which check the sliding average duration, and the printing of the configuration. config_derived.h builds it from the RelayEngine of config.h.

Template Parameters
NThe number of relays to be managed.
DThe duration in minutes for the sliding average (default is 10 minutes).

Definition at line 111 of file utils_relay.h.

Member Typedef Documentation

◆ Base

template<uint8_t N, uint8_t D = 10>
using RelayDiverter< N, D >::Base = RelayLogic::Engine< relayOutput, N, D >
private

Definition at line 113 of file utils_relay.h.

Constructor & Destructor Documentation

◆ RelayDiverter() [1/5]

template<uint8_t N, uint8_t D = 10>
RelayDiverter< N, D >::RelayDiverter ( const relayOutput(&) ref[N])
inlineexplicitconstexpr

Construct a list of relays.

Definition at line 120 of file utils_relay.h.

Here is the caller graph for this function:

◆ RelayDiverter() [2/5]

template<uint8_t N, uint8_t D = 10>
RelayDiverter< N, D >::RelayDiverter ( integral_constant< uint8_t, D > ,
const relayOutput(&) ref[N] )
inlineconstexpr

Construct a list of relays with a custom sliding average.

The first argument, an unnamed integral_constant, only carries the sliding average duration D in its type.

Parameters
refArray of relay configurations.

Definition at line 133 of file utils_relay.h.

◆ RelayDiverter() [3/5]

template<uint8_t N, uint8_t D = 10>
template<uint16_t V>
RelayDiverter< N, D >::RelayDiverter ( integral_constant< uint16_t, V > ,
const relayOutput(&) ref[N] )
inlineconstexpr

Construct a list of relays with a custom sliding average, given with MINUTES().

Template Parameters
Vthe sliding average duration in minutes: D, once checked to fit 8 bits
Parameters
refArray of relay configurations.

Definition at line 145 of file utils_relay.h.

◆ RelayDiverter() [4/5]

template<uint8_t N, uint8_t D = 10>
RelayDiverter< N, D >::RelayDiverter ( const RelayEngine< N, D > & relays)
inlineexplicitconstexpr

The relays of config.h.

Parameters
relaysThe relays, as in config.h.

Definition at line 157 of file utils_relay.h.

Here is the call graph for this function:

◆ RelayDiverter() [5/5]

template<uint8_t N, uint8_t D = 10>
template<uint8_t... I>
RelayDiverter< N, D >::RelayDiverter ( const RelayEngine< N, D > & relays,
index_sequence< I... >  )
inlineconstexprprivate

Definition at line 182 of file utils_relay.h.

Member Function Documentation

◆ printRelayEngineConfiguration()

template<uint8_t N, uint8_t D = 10>
void RelayDiverter< N, D >::printRelayEngineConfiguration ( ) const
inline

Print the configuration of each relay.

This method outputs the configuration of all relays, including their pin assignments, thresholds, and minimum ON/OFF durations, to the Serial interface.

Definition at line 168 of file utils_relay.h.

Here is the call graph for this function:

The documentation for this class was generated from the following file: