10Level 4
Sorting parts by size
Two sensors at different heights tell the large parts apart. A timer waits for the part to reach the piston, which pushes it aside. Small parts continue to the end of the belt.
The simulator is designed for computers (screens 1024 px or wider).
Virtual plant
Sorted right: 0. Sorted wrong: 0
Shown at rest. In the simulator the plant moves according to your program's outputs.
Inputs and outputs
| Address | Name | Description |
|---|---|---|
| I0.0 | START | Start push button (NO) |
| I0.1 | STOP | Stop push button (NC: 1 at rest) |
| I0.2 | LOW_SENSOR | Low sensor: detects every part (plant) |
| I0.3 | HIGH_SENSOR | High sensor: only large parts reach it (plant) |
| Q0.0 | BELT | Belt motor |
| Q0.1 | PISTON | Reject piston solenoid valve |
| M0.0 | LARGE_PART | A large part is on its way to the piston |
| T0 | T_TRAVEL | Time the part takes from the sensor to the piston |
| T1 | T_PUSH | Piston push duration |
Program
Ladder diagram (LD)
Rung 1 — Belt with seal-in.
Rung 2 — A part arrives: if the high sensor also sees it, it is large.
Rung 3 — Waits for the large part to reach the piston and clears the memory.
Rung 4 — Piston push: a half-second pulse.
Function block diagram (FBD)
Network 1 — Belt with seal-in.
Network 2 — A part arrives: if the high sensor also sees it, it is large.
Network 3 — Waits for the large part to reach the piston and clears the memory.
Network 4 — Piston push: a half-second pulse.
Structured text (ST)
(* Sorting parts by size — converted from Ladder *)
VAR
R_TRIG_1 : R_TRIG;
T_TRAVEL : TON;
T_PUSH : TP;
END_VAR
(* Rung 1: Belt with seal-in. *)
BELT := (START OR BELT) AND STOP;
(* Rung 2: A part arrives: if the high sensor also sees it, it is large. *)
R_TRIG_1(CLK := LOW_SENSOR);
IF R_TRIG_1.Q AND HIGH_SENSOR THEN LARGE_PART := TRUE; END_IF;
(* Rung 3: Waits for the large part to reach the piston and clears the memory. *)
T_TRAVEL(IN := LARGE_PART, PT := T#1s250ms);
IF T_TRAVEL.Q THEN LARGE_PART := FALSE; END_IF;
(* Rung 4: Piston push: a half-second pulse. *)
T_PUSH(IN := T_TRAVEL, PT := T#500ms);
PISTON := T_PUSH.Q;Instruction list (IL)
(* Sorting parts by size — converted from Ladder *) VAR R_TRIG_1 : R_TRIG; T_TRAVEL : TON; T_PUSH : TP; END_VAR (* Rung 1: Belt with seal-in. *) LD START OR BELT AND STOP ST BELT (* Rung 2: A part arrives: if the high sensor also sees it, it is large. *) CAL R_TRIG_1(CLK := LOW_SENSOR) LD R_TRIG_1.Q AND HIGH_SENSOR S LARGE_PART (* Rung 3: Waits for the large part to reach the piston and clears the memory. *) CAL T_TRAVEL(IN := LARGE_PART, PT := T#1s250ms) LD T_TRAVEL.Q R LARGE_PART (* Rung 4: Piston push: a half-second pulse. *) CAL T_PUSH(IN := T_TRAVEL, PT := T#500ms) LD T_PUSH.Q ST PISTON
Step by step
- 1Press ▶ Run (F5) and press START. Small parts only trigger LOW_SENSOR; large ones trigger both sensors at once.
- 2Rung 2: on the rising edge of LOW_SENSOR, if HIGH_SENSOR is also on, LARGE_PART is stored with a Set coil.
- 3Rung 3: T_TRAVEL measures 1.25 s, the time the part takes to reach the piston, and then clears the memory. Rung 4: the T_PUSH pulse drives the piston for half a second.
- 4The plant counts parts sorted right and wrong. If you stop the belt with a large part on its way, the time keeps running and the piston misses: in industry an encoder or a sensor in front of the piston is used so the sorting does not depend on time.