Siemens 6AV6651-7KA01-3AA4 - S7-1200 + KTP400 Basic Starter Kit 6AV6651-7KA01-3AA4 用户手册

产品代码
6AV6651-7KA01-3AA4
下载
页码 364
 
Getting started 
 
3.6 Use the CALCULATE instruction for a complex mathematical equation 
Easy Book 
Manual, 03/2014, A5E02486774-AF 
45
 
3.6 
Use the CALCULATE instruction for a complex mathematical 
equation 
 
The Calculate instruction lets you create a math function that operates on multiple input 
parameters to produce the result, according to the equation that you define.  
 
In the Basic instruction tree, expand the Math functions folder. 
Double-click the Calculate instruction to insert the instruction 
into your user program. 
 
The unconfigured Calculate 
instruction provides two input 
parameters and an output 
parameter. 
 
 
Click the "???" and select the data types for the input and output 
parameters. (The input and output parameters must all be the same 
data type.) 
For this example, select the "Real" data type. 
 
Click the "Edit equation" icon to enter the equation. 
 
 
 
For this example, enter the following equation for scaling a raw analog value. (The "In" and 
"Out" designations correspond to the parameters of the Calculate instruction.)  
Out 
value
  = ((Out 
high
 - Out 
low
) / (In 
high
 - In 
low
)) * (In 
value
 - In 
low
) + Out 
low
 
Out 
= ((in4 - in5) / (in2 - in3)) * (in1 - in3) + in5