FB_BA_AnalogInput

FB_BA_AnalogInput 1:

The FB_BA_AnalogInput function block is used to acquire and scale analog input signals.

The raw value nRawValue is converted into a physical value by linear interpolation with 2 interpolation points.

FB_BA_AnalogInput 2:

Within the parameters, it is possible to activate upper (stHighLimit) and lower (stLowLimit) limit value monitoring of the output signal fPresentValue.

In addition, the function block can be provided with a PT-1 filter to avoid strong fluctuations by the input signal nRawValue. The filter is activated by adjusting the filter constants nDampingConstant > 0.

Syntax

FUNCTION_BLOCK FB_BA_AnalogInput
VAR_INPUT
  nRawValue            : INT;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
  {region 'Variable Parameters'}
    {attribute 'parameterCategory':='Hardware'}
    stScale            : ST_BA_ScaleIntToReal := (nX01 := 0,nX02 := 32767,nY01 := -20,nY02 := 60);
    {attribute 'parameterCategory':='Hardware'}
    fOffset            : REAL;
    {attribute 'parameterCategory':='EventConfig'}
    stHighLimit        : ST_BA_LimitParameter := (nTimeToAbnormal := 1, nTimeToNormal := 1);
    {attribute 'parameterCategory':='EventConfig'}
    stLowLimit         : ST_BA_LimitParameter := (nTimeToAbnormal := 1, nTimeToNormal := 1);
    {attribute 'parameterCategory':='Value'}
    nDampingConstant   : UDINT;
  {endregion}
END_VAR
VAR_OUTPUT
  fPresentValue        : REAL;
  bHighLimit           : BOOL;
  bLowLimit            : BOOL;
END_VAR

FB_BA_AnalogInput 3: Inputs

Name

Type

Description

nRawValue

INT

Measured raw value.

FB_BA_AnalogInput 4: Inputs CONSTANT PERSISTENT

Name

Type

Description

stScale

ST_BA_ScaleIntToReal

The structure contains the interpolation points for linear interpolation.

fOffset

REAL

The offset can be used to adjust the scaled output value fPresentValue.

stHighLimit

ST_BA_LimitParameter

Data and command structure for upper limit value monitoring.

stLowLimit

ST_BA_LimitParameter

Data and command structure for lower limit value monitoring.

nDampingConstant

UDINT

To avoid strong fluctuations and jumps in the input signal, the function block is provided with a PT1 filter. This filter is activated by setting the filter constant nDampingConstant to greater than 0.

FB_BA_AnalogInput 5: Outputs

Name

Type

Description

fPresentValue

REAL

Scaled output value.

bHighLimit

BOOL

The upper limit monitoring is active.

bLowLimit

BOOL

The lower limit monitoring is active.

Prerequisites

Development environment

Required PLC library

TwinCAT from v3.1.4024.62

Tc3_BA2 from v5.5.14.0