03-09-2011 09:00 PM
Okay, I am pretty new to Lab View, and would appreciate suggestions of how to approach a problem.
My only LabView experience has been writing a simple .vi to acquire voltage signals in a loop at a certain sample rate, get 5 of them each time the loop iterated (it did so every second), average the 5 samples, and dump them into a file at every loop iteration.
That was for continuous data acquisition while viewing/monitoring the data at the same time, and was probably not the most efficient way (or even a good way) to do it.
Now, I am doing something different. I want to record voltage signals but only after a trigger event has occured, and only until a certain time window after the trigger event.
Should I use continuous data sampling?
Or should I sample "N" samples?
Should I use "producer / consumer" structure?
Should I continuously log to a TDMS file (I just started reading about that.... I used lvm files before....)?
I am very confused. I have enough programming knowledge to be dangerous, but am very new to Lab View. Any quick pointers to get me started? This is sort of time-critical....
Thanks a lot
-Jay
03-10-2011 12:13 AM
Jay,
There are quite a few examples in the example finder of how to implement various types of triggers IIRC.
How long is your time window and how fast do you want to sample? That will probably determine whether you want to use N samples (for shorter time windows where all your samples will fit in the hardware buffer) or continuous (for when you will want to make several reads before you have enough data).
Producer/consumer is a very versatile design pattern. If you have a long running acquisition that you'd like to be able to cancel or update the UI mid run then you might want to use it. If, on the other hand you are doing a quick (in UI terms) acquistion then there may not be any need. Templates and design patterns also become more important the longer you plan to keep the code around -- the more you plan to maintain and add onto the VI the more thought should go into the design.
File format is often a personal preference. TDMS is a richer file format (faster, smaller, IMO normally better) than LVM (essentially just a text file). TDMS files can be opened in Excel with a plugin or natively in any NI tools (LabVIEW, DIAdem etc.) Text files such as LVM can be opened with just about anything. One thing that may force your decision is if you are acquiring large amounts of data quickly (too fast to buffer in RAM) then you'd definitely want to use TDMS as it is much faster and gives your hard drive a chance to keep up with the inflow of data.
Good luck, let us know how you get on.
~Simon
03-10-2011 07:28 AM
Simon,
Thanks for the insight.
The time window of data I need to acquire is about a second or two, max. The voltage time-histories I am recording happen very quickly and last on the order of milliseconds.
Perhaps sampling a set number of samples at a very fast rate is the solution. "sampling" and "sample rate" still give me problems sometimes, conceptually. For example, figuring out how many samples to take and how fast to do it.... I guess I need to find some guidelines for this.
Perhaps TDMS is a good file type to use. The new DAQ system I am using has two PXIe 6358 cards - so I think I have the hardware capability... just need to figure out how many samples I can take. I guess I want the highest data "resolution" as I can get for the time window I'm interested in....
As far as implementing triggers, I think I can do it using a DAQ assistant vi, but I was reading last night that it might be better to use the "lower" level DAQmx vi's because they are more efficient. But, perhaps for my applicaiton, the possible inefficiency of the DAQ assistant vi won't have much of an impact?
I really appreciate the guidance...
03-10-2011 11:31 AM
The 6358 is a very capable board so you should be able to go up to 1.25MS/s.
Use N Samples when you know how many samples you want to collect (or in your case, if you know how long you want to acquire for, multiply that by your sampling rate -- 1 Hz being one sample per second so if you want 2 seconds worth of data at 1MS/s then your number of samples is 2M).
Use continuous sampling when you just want to keep acquiring until you tell it to stop.
By the sounds of things the DAQ Assistant will work just fine for you. Assuming you just want a normal digital or analog trigger you can set it up on the appropriate tab and as long as you're using the latest version of DAQmx you'll also be able to save the data directly to a TDMS file as it's acquired.