Standalone PLC projects

A new year has started, and what is not better to start a new blog-year by having a reader of this blog to host as a guest author? Roald Ruiter will describe the functionality of standalone PLC projects in TwinCAT.

In this article I want to highlight a useful and relatively new TwinCAT feature: Standalone PLC projects. As usual, Beckhoff’s InfoSys provides a good explanation on how to setup and run such a project from scratch. However, there is relatively little information on why the separation might be a good idea, how to separate an existing project and some of the pitfalls you might encounter.

A standalone PLC project “makes it possible to separate system, motion and I/O configuration from PLC development at project level”. In other words, the separation can prevent the configuration of one machine to influence the other. For example, one issue we were facing was that on our production machine we divided tasks over multiple cores, whereas on our development environments we would often run all tasks on a single core. It happened a few times that the development environment’s configuration was (partially) uploaded on the production machine, where it caused a bunch of issues as you can imagine.

The problems of the example above were probably caused by a wrongful merge of the combined project. Because the .tsproj file of the combined project contains so much information, which also changes when you for example change your target system, it is very difficult not to make a mistake once in a while when merging the .tsproj files from different systems.

That’s why it is a good idea to separate the projects. Creating a separate PLC project from scratch is relatively straight forward, but only possible from version 4022.0. First you create a standalone PLC project. Then you create a separate TwinCAT project, where you import the TMC file from the standalone project. After that you can assign the tasks you created in the standalone PLC project to the system tasks in the TwinCAT project. Finally you activate your configuration in the TwinCAT project and then you can log into the PLC from the standalone project.

It is also possible to separate an existing TwinCAT project which includes the PLC project. In order to do that you first create a standalone project, much like above. You go to File > New Project > TwinCAT PLC Project and select an appropriate name for your project and save location and click OK.

Then select Empty PLC Project in the following screen. The name doesn’t really matter, because this project will be replaced by an existing one in the next step. Click OK.

Then right click on the PLC project and select Change Project… Select the .plcproj file of the PLC project which you want to import.

Then select the appropriate option what to do with the PLC project files. After clicking on OK, all the files of the selected PLC project should show up in your standalone project.

There is one thing which is not copied and those are custom events. Custom events in a combined project are stored in the .tsproj file and can be found under SYSTEM > Type System > tab Event Classes. I’m not sure what the appropriate way is to get them in the new standalone project, but it can be done by copying the events from the combined project’s .tsproj file into the .tsproj file of the standalone PLC project.

At this point I wanted to go into some problems you might encounter with the creation of a standalone project. However, I couldn’t recreate issues I was having with a previously combined project which was later on split up into a standalone PLC and a TwinCAT project. For those who are also experiencing issues I’ll briefly go into them here. The issues we were facing had to do with custom events. Somehow whenever we added a custom event to our standalone PLC project, they were not added to the .tsproj file, but only in the .tmc file (after building of course). So whereas normally .tmc files can be added to the .gitingore file, this was not the case for this project.

Related to this issue is that whenever this buggy standalone PLC solution file was opened, the custom event classes were not loaded automatically. Only after manually reloading the project file, the event classes would show up.

Perhaps these issues were caused by the fact that the original combined project was created with an older TwinCAT version? Maybe you’ve experienced similar issues, or have some experience with setting up standalone projects? Let me know your thoughts in the comments below.

  • Share on:

2 Comments, RSS

  1. luka

    I was able to copy over also custom events, all I did was used 4024.7 TC. It went smoothly between newly created and an older project from 4022 as well. Comment?

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.