LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview display delay

There is some sort of delay between when events occur on our test stand and when they are observed on the Labview front panel. When the progam is first started, the delay is not perceptible. The longer the program runs, the greater the delay. I haven’t verified it yet, but I suspect the delay is also present in the data that is being logged. After running for ½ hour, the delay is approximately 5 seconds. The longer the VI runs, the longer the delay becomes. I have seen it where the displays are nearly a minute behind the actual event. The program is very simple and consist of a single loop that utilizes a "Wait Until Next ms Multiple" block so that it executes every 50 milliseconds (+/- 1 millisecond because it is not Labview realtime).  The CPU is at about 70% utilization while the VI is runnung. Any help is most appreciated.

 

0 Kudos
Message 1 of 8
(2,764 Views)
Can you post your code? Without it anything suggested will just be a guess.

Has it always worked this way or has something changed?

Do you have any array or string building occurring in the program? Are references being opened/created and not closed? Does memory usage increase over time?

Lynn
0 Kudos
Message 2 of 8
(2,760 Views)

Lynn posted some good follow-up Q's but let me focus on another issue where scobo wrote;

""Wait Until Next ms Multiple" block so that it executes every 50 milliseconds "

A common misconception about that function is what you wrote. Under the most simple cicumstances it will do that, but if you are doing any other stuff at the same time (70% CPU says you are) then that function will execute differently than expected.

Say the tick = 0 and you wait 50 and no other code is slowing down the cycling. Then when the tick-count reaches 50 it is done waiting.

Say the tick count is 10 then the code will only wait 40 because 50 is the next even multiple.

Again tick = 0 but this time your code takes 51 ticks to run. THe tick is now 51 so the next multiple would be 100.

So if your code takes longer to execute than the "wait until next" then with time you will be missing cylces.

Try using the TImed Loop if you have it available BUT I suspect the answers to Lynn's follow-up Q are what we need to get you going.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 8
(2,753 Views)


johnsold wrote:
Do you have any array or string building occurring in the program? Are references being opened/created and not closed? Does memory usage increase over time?

Dead on!
 
  • Also, do you have any charts with huge history limits that you are redrawing every 50ms?
  • Do you shuffle a lot of data with local variables and value properties? Can you calculate how many copies of the same data you have in memory?
  • Constantly resizing huge arrays (built array, delete from array, insert into array) is also very expensive, because a new contiguous copy of the entire array needs to be allocated in memory every time.
  • Do you have complex data structures? (e.g. arrays of clusters of arrays, etc.)
0 Kudos
Message 4 of 8
(2,743 Views)
Hi All - thanks, I will look into replacing the Wait Until... function. I have attached the affected VI in case someone may care to have a look. Thanks much for the comments!
0 Kudos
Message 5 of 8
(2,732 Views)
I would advice you to drop the Express VIs on daqmx.
The current setup will stop and start the daqmx read on every loop, this is ment is the context help of the Express VIs.
Why do you need the Index Waveform Array VI? I think a normal Index array would work. If you want to keep this vi, check that this VI is reentrant.
The write to spreadsheet file has the same issue as the daqmx VI, repeating functions (open, write, close) at every iteration.
The same goes for the GPIB drivers.

Basically you need a state machine:
  1. Init
    Initialize, the daqmx, GPIB, files
  2. Execute
    Read your data, filter, save to disk
  3. Close
    Clean up your references, stop daqmx
    Close LabVIEW
I am absolutly positive you will miss samples in your current setup.

Don't use the LabVIEW Stop primitive

Good luck,

Ton



Message Edited by TonP on 06-04-2008 08:56 PM

Message Edited by TonP on 06-04-2008 08:57 PM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 6 of 8
(2,715 Views)

Yep!

Go with Ton's suggestions. I think he listed all of the glaring issues.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 8
(2,703 Views)

I'll clean it up and see if that solves the problem.

 

Thanks for the help!

0 Kudos
Message 8 of 8
(2,698 Views)