LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cpu usage increases due to graph

I am logging three analog sensors in a while loop. The while loop is timed at 100 ms intervals.
When I send 2 sensors to a graph on screen it goes ok, When I want to plot a third graph my CPU usage increases to 100% and thescreen does not refresh smooth anymore.
 
what can be the problem? It does not seems to such a demanding task. The computer is a P3 500Mhz, 512 MB RAM
 
(Within this while loop I placed a second while loop to log the data to a file. This while loop is times at 50 ms because I need the data)
 
Thanks,
 
Arthur
0 Kudos
Message 1 of 5
(3,058 Views)
You should seperate the daq from the analysis/presentation and storage of your data, this whay you can have a DAQ loop running as fast as needed and sending the data via a queue for asynchronous processing and display.  This is the producer consumer model and has worked great for me in the past.  You probably only need to update your graph a few times a second at most since the user will not notice the difference.  Without seeing the code it is hard to diagnos the bottle neck.  Also with graphs I have seen that anti-aliasing can really slow down the process so if you are using this dont for time critical graphing.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 5
(3,047 Views)

You should seperate the daq from the analysis/presentation and storage of your data, this whay you can have a DAQ loop running as fast as needed and sending the data via a queue for asynchronous processing and display.


 

Seems a good solution. How did you do that: having 2 while loops parallel? one for display and one for storage?

Arthur

0 Kudos
Message 3 of 5
(3,044 Views)
I like queues for this sort of thing.  Three loops with two queues.  The first loop (a timed loop) reads the data and puts it in the first queue.  The second loop takes data from the first queue, analyzes it, and sends it to the second queue.  The third loop takes data from the second queue and writes it to file.

Using this strategy, the daq reads are performed on schedule and the analysis and writes fill in the gaps.  Each loop proceeds at its own pace.
0 Kudos
Message 4 of 5
(3,041 Views)

If you are using LV 7.0 or greater open a producer consumer template, place the daq read in the consumer and send the data to a queue, in the producer periodically (use a wait statement or a nother time control method) read out all the (FIFO) queues date (the great thing is that you can make the queue of the same type as the daq data.  Now you can concatinate the data and process and display it.  I like to save all this data to file outside of the consumer loop.  The producer (daq loop will run as fast as possible while the consumer is asynchronous running as timed but never faster than it is supplied data.  two loops next to each other are automatically parallel in labview and can be synchronized by a queue, notifier, occurance or any other synchronize object.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 5
(3,028 Views)