3-phase PV router
|
Functions and routines that handle general system processing tasks. More...
Classes | |
class | EWMA_average< A > |
Implements an Exponentially Weighted Moving Average (EWMA). More... | |
Functions | |
void | checkDiversionOnOff () |
Checks and updates the diversion state based on the diversion pin. | |
uint16_t | getOverrideBitmask (const int16_t currentTemperature_x100) |
Gets the combined bitmask of all active override pins and dual tariff forcing. | |
void | handlePerSecondTasks (bool &bOffPeak, int16_t &iTemperature_x100) |
Handles tasks that need to be executed every second. | |
void | logLoadPriorities () |
Prints the load priorities to the Serial output. | |
void | loop () |
Main processor loop. | |
bool | proceedDualTariffLogic () |
Handles dual tariff state transitions and priority rotation during off-peak periods. | |
bool | proceedLoadPriorities (const int16_t ¤tTemperature_x100) |
Handles load priority rotation and dual tariff state transitions. | |
void | proceedRotation () |
Proceeds with load priority rotation. | |
void | sendResults (bool bOffPeak) |
Prints or sends telemetry data logs based on the selected output format. | |
void | updatePowerAndVoltageData () |
Updates power and voltage data for all phases. | |
Functions and routines that handle general system processing tasks.
This group includes functions that are not time-critical but are essential for the overall operation of the system. These tasks include monitoring system states, managing load priorities, and handling diversion logic.
void checkDiversionOnOff | ( | ) |
Checks and updates the diversion state based on the diversion pin.
This function monitors the state of the diversion pin and updates the global b_diversionOff
flag accordingly. It also logs changes in the diversion state for debugging purposes if enabled.
Definition at line 169 of file main.cpp.
uint16_t getOverrideBitmask | ( | const int16_t | currentTemperature_x100 | ) |
Gets the combined bitmask of all active override pins and dual tariff forcing.
This function calculates the complete override bitmask by combining external override pins with dual tariff automatic forcing. The bitwise OR operation automatically handles precedence where external overrides take priority over dual tariff forcing for the same pins.
currentTemperature_x100 | Current temperature multiplied by 100 (used for dual tariff logic). |
Definition at line 125 of file main.cpp.
void handlePerSecondTasks | ( | bool & | bOffPeak, |
int16_t & | iTemperature_x100 ) |
Handles tasks that need to be executed every second.
This function performs various tasks that are triggered once per second, ensuring proper system operation and load management.
bOffPeak | Reference to the off-peak state flag. |
iTemperature_x100 | Current temperature multiplied by 100 (default to 0 if temperature sensing is disabled). |
Definition at line 448 of file main.cpp.
|
inline |
Prints the load priorities to the Serial output.
This function logs the current load priorities and states to the Serial output for debugging purposes. It provides a detailed view of the load configuration and their respective priorities.
ENABLE_DEBUG
). Definition at line 491 of file utils.h.
void loop | ( | ) |
Main processor loop.
This function handles non-time-critical tasks such as load management, telemetry updates, and temperature sensing. It processes ADC data through flags set by the ISR and ensures proper system operation.
b_newMainsCycle
flag, which is set after every pair of ADC conversions.Definition at line 492 of file main.cpp.
bool proceedDualTariffLogic | ( | ) |
Handles dual tariff state transitions and priority rotation during off-peak periods.
This function manages dual tariff state detection and triggers priority rotation when transitioning to off-peak periods. The actual load forcing is handled in getOverrideBitmask().
Definition at line 233 of file main.cpp.
bool proceedLoadPriorities | ( | const int16_t & | currentTemperature_x100 | ) |
Handles load priority rotation and dual tariff state transitions.
This function manages load priority rotation behavior and dual tariff state detection based on the system configuration. It supports priority rotation via pin control, EmonESP control, or automatic rotation. Override logic is handled in getOverrideBitmask().
currentTemperature_x100 | Current temperature multiplied by 100 (default to 0 if deactivated). |
proceedDualTariffLogic
for state transitions.Definition at line 281 of file main.cpp.
void proceedRotation | ( | ) |
Proceeds with load priority rotation.
This function triggers the rotation of load priorities and waits until the rotation is completed. It ensures that the new load priorities are logged after the rotation.
b_reOrderLoads
flag to initiate the rotation process.Definition at line 202 of file main.cpp.
|
inline |
Prints or sends telemetry data logs based on the selected output format.
This function handles the transmission of telemetry data in various formats, such as human-readable text, IoT telemetry, or JSON format. It also ensures that the first incomplete datalogging event is skipped during startup.
bOffPeak | Indicates whether the system is in an off-peak tariff period. |
SERIAL_OUTPUT_TYPE
, it prints data in text format, sends telemetry data, or outputs data in JSON format.Definition at line 450 of file utils.h.
void updatePowerAndVoltageData | ( | ) |
Updates power and voltage data for all phases.
This function calculates the power and voltage for each phase based on the accumulated data during the datalogging period. It also updates the total power.
Definition at line 372 of file main.cpp.