We will guide you on how to back up log data stored in TOP to an SD card.
#For how to set up the log function, refer to the attached sample project file.
The TOP device's backup memory is memory that stores data such as logs/alerts/recipes.
This memory is fixed at 512KB and cannot be changed.
Of this, the amount of memory usable for logs can be set in [Project]-[Properties] menu, which appears in the [Project Options] screen under [TOP Settings]-[Project Options]-[Partition Settings]. You can adjust this appropriately depending on the amount of log/alert/recipe data used in your project.
To store more data than the device-provided memory allows, you can equip an SD card or the optional module TOPR_OPT_CAM32 (for TOPR only) to back up data.
#The optional module TOPR_OPT_CAM32 can be found on the homepage under [Product Intro]-[Cables & Components].
[Backup Settings]
The backup function is set in the [Project]-[Log]-[Backup] page in TOP Design Studio.
Setting [Storage Medium] and [Old Log File Delete Unit]
Set [Storage Medium] to [SD Card/Ext Cam32] as above, and set [Old Log File Delete Unit] to 30%.
When the log data is full to the [Log Count], it copies 30% of the oldest log data and backs it up as a CSV file on the SD card. You can open the CSV file in Excel to check it. After backup, the backed up log data is deleted from the TOP device. #Log Count is set on the [Log Address] page as shown below.
If the log count is 1,000 and the log data in the TOP device is full with 1,000 logs, it copies 30% (300 logs) of the oldest log data and backs it up as a CSV file on the SD card. Separate files are created depending on the date and Log ID of the stored log data. After backup, the backed up log data is deleted from the TOP device.
The log files created on the SD card are stored in the [HMILoggingLOG_1(LogID)] directory.
#Notes --------------------------------------------------------
If [Storage Medium] is set to [None], no backup will be made. When [None] is set, settings below storage medium are meaningless.
#Cautions --------------------------------------------------------
1. If backup is triggered when the log data reaches the [Log Count] but there is no SD card inserted, backup will not happen and [the percentage set in Old Log File Delete Unit]% of the log data in the main unit will be deleted, so caution is required.
2. [Old Log File Delete Unit] also applies to the SD card capacity. If the capacity of the inserted SD card is full, [the percentage set in Old Log File Delete Unit]% of the oldest files on the SD card will be deleted.
2. Setting [Backup Condition] (Related to creating a CSV file on the SD card simultaneously with backup)
[Backup Condition] is an additional condition that triggers a backup, separate from the backup that happens when the log data reaches the log count. You must set at least one of [Use Backup Condition] or [Backup on Log File Name Change]. By default, [Backup on Log File Name Change] is enabled.
When a backup is triggered by a [Backup Condition], regardless of the [Old Log File Delete Unit], all log data in the TOP device is copied and backed up to the SD card, and the backed up log data is then deleted from the device.
If you set [Use Backup Condition], every time the set condition is met, the entire log is backed up. Even if there is already a CSV file for the same date, a new CSV file is created for each backup, incrementing the file number by 1. [2019-07-03_LOG001_000001(CSV file number +1).CSV]. Each time backup occurs, a new CSV file is created.
[Use Backup Condition] is used when you want to back up the entire log under a certain condition and save it in a separate file.
#If you want to back up the entire log using a specific condition but record it continuously in the same daily CSV file (not a new file), use [Object]-[Action and Effect]-[SD Update] function.
[Backup on Log File Name Change]: Every time the file name parameter of the CSV file to be stored on the SD card changes, a full backup occurs. The file name is normally [Date (YYYY-MM-DD)_LogID_FileNumber (000000 incremented) .CSV]; so, when the date changes (midnight), the full backup is executed.
Assuming backup runs normally at 12AM every day, as of July 4, 2019 at 12AM, log data accumulated for one day (July 3, 2019) will be in the device. That data will be backed up to a file named [2019-07-03_LOG001_000000.CSV].
Suppose the TOP unit was turned off or there was no SD card for three days from July 1 to July 3 and no backup occurred; if, on July 4, all 300 logs are backed up, SD card will have three files: [2019-07-01_LOG001_000000.CSV], [2019-07-02_LOG001_000000.CSV], [2019-07-03_LOG001_000000.CSV].
After July 4 midnight, if the log data fills up and triggers backup for [Old Log File Delete Unit]%, [2019-07-04_LOG001_000000.CSV] is created. Every time backup is triggered due to logs filling up, logs are written continuously in the CSV file for that date. In summary, the SD card will have one CSV log file per day.
#[Backup on Log File Name Change] and [Split Save] are described in item 3 below.
3. [Log File Name Option] setting (related to CSV file name on SD card)
CSV file names saved on the SD card may differ by the [Log File Name Option] setting, but basically are saved as [Date (YYYY-MM-DD)_LogID_FileNumber (starts at 000000 and increments).CSV], for example, 2019-07-03_LOG001_000000.CSV.
If you enable [User Defined Name] and [HMI Alias], file names become [Date_LogID_FileNumber_HMI Alias_User Defined Name.CSV]. #The HMI alias is under the [Information] menu of the TOP device. This helps identify which TOP’s log data was backed up, when using a single SD card with multiple TOPs.
If you set [Split Save], the file name becomes [Date_LogID_FileNumber_HMI Alias_User Defined Name_Split Save Address.CSV]. This function, together with [Backup on Log File Name Change], allows you to perform a full backup every time the address set in [Split Save] changes. Even if there are files for the same date, a new CSV file is created each time, with the address (number/text) appended to the file name. This is used when you want to back up when the address value (such as process, model, etc.) changes and record that value in the file name.
[SD Update operation] --------------------------------------------------
If you want to back up all log data remaining in the TOP device to the SD card when removing an inserted SD card, use the [Object]-[Action and Effect]-[Action]-[Special]-[Storage]-[SD Update] function.
All logs in the TOP device are backed up. CSV files are created by date of log data. If an identical date CSV file already exists on the SD card, data is appended rather than a new file being created.
[SD Card Specifications] ---------------------------------------------------
It is recommended to use an SD card of 32GB or less, formatted as FAT32.
[Summary] ----------------------------------------------------------
1. Note that backup means copying log data from the TOP device and saving it to the SD card, then deleting the backed up log data from the device.
2. To back up log data by date, use [Backup on Log File Name Change] without [Old Log File Delete Unit] or [Split Save]. To manually back up all logs, use the SD Update function.
3. To create multiple CSV files even for the same date, use [Use Backup Condition] or [Backup on Log File Name Change] + [Split Save] settings.