FB_BA_FltrPT1

FB_BA_FltrPT1 1:

The function block FB_BA_FltrPT1 implements a first-order digital PT1 filter for smoothing input signals. The filter time constant nDampConst determines the filter’s damping characteristics.

When the function block is first called (system startup), the output fOut is automatically set to the input fIn once. In subsequent cycles, the output continuously tracks the input signal, with the rate of change limited by the filter time constant.

FB_BA_FltrPT1 2:

The filter time constant nDampConst is internally limited to a value range of 0 to 86400 seconds. A value of 0 results in direct signal transmission without delay.

FB_BA_FltrPT1 3:

A rising edge on bSetActl can terminate the current iteration and immediately reset the output fOut to the current input value fIn. This is useful for reinitializing the filter.

Syntax

FUNCTION_BLOCK FB_BA_FltrPT1
VAR_INPUT
  fIn            : REAL;
  nDampConst     : UDINT;
  bSetActl       : BOOL;
END_VAR
VAR_OUTPUT
  fOut           : REAL;
END_VAR

FB_BA_FltrPT1 4: Inputs

Name

Type

Description

fIn

REAL

Input signal

nDampConst

UDINT

Filter time constant [s]. Internally limited to values between 0 and 86400.

bSetActl

BOOL

A rising edge at this input switches the output value fOut to the input value fIn.

FB_BA_FltrPT1 5: Outputs

Name

Type

Description

fOut

REAL

Filtered output signal