Event class

Event classes are groups of events (possibly for a theme) and, in the sense of the TwinCAT type system, data types that can be used in different modules. For this reason they are created as data types in the TwinCAT type system (System > Type System > Event Classes).

 Grafik aus Ereignisklassen (ivu7q472.png)

All known event classes are listed on the Event Classes tab in the TwinCAT type system. The TMC editor, in which the event classes can be defined and edited, can be opened via the context menu commands Edit and New.

In addition to the project event classes, TwinCAT also provides further event classes such as ADS return codes and system events.


Properties of event classes

This name designates the event class, for example in the generated source code.
Like all data types, event classes may also belong to a namespace.
This text is used for the event class for the display. It can be internationalized (see Internationalization/translations).
Like all data types it identifies the currently described event class. It is calculated automatically and changes in the event of changes within the event class.

Event classes in PLC libraries

If event classes are used in a PLC library, they should also be part of the library in order to ensure that the data types are contained in the TwinCAT type system of every application that uses the PLC library.

To make this possible the event classes must be "pinned" in the PLC library. To do this, select the command Pin Global Data Type in the context menu of the created data type under External Types in the PLC library object.


Event classes in C++ projects

Analogous to the other TwinCAT data types there is a possibility for C++ projects to define event classes locally in the C++ project.

The event classes are declared for use in the corresponding C++ modules (irrespective of where they were defined). If an event class is added to a C++ module, it is automatically embedded in the TMC file of the module.