LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save from 8 AI channels to seperate files

I am having trouble saving 8 (upto 12 Analog Input) channels to seperate files. The sampling rate is 100kHz, sampling time = 10sec., resulting in a total of 1,000,000 data points each. I tried using the Write LVM daq assistant vi (I tried both lvm and txt files), however, after writing a few files, a message saying,"ran out of memory" is displayed and the program quits.
Also, using the Write LVM vi, one can choose to not save the time column. But it still saves an empty column full of spaces " ".
What is the best way to save 8 to 12 channels of data with and without time, without running out of memory?
My system consists of a 1042 chassis housing 2 PXI-6133 cards. The chassis is connected to a remote PC running Windows XP, by means of fiber optic cable. The PC has about 2.5 GB of RAM installed. Also the virtual memory has been increased to about 3500 MB. The chassis has onboard RAM, the quantity of which I am not sure of.
It is probably a matter of using the resources wisely. I am not a good LabView programmer and so any help would be appreciated. Thanks.
 
0 Kudos
Message 1 of 16
(3,411 Views)

Yes, you will have to be very wise concerning resource utilization. Assuming your data is single precision floats @ 4 bytes per value, you are looking at 4Mbytes per channel of data, or 32M for all 8 channels, or 48M for 12 channels (if the data is double-precision floats, double all the numbers). Given a raw dataset of this size the code doesn't have to be very inefficient to use-up truly awe-inspiring amounts on memory--which it apprently is...

Question: do the datafiles need to be human readable, or can you store binary data? If you can store binary data the files will be smaller and the memory usage will be lower.

Also, can you post your code?

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 16
(3,401 Views)

Yes, at this point, I am desperate, willing to try anything. I only wish that a graphing s/w such as Matlab or Techplot can read the data and also Labview itself. Anything that won't cause the VI to hang or quit with valuable data in memory will be a life saver.

I shall post my code tomorrow when I get back to my lab PC. Thank you once again.

0 Kudos
Message 3 of 16
(3,397 Views)

Hi There

save in binary format , it is possible for matlab to be able to read saved binary format .You just have to modify data

to readable format.

Show us some code  then we can help.

chow

xseadog

0 Kudos
Message 4 of 16
(3,390 Views)

Hey PKP,

      Your post made me wonder if it was reasonable to store data as fast as you're wanting to.  On my 1.4G Centrino (Toshiba laptop), it's borderline - because of occasional extra-slow writes.

Here's the VI I used to test with.  Here, it takes practically no time to generate fake data, but if your DAQ (and any subsequent processing) is significant, you may be able to do the DAQ in parallel with the file IO, (acquire the first data-set, acquire the second data-set while filing the first, acquire the 3rd while filing the second, etc.)

Cheers

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 5 of 16
(3,380 Views)

My test requirements are such that all channels have to be recorded simultaneously and so a sequential capture and write process would not work.

I am attaching my program in which I have only 6 channels writing into individual files. I have to finally increase the number of channels to 12, to record quantities such as pressures, flow rates, and outputs of load cells, accelerometers, etc.

Thanks,

Philip

0 Kudos
Message 6 of 16
(3,363 Views)
I think you would be much better off if you got rid of the DAQ Assistant and the dynamic data and used the DAQmx functions directly and read and write binary data. Look at the shipping example called Cont Acq&Graph Voltage-To File(Binary). It acquires data as I32 and writes the same. You can easily modify it to write each channel to a separate file and Matlab or another LabVIEW program can read them.
0 Kudos
Message 7 of 16
(3,357 Views)

@PKP wrote:

My test requirements are such that all channels have to be recorded simultaneously and so a sequential capture and write process would not work.


My example simulates a DAQ process, returning/logging 10 channels "simultaneously", continuously.  In your case, you would stop the process after 10 seconds.  This way you don't need to have a 32 (or 48Meg) DAQ buffer, however, you would have to empty a [smaller] DAQ buffer periodically, before it overflowed.

Note that while your Channel-scan rate is 100KHz, there's (probably) one, shared, AtoD conveter on the DAQ board, in which case the first sample from channel 0 and the first sample from channel 1 are actually acquired at [slightly] different times.

Cheers

Message Edited by Dynamik on 09-12-2005 04:00 PM

Message Edited by Dynamik on 09-12-2005 04:01 PM

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 8 of 16
(3,348 Views)

Thanks Dennis. I tried the VI you mentioned and it works quite well. I was able to put a logical condition so that it stops recording after 10seconds. Also I was able to use another VI to read the data and use it to write a txt file from the binary file.

Now, I want to acquire up to 12 channels of different quantities and units. Can I just repeat this circuit diagram12 times in one VI , and specify each signal's scaling and units seperately, or is there a way to seperate the individual channels out of the task and then save them seperately?

Thanks

Philip

0 Kudos
Message 9 of 16
(3,339 Views)
You do not duplicate this example 12 times. If all of your channels were the same, then all you would do is in the physical channel something like Dev1/ai0:11. Since you want different settings for each channel, then what you do is have a separate DAQmx Create Channel for each setting. For example, if channels 0 thru 3 are to have an NRE setting, min of -5, max of +5, and channels 4 thru 8 are Diff, min of -1, max of +1, then you have one Create Channel with Dev1/ai0:3 and another with Dev1ai4:8 and the correct inputs for terminal configuration, minimum value, and maximum value. You don't have to have contiguous channels either, You can specify Dev1/ai0,ai3,ai7 or whatever. When you want to separate ot the read data for writing to separate files, use the index array function. Each channel will be a 1D array out of the 2D array being returned by the DAQmx Read.
0 Kudos
Message 10 of 16
(3,207 Views)