|
3-phase PV router
|
Main code for the PVRouter 3-phase project. More...
#include <Arduino.h>#include "config_derived.h"#include "datalog_math.h"#include "pin_edges.h"#include "processing.h"#include "shared_var.h"#include "types.h"#include "utils.h"#include "utils_relay.h"#include "validation.h"#include "main.h"#include "override_masks.h"#include "temp_schedule.h"
Go to the source code of this file.
Functions | |
| OverrideMasks | getDualTariffForcingBitmask (const bool bOffPeak, const int16_t currentTemperature_x100) |
| Calculates the dual tariff forcing bitmasks based on current conditions. | |
| OverrideMasks | getOverrideBitmask (const bool bOffPeak, const int16_t currentTemperature_x100) |
| Gets the combined bitmasks 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. | |
| bool | isDiversionEnabled () |
| Reads the diversion pin. | |
| bool | isRouterOff () |
| Tells whether the router is OFF. | |
| void | loop () |
| Main processor loop. | |
| bool | proceedDualTariffLogic () |
| Handles dual tariff state transitions and priority rotation during off-peak periods. | |
| void | proceedLoadPriorities (const bool bOverridden) |
| Handles load priority rotation. | |
| void | proceedRotation () |
| Proceeds with load priority rotation. | |
| void | processTemperatureData (const bool bStartNow) |
| Processes temperature data from DS18B20 sensors. | |
| template<uint8_t pin> | |
| PinEdges | readPinEdges () |
| Reads an active-LOW input pin, and tells how it changed since the previous reading. | |
| void | runTemperatureTransaction (const bool onTime) |
| Runs the 1-Wire transaction of this mains cycle, if any. | |
| void | setup () |
| Called once during startup. | |
| void | updatePowerAndVoltageData () |
| Updates power and voltage data for all phases. | |
Variables | |
| int16_t | temperatureReadings [tempSensors.size()] |
| The last reading of each sensor, in hundredths of °C, as endRead() returned it (none yet: setup()). | |
| TempSchedule::Scheduler< tempSensors.size(), TempSchedule::conversionCycles(SUPPLY_FREQUENCY) > | tempSchedule |
| The round of the temperature sensors: one 1-Wire transaction per mains cycle (temp_schedule.h). | |
Main code for the PVRouter 3-phase project.
This file contains the main logic for the PVRouter, including the setup and loop functions, as well as interrupt service routines (ISRs) and utility functions for managing load priorities, temperature sensing, and telemetry data.
Definition in file main.cpp.
| int16_t temperatureReadings[tempSensors.size()] |
| TempSchedule::Scheduler< tempSensors.size(), TempSchedule::conversionCycles(SUPPLY_FREQUENCY) > tempSchedule |
The round of the temperature sensors: one 1-Wire transaction per mains cycle (temp_schedule.h).