Real-time DataLogger configuration
Available from firmware 2019.3
There are different ways available to set up and configure a DataLogger session:
- from firmware 2019.3:
- configuration based on an XML file
- from firmware 2020.6, additionally:
- via PLCnext Engineer
- via RSC IDataLoggerService2 (reading values, handling a session)
Let's see which way fits your needs best.
File-based configuration
Available from firmware 2019.3
The configuration of a DataLogger instance can be done by an XML configuration file. You can download an exemplary DataLogger configuration file and folder from Github.com/plcnext and use it as a template. For an easy approach, you might want to watch the Tutorial videos.
The XML configuration file can be edited using a text editor. Adapt the settings for the session to your needs (see DataLogger reference)
Be aware of the XML entities when editing XML configuration files! There are symbols in the XML code that cannot be represented as attribute values because they have a syntactical function. Show detailsShow details
For example, the characters < and > are used for opening and closing XML tags. To be able to use these characters as attribute values in their genuine meaning "less than" or "greater than", entities are required.
The following entities are predefined in the XML specification. Make sure to use these entities in attribute values to avoid XML parsing errors.
Character | Entity |
Ampersand (& ) |
& |
Single quote (' ) |
' |
Double quote (" ) |
" |
Less than (< ) |
< |
Greater than (> ) |
> |
After editing, save the configuration file under /opt/plcnext/projects/Services/DataLogger/ on your controller. The file system of the controller is accessed via SFTP. Use a suitable SFTP client software for this, e.g., WinSCP.
Each configuration file generates a separate DataLogger session, and you can configure several DataLogger sessions running parallel.
When starting and stopping the firmware, a DataLogger is started and stopped automatically in this configuration. Due to that, all changes in the configuration file will only be active after restarting the firmware ( via console: sudo /etc/init.d/plcnext restart
).
Configuration via PLCnext Engineer
Available from firmware 2020.6
You can configure the parameters of your DataLogger sessions directly in the PLCnext Engineer software suite.
Additional sink typeTSDB
for time series databases
The PLCnext Engineer configuration comes not only with its convenient interface but with a slightly different parameter set.
- Configurations made with PLCnext Engineer can use the sink type
TSDB
, in addition to SQL-based data sinks (db
orvolatile
). TheTSBD
database is located on the controller, and this sink is not restricted to the maximum of 996 variables per session. - Only the
Chart
object in an HMI application can be connected to a DataLogger session writing to aTSDB
sink. By that, you can create a trending chart based on the recorded data values in the DataLogger session. For further configuration of that chart, search the PLCnext Engineer Help for "chart object". - The
TSDB
sink type neither supportsSTRING
norWSTRING
data types. If defined anyway in a session, it will be created without such variables, and a notification is sent.
Setting up a session by means of PLCnext Engineer
You can find the following procedure and parameters also in the Help menu of the PLCnext Engineer, and here's a Tutorial video with a complete use case involving OPC UA® Historical Data Access.
- Open a project made with PLCnext Engineer v2020.6 (or update the project)
- Double-click the PLCnext node in the PLANT area
- Choose the Data Logger Sessions tab
- To create a new session, enter a session name
↪ A new session is created with the default settings.
↪ For each defined logging session, PLCnext Engineer creates a separate configuration file named pcwe.<sessionname>.dl.config. - Adapt the parameters for the session to your needs (refer to the Help embedded into the PLCnext Engineer)
- Add the ports or variables to record by clicking a row below the session name
Note: You can only add ports that are used (e.g., instantiated) in the project. You can add the same port to different sessions. - Write and Start Project (F5)
After writing the project to the controller, the configuration files are stored in this path: /opt/plcnext/projects/PCWE/Services/DataLogger/
Reading values via RSC IDataLoggerService2
Available from firmware 2020.6
A Remote Service Call (RSC) interface is available for use with all PLCnext Control devices. See the regarding RSC IDataLoggerService2 topic for all details on this feature.