From GRAFCET to SCR steps on the S7-200
Sequential control relays LSCR, SCRT and SCRE; the S bits as GRAFCET steps; initial step with SM0.1; outputs and timers written from the step bits; choices, parallel branches, and stop and fault handling outside the steps.
35 min
On this page
The S7-200 has an instruction set made for GRAFCET: sequence control relays (SCR). The booklet asks you to program every GRAFCET this way, "one relay per step, not as a web of interlocking memory bits" (manual Exercise 5-2).
The instructions
| STL | LAD | Meaning |
|---|---|---|
LSCR S0.1 | SCR box | start of the segment of step S0.1: what follows runs only while S0.1 is 1 |
SCRT S0.2 | (SCRT) coil | transition: set S0.2 and reset the current step's bit |
SCRE | (SCRE) coil | end of the segment |
Each GRAFCET step n gets an S bit: step 0 is S0.0, step 1 S0.1… step 8 S1.0. A transition is a network inside the segment of its preceding step: the receptivity as contacts, then SCRT to the next step.
The translation, network by network
Network 1 // initial step on the first scan
LD SM0.1
S S0.0, 1
Network 2 // step 0
LSCR S0.0
LD START // receptivity 0 → 1
A TOP
SCRT S0.1
SCRE
Network 3 // step 1 …
LSCR S0.1
LD BOTTOM
SCRT S0.2
SCRE
The GRAFCET player generates this program from the chart: open Generated SCR program on the chart below and run it. The column on the left shows, for each instruction, the value on top of the logic stack in the current scan.
No errors: the program compiles.
Where to write the actions
You can write LD SM0.0 / = DOWN inside the segment of a step. It works for an output used in one step. But an output used in several steps (the mixer runs in steps 3 and 4) would get one = in each segment: a double coil, and the last segment in the program wins. The robust rule, used by the generator:
- inside the segments: only the transitions and stored actions (
S,R); - after the segments: one network per output,
LD S0.3/O S0.4/= MIXER; - timers of timed receptivities after the segments too, enabled by their step bit:
LD S0.3/TON T37, +50. The timer resets when the step is left, so the next visit starts from 0.
Stops and faults: outside the steps
An emergency stop or a fault must act whatever the active step. Write it after the segments:
LDN ESTOP_NC // stop pressed or wire broken
R S0.1, 7 // reset steps 1 to 7
S S0.0, 1 // back to the initial step (or a fault step)
Outputs driven from the step bits drop at once, because no step is active any more. Every TP from TP 3 on needs this structure.
Choices and parallel branches
- Choice: two
SCRTin the same segment, each after its own receptivity. Make them exclusive. - Parallel branches: one transition network with two
SCRT(both following steps set, the current reset). - AND convergence:
SCRTcannot wait for two steps. Write it after the segments:LD S0.3 / A S0.6 / A cond / S S0.7, 1 / R S0.3, 1 / R S0.6, 1.
ExplorerGo deeper: derivations and open questions
One scan per transition? When SCRT S0.2 fires in the segment of S0.1, S0.2 is set at once. If the segment of S0.2 comes later in the program, it runs in the same scan and may fire its own transition immediately. A GRAFCET that must spend at least one scan in each step (to see an edge, for example) should keep the segments in step order and use edge receptivities with care.