PLC API tTaskCycleTime : TIME; tCtrlCycleTime : TIME := T#0ms; nOrderOfTheTransferfunction : USINT; pNumeratorArray_ADR : POINTER TO FLOAT := 0; nNumeratorArray_SIZEOF : UINT; pDenominatorArray_ADR : POINTER TO FLOAT := 0; nDenomiantorArray_SIZEOF : UINT; pTransferfunction2Data_ADR : POINTER TO ST_CTRL_TRANSFERFUNCTION_2_DATA; nTransferfunction2Data_SIZEOF : UINT; END_STRUCT END_TYPE Sample: PROGRAM PRG_TRANSFERFUNCTION_2_TEST VAR CONSTANT nTfOrder : USINT := 2; END_VAR VAR aNumArray : ARRAY[0..nTfOrder] OF FLOAT; aDenArray : ARRAY[0..nTfOrder] OF FLOAT; aStTfData : ARRAY[0..nTfOrder] OF ST_CTRL_TRANSFERFUNCTION_2_DATA; eMode : E_CTRL_MODE; stParams :
ST_CTRL_TRANSFERFUNCTION_2_PARAMS; eErrorId : E_CTRL_ERRORCODES; bError : BOOL; fbTansferfunction : FB_CTRL_TRANSFERFUNCTION_2; 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 aNumArray[0] := 1.24906304658218E-007; aNumArray[1] := 2.49812609316437E-007; aNumArray[2] := 1.24906304658218E-007; aDenArray[0] := 0.998501124344101; aDenArray[1] := -1.99850062471888; aDenArray[2] := 1.0; stParams.tTaskCycleTime := T#2ms; stParams.tCtrlCycleTime := T#2ms; stParams.nOrderOfTheTransferfunction := nTfOrder; eMode := eCTRL_MODE_ACTIVE; TF4100 40 Version:
2.2.4 Name Type Description tTaskCycleTime TIME 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 TIME 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.
nOrderOfTheTra nsferfunction USINT Order of the transfer function [0...] pNumeratorArray ADR _ POINTER TO FLOAT Address of the array containing the numerator coefficients nNumeratorArray SIZEOF _ UINT Size of the array containing the numerator coefficients, in bytes pDenominatorArr ay ADR _ POINTER TO FLOAT Address of the array containing the denominator coefficients nDenomiantorArr ay SIZEOF _ UINT Size of the array containing the denominator coefficients, in bytes pTransferfunction 2Data ADR _ POINTER TO ST CTRL _ _ TRANSFERFUNC TION 2 DATA _ _ Address of the data array nTransferfunction 2Data SIZEOF _ UINT Size of the data array in bytes