-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFB_VD_Ventil_9.SCL
201 lines (193 loc) · 6.03 KB
/
FB_VD_Ventil_9.SCL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
(*****************************************************************************************
** **
** Copyright (c) 2019 Himmelt **
** All Rights Reserved Himmelt@SoraWorld **
** E-mail master@void-3.cn **
** **
******************************************************************************************
** Date Version Author Decsription **
------------------------------------------------------------------------------------------
** 2019.10.14 0.3 Himmelt Add KYPxxBER and BD01E; **
** Change name to FB_VD_Ventil_9 **
** 2019.10.12 0.2 Himmelt Change Valve to Ventil **
** 2019.08.09 0.1 Himmelt Beta **
** 2019.08.08 0.0 Himmelt Alpha **
*****************************************************************************************)
FUNCTION_BLOCK FB_VD_Ventil_9
VAR_INPUT
Addr : INT := 0;
K100 : BOOL := FALSE;
KYPX1R : BOOL := FALSE;
KYPX1V : BOOL := FALSE;
KYPX2R : BOOL := FALSE;
KYPX2V : BOOL := FALSE;
KYPX3R : BOOL := FALSE;
KYPX3V : BOOL := FALSE;
KYPX4R : BOOL := FALSE;
KYPX4V : BOOL := FALSE;
KYPX5R : BOOL := FALSE;
KYPX5V : BOOL := FALSE;
KYPX6R : BOOL := FALSE;
KYPX6V : BOOL := FALSE;
KYPX7R : BOOL := FALSE;
KYPX7V : BOOL := FALSE;
KYPX8R : BOOL := FALSE;
KYPX8V : BOOL := FALSE;
KYPX9R : BOOL := FALSE;
KYPX9V : BOOL := FALSE;
Delay : TIME := T#500MS;
END_VAR
VAR
tmpKYPR : ARRAY [1..9] OF BOOL;
tmpKYPV : ARRAY [1..9] OF BOOL;
tonKYPX1R : TON;
tonKYPX1V : TON;
tonKYPX2R : TON;
tonKYPX2V : TON;
tonKYPX3R : TON;
tonKYPX3V : TON;
tonKYPX4R : TON;
tonKYPX4V : TON;
tonKYPX5R : TON;
tonKYPX5V : TON;
tonKYPX6R : TON;
tonKYPX6V : TON;
tonKYPX7R : TON;
tonKYPX7V : TON;
tonKYPX8R : TON;
tonKYPX8V : TON;
tonKYPX9R : TON;
tonKYPX9V : TON;
END_VAR
VAR_OUTPUT
BEX1R : BOOL := TRUE;
BEX1V : BOOL := FALSE;
BEX2R : BOOL := TRUE;
BEX2V : BOOL := FALSE;
BEX3R : BOOL := TRUE;
BEX3V : BOOL := FALSE;
BEX4R : BOOL := TRUE;
BEX4V : BOOL := FALSE;
BEX5R : BOOL := TRUE;
BEX5V : BOOL := FALSE;
BEX6R : BOOL := TRUE;
BEX6V : BOOL := FALSE;
BEX7R : BOOL := TRUE;
BEX7V : BOOL := FALSE;
BEX8R : BOOL := TRUE;
BEX8V : BOOL := FALSE;
BEX9R : BOOL := TRUE;
BEX9V : BOOL := FALSE;
BD01E : BOOL := FALSE;
END_VAR
IF KYPX1R AND NOT KYPX1V THEN
tmpKYPR[1] := true;tmpKYPV[1] := false;BEX1V := false;
ELSIF NOT KYPX1R AND KYPX1V THEN
tmpKYPR[1] := false;tmpKYPV[1] := true;BEX1R := false;
END_IF;
IF KYPX2R AND NOT KYPX2V THEN
tmpKYPR[2] := true;tmpKYPV[2] := false;BEX2V := false;
ELSIF NOT KYPX2R AND KYPX2V THEN
tmpKYPR[2] := false;tmpKYPV[2] := true;BEX2R := false;
END_IF;
IF KYPX3R AND NOT KYPX3V THEN
tmpKYPR[3] := true;tmpKYPV[3] := false;BEX3V := false;
ELSIF NOT KYPX3R AND KYPX3V THEN
tmpKYPR[3] := false;tmpKYPV[3] := true;BEX3R := false;
END_IF;
IF KYPX4R AND NOT KYPX4V THEN
tmpKYPR[4] := true;tmpKYPV[4] := false;BEX4V := false;
ELSIF NOT KYPX4R AND KYPX4V THEN
tmpKYPR[4] := false;tmpKYPV[4] := true;BEX4R := false;
END_IF;
IF KYPX5R AND NOT KYPX5V THEN
tmpKYPR[5] := true;tmpKYPV[5] := false;BEX5V := false;
ELSIF NOT KYPX5R AND KYPX5V THEN
tmpKYPR[5] := false;tmpKYPV[5] := true;BEX5R := false;
END_IF;
IF KYPX6R AND NOT KYPX6V THEN
tmpKYPR[6] := true;tmpKYPV[6] := false;BEX6V := false;
ELSIF NOT KYPX6R AND KYPX6V THEN
tmpKYPR[6] := false;tmpKYPV[6] := true;BEX6R := false;
END_IF;
IF KYPX7R AND NOT KYPX7V THEN
tmpKYPR[7] := true;tmpKYPV[7] := false;BEX7V := false;
ELSIF NOT KYPX7R AND KYPX7V THEN
tmpKYPR[7] := false;tmpKYPV[7] := true;BEX7R := false;
END_IF;
IF KYPX8R AND NOT KYPX8V THEN
tmpKYPR[8] := true;tmpKYPV[8] := false;BEX8V := false;
ELSIF NOT KYPX8R AND KYPX8V THEN
tmpKYPR[8] := false;tmpKYPV[8] := true;BEX8R := false;
END_IF;
IF KYPX9R AND NOT KYPX9V THEN
tmpKYPR[9] := true;tmpKYPV[9] := false;BEX9V := false;
ELSIF NOT KYPX9R AND KYPX9V THEN
tmpKYPR[9] := false;tmpKYPV[9] := true;BEX9R := false;
END_IF;
tonKYPX1R(IN := tmpKYPR[1], PT := Delay);
tonKYPX1V(IN := tmpKYPV[1], PT := Delay);
tonKYPX2R(IN := tmpKYPR[2], PT := Delay);
tonKYPX2V(IN := tmpKYPV[2], PT := Delay);
tonKYPX3R(IN := tmpKYPR[3], PT := Delay);
tonKYPX3V(IN := tmpKYPV[3], PT := Delay);
tonKYPX4R(IN := tmpKYPR[4], PT := Delay);
tonKYPX4V(IN := tmpKYPV[4], PT := Delay);
tonKYPX5R(IN := tmpKYPR[5], PT := Delay);
tonKYPX5V(IN := tmpKYPV[5], PT := Delay);
tonKYPX6R(IN := tmpKYPR[6], PT := Delay);
tonKYPX6V(IN := tmpKYPV[6], PT := Delay);
tonKYPX7R(IN := tmpKYPR[7], PT := Delay);
tonKYPX7V(IN := tmpKYPV[7], PT := Delay);
tonKYPX8R(IN := tmpKYPR[8], PT := Delay);
tonKYPX8V(IN := tmpKYPV[8], PT := Delay);
tonKYPX9R(IN := tmpKYPR[9], PT := Delay);
tonKYPX9V(IN := tmpKYPV[9], PT := Delay);
IF tonKYPX1R.Q THEN
BEX1R := true;
ELSIF tonKYPX1V.Q THEN
BEX1V := true;
END_IF;
IF tonKYPX2R.Q THEN
BEX2R := true;
ELSIF tonKYPX2V.Q THEN
BEX2V := true;
END_IF;
IF tonKYPX3R.Q THEN
BEX3R := true;
ELSIF tonKYPX3V.Q THEN
BEX3V := true;
END_IF;
IF tonKYPX4R.Q THEN
BEX4R := true;
ELSIF tonKYPX4V.Q THEN
BEX4V := true;
END_IF;
IF tonKYPX5R.Q THEN
BEX5R := true;
ELSIF tonKYPX5V.Q THEN
BEX5V := true;
END_IF;
IF tonKYPX6R.Q THEN
BEX6R := true;
ELSIF tonKYPX6V.Q THEN
BEX6V := true;
END_IF;
IF tonKYPX7R.Q THEN
BEX7R := true;
ELSIF tonKYPX7V.Q THEN
BEX7V := true;
END_IF;
IF tonKYPX8R.Q THEN
BEX8R := true;
ELSIF tonKYPX8V.Q THEN
BEX8V := true;
END_IF;
IF tonKYPX9R.Q THEN
BEX9R := true;
ELSIF tonKYPX9V.Q THEN
BEX9V := true;
END_IF;
EW[Addr + 1] := 16#FFFF;// KYPxxBER
BD01E := A[Addr, 0];// KYP01EE
END_FUNCTION_BLOCK