# LGF_SimpleSmoothingFC (FC / 3.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

Identifier | Data type | Description
--- | --- | ---
Ret_Val | Void | Void - Function has no return value
error | Bool | FALSE: No error TRUE: An error occurred during the execution of the FB
status | Word | 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table)

### In/Out parameter

Identifier | Data type | Description
--- | --- | ---
values | Array[*] of LReal | Values that are to be included in the smoothing.
smoothedValues | Array[*] of LReal | The smoothed values.

### Status & Error codes

Code / Value | Identifier / Description
--- | ---
16#0000 | STATUS_FINISHED_NO_ERROR Status: Execution finished without errors
16#8400 | ERR_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#8401 | ERR_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 & Date | Change description
--- | ---
| 1.0.0 | Siemens Industry Online Support
| 23.11.2018 | First released version
| 1.0.1 | Simatic Systems Support
| 15.11.2019 | Regions, comments and constants are added
| 3.0.0 | Simatic Systems Support
| 23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library
| 3.0.1 | Simatic Systems Support
| 06.04.2021 | Insert documentation