Siemens S7-1500

PLC Lab can be connected via Ethernet to a real Siemens S7-1500. The network card of the PC with PLC Lab is connected to the Profinet interface of the S7-1500. The virtual system of PLC Lab can thus be imprinted on a real CPU. The PLC program is located in the real CPU, which can also be connected to the TIA portal in parallel. This makes it possible, for example, to replace (still) missing system parts with the virtual PLC Lab system and nevertheless carry out a test of the entire PLC program.

Essential settings in the S7-1500 for operation with PLC Lab

In order for PLC Lab to work with an S7-1500, the following hardware configuration settings must be made in the CPU.

Protection & Security Settings

Info

Make sure that either Full access (no protection) or HMI access is selected. In addition, the Allow access via PUT/GET communication option must be selected.

The two settings are shown below:

Info

It is important that these settings have also been transferred to the CPU because it is only then that they are effective.

Example

Creating a connection (device) to a Siemens S7-1500 in PLC Lab

If a virtual system in PLC lab is to be connected with the operands of a real S7-1500, the first step is to create a new device within PLC Lab. To do this, open a system project in PLC Lab (or create a new one) and then press the button shown below in the symbol table.

As a result, a dialog appears in which an S7-1500 must be selected as a device type and a name for the device must be assigned.

In the example the name "S7-1500-Station511" was assigned. The "OK" button confirms the entry and opens the next dialog. Enter the IP address of the S7-1500 CPU to be addressed. Furthermore, you have to select the network card of the PC which establishes the connection to the CPU and which is connected to it.

In the example, the target CPU has the IP address "192.168.1.195". Confirm the settings of this dialog with OK.

Creating symbols in PLC Lab which are linked with the operands of the new device

In the symbol table you can now select the new device and create symbols with the operands of the device. In the following example, three operands are created for the device.

There are two inputs and one output. The inputs have the address I0.0 and I0.1. The output has the address Q0.0. It does not matter if German or English syntax is used for the operands.

Use of symbols or operands in the virtual system of PLC Lab

You want to change both inputs in PLC Lab using push buttons. The output is linked to a lamp object to detect its status. First, place the "Control On" button, then link it to the operand and adjust the settings.

You can see the settings of the button once again in the following image:

In the next step, place the "Stop" button and the lamp. Note that the Stop button must be set as NC.

The second button was created as a copy of the first one. For this, select the first key and then press Ctrl + D.

This concludes the virtual layout of the example.

Configuration of devices in the Siemens TIA Portal

For this example we will use a CPU-1511-1 PN. It has a local DI/DO module with 16 digital inputs and outputs each. The inputs are assigned the addresses I0.0 to I1.7, the outputs the addresses Q0.0 to Q1.7.

Unique aspect of describing inputs via PLC Lab

In the example, the two inputs I0.0 and I0.1 are described via PLC Lab. These two inputs are also available physically. This means that the values of the real inputs is dominant. Any influence on the two inputs in PLC Lab via the two buttons has no effects. To change this, you have to switch off the updating of the process image for these inputs (or the module to which they belong). You can do this in the hardware configuration of the module. The picture below shows the settings.

As a result, the status of the module no longer overwrites the status written by PLC Lab. Once you have adjusted the settings, you have to transfer the new configuration to the CPU for it to be effective.
After the program test with PLC lab, you can undo the setting.

Tip

You can find more options for using real inputs in PLC Lab below in the description of input operands.

The PLC program for the example:

The PLC program, for example, consists of only one SR block and is located in network 1 of OB1. The program is created with the Siemens TIA portal.

The Q0.0 is set via the I0.0, to which the on-switch is connected. The I0.1 ("Stop") is attached to the R input. You also have to place a negation, since the "Stop" button is designed as a normally closed contact and thus supplies the status '1' in idle state. After transferring the OB1 to the S7-1500 and switching it to RUN, you can switch on the monitoring of the OB1 with the following button:

Starting the simulation in PLC Lab

In the next step, you will switch to PLC Lab and start the simulation. Press the RUN button.

After a few seconds, PLC Lab displays that the connection to the S7-1500 has been established.

You can now start the test of the PLC program.

Test of the PLC program with the virtual system of PLC Lab

When testing the PLC program, the OB1 is observed in the Siemens TIA portal and the virtual system is operated by PLC Lab.

Conclusion

PLC Lab can connect to a real S7-1500 and imprint the virtual system on the CPU. At the same time, the PLC blocks can be monitored via the TIA portal and the PLC program can be tested. A PLC program test is therefore possible without the sensors and actuators being connected to the modules of the PLC. PLC Lab can be used to easily provide progress conditions or other system behavior.

Useable operands

Inputs

Inputs can be both read and written. If the inputs are not real (i.e. if they are in the form of modules), then the value written by PLC Lab is valid in the input. If inputs are written and if they are physically present in the PLC, the real input always overwrites the PLC Lab status. So the real input is always dominant.

