Declaring and calling filters with FB_FTR_<type>

This sample shows how the individual filter function blocks of the PLC library Tc3_Filter are declared and called.

Download: Tc3_Filter_AllFilters.zip (*.tnzip)

Description:

Implementation:

Basic principle:

FUNCTION_BLOCK FB_PT1
VAR_INPUT
    aBuffer    : ARRAY [1..MAIN.cChannels] OF ARRAY [1..MAIN.cOversamples] OF LREAL;
END_VAR
VAR_OUTPUT
    aOutput    : ARRAY [1..MAIN.cChannels] OF ARRAY [1..MAIN.cOversamples] OF LREAL;
END_VAR
VAR
    stParams: ST_FTR_PT1 := (fSamplingRate := 10000,
    fKp := 1,
    fT1 := 6.3661977236758134307553505349006E-4,
    nOversamples := MAIN.cOversamples,
    nChannels := MAIN.cChannels);
// fT1 correlates to fc=250 Hz
    fbFilter : FB_FTR_PT1:=(stConfig:=stParams);
END_VAR

See also: