×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 39334504, Entry date: 04/01/2016
(75)
Rate

For an S7-1200/S7-1500 controller in STEP 7 (TIA Portal), how do you scale integer values in real numbers and vice versa for analog inputs and outputs?

• Entry
• Associated product(s)
STEP 7 (TIA Portal) provides the option of scaling analog values in the user program.

Instructions
You can use the SCALE_ X "Scale" and NORM_X "Normalize" converters to scale analog values. These blocks are located in STEP 7 (TIA Portal) in "Instructions" task card under "Basic Instructions" and "Converters". A detailed description of the function and parameterization is available in the STEP 7 Online Help. To obtain the Online Help for a block, mark the block concerned (SCALE_X, for example) and press the "F1" key.

In the following examples it is assumed that the measuring ranges are unipolar. The integer input value is then between 0 and 27648.

The following values are generated by the conversion (for determining temperature via current measurement, for example):

Integer value
(analog value)
Measured value
(in the 0-20mA range)
Measured value
(in the 4-20mA range)
Phys. value
00.04.020°C
69125.08.052.5°C
1382410.012.085°C
2073615.016.0117.5°C
2764820.020.0150°C

Example 1 - Conversion of an analog value into a physical value (analog input, taking the example of determining temperature)
The upper and lower limits are MAX=27648 and MIN=0 for normalization and MAX=150°C and Min=20°C for scaling. Since the input values are of the Integer data type and the output values are scaled as Real data type, the NORM_X function converts the data type from Integer to Real. The value 20000 corresponds to a measured value of 14.4676mA in the 0-20mA measuring range. Fig. 1

The connection of the two blocks as in Fig. 1 results in the following definition between the input value of the NORM_X block and the output value of the SCALE_X block:

 NORM_X_VALUE - NORM_X_MIN SCALE_X_OUT - SCALE_X_MIN ------------------------------------------- = ----------------------------------------- NORM_X_MAX - NORM_X_MIN SCALE_X_MAX - SCALE_X_MIN

If the input "VALUE" of the NORM_X block has the value 20000 and the limit values as in Fig. 1, then the output "OUT" of the SCALE_X block has the value:

 20000 - 0 SCALE_X_OUT - 20 ------------- = ----------------------- 27648 - 0 150 - 20 SCALE_X_OUT = 114.04 (corresponds to: 114.04°C)

Example 2 - Conversion of a physical value into an analog value (analog output taking the example of a control output)

Since the input values are of the Real data type and the output values are scaled as Integer data type, the SCALE_X function converts the data type from Real to Integer. The integer value 27648 corresponds to the upper limit and the integer value 0 to the lower limit of the output range. For example, for a control output of 65.0 the analog value 19968 is scaled, which corresponds to a current value of 14.4445mA (in the output range of 0-20mA). Fig. 2

Note
To change the data type conversion for the blocks, mark the block concerned and click on the yellow arrow. You can then select the required data type conversion from the drop-down list that opens. You must then change the parameters, because the data types of the parameters have changed. Fig. 3

Voltage measurement, Temperature measurement, Resistance measuring, Pressure sensor

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
https://www.siemens.com/cybersecurity#Ouraspiration.
Support to the statistics
With this function the IDs found are listed according to number (format .txt).

Copy URL
mySupport Cockpit