From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

local variable cross-talk?

I have three VIs, call them A, B, and C. A uses C as a
subVI, and B uses C as a subVI.

Now, when A contains only C, I run A and everything is
fine. C has a boolean control and indicator, very simple.
When I place B in A's diagram, and leave it unwired, A no
longer behaves correctly. A can no longer control C's
boolean indicator. It's very strange.

Now, the instance of C within B is wired such that C's
boolean indicator is wired to False. In the instance of C
within A, the boolean indicator is wired to a switch. It
appears to me that just the presence of B within A causes
A's boolean indicator to be controlled by B.

Does this behavior ring a bell?

--
---
Jeffrey W Percival, Senior Scientist and Associate Director
Space Astronomy Labora
tory, University of Wisconsin - Madison
1150 University Ave, Madison, WI 53706 USA
608-262-8686 (fax 608-263-0361) jwp@sal.wisc.edu http://www.sal.wisc.edu/~jwp
0 Kudos
Message 1 of 3
(2,284 Views)
Hi Jeffrey,
It looks like C's control value is modified by B execution (is this control an input for C ?) and A executes C without passing an input to C.
You can open C.VI and use highlight execution in order to track value changes.
Also, try to post these VIs ... it will be easier to find the problem.

p.s.: the title is related to local variables (usually involved in race conditions) but I am not sure where are you using them
0 Kudos
Message 2 of 3
(2,284 Views)
With B in A and not wired to anything, it will run as a parallel thread to whatever is happening in A. What runs first is not predictable without analyzing the VI. What probably is happening is that A passes the switch value to C then the parallel thread B runs and passes its value to C. So the A VI is doing what it is supposed to, it's just that the B VI is also doing what it is supposed to. Put a delay in A before it passes its value to C (making B run first), then see if B appears to no longer have control.

You might want to use the trace mode to see what it happening. Step through the program and watch what goes on.

Rob
0 Kudos
Message 3 of 3
(2,284 Views)