Online Change

Online Change 1:

From TwinCAT 3.1 Build 4024.0

The functionality described here is available from TwinCAT 3.1. 4024.0.

TwinCAT 3.1 supports the exchange of C++ modules at runtime, i.e. without interrupting the real-time program.

For this purpose, different versions of a TwinCAT Executable (TMX) are stored on the target system, as already described here.

For all module instances from a TMX, a switchover between the versions can be initiated by the engineering.

The procedure is roughly sketched:

Online Change capable module in TMX
1. TwinCAT instantiates the new module. The old module is still called cyclically by the task.
2. TwinCAT calls ITcOnlineChange::PrepareOnlineChange() of the new module.
This call can access the old module and accept data that does not change due to the cyclic calls of the module - for example parameter values.
3. TwinCAT calls ITcOnlineChange::PerformOnlineChange() of the new module.
This call can access the old module and take over data which have changed cyclically before. This call is executed if no cyclic call is made by a task. The old module is not called again by the task, but the new module is called. The PerformOnlineChange() method should use as little computing time as possible so that this switchover can take place from one task cycle to the other.
4. After completion, the task will call the new module cyclically.

Online Change 2:

The Online Change can be carried out through this dialog in engineering.

Online Change 3:

When dealing with the Online Change, there are therefore some aspects to consider:

After a restart, TwinCAT will start the driver in the initial version of the modules.