-

Data Logger Configuration

The DataLogger is a service component of the PLCnext Technology firmware. It can record data from any PLCnext IN or OUT ports. Recorded values are transferred from the GDS to a data sink for recording and storage purposes. The storage of the recorded data is done on the controller. The database is either written to the SD card or kept non-remanent in the controller RAM.

The Data Logger is started and stopped automatically on starting and stopping the firmware, i.e., the PLCnext Technology controller.

The Data Logger tool provides a further possibility of recording data from the running process besides the LOGIC ANALYZER tool. The difference is that PLCnext Engineer must be connected to the controller and the debug mode must be activated to use the LOGIC ANALYZER. The Data Logger, however, performs the data recording independently of PLCnext Engineer and its configuration is not volatile.

You can define several Data Logger sessions, each identified by a unique name.

The configuration of the Data Logger (sessions) can be done via

Note
Any modification of the Data Logger configuration is applied after restarting the controller.

Further Info
More details on the Data Logger and how to configure it with XML configuration files can be found in the PLCnext Technology User Manual (document number 109324_en_00), chapter "DataLogger".

How to configure the Data Logger in PLCnext Engineer

To be able to configure Data Logger sessions in PLCnext Engineer, the following must apply:

Example figure...

Proceed as follows:

  1. Double-click the 'PLCnext' node in the PLANT.
  2. Open the 'Data Logger Sessions' editor.
  3. To create a new session, enter a new session name (see description of fields below) and press <Enter>.

    The new session is created with default settings (see table below).

  4. Configure each recording session by defining the values in a session table row.
    See section "Data Logger configuration settings" for details on the parameters to be set.
  5. Add the ports to be recorded under a session table row by selecting the required items in the 'Name' column.

    Note
    • Only ports that are actually used (i.e., instantiated) in the project can be added to a session.
    • Ports can be added to more than one session.

  6. 'Write and Start' the project to apply the Data Logger configuration with the following command in the Cockpit or the controller context menu in the PLANT:

    The Data Logger is started automatically executing the configured sessions after the restart of the PLCnext Technology controller.

    For each defined log session, PLCnext Engineer creates one configuration file pcwe.<sessionname>.dl.config.
    On the controller, the configuration files are stored under /opt/plcnext/projects/PCWE/Services/DataLogger/.

Further Info
The steps how to configure the Data Logger manually via an XML configuration file can be found in the PLCnext Technology User Manual.

Data Logger configuration settings

For each Data Logger session, the following configuration parameters must be set in the 'Data Logger Sessions' editor. No parameter may remain undefined.

ParameterMeaning
NameIdentifies the Data Logger session. The name must be unique within the project.
The name must consist of normal letters and the characters "-", ".", and "+". Other special characters are not allowed.
TypeDefines the name of the data sink where the recorded data is stored.
For each configured Data Logger session, one data sink is created.

Possible values are:
  • Database: The data sink is an SQLite database which is first published in the controller RAM and then written to the SD card (according to the value of the 'Write Interval' parameter described below).
    As a result, a remanent log file is created whose name is derived from the session name. On the SD card, the database is stored under
    /opt/plcnext/logs/datalogger/<LogSessionName>.db.
    You can access the log file via suitable file transfer tools (e.g., WinSCP or ftp tools).
  • TSDB: The data sink is a time series database (TSDB) which is located on the controller. In the time series database, the data values of the selected ports and variables are collected and stored.

    In the HMI application, the 'Chart' object can be connected to a TSDB Data Logger session. Based on the recorded data values in the Data Logger session, you can create a trending chart using the 'Chart' object in your HMI application, thus enabling the visualization and monitoring of the development of the data values stored in the database.

    Further Info
    See the description of the 'Chart' object for further details.

  • Volatile: The data sink is non-remanent. It is published in the controller RAM. The records are not transferred to the SD card and are deleted on a controller shutdown.

    Access to the volatile data sink in the controller RAM is possible via PLCnext firmware functions and Remote Service Calls (RSC). The RSC interface allows the communication with the PLCnext core components. Via the ServiceManager which acts as RSC API you can request services, for example to read data from the GDS.

    Refer to the PLCnext Technology User Manual for information.

Default value: Database
Sampling Interval (ms)Defines the interval (in ms) in which the Data Logger subscribes values.
Value range: 0 up to 65535
Default value: 100 ms
Publish Interval (ms)Defines the interval (in ms) in which the data is transferred from the data buffer to the data sink. Note that the data publishing is not performed within the real-time context. See next table row for further information.
Value range: 1 up to 18446744073709551615
Default value: 200 ms
Buffer Capacity (cycles)Determines the size of the data buffer (in no. of cycles) where the recorded values are cached before they are forwarded to the specified data sink.
Value range: 0 up to 65535
Default value: 10

Background: In each cycle, the values of all recorded data items of a task are stored temporarily in this ring buffer. The capacity of the ring buffer determines the maximum number of task cycles that can be recorded before the data must be transferred from the buffer to the data sink. The transfer from the buffer to the data sink is referred to as publishing.
RolloverDefines the handling of data sink files.

  •  activated: Once the maximum file size is reached, the file is closed and renamed with an index starting from 0 (e.g., <LogSessionName>.db0, <LogSessionName>.db1, etc.). Then a new file is created. Every file with an index is closed and can be copied for evaluation. The current data is always logged in the database of this session.
  •  not activated: Once the maximum file size is reached, a configurable amount of the oldest records is deleted before the record proceeds. The amount of data to be deleted is configured with the parameter 'Delete Ratio (%)' (see below).
