LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time mismatch

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. DAQ-Only.PNG

 

 

Thanks.

0 Kudos
Message 1 of 8
(820 Views)

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?

0 Kudos
Message 2 of 8
(779 Views)

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. 

 

Download All
0 Kudos
Message 3 of 8
(673 Views)

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)…

 

  • Move all initialization code before the loop! This inlcudes all the DAQmx code up to the DAQmxStart function and the CNC_HandleAssignee case structure.
  • Avoid those DDT wires and ExpressVIs as much as possible…
  • NEVER delete the label of frontpanel elements…
  • Does your CNC device even support your required sample rate? Why don't you place the CNC code in its own parallel loop?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 8
(648 Views)

@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.

Message 5 of 8
(629 Views)

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.

 

TDMS Data.PNG

 

 

0 Kudos
Message 6 of 8
(606 Views)

The best would be to share your updated code.

0 Kudos
Message 7 of 8
(565 Views)

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

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 8 of 8
(563 Views)