The first solution to this problem is to switch off the updating of the process image of the input module for the duration of the simulation. Such a setting can be seen below:

A second possibility is to set the address of the real input module to an unused input address for the duration of the simulation.

Example: We want to influence the inputs I10.0 to I10.7 via PLC Lab. The input module is set to the unused input byte address 50 in the hardware configuration. After the simulation, the address 10 is set again for the input module.

Info

Please note that changes in the hardware configuration become effective only after the transfer into the CPU.

If both solutions are not possible, then PLC Lab is to influence data within a data block (which must not be optimized) or unused flags instead of the inputs. These can then overwrite the status of the inputs at the start of OB1.

Example: In the following example, PLC Lab influences the flag bits M10.0 to M10.7, i.e. the MB10. These flag bits are to overwrite the inputs I0.0 to I0.7, which are real in the PLC. For this reason, in network 1 of OB1, the MB10 is copied to EB0 via a MOVE block and thus the status of the bits I0.0 to I0.7 is overwritten with the bits M10.0 to M10.7.

After the program test with PLC Lab, simply remove network 1 in OB1 and the real status information from the inputs will be used again.

Examples for addressing inputs in PLC Lab (english syntax):

  • Bits: I10.3, I21.5
  • Bytes: IB10, IB120
  • Words: IW10, IW20, IW34
  • Double words: ID12, ID44

Within the objects, always specify the device to the operand as well.

Example: Input byte 34 in the device with the designation "S71500-Station-3" is to be addressed as operand in an object of PLC Lab.

Solution: The operand "S71500-Station-3.IEB34" is required.

Tip

For the operands to be used in a system, first add a symbol to the symbol table. Then you can use the symbol instead of the operand in the objects. As a result, you can insert the symbol from the symbol table using drag and drop. Or you can use the autocompletion (IntelliSense) within the editor for the operands.

Outputs

Outputs can be read and written in PLC Lab. Normally these are read, i.e. the value of the outputs is used to control the virtual system in PLC Lab. If outputs are written by PLC Lab, this only affects the PLC if the output is not overwritten by the PLC program. This means that if an output is described in the PLC program, the PLC program overwrites the status written by PLC Lab.

Info

If an output is influenced by PLC Lab to write, it should not also be written to by the PLC program.

Examples for addressing outputs in PLC Lab (english syntax):

  • Bits: Q10.3, Q21.5
  • Bytes: QB10, QB120
  • Words: QW10, QW20, QW34
  • Double words: QD12, QD44

Within the objects, always specify the device to the operand as well.

Example: Output byte 34 in the device with the designation "S71500-Station-3" is to be addressed as an operand in an object of PLC Lab.

Solution: For the operand the specification "S71500-Station-3.QB34" is necessary.

Tip

For the operands to be used in a system, first add a symbol to the symbol table. Then you can use the symbol instead of the operand in the objects. As a result, you can insert the symbol from the symbol table using drag and drop. Or you can use the autocompletion (IntelliSense) within the editor for the operands.

Flags

Flags can be both read and written in PLC Lab.

Info

If a flag is influenced by PLC Lab to write, it should not also be written to by the PLC program.

Examples for addressing flags in PLC Lab :

German and English syntax:

  • Bits: M10.3, M21.5
  • Bytes: MB10, MB120
  • Words: MW10, MW20, MW34
  • Double words: MD12, MD44

Within the objects, always specify the device to the operand as well.

Example: Flag byte 34 in the device with the designation "S71500-Station-3" is to be addressed as an operand in an object of PLC Lab.

Solution: The operand "S71500-Station-3.MB34" is necessary.

Tip

For the operands to be used in a system, first add a symbol to the symbol table. Then you can use the symbol instead of the operand in the objects. As a result, you can insert the symbol from the symbol table using drag and drop. Or you can use the autocompletion (IntelliSense) within the editor for the operands.

Data in data blocks

PLC Lab can access the data of DBs both with read and write access.

These DBs must not be optimized!

Info

If DB data is influenced to write by PLC Lab, it should not also be written to by the PLC program.

Examples for addressing data in data blocks with PLC Lab :

German and English syntax:

  • Bits: DB2.DBX10.3, DB5.DBX21.5
  • Bytes: DB2.DBB10, DB33.DBB120
  • Words: DB2.DBW10, DB33.DBW20, DB1.DBW34
  • Double words: DB2.DBD10, DB1.DBD44

Within the objects, always specify the device to the operand as well.

Example: Data byte 34 in the device with the designation "S71500-Station-3" is to be addressed as an operand in an object of PLC Lab.

Solution: The operand "S71500-Station-3.DB12.DB34" is necessary.

Tip

For the operands to be used in a system, first add a symbol to the symbol table. Then you can use the symbol instead of the operand in the objects. As a result, you can insert the symbol from the symbol table using drag and drop. Or you can use the autocompletion (IntelliSense) within the editor for the operands.