beckhoff TS4100 — 5.3.7 FB_CTRL_TRANSFERFUNCTION_2

PLC-API fbTansferfunction : FB_CTRL_TRANSFERFUNCTION_1; bInit : BOOL := TRUE; fIn : FLOAT := 0; fOut : FLOAT; b_0, b_1, b_2 : FLOAT; a_0,a_1,a_2 :

FLOAT; END_VAR IF bInit THEN (* set values in the local arrays *) ar_fNumeratorArray[0] := 1.24906304658218E-007; ar_fNumeratorArray[1] := 2.49812609316437E-007; ar_fNumeratorArray[2] := 1.24906304658218E-007; ar_DenominatorArray[0] := 0.998501124344101; ar_DenominatorArray[1] := -1.99850062471888; ar_DenominatorArray[2] := 1.0; (* set values in the parameter struct *) stParams.tTaskCycleTime := T#2ms; stParams.tCtrlCycleTime := T#2ms; stParams.nOrderOfTheTransferfunction := nOrderOfTheTransferfunction; (* set the mode *) eMode := eCTRL_MODE_ACTIVE; bInit := FALSE; END_IF (* set the addresses *) stParams.pNumeratorArray_ADR := ADR( ar_fNumeratorArray); stParams.nNumeratorArray_SIZEOF := SIZEOF( ar_fNumeratorArray); stParams.pDenominatorArray_ADR := ADR( ar_DenominatorArray ); stParams.nDenominatorArray_SIZEOF := SIZEOF( ar_DenominatorArray ); stParams.pTransferfunction1Data_ADR := ADR( ar_stTransferfunction2Data ); stParams.nTransferfunction1Data_SIZEOF := SIZEOF( ar_stTransferfunction2Data ); (* call the function block *) fbTansferfunction ( fIn := fIn, eMode := eMode, stParams := stParams, fOut => fOut, eErrorId => eErrorId, bError => bError ); Requirements 5.3.7 FB_CTRL_TRANSFERFUNCTION_2 This function block calculates a discrete transfer function with the second standard form illustrated below.

The transfer function here can be of any order, n. The coefficients for the following transfer functions are stored in the parameter arrays: TS4100 35 Version: 1.1 Development Environment Target System PLC libraries to include TwinCAT v2.8 PC (i386) TcControllerToolbox.lib TwinCAT v2.9 from Build 947 BC [} 10] TcControllerToolbox.lb6 TwinCAT v2.9 from Build 956 BX [} 10] TcControllerToolbox.lbx