Management and identification of data types
Data types in the TwinCAT 3 type system are fundamentally identified on the basis of their GUID. Thus, several data types can exist with the same name. The same applies to different versions of a data type. Each version of a data type is assigned a new GUID.
At the same time, each data type has a list of data types that it keeps hidden ("Datatype Hides").
This makes it possible to use different versions of a data type in the project at the same time.
The Update Instances... command in the context menu of a data type in the type system editor (Data Types tab) employs the respectively latest version for selected uses of a data type.
TwinCAT has a so-called reference counter for each data type. This counter can be seen in the RefCount column in the editor of the type system. Each use of the data type in a project, and also in an editor and so on, increments the counter. If a counter is at 0, the data type is no longer used and is discarded.
If the Persistent (even if unused) setting in the context menu of a data type is activated, the data type description will be saved in the TwinCAT project file (*.tsproj) even if the data type is not used in the TwinCAT project. The setting is activated by default with data types that are newly created directly via the type system editor. This ensures that the data types are not directly deleted if the TwinCAT project is saved before the new data types are used.
If a SharedTMC is used underneath the Type System object in the TwinCAT project tree, the setting should not be activated for data types in this file as the data types are saved both in the project and in the SharedTMC. The setting is deactivated by default with data types that are newly created directly via a SharedTMC editor.
The Auto Delete (if unused) setting should not be manually changed, but is shown for the sake of completeness. Data types for which this setting is activated are hidden for PLC projects and cannot be used there. The setting should not be used, for example, to automatically clean the type system. Unused data types are not automatically saved in the TwinCAT project and are then no longer in the type system after reloading the TwinCAT project.