beckhoff TF4100 — 4.2.1.4.5 FB_CTRL_MOVING_AVERAGE

PLC API fbDigitalFilter ( fIn := fIn, eMode := eMode, stParams := stParams, fOut => fOut, eErrorId => eErrorId, bError => bError); 4.2.1.4.5 FB_CTRL_MOVING_AVERAGE The function block provides a moving average filter in the functional diagram. The arithmetic mean value of the last "n" values is calculated. 1 n = - = е k i i k n n c c The programmer must create an array "ARRAY [1...n] of FLOAT" in the PLC, in which the function block can store the internally required data. VAR_INPUT fIn : FLOAT; fManSyncValue : FLOAT; bSync : BOOL; eMode : E_CTRL_MODE; bHold : BOOL; END_VAR Inputs Outputs VAR_OUTPUT fOut : FLOAT; eState : E_CTRL_STATE; eErrorId : E_CTRL_ERRORCODES; bError :

BOOL; END_VAR TF4100 93 Version: 2.2.4 Name Type Description fIn FLOAT Input value for the moving average filter fManSyncValue FLOAT Input value to which the moving average filter can be set, or that is issued at the output in manual mode. bSync BOOL A rising edge at this input sets the moving average filter to the value "fManSyncValue". eMode E CTRL MODE _ _ Input that specifies the operation mode [} 173] of the function block. bHold BOOL A TRUE at this input will hold the internal state (and therefore also the output) constant at its current value, independently of the input value.