Learning phase 7: Enclosing Steps

Learning Aim

Similar to a macro step, an enclosing step is also a stylistic device for structuring a GRAFCET.\ An enclosing step invokes a partial GRAFCET chart which is summarised in a group. This learning phase explains how an enclosing step invokes its own enclosed steps and when they are ended again.

Learning steps:

  • The enclosing step
  • The enclosures or enclosed steps
  • Each step with activation link within the enclosures
  • GRAFCET structuring with enclosing steps

Things you should know

The enclosed steps (or enclosure) are grouped together as a partial GRAFCET chart in a group, and denoted with the name of the enclosing step. This name is given in the top left-hand corner of the group border. You should enter a group label in the lower left-hand corner of the group border.

The enclosures of an enclosing step do not contain an initialisation step. This would only be possible with an enclosing initial step.

shows step 2 indicated by the symbol for an enclosing step. This symbol consists of a normal box containing another box which is rotated at an angle to the outer one. Two groups with enclosed steps are assigned to enclosing step 2.

These two partial GRAFCET charts are labelled with G1 and G2. The label is located at the bottom left-hand corner of the group border and is not relevant for the call. The label for the enclosing step to which the enclosed steps for the partial GRAFCET chart are assigned is located on the group border top left. In the example, "2" is indicated there, since the partial GRAFCET charts belong to the enclosing step with the step label 2.

Fig. 3.115 Enclosing step 2 and its enclosures

Several enclosures can be activated simultaneously by an enclosing step. They therefore run in parallel until the enclosing step is deactivated.

Each enclosure contains one (1) step marked with the "*" character to the left of the step symbol. This symbol indicates the start step for the enclosed steps, i.e., the step which is activated as soon as the enclosing step itself becomes active. This is frequently referred to as an activation link in this case. This means that the enclosed steps with this symbol have an activation link to the enclosing step. If the enclosing step is activated, then the activation is transferred to the linked steps.

In the example, step 100 and step 200 are tagged with this symbol in the partial GRAFCET chart G1 and the partial GRAFCET chart G2 respectively. The step labels within the enclosure can be arbitrary so long as they are not selected twice.

represents the point in time at which initial step 1 is active. The enclosing step 2 is idle. This also makes the enclosed steps of the two groups G1 and G2 idle.

Fig. 3.116 The enclosing step is not yet active.

Fig. 3.117 Enclosing step 2 is active and therefore also the steps with an activation link from the partial GRAFCET charts G1 and G2.

In the transition to the enclosing step 2 has been performed. The activation of enclosing step 2 causes each step with an activation link to become active in the enclosed steps of the partial GRAFCET charts G1 and G2. The steps involved here are steps 100 and 200.

The figure also clearly shows that both partial GRAFCET charts G1 and G2 are processed in parallel. The cyclical sequence for both enclosures is processed here as long as enclosing step 2 is active.

If the enclosing step is deactivated, all the steps in the enclosed groups (or enclosures) are also deactivated.

Fig. 3.118 Offset sequence on changing the step with activation link

In , the activation link within the group G2 is set to step 201 (asterisk).

This change causes step 201 to be activated on activation of enclosing step 2 within the partial GRAFCET chart G2. The partial GRAFCET chart in G2 therefore starts with step 201. This has no effect on enclosure G1. Step 100 continues to have the activation link to enclosing step 2 here.

The two cyclical partial GRAFCET charts G1 and G2 now no longer run synchronously.

This example also shows that the 'topmost' step in an enclosure does not necessarily have to possess the activation link. A step that is lower down in the hierarchy can also have the activation link.


PLC-Lab Filename Grafcet-Studio Filename
MuldenBeladen.plclab MuldenBeladen2.grafcet

The tilting container from Learning Phase 6 is used again for the application of what has been learned. This time, the solution is to be developed with the aid of an enclosing step. The step sequence from the solution with the macro step is retained here regarding functionality.

Fig. 3.119 Diagram of the technology for the tilting container with weigh station

Definition of the operands:

Symbol Description
S1Start "Start" button, value = True if pressed
S2ContainerInPosition "Container in position" sensor, value = True if pressed
S3TiltContainerFull "Tilting container is filled" sensor, value = False when filled
S4TiltContainerLoadingPos "Tilting container is in loading position" sensor, value = True if pressed
S5TiltContainerTilted "Tilting container is in tilted position" sensor, value = True if pressed
M1Belt Belt motor
M2Mill Mill motor
M3Tilt Motor for tilting the container
M4TiltBack Motor for moving the tilting container into the loading position

