Turbocharging TwinCAT Online Changes: From Reserved Memory Setup to Network Optimization Best Practices

Large-scale project debugging often faces slow login speeds after code modifications. Sometimes, even when working on the same project, Online Change prompts may occur during program downloads. Additionally, in some instances, Online Change is not an option, requiring a full Download that can cause PLC Stop, with potentially severe consequences if the machine is in production.

This document analyzes the fundamental principles of Online Change, draws from Information System and past experiences of colleagues, and combines recent test results to delve into the typical phenomena mentioned above. Feasible optimization suggestions are provided accordingly.

Table of Contents

  1. Fundamentals of Online Change
  2. Possibilities of Direct Login Failure and Solutions
  3. Necessity of Download and Solutions
  4. Displaying Changes During Online Change
  5. Accelerating Online Change Speed

1. Fundamentals of Online Change

1.1 Online Change Prompt

When logging into a PLC project that differs from the actual project on the target machine, a message window will appear, offering two login options:



  • Login with Download‌: Fully switches the program and reinitializes.
  • Login with Online Change‌: Only loads modified parts, potentially involving simple or complex online modifications based on the changes.

1.2 Mechanism of Online Change

Handling Variables During Online Change

  • Unmodified Variables‌: Remain in their memory locations and retain their original values.
  • Deleted Variables‌: Leave memory gaps that may be filled during the next Online Change (if possible).
  • New Variables‌: Assigned a new memory location, either in gaps, at the end of used memory blocks, or in a new memory block.

Handling Programs During Online Change

If the memory location of an FB instance does not have sufficient space for new variables, the entire FB instance may need to be moved during Online Change.

1.3 Application Risks of Online Change

  • Code Switching Time‌: During code switching, communication may pause, or PLC cycle overflow may occur.
  • Existing Variable Values May Be Invalid‌: Newly created variables are initialized, but existing ones retain their values, which may cause runtime exceptions or program malfunctions.


  • Pointers/References May Be Invalid‌: Pointers retain their pre-Online Change values, which may become invalid if the pointed-to variables move during Online Change.

1.4 New Feature in Build 4024: Reserve Memory

What is Reserve Memory?
Reserve Memory, or Online Change Memory Reserve, is an attribute added in TC3.1.4024 and later versions for FBs. It allocates additional memory for FB instances during Online Change to store new variables.

How to Set Reserve Memory

  1. Navigate to ‌PLC | Windows | Online Change Memory Reserve Settings‌.
  2. Select the target PLC project (if multiple exist).
  3. Enable editing and set the desired reserve memory size for each FB, up to half of the current size or equivalent, depending on the controller's memory capacity.
  4. Apply the settings.

1.5 Observing Online Change Frequency

The number of Online Changes can be viewed in the global variable _AppInfo under OnlineChangeCnt. Each Online Change consumes additional temporary memory.


2. Possibilities of Direct Login Failure and Solutions

2.1 Automatic Library Version Upgrade Triggering Recompilation

When a project is moved to a different PC with a different XAE version, the default setting "as always newest" may cause recompilation due to changes in referenced libraries.

Solution‌: Set all libraries/placeholders to the effective version using the right-click menu in the "Reference" node.

2.2 Visu Internal Library Version Errors

PLC programs with HMI interfaces may encounter Visu-related errors.

Solution‌: Set the corresponding Visu Profile to automatically set the versions of related libraries/placeholders. For libraries referenced internally within Visu libraries, manually set them to the effective version.

2.3 Non-official Libraries Using Duplicate Version Numbers

User-created libraries with duplicate version numbers may cause recompilation when opened on different PCs.

Solution‌: Copy the project along with its referenced libraries and install them in the new environment, overwriting the original libraries.


3. Necessity of Download and Solutions

3.1 Modifying Variable or FB Instance Types Without Changing Names

Changing the type of a variable or FB instance without altering its name requires a full Download.

Solution‌: Avoid direct type modifications. Instead, create new variables and replace them in the program.

3.2 Adding/Removing Check Functions, Such as CheckBounds

Adding implicit functions like CheckBounds requires a Download due to recompilation.

Solution‌: Avoid adding these functions during normal debugging. If a Page Fault occurs, using Core Dump functionality can help identify the issue without restarting the PLC.

3.3 Using Different Compiler Versions

Modifying the compiler version in the PLC project properties or having a mismatch between the development environment and the target machine requires a Download.

Solution‌: Avoid changing compiler versions before Online Change and ensure Engineering, Target, and Project versions are consistent.

3.4 XAE Unable to Distinguish Between Different Versions of Global System Data Types

Earlier TC3 versions did not distinguish between different versions of .tmc files, leading to Download requirements when opening old projects in newer XAE versions.

Solution‌: Ensure the TcModuleFolders.xml file specifies the correct relative paths for .tmc files. If missing, upgrade to a compatible minor version.


4. Displaying Changes During Online Change

4.1 Build 4024: Using the Details Button

The Details button in TC3.1.4024 and later versions displays specific changes during Online Change.

4.2 Build 4022 and Earlier: Compiler Define "uptodate_in_message_out"

In the PLC project's compiler defines, input "uptodate_in_message_out" to display change details in the output window during compilation.

4.3 Direct Comparison Using XAE Tools

If the controller has the source code, use ‌XAE | Tools | TwinCAT Project Compare‌ for a detailed comparison.


5. Accelerating Online Change Speed

5.1 Operating the HMI Interface Directly

The PLC logic updates faster than the POU display refresh during Online Change. Operators can continue debugging via the HMI interface without waiting for the code refresh.

5.2 Upgrading Programming PC's CPU Performance

High-performance CPUs can speed up compilation and file compression processes, thus accelerating Online Change.

5.3 Improving Network Transmission

Use wired connections between the programming PC and PLC for large projects. Direct network cables or a dedicated switch can minimize transmission time and avoid potential delays caused by WiFi or shared networks.