Native Datalogger

Hello, I am testing the native datalogger in the PLCnext Engineer 2020.6. I have made the configuration in PLCnext Engineer and it seems to be working. But it is not clear the timestamp format presented in the database. The timestamp number in the database is like this: 5249009445093906144 (see picture attached). What is the timestamp format saved in the database ? How can I convert it to data/time format ? I have tried a lot of timestamp converter in internet but none of them recognized the format. I have tried to configure the Datalogger with RAW and ISO 8601 option, but the number format in Database was the same. Other question about Dataloger is the difference of Sample Interval and Publish Interval. It is not clear for me. Could you explain me ? Thank you, Sidnei Marcondes

Hi Sidnei, In this page of the Info Center … https://www.plcnext.help/te/Service_Components/DataLogger/DataLogger_Reference.htm … the “Interval” section defines the Sample Interval and Publish Interval, and the “Timestamp” section describes the timestamp format. If the answers are not on this page, please let us know. We may need to review this content. Frank also mentions these parameters in this video, from 3:19: ~ Martin.

Hello Martin, Sorry, but I haven´t found the answer for my doubts in the manual link and the Frank´s video. Let me explain with other worlds. 1) Timestamp I am receiving the number 5249009445093906144 in the timestamp column of the DB file. How can I convert this timestamp number to dd-mm-yyyy / hh:mm:ss format ? 2) Inteval I have understood that: Sample Interval - time to save the variable value in a buffer in RAM Write Interval - number of records (cycles) in the RAM buffer to transfer to DB file (SD card) Is it correct ? But is not clear what is the Publish Interval. Sidnei

Hi Sidnei, 1) Timestamp You are right, those numbers seem strange. There is more information from Frank in this answer to an earlier post: https://www.plcnext-community.net/en/discussions-2-offcanvas/datalogger-rt.html#reply-2394 The Datalogger uses the ToBinary method to encode the date/time and “kind” data. If you are using C# or VB.NET to read the TimeStamp field, you can use the FromBinary method. Otherwise you can remove the two leading bits, and the remaining data represents the ticks (in 100s of nanoseconds) since 01.01.0001. 2) Interval The second diagram on this page of the Info Center might also help: https://www.plcnext.help/te/Service_Components/DataLogger/DataLogger_concept.htm The Publish interval is the period at which data is copied from the Ring Buffer (in RAM) to the “Data Sink” (in RAM). This data sink stores the data in RAM, until it is flushed to the Data Sink on the SD card (based on the Write Interval parameter). You can think of this in-memory data sink as like a “file stream” in C++. When you write to a file stream in C++, the data is not actually written to disk until the filestream is “flushed”. Hope this helps. ~ Martin.

I couldn’t help doing that conversion myself: Timestamp: 5249009445093906144 In binary: 100100011011000001110100100011110100101011111100001011011100000 Remove the first two bits: 0100011011000001110100100011110100101011111100001011011100000 In decimal: 637323426666518240 (this is the number of ticks since 01.01.0001 00:00:00) Using this converter: http://www.datetimetoticks-converter.com/ DateTime: 06 August 2020 20:31:06 Voila!

Hi Martin, Thank you very much for your answer. Now it is clear. I have only one more question about timestamp. I have tried the Datalogger with timestamp format parameter in RAW and ISO 8601. But the result was the same, timestamp like 5249009445093906144, that is RAW format. Is ISO 8601 format parameter working in 2020.6 version ? I was able to convert the RAW timestamp to Date/Time format in the DB Browser SQLite software with the follow SQL Command: SELECT STRFTIME(‘%Y-%m-%d %H:%M:%f’,(Timestamp & 0X3FFFFFFFFFFFFFFF)/10000000.0 - 62135596800, ‘unixepoch’, ‘localtime’), * from log_all_3662298461 Sidnei

Hmm, you are right. I get the same. You can see from Frank’s video that this was working in an earlier version. I have raised this with the developers and will let you know the result. ~ Martin.

An update on this Timestamp issue: This has been confirmed as a bug in PLCnext Engineer version 2020.6. The format of the datalogger configuration file generated by PLCnext Engineer is not correct, and the datalogger defaults to the RAW timestamp format. This issue does not arise for applications that use the RAW timestamp format. It is possible to work around this issue by either:

                                             * manually editing the data logger configuration file that is generated by PLCnext Engineer - but this configuration file will be overwritten every time the PLCnext Engineer project is sent to the PLC, or
                                             * not using PLCnext Engineer for datalogger configuration, but instead using a datalogger configuration file located on the PLC outside the PCWE directory.

This bug is currently scheduled to be fixed in the next version of PLCnext Engineer. Sorry for the inconvenience. ~ Martin.