The figure below shows the main GRAFCET chart on the left-hand side. You can see here that step 4 is the enclosing step.

When developing the solution, you should remain aware that the enclosed steps are disabled as soon as the enclosing step is no longer activated. In contrast, in the macro step there was a guarantee that the steps in the expansion were processed completely.

In the example, this action by the enclosing step could result in the milling operation being terminated immediately if the transition condition after the enclosing step is fulfilled. To prevent this, the transition condition for the transition was extended after enclosing step 4.

Here, the step variable from step 104 is incorporated into the transition condition by an AND operation. Step 104 is the last step in the enclosure. This ensures that the steps in the enclosure have been processed completely, because only when step 104 is active, does its step variable also have the status True. In principle, this imitates the action of the macro step.

Fig. 3.120 Solution to the application with an enclosing step

Fig. 3.120 shows the solution with enclosing step 4 and the enclosure in group G1. Step 100 is assigned the activation link which means it starts the enclosure. Step 100 switches on the belt allowing the container to be moved to the position S2ContainerInPos. The following steps are identical to the solution in the "Macro Step" section. Only the step labels are different, because an enclosure does not contain an input or output step.

Testing the application

Fig. 3.121 Test for the application with enclosing step 4

In Fig. 3.121, step 100 is active and starts the belt. In this situation, if the transition condition for the transition following enclosing step 4 did not have the step variable for step 104 added to it, then the transition to step 105 would take place immediately. This would mean that enclosing step 4 is no longer active along with all the steps in the enclosure in partial GRAFCET chart G1.


  • The enclosing step is represented by a normal box with a rotated box inside it. The step label is stated in this symbol.
  • The step label for the enclosing step is entered in the top left-hand corner in all partial GRAFCET charts. This therefore concerns an enclosure to which this special enclosing step is assigned.
  • Each enclosure must have a step with activation link. This is indicated by the "*" to the left of the box for the step. The enclosed step with activation link becomes active as soon as the enclosing step becomes active.
  • An enclosure, in turn, can also contain enclosing steps.
  • An enclosure can only be assigned to a single enclosing step.
  • If the enclosing step is deactivated, all active steps in its enclosures are also deactivated.
  • The enclosing step serves to improve the structuring of a GRAFCET chart.


PLC-Lab Filename Grafcet-Studio Filename
MuldenBeladenUeberBaender.plclab MuldenBeladenUeberBaender.grafcet

A GRAFCET chart is to be developed, which transports a container to position S2 when started. Belt motors M2 and M3 are then switched on and the container filled. Sensor S3 should then register the items with which the container has already been filled. If at least 10 items have fallen into the container, both feeding belts stop and the container is carried away. The counter required for this purpose is to be realised by an enclosing step and a storing action on activation. The number of items are stored here in the integral operand CountItemsInContainer.

Fig. 3.122 Diagram of the technology for controlling the belt

Definition of the operands:

Symbol Description
S1Start "Start" button, value = True if pressed
S2ContainerInPosition "Container at loading position" sensor, value = True if pressed
S3LightBarrier "Light barrier for falling items" sensor, value = True if interrupted by item
M1BeltContainer Belt motor for belt which transports the container
M2BeltLeft Belt motor for items to be loaded, top left
M3BeltRight Belt motor for items to be loaded, top right
CountItemsInContainer Counter for the items already loaded into the container, integral internal value


Fig. 3.123 Solution for the task "load container using belts"

You can see the solution to the task in . The enclosure for enclosing step 5 evaluates the positive edge at S3LightBarrier and activates step 7. A storing action on activation is attached to step 7, which increases the value in the integral operand CountItemsInContainer by one. When the contents of CountItemsInContainer has reached 10, the transition from step 5 to step 8 is performed. This results in step 5 and all the steps in its enclosure being deactivated. Activation of step 8 causes the container to be transported away from the loading position and the value in CountItemsInContainer to be set to '0'.

Review Questions

  • When is the activation link for an enclosed step initiated?
  • How is the step with activation link indicated?
  • What is the difference between a macro step and an enclosing step with regard to the complete performance of the steps in the expansion or enclosures?
  • Can several enclosed steps be active simultaneously within different enclosures?
  • Is the value of the assignation for an active storing action on activation within an enclosure retained if the enclosing step is deactivated?