LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform Array

I am acquiring some temperatures and plotting them to a waveform chart
at a rate of about 1 a second. If I wire the data straight to the
chart, the buffer is limited to 1024 points and I have no problems.
If I keep all of the waveform arrays in a 2D array, keep the array
limited to 1024 points, and update the chart through the History
property node once a second I have serious problems. Everything is
fine at first, but after the VI runs for about 20 minutes my processor
usage jumps to 100% (from 10%) and my available memory goes way down.
I am using the Delete From Array function to remove the zero index
every reading after it reaches size of 1024. Does using this somehow
not release the memory? The description says that it resizes the
array when it
deletes. Any thoughts?

Thanks
0 Kudos
Message 1 of 4
(3,040 Views)
You should take care to limit resizing operations on arrays, because they are expensive.

It seems you delete the first element, then add a new element at the end. These are two resize operations per iteration!!!

There are better ways to keep the array "in place".

(1) Stick to "replace array element", indexing into the oldest element and keep track of the index.
(this will give you a scope type chart)

(2) rotate by one, then replace the oldest.
(This will give you a chart)

In both cases the array size is constant, which is important. Place the array into a shift register, initialized with a 1024 size array of zeroes, then tap into it as suggested.

(there are a few other ways to do this, but these examples should give you a starting point).
0 Kudos
Message 2 of 4
(3,040 Views)
There is an example vi (XY Chart.vi) under LabVIEW help Chart Examples. I think it provides what you need to tackle this problem.
0 Kudos
Message 3 of 4
(3,040 Views)
SysApp,

We have found issues with te Delete from Array function in LabVIEW 6.1. To actually make the function work properly, one needs to wired the deleted part to something. This will then free the memory properly. The issue is being looked into by R&D.
You can also change the buffer size of the chart by right-clicking on the front panel and choosing Chart History Length. This operation can only be done on the front panel.
If you need to save this much data, I would suggest logging the data to a file. I also agree with altenbach that the approach being taken is an expensive one processor wise.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 4 of 4
(3,040 Views)