3-phase PV router
Loading...
Searching...
No Matches
Dual tariff feature

Functions used for managing dual tariff periods. More...

Namespaces

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

Classes

struct  DualTariff::Boost
 A boost resolved for a given off-peak duration: its window in ms and its target masks. More...
 
struct  BoostTable
 The scheduled boosts, resolved for the off-peak duration: window in ms and target masks. More...
 

Functions

OverrideMasks getDualTariffForcingBitmask (const bool bOffPeak, const int16_t currentTemperature_x100)
 Calculates the dual tariff forcing bitmasks based on current conditions.
 
void printDualTariffConfiguration ()
 Print the settings for off-peak period.
 
void printOffPeakTime (const uint32_t ms)
 Prints a time in ms from the start of the off-peak period, as <h>h<mm>.
 
DualTariff::Boost readBoost (const uint8_t i)
 Reads scheduled boost i from flash.
 
constexpr BoostTable resolveBoosts ()
 Resolves each scheduled boost, at compile time.
 

Detailed Description

Functions used for managing dual tariff periods.

This group includes functions that detect and handle changes between off-peak and on-peak tariff periods. It adjusts load priorities and diversion strategies based on the current tariff state. Features like forced load operation during off-peak periods are also supported.

Note
The dual tariff feature helps optimize energy usage and cost savings by prioritizing energy diversion during off-peak periods.

Function Documentation

◆ getDualTariffForcingBitmask()

OverrideMasks getDualTariffForcingBitmask ( const bool bOffPeak,
const int16_t currentTemperature_x100 )

Calculates the dual tariff forcing bitmasks based on current conditions.

This function determines which loads and relays should be forced ON during off-peak periods based on elapsed time since off-peak start, the scheduled boosts, and temperature conditions.

Parameters
bOffPeaktrue if the system is in an off-peak period (as tracked by proceedDualTariffLogic()).
currentTemperature_x100Current temperature multiplied by 100.
Returns
Bitmasks of loads and relays that should be forced ON due to dual tariff conditions, 0 if none.
  • The logic is Forcing::boostForcing() (override_masks.h); this wrapper reads millis() and the tables.
  • Only applies during off-peak periods.
  • Each scheduled boost has its own window (scheduledBoosts), resolved at compile time.
  • Temperature must be at or below the threshold for forcing to activate.
  • Relies on proceedDualTariffLogic() having been called first, so that ul_TimeOffPeak is up to date.

Definition at line 77 of file main.cpp.

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

◆ printDualTariffConfiguration()

void printDualTariffConfiguration ( )
inline

Print the settings for off-peak period.

Definition at line 93 of file dualtariff.h.

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

◆ printOffPeakTime()

void printOffPeakTime ( const uint32_t ms)
inline

Prints a time in ms from the start of the off-peak period, as <h>h<mm>.

Definition at line 74 of file dualtariff.h.

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

◆ readBoost()

DualTariff::Boost readBoost ( const uint8_t i)
inline

Reads scheduled boost i from flash.

Parameters
ithe boost, below NO_OF_BOOSTS
Returns
its window in ms from the start of the off-peak period, and its target masks

Definition at line 62 of file dualtariff.h.

Here is the caller graph for this function:

◆ resolveBoosts()

BoostTable resolveBoosts ( )
constexpr

Resolves each scheduled boost, at compile time.

Definition at line 42 of file dualtariff.h.