05-09-2012 06:49 AM
Hi,
I'm using a NI USB-6211 device to measure 3 voltages in Diff-Mode, 3 voltages in RSE-Mode and a encoder output from a motor (Faulhaber 1331T006SR with IE-400 encoder), which gives 400 pulses (rectangular signal) per revolution. I am using the attached .vi to measure the signals and save it as text-file. My problem is, that I need to measure the signals with 500Hz sampling-frequency for around half an hour. I need the data, without interruption, to do some analysis on the data afterwards. The mentioned .vi works, if I measure something like 150k points (I set it with the number of samples) which is around 5 minutes. But if I want to measure more points the programm runs for a very long time and doesn't save anything. I tried to put a while-loop around that stuff and to buffer the measurements in an array and write the data stepwise in a file. To test that I've measured a sine-signal and the inputs, but there was always a small gap between the measurements, when the while loop was reentered.
How can I do this? I wouldn't mind writing the data in a binary if this is faster.
The vis are for labview 2011 and 2009.
best regards,
estanzi
05-09-2012 06:57 AM
Writing to a file doesn't matter if you have seperate loops for Data acquisition and processing. You need to have 2 different loops among one you have to acquire the data as 1 sample per acquisition and run the loop at 500 Hz ( You can use Timed loop for this) and put the data to the Queue. In the other loop you can have it as a normal while loop and read the data from the queue and write it to the file.
05-09-2012 07:16 AM
But the problem with initialising the DAQ-tasks still takes some time, so if I put it in a loop, there still will be jumps in the sine-signal??
How do I create a timed-loop?
How do I put the data in a queue?
And how do I tell the vi that it has to measure for example 4 million values?
Thanks for the answer!
regrads,
estanzi
05-09-2012 07:41 AM
@estanzi wrote:
But the problem with initialising the DAQ-tasks still takes some time, so if I put it in a loop, there still will be jumps in the sine-signal??
You should not put the Initialization into the loop that has to be outside the loop at the beginning.
@estanzi wrote:
How do I create a timed-loop?
How do I put the data in a queue?
You need to go through the basic materials on LabVIEW. Search for Timed loop in LabVIEW help and You may find this to be useful.
@estanzi wrote:
And how do I tell the vi that it has to measure for example 4 million values?
You can calculate the time for which the loop has to acquire the data based on the required samples then stop the acquisition once the data you expected is obtained.
05-09-2012 07:48 AM
You already have separated your setup and data acquistion, so your solution should be fairly straightforward. As mentioned above, you will be implementing a loop around your data acquisition so you can repetitively take data. You will also be putting a loop around your file storage, so it can store repetitively. You will pass data between the loops using a queue (a wire would cause one loop to wait until the other was finished). This is called a producer/consumer architecture, and if you search these forums you will get many hits.
When you do this, you will run into the problem of how to stop both loops. Stop the first loop any way you want (e.g. after X number of points, after a certain time, etc.). When it finishes, enqueue an empty array into the queue. Stop the bottom loop when it gets an empty array. Make sure you close the queue reference after the bottom loop exits. Some other things you may want to do:
Good luck. Let us know if you have more issues.
05-10-2012 02:43 AM
Hi,
maybe this helps you to acquire and save your data.
Here you acquire one voltage signal and write it in a TDMS-File.
My example is based on producer-consumer design pattern.
You can open the TDM or TDMS file with Excel after having installed the TDM Excel Add-In for Microsoft Excel:
http://zone.ni.com/devzone/cda/epd/p/id/2944
TDM and TDMS Data can of course be opened in NI DIAdem:
http://www.ni.com/diadem/whatis/
Producer/Consumer Design: http://www.ni.com/white-paper/3023/en
I hope this helps.
Best regards
Suse
06-26-2012 08:12 AM
Hi,
sorry for the late answer:
I realized the solution proposed by DFgray partly, but if I set the SampleMode to Continuous, then it doesn't work. I get an error 200560, which seems to be a timing error. How can I avoid it. If the SampleMode is set to Finite Samples and I want to read 1000 samples it works well.
Any hints?
Thanks in advance,
Stani
06-26-2012 08:53 AM
Full disclosure - I am not a DAQ guru, so take any advice at this point with a grain of salt. I think it might work if you remove the wait until done VIs. Remove them and wire the 5s timeout into the acquisition VIs, along with the number of data points you want (same value for both). If that doesn't work, try modifying your buffer sizes. Your data rates are relatively low, so you should be able to do this.
Good luck!
06-26-2012 10:14 AM
Hi,
so far this looks like this (see attached vi) and seems to work. I have to do a longterm test and give feedback.
Thanks again,
estanzi
06-27-2012 10:32 AM
Hi,
another Problem:
I have tested this programm with a constant voltage input and a function generator, which provides a rectangular signal as frequency input.
The problem now is, that if I want to measure 60s, I would set it in "time", which changes the stop condition of the acquisition loop to
60s * SamplingFrequency (1000Hz) / Number of samples per channel (100) = 600 Iterations
But the programm runs sometimes longer than 60s, which seems to depend on the frequency of the function generator. If I set the frequency to the sampling frequency (1000Hz), then it takes 4 times 60s. If I set it to 2000Hz, then it takes 2 times 60s.
I played around with it and guess that to get a frequency the device is averaging over 4 rising edges?
Is it the limitation?
How can I make sure that the voltage measurement and the frequency measurement are synchronious?
Regards,
estanzi