3-phase PV router
Loading...
Searching...
No Matches
Functions | Variables
processing.h File Reference

Public functions/variables of processing engine. More...

#include "config.h"
Include dependency graph for processing.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void confirmPolarity (uint8_t phase)
 This routine prevents a zero-crossing point from being declared until a certain number of consecutive samples in the 'other' half of the waveform have been encountered.
 
void initializeOptionalPins ()
 Initializes the optional pins.
 
void initializeProcessing ()
 Initializes the ports and load states for processing.
 
uint8_t nextLogicalLoadToBeAdded ()
 Retrieve the next load that could be added (be aware of the order)
 
uint8_t nextLogicalLoadToBeRemoved ()
 Retrieve the next load that could be removed (be aware of the reverse-order)
 
void printParamsForSelectedOutputMode ()
 Print the settings used for the selected output mode.
 
void proceedHighEnergyLevel ()
 Process the case of high energy level, some action may be required.
 
void proceedLowEnergyLevel ()
 Process the case of low energy level, some action may be required.
 
void processCurrentRawSample (uint8_t phase, int16_t rawSample)
 Process the calculation for the actual current raw sample for the specific phase.
 
void processDataLogging ()
 Process with data logging.
 
void processLatestContribution (uint8_t phase)
 Process the latest contribution after each phase specific new cycle additional processing is performed after each main cycle based on phase 0.
 
void processMinusHalfCycle (uint8_t phase)
 Process the start of a new -ve half cycle, for this phase, just after the zero-crossing point.
 
void processPlusHalfCycle (uint8_t phase)
 Process the start of a new +ve half cycle, for this phase, just after the zero-crossing point.
 
void processPolarity (uint8_t phase, int16_t rawSample)
 Process with the polarity for the actual voltage sample for the specific phase.
 
void processRawSamples (uint8_t phase)
 This routine is called by the ISR when a pair of V & I sample becomes available.
 
void processStartNewCycle ()
 This code is executed once per 20mS, shortly after the start of each new mains cycle on phase 0.
 
void processStartUp (uint8_t phase)
 Process the startup period for the router.
 
void processVoltage (uint8_t phase)
 Process the calculation for the current voltage sample for the specific phase.
 
void processVoltageRawSample (uint8_t phase, int16_t rawSample)
 Process the current voltage raw sample for the specific phase.
 
void updatePhysicalLoadStates ()
 This function provides the link between the logical and physical loads.
 
void updatePortsStates ()
 update the control ports for each of the physical loads
 

Variables

volatile uint32_t absenceOfDivertedEnergyCount { 0 }
 
volatile bool b_datalogEventPending { false }
 
volatile bool b_diversionOff { false }
 
volatile bool b_newMainsCycle { false }
 
volatile bool b_overrideLoadOn [NO_OF_DUMPLOADS]
 
volatile bool b_reOrderLoads { false }
 
volatile uint16_t copyOf_countLoadON [NO_OF_DUMPLOADS]
 
volatile float copyOf_energyInBucket_main
 
volatile uint8_t copyOf_lowestNoOfSampleSetsPerMainsCycle
 
volatile uint16_t copyOf_sampleSetsDuringThisDatalogPeriod
 
volatile int32_t copyOf_sum_Vsquared [NO_OF_PHASES]
 
volatile int32_t copyOf_sumP_atSupplyPoint [NO_OF_PHASES]
 
constexpr uint16_t initialDelay { 3000 }
 
uint8_t loadPrioritiesAndState [NO_OF_DUMPLOADS]
 
constexpr uint8_t PERSISTENCE_FOR_POLARITY_CHANGE { 2 }
 
constexpr uint8_t sensorI [NO_OF_PHASES] { 1, 3, 5 }
 
constexpr uint8_t sensorV [NO_OF_PHASES] { 0, 2, 4 }
 
constexpr uint16_t startUpPeriod { 3000 }
 
PayloadTx_struct< NO_OF_PHASEStx_data
 

Detailed Description

Public functions/variables of processing engine.

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
2021-10-04

Definition in file processing.h.

Function Documentation

◆ initializeOptionalPins()

void initializeOptionalPins ( )

Initializes the optional pins.

Definition at line 143 of file processing.cpp.

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

◆ initializeProcessing()

void initializeProcessing ( )

