Store the data (acquired in 1ms interval) into SD card
Hello PLCnext team,
Our customer would like to use the DataLogger feature on AXCF2152 to store the data from connected pressure sensor with Axioline F (AI8 1F).
They need to acquire the data on all 8 channels from pressure sensor every 1ms. Then, they need to store the data into SD card in csv format.
So, we tested it by using DataLogger FB, but we found data gap in the aquired csv files.(Please find the tested project file and the result
csv file in the following URL http://intrans.europe.phoenixcontact.com/transfer/index.jsp?id=1967854171&pwd=kThguxP8P8)
We understand that such higher data sampling rate causes the data gap due to CPU performance limitation.
But, we'd appreciate it if you would give us any good idea to perform this customer's requirement.
Sincerely,
Hiroki Kannon
Comments
Hello Hiroki,
It appears that you are using the Datalogger FB library from the PLCnext Store. Note that this data logger is completely independent from the data logger that is included with the PLCnext runtime.
You will not be able to achieve 1 ms logging frequency with the data logger in the PLCnext Store. In order to achieve this level of performance, you must use the data logger in the PLCnext runtime. This data logger is described in the Info Center, here:
https://www.plcnext.help/te/Service_Components/DataLogger/DataLogger.htm?d_f=false
The data logger stores information in a sqlite database. You will need to write your own program to copy the data from the database to a file in CSV format.
Hope this helps.
~ Martin.
Dear Martin-san,
Thank you so much for your advice.
Yes, I used the data logger in the PLCnext store.
As instructed, I tried the data logger in the PLCnext runtime. I got better result.
I confirmed that the data logger was able to store the acquired data without any gap every 5ms.
But, the data logger was not able to store the acquired data without gap every 1ms. I saw that
gap occurred sometimes. (Please find the resulted sqlite data and my data logger configuration
in the following URL http://intrans.europe.phoenixcontact.com/transfer/index.jsp?id=593595412&pwd=5pRqDnmQHw)
Do you think that's a reasonable result ?
or
Is there still any chance that the data logger store the data without any gap every 1ms ?
Sincerely,
Hiroki Kannon
Hi Hiroki,
Our resident expert on the data logger has had success logging at 1 ms with the following settings:
(sorry for the image, but this forum does not like angled brackets):
Obviously you can set the "name" and "dst" attributes to suit yourself.
Please let us know if this improves the performance.
~ Martin.
Hello Martin-san,
Thank you for your prompt reply and helpful advice.
I tried your data logger configuration and confirmed the performance improvement.
The data logger could captured the data without any gap every 1ms, Thanks!!
I'll keep testing.
BTW,
I have a few questions about the conversion the format from sqlite to csv.
When adding a program for the data format conversion on the AXCF2152, do you think the AXCF2152 can keep the 1ms data logger operation ?
If yes, would it be possible to provide a sample program for such data conversion ?
Sincerely,
Hiroki Kannon
Hi Hiroki,
Yes, I think it would be possible to run a separate program and maintain performance.
There are many different ways you could write and run such a program. One option is to write a C++ application and run it as a linux cron job, or as a daemon. You could also write the program in another language like python, if you want.
There is a simple example showing how to access a sqlite database from C++, here:
https://www.plcnext-community.net/en/hn-makers-blog/368-how-to-use-sqlite-in-a-plcnext-c-project.html
On the CSV side, this would involve writing formatted output to a file stream, which will be a fairly standard process in your language of choice.
Hope this helps.
~ Martin.
Hello Martin-san,
Thank you for your helpful advice.
I understand. I'll try some of these ideas.
Sincerely,
Hiroki Kannon