LGF_SimpleSmoothingFC (FC / V3.0.1)

Overview

Author: Siemens Digital Industry

Short description

The function calculates the linear mean value acyclically.

The simplest form of smoothing a sequence of measured values is to calculate the linear mean value by three points.

The function reads an array that is smoothed. N-2 smoothed measured values can be calculated from N measured values. Therefore, the output array in the index (0) and index (N) contains the value 0.

Block Interface

LGF_SimpleSmoothingFC (FC)
   Ret_Val  Void
    
   error  Bool
    
   status  Word
    
Array[*] of LReal  values  Array[*] of LReal
       
Array[*] of LReal  smoothedValues  Array[*] of LReal
       
   

Output parameter

IdentifierData type Description
Ret_ValVoid Void - Function has no return value
errorBool FALSE: No error
TRUE: An error occurred during the execution of the FB
statusWord 16#0000-16#7FFF: Status of the FB
16#8000-16#FFFF: Error identification (see following Table)

In/Out parameter

IdentifierData type Description
valuesArray[*] of LReal Values that are to be included in the smoothing.
smoothedValuesArray[*] of LReal The smoothed values.

Status & Error codes

Code / ValueIdentifier / Description
16#0000STATUS_FINISHED_NO_ERROR
Status: Execution finished without errors
16#8400ERR_NOT_ENOUGH_VALUES
Error: Not enough values. The block requires three (3) values to calculate a smoothed value. Increase the size of the array at the input parameter `values`. Adapt the array on the output parameter `smoothedValues` to the new size.
16#8401ERR_ARRAY_DIFFERENT
Error: The Arraysizes are not equal. The arrays `values` and `smoothedValues` must have the same size.

Functional description

The function calculates the smoothed values using the following formula:

\overline{y(n)} = \frac{y(n-1) + y(n) + y(n+1)}{3}

The calculated value is output or the calculated values are output at output smoothedValue.

Based on this formula, the function cannot calculate values for the elements 0 and N.

Change log

Version & DateChange description
01.00.00Siemens Industry Online Support
23.11.2018First released version
01.00.01Simatic Systems Support
15.11.2019Regions, comments and constants are added
03.00.00Simatic Systems Support
23.04.2020Set version to V3.0.0, harmonize the version of the whole library
03.00.01Simatic Systems Support
06.04.2021Insert documentation