02-28-2023 02:00 AM
Hello everyone,
I have noticed in my application, that selecting a numeric control field (or simply moving the mouse over a control or a chart indicator) changes the timing of the application. Is there a way to disable this, to get a more repeatable timing?
Example below, when selecting the “0” in Numeric:
I found an old forum entry about this and was wondering if there is a better solution available than using a transparent decoration to cover the entire user interface.
Solved! Go to Solution.
02-28-2023 02:28 AM
Provided that you can't guarantee a constant timing unless the OS is realtime, you can improve greatly by running the code in another "worker" vi with no user interface. This vi may send the results of the processing to other vis - to be viewed or saved - using a queue or a notifier or whatever you think is best for your application. A proper way to terminate or pause the worker vi should be setup, via a Global, a Notifier, a User event, a command queue or other synchronization objects.
02-28-2023 02:43 AM
Thank you for your reply. What do you mean with a "worker" VI: a sub-VI?
The same timing happens if the loop is run in a sub-VI: If the Numeric on the caller is selected, the timing in the sub-VI is influenced.
My application is a Queued Message Handler.
Left: Caller, right: sub-VI
02-28-2023 03:13 AM
I meant a vi run in parallel with your main. But your subvi has a user interface that it constantly updates. This forces running in the UI thread and this could be the reason of the jitter.
I'm trying to replicate your test but I don't get the same bad results. I get timings from 10 to 12 whether or not I move the mouse or select the numeric. If I drop the chart, I get 10 to 11 (very seldom 12).
02-28-2023 03:57 AM
Why do you need it? Don't do timing sensitive things in the UI thread and if timing is really important, do it in a RT OS.
02-28-2023 04:25 AM
Thank you for your responses. How do I get the process into the UI-Thread?
My demo-application now uses two loops (and I changed the execution setting), but still get the same interference from the mouse over the Numeric indicator from the main-VI in the sub-VI:
Main:
Sub-VI:
02-28-2023 04:41 AM
Hi Jascha,
@Jascha_Eisenberg wrote:
My demo-application now uses two loops (and I changed the execution setting),
Don't even start to fiddle with execution priorities of subVIs. Most often this setting will not improve the behaviour!
Switching the execution system does not help here as all FP elements are handled in the UI thread: as soon as you interact with the "Numeric" control your VI will be limited by the UI thread execution…
Again: Don't do time-critical stuff in a loop which is supposed to handle UI elements. (See previous responses above…)
02-28-2023 05:04 AM
If I have two loops, and I select the “0” in the numeric control (top loop), why does it influence the timing of the lower loop?
02-28-2023 07:12 AM
I tried by changing the timed loop to just queue up the times in a sub-vi but it had the same effect. So, back to the original question, why do you need a timed loop? It it's some sort of sampling it should be hardware timed and you should get it in chunks.
02-28-2023 07:42 AM
Hi Jascha,
@Jascha_Eisenberg wrote:
If I have two loops, and I select the “0” in the numeric control (top loop), why does it influence the timing of the lower loop?
Because there only is one UI thread!
When the UI thread is busy with your "numeric" then it cannot serve the chart (which requires UI thread work) in the other loop at the same time…