08-03-2009 10:26 AM
Hello all,
I have to keep some waveforms in memory (about 16). Theses waveform are growing with time. I keep them in an array and I add data to them with the WDT Append Waveforms DBL.vi.
The array is kept in shift register so I can use the data anywhere in the project.
Does anyone know a better way (less ressources consuming) to do that? This is the most consuming part of my application so I would like it to be fully optimized.
I attached a image to illustrate.
Thanks in advance!
Vincent
08-03-2009 10:41 AM
Do you know how long these waveforms may become? or can you limit it somehow? I always preallocate space for data, and then come up with some scheme to handle data when it gets longer than the preallocated amount (store it to disk, throw it away..). If your waveform can grow unbounded, your program will eventually crash. There are some things you may be able to do to forestall the inevitable, but a better approach would be to make some decisions that will prevent the crash.
Chris
08-03-2009 10:59 AM
For what I've been told, the acquisition should run for a maximum of 2 hours at a rate of 500Hz.
So 500x60x120x4= 14400000 Bytes. -> about 14Mo per channel so about 224Mo if all channels are used.
I think the computer will be dedicated to the application so it should be ok...
Preallocation is indeed a better way to handle arrays. Since i'm adding data to the waveform by chunk (not 500 times by second), it's not so bad. Depending of the configuration, I could add for exemple 10 chunk of 50 data per seconds. I don't know if preallocating will boost performance significatly. I think I'll have to try. I guest the easy way to do that would be to keep another array with the index of the end of data for every waveform...
Thanks!
08-03-2009 11:11 AM
An alternative approach would not put the arrays together until they are required. Just the let the WF's sit in a queue then only read them and assemble when required.
Ben
08-03-2009 11:20 AM
Hello Ben!
This seems to me like a clever idea. I will definetly have a try since I don't think it will involve too much work and changes.
Thanks for your help!