Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 77316903, Entry date: 07/04/2016

How do you standardize and destandardize analog values with STEP 7 (TIA Portal)?

  • Entry
  • Associated product(s)
Contrary to binary signals, analog signals take any number of values within a specific range. You have to convert or standardize and destandardize the analog values before you can process, display or output them.

For standardizing you should only use the general linear equation for linear signals. Defining two points of the straight line is sufficient to calculate the gradient of the line and the ordinate value.

Standardizing or scaling the analog value
An analog input module provides a numerical value for a standardized analog signal (current, voltage, resistance or temperature). This numerical value must represent the parameter to be measured (fill level in liters, for example).

Fig. 1

Inversely, the user program calculates a process value that has to be converted into a numerical value. The analog output module converts this numerical value into an analog signal to trigger an actuator, for example.

Fig. 2

The functions of the library available for downloading below can be used for standardizing and destandardizing in analog value processing.

  • The x values are the known parameters in each case.
  • The corresponding y value includes the result of the conversion.

The table below includes the functions for the S7-300/S7-400 and for the S7-1200/S7-1500:


SclScaleLinearIntS7-1200/S7-1500  SCLHere the x values and the y values are integer numbers.
SclScaleLinearIntToRealS7-1200/S7-1500   SCLHere the x values are integer numbers and the y values are real numbers.
SclScaleLinearRealS7-1200/S7-1500  SCLHere the x values and the y values are real numbers.
SclScaleLinearRealToIntS7-1200/S7-1500    SCL Here the x values are real numbers and the y values are integer numbers.

With the S7-300/S7-400 these functions do not change the address register AR1/AR2 and for the FBD and LAD applications they provide the ENO box in which the RLO = 0 or 1 is stored in the BR bit.

By entering "yMin" and "yMax" you can limit the calculated y value to a specific range with lower and upper limits. In this way you avoid overrange and underrange areas with the analog modules.

The value for "Y" (function value "Ret_Val") is calculated according to the general linear equation with y = ax + b.

This yields the following relationship:

(y1 - y0)
y =------------* (x - x0) + y0
(x1 - x0)

Fig. 3 shows linear scaling with the function "SclScaleLinearIntToReal".

Fig. 3

A signal of 4mA to 20mA is present at an analog module. This signal is converted to the internal CPU value of 0 to 27648 to measure a fill level. Here, 4mA corresponds to the fill level of 0.0m and 20mA to the fill level of 1.7m.

Then parameterize the block as follows:

  • P0 (x0 = 0; y0 = 0.0)
  • P1 (x1 = +27648; y1 = 1.7)

Fig. 4 shows the call and parameters of the function "SclScaleLinearIntToReal".

Fig. 4

Download for the S7-1200/S7-1500
The download includes the STEP 7 (TIA Portal) library with the blocks described above for the S7-1200 and for the S7-1500. Unpack the Zip file in a separate directory on your hard disk. Then you can open and edit the library in STEP 7 (TIA Portal).

 Registration required 77316903_Scale_Lib_S7-1200_S7-1500.zip (1.1 MB)

Download for the S7-300/S7-400
The download includes the STEP 7 (TIA Portal) library with the blocks described above for the S7-300 and for the S7-400. Unpack the Zip file in a separate directory on your hard disk. Then you can open and edit the library in STEP 7 (TIA Portal).

 Registration required 77316903_Scale_Lib_S7-300_S7-400.zip (1.1 MB)

You can only open and edit the libraries in STEP 7 (TIA Portal). Further information about opening libraries is available in Entry ID: 107147393

Creation Environment
The screens and downloads in this FAQ response were created with STEP 7 (TIA Portal) V13 + SP1.

Additional Keywords
Measuring range, Measured value modification

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit