Applies To:
  • CitectSCADA x.x

Summary:
I have seen the Trend Archive code in the Example project but I do not understand exactly what it can do for me. 

Solution:
The trend archive Cicode is designed for archiving files that may need to be viewed at a later date, it is not designed as a total trend backup system. Following is a brief description of the steps in the process. The text in the Trendarc.ci file should also be read before attempting to setup.

Backup selected trends
This option allows the user to select the trends that are to be archived. The Code will copy all the files for the selected trends to the backup directory (backup directory selected from the Configure form). Then it will invoke CtBackup.exe or CtBack32.exe and archive all the files from the backup directory except the HST files. The compressed archive will be called CTTREND.001 and will be stored as per the Configure form. The compression uses the PKZIP algorithm however the file format is different.

Backup all Trends
This option does the same as the above except it copies all the trends in the system. This may take a long time in a large system. Also the code is not really optimised for archiving hundreds of megabytes of trend data.

Restore Trends
This option restores the trends from a CTTREND.001 file and places the trend files in the restore directory as specified by the Configure form. The restore directory must be separate from the directory that stores the online trend files, ie as specified in the "Trend Tags" form.

Attach Files
This option attaches all the files in the restore directory to the trend system using the TrendAddHistory() Cicode function. After completing this step the trends will be viewable by selecting the appropriate Time / Date on the trend screen.

Remove Files
This option get all the file names from the restore directory and pass these names to the TrendDelHistory() function thus removing the files from the trend system. The files are not deleted, the files will be deleted the next time a restore is done to the same directory. (This operation is identical to "Attach Files" however it calls TrendDelHistory() instead).

It is possible to have multiple restore directories if you require multiple archives to be attached at the same time. The attached files are not affected by the normal rotation of the online trend files. To achieve this, create a new directory then select this directory as the restore directory in the Configure form, then do a restore and attach. Repeat this for each archive that you wish to add.

See Trendarc.ci in the Example project for more info.

 

Keywords:
 

Attachments