Project settings

So that a TwinCAT project that is managed using a source code management system can be processed in a team as independently as possible, various settings can be set. These are described below.

Independent Project File

It is possible in TwinCAT to save individual sub-projects, NC axes or I/O devices explicitly in separate files. These files then contain all the parameters, etc. of the respective TwinCAT object, so that the complete project file does not have to be "checked out" when making changes to this object. The links of a PLC project, for example, are thus no longer stored in the TwinCAT project file, but in the corresponding XTI file of the PLC project.

So that this function can be used in TwinCAT it must be "globally" enabled once. This is done via the TwinCAT –> XAE Environment –> File settings category in the TwinCAT Engineering environment options.

Project settings 1:

The Enable Multiple Files option enables the use of this function for new projects. The options below it define the elements in a new project for which this function is switched on by default.

Project settings 2:

Restart necessary

Changes to these options only become effective after restarting the development environment.

Use of Independent Project Files in a project

If this option is not activated by default for a TwinCAT object, it can be done manually (or the option can be reset) via the option Independent Project File in the context menu of the TwinCAT object.

Project settings 3:

Objects that are saved as Independent Project Files are marked in the TwinCAT tree with the aid of an overlay icon in the form of a small floppy disk. A black floppy disk indicates that there are no unsaved changes yet for this object, whereas this is the case with a red floppy disk.

Project settings 4:

Keep Unrestored Link Info

If not set otherwise, TwinCAT only saves the required information so that the project repository is not unnecessarily loaded. In association with this, TwinCAT also checks whether links are still valid. Any invalid links found are automatically deleted. This mechanism is obstructive when merging projects, since only the code and the links can be merged, but the updated process image is only available after recompiling the code that has now been merged. It is thus possible for the link information to be newer than the process image and the automatic optimization function would delete all links to the new variables in the process image. With the option Keep Unrestored Link Info, the link information marked for deletion is retained and automatically restored as soon as the variables show up in the process image.

Project settings 5:

LineIDs

LineIDs are needed to map lines in source code to lines in machine code. This is important as soon as breakpoints are set. Without LineIDs, the following scene would not work as desired:

A breakpoint is set in the source code. After that, blank lines or comments are inserted in the source code before the breakpoint. These are not changes that lead to an online change. The engineering environment is now closed and reopened. Without stored LineIDs it can happen that the set breakpoints point to blank lines. If TwinCAT remembers the LineIDs, the breakpoints point to the desired location.

LineIDs are noted at the end of a POU by default. However, these are changes that are not visible in the PLC editors. Therefore, they are displayed in the Project Compare Tool as formal and not substantive changes. So in case of a merge these changes cannot be merged in a meaningful way. In addition, changes in LineIDs also occur when blank lines and comments are inserted and then deleted. Content-wise, the two POUs are the same in the PLC editors, but not in the XML representation of the file, since the LineIDs may have changed.

To avoid these disadvantages of LineIDs, it is possible to save LineIDs in a separate file (Separate Line Ids). They are then no longer part of a POU. Starting with TwinCAT version 3.1.4026 it is also possible to completely disable the saving of LineIDs (Write Line Ids). However, this has the disadvantage that all changes in a POU that had no effect on the compilation in the past, e.g. adding blank lines and comments, now require at least one online change.

Project settings 6: