Showing results for 
Search instead for 
Did you mean: 

Waveform chart from network shared variable

Waveform chart from network shared variable



I am running a data aquisition routine on a Realtime Desktop PC. I log all of the data on the target PC and perform feedback operations based on analysis that also happens on the target PC.


In addition to this, I want to send the data to the host PC and display it on a waveform chart. The data arrives at the host as a network shared variable of type "array of waveform" and contains four elements with 1000 datapoints each.

The realtime PC updates the shared variable with new data every 10ms.


Here is my problem/question: I can easily display the new data in the waveform chart (i.e. the chart's x axis is 10ms long and the entire data in the chart changes every 10ms). This is not what I want though. I want the data to "scroll from right to left", i.e., I want to see about 5s worth of data, with the leftmost 1000 datapoints being deleted every 10ms, and the newest 1000 datapoints being attached to the right every 10ms.

What is the easiest way to do this?


It seems like this would be a common scenario and there should be an easy way to deal with this. A "first in first out" buffer would be ideal, since everytime I would add to the buffer it would delete the oldest datapoints to make room for the 1000 new datapoints. I could then display this buffer in my waveform chart (I have not found such a "first in first out" buffer implementation in labview. The RT FIFO does not do this, as far as I understand.)


Of course I could (and would) write my own, but this seems like basic functionality that may be available and I just do not know what it is called and where I can find it.


Thanks for all help!



0 Kudos
Message 1 of 2

Re: Waveform chart from network shared variable

With a 10 msec update rate you will want to use a producer/consumer architecture where the data acquisition loop is the producer and it passes the acquired data to a consumer loop through a queue that handles the charting functions.  A 10 msec update is probably faster than you need as the human high is really not going to keep up with a 100 changes in the graph a second.


In the consumer loop, dequeue the data and append it to the end of an array that you store in a shift register.  Check the size of the array and if it exceeds a certain size, than use array subset to  get the array starting at a 10 msec point to the end and send that to the XY or waveform graph.  You are essentially creating your own circular buffer.


With trying to keep up with a 10 msec update rate, you may need to optimize the array functions so that they can run as fast as possible. 

0 Kudos
Message 2 of 2