Command: Online Change
Function: The command is used to trigger an online change on the current application. When this is done, CODESYS re-downloads only the changed parts of an application which is already running on the controller.
Call: menu; context menu of an Application object
Requirement: The application is in online mode.
The command is available in the context menu when an application is selected in the device tree. As a result, you can perform an online change just for one application, even if that application is not currently "active".
Caution
An online change modifies the running application program and does not cause a restart.
Make sure that the new application code still has the required effect on the controlled system.
Depending on the controlled plant, this could result in damage to the plant or the workpieces, or injury or death of personnel.
Important
When an online change is performed, the application-specific initializations (example: homing) are not executed because the machine retains its status. For this reason, the new program code may not have the intended effect.
Variables to pointers retain their value from the last cycle. When a pointer refers to a variable whose value was changed in an online change, the variable no longer yields the correct value. Make sure that the pointers are re-assigned in each cycle.
After you have changed the "parent application", a "child application" is removed from the controller when an online change is performed.
No initialization code during a fast online change
Since compiler version >= 3.5.0.0, a "fast online change" is performed for minor changes. During a fast online change, only the modified POUs are compiled and downloaded. In particular, no initialization code is generated.
For variables with the init_on_onlchange
attribute, this also results in no initialization code being generated. In the usual scenarios, that has no impact because the attribute is usually used to initialize variables with addresses. However, during a fast online change, it cannot happen that a variable changes its address.
However, to make sure of the impact of the init_on_onlchange
attribute is applied in the entire application code, in general for the application you can use the no_fast_online_change
compiler define to disable the fast online change. To do this, select your application object in the device tree and click Properties in the context menu. Below the Build tab, add the no_fast_online_change
compiler define.
For more information, see: Build
At the time of download, CODESYS also lists the changed interfaces, affected variables, and all POUs with new generated code in the Build category of the message view. If memory locations change, a dialog will notify you of possible problems relating to pointers.
Tip
In the Online Change Memory Reserve view, memory reserves can be configured for the online change so that instance variables do not have to be moved in the memory when changing a function block in an online change.
For more information, see: Online Change Memory Reserve Settings
What prevents an online change?
In CODESYS, there are actions after which an online change on a controller is no longer possible. After that, the application always has to be completely recompiled. A typical case is the Clean All command which deletes the compile information stored at the last download. However, these kind of actions typically generate a warning which you need to acknowledge.
But there are also "normal" editing actions which result in an online change not being possible at the next login. Therefore, you need to pay attention to the following symbol in the status bar when editing in the program POUs: . When this symbol turns red in color
, only a full download to the controller can be performed. Double-click the symbol to open the Application Information dialog with a list of differences from the last download. In the dialog, you also find information about which of the changes prevent an online change.
For more information, see: Command: Login
Check functions | Activation or removal of a check function ( Change in an interface of a check function (also the insertion and deletion of local variables) |
Task Configuration | Change in the configuration settings |
Project Settings | Change of the Compile Options in the Settings section (Unicode, replace constants, logging in, breakpoints) Change in the Compiler defines |
Application properties | Change of the Target system memory settings (Build tab) |
POU properties | Change of the External implementation option (Build tab) |
Tasklocal global variable list | All changes |
Function block | Change of the basis POU of a function block ( Change in the interface list ( Exception: Adding a new interface at the end of a list |
Data Type | Change of the data type of a variable from one custom data type to another custom data type (for example, from Change of the data type from one custom data type to a basis type (for example, from Note: As a workaround, you should always change the name of the variable together with the data type. Then the variable is initialized as a new variable and the old one is removed. After that, an online change is possible. |
Alarm Configuration | Change in the alarm database configuration Change of the number of latch variables (also has an impact on the memory format in the database) Change to the configuration of the distributed alarms |
Data Source | All changes in the configuration |
Device configuration | Change in the device tree (also by means of the Update Device command) Change in a device configuration: By default, changes to device parameters are not capable of online change. However, exceptions can be configured in the device description. Note: I/O mapping to variables is possible by means of an online change. |
Visualization | Toggling of the overlay function Before V3.5 SP6: Change in the configuration of the trace element Note: In V3.5 SP6 and higher, the following applies: For online changes which affect visualizations or affect the data of the application (for example, a new variable is inserted), the visualization is completely reinitialized. For TargetVisu, for example, this means that the visualization closes and reopens with the start page. For WebVisu, the visualization also restarts with the start visualization after a short waiting period. |
Unit Conversion | Insertion or removal of objects for unit conversion |
Trend | Change of the number of variables or maximum number of variables Change of the number of variables with a description or special line settings |
For more information, see: Performing an Online Change and init_on_onlchange