Вы находитесь на странице: 1из 3

Totally Integrated

Automation Portal

Block_2 [FC2]
Block_2 Properties
General
Name
Block_2
Language
SCL
Information
Title
Family

Name
Input
Output

Number

Type

Author
Version

0.1

Comment
User-defined
ID

Data type

alarm_bit
no
InOut
Temp

Bool
Int

data_1
data_2
diff
abs_diff
i
j
cnt
cnt_i
cnt_j
k
Return

Int
Int
Int
Int
Int
Int
Int
Int
Int
Int

0.0
2.0
4.0
6.0
8.0
10.0
12.0
14.0
16.0
18.0

Comment

not used
not used

Void

Block_2

0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019

Offset

FC

// I have written a program only for 5 elements

#i:=0;
#j:=0;
#k:=0;

// pointer 1 DB1
// pointer 2 DB1
// pointer 3 to store the difference in DB2

L1: #data_1:=%DB1.DW(#i);
FOR #j := #i+2

TO 10 BY 2

#data_2:=%DB1.DW(#j);
#diff:= #data_1-#data_2;
#abs_diff:=ABS(#diff);
%DB2.DW(#k):=#diff;
#k:=#k+2;

//load the value pointed by i in data_1


DO

// loop for the subsraction


// load the value pointed by j in data_2
// substraction
// absolute diff
// storing the difference in DB2
// pointer of DB2

Totally Integrated
Automation Portal

0020
#no:=#k;
0021
0022
IF #abs_diff>=50 THEN
0023
#alarm_bit:=1 ;
0024
END_IF;
0025
0026 END_FOR;
0027
0028
0029 IF #no=10 THEN
0030
#j:=0;
0031
#i:=#i+2;
0032
GOTO L1;
0033 END_IF;
0034
0035
0036
0037
0038
Symbol
#i
0
#j
#data_1
"Data_block_1"
#data_2
#diff
#abs_diff
2
"Data_block_2"
#k
10
#no
50
#alarm_bit
true
Symbol
#i
0
#j
#data_1
"Data_block_1"
#data_2
#diff
#abs_diff
2
"Data_block_2"
#k
10
#no
50
#alarm_bit

Address
0

%DB1

2
%DB2
10
50
true
Address
0

%DB1

2
%DB2
10
50

// alarm generation

// loop repeatation

Type
Int
DInt
Int
Int
Block_DB
Int
Int
Int
Int
Block_DB
Int
Int
Int
Int
Bool
Bool

Comment

Type
Int
DInt
Int
Int
Block_DB
Int
Int
Int
Int
Block_DB
Int
Int
Int
Int
Bool

Comment

Totally Integrated
Automation Portal
Symbol
true

Address
true

Type
Bool

Comment

Вам также может понравиться