PLC API This function block calculates a discrete transfer function with the structure described below. This structure allows either an FIR filter ( F inite I mpulse R esponse) or an IIR filter ( I nfinite I mpulse R esponse) to be implemented. The transfer function here can be of any order, n. The coefficients for the following transfer structure are stored in the parameter arrays: b b z b z b z Y z G z X z a z a z a z ... ( ) ( ) ( ) 1 ... - - - - + + + + = = + + + + 1 2 ( 1) 1 2 3 1 2 ( 1) 2 3 - - - - n n n n The programmer must create the following arrays in the PLC if this function block is to be used: aCoefficientsArray_a : ARRAY[1..nFilterOrder+1] OF FLOAT; aCoefficientsArray_b :
ARRAY[1..nFilterOrder+1] OF FLOAT; aStDigitalFilterData : ARRAY[1..nFilterOrder] OF ST_CTRL_DIGITAL_FILTER_DATA; The coefficients "b 1 " to "b n " are stored in the array aCoefficientsArray_b . This must be organized as follows: aCoefficientsArray_b[1] := b1; aCoefficientsArray_b[2] := b2; aCoefficientsArray_b[n-1] := bn-1; aCoefficientsArray_b[n] := bn; The coefficients "a1" to "an" are stored in the array aCoefficientsArray_a . This must be organized as follows: aCoefficientsArray_a[1] := xxx; (* not being evaluated *) aCoefficientsArray_a[2] := a2; ...
aCoefficientsArray_a[n-1] := an-1; aCoefficientsArray_a[n] := an; The internal data required by the function block is stored in the array aStDigitalFilterData . This data must never be modified from within the PLC program. This procedure is also illustrated in the sample program listed below. Inputs VAR_INPUT fIn : FLOAT; fManValue : FLOAT; eMode : E_CTRL_MODE; END_VAR TF4100 90 Version: 2.2.4