Real-time DataLogger
Available from firmware 2019.3
Use Case
As soon as you record consumption values, need to prove energy feeds, or possibly have to log plant states, you need a reliable data acquisition. With the PLCnext Real-time DataLogger, you now have a convenient way to do all these use cases without any programming effort. Simply parameterize the required variables, and the DataLogger starts with recording values that are synchronous to an ESM task. The data is available directly on the SD card of the controller, or you can rely on OPC UA Historical Access.
In addition, you can decide whether each value or only changed values are being recorded. This is how a simple data logger becomes a powerful event recording system ("Sequence of Events").
Note: When planning a project that depends on task-synchronous real-time data logging, it is highly recommended to select the hardware according to a maximum CPU load of 70 to 80 percent, visible in the PLCnext Engineer cockpit (see CPU load here:show where to find the CPU load). See ESM for further information on effects to the real-time context.
Concept
The DataLogger is a service component of the PLCnext Technology runtime. This component transfers real-time data from the GDS to a database for recording and storage purposes.
This simplified schematic drawing shows how the DataLogger works:
When starting and stopping the PLCnext Technology runtime, a configured DataLogger session is started and stopped automatically. The DataLogger then collects the values that are synchronous to an ESM task of the configured GDS ports with a given sampling rate and stores them with a time stamp (exact to 1 µs) into a RAM disk.
With the standard settings, the database is stored SQLite-compliant on an SD card in the PLCnext Control. Then you can copy the database at any time, read it out in place via OPC UA® Historical Access, or read out entries via a C++ interface (RSC IDataLoggerService2). All essential settings are given by an XML configuration file, no further programming is necessary.
The DataLogger internally uses GDS subscriptions of<SubscriptionKind> Recording
which is behaving like RealTime
and HighPerformance
. This results in values for instance variables that are synchronous to an ESM task. In other words: Within a single record, the values of all instance variables whose related program instance is associated with the same ESM task are stemming from the same execution cycle of that task.
Handling of global variables
As global variables are not instantiated in program instances, no ESM task is related to these variables. For information how global variables are recorded refer to subscription of global variables in RSC GDS services.
Up to firmware 2021.0 LTS, there was no reliable way to get values which are all synchronous to the same ESM task.
From firmware 2021.6 on, the DataLogger supports continuous recording with a selected ESM task, using the taskContext
attribute instead of samplingInterval
. By specifying an ESM task simply via its name, the values of all kinds of variables will be sampled within this task:
- resource-global variables and component ports
- variables instantiated within a program associated to any ESM task
Feature development
Being an extremely useful feature, the Real-time DataLogger of PLCnext Technology is still subject to further development. Some of the features have been implemented only recently, so please make sure to use the suitable firmware release:
Task-synchronous DataLogger
First implemented with firmware 2019.3, therefore the table does not show a 2019.0 LTS column.
Firmware version | 2020.0 LTS |
2021.0 LTS |
2022.0 LTS |
2022.3 | 2022.6 | 2022.9 | 2023.0 LTS |
2023.3 | 2023.6 | 2023.9 | 2024.0 LTS |
2024.6 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Logging of GDS ports | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
File format – SQLite | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Mode – infinite | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Mode – on change (Sequence of Event) | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Mode – Time frame | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Mode – Trigger | – | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
C++ API (Remote Service Call – RSC) to query the database | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Time stamp according to ISO 8601 | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Session configuration and management via PLCnext Engineer | – | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Session configuration and management via RSC IDataLoggerService2 | – | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Sampling values in a specified ESM task | – | – | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Where to start
After this short introduction, here you find further information on how to use the DataLogger:
- DataLogger configuration – different ways to set up a DataLogger session
- DataLogger config flowchart – a guide through the attributes and decisions to make for a configuration
- DataLogger examples – configuration sets for often used scenarios
- DataLogger reference – find all the details on attributes and things to know
- DataLogger Tutorial videos – what the DataLogger is all about and how to set up different DataLogger configurations
- RSC IDataLoggerService2 – learn about the Remote Service Call (RSC) for setting up and using the DataLogger out of C++ programs