Code generation of the event definition

Source code is generated from the definition of event classes with events, both in the PLC and in C++.

The "names" of the events and event classes are used in the code generation. An event class can thus be used across different versions of an event class through its name.

The "severity" is provided by the code generation. The programmer thus has the possibility to set this individually when creating the events. The severity as described in the TMC editor should thus be considered the default behavior. The severity can deviate from this in the specific application case.

PLC

A GVL TC_EVENTS is created in the PLC and contains the event classes as subelements and is updated following changes (saving/closing the TMC editor). These global constants in turn contain the events themselves as subelements together with the individual elements EventId, Severity and the UUID of the event class to which they belong.

These elements can be used by means of IntelliSense for the parameters, e.g. with Create()/CreateEx().

Code generation of the event definition 1:

Logged-in PLC

The code is not updated if a connection to a PLC exists (login). The update then takes place following a logout.

Via "OnlineChange" the changes to an event class can be applied if the option "Update boot project" is selected.

C++

TcCOM modules must use the event classes, i.e. they must be entered as used in the TMC editor. A code generation then creates a namespace, "TcEvents", as part of the <DriverName>Services.h- file. The namespace can be used by means of IntelliSense for the parameters of the event classes/events, e.g. with CreateMessage()/CreateAlarm().

Code generation of the event definition 2:

Compatibility

The C++ source code generation requires Visual Studio 2013 or newer.