3-phase PV router
Loading...
Searching...
No Matches
Functions
main.cpp File Reference

Main code. More...

#include <Arduino.h>
#include "config.h"
#include "calibration.h"
#include "processing.h"
#include "types.h"
#include "utils.h"
#include "utils_relay.h"
#include "validation.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

void checkDiversionOnOff ()
 Check the diversion state.
 
bool forceFullPower ()
 This function set all 3 loads to full power.
 
 ISR (ADC_vect)
 Interrupt Service Routine - Interrupt-Driven Analog Conversion.
 
void loop ()
 Main processor.
 
bool proceedLoadPrioritiesAndOverriding (const int16_t currentTemperature_x100)
 This function changes the value of the load priorities.
 
bool proceedLoadPrioritiesAndOverridingDualTariff (const int16_t currentTemperature_x100)
 Proceed load priority in combination with dual tariff.
 
void proceedRotation ()
 Proceed load priority rotation.
 
void setup ()
 Called once during startup.
 

Detailed Description

Main code.

Author
Frédéric Metrich (frede.nosp@m.ric..nosp@m.metri.nosp@m.ch@l.nosp@m.ive.f.nosp@m.r)
Version
0.1
Date
2023-02-15

Definition in file main.cpp.

Function Documentation

◆ checkDiversionOnOff()

void checkDiversionOnOff ( )

Check the diversion state.

Definition at line 170 of file main.cpp.

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

◆ forceFullPower()

bool forceFullPower ( )

This function set all 3 loads to full power.

Returns
true if loads are forced
false

Definition at line 137 of file main.cpp.

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

◆ loop()

void loop ( )

Main processor.

None of the workload in loop() is time-critical. All the processing of ADC data is done within the ISR.

Definition at line 353 of file main.cpp.

Here is the call graph for this function:

◆ proceedLoadPrioritiesAndOverriding()

bool proceedLoadPrioritiesAndOverriding ( const int16_t  currentTemperature_x100)

This function changes the value of the load priorities.

Since we don't have access to a clock, we detect the offPeak start from the main energy meter. Additionally, when off-peak period starts, we rotate the load priorities for the next day.

Parameters
currentTemperature_x100current temperature x 100 (default to 0 if deactivated)
Returns
true if off-peak tariff is active
false if on-peak tariff is active

Definition at line 271 of file main.cpp.

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

◆ proceedLoadPrioritiesAndOverridingDualTariff()

bool proceedLoadPrioritiesAndOverridingDualTariff ( const int16_t  currentTemperature_x100)

Proceed load priority in combination with dual tariff.

Parameters
currentTemperature_x100current temperature x 100 (default to 0 if deactivated)
Returns
true if high tariff (on-peak period)
false if low tariff (off-peak period)

Definition at line 215 of file main.cpp.

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

◆ proceedRotation()

void proceedRotation ( )

Proceed load priority rotation.

Definition at line 194 of file main.cpp.

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

◆ setup()

void setup ( )

Called once during startup.

This function initializes a couple of variables we cannot init at compile time and sets a couple of parameters for runtime.

Definition at line 320 of file main.cpp.

Here is the call graph for this function: