summaryrefslogtreecommitdiffstats
path: root/tests/tc999_projects/acme-004.awl
blob: 04da8837dd776e86bd96266da0d598708c2da203 (plain)
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
FUNCTION_BLOCK FB 1
TITLE =
VERSION : 0.0


VAR_INPUT
  Start : BOOL ;	
  Stop : BOOL ;	
  Response : BOOL ;	
  Reset_Maint : BOOL ;	
  Timer_No : TIMER ;	
  Response_Time : S5TIME ;	
END_VAR
VAR_OUTPUT
  Fault : BOOL ;	
  Start_Dsp : BOOL ;	
  Stop_Dsp : BOOL ;	
  Maint : BOOL ;	
END_VAR
VAR_IN_OUT
  Motor : BOOL ;	
END_VAR
VAR
  Time_bin : WORD ;	
  Time_BCD : WORD ;	
  Starts : INT ;	
  Start_Edge : BOOL ;	
END_VAR
BEGIN
NETWORK
TITLE =Start/Stop and Latching

      A(    ; 
      O     #Start; 
      O     #Motor; 
      )     ; 
      AN    #Stop; 
      =     #Motor; 
NETWORK
TITLE =Startup Monitoring

      A     #Motor; 
      L     #Response_Time; 
      SD    #Timer_No; 
      AN    #Motor; 
      R     #Timer_No; 
      L     #Timer_No; 
      T     #Time_bin; 
      LC    #Timer_No; 
      T     #Time_BCD; 
      A     #Timer_No; 
      AN    #Response; 
      S     #Fault; 
      R     #Motor; 
NETWORK
TITLE =Start Lamp / Fault Reset

      A     #Response; 
      =     #Start_Dsp; 
      R     #Fault; 
NETWORK
TITLE =Stop Lamp

      AN    #Response; 
      =     #Stop_Dsp; 
NETWORK
TITLE =Count Starts

      A     #Motor; 
      FP    #Start_Edge; 
      JCN   lab1; 
      L     #Starts; 
      +     1; 
      T     #Starts; 
lab1: NOP   0; 
NETWORK
TITLE =Maintenance

      L     #Starts; 
      L     50; 
      >=I   ; 
      =     #Maint; 
NETWORK
TITLE =Reset Maintenance

      A     #Reset_Maint; 
      A     #Maint; 
      JCN   END; 
      L     0; 
      T     #Starts; 
END:  NOP   0; 
END_FUNCTION_BLOCK

DATA_BLOCK DB 1
TITLE =
VERSION : 0.0

 FB 1
BEGIN
   Start := FALSE; 
   Stop := FALSE; 
   Response := FALSE; 
   Reset_Maint := FALSE; 
   Timer_No := T 0; 
   Response_Time := S5T#0MS; 
   Fault := FALSE; 
   Start_Dsp := FALSE; 
   Stop_Dsp := FALSE; 
   Maint := FALSE; 
   Motor := FALSE; 
   Time_bin := W#16#0; 
   Time_BCD := W#16#0; 
   Starts := 0; 
   Start_Edge := FALSE; 
END_DATA_BLOCK

DATA_BLOCK DB 2
TITLE =
VERSION : 0.0

 FB 1
BEGIN
   Start := FALSE; 
   Stop := FALSE; 
   Response := FALSE; 
   Reset_Maint := FALSE; 
   Timer_No := T 0; 
   Response_Time := S5T#0MS; 
   Fault := FALSE; 
   Start_Dsp := FALSE; 
   Stop_Dsp := FALSE; 
   Maint := FALSE; 
   Motor := FALSE; 
   Time_bin := W#16#0; 
   Time_BCD := W#16#0; 
   Starts := 0; 
   Start_Edge := FALSE; 
END_DATA_BLOCK

DATA_BLOCK DB 3
TITLE =
VERSION : 0.0

 FB 1
BEGIN
   Start := FALSE; 
   Stop := FALSE; 
   Response := FALSE; 
   Reset_Maint := FALSE; 
   Timer_No := T 0; 
   Response_Time := S5T#0MS; 
   Fault := FALSE; 
   Start_Dsp := FALSE; 
   Stop_Dsp := FALSE; 
   Maint := FALSE; 
   Motor := FALSE; 
   Time_bin := W#16#0; 
   Time_BCD := W#16#0; 
   Starts := 0; 
   Start_Edge := FALSE; 
END_DATA_BLOCK

FUNCTION FC 1 : VOID
TITLE =
VERSION : 0.0


