LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time Problems

We want a program to take voltage and time data for a specified time at a given sampling rate (typically tens to hundreds of seconds at 10Hz). I'm using a DAQmx vi to interface to the PMT with a NI USB 6009, 8input/14bit. I've run into two problems having to do with time:

 

1. When I save the data after the loop executes (the write to measurement vi that's outside the while loop), timing data is lost. Note that in the "outside" text file (from the screenshot), there are iteration numbers or something in the time column (0,1,2...etc.). Why? And, how can I retain the time data? I'm thinking of using an array, but I'm not sure. Basically, I want the data saved "inside" the loop (see "inside" text file screenshot) to be the same as that saved outside (because I want the "save" prompt to occur at the end of the program execution). 

 

2. I have a millisecond timer in the loop and it's seems to be working fine (if you look at the time data from the inside loop save). But, notice the lapse between time = 0 and the next data point. Is it a delay in my program? I'm thinking probably, but how can I (or can I) get rid of it?

 

Also, if you have some critique of my labview skills, please share them. I'm a noob here.

 

0 Kudos
Message 1 of 3
(2,232 Views)

1.) You are losing the timestamp when you convert from dynamic to DBL

2.) You are using the wait until next ms multiple.  Check out the help for the timing functions.

 

Typically, you would setup a DAQmx task to take the measurements at the required sampling rate and then read the data at a specified interval.  Have a look at the "producer/consumer" architecture.  It's not very efficient to read every single data point, even at 10Hz. 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 2 of 3
(2,191 Views)

1. You are losing the time data when converting from Dynamic Data Type to an array of DBL.
2. I would guess that the first time you loop goes around, your USB 6009 is being configured so it takes longer than normal to execute.


Critique:
Using auto indexing on a while loop is considered bad practise because it is not known at run time how much memory to allocate to LabVIEW has to constantly keep allocating new memory at run time which is bad for performance.


When performing DAQ it is common to stream to a file inside the loop like you are and not save it all up until the end and do one big file write.


Try to keep code clean and readable. Avoid wire bends and data flowing from right to left.

Lewis Gear CLA
LabVIEW UAV

0 Kudos
Message 3 of 3
(2,184 Views)