Device WinSPS-S7 V6¶
In the following example, a system is created and used to test a PLC program in WinSPS-S7 V6. The PLC program is edited by the S7-300-SoftPLC integrated in WinSPS-S7 V6. Therefore, we do not need a real S7-300. PLC-Lab connects directly to the simulator of WinSPS-S7.
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 WinSPS-S7 V6 or Grafcet-Studio:
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 "Start". 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 I0.0 as the operand, which is already specified. You could leave the operand as it is. If you want to use the German syntax, the "I" must be replaced with an "E". A change causes the German syntax to be used when the next operand is added following E0.0.
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 "Stop".
The operand itself is correct: it is input I0.1 and the syntax can be left as it is.
Finally, we need the output Q0.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 "LampStart" 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.
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 "Sim.". 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.
Third option "Drag & Drop" on the Object: Now for the third option. In this case, you also select the operand from the symbol table and then drag and drop it. But here the target is the switch. This means that the operand is dropped directly on the object. For switch objects, the operand you have inserted is automatically inserted as the operand that is affected by the switch.
The advantage of the options 2 and 3 is that the symbol of the operand is automatically used to label the switch object.
If you used one of the options, then the switch is now connected to the symbol "Start" and consequently to the I0.0. Now the switch object must be defined as a push-button. Furthermore, the text "Start" 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.
In the first step you have to adjust the operand of the switch. This is supposed to be the "Stop" push-button. We will do this using the third option described above. The operand with the symbol "Stop" in the symbol table is dropped over the switch object using drag & drop.
This action also changes the label because the symbol of the new operand is used as the label of the switch object. Thus only the property of the switch as opener has to be set in the properties of the switch object.
Drawing a lamp¶
Finally, we need a lamp object to signal the state "Start". 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 "LampStart" to the object (via drag & drop).
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.
Using WinSPS-S7 V6¶
In the example we want to use the layout in PLC-Lab to test the functionality of a PLC program in WinSPS-S7 V6
WinSPS-S7 V6 and PLC-Lab work together directly. When WinSPS-S7 V6 is set to "Simulator", the two programs are connected if the operands of the device with the name "Sim" are used in PLC-Lab.
After starting WinSPS-S7, a project folder is opened or created. The interface then appears as follows:
We need to create the symbols necessary for the program in the symbol table. These symbols occupy the input addresses I0.0 and I0.1 as well as the output address Q0.0. These symbols were used in the virtual system of PLC-Lab. Below you can see the completed symbol table in WinSPS-S7:
The PLC program for the example is to be programmed in OB1. Open the editor for OB1. You can do this by double-clicking on OB1 within the table of the project contents.
In the now open editor for OB1, network 1 is switched to the "FBD" display mode.
The PLC program consists of an SR memory whose set input is assigned the input I0.0 (symbol "Start"). The reset input is assigned the I0.1 (symbol "Stop") and the SR memory is linked to Q0.0 (symbol "LampStart"). It should be noted that a negation is attached to the R input, since the "Steuerung Aus" push-button has been designed as an opener and thus supplies the value '1' when idle.
The PLC program is now complete and the OB1 can be saved using Ctrl+ S.
In order for WinSPS-S7 to interact with the internal S7-300-SoftPLC, you have to set the target to "Simulator". You make this setting with the selection list shown below:
After the setting has been made, it will look as follows:
The next step is to transfer the created OB1 to the simulation PLC. To do this, simply click the "Synchronize" button.
The PLC is then switched to Run via the CPU Control Center:
The PLC program is now processed in the SoftPLC and the test can begin with the help of PLC-Lab. To do this, switch to PLC-Lab.
Switching on the simulation in PLC-Lab¶
After switching to PLC-Lab, you can switch to run mode.
The system immediately indicates that PLC-Lab is connected to WinSPS-S7.
Testing the PLC program¶
The next step is to switch to WinSPS-S7 and switch on observation:
To do so, click on the following button in the upper part of the editor for the OB1.
The test of the PLC prgramm 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 PLC programm in WinSPS-S7 V6. The interaction between WinSPS-S7 V6 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 WinSPS-S7 V6 "Simulator" is to be set as target.