LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

xy graph questions

Hi,

I'm working on a dataacquisition system on my internship and therefore I'm trying to plot multiple values in a XY graph.
This all works fine now, but after a couple of seconds the XY graph stops updating.

I put several tests in the code to see where it did go wrong, and it seems like the express VI im using doesn't work after a couple seconds.

Also, I'm looking for a way to just enter new values into the XY graph without supplying the entire array of values. (which is VERY big, because of the 8 channels that update within every couple miliseconds)
Another thing I was wondering about, for this assignment I need to plot every possible channel to another channel. That's why I'm using a XY graph.
Should I do this by making 8 different XY graphs and then with a case structure check which one I should update, or is there another way?

Thanks in advance,
Jaap

Message Edited by k0ewl on 01-02-2006 04:22 AM

Download All
0 Kudos
Message 1 of 5
(2,944 Views)

Hi,

In your VI, you are not groupling the corresponding x and y arrays to plot each curve on the xy graph.

In the atttached VI, see how to plot multiple sets (x, y) on a single xy graph.

keep entering new xy values into the array and observe how the graphrescales to fit updated curves.

Hope this helps

regards

Dev

 

0 Kudos
Message 2 of 5
(2,920 Views)
Your two arrays (x and y) are mismatched in size, one grows in columns and the other in rows. After about 8 measurements, you'll only see the beginning of the data.
 
Here are some tips:
  1. Get rid of the sequence structure, it is not needed. Most things can be initialized as shift registers.
  2. Get rid of the local variables and use shift registers instead. local variables cause extra data copies.
  3. use only one loop and get the real elapsed time.
  4. If you want to update the graph less often, just check if 50ms have elapsed since the last update.
  5. Use latch action on the stop button.

Attached is a quick draft (LabVIEW 7.0).

Be aware that the program is still quite flawed and you'll run into memory issues pretty quickly by growing arrays without upper size limits and sending them to an XY graph. How long is this VI supposed to run? You could e.g. stream the data to disk and only keep e.g. the last 1000 points in the shift register.

0 Kudos
Message 3 of 5
(2,917 Views)

Just insert a Transpose Array before feeding the Y data to the graph, as in the attached picture.

This being said, you are overusing local variables and there is little chance that your vi will run at the expected rate, since a lot of time will be wasted making copies of the array and adding new lines of data to it.
What you should/could do is :
Fill a presized array with NaN values and use a replace array element, this will avoid requesting a new memory allocation at each loop iteration.
Use a shift register to store the data at each iteration instead of using local variables;
Use a separate array for the time data, this will avoid being obliged to slice the big array before each plot refresh;
Reduce the refresh rate of the graph display, 200 ms is more than enough for just data visualization.
Consider using a queue to pass data from the acquisition loop to the display loop, etc...
 
You should also read this thread
.
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 5
(2,914 Views)
Thank you very much for your help.

The reason why I did it this way is because of the flexibility of the program.
It will be used to measure 8 analog input channels, which can be anything, and to output 2 analog channels with a PWM signal.
Also the XY graph is used to display any of those channels plotted against time, or anyone of the other channels.
another reason is to make sure that the graph updates at 50ms and the measurement is at the ms the user enters.

And the measurement will sometimes be at a stunning speed of about 10ms to measure oscillation.

So, i'll keep the changes you made in mind and i'll change my program so that it is still simple to explain to newby's (like me, and other students) and doesnt take to much CPU power.

Thank you very much everybody Smiley Very Happy

0 Kudos
Message 5 of 5
(2,908 Views)