3-phase PV router
Loading...
Searching...
No Matches
rotation_groups.h File Reference

The rotation groups: which loads take turns, checked and resolved at compile time. More...

#include <stdint.h>
#include "config_types.h"
#include "load_map.h"
Include dependency graph for rotation_groups.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Rotation::Table< NG, NL >
 The rotation groups, resolved: the priority places each group holds. More...
 
class  Rotation::Table< 0, NL >
 No rotation group: nothing to hold, nothing to rotate. More...
 

Namespaces

namespace  Rotation
 

Functions

constexpr uint8_t Rotation::countLoads (uint32_t mask)
 Number of bits set in mask.
 
template<uint8_t NG, uint8_t MaxPins, uint8_t NL>
constexpr uint32_t Rotation::groupLoads (const RotationGroups< NG, MaxPins > &groups, const uint8_t g, const uint8_t(&loadMap)[NL])
 The loads of group g, all its codes together.
 
template<uint8_t NG, uint8_t MaxPins, uint8_t NL>
constexpr bool Rotation::groupsAreConsistent (const RotationGroups< NG, MaxPins > &groups, const uint8_t(&loadMap)[NL])
 In each group, every load is local, or every load is on the same remote unit.
 
template<uint8_t NG, uint8_t MaxPins, uint8_t NL>
constexpr bool Rotation::groupsHaveTwoLoads (const RotationGroups< NG, MaxPins > &groups, const uint8_t(&loadMap)[NL])
 Every group holds at least 2 loads.
 
template<uint8_t NL>
constexpr uint32_t Rotation::loadsOf (const uint8_t code, const uint8_t(&loadMap)[NL])
 The loads a target code stands for, by load number.
 
template<uint8_t NG, uint8_t MaxPins, uint8_t NL>
constexpr bool Rotation::noLoadTwice (const RotationGroups< NG, MaxPins > &groups, const uint8_t(&loadMap)[NL])
 No load is named twice, within a group or across groups.
 
template<uint8_t NG, uint8_t MaxPins, uint8_t NL>
 Rotation::Table (const RotationGroups< NG, MaxPins > &, const uint8_t(&)[NL], const uint8_t(&)[NL]) -> Table< NG, NL >
 Deduction guide: the groups and the loads from the arguments.
 
template<uint8_t NG, uint8_t MaxPins, uint8_t NL>
constexpr bool Rotation::targetsAreLoads (const RotationGroups< NG, MaxPins > &groups, const uint8_t(&loadMap)[NL])
 Every code of every group stands for at least one load.
 

Detailed Description

The rotation groups: which loads take turns, checked and resolved at compile time.

Author
Frédéric Metrich (frede.nosp@m.ric..nosp@m.metri.nosp@m.ch@l.nosp@m.ive.f.nosp@m.r)
Version
0.1
Date
2026-11-24

rotationGroups (config.h) lists, group by group, the loads that take turns at the top of the priority list: one group per appliance, such as the elements of a 3-phase water heater. The groups are written with target codes (config_types.h); this file turns them into load numbers, checks them for validation.h, and builds Rotation::Table: the priority places each group holds. Rotation only reorders the loads of a group among their places, so those places never change and are known at compile time.

No Arduino here: the native tests build it on the PC.

Definition in file rotation_groups.h.