LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Subpanel indicators don't update if they are not visible

Hi all,

 

I am experiencing some weird behavior in one of my applications and I was wondering if anyone here had any idea why.  Here is the problem:

 

I have a vi that gets loaded into a subpanel.  The indicators of that vi don't display the data I wired to them unless I am watching the indicators when they update.  In other words: If the vi is not loaded into the subpanel, the indicators are not visible and they do not update when new data is wired to them.  When I insert that vi into the subpanel, the indicators display the wrong values until the next time they are updated.

 

I have attached some simple code that demonstrates this behavior.  It is saved as LabVIEW 2015, but I originally wrote the code in 2022 Q3.

The attached code will start a vi using call by reference.  After 6 seconds the vi will be inserted into the subpanel, and you will see that all values are default until the next time they are updated.

 

Is this normal?  It feels like a bug.  I have tried a lot of things to resolve this, including all applicable solutions of this knowledge article:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000kISeSAM&l=en-US

I have also tried settings the indicators, "Synchronous Display" property, and I have tried to force updates using the, "Defer panel updates" property.  The only thing that has worked is writing values to the indicators constantly in order to get them to update after I start looking at them.

0 Kudos
Message 1 of 6
(271 Views)

Not sure what's the reason behind it, but it works if you use Run VI Method instead.

 

ZYOng_1-1765935746727.png

 

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 Kudos
Message 2 of 6
(239 Views)

Hi,

 

I don't know what is your purpose with this program, but if you make a few changes, it will work fine.

 

First, in your program, you won't see the values the array takes because it only displays them when the VI execution ends, so you would never see them in your program.
Second, the “i” indicator starts at 4 because in your main VI you wait 6.1 seconds before displaying the VI, and the secondary VI runs 4 loops before you diplay it during that 6.1 waiting time.

 

Here are some changes you can make.

 

Best regards.

using LV 2017 on Win11
0 Kudos
Message 3 of 6
(208 Views)

I've used sub-Panels in several LabVIEW Projects.  In all cases, the VI that was loaded into the sub-Panel was only called while in the sub-Panel.  You are calling it before it is placed in the sub-Panel -- I'm not sure why that messes up communication, but I also don't know why you need to do that.  The contents of my sub-Panels are often State Machines being run by the "calling program", so after doing the Insert VI to embed the (not-yet-running) routine you want in the sub-Panel, I send the "Initialize" command to the VI in the sub-Panel (which would be your "6-second" routine) and follow up with whatever else I need to send. 

 

Why can't the sub-Panel routine do the 6-seconds by itself?  The idea is to keep all of the code running in the sub-Panel running only in the sub-Panel.  At least, this technique has worked well for me ...

 

Bob Schor

0 Kudos
Message 4 of 6
(161 Views)

My guess, it basically has to do with the fact that the front panel isn't initially loaded into memory. The compiled code is trying to be smart about making copies of data. If the front panel doesn't need to be loaded, each control/indicator only needs one copy of data. If the front panel does need to be loaded, each control/indicator needs two copies, one for the the actual data and one for the displayed FP object. Since you aren't loading the FP into memory until later, that second copy is only getting made when you do, and the initial value of that second copy is the default value of each control/indicator.

 

As for why Run VI works, I'm not sure. But, in your called VI, doing anything that loads the front panel into memory without actually opening it will work to make the indicators show with the expected values initially. For example:

Spoiler
FireFistRedhawk_0-1765987050822.png

 

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 5 of 6
(141 Views)

I'd say it's expected behaviour. Why update a front panel that isn't shown? That's just unnecessary work.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(50 Views)