Backup and restore

BACnet enables the creation of backup for the configuration of a BACnet controller. In TwinCAT BACnet/IP the configuration may consist of several files. One of the main files is CurrentConfig.xml, which contains the general TwinCAT configuration. In addition, TwinCAT BACnet/IP uses a further BACnetOnline file which contains the relevant data that were modified during runtime and differ from the original configuration of CurrentConfig.xml. Further files may be used to determine a configuration, e.g. a PLC boot project or project-specific files.

The BACnet backup and restore mechanism enables a customizable number of files to be backed up and restored using the file services. Once a backup was selected via the corresponding BACnet services, a BACnet client can determine which BACnet file objects belong to a backup configuration belong by reading the device object property ConfigurationFiles. The BACnet file objects refer to the corresponding file names. Please note that TwinCAT BACnet/IP treats all files relative to the boot project folder (default: "C:\TwinCAT\Boot"). Backup-relevant files should therefore be stored in this folder.

Creating a BACnet server automatically creates two file objects, which refer to the file CurrentConfig.xml and the BACnetOnline file.

Backup and restore 1:

BACnet TwinCAT/IP enables further files to be included in a backup configuration. To this end can a new BACnet file object can be added. The file name can be configured in the property ObjectName. If the property FileType is initialised with the string "TwinCAT Configuration File", during a backup request this file object is included in the property ConfigurationFiles so that it can be backed up by a BACnet client and subsequently restored. The screenshot illustrates how the boot project for PLC runtime 1 can be included in the backup configuration.

Backup-relevant data can also be stored in the PLC. A feedback mechanism between BACnet and a PLC ensures that the PLC backup data are written to the storage medium during a backup operation. Cyclic monitoring of the property SystemStatus of the server device object enables the timing of a backup to be detected (BackupInProgress (5)). A feedback procedure can be activated via the server control status word (ServerControl) by setting bit 0. If bit 0 is set in the control status word, the BACnet stack waits for the PLC data to be written before processing the backup request of a BACnet client (once bit 1 is set in the control status word). A corresponding PLC sequence is shown below:

  1. Set bit 0 in the control status word
  2. Monitor SystemStatus - when value BackupInProgress (5): writing the relevant data
  3. After the write operation set bit 1 in the control status word
  4. When SystemStatus has the value operational (0) again: delete bit 1

A further backup-relevant file is "BACnet_LastRestoreTime.wbp", which is stored in the boot folder of TwinCAT. This file contains data that have to survive a restore. They include the properties LastRestoreTime and DatabaseRevision.

TwinCAT BACnet/IP currently does not support triggering of a backup or restore operation. A corresponding building management tool can be used to backup and restore the Beckhoff controllers. In other words, only the server is supported in this case, not the client side.