SYSTEMINFOTYPE

TYPE SYSTEMINFOTYPE
STRUCT
runTimeNo :BYTE;
projectName :STRING(32);
numberOfTasks :BYTE;
onlineChangeCount :UINT;
bootDataFlags :BYTE;
systemStateFlags  :WORD;
END_STRUCT
END_TYPE

runTimeNo: specifies the number of the runtime system (1..4).

projectName: project name as STRING.

numberOfTasks: number of tasks contained in the runtime system (max. 4).

onlineChangeCount: number of online changes since the last complete download.

bootDataFlags: State of the boot data (RETAIN and PERSISTENT) after loading. The upper four bits indicate the state of the persistent data, while the lower four bits indicate the state of the retain data.

Bit number

Description

0

RETAIN variables: LOADED (without error)

1

RETAIN variables: INVALID (the back-up copy was loaded, since no valid data was present)

2

RETAIN variables: REQUESTED (RETAIN variables should be loaded, a setting in TwinCAT System Control)

3

reserved

4

PERSISTENT variables: LOADED (without error)

5

PERSISTENT variables: INVALID (the back-up copy was loaded, since no valid data was present)

6

reserved

7

reserved

systemStateFlags : Reserved.

When shutting TwinCAT down the PERSISTENT and RETAIN data is written into two files on the hard disk. The path can be specified in TwinCAT System Control by means of the TwinCAT system properties (PLC tab). The standard setting is "<Drive>:\TwinCAT\Boot". The files all have a fixed name with fixed extensions:

File name

Description

TCPLC_P_x.wbp

Boot project (x = number of the run-time system)

TCPLC_S_x.wbp

Packed source code (x = number of the runtime system)

TCPLC_R_x.wbp

RETAIN variables (x = number of the runtime system)

TCPLC_T_x.wbp

PERSISTENT variables (x = number of the runtime system)

TCPLC_R_x.wb~

Backup copy of the RETAIN variables (x = number of the runtime system)

TCPLC_T_x.wb~

Backup copy of the PERSISTENT variables (x = number of the runtime system)

If the persistent or retain variables are not loaded, e.g. because they are invalid, the backup file is loaded by default. In that case bit 1 of the bootDataFlags (for the RETAIN variables) in the PLC and/or bit 5 (for the PERSISTENT variables) is set.

A registry setting can be used to determine whether the backup file is deleted or used. The backup file is used by default (setting 0). If the backup file is to be deleted, the value of "ClearInvalidRetainData" or "ClearInvalidPersistentData" must be set to 1 in the registry under:

[HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\TwinCAT\Plc]
"ClearInvalidRetainData"=dword:00000000
"ClearInvalidPersistentData"=dword:00000000

the value of "ClearInvalidRetainData" or of "ClearInvalidPersistentData" must be set to 1.

Whether the backup file is to be used can also be set in the TwinCAT System Manager in the tree structure on the left under PLC > PLC Settings:

SYSTEMINFOTYPE 1:

The backup files are deleted if the option Clear Invalid Retain Data or Clear Invalid Persistent Data is set in the System Manager. Corresponds to registry entry 1.

Development environment

Target platform

PLC libraries to be linked

TwinCAT v2.7.0

PC or CX (x86)

PLCSystem.Lib

TwinCAT v2.8.0

PC or CX (x86)

TcSystem.Lib

TwinCAT v2.10.0 Build >= 1301

CX (ARM)

TcSystem.Lib