Initializes the ports and load states for processing.

Definition at line 91 of file processing.cpp.

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

◆ printParamsForSelectedOutputMode()

void printParamsForSelectedOutputMode ( )

Print the settings used for the selected output mode.

Definition at line 799 of file processing.cpp.

Here is the caller graph for this function:

◆ updatePortsStates()

void updatePortsStates ( )

update the control ports for each of the physical loads

Definition at line 190 of file processing.cpp.

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

Variable Documentation

◆ absenceOfDivertedEnergyCount

volatile uint32_t absenceOfDivertedEnergyCount { 0 }
inline

number of main cycles without diverted energy

Definition at line 30 of file processing.h.

◆ b_datalogEventPending

volatile bool b_datalogEventPending { false }
inline

async trigger to signal datalog is available

Definition at line 31 of file processing.h.

◆ b_diversionOff

volatile bool b_diversionOff { false }
inline

async trigger to stop diversion

Definition at line 35 of file processing.h.

◆ b_newMainsCycle

volatile bool b_newMainsCycle { false }
inline

async trigger to signal start of new main cycle based on first phase

Definition at line 32 of file processing.h.

◆ b_overrideLoadOn

volatile bool b_overrideLoadOn[NO_OF_DUMPLOADS]
inline

async trigger to force specific load(s) to ON

Definition at line 33 of file processing.h.

◆ b_reOrderLoads

volatile bool b_reOrderLoads { false }
inline

async trigger for loads re-ordering

Definition at line 34 of file processing.h.

◆ copyOf_countLoadON

volatile uint16_t copyOf_countLoadON[NO_OF_DUMPLOADS]
inline

copy of number of cycle the load was ON (over 1 datalog period)

Definition at line 45 of file processing.h.

◆ copyOf_energyInBucket_main

volatile float copyOf_energyInBucket_main
inline

copy of main energy bucket (over all phases)

Definition at line 42 of file processing.h.

◆ copyOf_lowestNoOfSampleSetsPerMainsCycle

volatile uint8_t copyOf_lowestNoOfSampleSetsPerMainsCycle
inline

copy of a mechanism to check the integrity of this code structure

Definition at line 43 of file processing.h.

◆ copyOf_sampleSetsDuringThisDatalogPeriod

volatile uint16_t copyOf_sampleSetsDuringThisDatalogPeriod
inline

copy of for counting the sample sets during each datalogging period

Definition at line 44 of file processing.h.

◆ copyOf_sum_Vsquared

volatile int32_t copyOf_sum_Vsquared[NO_OF_PHASES]
inline

copy of for summation of V^2 values during datalog period

Definition at line 41 of file processing.h.

◆ copyOf_sumP_atSupplyPoint

volatile int32_t copyOf_sumP_atSupplyPoint[NO_OF_PHASES]
inline

copy of cumulative power per phase

Definition at line 40 of file processing.h.

◆ initialDelay

constexpr uint16_t initialDelay { 3000 }
inlineconstexpr

in milli-seconds, to allow time to open the Serial monitor

Definition at line 26 of file processing.h.

◆ loadPrioritiesAndState

uint8_t loadPrioritiesAndState[NO_OF_DUMPLOADS]
inline

load priorities

Definition at line 22 of file processing.h.

◆ PERSISTENCE_FOR_POLARITY_CHANGE

constexpr uint8_t PERSISTENCE_FOR_POLARITY_CHANGE { 2 }
inlineconstexpr

allows polarity changes to be confirmed

Definition at line 24 of file processing.h.

◆ sensorI

constexpr uint8_t sensorI[NO_OF_PHASES] { 1, 3, 5 }
inlineconstexpr

for 3-phase PCB, current measurement for each phase

Definition at line 19 of file processing.h.

◆ sensorV

constexpr uint8_t sensorV[NO_OF_PHASES] { 0, 2, 4 }
inlineconstexpr

for 3-phase PCB, voltage measurement for each phase

Definition at line 18 of file processing.h.

◆ startUpPeriod

constexpr uint16_t startUpPeriod { 3000 }
inlineconstexpr

in milli-seconds, to allow LP filter to settle

Definition at line 27 of file processing.h.

◆ tx_data

PayloadTx_struct< NO_OF_PHASES > tx_data
inline

logging data

Definition at line 50 of file processing.h.