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. | |
bool | forceFullPower () |
Forces all loads to full power if the override pin is active. | |
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 | proceedLoadPrioritiesAndOverriding (const int16_t ¤tTemperature_x100) |
Handles load priorities and overriding logic. | |
bool | proceedLoadPrioritiesAndOverridingDualTariff (const int16_t ¤tTemperature_x100) |
Handles load priorities and overriding during dual tariff periods. | |
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 107 of file main.cpp.
bool forceFullPower | ( | ) |
Forces all loads to full power if the override pin is active.
This function checks the state of the override pin and forces all loads to full power if the pin is active. It also logs changes in the override state for debugging purposes if enabled.
Definition at line 64 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 408 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 464 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 449 of file main.cpp.
bool proceedLoadPrioritiesAndOverriding | ( | const int16_t & | currentTemperature_x100 | ) |
Handles load priorities and overriding logic.
This function manages load priorities and overriding behavior based on the system configuration. It supports dual tariff handling, priority rotation, and manual override functionality.
currentTemperature_x100 | Current temperature multiplied by 100 (default to 0 if deactivated). |
proceedLoadPrioritiesAndOverridingDualTariff
.Definition at line 236 of file main.cpp.
bool proceedLoadPrioritiesAndOverridingDualTariff | ( | const int16_t & | currentTemperature_x100 | ) |
Handles load priorities and overriding during dual tariff periods.
This function manages load priorities and overriding logic based on the dual tariff state and the current temperature. It ensures proper load behavior during off-peak and on-peak periods.
currentTemperature_x100 | Current temperature multiplied by 100 (default to 0 if deactivated). |
Definition at line 171 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 140 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 423 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 334 of file main.cpp.