Learning phase 8: Alternative Branches¶
Learning Aim¶
If several transitions are to follow a step, then an alternative branch is used. As the name implies, alternative sequences can be realised with this. Only one process is ever performed, however. For this reason, the transition conditions for the transitions that branch into the individual sequences need to be mutually exclusive. The individual sequences of an alternative branch are also called partial sequences. This learning phase explains how an alternative branch works and what preconditions need to be in place.
Learning steps:
- Introduction to the alternative branch
- Application of the alternative branch
- Designation and application of linked labels, backward sequences, backward sequence skips and loop formations.
Things you should know¶
represents an alternative branch. Two parallel arranged transitions occur after initial step 1. The transition conditions are mutually exclusive: This means that only one transition condition can be fulfilled and activate the respective following step (2 or 3).
Fig. 3.124 Alternative branch
If the partial sequence is processed with step 2, the activation of step 4 is performed by the transition with the condition 2s/X2. When processing the partial sequence with step 3 step 4 in contrast, is made active by the transition with the condition 3s/X3.
With an alternative branch, the programmer must define each of the following transition conditions so that only one condition can be fulfilled. The transition conditions therefore must be mutually exclusive. If this is not the case, then the behaviour remains undefined, i.e. no prediction can be made as to which partial sequence will be performed. In Grafcet-Studio, the partial sequence whose transition first initiates the transition would be performed.
In the figure on the left below, the step enabling condition has also activated step 3. The transition to step 4 takes place once the time 3s/X3 has expired. The transition condition is fulfilled in the figure on the right, and the transition from step 1 to step 2 takes place.
Fig. 3.125 The partial sequence with step 3 is being processed. | Fig. 3.126 The partial sequence with step 2 is being processed. |
---|---|
As a rule, an alternative branch begins and ends with a transition. An alternative branch can also consist of only a single transition however, such as to skip other partial sequences.
An example of this is depicted in the adjacent figure.
Here, the third partial sequence consists of a transition alone. If its transition condition is fulfilled, the direct transition from step 1 to step 4 takes place.
Use¶
PLC-Lab | Filename | Grafcet-Studio | Filename |
---|---|---|---|
Schranke.plclab | Schranke.grafcet |
Typical applications for an alternative branch include the left/right run on an engine or the opening of a gate.
The gate in the figure on the right should be operated using a button S1. If the gate is closed (S2 = True), then actuating S1 opens the gate. If the gate is open (S3 = True), then it is closed by actuating S1.
Fig. 3.127 Diagram of the technology for a gate
Definition of the operands:
Symbol | Description |
---|---|
S1GateOpen | "Operate Gate" switch, value = True if pressed |
S2GateIsOpen | "Gate is open" sensor, value = True if pressed |
S3GateIsClosed | "Gate is closed" sensor, value = True if pressed |
M1OpenGate | Motor for opening the gate |
M1CloseGate | Motor for closing the gate |
Fig. 3.128 Solution to the application for a gate
Testing the application¶
The gate is closed so that when the button S1 is pressed, the transition with the condition S1GateOpen*S3GateIsClosed initiates the transition to the step 2 ().
Fig. 3.129 Testing the alternative branch, based on the example of a closed gate
Fig. 3.130 Testing the alternative branch, based on the example of an opened gate
The gate is opened in . On actuation of S1 therefore, the transition condition S1GateOpen*S2GateIsOpen is fulfilled and the transition to step 3 takes place. This remain active until the gate is closed.
Backward sequences, linked labels, backward sequence skips and loops in GRAFCET¶
At this point, we will show how to insert a backward sequence, use a linked label and implement a backward sequence skip to form a loop in GRAFCET.
In the following figure, you can see a backward sequence such as has already been used in many examples in this workbook to achieve cyclical processing in the GRAFCET.
In the figure on the right, the entire GRAFCET is repeatedly performed, looping from step 1 to step 3. This type of loop structure has already been used several times.
You can also implement what is referred to as a backward sequence skip, however, which does not pass over all the steps of a GRAFCET structure. The following figure shows an example of this.
Fig. 3.131 Backward sequence to initial step
Fig. 3.132 Backward sequence skip for loop formation
In the right-hand partial sequence of the alternative branch, a linked label is realised with an arrow symbol. In Grafcet-Studio the arrow symbol is principally used for such a linked label. The linked step for the 'skip' can be specified on the arrow here. In the example, this step is 2a.
As long as the condition is fulfilled, the transition from step 2b to step 2a will be performed. If a different transition condition is fulfilled for the transitions within the partial sequences of the alternative branch, then either the loop is terminated or no entry into the loop takes place at all. If application of the linked label forms a loop, as in the example above, then we can also refer to it as a backward sequence skip. This term then illustrates the effect of the linked label more clearly.
Strictly speaking, the arrow symbol (or the linked label) is a replacement for a directed link to the specified step. In the example, this would be a directed link, which begins behind the transition with the condition and ends at the top of the linked step 2a. Since directed links of this kind complicate the GRAFCET in most cases, the linked label is used, which is represented by an arrow symbol in GRAFCET Studio.
The linked label is also used when, for example, the GRAFCET extends over several pages and links from one end of the GRAFCET chart to the other are required.
The loop structure shown in the figure above is often used in conjunction with alternative branches. The second training session in this section also uses a backward sequence skip in the solution.
Summary¶
- If at least one step is included in the partial sequence for an alternative branch, then the partial sequence begins and ends with a transition.
- The partial sequence of an alternative branch can also consist of just one transition. This is used when other partial sequences of the alternative branch are to be skipped.
- For the sake of clarity, in the case of a large number of steps within a partial sequence, you should use an enclosing step or macro step.
Training 1¶
PLC-Lab | Filename | Grafcet-Studio | Filename |
---|---|---|---|
SchrankeMitLampe.plclab | SchrankeMitLampe.grafcet |
The gate you are already familiar with from the last example has blinking lamp H1 added to it. Lamp H1 is to blink with a pulse/pause time of 500ms as soon as the gate is being closed. An alternative branch is to be used in this solution as well. An enclosing step in the partial sequence for closing the gate is to be used for realising the blinking lamp H1.
Fig. 3.133 Diagram of the technology for the gate and lamp
Definition of the operands:
Symbol | Description |
---|---|
S1OpenTheGate | "Operate Gate" switch, value = True if pressed |
S2GateIsOpen | "Gate is open" sensor, value = True if pressed |
S3GateIsClosed | "Gate is closed" sensor, value = True if pressed |
M1OpenGate | Motor for opening the gate |
M1CloseGate | Motor for closing the gate |
P1 | Lamp H1 should blink while the gate is being closed |
Solution¶
You can see the modified partial sequence for closing the gate in the adjacent figure. Enclosing step 3 is now used here. The blinking of H1 is realised by the enclosed steps 30 and 31. On closing the gate, the enclosure is processed until the condition for the transition following step 3 is fulfilled. This is the case as soon as the gate has reached the bottom end position and S3 returns the value True.
Fig. 3.134 Alternative branch, based on the example of a gate, with the use of an enclosing step in the partial sequence
Training 2¶
PLC-Lab | Filename | Grafcet-Studio | Filename |
---|---|---|---|
ReinigungsmittelTest.plclab | ReinigungsmittelTest.grafcet |
A device is used for testing cleaning agents. The respective cleaning agent is sprinkled onto a glass plate. A cylinder with a sponge performs wiping movements on the glass plate. The number of wiping cycles can be set here, within the range of 1–10. The Start button S1 starts the process. After the set cycles have been run through, lamp H1 lights up. The operation can be completed by actuating the Confirm button S2. A re-start can be initiated after this.
Fig. 3.135 Diagram of the technology for the testing of cleaning agents
Definition of the operands:
Symbol | Description |
---|---|
S1Start | "Start" button, value = True if pressed |
S2Confirm | "Confirm" button, value = True if pressed |
S3A1Retracted | "S3 retracted" sensor, value = True if pressed |
S4A1Extended | "S4 extended" sensor, value = True if pressed |
TargetCountCycle | Default value of the slider for the number of cycles to be processed; integral value ranging from 1 to 10. |
A1ExtendRetract | Move actuator A1 forwards and backwards, True = forward movement |
P1ProcessCompleted | "Process completed" lamp |
P1 | Lamp H1 should blink when the gate is closing |
CompletedCycles | Integral operand for capturing already completed cycles |
Solution¶
Fig. 3.136 Alternative branch with a backward sequence skip
The solution for the system shows . A backward sequence skip was used here in the right-hand partial sequence of the alternative branch. To this end, an arrow symbol is placed in Grafcet-Studio and the label for the step which is the destination of the link label, is given. Step 2 is the destination in the example. This means: If the transition condition [CompletedCycles<TargetCountCycle] is fulfilled, then the transition to step 2 takes place. Therefore, one could say that there is a directed link leading from the transition with the condition [CompletedCycles<TargetCountCycle] to the top section of step 2.
As long as the transition condition [CompletedCycles<TargetCountCycle] is fulfilled, a loop from step 2 to step 4 and back takes place. Execution of the loop is aborted by the transition with the condition [CompletedCycles>=TargetCountCycle].
If this condition is fulfilled, then the transition to step 5 takes place.
Review Questions¶
- Which GRAFCET element does the multi-step partial sequence of an alternative branch begin and end with?
- An alternative branch consists of three partial sequences. What needs to be taken into consideration when defining the transition conditions for each of the first transitions in the partial sequences?
- What options do you have for designing a complex partial sequence more clearly?