LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lost nearly 7min of data, what is causing the jumps?

I have a program which reads both voltage in from my daq and a serial readout of a value. It should be recording this data once a second. But occasionally it seems to skip a data point. Over the course of ~7hrs. I lost about 7min of data as you can see from the attached excel spreadsheet which copies the data column from the tdms file I wrote to. why is this happening?

 

so i cannto seem to attach an xlsx file to this post. but the data looks like, you can see the second missing at 7:29:40:

 

7:29:25 AM 0.428607317
7:29:26 AM 0.63280981
7:29:27 AM 0.146459628
7:29:28 AM 0.420607482
7:29:29 AM 0.227862984
7:29:30 AM 0.789994507
7:29:31 AM 0.69160001
7:29:32 AM 0.522392381
7:29:33 AM 0.083571152
7:29:34 AM 0.559048316
7:29:35 AM 0.024002613
7:29:36 AM 0.91958844
7:29:37 AM 0.668933406
7:29:38 AM 0.939340449
7:29:39 AM 0.531813595
7:29:40 AM 0.475326098
7:29:42 AM 0.587602947
7:29:43 AM 0.166563736
7:29:44 AM 0.162345344
7:29:45 AM 0.851444344
7:29:46 AM 0.174798941
7:29:47 AM 0.864939952
7:29:48 AM 0.521645376
7:29:49 AM 0.623509246
7:29:50 AM 0.131633047
0 Kudos
Message 1 of 15
(3,488 Views)

   

0 Kudos
Message 2 of 15
(3,483 Views)

sorry it was the wrong vi i had to change it. it's uploaded now.

0 Kudos
Message 3 of 15
(3,473 Views)

It is impossible to say from just looking at the code.

 

What are the DAQmx devices?  if they are software timed they will not be exactly syncronized with the system clock.  Not to mention that DAQmx Express vi is not going to be very accurate in timing itself since the DAQmx State transitions are all going to happen every cycle and that DOES take some time in addition to the actual acquisition.  

 

The DAQ Assistant IS the most likely bottleneck Use the DAQmx API to create configure and start your task before the loop and close it after the loop and the timing should greatly improve. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 15
(3,452 Views)

You take 1000 data points, at a 1KHz signal, then you do some math and manipulation, and then you write to disk...why would you think this would take 1second to perform?  Your DAQ alone will take 1 second to get, that is not including the Windows jitter or other operations.  Also how long does it take to perform your serial operations?  You have a timeout of 10seconds so the response of your device could be slowing down your rate as well.

 

If sample rate isn't that critical, or if number of sample points isn't that critical, then I'd recommend changing these.  If you want continuous data then I'd suggest using the Continuous sampling method instead of N samples.  But since you are just averaging them anyway I'm guess it isn't that important.

 

I'd also investigate where the timing delay is coming from.  Again it might be serial not DAQ in which case you will have to get createive, like holding a previous value until a new one comes along.

0 Kudos
Message 5 of 15
(3,449 Views)

it is an ni usb 6210 with a single bnc inputted to it form a device that spits out a voltage.

0 Kudos
Message 6 of 15
(3,441 Views)

the onyl thing i want is a data point every second. have i not set it up this way? the serial port response is using an ni usb232 2 port box which is connected to two devices.

0 Kudos
Message 7 of 15
(3,438 Views)

@labview12110 wrote:

the onyl thing i want is a data point every second. have i not set it up this way?


No it is not, it is setup as I described where a hardware timer will maintain 1KHz sampling rate, and the function will return once 1000 samples have been aquired.  You can change it to be a single sample software timed read, which will return much faster.

 

But again your loop rate will also be determined by how slowly the serial devices respond.  I doubt they take 1second to respond but it is possible.  You will need to figure out if changing the DAQ settings alone is enough.

0 Kudos
Message 8 of 15
(3,432 Views)

How do i change it to be a single sample taken once a second?

 

also how can i time the serial portion of this vi? is there a way to view how long it takes to write, read, and parse while the vi is running?

0 Kudos
Message 9 of 15
(3,426 Views)

Double click the DAQ Assistant function and select 1 Sample On Demand for the aqusition mode.  If this is your issue then this may make it go too fast, in which case you'll want a wait until next ms multiplier to ensure the loop runs once a second.  Or a timed loop.

 

You can check timing with a probe similar to this one which I use.

 

https://decibel.ni.com/content/blogs/EvanP/2010/10/04/simple-sexy-labview-timing-probes

 

It tells you how much time has gone from one error wire to the next.

0 Kudos
Message 10 of 15
(3,419 Views)