LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to efiiciently plot data in graph

I want to acquire onesignal at 1 k freq and plot it contineously. the data should get appended to the graph. but i cant use the chart control for two reasons
1. all the data from 0 time should be visible on screen.
2. i want to dynamically place some markers which will point some perticular analysis in real time.
 
i have written one program for this but when i run it it contineously shows 100% CPU usage and data in acquisition buffer keeps on increasing. if i reduce the sampling rate to say 20 CPU usage drops down to 20 to 30% how should i improve my code. my test should run for atleast 1 Hr.
 
i suspect following may be the problems.
i get around 200ms data in one read operation in loop and i have used build array function to append new data points in the graph control (hence all the data gets plotted in each loop iteration)
in each iteration i have to check whether to do autofit and perform the operation (because client wants X scale to be configurable and if test continues beyond that time then scale should be changed to autofit)
there are 4 more graphs on the same screen (but they get 20 points in one second)
 
one more observation is that the whole graphs blinks quite often while ploting the data
 
please suggest me solution

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 1 of 3
(2,713 Views)
How long is this supposed to run? How big do your arrays get???
 
Building arrays in a loop is a performance bottleneck because it constantly needs to reallocate new memory.
 
Sending huge amounts of data to a graph at high rate is also very expensive, especially if you use autoscaling and fancy point and line styles. You could place the graph terminal inside a case structure and update it at a lower rate (e.g. every 5 iterations).
 
It the array is large, you should also reduce your data. It does not make much sense to send 1'000'000 points to a graph that is only 500pixels wide, right?
Message 2 of 3
(2,707 Views)
How long is this supposed to run? How big do your arrays get???
>>Test is supposed to run for max 1 HR, but most of the times it gets finsihed in 15 mins.
 
Building arrays in a loop is a performance bottleneck because it constantly needs to reallocate new memory.
>>yes, i understand, but is their better way to do the thing? i think allocating array for 1HRs data is not at all pratical, aslo in my test having some default value of data (which happens if i preallocate the array) is not acceptable.
 
Sending huge amounts of data to a graph at high rate is also very expensive, especially if you use autoscaling and fancy point and line styles. You could place the graph terminal inside a case structure and update it at a lower rate (e.g. every 5 iterations).
>> i think i have implemented it in better way. i read 200 samples from DAQmx read VI (1/5 th of a sec.) this automatically eliminates the need of using unnecessary build array (refresh rate more that that is not acceptavle as  the end user wants to see changes as the test progresses)
 
It the array is large, you should also reduce your data. It does not make much sense to send 1'000'000 points to a graph that is only 500pixels wide, right?
>>yes what you are saying is very much acurate. and i tried in this area as well, i tried to take 1 out of X samples and plotting it, taking avg of X samples and plotting it, taking max of X samples and plotting it but all of them give some type of distrotion in my data. can you please suggest any better method. btw my signal is actually mixture of two parts one is high freq. component and other is low freq. component riding over it. and when i tried to reduce the number of points to be plotted low freq component was getting distorted.
 
thanks
Tushar

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 3 of 3
(2,688 Views)