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

The windows of the scheduled boosts, in milliseconds from the start of the off-peak period. More...

Classes

struct  Boost
 A boost resolved for a given off-peak duration: its window in ms and its target masks. More...
 

Functions

constexpr bool endsWithinOffPeak (const BoostWindow &window, const uint8_t offPeakHours)
 Whether a window with FOR() ends within the off-peak period (its end may be the end of the period): a longer one is a mistake, since the meter would cut it short.
 
constexpr bool hasLength (const BoostWindow &window)
 Whether the boost lasts at all: a length of 0 is no boost.
 
constexpr bool inWindow (const uint32_t elapsed, const uint32_t start, const uint32_t end)
 Whether the boost is in its window.
 
template<uint8_t N, uint8_t MaxPins>
constexpr Boost resolve (const BoostSchedule< N, MaxPins > &boosts, const uint8_t i, const uint8_t offPeakHours)
 Boost i of boosts, for an off-peak period of offPeakHours.
 
constexpr int32_t startInMinutes (const BoostWindow &window, const uint8_t offPeakHours)
 The start of the window, in minutes from the start of the off-peak period: negative if before it.
 
constexpr bool startsWithinOffPeak (const BoostWindow &window, const uint8_t offPeakHours)
 Whether the window starts within the off-peak period: otherwise, it would never open.
 
constexpr uint32_t windowEnd (const BoostWindow &window, const uint8_t offPeakHours)
 The end of the boost window (excluded), in ms from the start of the off-peak period.
 
constexpr uint32_t windowStart (const BoostWindow &window, const uint8_t offPeakHours)
 The start of the boost window, in ms from the start of the off-peak period.
 

Detailed Description

The windows of the scheduled boosts, in milliseconds from the start of the off-peak period.

Function Documentation

◆ endsWithinOffPeak()

bool DualTariff::endsWithinOffPeak ( const BoostWindow & window,
const uint8_t offPeakHours )
constexpr

Whether a window with FOR() ends within the off-peak period (its end may be the end of the period): a longer one is a mistake, since the meter would cut it short.

Returns
true for UNTIL_THE_END: only the meter ends such a boost

Definition at line 202 of file utils_dualtariff.h.

Here is the call graph for this function:

◆ hasLength()

bool DualTariff::hasLength ( const BoostWindow & window)
constexpr

Whether the boost lasts at all: a length of 0 is no boost.

Definition at line 212 of file utils_dualtariff.h.

◆ inWindow()

bool DualTariff::inWindow ( const uint32_t elapsed,
const uint32_t start,
const uint32_t end )
constexpr

Whether the boost is in its window.

Parameters
elapsedms since the start of the off-peak period: millis() - its start, which stays right when millis() wraps around

Definition at line 148 of file utils_dualtariff.h.

◆ resolve()

template<uint8_t N, uint8_t MaxPins>
Boost DualTariff::resolve ( const BoostSchedule< N, MaxPins > & boosts,
const uint8_t i,
const uint8_t offPeakHours )
constexpr

Boost i of boosts, for an off-peak period of offPeakHours.

Definition at line 228 of file utils_dualtariff.h.

Here is the call graph for this function:

◆ startInMinutes()

int32_t DualTariff::startInMinutes ( const BoostWindow & window,
const uint8_t offPeakHours )
constexpr

The start of the window, in minutes from the start of the off-peak period: negative if before it.

Definition at line 182 of file utils_dualtariff.h.

Here is the caller graph for this function:

◆ startsWithinOffPeak()

bool DualTariff::startsWithinOffPeak ( const BoostWindow & window,
const uint8_t offPeakHours )
constexpr

Whether the window starts within the off-peak period: otherwise, it would never open.

Definition at line 189 of file utils_dualtariff.h.

Here is the call graph for this function:

◆ windowEnd()

uint32_t DualTariff::windowEnd ( const BoostWindow & window,
const uint8_t offPeakHours )
constexpr

The end of the boost window (excluded), in ms from the start of the off-peak period.

Returns
UINT32_MAX for UNTIL_THE_END: the end of the off-peak period stops any boost anyway

Definition at line 172 of file utils_dualtariff.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ windowStart()

uint32_t DualTariff::windowStart ( const BoostWindow & window,
const uint8_t offPeakHours )
constexpr

The start of the boost window, in ms from the start of the off-peak period.

A start before the period wraps around to a very large value: the window then never opens. validation.h rejects such a window at compile time, with startsWithinOffPeak().

Parameters
offPeakHoursthe duration of the off-peak period, in hours (12 at most)

Definition at line 161 of file utils_dualtariff.h.

Here is the caller graph for this function: