Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

allocate a big memory on the host

Hi,

 

I was stuck on another porblemSmiley Sad. I am doing a high speed data aquisition of 10 channels all at 51.2ks/s. It is a triggered acquistion with crio 9024. I need 30s data before the first trigger signal and another 30s data after the last trigger signal, and also the data in between the first trigger and the last trigger event (a duration of about 3mins). Therefore the total data acquisition each time is about 4 or 5 mins. I also need the the trigger module sychronized with the sound and vibration modules (9024) and sampled with the same rate. This has made the detection of the first trigger and last trigger almost impossible to implement on the FPGA.

Therefore I definitely need a way to allocate a large memory on the host to hold the data before saving to a file,  especially to contain the pretriggered data which should be kept at a fixed size and dynamically updated. I planned to use an array to do the job but unfortunately, the cpu usage increases dramatically with the increase of the array size. Is there any other way to create a big memory on the host which allows me to operate easily, like delete some part and repalce some part of its contents but without choking the cpu? 

 

Regards

wenxu

 

 

0 Kudos
Message 1 of 6
(4,401 Views)

Anyone can help please. thanks

0 Kudos
Message 2 of 6
(4,374 Views)

The standard way is to use Initialize Array outside a loop.  Connect the array to the loop via a shift register.  Inside the loop update the array using Replace Array Subset.

 

Read the detailed help for those functions.  Also search the NI web site for a document on handling large arrays in LabVIEW.  It contains much good information on how to manage largte amounts of data without making extra copies or moving the data unnecessarily.

 

Lynn

0 Kudos
Message 3 of 6
(4,371 Views)

Thanks,Lynn.

 

I have already tried this method but it does not work. It still causes very high CPU usage. I think the CPU usage does not depend on whether the array is pre-initialized or not but how the CPU processes the array (like in a parallel or sequential order ). I am wondering whether there are some other ways instead of using an array as a data buffer though I very much prefer this mehtod.

 

Regards

Wenxu

0 Kudos
Message 4 of 6
(4,367 Views)

Please post your code.  Without seeing the code it is difficult to offer anything other than graod generalities.

 

Lynn

0 Kudos
Message 5 of 6
(4,357 Views)

Hi Wenxu, 

 

You may also want to try building the array using a for loop with auto-indexing. Because the size of the for loop is predefined (wire a constant to it), the compiler can treat the structure as a constant. Since the number of iterations of a while loop are determined at run-time, it is not the most efficient method. Please see this example for how to use auto-indexing with for loops and this help document for more information on loops.  

Julianne K
Systems Engineer, Embedded Systems
Certified LabVIEW Architect, Certified LabVIEW Embedded Systems Developer
National Instruments
0 Kudos
Message 6 of 6
(4,347 Views)