02-23-2023 01:31 AM
I'm running a timed loop on a cRIO 9047. Everything (GUI and automation) is in the same VI. The code contains many Control Property Nodes "Disabled" to programmatically "disable&grey out" or "enable" GUI-Buttons when something happens.
For example, the GUI contains a button "start measurement". This button is greyed out as soon as the user clicks it and then later enabled after a certain amount of time has passed.
However, those property nodes slow down my loop a lot. Without the nodes, the loop takes around 2ms, with the nodes included around 50ms, making my measuring system useless.
What options do I have to reduce this slow-down? Maybe I should put the GUI into a seperate timed loop which is running on another core of my cRIO? But how do I then access those property nodes?
02-23-2023 01:40 AM - edited 02-23-2023 01:41 AM
Hi faul,
@UL-00 wrote:
However, those property nodes slow down my loop a lot. Without the nodes, the loop takes around 2ms, with the nodes included around 50ms, making my measuring system useless.
What options do I have to reduce this slow-down? Maybe I should put the GUI into a seperate timed loop which is running on another core of my cRIO? But how do I then access those property nodes?
Questions:
02-24-2023 05:26 AM
Thank you for your questions.
02-24-2023 05:43 AM
Hi faul,
@UL-00 wrote:
- Why do you think you don't "have access" to those property nodes when you place them in a separate loop?
- In my main loop I somehow have to tell the program to write to a property node which is located in another loop. I don't know how.
Just move the property node to the other loop…
What's the problem in doing so?
(As long as you don't post any code we cannot give specific recommendations…)
02-24-2023 08:48 AM
@UL-00 wrote:
- Why do you think you don't "have access" to those property nodes when you place them in a separate loop?
- In my main loop I somehow have to tell the program to write to a property node which is located in another loop. I don't know how.
Queue or user event
02-24-2023 11:03 AM
@UL-00 wrote:
Thank you for your questions.
- Why do you need to access control property nodes in timed loops? (Are you really using TimedWhileLoops?)
- Yes, I am using a timed while loop because I want to guarantee that my loop finishes in a certain amount of ms.
- I access the control property nodes in my timed loop because this is the only loop I have!
- Why do you need to set those property nodes in each iteration of your loop? What makes you think you need to update a GUI at 500Hz?
- I actually don't need to. That's a good point, I could update the property nodes less often. I would use the loop counter and a remainder function to update them..let's say only every 10th iteration.
- Why do you think you don't "have access" to those property nodes when you place them in a separate loop?
- In my main loop I somehow have to tell the program to write to a property node which is located in another loop. I don't know how.
Investigate the Producer/Consumer approach to get the data from one loop to the other. Only update the UI element status when changed, and do it in the other loop. If you really need to be time critical you should consider going to a real-time system - you can never "guarantee" loop time in Windows.
02-24-2023 11:12 AM
Also, while it's not the root of your problem (other people have addressed that pretty well...) if you have 2 or more property nodes in a row that you're setting that are slowing you down, look into the Defer Panel Updates property for the VI's panel in question. I have applications where I want to disable dozens of buttons while a test is in progress and using that property is how I make it happen in a timely manner.