3-phase PV router
Loading...
Searching...
No Matches
Energy::PerSampleCalibration< NMin, NMax, N > Struct Template Reference

cal / n for every phase and every expected sample count n, in fixed point. More...

#include <energy_bucket.h>

Public Attributes

uint8_t shift
 
uint16_t value [N][NMax - NMin+1]
 

Detailed Description

template<uint8_t NMin, uint8_t NMax, uint8_t N>
struct Energy::PerSampleCalibration< NMin, NMax, N >

cal / n for every phase and every expected sample count n, in fixed point.

One cycle's contribution is (sumP / n) x cal = sumP x (cal / n). With this table the ISR multiplies sumP directly, with no division - and without the truncation of that division either.

Template Parameters
NMinSmallest expected number of sample sets per mains cycle.
NMaxLargest expected number of sample sets per mains cycle (<= 64 << SumShift of toFixedPerSample(), so that sumP stays within the 24 bits contribution() expects).
NNumber of phases.

Definition at line 103 of file energy_bucket.h.

Member Data Documentation

◆ shift

template<uint8_t NMin, uint8_t NMax, uint8_t N>
uint8_t Energy::PerSampleCalibration< NMin, NMax, N >::shift

shared by the whole table

Definition at line 106 of file energy_bucket.h.

◆ value

template<uint8_t NMin, uint8_t NMax, uint8_t N>
uint16_t Energy::PerSampleCalibration< NMin, NMax, N >::value[N][NMax - NMin+1]

round(cal x 2^SumShift / n x 2^shift), indexed [phase][n - NMin]

Definition at line 105 of file energy_bucket.h.


The documentation for this struct was generated from the following file: