LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing Settings in LabView

We have a LabView Program that is set up to start our pump motor and then read data from a pressure transducer.  We also have a program timer to stop the test after 5 seconds.  The program writes to a file what the pressure was at a specific time.  I want to set of the DAQ timer settings for the pressure transducer so it samples/reads what the pressure is every .01 seconds.  This way I'll have only 500 data point for every 5 second test. 

 

Right now I can select the acquisition mode to run continuous and get way more data than needed or if I change to "N Samples" The samples to read box and Rate (Hz) box are unclear as to what values to put in.  What values and acquisition mode do I need to be in to get a sample read every .01 seconds.

 

 

0 Kudos
Message 1 of 17
(3,968 Views)

Rather than set your task to continuous, use N Samples. The
settings you need will be:

Rate = 100Hz

Samples to Read = 500

 

The rate is obtained from the reciprocal of your period (1/
0.01) and your number of data points will be the rate multiplied by the
duration in seconds.

 

Check out the NI web site there are lots of good training resources
which cover everything from basic to advanced techniques in DAQ.

0 Kudos
Message 2 of 17
(3,964 Views)

I did this and tha data that gets recorded is not what is asked for.  I have attached a screen shot of the program and the data recorded (one can open with the Windows notepad).  Looking at the recorded data it takes readings ~ .00062 seconds for 500 samples, then the time skips ahead from .3 seconds to 1.2 seconds.  It seems as if it will start and take 500 sample readings and then skip over time until 1.2 seconds is reached, then take another 500 samples .00062 seconds aparts from eachother.

 

Please look at this and suggest a countermeasure so that I can get what I want.  Thanks.

Download All
0 Kudos
Message 3 of 17
(3,949 Views)

Why would you attach a word file instead of the actual VI? You've got everything hidden in an express VI so no one can see your actual settings and no one can run the code.

 

You can switch back to continuous but you are liable to get an error because you have the write to file in the same loop. With the suggested N Sample mode, you will get 5 seconds of data all at once. No need to loop or to use the elapsed time function.

0 Kudos
Message 4 of 17
(3,940 Views)

I have attached the "build" that I run.  Please comment about the write to file.  The intent is that we input the pump serial number and then it saves that data individually for each pump under that unique serial number.

 

Plus when I try to attach the VI (program) you website stays, "Please correct the highlighted errors and try again.

0 Kudos
Message 5 of 17
(3,931 Views)

Take a look at the attached vi. I've tried to keep it close to the way you've programmed it with the Express vi's. If you use the N samples method you don't need the Elapsed Timer vi, the hardware will take care of that for you. I've checked out my program with a simulated board, I don't have actual hardware on my PC at the moment, I get the samples as I would expect.

 

The Express vi's will get you started very quickly but may not be good enough if you want precise control over your test. You can't guarantee that your Pressure readings will start exactly when your digital output switches. If you need to be accurate on your triggering you will have to use the vis. in the NI-DAQmx pallet. For now see if you can get your timing right.

 

You need to attach the original vi or a small part of it which demonstrates the problem you're having.

0 Kudos
Message 6 of 17
(3,929 Views)

I have attached our VI to this repsonse.  Purpose of the test is to:

 

1.) Enter in serial # number of pump (this is the file name the data is saved under).

2.) Press the button and run the test for five seconds.  This starts the recording and pump motor at the same time.

3.) Record pressure over time (take a pressure reading from the transducer every .01 seconds).  This way we can graph how long our pump takes to reach pressure.

4.) After five seconds the test stops (stopping the recording and pump motor) and then we can be ready for the next pump.

 

 

0 Kudos
Message 7 of 17
(3,902 Views)

Your basic arithmetic is all wrong. You've specified taking a sample every .002 seconds and the number of samples is all wrong if you really want 5 seconds of data.

 

Lets review the basics that you were given by Ian. If you want a sample every .01 seconds, then the rate is 100 samples/sec (1/.01). If you want 5 seconds of data, then the number of samples is 500 (100 Samples/sec*5 sec). No continuous mode - just N Samples and no Elapsed Time function. Just one single acquisition. Change the mechanical action of your front panel start button to Latch When Released so that the case statement runs just once for each button press.

 

Add a new front panel button to stop the main while loop and you really don't need anything in your false case if you change from a chart to a graph. With a graph, each time you press the start button you would get a whole new set of data displayed.

0 Kudos
Message 8 of 17
(3,897 Views)

We did that and understand the math for the rate and sample qty you are recommending.  We have changed the DAQ block for the pressure transducer to N Samples, the quanity of samples and the rate as you recommeneded.  However, we have done this and still it takes readings every .00062 seconds.  The sample rate seems locked in at that time frequency.

 

Please suggest what can be done to change this (Delta X from .00062 seconds).  Please see the attached document of what data is sampled.  Please help.

0 Kudos
Message 9 of 17
(3,879 Views)

What is the hardware that you are using?

0 Kudos
Message 10 of 17
(3,876 Views)