Skip to main content

FB_SCALING

Description Function Block

The FB_SCALING function block is used to multiply the AnalogIn input by the scaling factor and then divided and added to the scaling offset. The AnalogIn input can be negated. In the case of data types INT and DINT, this corresponds to multiplication by –1. For the data types UINT and UDINT, this corresponds to an XOR concatentation with 16#FFFFFF or 32#FFFFFFFFFF.

The bFloor, bCeil, and bRound inputs can be used to specify which rounding method to be applied for the internal division.

In addition, the tWatchdog input can be used to define that the AnalogIn input must have changed within the specified time. If the AnalogIn input remains unchanged within the specified time, the bStuckAtError output is set to TRUE. If the tWatchdog input is set to t#0ms or it is not used, then the check is deactivated. The bStuckAtError output is not an FB error. As a result, the TwinSAFE group does not enter an error state. It must react to it in the application program.

EL6900

The FB_SCALING function block is not supported by the EL6900.

EL6900_SCALING.png
Table 50. VAR_INPUT

Name

Data Type

Initial Value

Description, Parameter Values

AnalogIn

LINT

0

Input for scaling. The input can be negated.

Permitted data types: UINT, INT, UDINT, DINT

uiMultiplier

SAFEUINT

0

Scale factor Multiplier

Only a constant value is permitted (no variable)

uiDivisor

SAFEUINT

0

Scaling factor divisor

Only a constant value is permitted (no variable)

bFloor

SAFEBOOL

FALSE

Rounding method: Decimal places are truncated.

Only a constant value is permitted (no variable)

Only one of the bFloor, bCeil, and bRound inputs may beTRUE.

bCeil

SAFEBOOL

FALSE

Rounding method: The next largest integer is returned as the result.

Only a constant value is permitted (no variable)

Only one of the bFloor, bCeil, and bRound inputs may beTRUE.

bRound

SAFEBOOL

FALSE

Rounding method: Rounded away from zero (for example, 2.5 is rounded up to 3).

Only a constant value is permitted (no variable)

Only one of the bFloor, bCeil, and bRound inputs may beTRUE.

bMultiplicationFirst

SAFEBOOL

FALSE

TRUE: When scaling, after the optional negation multiplication is performed first.

FALSE: When scaling, after the optional negation division is performed first.

diScalingOffset

SAFEDINT

0

Offset which is added to the analog value

Only a constant value is permitted (no variable)

tWatchdog

SAFETIME

TIME#0ms

Time (in ms) within which the AnalogIn input value must change

If the value is t#0ms, then the check is deactivated.



Table 51. VAR_OUTPUT

Name

Data Type

Initial Value

Description, Parameter Values

bStuckAtError

SAFEBOOL

FALSE

Becomes TRUE if the AnalogIn input value has not changed for the tWatchdog time.

AnalogOut

SAFEUSINT

0

Output with the scaled input signal

  • Negation AnalogIn

  • Multiplication scaling factor numerator

  • Division scaling factor denominator

  • Addition scaling offset

Permitted data types: UINT, INT, UDINT, DINT. The data type must be selected according to the input data types.

bError

SAFEBOOL

FALSE

TRUE:

  • The AnalogOut output has an overflow or underflow.

  • In the case of multiplication, a 32-bit overflow occurs.

  • In the case of division, a 32-bit overflow occurs due to rounding up.

FALSE: No error has occurred.