Default value: not activated
Write IntervalSpecifies how many data records are published to the data sink before these values are written to the file on the SD card.

The parameter is only relevant if 'Database' is set as 'Type'. Before closing the database or when the controller is switched off, all recorded values that have not yet been transferred are written to the SD card.

Note
The default value is 1000 to keep write access operations to the SD card as low as possible.
The lower the Write Interval value, the higher the frequency of write accesses to the SD card. A high number of write operations to the SD card may cause performance problems. Possibly, the data cannot be written to the SD card at the required speed. This may result in the loss of recorded data.
If a low write interval is necessary but leads to performance issues, it may be useful to use a non-remanent data sink in the RAM by setting 'Type = Volatile'.

Note
Observe the section "Evaluation of the data base for consistent data" below this table.

Max File SizeDefines the maximum memory size of the log file in bytes.
Value range: 16384 up to 150000000 bytes
Default value: 5000000

Note
If the value range is exceeded, no log is file created.

Max FilesDefines the maximum number of rolling files. The value is only relevant, if the 'Rollover' checkbox is activated.

When the maximum number of files is reached, the oldest file will be deleted. The file index of the closed files will be counted up further.

Possible values:
Value range: -1 up to 4294967295
Default value: -1.

  • 0: The behavior corresponds to a deactivated rollover ('Rollover' checkbox not activated).
  • 1: rollover is activated. If the maximum file size is reached, a configured amount ('Delete Ratio') of the oldest data in the database is deleted.
  • Integer number > 1: Number of rollover files.
  • Negative integer number: The file number limitation is deactivated. This results in logging activity until the memory is full.

Store ChangesDefines the recording mode.
  •  activated = record on change: The Data Logger only records data when they change. If a value does not change, the value NULL is written to the data base.
  •  not activated = endless mode: Values are recorded continuously in the set interval, independently whether they change or not.
Default value: not activated
Delete Ratio (%)Defines the percentage amount of the maximum memory size to be deleted for the logging of new data before new data is written into the database. The old data is deleted when the value that is defined via the Max File Size parameter is reached and the 'Rollover' checkbox is not activated.
Value range: 1 to 100 (integer value)
Default value: 30
Timestamp FormatPossible values:
  • ISO 8601
  • RAW = 64 bit integer value
Default value: RAW

Each recorded port/variable value is stored with a timestamp in the database. Each item of the same task has the identical time stamp.
The timestamp is created in the task cycle based on the system time of the controller. It is set at the start of the task (task executing event) and maps exactly the cycle time of the task. As a result, the timestamp value of the following task cycle is increased by one cycle duration.
The time resolution has a precision of 100 ns.

Despite the format, all timestamps are reported using the UTC timezone. The implementation and internal representation complies to the .NET DateTime class, see Documentation of DateTime Struct on https://docs.microsoft.com.
Trigger ConditionDefines whether the value sampling is done in the context of a selected task or not.
  •  activated = sampling is done in the context of the selected task.
  •  not activated = sampling is done in fixed set intervals (parameter 'Sampling Interval').
Task ContextThe field is only active if the checkbox 'Trigger Condition' is marked.

Select the task in which sampling is to be performed from a drop-down list. The drop-down list offers all task types for selection.
The task defines the update rate of the recorded values. Values are subscribed after each cycle of the selected task. The properties of the set task influence the Data Logger session because the subscription rate depends on the cycle time of the synchronization task. If an 'Idle Task' is selected, the visualized values may be inexact or outdated since the cycle time of the 'Idle Task' may vary (depending on the other user tasks on the controller). An 'Event Task' may be executed not cyclically depending on the defined event.
Pre CyclesThe field is only active if the checkbox 'Trigger Condition' is marked.

Specifies the number of sampling cycles recorded before the trigger event (default value = 10 ms). As soon as the trigger event has occurred, the data recorded during the "pre-trigger cycles" are stored.
Post CyclesThe field is only active if the checkbox 'Trigger Condition' is marked.

Specifies the number of sampling cycles recorded after the trigger event (default value = 10 ms). As soon as the trigger event has occurred, the data recorded is continued during the number of defined "post-trigger cycles". If this number has been reached, the session is stopped automatically.
Operand 1
and
Operand 2
The fields are only active if the checkbox 'Trigger Condition' is marked.

Variable or port used as trigger condition.

Depending on the set operation, one or two operands have to be defined.

Open the drop-down list which offers only data items of a suitable data type according to the 'Operation' selected. To define a constant as operand, enter a numeric value, or a Boolean value (FALSE or TRUE).
OperationThe field is only active if the checkbox 'Trigger Condition' is marked.

Select an 'Operation' from the drop-down list.
Depending on the set operation, one or two 'Operands' have to be defined.

Evaluation of the database for consistent data

By evaluating the ConsistentDataSeries database flag in your application, you can monitor the consistency of the recorded data.

Background: Incomplete data recording (for example due to performance reasons or a memory overflow) is indicated in the database column ConsistentDataSeries: