PLC-API bError : BOOL; eErrorId : E_CTRL_ERRORCODES; END_VAR fOut : Output of the digital filter. eState : State of the function block. eErrorId : Supplies the error number [ } 16] when the bError output is set. bError : Becomes TRUE, as soon as an error occurs. VAR_IN_OUT VAR_IN_OUT stParams : ST_CTRL_DIGITAL_FILTER_PARAMS; END_VAR stParams : Parameter structure of the function block. This consists of the following elements: TYPE ST_CTRL_DIGITAL_FILTER_PARAMS : STRUCT tTaskCycleTime : TIME; (* task cycle time *) tCtrlCycleTime : TIME := T#0ms; (* controller cycle time *) nFilterOrder : USINT; pCoefficientsArray_a_ADR : POINTER TO FLOAT := 0; nCoefficientsArray_a_SIZEOF :
UINT; pCoefficientsArray_b_ADR : POINTER TO FLOAT := 0; nCoefficientsArray_b_SIZEOF : UINT; pDigitalFilterData_ADR : POINTER TO ST_CTRL_DIGITAL_FILTER_DATA; nDigitalFilterData_SIZEOF : UINT; END_STRUCT END_TYPE tTaskCycleTime : Cycle time with which the function block is called. If the function block is called in every cycle this corresponds to the task cycle time of the calling task. tCtrlCycleTime : Cycle time with which the control loop is processed. This must be greater than or equal to the TaskCycleTime. The function block uses this input value to calculate internally whether the state and the output values have to be updated in the current cycle. nFilterOrder :
Order of the digital filter [0... ] pCoefficientsArray_a_ADR : Address of the array containing the a coefficients. nCoefficientsArray_a_SIZEOF : Size of the array containing the a coefficients, in bytes. pCoefficientsArray_b_ADR : Address of the array containing the b coefficients. nCoefficientsArray_b_SIZEOF : Size of the array containing the b coefficients, in bytes. pDigitalFilterData_ADR : Address of the data array. nDigitalFilterData_SIZEOF : Size of the data array in bytes. TYPE ST_CTRL_DIGITAL_FILTER_DATA STRUCT Interne Struktur. Auf diese darf nicht schreibend zugegriffen werden. END_STRUCT END_TYPE Sample: PROGRAM PRG_DIGITAL_FILTER_TEST VAR fbDigitalFilter :
FB_CTRL_DIGITAL_FILTER; ar_CoefficientsArray_a : ARRAY[1..3 ] OF FLOAT; ar_CoefficientsArray_b : ARRAY[1..3 ] OF FLOAT; ar_stDigitalFilterData : ARRAY[1..2 ] OF ST_CTRL_DIGITAL_FILTER_DATA; TS4100 81 Version: 1.1