DataLog definition

Top  Previous  Next

The variables and properties for the data log are defined in the <datalog> worksheet. The definition consists of the header and the variable list.

 

The header consists of a parameter set. The header starts with the first row beginning with # and ends with the first line no longer beginning with #.

 

Tag

Value

M/O

Default

Description

#Size

Decimal

O

4

Maximum size of the log file in kB.

If the file size is exceeded, the oldest value in the log file is overwritten. (ring buffer)

#File

String

O

<definition>.log

<definition>.idx

Name of the log and index file (contains the actual position in File -> Ring buffer).

If this parameter isn't defined but the option Type=<type> type will be the name of log and index file.

<type>.log

<type>.idx

#Separator

 

O

<TAB>

Column separator, one character

#dt

Decimal

O

0

Time interval for log entry in [s], if > 0. Alternatively the data logging can also be initiated via the Control variable from the PLC.

#Header

String

O

 

Header in log file

#TimeFormat

<format>

O

%10lu

A special format can be defined for the time stamp in the first column.

#Control

Variable

O

 

Control variable of type DWORD.
If this variable is not defined, each value change is logged but at a maximum rate of one record per second.

The variable name may contain group placeholders. The are replaced by the parameters defined in the VarValue cell of DataLog object.

#TimeStamp

Variable

O

 

Variable for the time stamp (first column). Must be of type DWORD.
If this variable is not configured, the EPAM system time is logged.

The variable name may contain group placeholders. The are replaced by the parameters defined in the VarValue cell of DataLog object.

#BusyCursor

{on¦off}

O

off

The BusyCursor (hour glass) is displayed during an export/save operation.

#Export

<format>

O

 

Automatic export if <format> is defined. The same rules apply to <format> as to #variable for type DT. The entry for <format> with the actual time forms the name for the export file.
Each time a log entry is written, the name is generated using the actual time. If the resulting text or file name changes, the Datalog file is exported under the new name.

 

One export per day sample:
log1-%[yy-mm-dd]DT.csv log1-12-03-09.csv

 

Automatic exports my be defined for: hourly, 12-hourly, daily, weekly, monthly, yearly.
The file name can be given an absolute path. Otherwise the file is exported to PATH_DAT.

 

If the definition is used for multiple #Datalog objects, ( empty #File parameter) use the placeholder <type> to integrate the type name into the filename.

 

Sample:

<type>-%[yy-mm-dd]DT.csvlog1-12-03-09.csv

 

#AutoExport

{on¦off}

O

off

Use to disable the automatic export (see #Export). Typically used if the export will be trigged by the PLC with Export-Bit in the Control-Variable.

#LogFileFormat

{ascii¦utf16¦binary}

O

ascii

File format:

ascii:     ...WSTRINGs can not be logged, the log file is accordingly smaller.
utf16:     ...WSTRINGs can also be logged. (not yet implemented)
binary:   ...Neither STRING nor WSTRING can be logged. An *.idx file is not created. #separator is not relevant.

 


Variable

The variables to be logged are then specified after the header parameters.

Variable

VarType

Format

Comment

Variablename1

Data type

Variableformat

Comment

Variablename2




...




 

Format is optional, if not defined the default format will be used.

 

Icon-HinweisThe variable name may contain group placeholders. The are replaced by the parameters defined in the VarValue cell of DataLog object

 

Sample:

VarValue

 Drive1

Varible

/PlcH/Plc1/{%1}.w1

/PlcH/Plc1/Drive1.w1

 

 

 

Control variable

Bit

Value

Meaning

Description

0

16#0000001

Trigger

The PLC sets the Trigger Ctrl bit to cause EPAM to start logging the Datalog entries (#dt set or > 0) or to log only one Datalog entry (#dt not set or 0). In the latter case, the RTS resets the Trigger bit to confirm that the Datalog entry was logged.

1

16#0000002

Export

PLC sets the Export Ctrl bit to cause EPAM to export the Datalog to PATH_DAT.

The RTS resets the bit to confirm action.

2

16#0000004

Reset

PLC sets the Reset Ctrl bit to cause EPAM to delete the Datalog file in the EPAM log directory (PATH_LOG -> Ramdrive).

The RTS resets the bit to confirm action.

3

16#0000008

Save

PLC sets the Save Ctrl bit to cause EPAM to save the Datalog file in the EPAM log directory (PATH_DAT).

The RTS resets the bit to confirm action.

4

16#0000010

HMI-Reset

EPAM sets the HMI Reset Ctrl bit to notify the PLC that the Datalog file in the EPAM log directory (EPAM Ramdrive) was deleted with theDatalog:[<name>].delete button action. The resetting of the HMI Reset Ctrl bit must be carried out by the PLC.

5

16#0000020

HMI-Save

EPAM sets the HMI Save Ctrl bit to notify the PLC that the Datalog file was saved in the EPAM log directory (PATH_DAT) with the Datalog:[<name>].save button action. The resetting of the HMI Save Ctrl bit must be carried out by the PLC.

6

16#0000040

HMI-Export

EPAM sets the HMI Export Ctrl bit to notify the PLC that the Datalog file was exported to PATH_DAT with the Datalog:[<name>].export button action. The resetting of the HMI Export Ctrl bit must be carried out by the PLC.

 

Triggering the log function

1.#dt set, or > 0:
The DataLog operation is started by setting the Trigger Ctrl bit in the PLC. Data is saved cyclically every x seconds.
The DataLog operation is stopped by resetting the Trigger Ctrl bit in the PLC.
 
2.#dt not set or 0:
A DataLog entry is saved by setting the Trigger Ctrl bit in the PLC.
If the DataLog entry was written, EPAM then resets the Trigger Ctrl bit.

 

Icon-Hinweis        Important

 All lines in a DataLog file must have the same length! For the Variable format observe the max. length of the data type!

 


Example

 

Header

Value

Comment

 

#size

200

Size of Logfile in KB

 

#file

datalog1.csv

Logfile name

 

#separator

;

Separator between columns

 

#dt

1

Log interval in [s]

 

#timeformat

%lu

time format

 

#control

/PLCH/PLC1/GlobalDatalog.DataLog1.Ctrl

Control variable DWORD

 

#timestamp

/PLCH/PLC1/GlobalDatalog.DataLog1.Timestamp

Time variable DWORD

 

Variable

VarType

Format

Comment

/PLCH/PLC1/GlobalDatalog.DataLog1.BoolDecimal

BOOL

%1u

BOOL variable (unsigned decimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.BoolHex

BOOL

%1u

BOOL variable (hexadecimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.ByteDecimal

BYTE

%3u

BYTE variable (unsigned decimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.ByteHex

BYTE

%2x

BYTE variable (hexadecimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.WordDecimal

WORD

%6hu

WORD variable (unsigned decimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.WordHex

WORD

%4hx

WORD variable (hexadecimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.DwordDecimal

DWORD

%8lu

DWORD variable (unsigned decimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.DwordHex

DWORD

%8lx

DWORD variable (hexadecimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.SintDecimal

SINT

%4d

SINT variable (decimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.IntDecimal

INT

%6d

INT variable (decimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.DintDecimal

DINT

%12ld

DINT variable (decimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.UsintDecimal

USINT

%3u

USINT variable (unsigned decimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.UintDecimal

UINT

%5hu

UINT variable (unsigned decimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.UdintDecimal

UDINT

%12lu

UDINT variable (unsigned decimal representation)

/PLCH/PLC1/GlobalDatalog.DataLog1.RealDecimal

REAL

%20.4f

REAL variable (floating comma representation)