3-phase PV router
Loading...
Searching...
No Matches
CtFilter::LowPassBoost Struct Reference

The state of the filter of one CT (one per phase), and the filter itself. More...

#include <ct_filter.h>

Public Member Functions

int16_t apply (const int16_t sampleMinusDC, const Coefficients &coefficients)
 Filters one sample.
 
int32_t lowPass () const
 The low-pass state, x256 scale (Robin's lpf_long).
 

Public Attributes

uint8_t lpfLowBits {}
 
int16_t lpfX64 {}
 

Detailed Description

The state of the filter of one CT (one per phase), and the filter itself.

The state is Robin's lpf_long (x256), kept as its x64 part and its 2 low bits: lpf_long = 4 x lpfX64 + lpfLowBits. Every multiply is then 16 x 16, and no shift of the state needs a loop.

Definition at line 116 of file ct_filter.h.

Member Function Documentation

◆ apply()

int16_t CtFilter::LowPassBoost::apply ( const int16_t sampleMinusDC,
const Coefficients & coefficients )
inline

Filters one sample.

As Robin's, at x256: lpf += alpha x (sample - lpf), truncated towards zero; then sample + gain x lpf, back to x64.

Parameters
sampleMinusDCThe DC-removed current sample, x64 scale (left-aligned ADC).
coefficientsThe coefficients, from coefficientsOf(); a gain of 0 returns the sample.
Returns
The filtered sample, x64 scale, saturated to the int16 range.

Definition at line 137 of file ct_filter.h.

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

◆ lowPass()

int32_t CtFilter::LowPassBoost::lowPass ( ) const
inline

The low-pass state, x256 scale (Robin's lpf_long).

Definition at line 122 of file ct_filter.h.

Here is the caller graph for this function:

Member Data Documentation

◆ lpfLowBits

uint8_t CtFilter::LowPassBoost::lpfLowBits {}

its 2 bits below, 0..3 (lpf_long & 3)

Definition at line 119 of file ct_filter.h.

◆ lpfX64

int16_t CtFilter::LowPassBoost::lpfX64 {}

low-pass of the current, x64 scale (lpf_long >> 2)

Definition at line 118 of file ct_filter.h.


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