SCALE_X: Scale (S7-1200, S7-1500) - STEP 7

FBD (S7-1200, S7-1500)

ft:publication_title
FBD (S7-1200, S7-1500)
Product
STEP 7
Version
V20
Publication date
11/2024
Language
en-US
SCALE_X: Scale

Description

You can use the "Scale" instruction to scale the value at the VALUE input by mapping it to a specified value range. When the instruction "Scale" is executed, the floating-point value at input VALUE is scaled to the value range, which is defined by the parameters MIN and MAX. The result of the scaling is an integer, which is stored at output OUT.

The following figure shows an example of how values can be scaled:

The "Scale" instruction works with the following equation:

OUT = [VALUE ∗ (MAX – MIN)] + MIN

The enable output ENO has the signal state "0" if one of the following conditions applies:

  • Enable input EN has the signal state "0".

  • The value at input MIN is greater than or equal to the value at input MAX.

  • The value of a specified floating-point number is outside the range of the normalized numbers according to IEEE-754.

  • An overflow occurs.

  • The value at input VALUE is NaN (Not a number = result of an invalid arithmetic operation).

Note

For more information on the conversion of analog values, refer to the respective manual.

Parameters

The following table shows the parameters of the "Scale" instruction:

Parameters

Declaration

Data type

Memory area

Description

S7-1200

S7-1500

EN

Input

BOOL

I, Q, M, D, L or constant

I, Q, M, D, L, T, C or constant

Enable input

ENO

Output

BOOL

I, Q, M, D, L

I, Q, M, D, L

Enable output

MIN

Input

Integers, floating-point numbers

I, Q, M, D, L or constant

I, Q, M, D, L or constant

Low limit of the value range

VALUE

Input

Floating-point numbers

I, Q, M, D, L or constant

I, Q, M, D, L or constant

Value to be scaled.

If you enter a constant, you must declare it.

MAX

Input

Integers, floating-point numbers

I, Q, M, D, L or constant

I, Q, M, D, L or constant

High limit of the value range

OUT

Output

Integers, floating-point numbers

I, Q, M, D, L

I, Q, M, D, L

Result of scaling

You can select the data types of the instruction from the "???" drop-down lists of the instruction box.

For additional information on valid data types, refer to "See also".

For additional information on declaring constants, refer to "See also".

Example

The following example shows how the instruction works:

The following table shows how the instruction works using concrete operand values:

Parameters

Operand

Value

MIN

Tag_MIN

10

VALUE

Tag_Value

0.5

MAX

Tag_MAX

30

OUT

Tag_Result

20

If the "TagIn" operand has signal state "1", the instruction is executed. The value at input "Tag_Value" is scaled to the range of values defined by the values at inputs "Tag_MIN" and "Tag_MAX". The result is stored at output "Tag_Result". If the instruction is executed without errors, the ENO enable output has the signal state "1" and the "TagOut" output is set.