Vous êtes sur la page 1sur 2

Totally Integrated

Automation Portal

Project1 / PLC_1 [CPU 1212C DC/DC/DC] / Program blocks


Scale_current_input [FC1]
Scale_current_input Properties
General
Name Scale_current_input Number 1 Type FC Language LAD
Numbering automatic
Information
Title Scale current input from Author Comment Family
0-20 mA to 4-20 mA 27648
f(x) =
------------------------------- * x
- 6912
(27648 - 5529,6)
Version 0.1 User-defined
ID

Scale_current_input
Name Data type Default value Comment
Input
r_wire_break_limit Real
w_input_0-20mA Word
Output
b_wire_break Bool
r_input_4-20mA Real
InOut
Temp
r_analog_input_temp Real
r_factor Real
Constant
Return
Scale_current_input Void

Network 1:
- Convert analog value to real

CONV
UInt to Real
EN ENO
#"w_input_0- #r_analog_
20mA" IN OUT input_temp

Symbol Address Type Comment


#"w_input_0-20mA" Word
#r_analog_input_temp Real

Network 2:
- check for wire break
- set value to zero
- set bit "wire break"

#r_analog_
input_temp
MOVE #b_wire_break
<=
EN ENO
Real
#r_wire_break_ 5529.6 IN #r_analog_
limit OUT1 input_temp

Symbol Address Type Comment


#b_wire_break Bool
#r_analog_input_temp Real
#r_wire_break_limit Real

Network 3:
- check if value < 4mA

#r_analog_
input_temp
MOVE
<=
EN ENO
Real
5529.6 5529.6 IN #r_analog_
OUT1 input_temp

Symbol Address Type Comment


#r_analog_input_temp Real

Network 4:
- check if value > 20mA
Totally Integrated
Automation Portal

#r_analog_
input_temp
MOVE
>
EN ENO
Real
27648.0 27648.0 IN #r_analog_
OUT1 input_temp

Symbol Address Type Comment


#r_analog_input_temp Real

Network 5:
multiply analog value by range ( 27648)
f(x1)=x * 27648

MUL
Real
EN ENO
#r_analog_ #r_analog_
input_temp IN1 OUT input_temp
27648.0 IN2

Symbol Address Type Comment


#r_analog_input_temp Real

Network 6:
f(x2) = f(x1) / 22118,4
f(x3) = f(x2) - 6912 = f(x)

DIV SUB
Real Real
EN ENO EN ENO
#r_analog_ #r_analog_ #r_analog_ #"r_input_4-
input_temp IN1 OUT input_temp input_temp IN1 OUT 20mA"
22118.4 IN2 6912.0 IN2

Symbol Address Type Comment


#"r_input_4-20mA" Real
#r_analog_input_temp Real

Vous aimerez peut-être aussi