×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 24624928, Entry date: 11/07/2013
(9)
Rate

How can you standardize and destandardize analog values with STEP 7 V5.5?

  • Entry
  • Associated product(s)
Instructions An analog input module provides a number value for a standardized analog signal (current, voltage, resistance or temperature). This number value must represent the parameter to be measured (fill level in liters, for example). This procedure is called standardizing or scaling the analog value. ...

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

Conversely the user program calculates a process value. This process value has to be converted into a number value that the analog output module converts into an analog signal with which it activates an analog actuator. This conversion procedure is called destandardizing. The functions of the library available for downloading below can be used for standardizing and destandardizing in analog value processing.

Fig. 01 shows an example for standardizing.


Fig. 01

Fig. 02 shows an example for destandardizing.


Fig. 02

Thus in the y values there is always the result of the conversion. The x values are the known parameters in each case.

The four functions of the loadable library differ with regard to data types that are available for the y side or x side.

  1. With the FC164 function the x values are integer numbers and the y values are integer numbers.
  2. With the FC165 function the x values are integer numbers and the y values are real numbers.
  3. With the FC166 function the x values are real numbers and the y values are integer numbers.
  4. With the FC167 function the x values are real numbers and the y values are real numbers.

Notes
These functions do not change the address register AR1/AR2 and for the FBD and LAD applications provide the ENO box in which the RLO = 0 or 1 is stored in the BR bit.

Program handling taking the example of FC165 (scaling of the type INTEGER to REAL)
Parameters of the block FC165:
 

Declaration

Name

Type

Comment

in

X

INT

Range {-32768,..,0,..,+32767}

in

yMIN

REAL

MIN limit for y
{-3.402823e+38,..,
0.0,..,+3.402823e+38}

in

yMAX

REAL

MAX limit for y
{-3.402823e+38,..,
0.0,..,+3.402823e+38}

in

x0

INT

Range {-32768,..,0,..,+32767}

in

y0

REAL

Range {-3.402823e+38,..,
0.0,..,+3.402823e+38}

in

x1

INT

Range {-32768,..,0,..,+32767}

in

y1

REAL

Range {-3.402823e+38,..,
0.0,..,+3.402823e+38}

out

y

REAL

Range {-3.402823e+38,..,
0.0,..,+3.402823e+38}

By entering yMIN and yMAX you can limit the calculated y value to a specific range with lower and upper limits. This cuts out overrange and underrange areas of the analog input and output cards.

Thus Y is calculated according to the general linear equation: y = a x + b.

This yields the following relationship: y = (y1-y0) / (x1-x0) * (x-x0) + y0

Example of linear scaling with the function FC165 (INTEGER > REAL)


Fig. 03

A signal of 4mA to 20mA is present at the analog input card. This is converted to the internal CPU value of 0 to 27648. A fill level is to be measured with this. It is known that 4mA corresponds to the fill level of 0.0m and 20mA to the fill level of 1.7m.

This yields the following parameters:
P0(x0=0; y0=0.0)
P1(x1=+27648; y1=+1.7)

You call the FC165 function as follows:
 

CALL FC 165
x:= PEW 20
yMIN:= 0,0
yMAX:= 1,7
x0:= 0
y0:= 0,0
x1:= 27648
y1:= 1,7
y:= MD22

Note
Refer to the manual "S7-300 Automation System Module data"  (Entry ID 8859629), chapter 5 "Representation of the analog values of analog modules" to see which voltage, current, resistance and temperature ranges correspond to which internal CPU number ranges. If you have an S7-400 system, the relevant information is available in the manual "Automation System S7-400 Module Specifications" (Entry ID 1117740), section 5.3 "Analog Value Representation".

Download "STEP7_V55_PID_Scale"
Copy the "STEP7_V55_PID_Scale.zip" file into a separate directory and then start the file with a double-click. The STEP 7 library now unpacks with all the associated subdirectories. You can then use the SIMATIC Manager to open and process the extracted library. The download contains the described functions FC164, FC165, FC166 and FC167 in a STEP 7 library.

STEP7_V55_PID_Scale.zip ( 224 KB )  

The STEP 7 V5.5 library also contains the IEC standard block FC105 "SCALE" of STEP 7. More information on this block is available in the STEP 7 Online Help.

Creation environment
Screens and download in this FAQ response were created with STEP 7 V5.5

Additional Keywords
Measuring range, Measured value adaptation

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.