Your first sequence
Turn a machine description into a step table, then into a sequence with timeouts and alarm steps, and build it in the Logivyx Sequence Designer on your trainer. This completes the free Basic levels of the course.
By the end of this module you can
- Write a step table from a description of a machine
- Add a timeout and an alarm step to every step that waits for a sensor
- Make sure every output that is switched on is switched off again on every path
- Build, generate, run and monitor a sequence in the Logivyx Sequence Designer
- Recognise the CASE-based Structured Text a sequence turns into
The drilling station from module 13, now with fault handling. Before drawing anything, write a table: one row per step, what it does, what it waits for, and what happens if it waits too long.
| Step | Name | On entry (ON ACTIVATE) | Next when (T1) | Timeout |
|---|---|---|---|---|
| 0 | Idle | – | Start condition: START and part present → 10 | – |
| 10 | Clamp | Clamp := 1 | Clamp closed → 20 | 3 s → 11 |
| 11 | Alarm: clamp | Alarm := 1 | RESET → 40 | – |
| 20 | Drill | Spindle := 1, Drill_Down := 1 | Drill at bottom → 30 | 4 s → 21 |
| 21 | Alarm: drill | Drill_Down := 0, Alarm := 1 | RESET → 30 | – |
| 30 | Retract | Drill_Down := 0 | Drill at top → 40 | – |
| 40 | Unclamp | Spindle := 0, Clamp := 0, Alarm := 0; stay at least 1 s | Clamp open → 0 | – |
- Number steps in tens and alarm steps as step + 1. Maintenance sees "step 21" and knows: stuck while drilling.
- Every step that waits for a sensor gets a timeout. A broken sensor then gives a clear alarm instead of a silent, frozen machine.
- Every output switched on is switched off on every path, including the alarm paths. Follow each output through the table to check.
- Alarm steps lead to a safe recovery step (retract, unclamp), not straight back to Idle with tools in the part.
The chart below follows the Logivyx Sequence Designer's behaviour: actions run once on entry (ON ACTIVATE) and stay set until another step changes them, T1 is checked after the step's minimum time, and a timeout jumps to the alarm step. Seq_Step shows the active step number, like the tag the Sequence Designer creates.
Behind the graphics, a sequence is the CASE-on-step-number pattern from module 11. The Logivyx Sequence Designer generates code shaped like this (simplified), with one timer shared by all steps:
CASE Step OF
0: IF Start_PB AND Part_Present THEN Step := 10; END_IF; // Idle
10: IF Step <> LastStep THEN // ON ACTIVATE
Clamp := TRUE; LastStep := Step;
T(IN := FALSE, PT := T#3s);
END_IF;
T(IN := TRUE, PT := T#3s);
IF Clamped THEN Step := 20; // T1
ELSIF T.Q THEN Step := 11; // TimeOut
END_IF;
11: …
END_CASE;
In the Logic Editor the generated routine appears like any other; open it to read the real code. Click Generate ST… again after every change in the Sequence Designer, and call the routine from Main.
In GRAPH, put the timeout in each step's supervision (e.g. "Step10".T > T#3s). A supervision fault stops the sequence and flags an error for the HMI; acknowledging it lets the step continue. Recovery steps like 11 and 21 are modelled with alternative branches instead.
In an SFC routine, give each step a .PRE and set .LimitHigh for an alarm, or add a branch with transition Step10.T > 3000 to an alarm step. The step tag's .X is handy for the output logic and the HMI.
In a GX Works3 SFC block, add a second transition from the step to the alarm step with a timer condition (a timer started by the step's action), or monitor the step's active time from the main program.
Use PLC_Trainer. Inputs: PB1 START, PB4 RESET, SW1 part present, SW2 clamp closed, SW3 drill at bottom, SW4 drill at top. Outputs: Q1 clamp, Q2 drill down, Q3 spindle, Q6 alarm. Rename the widget captions.
Drill_Cycle
- Tools → Sequence Designer…, New Sequence, name
Drill_Cycle. Enter the Start conditionPB1 = 1 AND SW1 = 1. - + Add Step six times. In the properties panel give them the numbers and names 10 Clamp, 11 Alarm_Clamp, 20 Drill, 21 Alarm_Drill, 30 Retract, 40 Unclamp.
- Step 10: ON ACTIVATE row
Q1 = 1. T1: conditionSW2 = 1, Target Step 20. TimeOut (s) 3, TimeOut → Step 11. - Step 11: ON ACTIVATE
Q6 = 1. T1:PB4 = 1→ 40. Step 20: ON ACTIVATEQ3 = 1andQ2 = 1; T1SW3 = 1→ 30; TimeOut 4 → 21. - Step 21: ON ACTIVATE
Q2 = 0andQ6 = 1; T1PB4 = 1→ 30. Step 30: ON ACTIVATEQ2 = 0; T1SW4 = 1→ 40. - Step 40: Time (s) 1; ON ACTIVATE
Q3 = 0,Q1 = 0,Q6 = 0; T1SW2 = 0→ Target Step 0 (Idle; if a hint says there is no step 0, that is expected). - Use ⇢ Connect Transition or check that every arrow appears on the canvas. Click Generate ST… into a new routine
Drill_Cycle. In the Logic Editor, call it fromMaininstead of the earlier labs. Bind theN1numeric display to the new tagDrill_Cycle_Seq_Step. Save. - F5. Run a good cycle with the switches, then force each timeout and recover with RESET. Watch it in 🧮 Logic Diag → View Sequence.