NORM_X: Normalize (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
NORM_X: Normalize

Description

You can use the instruction "Normalize" to normalize the value of the tag at the VALUE input by mapping it to a linear scale. You can use the parameters MIN and MAX to define the limits of a value range that is applied to the scale. Depending on the location of the normalized value in this value range, the result at output OUT is calculated and stored as a floating-point number. If the value to be normalized is equal to the value at input MIN, output OUT returns the value "0.0". If the value to be normalized is equal to the value at input MAX, output OUT returns the value "1.0".

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

The "Normalize" instruction works with the following equation:

OUT = (VALUE – MIN) / (MAX – 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.

  • The value at input VALUE is NaN (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 instruction "Normalize":

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 1)

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 1)

Input

Integers, floating-point numbers

I, Q, M, D, L or constant

I, Q, M, D, L or constant

Value to be normalized.

MAX 1)

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

Floating-point numbers

I, Q, M, D, L

I, Q, M, D, L

Result of the normalization

1) If you use constants in these three parameters, you only need to declare one of them.

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

20

MAX

Tag_MAX

30

OUT

Tag_Result

0.5

If the "TagIn" operand has signal state "1", the instruction is executed. The value at input "Tag_Value" is assigned to the range of values defined by the values at inputs "Tag_MIN" and "Tag_MAX". The tag value at input "Tag_Value" is normalized corresponding to the defined value range. The result is stored as a floating-point number 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.