Learning phase 1 - Steps and transitions¶
In the following, we present 10 learning phases for self-study. We recommend that you work through the learning phases in the order given in this workbook. The exercises at the end of the workbook need you to have understood all the previous learning phases properly.
Learning phase 1: Steps and transitions¶
The aim of this learning phase is to determine the relationship between a step and a transition. This learning phase will also introduce you to transition conditions and continuing actions.
- Interrelationship between step and transition
- Initial step
- Continuing action
- Transition condition
Things you should know¶
The structure of a GRAFCET consists of at least one step and the step enabling condition, or what is known as the transition (). Steps and transitions are connected by directed links, which are also called operative connections. The step label in the step symbol is also the name of the Boolean-*type step variable and has the values True = active or False = idle. The step variable here consists of the prefix X and the label for the step, such as X1. The transition has a transition condition, which is also called a matching condition. If the transition condition has the value False, then no further step will take place and the superordinate step remains active. If the result of the transition condition switches to the value True, then the transition to the subsequent step is carried out. This results in the previous step becoming idle and the subsequent step becoming active. In this example, the transition from the initial step 1 to step 2 occurs if the operand is S1Start = True and the initial step 1* was previously active.
Fig. 3.62 The interrelationship between step and transition
A GRAFCET always contains at least one initial step, which is also referred to as starting step. This initial step is activated as soon as the GRAFCET is started. This makes the step part of what is referred to as the initial situation.
A GRAFCET always has at least one initial step. If the initial step is active, all further steps in the linear structure that follow are idle!
If a GRAFCET structure ends with a step, it is referred to as the pit step. If a GRAFCET structure ends with a transition, it is referred to as the pit transition.
Step label and step variable:
The step label in the step symbol (inside the box) is also the name of the step variable. Access to the step variable takes place with the prefix X. This, for instance, is how access to the step variables for steps 1, 2 and 3 takes place via the step variables with the label X1, X2 and X3. Fig. 3.63 labels the second step with the step label 2a; this means that the step variable has the label X2a.
The step label always begins with a number.
The result of the transition condition for a transition determines the transition as soon as the transition is released. If a transition is released and the transition condition returns the value True, then the transition to the subsequent step takes place, otherwise not.
For example, in the initial step 1 remains active so long as the transition condition 1s/X1 returns the result True. If the initial step 1 is active, then the transition that follows it is released. This is the first pre-condition for a transition. Once the transition is released, only the result True for the transition condition is still required as the second pre-condition.\ If step 2a is activated, the subsequent transition is released as well. As soon as the result of the transition condition 1s/X2a changes to True, step 2a becomes idle and the initial step 1 is activated over the directed link. The step variables for the two steps 1 and 2a come into use within the transition conditions. As mentioned above, X is added to the step label as a prefix. A time callout delays the transition condition 1s/X1. This returns the value True when step 1 is active for at least one second. We discuss transition conditions with step variables and time conditions separately later on in this workbook.
Fig. 3.63 Two-step GRAFCET
You enter a logical expression under the transition condition, which returns True or False as the result.
In principle, a transition condition can contain an infinite number of logical operators and operands. For example, the term after step 2 in consists of three operands, which are linked with a logical AND (*).
The following operators can be used in a term:
|*||AND operation||S1*S2: Condition is true if S1 = 1 and S2 = 1|
|+||OR operation||S1+S2: Condition is true if S1 = 1 or S2 = 1|
|!||Negation||S1*!S2: Condition is true if S1 = 1 and S2 = 0|
|↑||Rising edge||S1*↑S2: Condition is true if S1 = 1 and there is a rising edge for S2. Note: To enter an arrow with Grafcet-Studio, press Ctrl and [↑] simultaneously in the editor box.|
|↓||Falling edge||S1*↓S2: Condition is true if S1 = 1 and there is a falling edge for S2.|
Furthermore, a time dependency can be created in a term. The table below assumes that the transition is released. This means that all steps immediately preceding the transition are active.
Examples of time callouts:
|4m1s200ms||4 minutes, 1 second and 200 milliseconds|
|1d3h1m20s100ms||1 day, 3 hours, 1 minute, 20 seconds and 100 milliseconds|
General structure of a transition condition with time response:
T1/…/T2 , with T1= ON delay, T2= OFF delay.
|ON and OFF delay||T1/…/T2|
The term for the transition condition is always evaluated separately from the step. The condition only depends on a step if step variables (e.g. X1) are used in the condition. This means that timers can already expire without the transition being released.
Each step can be assigned one or more actions. Each transition is defined by a transition condition with at least one Boolean expression. represents a GRAFCET in Watch mode. The currently active step is flagged in red and marked by a gear symbol. In the example, this is step 2. The gear symbol is a symbol specific to Grafcet-Studio that additionally marks the currently active step. The active step 2 also activates the continuing action attached to the step. This causes the operand H1 to be set to the Boolean value True.
Fig. 3.64 GRAFCET in Watch mode
Actions can be assigned to a step and a transition condition belongs to each transition. The actions and transition conditions form the interpretation of the GRAFCET.
Fig. 3.65 Step 2 has a total of three continuing actions.
In the picture you see a GRAFCET with three continuing actions at step 2 (H1, H2, and H3). The number of actions per step is unlimited. The finite size of the drawing area represents a practical limitation here. You can also see a comment in the figure: It is framed by quotation marks and can be placed anywhere within the Grafcet-Studio.
If the action is shown as a box without further callouts, it represents a continuing action. The action writes the value True to the operand when the step is active and False when the step is idle. Therefore, the operand is always written separately to the step status! Special behaviour when multiple actions influence the same operand: If several continuing actions are influencing the operand, it has the value True if at least one of the steps associated with the respective action is active. Otherwise, the operand has the value False.
As soon as the transition condition for the transition following the step is met, the transition to the subsequent step takes place. This makes the previous step idle.
Comments in GRAFCET improve readability. This is especially important for large GRAFCET charts.
Comments are written in quotation marks.
Fig. 3.66 Section of a GRAFCET with a comment
The task in the following section is to develop a GRAFCET as an example of a simple system.
Practical example of a "fan system"¶
A blower is to be switched on with the "Fan On" button and switched off again with the "Fan Off" button.
|Fig. 3.67 Diagram of the technology for the fan control||Fig. 3.68 A GRAFCET for fan control|
The GRAFCET in the top right-hand figure shows the solution for controlling the fan. The transition condition S1FanOn has the value False as a result if the "Fan On" button is not pressed. The initial step 1 remains in this status active. When the button is pressed, the transition condition is met and the transition to step 2 takes place. At the same time, the initial step 1 becomes idle. The now active step 2 switches the fan M1 on using the continuing action.
The transition S2FanOff has the value True as a result as soon as the "Fan Off" button is pressed. In this case, step 2 becomes idle and therefore, so does the continuing action. The fan switches off and the initial step 1 is activated again via the backward sequence (directed link from the pit transition back to the initial step 1).
This exercise does not take into account that both buttons could be pressed simultaneously!
If a backward sequence takes place from the pit element to the initial step, the GRAFCET is referred to as a closed sequence.
Testing the application¶
If the GRAFCET has been drawn in Grafcet-Studio, PLC Lab has been started and the fan system has been loaded, the GRAFCET test can be started. To perform the test, you first need to switch PLC Lab to Run and then start the simulation in Grafcet-Studio by clicking on the Watch button.
Fig. 3.69 The GRAFCET in test mode with active step 1
The "Fan On" button has not yet been pressed, so the transition condition S1FanOn returns the value False and no transition to the next step takes place. The initial step 1 therefore remains active. The fan motor is off as step 2 is idle. If you press the "Fan On" button, the value for the transition condition S1FanOn changes to True and step 2 is activated in the GRAFCET.
Fig. 3.70 Transition from step 1 to step 2 by satisfying the transition condition S1FanOn
When step 2 is activated, the continuing action M1 is also set to True because the continuing action makes M1 always have the same status as step 2. Active step 2 remains active until the transition condition S2FanOff is fulfilled.
Fig. 3.71 Transition from step 2 to step 1 by satisfying the transition condition S2FanOff
The figure above shows the status in which the "Fan Off" button is pressed. This sets the transition condition S2FanOff to True and the initial step 1 is reactivated. Furthermore, the previous step 2 is also set back to idle and the continuing action M1 writes the value False in M1. The fan is switched off.
- Learning Phase 1 introduces and applies the terms step, transition and transition condition.
- If you want to use Boolean status of a step in a transition condition, you should use the step variable for the step. The step label is prefixed with X (e.g. X1, X2, Xa2) here.
- Each step can be assigned one or more actions. Learning Phase 1 introduced you to the continuing action and its application. This sets the operand to True when the step is active. Otherwise, the value False is written to the operands. If the operand is used in several continuing actions, then the value True is written as soon as at least one of the steps associated with the respective action is active. If this is not the case, the operand is given the value False.
- Each transition has a transition condition for the transition to the next step. If the transition is released and the transition condition is fulfilled, the following step is activated and the preceding step is set to idle. In Learning Phase 1, only individual operands have been specified as transition conditions. However, you can also define terms that define a link between operands. We will demonstrate this later on in the workbook.
- You can add comments to make the GRAFCET more easily readable. Placing the comments in quotation marks makes them comply with the applicable standards.
Training (switching a motor on/off)¶
A motor is to be switched on or off using buttons. The system has the following operands:
- S1MotorOn for "Motor On" button; this returns True when the button is pressed
- S2MotorOff for "Motor Off" button; this returns False when the button is pressed
- M1 for the motor
Fig. 3.72 Diagram of the technology for controlling the motor
You can view the solution in . The transition condition for the transition after step 2 consists of the negated status of the operand S2MotorOff (see Chapter 2.9 for how to enter the negation), since the button returns the value True in the idle state (without being pressed). When pressed, the operand has the value False, which should lead to step 2 being deactivated.
Fig. 3.73 GRAFCET solution for "Motor On/Off"
- For what purpose was GRAFCET originally designed?
- What are directed links?
- The step variable for the step labelled 3c should be used. What is the label for this step variable?
- Each transition has a Boolean transition condition. What happens to the preceding and subsequent step of a transition when the result of the transition condition is True and the transition is released?