LGF_SimpleSmoothingFB (FB / V3.0.1)

Overview

Author: Siemens Digital Industry

Short description

The function calculates the linear mean value cyclically.

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

The function reads-in a value with each positive edge on the insert input. As soon as three values have been read in, the block calculates a smoothed value and outputs it.

Block Interface

LGF_SimpleSmoothingFB (FB)
Bool  enable smoothedValue  LReal
    
Bool  insert error  Bool
    
LReal  value status  Word
    
   

Input parameter

IdentifierData type Default value Description
enableBool FALSE Activates the block. As long as enable is `TRUE`, the block can accept values on the parameter `value`.
insertBool FALSE Accepts the value at the input `value` at positive edge and outputs a `smoothedValue` if three values have been read in.
valueLReal 0.0 Value that is to be included in the smoothing.

Output parameter

IdentifierData type Description
smoothedValueLReal The smoothed 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)

Status & Error codes

Code / ValueIdentifier / Description
16#7000STATUS_NO_CALL
Status: No call of FB. The block waits for activation through the parameter `enable`.
16#7001STATUS_FIRST_CALL
Status: First call of FB after enabling
16#7002STATUS_SUBSEQUENT_CALL
Status: Processing is active. Subsequent call of FB.
16#7010STATUS_NOT_ENOUGH_VALUES
Status: Not enough values. The block requires three (3) values to calculate a smoothed value. Transfer additional values with a positive edge on the `insert` input.

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.03Simatic Systems Support
05.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