TwinCAT Module Class Wizard

TwinCAT 3 offers various class templates that can be used to create TcCOM object classes:


TwinCAT Module Class Wizard 1:

TwinCAT Modules Class

Creates a new TwinCAT module class.

This is a template generates a basic core module. It has no cyclic caller and no data area, instead it's good as a start point for implementing services called on demand from a caller.

For example when creating a C++ method that will be called from a PLC module or another C++ module.

See Sample11

TwinCAT Module Class with ADS port

This template offers the C++ module as well as the functionality of an ADS server and ADS clients.

Since the modules behave like ADS clients or ADS servers that communicate with each other via ADS messages, the two modules (Caller=Client and Called=Server) can run in the same or different real-time contexts on the same or different CPU cores.
Because ADS can work across networks, the two modules can also run on different machines in the network.

See Sample03, ADS Communication

TwinCAT Module Class with cyclic caller

Enables the cyclic call of a C++ program which is cut off from the outside world.

Not often used, a module class with cyclic caller and cyclic I/O is preferred.

TwinCAT Module Class with cyclic input/output

Creates a new TwinCAT module class, which implements the cyclically calling interface and has an input and output data area.

The input and output data areas can be linked with other input/output images or with physical I/O terminals.

Important:

The C++ module has its own logical input/output data storage area. The data areas of the module can be configured with the System Manager.

If the module is mapped with a cyclic interface, copies of the input and output data areas exist in both modules (the caller and the called). In this way, the module can run under a different real-time context and even on another CPU core in relation to another module.
TwinCAT will continuously copy the data between the modules.

See Quick Start, sample 01.

TwinCAT Module Class with data pointer

Just like the TwinCAT Module Class with Cyclic IO, this template also generates a new TwinCAT module class that implements a calling interface with an input and output data area for linking with other logic input/output images or with physical I/O terminals.

In addition, this template provides data pointers that can be used to access data areas from other modules via pointers.

Important:

Unlike in the case of the cyclic I/O data area, where the data is copied cyclically between modules, in the case of the use of C++ data pointers there is only a single data area and this belongs to the destination module. When writing from another C++ module to the destination module via the data pointer mechanism, this will immediately affect the data area of the destination module. (Not necessarily towards the end of a cycle).

If the module is executed at runtime, the call occurs immediately, blocking the original process (it is a pointer...). Therefore, both modules (the caller and the called one) must be in the same real-time context and on the same CPU core.

The data pointer is configured in the TwinCAT Module Instance Configurator.

See sample10

TwinCAT Module Class for real-time context

This template creates a module, which can be instantiated in the real-time context.

As described here, the other modules have transitions for startup and shutdown in a non-real-time context. In some cases modules have to be started when a real-time is already running, so that all transitions are executed in the real-time context. This is a corresponding template.
The modules with this (modified) state machine can also be used for instantiation directly on startup of TC. In this case the transitions are executed like for a normal module.

The TcCOM 03 sample illustrates the application of such a module.

TwinCAT Module Class with Online Change capability

This option can only be used if the module is added to a Versioned C++ Project.

This template creates a module that is capable of online change. Due to the revision control of the project, these modules become exchangeable at runtime - it is therefore possible to exchange modules from different versions at runtime.

The procedure for this Online Change is described here.

The module itself otherwise corresponds to a module with cyclic input/output.