3-phase PV router
Loading...
Searching...
No Matches
calibration.h
Go to the documentation of this file.
1
12#ifndef CALIBRATION_H
13#define CALIBRATION_H
14
15#include "config.h"
16
17//
18// Calibration values
19//-------------------
20// Three calibration values are used in this sketch: f_powerCal, f_phaseCal and f_voltageCal.
21// With most hardware, the default values are likely to work fine without
22// need for change. A compact explanation of each of these values now follows:
23
24// When calculating real power, which is what this code does, the individual
25// conversion rates for voltage and current are not of importance. It is
26// only the conversion rate for POWER which is important. This is the
27// product of the individual conversion rates for voltage and current. It
28// therefore has the units of ADC-steps squared per Watt. Most systems will
29// have a power conversion rate of around 20 (ADC-steps squared per Watt).
30//
31// powerCal is the RECIPROCAL of the power conversion rate. A good value
32// to start with is therefore 1/20 = 0.05 (Watts per ADC-step squared)
33//
34inline constexpr float f_powerCal[NO_OF_PHASES]{ 0.05000F, 0.05000F, 0.05000F };
35//
36// f_phaseCal is used to alter the phase of the voltage waveform relative to the current waveform.
37// The algorithm interpolates between the most recent pair of voltage samples according to the value of f_phaseCal.
38//
39// With f_phaseCal = 1, the most recent sample is used.
40// With f_phaseCal = 0, the previous sample is used
41// With f_phaseCal = 0.5, the mid-point (average) value in used
42//
43// NB. Any tool which determines the optimal value of f_phaseCal must have a similar
44// scheme for taking sample values as does this sketch.
45//
46inline constexpr float f_phaseCal{ 1 };
47//
48// For datalogging purposes, f_voltageCal has been added too. Because the range of ADC values is
49// similar to the actual range of volts, the optimal value for this cal factor is likely to be
50// close to unity.
51inline constexpr float f_voltageCal[NO_OF_PHASES]{ 0.8151F, 0.8184F, 0.8195F };
53inline constexpr float lpf_gain{ 0 };
54inline constexpr float alpha{ 0.002 };
55//--------------------------------------------------------------------------------------------------
56
57#endif // CALIBRATION_H
constexpr float alpha
Definition: calibration.h:54
constexpr float f_phaseCal
Definition: calibration.h:46
constexpr float f_voltageCal[NO_OF_PHASES]
Definition: calibration.h:51
constexpr float lpf_gain
Definition: calibration.h:53
constexpr float f_powerCal[NO_OF_PHASES]
Definition: calibration.h:34
Configuration values to be set by the end-user.
constexpr uint8_t NO_OF_PHASES
Definition: config_system.h:19