PLCopen Motion Control Behaviour of the function block With each call the function block checks the address of the filter buffer pBuffer and the indices of the elements MinIdx and MaxIdx to be used. If the transferred values are obviously nonsensical, the system responds with Error and coded information in ErrorID. Otherwise, with each call Input is entered in the filter buffer, and the average value of the modification over the set of values available in the buffer is formed and returned as Output . NOTE! The set of values for averaging contains (MaxIdx - MinIdx + 1) values. The measuring time is determined by multiplication of this number with the cycle time. NOTE!
The principle of sliding averaging leads to a delay amounting to half the measuring time. If the filtered parameter can be used in a control loop, the resulting frequency-dependent phase shift can lead to restrictions for the parameter selection. The function block has no way to fully check the transferred values of pBuffer, MinIdx and MaxIdx. The user must ensure that these values can be used safely. Otherwise may behave in an unpredictable manner (overwriting of memory) or abortion of the PLC operation. 4.4.9.2.2 MC_AxUtiPT1_BkPlcMc (from V3.0) The function block calculates a first-order low-pass. VAR_INPUT fInput: LREAL:=0.0; fCycletime: LREAL:=0.001; fT0:
LREAL:=1.0; END_VAR VAR_OUTPUT fOutput: LREAL; bError: BOOL; nErrorId: UDINT; END_VAR fInput : The raw value of the parameter to be filtered. fCycletime : [s] The cycle time of the calling PLC task. fT0 : [s] The filter time constant. fOutput : The filtered value. bError : This output indicates problems with the transferred parameters. nErrorId : In the event of an error, coded information about the type of problem is reported here. Behavior of the function block With each call the function block checks the transferred parameters. If an invalid value is detected, the function block responds with bError and a corresponding value in nErrorId .
Otherwise, the internal variables are updated with fInput, and the filtered value is returned as fOutput . PLC Library Hydraulics 189 Version: 1.4