05-21-2009 02:44 PM
We recently built a new acquisition system that was "almost" just like one we've been using for awhile. There are about a half a dozen problems with it, but here is one of the major stumbling blocks. I am running three finite tasks at three different rates, but then combining them to one .tdms file.
You should probably wince when you read this next part, but I combined the tasks by using a build array function with the concatenate inputs checked. The tasks are as follows:
1. 32 channels at 250 kHz for 1 second
2. 8 channels at 500 kHz for .5 second
3. 8 channels at 2 MHz for .5 second
These are the maximum values we could get without running into a not enough memory error. The goal is about double that amount of data points. I'm guessing that the build array is at the root of the memory problem, but I am unsure how to preallocate the array?
05-25-2009 11:10 PM
To preallocate the array you can call Initialize Array, and then Insert Into Array rather than Build array. If this does not solve the issue, it is also possible to see everywhere that LabVIEW copies the array in the code by going to Tools>>Profile>>Show Buffer Allocations. This will help you determine what other parts of the code you may be able to improve.
-Christina
05-26-2009 06:36 AM
Yup, that part I get. But two nuances. How large do I make the array when I initialize it, and where do I insert the waveforms from the different tasks? Also, I think replacing is better than inserting?
When I tried this the first time, if I initialized the array with the number of data points I wanted to end up with, it gave me an error on initialization that there was not enough memory. We have since moved to a bigger hard drive, not sure if that will make a difference. If I initialize it with less than the number of points than I will end up with, is that any better than building an array? I assume it is.
I'm guessing since there are 32 channels in the first task, I will replace it in the array at index 0, and replace the second task at index 32?
I won't be able to work with this system again for a couple more days, so just trying to get a plan of attack together for when I get there.