First steps in Grafcet-Studio¶
This section introduces you to the Grafcet-Studio operating concept. Please take some time to familiarise yourself with it. A further bonus is that you will be able to create GRAFCET charts more quickly and with fewer errors.
This workbook uses GRAFCET terms with which you may not yet be familiar with. You can safely ignore this fact at the moment, because at this point you will only be dealing with how to draw a GRAFCET chart. The individual GRAFCET components are described in detail afterwards, and then it is important for you to be able to draw them.
To use Grafcet-Studio, you need a standard Windows computer with one of the following operating systems installed:
- Windows 7
- Windows 8.1
- Windows 10
The edition (Home, Pro...) and architecture (32 or 64-bit) do not play a role here.
Installation and activation¶
You can find the serial number for the software and all the instructions for installing and activating the software on the first page of this workbook.
If you have any problems with the software, simply send us an email at firstname.lastname@example.org
Use in the workbook¶
If you want to create a GRAFCET chart for a virtual system, you need to open the correct Grafcet-Studio template project. This is important, because the table of symbols needs to contain the correct symbols. Once you have installed Grafcet-Studio, you will find the template projects located in the "My Documents" folder in the "GRAFCET Workbook" folder. Whenever you are required to draw a GRAFCET chart for a virtual system, you will also be told which PLC Lab template you need to open.
Please note the following symbols:
The most important screen elements in Grafcet-Studio:
Fig. 2.2 The Grafcet-Studio screen layout
Fig. 2.2 The Grafcet-Studio screen layout
|Toolbar||The key quick access commands are located on the toolbar. You can access all the menu items by clicking on the icon on the left (arrow down).|
|Drawing area||The GRAFCET is drawn on the drawing area. A thumbnail view, within which you can navigate, is shown bottom right.|
|Overview||The GRAFCET is shown here as a thumbnail. This helps maintain an overview of more extensive projects.|
|Zoom||You can use the slider to zoom in and out. You can hide the slider by clicking on the "Zoom in/out" button (see toolbar).|
|GRAFCET pages||You can add and delete GRAFCET pages here. The Starter Edition included with the workbook only supports one GRAFCET page. This one-page limitation is irrelevant in this workbook, because you can fit all the examples and exercises onto a single GRAFCET page.|
|IO panel||Inputs and outputs are displayed in the IO panel. You can use the mouse to manipulate digital inputs. You can specify a decimal value in an input field for analogue inputs. You can monitor digital and analogue outputs here.|
|GRAFCET elements||You will find the GRAFCET elements on the left. You can add elements to the drawing from here. Tip: Usually, it is quicker to duplicate existing elements on the drawing (copy & paste).|
|Table of symbols||You can assign descriptive names to the inputs and outputs in the table of symbols. You use this option as much as possible to create as powerful a GRAFCET as possible. Only symbols (not addresses) can be entered in the drawing.|
|License manager||Clicking on this button calls up the 'License Manager'. This enables or disables the software on the PC. The demo version remains active if the software is disabled.|
Table of symbols¶
Descriptive terms are assigned to the operand addresses in the table of symbols. You then use these symbols in the GRAFCET. Normally, you do not need to change anything in this table, since a project template containing the appropriate symbols (or operands) is available for each virtual system.
Starting a new project¶
Click on "New" to create a new project:
Fig. 2.3 Creating a new project with the "New" button
Fig. 2.3 Creating a new project with the "New" button
This creates a new project with an almost empty drawing area and a standard table of symbols.
The drawing area contains an initial step. You can either use or delete it.
Tip: If you want to use the table of symbols from another project as a basis, save the current project under a new name and delete all the elements from the drawing area. Then select "More..." and then "Save As…". Select all the elements on the drawing area with Ctrl+A and then use the "Delete" key to delete them all.
Do not use this function for project templates for PLC Lab Runtime. Otherwise, the symbols required for the virtual systems will have their names changed to default names. Instead, delete all GRAFCET elements on the drawing area by pressing Ctrl+A (select all) and then the [Delete] key.
Inserting a GRAFCET element¶
Go to the GRAFCET Elements window (see figure above) to insert GRAFCET elements into the drawing area. You can now drag and drop elements from the panel into the canvas. Or you select the insertion position and insert the element at the selected position by a left mouse click. If you want to insert a transition, select a step in the bottom third of the step symbol and then click on this symbol:
The transition will then be inserted below the step:
|Fig. 2.4 Selecting the step at the bottom edge||Fig. 2.5 Inserting a transition with|
If you want to turn an initial step into a normal step, then select the step in the middle and click on this symbol:
|Fig. 2.6 Selecting the initial step in the middle||Fig. 2.7 The initial step has turned into a normal step.|
If you insert an element and a GRAFCET element is not selected in the drawing area, the new element is inserted in the drawing area aligned to the left.
Copy & Paste:
Tip: You can insert GRAFCET elements quicker if you copy parts of a GRAFCET that has already been created. You can also duplicate several linked GRAFCET elements.
Variant 1: Copy & Paste on the keyboard: Select the elements you want to copy with the mouse. Hold down the SHIFT key to select multiple elements simultaneously. Now press Ctrl+C for "Copy" and then Ctrl+V for "Paste". The selected elements have now been duplicated and you can move them with the mouse.
Variant 2: Duplication with the mouse. Select the elements you want to duplicate. Press and hold the Ctrl key down. Click and hold the left mouse button down. Now drag the mouse to the desired position. Doing so duplicates the selected elements and you can move them to the desired position immediately.
Deleting/Moving GRAFCET elements¶
You can delete GRAFCET elements on the screen by first selecting them and then deleting them with the "Delete" key. You can undo this by selecting "Undo" in the toolbar.
You can select several elements simultaneously with the mouse while pressing SHIFT and holding it down.
To move an item on the drawing surface, left-click on it with the mouse, hold the mouse button down and drag the element to the desired position.
See "Editing the GRAFCET" for additional editing functions.
Drawing a sequence with transitions¶
The step sequence consisting of steps and transitions shown in the figure on the left is to be drawn.
Insert a step and select it at the bottom edge:
then click on this symbol three times:
By doing so, you have already created a step sequence consisting of a total of four steps, as shown in the figure on the left. You can also create the same step chain by pressing the INSERT key on your keyboard. Make sure that the bottom third of the step or transition is selected before.
Entering GRAFCET terms¶
Terms (expressions) are required in the following GRAFCET elements:
- Transition condition: Here, you define the step enabling condition
- Action: Here, you define which commands are to be performed (interpretation)
- Action condition: An additional condition that must be fulfilled so that the action commands are performed.
Open the inline editor of the term by a double click or by pressing F2 or Return on your keyboard. In case of a action with condition: The Return key edits the action term and F2 edits the condition. Tipp: You can also select the grafcet item by pressing the cursor keys up, down, right and left.
You can use the following special characters for these terms:
|Special characters||Explanation||Input with|
|↑||Rising edge||Ctrl + ↑|
|↓||Falling edge||Ctrl + ↓|
|!||Negation||! (Displayed as a horizontal line above the variable.)|
A Boolean expression that includes a comparison must be placed in square brackets (fig. right):
|Fig.. 2.8 Terms in the GRAFCET chart||Fig. 2.9 A comparison must be placed in square brackets|
Grafcet-Studio has an integrated auto-complete to help you enter symbols faster and more conveniently. Type in the first letters, and then press Ctrl + Space simultaneously. A window (see the figure below) appears where you can select the symbol (arrow buttons) and insert it (Return key).
Fig. 2.10 Auto-complete
Fig. 2.10 Auto-complete
You can create a backward sequence with the help of directed links or the linked label (arrow, skip):
|Fig. 2.11 Backward sequence with directed link||Fig. 2.12 Backward sequence with link/skip|
|After the transition 1s/X3, the backward sequence to step 1 takes place with the help of directed links.||After the transition 1s/X6, the backward sequence takes place with a linked label: Arrow symbol and callout for the linked step number.|
Both variants are equivalent and can be drawn very quickly.
Backward sequence with directed links:
Drag & drop is used to draw the backward sequence: Left-click on the bottom edge of the transition 1s/X3 and, keeping the mouse button held down, drag upwards to the top edge of the linked step and then release the mouse.
Note 1: The movement of the mouse lets you influence whether the directed link is dragged upwards over the left or right-hand side (usually the left-hand side is better suited). You can also use the mouse to determine how much free space is left between the step sequence and backward sequence. Try it out; the "Undo" button (toolbar) means you can undo the backward sequence.
Note 2: The starting point can also be a step. In this case, however, a transition with the condition 1 is inserted, because the step and transition must always alternate.
Note 3: The backward sequence is only drawn if the start element (transition or step) and the linked step are vertical above one another (same X position).
If this is not the case, you should use the second variant:
Backward sequence with linked label (skip):
Select transition at the bottom edge.
Insert skip or linked label with . 0 is pre-populated. You need to change this figure.
Click on the 0 and wait a moment, then you can change the label for the linked step.
The figures below show how to arrange actions:
Fig. 2.13 An (1) action is linked to a step.
Fig. 2.14 Multiple actions are linked with a single step. Horizontal arrangement.
Fig. 2.15 Multiple actions are linked with a single step. Horizontal and vertical arrangement.
To place an action, select the step you want and then click on an "Action" button in the GRAFCET Elements window.
You can add multiple actions by clicking on the "Action" button several times in succession. Tipp: As alternative you can insert a continous action by pressing Ctrl+Ins (The step must be selected). The actions are then arranged in a horizontal series. If you prefer a mixed arrangement (horizontal and vertical), you can combine the actions with directed links (see figure on the right):
Fig. 2.16 Drawing directed links
Fig. 2.16 Drawing directed links
You can see two alternative branches below. This section shows you how to draw them.
|Fig. 2.17 Example 1||Fig. 2.18 Example 2|
How to draw Example 1 (figure on the left)
Insert the branch by drag & drop by left-clicking on the top edge of the first transition. Keeping the mouse button held down, drag the edge down, and release the button at the bottom edge of the second transition:
|Fig. 2.19 Drawing a branch.||Fig. 2.20 Branch has been inserted.|
How to draw Example 2
|Fig. 2.21 You insert the branch using drag & drop as in Example 1.||Fig. 2.22 The branch has been created.|
Next, insert the steps and the transition in the branch:
|Fig. 2.23 Select the directed link after the transition and delete it with the "Delete" key||Fig. 2.24 Extending the transition||Fig. 2.25 Selecting the bottom edge of the transition|
|Fig. 2.26 Click on the button in the GRAFCET Elements window. This inserts a step which is already selected at the bottom edge.||Fig. 2.27 Double-click on the symbol at the top. This inserts two steps with a transition.|
Step 8 is superfluous here. You should therefore delete it:
|Fig. 2.28 Select step 8 in the middle and remove it with the "Delete" key.||Fig. 2.29 You now need to shorten the transition.||Fig. 2.30 Finished|
Need more space for actions?
If you need more space for actions, simply drag the mouse to the right. This extends the branch further to the right.
|Fig. 2.31 Initial situation||Fig. 2.32 Enough space for actions|
Macro steps and enclosing steps¶
In this section, you can read how to draw a macro step and an enclosing step.
Fig. 2.33 Macro step and its expansion
The GRAFCET Elements window allows you to draw a macro step.
macro step requires what is referred to as an expansion (border), in which you draw the contents of the macro step. Note: The border is not needed in case of the macro step. It will also work without a border.
You can either draw the border first or at the end, it does not matter. What is important is that you give the border the same label as the macro step itself. In this case, it is the number 2.
Draw the initial situation and then insert a new step. You should then drag the new step to the right with the mouse:
|Fig. 2.34 Initial situation||Fig. 2.35 Nothing is selected.|
You should now insert a normal step with .
Fig. 2.36 Then drag the new step to the right with the mouse and select the bottom edge.
Now, double-click on the step-transition combination
The drawing should take the following form. You now need to change the step label for step 3 and step 4 in the following manner:
|Fig. 2.37 Step 3 and step 4 prior to the change||Fig. 2.38 After the change|
The top step needs to be labelled with E2 and the bottom step with S2.
Now you need to add the border. To do so, click on in the GRAFCET Elements window:
|Fig. 2.39 Clicking the "Border" button.||Fig. 2.40 The border is inserted.|
The border is already selected when you insert it. At this point, it is important to drag the border to the right position immediately with the mouse – the reason being that a property of the border is that internal elements always move with it. If required, you can disable this action by holding down the ALT key and clicking on the border. This action is not activated until the border is enlarged.
Fig. 2.41 You can resize the border by dragging the bottom right-hand corner. Fig. 2.42 The border label for the expansion must correspond to the step label for the macro step.
You can draw an enclosing step in the same way:
Fig. 2.43 Setting up an activation link
The enclosing step needs what is referred to as an activation link ("*"): Select step 3 and click on the button. The step is then flagged accordingly.
You should draw the following parallel sequence:
Fig. 2.44 Example of parallel branch
First, you need to draw the step sequence consisting of steps 1 to 5 (figure on the left). Create steps 6 and 7 by duplicating them with the mouse. To do to so, hold the Ctrl key down, click on step 2 and drag the mouse to the right. This creates a new step. Create step 7 in the same way. Shorten the directed link for the transition as shown in the figure on the right:
|Fig. 2.45 Step sequence with steps 1 to 5||Fig. 2.46 Transition has been shortened. Step 6 and step 7 have been added.|
You now need to create the synchronisation with the mouse. To do so, click on the top edge of step 7 and drag it to the left to step 6 (figure on the left) with the mouse button held down:
|Fig. 2.47 Connecting step 7 and step 6||Fig. 2.48 Lengthening the double line|
Now, extend the synchronisation to the left with the mouse. This completes the top section of the synchronisation:
Fig. 2.49 The top section is finished.
Transitions and additional steps now need to be attached to step 6 and step 7. Select the bottom edge of step 6 and double-click on the Transition + Step button:
Complete step 7 in the same way. The GRAFCET now takes the following form:
The bottom synchronisation is still missing, however: Click on the bottom edge of step 11 keeping the mouse button held down.
Drag themouse to the left and then release the mouse button again just above the bottom edge of step 9.
Fig. 2.50 Steps 11, 9 and 4 must still be connected.
You now need to insert the double directed link and simply extend it to the left.
You also need to move the connection for the transition below step 4 downwards:
Fig. 2.51 The double line is extended to the left.
The GRAFCET chart is now finished:
The top and bottom sections of the parallel sequence or synchronisation are different objects in Grafcet-Studio. It would be a mistake to duplicate the top section and use it at the bottom as well!
Fig. 2.52 The example has been fully drawn
Forced commands are drawn in the same way as actions:
Fig. 2.53 Example of forcing
Partial GRAFCET chart G1 is forced in the example above. You need to make sure that this partial GRAFCET chart really exists (label at the bottom of the border).
Editing the GRAFCET¶
You can move each GRAFCET element freely around the drawing area. To do so, left-click on the element and drag the element to the desired position keeping the mouse button held down. For steps and transitions, you need to click on the element in the middle to move them.
The following functions help you to draw GRAFCET charts quickly and conveniently:
Selecting multiple elements:
Variant 1: Press the SHIFT key, and keeping it held down, click on each element you want to select.
Variant 2: Drag the mouse to enlarge a border. This selects all the elements in the border.
Click on open space in the drawing area to remove all your selections.
Selecting the next element in the drawing area:
If you select an (1) element, you can press the cursor keys ←, ↑, →, ↓ to select the next element. You can, for example, also change a step number or the term for a transition by pressing the Return key or clicking and hovering over the number/term.
Increasing/Decreasing the size of elements in the drawing area:
Sometimes it can be helpful to reduce or enlarge the size of elements in the drawing area during editing. You can do this with the slide control in the status bar or by holding down the CTRL key and moving the wheel on the mouse.
Selecting all with Ctrl+A:
Press Ctrl+A on the keyboard. This selects all the elements (if the shortcut fails to work, click in the drawing area and try again).
Afterwards, you can for instance, move all the elements in the drawing area.
Copying and pasting on the keyboard:
Pressing Ctrl+C copies all the selected elements to the clipboard. You can then copy them by pressing Ctrl+V. After copying, all newly created elements are selected so that you can drag them to the desired position with the mouse.
Copying with the mouse:
Left-click on an element while holding down the Ctrl key. Then, move the elements to the desired position keeping the left mouse button held down. This process duplicates all the selected elements.
Tip: You can usually draw faster by simply copying new elements from the already existing GRAFCET, because the cursor paths are shorter. Why not give it a try?
Moving elements on the keyboard:
Press Ctrl and one of the cursor keys ←, ↑, →, ↓ at the same time to move all the selected elements by one grid segment.
Use Ctrl+[Z] or the corresponding icon in the toolbar to undo previous actions. This is very useful when you accidentally delete elements or when you have mistakenly drawn a backward sequence. In this case, the entire backward sequence will be deleted and you can draw it again.
Extending directed links:
If directed links overlap, it can sometimes be helpful to move a directed link into the foreground. To do so, right-click on the directed link and select "Move to top". Afterwards, you can change the length of the directed link.
|Fig. 2.54 Moving an element to the foreground||Fig. 2.55 Changing the length of a directed link|
Errors in the GRAFCET chart are marked by a red exclamation mark. The GRAFCET chart is verified when you click the "Watch" button or initiate verification in the context menu (right mouse button):
|Fig. 2.57 Right-click to access the context menu.||Fig. 2.56 "Watch" button|
Example of an error message:
Fig. 2.58 Error on an action
You can see the cause of the error by pointing and keeping the mouse pointed at the exclamation mark.
A green exclamation mark (warning) appears when a GRAFCET object in the drawing area is not connected:
Fig. 2.59 Warning on a transition
If there are only warnings, you can simulate the GRAFCET.
If there are errors (red exclamation marks), you cannot simulate the GRAFCET and they need to be corrected.
Simulating a GRAFCET with PLC Lab Runtime¶
A virtual system is supplied for all the exercises in this workbook. Each virtual system has sensors (e.g. proximity switches) and actuators (e.g. a motor, lamp). The status of the sensors is written in the inputs and the values for the outputs are transferred to the actuators. This means that during the simulation of the GRAFCET, you do not need to influence the inputs manually. If, for example, a cylinder extends, then the corresponding sensor is automatically actuated at the front-end final position thus switching over the input connected to the sensor. As with a virtual start-up of the system, this allows you to focus entirely on the GRAFCET and the simulation.
To make sure everything functions as we (the authors) have planned, it is important that you pay attention to the following:
- Run Grafcet-Studio and open the correct template project (GRAFCET Workbook folder in "My Documents"). This ensures that you have the requisite symbols or operands at the ready.
- Run PLC Lab Runtime and open the correct system from the project tree (GRAFCET Workbook node). "S7AG (WinSPS-S7)" needs to be set in the target selection list (see figure below). Click on the "RUN" button to start the simulation of the virtual system. Always run the virtual system first and then click on the "Watch" button in Grafcet-Studio. This ensures that the inputs have the correct statuses when you run the GRAFCET.
Each exercise contains a variation of the following information:
The information shows you the correct system and Grafcet-Studio template.
Fig. 2.60 PLC Lab Runtime in RUN mode. "S7AG (WinSPS-S7)" is defined as the target.
Simulating a GRAFCET without PLC Lab Runtime¶
In principle, you can run or simulate a GRAFCET chart without PLC Lab Runtime. The "I/O Panel" window is available for setting the inputs and monitoring the outputs:
Fig. 2.61 I/O panel with inputs and outputs
The I/O panel displays the inputs and outputs from the table of symbols. You can unhide and hide the operand types (digital input, digital output, analogue input and analogue output) with the DI, DO, AI, AO switches. You can change the condition (1 or 0) for a digital input with a mouse click. You can define the value of an analogue input by entering a decimal in an input field.
Once you have started PLC Lab Runtime and it is in "RUN" mode, you can no longer influence the inputs in this window, since in this case the inputs from the virtual system are modified.
If you are working through the exercises in this workbook using PLC Lab Runtime, then you do not need this window.