VAR_INPUT
  Open : BOOL ;	
  Close : BOOL ;	
END_VAR
VAR_OUTPUT
  Dsp_Open : BOOL ;	
  Dsp_Closed : BOOL ;	
END_VAR
VAR_IN_OUT
  Valve : BOOL ;	
END_VAR
BEGIN
NETWORK
TITLE =Open/Close and Latching

      A(    ; 
      O     #Open; 
      O     #Valve; 
      )     ; 
      AN    #Close; 
      =     #Valve; 
NETWORK
TITLE =Display "Valve open"

      A     #Valve; 
      =     #Dsp_Open; 
NETWORK
TITLE =Display "Valve closed"

      AN    #Valve; 
      =     #Dsp_Closed; 
END_FUNCTION

ORGANIZATION_BLOCK OB 1
TITLE =
VERSION : 0.0


VAR_TEMP
  OB1_EV_CLASS : BYTE ;	//Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)
  OB1_SCAN_1 : BYTE ;	//1 (Cold restart scan 1 of OB1), 3 (Scan 2-n of OB1)
  OB1_PRIORITY : BYTE ;	//1 (Priority of 1 is lowest)
  OB1_OB_NUMBR : BYTE ;	//1 (Organization block 1, OB1)
  OB1_RESERVED_1 : BYTE ;	//Reserved for system
  OB1_RESERVED_2 : BYTE ;	//Reserved for system
  OB1_PREV_CYCLE : INT ;	//Cycle time of previous OB1 scan (milliseconds)
  OB1_MIN_CYCLE : INT ;	//Minimum cycle time of OB1 (milliseconds)
  OB1_MAX_CYCLE : INT ;	//Maximum cycle time of OB1 (milliseconds)
  OB1_DATE_TIME : DATE_AND_TIME ;	//Date and time OB1 started
  Enable_Motor : BOOL ;	
  Enable_Valve : BOOL ;	
  Start_Fulfilled : BOOL ;	
  Stop_Fulfilled : BOOL ;	
  Inlet_Valve_A_Open : BOOL ;	
  Inlet_Valve_A_Closed : BOOL ;	
  Feed_Valve_A_Open : BOOL ;	
  Feed_Valve_A_Closed : BOOL ;	
  Inlet_Valve_B_Open : BOOL ;	
  Inlet_Valve_B_Closed : BOOL ;	
  Feed_Valve_B_Open : BOOL ;	
  Feed_Valve_B_Closed : BOOL ;	
  Open_Drain : BOOL ;	
  Close_Drain : BOOL ;	
  Close_Valve_Fulfilled : BOOL ;	
END_VAR
BEGIN
NETWORK
TITLE =Interlock for Feed Pump A

      A     I      1.6; 
      A     I      1.3; 
      AN    Q      9.5; 
      =     #Enable_Motor; 
NETWORK
TITLE =Call FB Motor for Ingredient A

      A     I      0.0; 
      A     #Enable_Motor; 
      =     #Start_Fulfilled; 
      A(    ; 
      O     I      0.1; 
      ON    #Enable_Motor; 
      )     ; 
      =     #Stop_Fulfilled; 
      CALL FB     1 , DB     1 (
           Start                    := #Start_Fulfilled,
           Stop                     := #Stop_Fulfilled,
           Response                 := I      0.2,
           Reset_Maint              := I      1.7,
           Timer_No                 := T     12,
           Response_Time            := S5T#7S,
           Fault                    := Q      4.5,
           Start_Dsp                := Q      4.2,
           Stop_Dsp                 := Q      4.3,
           Maint                    := Q      4.6,
           Motor                    := Q      4.4);
NETWORK
TITLE =Delay Valve Enable Ingredient A

      A     Q      4.4; 
      L     S5T#1S; 
      SD    T     13; 
      AN    Q      4.4; 
      R     T     13; 
      A     T     13; 
      =     #Enable_Valve; 
NETWORK
TITLE =Inlet Valve Control for Ingredient A

      AN    I      0.2; 
      AN    Q      4.4; 
      =     #Close_Valve_Fulfilled; 
      CALL FC     1 (
           Open                     := #Enable_Valve,
           Close                    := #Close_Valve_Fulfilled,
           Dsp_Open                 := #Inlet_Valve_A_Open,
           Dsp_Closed               := #Inlet_Valve_A_Closed,
           Valve                    := Q      4.0);
