From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform chart running slow... Any suggestions??

Hi everyone,

 

I have developed the attached application for some post-graduates to acquire their research data... I have a bit of an idea about labview programing, but still have a alot to learn..

 

I am trying to build a user friendly application for the stduents that includes a device self-calibration function and two other standalone instruments for data collection... The problem lies in the Voluntary testing instrument (the instrument is not quite finished, but works ok for testing)... Data are acquired continuous using a while loop with a sampling rate of 2k and reads 100 samples per loop. The waveform chart display in Voluntary Testing is slow after the instrument has been run a few times. The chart buffer history length is 1024...

 

Does anyone have any ideas about how this might be happening and how I can avoid the slow display?? Any and all assistance greatly appreciated.

 

Thanks,

Jack

 

 

0 Kudos
Message 1 of 7
(4,527 Views)

Hi,

 

I checked your VI and I think most of it are not so well orgnized. So I strongly recommend you using Find Examples under Labview help menu and go through the DAQ examples.

 

Now, let's go through your VI. (sorry I don't have DAQmx installed, so I'll just list some of the problems)

1. The while loop runs only once, and so does the for loop. So you can remove them.

2. You need to wire a DAQmx stop VI and a DAQmx close VI to actrally stop the device from collecting data. There are many examples in Labview.

3. A sampling rate of 2k means you are getting 2k points for every second, so I don't think reading 100 sample each time is a good idea.

 

Anyway..... I suggest you spend some time looking at DAQmx examples.

 

Cheers. 

0 Kudos
Message 2 of 7
(4,513 Views)

Hi Z. Chen,

 

Thanks for your comments... Just to clarify, I understand the stop and clear vis and loop changes... About your comments on organisation, do you mean the vi coding is messy and should be tidied up for clarity, or is the code poorly written and inefficient? Also, should I read more or less data points than 100 when sampling at 2k?

 

Thanks again.

 

Jack

0 Kudos
Message 3 of 7
(4,498 Views)

It's a good start, although there's always room for improvement.

 

Some strange things:

- You only read the tab control at start pf program, meaning you cannot change behaviour while running the program, move it inside the loop.

- 2ms wait in main loop seems low, set it to 10 so you collect samples 100 times/sec instead of 500 (or even slower)

- You initialize the DAQ every loop, initialize and close outside main loop. (you kind of solved that in the inside loop)

- 1 run loops can be scrapped, unless you want to use an uninitialized shift register as memory.

- your measurement loop doesn't have any wait at all

- If your Save is active you'll try to write to file some 2..3..5...lots of times per second, which ofcourse wont work.

 

Basically, if you have a sample time of 2k in the daq, how often does the measurement loop need to run?

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 7
(4,492 Views)

Hi,

 

For basic data DAQmx, acquier->display->save, please refer to C:\Program Files (x86)\National Instruments\LabVIEW 2010\examples\DAQmx\Analog In\Measure Voltage.llb\Cont Acq&Graph Voltage-To File(Binary).vi

 

For more advanced programming, it is suggested that you look for the queue at C:\Program Files (x86)\National Instruments\LabVIEW 2010\examples\general\queue.llb\Queue Basics.vi

 

Idealy you'll need to have the conbination of the two VIs above. You'll need to have two while loops, one running data acquirsation and poping them into the queue. The other while loop is dequeueing the elements and you can put

display and file save after the data element out.  

This is called a Producer/Consumer Design Patten, which you can find an already built one when you create a new VI using the Labview templates.

Simply go to New .. -> VI -> From template -> Frameworks -> Design Patterns -> Producer/Consumer Design Pattern (Data)

0 Kudos
Message 5 of 7
(4,485 Views)

Hello jcannon

 

Can you please update me on the status of your issue?  Have you had any luck implementing the suggestions of our esteemed forum users?  Please keep me in the loop with your issue.  I am committed to seeing this issue resolved but a status update would help me proceed and not suggest things that have already been attempted.

 

Thank you for choosing National Instruments!

Sincerely,

Greg S.
0 Kudos
Message 6 of 7
(4,444 Views)

Hi Greg,

 

Sorry for the delay in replying.... I have made a number of changes based on the other replies I have received and the chart is now running much better... With regard to using the dequeues to display the waveform, will this allow a large waveform history buffer so the x axis scroll bar be used (perhaps going back up to 120,000 data points??

 

Thanks,

Jack

0 Kudos
Message 7 of 7
(4,437 Views)