LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure's TImeout Causing Lag

Hello,

My philosophy to structure a user interface is using a "main" VI to launch and control other sub-vis. In the main "VI" typically I have a big'o Event Structure. On its timeout I query the execution status of the sub-vis in order to enable/disable the users options on the "main" VI. 

 

This basic premiss worked fine in a number of "main" VI. I started another "main" VI recently  and for some reason I can't compreehend I see the Windows processing (turning wheel) every at every timeout execution. In the "good" VIs, see example attached, I perform many and more complex queries and I don't see Windows processing anything. But on the "bad" VI for some reason this happens.

 

Does anyone have a hint as to why this is happening?  

 

Thanks.

Daniel 

Download All
0 Kudos
Message 1 of 10
(612 Views)

Hi Daniel,

 


@Daniel_Novo wrote:

Does anyone have a hint as to why this is happening?


Is that VI (or its frontpanel) large or does it need to handle a lot of data (in the frontpanel)?

Which function exactly is slow? Opening the VI ref or reading the ExecState?

 

Btw. usually it is not recommended to use CurrentVIsPath. Instead using the AppDir constant is promoted…

And why don't you use a subVI to read the ExecState of a VI given by string constant (to reduce code duplication)?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(608 Views)

Hello GerdW, 

 

there is almost nothing on the "bad" vi's front panel. A couple of dials and 4x boolean controls to call the sub-vis. In any case a lot less than what I have on the "good" VI. 

 

I guess I could've optimized the code using a subvi for the queries. On the other hand I had space so it was just a matter of copying and changing the VI reference. I will change the File Constant. 

 

I just checked the CPU usage. On the good VI I am below 10% on idle state. With the bad VI it is almost 40%. When I remove the query code from the timeout it drops to almost nothing. 

 

Is there any obvious reason why one VI should work perfectly and the other not? I think I will start the second VI from scratch to see if there is any obvious reason.

 

BR, 

Daniel  

0 Kudos
Message 3 of 10
(581 Views)

Update.... when I call the sub-vi the "lagging" stops. The spinning wheel goes away. 

0 Kudos
Message 4 of 10
(579 Views)

Newst update... I left the VI running for some minutes and the "strange" behaviour went away. SO... there's that. 

0 Kudos
Message 5 of 10
(561 Views)

You talks about event structure timeout and lag, but only show truncated pictures of code that has no obvious relation to any of this. What is a "big'o Event Structure"? What is the timeout?

 

Why is there so much duplicate code? All you probably need is autoindex over an array of VI names.

0 Kudos
Message 6 of 10
(524 Views)

The main difference between good and bad is that good all starts VIs SA_<something>.vi while bad starts a cf_table.vi. My "highly educated" guess is that your cf_table.vi is the culprit as its event handling is sub-optimal.

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 10
(508 Views)

Dear Knights!

 

Thank you for your constructive inputs. I've posted some updates. I'd guess the issue I faced has something to do with labview as an IDE (if such term applies to it) or how code is compiled by it.

 

Nevertheless, keep in mind this is the babbling of a mere plebe. 

 

GSK

0 Kudos
Message 8 of 10
(485 Views)

@Daniel_Novo wrote:

I've posted some updates.


Where?

 


@Daniel_Novo wrote:

I'd guess the issue I faced has something to do with labview as an IDE (if such term applies to it) or how code is compiled by it.


I have absolutely no idea what you are trying to say here. 😮

0 Kudos
Message 9 of 10
(457 Views)

I don't understand what you're trying to do, but i'd use a Static VI ref instead of building paths and opening and closing refs.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 10
(414 Views)