In the following example, we will create a system and use it to test a GRAFCET in Grafcet-Studio. The GRAFCET is processed by the Grafcet engine on the PC (i.e., the GRAFCET simulator). PLC-Lab then connects to this Grafcet engine.
Starting PLC-Lab and creating a system¶
PLC-Lab is started and a new system project is created:
Shortly after pressing the "New" button, the PLC-Lab program window with the drawing board appears.
Selecting a device and creating symbols¶
For this example we need three operands, which have to be created in the symbol table first. The operands should belong to the device with the name "Sim ". This device is used if PLC-Lab is to interact with Grafcet-Studio or WinSPS-S7 V6:
Now all operands added to the symbol table are assigned to this device. The first operand is added to the symbol table by clicking the plus button.
The symbol of the operand is to be changed to "TasterStEin". To do this, click on the cell of the symbol.
and enter the name.
Use the TAB key to jump to the next column of the symbol table. Here you can specify the operand.
Use the E0.0 as the operand, which is already specified, but with the English syntax: I0.0. You could leave the operand as it is. If you want to use the German syntax, the "I" must be replaced with an "E". You can see this below.
This change causes the German syntax to be used when the next operand is added following E0.0. To insert the next operand, press the button with the plus sign again.
Now there is another operand in the symbol table behind the currently selected operand. Its address is increased to such an extent that there is no address overlap. With a bit operand, this means that the bit address is increased by one.
The standard symbol of this operand should also be replaced by another symbol; specify the symbol "TasterStAus".
The operand itself is correct: it is input E0.1 and the syntax can be left as it is.
Finally, we need the output A0.0, to which a lamp is connected. This lamp lights up when the controller is switched on. Now you select the second line of the symbol table (if not already selected) and click the plus button again. Then you can enter "LampeStEin" as the name of the symbol. These steps are shown below:
Drawing the first push-button¶
All operands you need are now available in the symbol table. The next step is to create the objects you need for the system on the PLC-Lab drawing board. In the example you need two push-buttons and a lamp. Start with the "Steuerung Ein" push-button. Within the tools, select the object type "Switches not illuminated":
Then move the mouse to the position within the drawing board where you want to place the switch. The mouse pointer now resembles a cross. Use the left mouse button to drag the switch object onto the drawing board. When you let go of the mouse button, the process is completed.
If you press the Shift key while dragging an object, the height and width of the object to be placed will be changed consistently.
In the next image, you can see the steps for placing the switch object; the Shift key was pressed while dragging the object:
After the switch has been placed, its properties are displayed in the object properties table. In the example, the operand to which the switch object is connected should be specified first. It will be affected when the switch is actuated. Two options are available for specifying the operand.
First option "Autocompletion": In the first option, in the cell for the operand, the device name followed by a period is specified first; in the example, this is "PLCSim300.". Then use the key combination Ctrl + Space. As a result, all symbols of this device are now displayed in a list. Select the symbol you want to use with the cursor keys (../up or down) and confirm with the return key. The selected symbol is then entered as an operand. These steps are shown below:
Second option "Drag & Drop": With the second option, you select the line of the operand in the symbol table and then drop it on the description of the operand property using drag & drop.
If one of the two options was used, then the switch is now connected to the symbol "TasterStEin" and consequently to the E0.0. Now the switch object must be defined as a push-button. Furthermore, the text "St. Ein" with a font size of "12" should appear in the switch object. The properties required for this are shown below:
Drawing the second push-button¶
And now to the second switch. We want to create this switch from a copy of the first switch. Select the first switch and press Ctrl + D. A copy of the selected switch is then placed next to the source object.
To display the properties of the new switch in the table, click on a free space in the draw-window and then select the new switch with the mouse. Now the properties are displayed and can be changed. In the first step you have to adjust the operand of the switch. Because this should be the "Steuerung Aus" push-button. In the property for the operand, remove the characters behind the device name "PLCSIM". and use the Ctrl + Space keys:
From the list, you can now select and insert the "TasterStAus" symbol.
This connects the "Steuerung Aus" push-button to the correct operand. The push-button must be designed as an opener, which means that it provides the status '0' to the operands when actuated and the status '1' when idle. Furthermore, the text in the switch object should read "St. Aus". These changes are shown below.
Drawing a lamp¶
Finally, we need a lamp object to signal the state "Steuerung Ein". For this purpose, select a green indicator light in the object selection "Lamps->Indicator lights".
The lamp can then be placed on the drawing board.
In the next step, assign the operand with the symbol "LampeStEin" to the object.
You can remove the caption from the lamp.
This means that no more text is displayed in the object.
After these actions, the drawing board looks as follows:
All objects are available for the example. If required, you can save the layout by pressing Ctrl + S.
In the example we want to use the layout in PLC-Lab to test the functionality of a GRAFCET in Grafcet-Studio.
Grafcet-Studio and PLC-Lab work together directly. When Grafcet-Studio is set to "GRAFCET Simulator", the two programs are connected if the operands of the device with the name "Sim" are used in PLC-Lab.
After starting Grafcet-Studio, start a new project with the "New" button:
The GRAFCET engine is then set to "GRAFCET Simulator":
You can now specify the operands that are necessary for the project in the symbol table of Grafcet-Studio. It is important that you use the same input and output addresses as are used in the PLC-Lab system. The input operands within the sensors are shown below:
The addresses of the operands are specified in Grafcet-Studio with an English syntax. Thus I0.0 and I0.1 correspond to the inputs E0.0 and E0.1. Next is the output which we have to specify within the actuators:
Please make sure that you use the address Q0.0 (English syntax for A0.0).
Now you can draw the GRAFCET. This could have been done without defining the symbols, but then it would be harder to read the GRAFCET. Below you can see the GRAFCET for our example:
After initial step 1, a positive edge at "TasterStEin" leads to the transition to step 2. Thus "LampeStEin" is described by a continuously acting action with status '1'. A negative edge on the "TasterStAus" leads to the transition to step 1 and thus to the deactivation of step 2. This also means that "LampeStEin" is assigned the status '0'.
The GRAFCET is now complete and the test can be started. To do this, first switch to PLC-Lab.
Activating the simulation in PLC-Lab¶
After switching to PLC-Lab, you can immediately enter run mode.
The program immediately indicates that PLC-Lab is connected to Grafcet-Studio.
Testing the GRAFCET¶
The next step is to switch to Grafcet Studio and switch on observation:
The test of the GRAFCET can then start with the help of the virtual system in PLC-Lab.
The example shows how a virtual system can be created in PLC-Lab to test a GRAFCET in Grafcet-Studio. The interaction between Grafcet-Studio and PLC-Lab is very easy to establish. In PLC-Lab the operands of the device with the name "Sim" are to be used and in Grafcet Studio the "GRAFCET Simulator" is to be used as the Grafcet Engine.