For each Datalog described, it’s necessary to declare a control variable in the PLC program with name “DATALOG_name” (replacing “name” with the name of the datalog. For example: DATALOG_LOG_1).These control variables must be of type GS_DATALOG_PAR, a data structure with the following fields:ENABLE: bool. Lets you activate/deactivate logging (true / false). Activation takes place on the rising edge, and is controlled once a second. Activation takes place at the next sampling time in seconds. Deactivation takes place on the falling edge at the next sampling time. In case of not-circular DataLogging and full buffer, sampling is automatically stopped, even if the ENABLE flag is “true.”
This flag can be reset by the system on error detect. It’s not advisable to keep it continuously at TRUE state inside 1131 program.CLEAR: bool. Lets you completely clear the logging buffer. Clearing takes place at the next sampling. The flag is lowered when clearing is done. It is important to keep this flag low, otherwise sampling will be continuously cleared. The physical reset of the disk file will be done at later time. It’s possible to know when the file has been cleared by monitoring the bit 12 in the STATUS word.
If enable = false, the clear request is kept pending until the datalog is started again.COPY: byte. Lets you copy the historical file. A new file is created with the values of the current historical file and file name “DATALOG_PREFIXnamelog_DATE_TIME.cop”.
The “prefix” string is specified inside the “PREFIX” fiel (see below).
The copy is “acquired” and run by the file system manager (activated every minute). It’s a bitmask:b0: COPY FULL. Lets you automatically make a copy of the historical file when FULL status is reached. The physical copy is made the next time the file system manager is run (activated every minute). This bit is never cleared automatically. At very end of file copy (file write) will be raised bit 11 in the STATUS word.b1: COPY NOW. Makes a copy immediately, regardless of buffer level (or for circular buffers). The value is cleared when the operation is acquired (b7 = 1). The physical copy is made the next time the file system manager is run (activated every minute), but the data saved is the data that is “photographed” when the COPY flag is detected. At very end of file copy will be raised bit 11 in the STATUS word. So, raising b1 during enable = TRUE, the copy will be queued at next sample (which enters inside the copy).
Note: if, after the acquired operation (b7 = 1) this bit will be raised again (b1 or b2), the request will be ignored and not queued.b2: COPY & CLEAR. Like b1 but the Datalog data is cleared after the copy and next sample (the next after the copy one) will take place at offset zero. The value is cleared when the operation is acquired (b7 = 1).
If enable = false, the clear request is kept pending until the datalog is started again.b3: reserved for future useb4+b5: select the path destination for the COP file.
Destination
b5
b4
/ata0a/export/[GROUP]
0
0
/usbkey/export/[GROUP]
0
1
/usbkey/1/export/[GROUP]
1
0
/sdcard/export/[GROUP]
1
1
b7: COPY DONE. Raised when the copy command is queued. This happens normally synchronous with sample time. When the copy will eventually take place (physical file write), the STATUS b11 will be raised and this bit cleared.
Not used for COPY FULL management.PREFIX: string to be used as prefix for the exported COP file, done with “COPY” field (see above).GROUP: grouping folder to be used for the exported COP file inside the selected disk (chosen by bits b4+b5: ata0a, USB or SDCard), done with “COPY” field (see above). If this field is empty (empty string) the COP file will be created inside the folder “/export”, otherwise a new subfolder will be created (if not existing) “/export/[GROUP]” (with [GROUP] = this string value). If more than one COP use the same group value they will be grouped inside the same folder. It’s advised to create this string combined with date/time. Example: “PRODUCTION123_2015-05-28_08-50”.INFO1, INFO2, INFO3: generic strings which will be exported inside CSV and COP files, as first 3 rows content. They could help to better describe the Datalog (more than variable name, already inserted automatically).SIZE: design time datalog size. It contains the maximum elements availability (GF_ProjectVX design time grid, column “Buffer size (num)”.COUNTER: int. Incremented after every sampling. By copying this value, you can check the exact sampling time. Note: with circular Datalogs this counter will be continuously incremented, while with standard Datalogs, if FULL, the counter will stop.
Also “Start” and “Stop” records are counted, after “Enable := True” and “Enable := False”.STATUS: word. Contains a bitmask code corresponding to any error detected:b0: if TRUE = all OKb1: 5-minute prealarm. The system has not yet saved data to disk.b2: CPU overload alarm. The system has not saved data to disk for 10 consecutive minutes. Sampling is automatically stopped (enable = 0).b3: buffer full. In case of not-circular sampling, indicates that the buffer is full. Sampling is automatically stopped (enable = 0).b4: config error. Existing sampling files do not correspond to the configuration specified in the INI file. Sampling files are deleted and recreated.b5: error in opening or creating buffer file on disk.b6: error in CFG file (ini file).b7: label to be sampled not found in PLC program.b8: trigger label not found in PLC program.b9: reserved (interface data structure not found in PLC program).b10: disk fullb11: raised when the COPY operation has been completed on disk. This flag needs to be reset by the userb12: raised when the CLEAR operation has been completed on disk. This flag needs to be reset by the userb13: reserved for internal useb14: error creating the COP file. Perhaps the path “GROUP” is invalid, or the destination (USB or SD Card) is not present or read only.COMMA: dint. Allows to control the datalog comma position , if displayed on pages (DatalogGrid and DatalogExport). 0 = automatic comma, -1 = no decimals, 1..4 = comma positionMINY, MAXY: real. Graph display limits when displayed on the component DatalogGraph.RES_MINY, RES_MAXY: real. Graph display limits when displayed on the component DatalogGraph, used automatically during ZOOM and PAN. They assume MINY and MAXY values when pressing the vertical refresh button.