3-phase PV router
Loading...
Searching...
No Matches
processing.h
Go to the documentation of this file.
1
11
12#ifndef PROCESSING_H
13#define PROCESSING_H
14
15#include "config.h"
16
17// analogue input pins
18inline constexpr uint8_t sensorV[NO_OF_PHASES]{ 0, 2, 4 };
19inline constexpr uint8_t sensorI[NO_OF_PHASES]{ 1, 3, 5 };
20// ------------------------------------------
21
23
24inline constexpr uint8_t PERSISTENCE_FOR_POLARITY_CHANGE{ 1 };
25
26inline constexpr uint16_t initialDelay{ 3000 };
27inline constexpr uint16_t startUpPeriod{ 3000 };
28
29#ifdef TEMP_ENABLED
31#else
33#endif
34
36
37void processCurrentRawSample(const uint8_t phase, const int16_t rawSample);
38void processVoltageRawSample(const uint8_t phase, const int16_t rawSample);
39
40#if defined(__DOXYGEN__)
42inline void processStartUp(uint8_t phase);
43inline void processStartNewCycle();
44inline void processPlusHalfCycle(uint8_t phase);
45inline void processMinusHalfCycle(uint8_t phase);
46inline void processRawSamples(const uint8_t phase);
47inline void processVoltage(uint8_t phase);
48inline void processPolarity(uint8_t phase, int16_t rawSample);
49inline void confirmPolarity(uint8_t phase);
50inline void proceedLowEnergyLevel();
51inline void proceedHighEnergyLevel();
52inline uint8_t nextLogicalLoadToBeAdded();
53inline uint8_t nextLogicalLoadToBeRemoved();
54inline void processLatestContribution(uint8_t phase);
55inline void processDataLogging();
56inline void updatePortsStates();
57inline void updatePhysicalLoadStates();
58#else
59void initializeProcessing() __attribute__((optimize("-O3")));
60inline void processStartUp(uint8_t phase) __attribute__((always_inline));
61inline void processStartNewCycle() __attribute__((always_inline));
62inline void processPlusHalfCycle(uint8_t phase) __attribute__((always_inline));
63inline void processMinusHalfCycle(uint8_t phase) __attribute__((always_inline));
64inline void processRawSamples(const uint8_t phase) __attribute__((always_inline));
65inline void processVoltage(uint8_t phase) __attribute__((always_inline));;
66inline void processPolarity(uint8_t phase, int16_t rawSample) __attribute__((always_inline));
67inline void confirmPolarity(uint8_t phase) __attribute__((always_inline));
68inline void proceedLowEnergyLevel() __attribute__((always_inline));
69inline void proceedHighEnergyLevel() __attribute__((always_inline));
70inline uint8_t nextLogicalLoadToBeAdded() __attribute__((always_inline, optimize("-O3")));
71inline uint8_t nextLogicalLoadToBeRemoved() __attribute__((always_inline, optimize("-O3")));
72inline void processLatestContribution(uint8_t phase) __attribute__((always_inline));
73inline void processDataLogging() __attribute__((always_inline, optimize("-O3")));
74inline void updatePortsStates() __attribute__((optimize("-O3")));
75inline void updatePhysicalLoadStates() __attribute__((always_inline));
76#endif
77
78#endif /* PROCESSING_H */
container for datalogging
Definition types.h:73
Configuration values to be set by the end-user.
constexpr TemperatureSensing temperatureSensing
Definition config.h:98
constexpr uint8_t NO_OF_DUMPLOADS
Definition config.h:32
constexpr uint8_t NO_OF_PHASES
void initializeProcessing()
Initializes the processing engine, including ports, load states, and ADC setup.
void updatePhysicalLoadStates()
Updates the physical load states based on logical load priorities and states.
void processLatestContribution(uint8_t phase)
Process the latest contribution after each phase-specific new cycle.
void updatePortsStates()
Updates the control ports for each of the physical loads.
void processStartUp(uint8_t phase)
Processes the startup period for the router.
void processStartNewCycle()
Processes the start of a new mains cycle on phase 0.
void processMinusHalfCycle(uint8_t phase)
Processes the start of a new negative half cycle for the specified phase.
void processVoltageRawSample(const uint8_t phase, const int16_t rawSample)
Processes the current voltage raw sample for the specified phase.
void proceedLowEnergyLevel()
Handles the case when the energy level is low, potentially removing a load.
void processPolarity(uint8_t phase, int16_t rawSample)
Processes the polarity of the current voltage sample for a specific phase.
void processRawSamples(const uint8_t phase)
Processes raw voltage and current samples for the specified phase.
uint8_t nextLogicalLoadToBeAdded()
Retrieve the next logical load that could be added.
void processPlusHalfCycle(uint8_t phase)
Process the start of a new positive half cycle for the specified phase.
void processDataLogging()
Process data logging at the end of each logging period.
uint8_t nextLogicalLoadToBeRemoved()
Retrieve the next logical load that could be removed (in reverse order).
void confirmPolarity(uint8_t phase)
Confirms the polarity of the current voltage sample for a specific phase.
void processVoltage(uint8_t phase)
Processes the current voltage sample for the specified phase.
void proceedHighEnergyLevel()
Handles the case when the energy level is high, potentially adding a load.
void processCurrentRawSample(const uint8_t phase, const int16_t rawSample)
Processes the current raw sample for the specified phase.
constexpr uint16_t startUpPeriod
Definition processing.h:27
constexpr uint8_t PERSISTENCE_FOR_POLARITY_CHANGE
Definition processing.h:24
uint8_t loadPrioritiesAndState[NO_OF_DUMPLOADS]
Definition processing.h:22
constexpr uint8_t sensorV[NO_OF_PHASES]
Definition processing.h:18
constexpr uint8_t sensorI[NO_OF_PHASES]
Definition processing.h:19
void printParamsForSelectedOutputMode()
Print the settings used for the selected output mode.
constexpr uint16_t initialDelay
Definition processing.h:26
PayloadTx_struct< NO_OF_PHASES > tx_data
Definition processing.h:32