Here you will find GRAFCET examples that could be useful for your daily work. Step chains can be created very easily in GRAFCET. These examples also highlight other practical cases, such as manual operation. Here it becomes clear that GRAFCET can be used very well not only for the realization of step chains.
The figure shows three separate GRAFCETs, each of which produces a flashing light.
The flashing light here is switched on over input I1.
|1||An effective example of how to quickly program a flashing light in GRAFCET. The BlinkFlag symbol is assigned to the Data group in the table of symbols and serves as a buffer memory|
|2||The simplest way of creating a flashing light in GRAFCET.|
|3||A flashing clock pulse is used here, which is supplied by the PLC. This example only works if the PLC (the device) specifies a flashing clock pulse. The ClockFromPLC symbol is assigned the Data group in the table of symbols and must be described in the PLC.|
Operating states like manual, automatic or emergency stop are realised in the GRAFCET chart using what are referred to as overriding commands. To this end, GRAFCET charts are combined into groups (frameworks) and these can then be "activated" and "deactivated" using the overriding commands.
This example consists of 3 parts:
States in the main GRAFCET:
|State||What step is active?|
|Emergency stop||Step 1|
|Control Off||Step 2|
|Control On||Step 3|
The main GRAFCET has the task of switching between the operating states. If automatic mode is active, manual operation is deactivated via forcing and vice versa. Since the emergency stop switch can be pressed in any state, it (S3EmergencyStop) is represented in every alternative branch.
Automatic mode is a simple step chain with a loop back jump.
Manual operation is solved here by continuously active initial steps and an action on event. A step chain is not necessary here.
If you want to start two or more things simultaneously in a step sequence, you should use the parallel branch in the GRAFCET chart. Alternatively, you can also draw a separate GRAFCET with its own initial step. This variant would then be separate to a step sequence.
Two hydraulic cylinders are to be extended simultaneously. If both cylinders are fully extended, a pump should be switched on for 3 seconds and at the same time the cylinders should be retracted again. The speed of the two piston rods varies during retraction and extension. When both piston rods are retracted again, the system is ready for the next operation.
The retraction of the 2 cylinder rods takes different lengths of time. The extension of the piston rod must be switched off at the correct time (if extracted). Therefore, a parallel branch is used here. Synchronization is not necessary in this case.
Further explanations of the proposed solution:
Why are parallel sequences necessary here? Because the two cylinders retract at different speeds, and therefore the switch-off of the retraction must be controlled separately for each cylinder.
You can realize a counter with an addition in an action and you can realise a comparator within a transition in square brackets.
In the GRAFCET on the left, the value of the Counter symbol is incremented if step 2 is active and I0 is present as a rising edge. The value of the Counter symbol is reduced by 1 if step 2 is active and I1 is present as a rising edge.
After step 2, the transition condition consists of a comparison. If the value of the counter is larger than 5, step 3 is activated. Note: A comparison must always be set in square brackets.
In the right-hand GRAFCET, I2 and I3 are evaluated *at any time. If the rising edge is I2, an increment takes place, and if the rising edge is I3, a reduction takes place.
Two possible solutions for evaluating a selection switch are shown here. The figure on the left shows a step sequence with alternative branches and the figure on the right shows 3 separate initial steps, each of which has an action with an assignation condition.
The steps sequence would be used if the selection switch is used to activate a next step.
The individual selection switch positions (S1, S2, S3) are mutually locked. This may be dispensed with if the selector switch ensures that only one position is ever active at the same time.
The staircase light function shown here should function as follows: If button S1 or button S2 is pressed, then a light should be switched on. The light should then be switched off again after 30 seconds. This is what a possible solution in GRAFCET would look like:
If you would like to switch a second light separately, you simply need to draw the same GRAFCET with other symbols on the right adjacent to it.
Here is a simple example of how to map a impulse relay function. The rising edges for S1 and S2 are evaluated here:
The output can be switched on and off again by pressing S1 or S2. S1 and S2 are manipulated with buttons.
Another very simple solution (GRAFCET Studio 184.108.40.206.5 or newer required):
Manual mode does not usually consist of a step sequence. If manual mode is switched on, certain outputs should be switched when certain buttons are pressed. This can be implemented relatively easily in the GRAFCET.
The recipe for a manual mode: You use an action on event and connect it to an initial step. This means that the action is always executed when the condition for the event is true. Example:
In this example, there are three initial steps with one action on event each. The event definition always contains the manual operation (P2ManualOn) in an AND operation. This ensures that the action is only active in manual mode.
This example is also a proof that GRAFCET can be used very well not only for step sequences.
This example shows how to define constants and continuously normalize an analog value.
The initial step "8" (always active) is connected to actions (Stored action on activation) which are written once. Values are written to the symbols "K2","K1",... here. These symbols (constants) are used in the scaling at step "7". An action on event is connected to the initial step "7". Since a "1" has been entered in the condition of the event, the action is executed with each cycle. The term in the action is therefore processed again and again. The symbol "AnalogNormiert" is used to store the current standardised analog value.
Note to "1" as definition of an event: Normally the specification of "1" as event does not make sense. This has a special meaning in GRAFCET Studio. In this case, the action is executed in every Grafcet cycle.
In order to evaluate the time in the GRAFCET, the current time must be written to GRAFCET symbols in the PLC program. In GRAFCET-Studio, the following symbols (names are random) are created in the Data area:
It is important that the group "Data" is set up correctly and that the data types are created correctly (here UInt8 and UInt16).
Here's the GRAFCET to turn on a lamp at 10. Dec. 2018 8:10 p.m. and turn it off again at 10. Dec. 2018 8:15 p.m.:
In this GRAFCET the time is checked every 3 seconds to save cyclic time. If both actions were linked to an initial step, the time would be checked in each cycle, but this would unnecessarily stress the PLC-CPU.
In the PLC program, the current time must be written to the GRAFCET symbols. Use the provided function SetGrafcetSymbolUInt8 and SetGrafcetSymbolUInt16. These functions expect the Offset in the first parameter (see symbol table column DB address) and in the second parameter the value to be written.
To be able to use the clock memory byte of the PLC, it must first be switched on in the PLC via the hardware configuration. With the provided function SetGrafcetSymbolBool the desired bit can now be written into the GRAFCET symbol. Here's the symbol definition in GRAFCET Studio:
In the PLC program, use the function SetGrafcetSymbolBool:
CALL "SetGrafcetSymbolBool" Offset :=150 Bit:=0 Value :="PLC_TICK"
The offset 150 was taken from the symbol table (DB address column). To let a lamp flash when the I5 symbol is true, the following GRAFCET is required:
Two-hand triggering: An action should be performed when the operator presses two buttons simultaneously (within 200ms). This is to ensure that both hands of the operator are outside the danger zone. After some deliberation, the following solution has been found:
The condition "Condition1" is fulfilled if the operator presses the push-buttons S1 and S2 simultaneously (tolerance=200ms). This was realized by a source and final transition. Step "7" is active for 200ms when push-button S1 (Hi-Edge of S1) is pressed. Step "8" is active for 200ms when button S2 (Hi-Edge of S2) is pressed. If both steps "7" and "8" are active at the same time, then the two-hand triggering is fulfilled. X7 and X8 are contained in the "Codition1" as AND operation.