-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconveyor.salman-test.yaml
More file actions
106 lines (98 loc) · 4.33 KB
/
Copy pathconveyor.salman-test.yaml
File metadata and controls
106 lines (98 loc) · 4.33 KB
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
# Tests for examples/conveyor/conveyor.st
#
# salman test examples/conveyor/conveyor.st examples/conveyor/
#
# Values are written as IEC literals and mean here exactly what they mean in
# source: T#5s is a duration, 16#FF is a byte, TRUE is a BOOL.
- test: "the belt does not run until the start button is pressed"
pou: Conveyor
steps:
- { scans: 1, expect: { Motor: false, Jam_Lamp: false, State: 0 } }
- { set: { Start_PB: true }, scans: 1, expect: { Motor: true, State: 1 } }
- test: "the belt runs on for two seconds after the stop button, then stops"
pou: Conveyor
steps:
- { set: { Start_PB: true }, scans: 1, expect: { Motor: true } }
- set: { Start_PB: false, Stop_PB: true }
scans: 1
expect: { Motor: true }
note: "the run-on TOF holds the motor while the belt clears"
- { advance: "T#1s999ms", expect: { Motor: true } }
- { advance: "T#2ms", expect: { Motor: false } }
- test: "the stop button wins when both buttons are pressed, and there is no start-up pulse"
pou: Conveyor
steps:
- set: { Start_PB: true, Stop_PB: true }
scans: 1
expect: { Motor: false }
note: >-
Two rules at once. RS is reset dominant, so with both buttons pressed the latch
is clear. And a fresh TOF whose input starts low must not begin an off delay:
if it did, every programme using a run-on timer would emit a phantom pulse the
moment the controller started.
- { advance: "T#3s", expect: { Motor: false } }
- set: { Stop_PB: false }
scans: 1
expect: { Motor: true }
note: "releasing stop lets the latch set, because start is still held"
- test: "each part counts exactly once, on the leading edge of the sensor"
pou: Conveyor
steps:
- { set: { Start_PB: true }, scans: 1, expect: { Parts.CV: 0 } }
- { set: { Part_Sensor: true }, scans: 1, expect: { Parts.CV: 1 } }
- set: {}
scans: 5
expect: { Parts.CV: 1 }
note: "a sensor held high must not count five more times"
- { set: { Part_Sensor: false }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1, expect: { Parts.CV: 2 } }
- test: "the batch completes at ten parts and progress reaches one hundred percent"
pou: Conveyor
steps:
- { set: { Start_PB: true }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1 }
- { set: { Part_Sensor: false }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1 }
- { set: { Part_Sensor: false }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1 }
- { set: { Part_Sensor: false }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1 }
- { set: { Part_Sensor: false }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1 }
- { set: { Part_Sensor: false }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1 }
- { set: { Part_Sensor: false }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1 }
- { set: { Part_Sensor: false }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1 }
- { set: { Part_Sensor: false }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1 }
- { set: { Part_Sensor: false }, scans: 1 }
- { set: { Part_Sensor: true }, scans: 1, expect: { Parts.CV: 10, Batch_Done: true } }
- { expect: { Progress: 100, State: 3 } }
- test: "a jam is flagged after ten seconds of running with no part"
pou: Conveyor
steps:
- { set: { Start_PB: true }, scans: 1, expect: { Jam_Lamp: false } }
- { advance: "T#9s999ms", expect: { Jam_Lamp: false } }
- { advance: "T#2ms", expect: { Jam_Lamp: true, State: 2 } }
- test: "a part restarts the jam timer"
pou: Conveyor
steps:
- { set: { Start_PB: true }, scans: 1 }
- { advance: "T#9s", expect: { Jam_Lamp: false } }
- set: { Part_Sensor: true }
scans: 1
note: "the edge output drops IN for one scan, which restarts the timer"
- { set: { Part_Sensor: false }, advance: "T#9s", expect: { Jam_Lamp: false } }
- { advance: "T#2s", expect: { Jam_Lamp: true } }
- test: "the whole sequence produces the recorded trace"
pou: Conveyor
record: [Motor, Jam_Lamp, Batch_Done, "Parts.CV", Progress, State]
golden: conveyor.trace
steps:
- { set: { Start_PB: true }, scans: 4 }
- { set: { Part_Sensor: true }, scans: 3 }
- { set: { Part_Sensor: false }, scans: 3 }
- { set: { Part_Sensor: true }, scans: 3 }
- { set: { Stop_PB: true, Start_PB: false }, scans: 4 }