Hello,
We are working on a project that includes several GVLs. These GVLs contain both persistent and non-persistent variable sections. For example:
GVL “HMI”:
{attribute 'qualified_only'}
VAR_GLOBAL PERSISTENT RETAIN
xSBAutoTurnOff: BOOL := TRUE;
END_VAR
VAR_GLOBAL
xPBTurnOn: BOOL;
END_VAR
In the project tree, we have added the PersistentVars object, which contains all the persistent variable instances. This setup has worked reliably for years.
PersistentVars:
{attribute 'qualified_only'}
VAR_GLOBAL PERSISTENT RETAIN
// Generated instance path of persistent variable
HMI.xSBAutoTurnOff: BOOL := TRUE;
END_VAR
Recently, we introduced some updates to the project, adding new variables to the persistent sections of various GVLs—without modifying the existing ones. After compiling the project and executing the “Add all instances” command, all new variables are appended to the end of the PersistentVars list.
When we load the project directly from CODESYS to the PLC, the persistent variables are retained correctly. However, if we execute the “Create boot application” command while the PLC is still connected, the entire list of persistent variables is reinitialized upon reboot. The same issue occurs when updating an older project using Application.app and Application.crc.
Our question is:
Why does appending new variables to the end of the PersistentVars list cause the entire list to reset? This is a major issue for us, as maintaining compatibility with existing machines is critical.
Environment:
-
CODESYS: SP17 Patch 3
-
Weintek Package: 1.2.400
Thank you.