Du meinst so etwas?
Habe etwas in AWL gebastelt, das die 4 LichtSchranken LB0, LB1, LB2 und LB3 auswertet.
Zulässig sind die Reihenfolgen LB0 -> LB1 -> LB2 -> LB3 bzw. LB3 -> LB2 -> LB1 -> LB0, jedoch (? evtl ohne die zweite Abweichung . . . das gif-Bildchen hat sich vorhin noch etwas anders verhalten . . . merkwürdig!?):
- muss LB0 unterbrochen bleiben, bis nach LB1 und LB2 auch LB3 unterbrochen wird bzw. LB3 muss unterbrochen bleiben, bis nach LB2 und LB1 auch LB0 unterbrochen wird, d.h. der Abstand zwischen LB0 und LB3 darf nicht grösser sein, als die zu überwachende Paletten- bzw. WerkstückLänge
- das MutingSignal wird maximal so lange ausgegeben, wie mindestens 1 der beiden Lichtschranken LB1 + LB2 unterbrochen ist.
Sobald das Unterbrechen bzw. das Beenden der Unterbrechungen der Lichtschranken nicht (mehr) zur anfangs festgestellten Richtung passt, wird das MutingSignal ggfs (vorzeitig) beendet.
Code:
// AND combination of inputs
3 U E 0.0 LB 0 13 44 57 70 89 95 103 122 128
4 U E 0.1 LB 1 9 14 17 60 73 131
5 U E 0.2 LB 2 10 18 21 63 76 134
6 U E 0.3 LB 3 22 47 66 79 90 97 105 124 137
7 = L 2.4 tmp all LBs active 36 51 140
// OR combination of inputs
9 O E 0.1 LB 1 4 14 17 60 73 131
10 O E 0.2 LB 2 5 18 21 63 76 134
11 = L 2.5 tmp LB1 or LB2 active 96 104 113 123
// XOR combinations of inputs
13 X E 0.0 LB 0 3 44 57 70 89 95 103 122 128
14 X E 0.1 LB 1 4 9 17 60 73 131
15 = L 2.0 tmp E 0.0<>E 0.1 25 29 33
17 X E 0.1 LB 1 4 9 14 60 73 131
18 X E 0.2 LB 2 5 10 21 63 76 134
19 = L 2.1 tmp E 0.1<>E 0.2 26 30 34
21 X E 0.2 LB 2 5 10 18 63 76 134
22 X E 0.3 LB 3 6 47 66 79 90 97 105 124 137
23 = L 2.2 tmp E 0.2<>E 0.3 27 31 35
// check # of edges
25 U L 2.0 tmp E 0.0<>E 0.1 =15 29 33
26 UN L 2.1 tmp E 0.1<>E 0.2 =19 30 34
27 UN L 2.2 tmp E 0.2<>E 0.3 =23 31 35
O
29 UN L 2.0 tmp E 0.0<>E 0.1 =15 25 33
30 U L 2.1 tmp E 0.1<>E 0.2 =19 26 34
31 UN L 2.2 tmp E 0.2<>E 0.3 =23 27 35
O
33 UN L 2.0 tmp E 0.0<>E 0.1 =15 25 29
34 UN L 2.1 tmp E 0.1<>E 0.2 =19 26 30
35 U L 2.2 tmp E 0.2<>E 0.3 =23 27 31
36 O L 2.4 tmp all LBs active =7 51 140
37 = L 3.2 tmp # of edges OK 91 99 107
// set decreasing
39 O M 0.0 dir IN (0 -> 3) R92 R109 S100 43 111 116
40 O M 0.1 dir OUT (3 -> 0) R93 R101 S108 46 112 119
41 = L 3.0 tmp direction defined 54 125
43 U M 0.0 dir IN (0 -> 3) R92 R109 S100 39 111 116
44 UN E 0.0 LB 0 3 13 57 70 89 95 103 122 128
O
46 U M 0.1 dir OUT (3 -> 0) R93 R101 S108 40 112 119
47 UN E 0.3 LB 3 6 22 66 79 90 97 105 124 137
48 = L 3.1 tmp decreasing given 50
50 U L 3.1 tmp decreasing given =48
51 UN L 2.4 tmp all LBs active =7 36 140
52 U M 0.3 EF previously all LBs active =141
53 O M 0.2 decreasing =55 83 86
54 U L 3.0 tmp direction defined =41 125
55 = M 0.2 decreasing 53 83 86
// negative edges
57 UN E 0.0 LB 0 3 13 44 70 89 95 103 122 128
58 U M 1.0 EF LB 0 =129 71 98
O
60 UN E 0.1 LB 1 4 9 14 17 73 131
61 U M 1.1 EF LB 1 =132 74
O
63 UN E 0.2 LB 2 5 10 18 21 76 134
64 U M 1.2 EF LB 2 =135 77
O
66 UN E 0.3 LB 3 6 22 47 79 90 97 105 124 137
67 U M 1.3 EF LB 3 =138 80 106
68 = L 2.6 tmp neg edge 84
// positive edges
70 U E 0.0 LB 0 3 13 44 57 89 95 103 122 128
71 UN M 1.0 EF LB 0 =129 58 98
O
73 U E 0.1 LB 1 4 9 14 17 60 131
74 UN M 1.1 EF LB 1 =132 61
O
76 U E 0.2 LB 2 5 10 18 21 63 134
77 UN M 1.2 EF LB 2 =135 64
O
79 U E 0.3 LB 3 6 22 47 66 90 97 105 124 137
80 UN M 1.3 EF LB 3 =138 67 106
81 = L 2.7 tmp pos edge 87
// detect wrong direction/order
83 UN M 0.2 decreasing =55 53 86
84 U L 2.6 tmp neg edge =68
O
86 U M 0.2 decreasing =55 53 83
87 U L 2.7 tmp pos edge =81
O
89 UN E 0.0 LB 0 3 13 44 57 70 95 103 122 128
90 UN E 0.3 LB 3 6 22 47 66 79 97 105 124 137
91 [COLOR=#0000cd][B]ON L 3.2 tmp # of edges OK[/B][/COLOR] =37 99 107
92 R M 0.0 dir IN (0 -> 3) R109 S100 39 43 111 116
93 R M 0.1 dir OUT (3 -> 0) R101 S108 40 46 112 119
// start sequence IN
95 U E 0.0 LB 0 3 13 44 57 70 89 103 122 128
96 UN L 2.5 tmp LB1 or LB2 active =11 104 113 123
97 UN E 0.3 LB 3 6 22 47 66 79 90 105 124 137
98 UN M 1.0 EF LB 0 =129 58 71
99 U L 3.2 tmp # of edges OK =37 91 107
100 S M 0.0 dir IN (0 -> 3) R92 R109 39 43 111 116
101 R M 0.1 dir OUT (3 -> 0) R93 S108 40 46 112 119
// start sequence OUT
103 UN E 0.0 LB 0 3 13 44 57 70 89 95 122 128
104 UN L 2.5 tmp LB1 or LB2 active =11 96 113 123
105 U E 0.3 LB 3 6 22 47 66 79 90 97 124 137
106 UN M 1.3 EF LB 3 =138 67 80
107 U L 3.2 tmp # of edges OK =37 91 99
108 S M 0.1 dir OUT (3 -> 0) R93 R101 40 46 112 119
109 R M 0.0 dir IN (0 -> 3) R92 S100 39 43 111 116
// output
111 O M 0.0 dir IN (0 -> 3) R92 R109 S100 39 43 116
112 O M 0.1 dir OUT (3 -> 0) R93 R101 S108 40 46 119
113 U L 2.5 tmp LB1 or LB2 active =11 96 104 123
114 = A 0.0 activate muting
// optional outputs 1
116 U M 0.0 dir IN (0 -> 3) R92 R109 S100 39 43 111
117 = A 0.1 correct order for IN (optional)
// optional outputs 2
119 U M 0.1 dir OUT (3 -> 0) R93 R101 S108 40 46 112
120 = A 0.2 correct order for OUT (optional)
// optional outputs 3
122 O E 0.0 LB 0 3 13 44 57 70 89 95 103 128
123 O L 2.5 tmp LB1 or LB2 active =11 96 104 113
124 O E 0.3 LB 3 6 22 47 66 79 90 97 105 137
125 UN L 3.0 tmp direction defined =41 54
126 = A 0.3 fault LB without direction (opt.)
// store status for edge-detection
128 U E 0.0 LB 0 3 13 44 57 70 89 95 103 122
129 = M 1.0 EF LB 0 58 71 98
131 U E 0.1 LB 1 4 9 14 17 60 73
132 = M 1.1 EF LB 1 61 74
134 U E 0.2 LB 2 5 10 18 21 63 76
135 = M 1.2 EF LB 2 64 77
137 U E 0.3 LB 3 6 22 47 66 79 90 97 105 124
138 = M 1.3 EF LB 3 67 80 106
140 U L 2.4 tmp all LBs active =7 36 51
141 = M 0.3 EF previously all LBs active 52
Die verwendeten Variablen (alle BOOL):
Code:
E 0.0 LB 0 3 13 44 57 70 89 95 103 122 128
E 0.1 LB 1 4 9 14 17 60 73 131
E 0.2 LB 2 5 10 18 21 63 76 134
E 0.3 LB 3 6 22 47 66 79 90 97 105 124 137
A 0.0 activate muting =114
A 0.1 correct order for IN [B](optional)[/B] =117
A 0.2 correct order for OUT [B](optional)[/B] =120
A 0.3 fault LB without direction [B](opt.)[/B] =126
M 0.0 dir IN (0 -> 3) R92 R109 S100 39 43 111 116
M 0.1 dir OUT (3 -> 0) R93 R101 S108 40 46 112 119
M 0.2 decreasing =55 53 83 86
M 0.3 EF previously all LBs active =141 52
M 1.0 EF LB 0 =129 58 71 98
M 1.1 EF LB 1 =132 61 74
M 1.2 EF LB 2 =135 64 77
M 1.3 EF LB 3 =138 67 80 106
L 2.0 tmp E 0.0<>E 0.1 =15 25 29 33
L 2.1 tmp E 0.1<>E 0.2 =19 26 30 34
L 2.2 tmp E 0.2<>E 0.3 =23 27 31 35
L 2.4 tmp all LBs active =7 36 51 140
L 2.5 tmp LB1 or LB2 active =11 96 104 113 123
L 2.6 tmp neg edge =68 84
L 2.7 tmp pos edge =81 87
L 3.0 tmp direction defined =41 54 125
L 3.1 tmp decreasing given =48 50
L 3.2 tmp # of edges OK =37 91 99 107
Die Ausgänge A 0.1 .. A 0.3 sind optional (vermutlich nicht "lebenswichtig").
Mit L (z.B. L 3.0) sind temporäre Bits gemeint. (Einige der temporären Bits sind nur deshalb erforderlich, weil ich die Verwendung von Klammern gemieden habe)
Mit M (z.B. M 1.0) sind NICHT-temporäre Bits gemeint, deren Inhalte im nächsten PLC-Zyklus noch unverändert verfügbar sein müssen.
Gruss Heinileini
Nachschlag für LOGO!Fans
Anhang anzeigen ParMute4LB-FUP.lsc.pdf
Anhang anzeigen parMute-FUP.pdf