-
Notifications
You must be signed in to change notification settings - Fork 1
Home
The sample consists of two main components. The sample page is used to operate the software management. The task mappBackup_01 drives the software management. The two helper task USBdevice and NETdevice are used to connect to USB sticks and network resource's.
The following functions are currently supported.
- Creat, restore and update the PLC
- List and Delete backups
- Generate backup names
Depending on the PLC speed and project size a backup or restore command will take several minutes. The task uses a variable structure to communicate with the outside world that can also be used to interact with other tasks. The structure Backup_01 looks as follows:
Level 1 | Level 2 | Level Description | ||
CMD | Used to trigger commands like backup, restore, delete, ... A command is triggered by setting it to true, when the command is finished the task will reset the command. This indicates that the command is finished. Do not change any parameters or set another command until the previous command is finished. | |||
---|---|---|---|---|
Backup | Create a backup | |||
Restore | Restore an existing backup or install an update | |||
Delete | Delete the selected backup | |||
GenerateName | Generate backup name by using the default name plus the date and time | |||
RefreshInfo | Refresh details for the selected backup | |||
RefreshDirectory | Refresh the list of available backups | |||
ErrorReset | Resets pending errors | |||
PAR | Parameters like backup name, file path, ... | |||
BackupName | Name of the backup to be created or restored | |||
DefaultName | Name used for auto generating backup names | |||
DeviceName | Device where the recipe is created or restored. This can be a USB stick or network resource. The user partition is not a valid device since it is part of the backup and restore process. | |||
UniqueName | This name is used to create folder in the restore location when the restore command is called. When the PLC reboots after the restore process this folder is used to detect that a restore was completed. When using USB devices for restore the name is not relevant. When using network shares this name should be unique for each PLC that uses the location to restore updates. | |||
DeviceList | List of devices where the backups are stored | |||
VisuSlotID | Web session that triggered the command. This is used to show the message box only on the client that triggered the command. | |||
VisuSlotID | This is the session ID for the current command. This is used to identify where to send response messages. | |||
ShowMessageBoxOK | Show message box when backup or restore is finished | |||
ShowMessageBoxError | Show message box when error occurs | |||
MpLink | MpLink from the mappRecipe configuration under the physical view. | |||
DAT | Backup list as well as status information | |||
CurrentID | ID of the current project | |||
CurrentVersion | Version of the current project | |||
RequestedName | Name of the selected backup | |||
RequestedID | ID of the selected backup | |||
RequestedVersion | Version of the selected backup | |||
LastName | Name of the last backup | |||
LastDate | Date and time of the last backup | |||
LastType | Last backup was manual or automatic | |||
BackupNames | All directories found at the location. This includes backups or any directory found. To check if a directory is a valid backup select it first and then check the backup details. | |||
BackupNum | Number of backups found | |||
Status | Shows the result for the last command | |||
VIS | Data specific for the visualization | |||
DeviceList | List with all devices formatted as data provider for the mappView listbox | |||
BackupNames | List with all backups names formatted as data provider for the mappView listbox | |||
EnabledCommand | Used to disable the group boxes while command is active | |||
EnabledDelete | Only enable delete if at least one backup exists | |||
ShowMessageBoxOK | Show a message box when command was successful | |||
ShowMessageBoxError | Show a message box when command was not successful | |||
ERR | Information about errors | |||
No | Error number | |||
State | State where the error occurred | |||
Text | Error text |
The following constants located in the package mappBackup under Variables.var can be adjusted if necessary.
Constant | Default | Text |
---|---|---|
BACKUP_DEVICE_LIST | List of predefined devices for backup and restore. | |
BACKUP_LIST_NUM | 20 | Maximum number of backups that are listed. |
BACKUP_NAME_LENGTH | 100 | Maximum length for a backup name. |
BACKUP_VIS_LENGTH | 300 | Make this BACKUP_NAME_LENGTH x 3. |
BACKUP_DIRECTORY | By default the backups must be in the root of the device. If this is not possible a folder path can be defined here. |
- For obvious reasons it is not possible to trigger concurrent backups or restore processes from multiple clients at the same time. However, the sample will only show message boxes on the web client that triggered the command.
- Backup and restore does not work when the target is in simulation mode.
Update packages can be generated directly within Automation Studio. Use Project->Project Installation->Generate Project Installation Package.
Copy the folder on a USB stick or network location and use the restore function to install the update.
The sample generates the following list of error messages. All other error numbers are generated from included libraries that can be found in the Automation Studio help.
No | Constant | Text |
---|---|---|
50000 | ERR_BAC_NAME_IS_EMPTY | Backup name is empty |
50001 | ERR_BAC_DEVICE_IS_EMPTY | Device name is empty |
50010 | ERR_BAC_MAX_NUM | Backup name already exists |
50011 | ERR_BAC_NAME_LENGTH | Backup name length exceeds maximum size |
50020 | ERR_BAC_NAME_EXISTS | One or more backup names exceed the maximum length |
First public release