12-28-2023 10:34 PM
Hi,
I am trying to make a VI that acquires data from two different devices- The DAQmx and a CNC Controller. I wish to take data from the two devices at the rate of 10 samples per second and write them to a .TDMS file along with absolute time when the reading was taken. The VI runs, captures data and writes them to the file but there seems to be a mismatch in timings.
For example, if I take readings from 09:00 AM to 09:30 AM, the .TDMS file absolute time column shows that the recording was taken only up to 09:25 AM. It also appears that the last value taken at 09.30 AM is same as the last value in the .TDMS file which means it is missing some values in between. The DAQmx values without CNC Controller seems to work fine without any data and time lag. I had tried wiring time stamps, build waveform functions and still this problem exists. I just want the data from both the devices to be logged every 0.1 second in a synchronous way.
I have attached the VI and the pattern of .TDMS file that I need for your reference. Requesting someone to help me on this topic.
Thanks.
12-29-2023 03:51 AM
Hi, consider uploading a vi snippet (png) Without having a look on your code: Did you try to write every column to a different channel?
12-31-2023 11:11 PM
Thanks for your reply.
I have attached the snippet of my code below. I request you to kindly ignore the 'Handle Assigner' SubVI. I have also also attached the specifications of Write to tdms express VI.
01-01-2024 10:51 AM
Hi dspredeep,
@dspredeep wrote:
I am trying to make a VI that acquires data from two different devices- The DAQmx and a CNC Controller. I wish to take data from the two devices at the rate of 10 samples per second and write them to a .TDMS file along with absolute time when the reading was taken. The VI runs, captures data and writes them to the file but there seems to be a mismatch in timings.
For example, if I take readings from 09:00 AM to 09:30 AM, the .TDMS file absolute time column shows that the recording was taken only up to 09:25 AM. It also appears that the last value taken at 09.30 AM is same as the last value in the .TDMS file which means it is missing some values in between. The DAQmx values without CNC Controller seems to work fine without any data and time lag. I had tried wiring time stamps, build waveform functions and still this problem exists. I just want the data from both the devices to be logged every 0.1 second in a synchronous way.
Your VI is quite complicated (and full of Rube-Goldberg code)…
01-01-2024 06:47 PM
@dspredeep wrote:
Thanks for your reply.
I have attached the snippet of my code below. I request you to kindly ignore the 'Handle Assigner' SubVI. I have also also attached the specifications of Write to tdms express VI.
I suggest not to use the tdms express vi here. I would write every column of your desired table into a seperate tdms channel.
01-02-2024 05:50 AM - edited 01-02-2024 05:52 AM
Thank You GerdW,
When I tried to keep all initialization code before the loop, the DAQmx start function returns an error message. However I tried to reduce the complexity of my code and followed other points suggested and almost arrived at the solution. But as you can see in the attached snippet of the file that was written the absolute time values aren't precise at milli second levels. Requesting you to help me with that.
01-02-2024 07:23 AM
The best would be to share your updated code.
01-02-2024 07:29 AM
Your timing could be affected by the wait function (upper right). Try using "Wait Until Next ms Multiple" and see if that helps
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P82BSAS&l=en-US