NETWORK
TITLE =Feed Valve Control for Ingredient A

      AN    I      0.2; 
      AN    Q      4.4; 
      =     #Close_Valve_Fulfilled; 
      CALL FC     1 (
           Open                     := #Enable_Valve,
           Close                    := #Close_Valve_Fulfilled,
           Dsp_Open                 := #Feed_Valve_A_Open,
           Dsp_Closed               := #Feed_Valve_A_Closed,
           Valve                    := Q      4.1);
NETWORK
TITLE =Interlock for Feed Pump B

      A     I      1.6; 
      A     I      1.3; 
      AN    Q      9.5; 
      =     #Enable_Motor; 
NETWORK
TITLE =Call FB Motor for Ingredient B

      A     I      0.3; 
      A     #Enable_Motor; 
      =     #Start_Fulfilled; 
      A(    ; 
      O     I      0.4; 
      ON    #Enable_Motor; 
      )     ; 
      =     #Stop_Fulfilled; 
      CALL FB     1 , DB     2 (
           Start                    := #Start_Fulfilled,
           Stop                     := #Stop_Fulfilled,
           Response                 := I      0.5,
           Reset_Maint              := I      1.7,
           Timer_No                 := T     14,
           Response_Time            := S5T#7S,
           Fault                    := Q      5.5,
           Start_Dsp                := Q      5.2,
           Stop_Dsp                 := Q      5.3,
           Maint                    := Q      5.6,
           Motor                    := Q      5.4);
NETWORK
TITLE =Delay Valve Enable Ingredient B

      A     Q      5.4; 
      L     S5T#1S; 
      SD    T     15; 
      AN    Q      5.4; 
      R     T     15; 
      A     T     15; 
      =     #Enable_Valve; 
NETWORK
TITLE =Inlet Valve Control for Ingredient B

      AN    I      0.5; 
      AN    Q      5.4; 
      =     #Close_Valve_Fulfilled; 
      CALL FC     1 (
           Open                     := #Enable_Valve,
           Close                    := #Close_Valve_Fulfilled,
           Dsp_Open                 := #Inlet_Valve_B_Open,
           Dsp_Closed               := #Inlet_Valve_B_Closed,
           Valve                    := Q      5.0);
NETWORK
TITLE =Feed Valve Control for Ingredient B

      AN    I      0.5; 
      AN    Q      5.4; 
      =     #Close_Valve_Fulfilled; 
      CALL FC     1 (
           Open                     := #Enable_Valve,
           Close                    := #Close_Valve_Fulfilled,
           Dsp_Open                 := #Feed_Valve_B_Open,
           Dsp_Closed               := #Feed_Valve_B_Closed,
           Valve                    := Q      5.1);
NETWORK
TITLE =Interlock for Agitator

      A     I      1.6; 
      A     I      1.4; 
      AN    Q      9.5; 
      =     #Enable_Motor; 
NETWORK
TITLE =Call FB Motor for Agitator

      A     I      1.1; 
      A     #Enable_Motor; 
      =     #Start_Fulfilled; 
      A(    ; 
      O     I      1.2; 
      ON    #Enable_Motor; 
      )     ; 
      =     #Stop_Fulfilled; 
      CALL FB     1 , DB     3 (
           Start                    := #Start_Fulfilled,
           Stop                     := #Stop_Fulfilled,
           Response                 := I      1.0,
           Reset_Maint              := I      1.7,
           Timer_No                 := T     16,
           Response_Time            := S5T#10S,
           Fault                    := Q      8.3,
           Start_Dsp                := Q      8.1,
           Stop_Dsp                 := Q      8.2,
           Maint                    := Q      8.4,
           Motor                    := Q      8.0);
NETWORK
TITLE =Interlock for Drain Valve

      A     I      1.6; 
      A     I      1.5; 
      AN    Q      8.0; 
      =     #Enable_Valve; 
NETWORK
TITLE =Drain Valve Control

      A     I      0.6; 
      A     #Enable_Valve; 
      =     #Open_Drain; 
      A(    ; 
      O     I      0.7; 
      ON    #Enable_Valve; 
      )     ; 
      =     #Close_Drain; 
      CALL FC     1 (
           Open                     := #Open_Drain,
           Close                    := #Close_Drain,
           Dsp_Open                 := Q      9.6,
           Dsp_Closed               := Q      9.7,
           Valve                    := Q      9.5);
NETWORK
TITLE =Container Level Display

      AN    I      1.3; 
      =     Q      9.0; 
      AN    I      1.4; 
      =     Q      9.1; 
      AN    I      1.5; 
      =     Q      9.2; 
END_ORGANIZATION_BLOCK

bues.ch cgit interface