07-21-2017 09:16 AM
Hello, I am using Labview 2014 32 Bit on a Win 7 machine (8 GB RAM, 6 core AMD).
I have developed a very complex measurement software over the last years with communication with > 15 external devices. Therefore my code is very big (many sub vis, many controls etc). Basically, I use a producer and a consumer loop using Queues. Additionally I have a device loop for time sensitive communication with my LASER
Recently, I noticed that the CPU load increases drastically when using the scroll bars. As a result of this my device loop for my LASER is not running as designed. Unfortunately, my laser needs to receive a command from PC every 500 ms - otherwise it will turn itself off. And this is my problem: When scrolling while the VI is running, the CPU load increases and the loop execution gets delayed to the point that my laser switches itself off and on until stopping the scrolling. I also used time-controlled loop with high priorities without solving my problem.
My question to the community: Is this a common problem for very big GUI - VIs? Is there an easy fix (except hiding the scroll bar)?
I would appreciate any help I could get.
Best Regards
PS: My wait for event structure has almost 150 cases - could this be a possible reason?
07-21-2017 09:31 AM
I think your bottleneck is the UI thread. Pllease verify that you run most code in other threads.
I am not sure about VISA in context of serial, but i think it shouldn't execute in the UI thread.
However, if it runs outside the UI thread, your application binds it to it.
In order to solve this, i recommend you to:
1. Move to producer/consumer design pattern rather than a simple event handler
2. Make sure to run as little code as possible in the UI thread
07-21-2017 02:39 PM
Do you have property nodes in the laser loop?
Ben
07-22-2017 12:21 AM
Dear Ben,
not really.
I transmit a cluster of settings and a cluster of readings to my communication vi and receive it back. In the bottom is a case for refilling the Queue.
Maybe I should wait with the refreshing of the clusters on my frontpanel and only refresh it every 1-2 seconds.
best regards
07-22-2017 12:29 AM
@Norbert_B wrote:
I think your bottleneck is the UI thread. Pllease verify that you run most code in other threads.
I am not sure about VISA in context of serial, but i think it shouldn't execute in the UI thread.
However, if it runs outside the UI thread, your application binds it to it.
In order to solve this, i recommend you to:
1. Move to producer/consumer design pattern rather than a simple event handler
2. Make sure to run as little code as possible in the UI thread
Dear Norbert,
actually I don't know about anything of what you just wrote. I never thought about UI threads. I will read up about this topic - maybe I can optimize my code.
to your #1: I have this - I atleast think i do. I have a producer(erzeuger) loop and a consumer loop (Verbraucher). Producer has an event handler. Consumer a case handler.
Best regards
07-22-2017 04:15 AM - edited 07-22-2017 04:17 AM
I can see in your first laserloop.PNG file one property node (false constant assigned to a boolean beginning by "GasExc").
This might be a possible explanation. Property nodes use the UI thread. If the UI thread is busy with scrolling, the property node execution might be delayed (the UI and property node cannot be accessed at the same time).
For your complex application, you probably have already passed the point where you need to look into design patterns and general good practices (LabVIEW Core 2, 3, Advanced Architectures courses would help).
Just a few quick recommendations:
Good luck
07-22-2017 11:25 AM
Some other comments: