PLCopen Motion Control fMaxRate : The magnitude of the maximum permitted rate of change at the output as change per second. fOutput : [1/s] The filtered value. bError : This output indicates problems with the transferred parameters. nErrorId : In the event of an error, coded error information is output here. Behavior of the function block With each call the function block checks the transferred values for fCycletime and fMaxRate . If the values are incorrect, the system responds with bError and coded information in nErrorId . Otherwise, the difference between Input and Output is determined with each call.
If the magnitude of this difference is less than or equal to fMaxRate * fCycletime , the value of Input is used directly as fOutput . Otherwise, fOutput is changed by fMaxRate * fMaxRate . The sign is selected automatically. NOTE! The value for fCycletime must be ≥ 0.001. Negative values are not permitted for fMaxRate. Input will usually be a value, which is determined and filtered based on the cycle of the axis blocks. Axis_Ref_BkPlcMc [ } 67] . ST_TcHydAxParam [ } 93] .fCycletime can be used for fCycletime here. 4.4.9.2.5 MC_AxUtiSlidingAverage_BkPlcMc (from V3.0) The function block determines a moving average. VAR_INPUT Input: LREAL:=0.0; MinIdx: DINT:=0; MaxIdx: DINT:=0; pBuffer:
POINTER TO LREAL:=0; END_VAR VAR_OUTPUT Output: LREAL:=0.0; END_VAR Input : The raw value of the parameter to be filtered. MinIdx : The index of the first filter buffer element to be used. MaxIdx : The index of the last filter buffer element to be used. pBuffer : The address of the first filter buffer element. Output : The filtered value. 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, Input is output as Output .
Otherwise, with each call Input is entered in the filter buffer, and the average value of the set of values available in the buffer is formed and returned as Output . PLC Library Hydraulics 191 Version: 1.4 Note The set of values for averaging contains (MaxIdx - MinIdx + 1) values. The filter time is de- termined by multiplication of this number with the cycle time.