Simulating an existing TIA project with PLC-Lab¶
If in an existing PLC project the hardware configuration is changed according to the specification and the function "MHJ-PLC-Lab-Function-S71500" or "MHJ-PLC-Lab-Function-S71200" is called in network 1 of OB1, then the PLC program can also be tested with PLC-Lab.
Steps with a S7-1500:
- Open the existing project in the TIA Portal, select the project view and double-click on the device configuration within the existing PLC station.
- Set the minimum cycle time of the CPU to 5 ms. This is necessary because the PLCSim otherwise generates a high PC CPU load. This is independent of the use of PLC-Lab.
- Place a DI16 module on a free slot and assign the start address 512. Then switch off the updating function of the process image for this module.
- Display the task card "Reference projects" via the menu item "View->Reference projects".
- In the task card "Reference projects", the PLC-Lab S7-1500 Advanced template project from the directory "...\Automation\PLC-Lab-Editor\" is now opened within your own files.
- Copy the function "MHJ-PLC-Lab-Function-S71500" from the PLC-Lab Advanced template project for the S7-1500 into the project. To do this, copy the function to the program blocks of the existing TIA project in the reference project within the program blocks using drag & drop.
- The function "MHJ-PLC-Lab-Function-S71500" is called in network 1 of OB1. The minimum and maximum input byte addresses to be addressed from PLC-Lab must be specified at the parameters "MinDiByte" and "MaxDiByte". In the call shown below, for example, the input bytes IB0 to IB15 can be written via objects in PLC-Lab.
Make sure that these addresses are occupied by input modules and that the process image of these modules is switched off.
Now the existing TIA project can be simulated with PLC-Lab.