LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to use correctly the value property node in a re-entrant VI

Hi everybody,

I am using labview 6.1 and developing an application which call a reentrant SubVI. However when I use the Value Property Node (which I need : the use of local terminal isn't possible in my final application) in the re-entrant SubVI, i get the initial value of the control, not the current value !?

Is there anybody to explain me why and how to solve this problem ?

I have attached 3 VIs for a better explanation.

Thanks.
Download All
0 Kudos
Message 1 of 7
(3,685 Views)
Hi,
The property nodes run in the user interface thread i.e. you read or write to the properties of the controls that are present on the front panel (user interface). When you make a VI reentrant, you are creating a seperate dataspace for each instance of that VI. If you have a seperate dataspace for each instance, then the front panel will not update the controls since at any point different instances of the VI can contain a different value for the controls on the front panel of the reentrant vi. Since the front panel is not updated for reentrant VIs, and property nodes use the front panels to get the values, then for reentrant VIs, the property nodes will not reflect the changes.

Your only option is to use globals or locals.

Good luck.

Sincerely
,
Feroz
National Instruments
Message 2 of 7
(3,685 Views)
I thank you for this clear answer.

But since I have to use a variable in a subVI (re-entrant) which can be changed by the caller (re-entrant too), is there any solution to read the value af a variable passed by reference ?
Is there any solution to pass a global by reference ?

In a C environment, passing address permits all these things ...

Thanks, one more time.
0 Kudos
Message 3 of 7
(3,685 Views)
You just need to create a local variable instead of a property node to read the value of the control that was passed in. Popup on the control and select Create >> Local Variable. Or just wire the control to where you need it. Data flow is still working; Feroz just explained an idosyncracy of how property nodes work in reentrant VIs.

BTW - I don't mean to turn this into a sales opportunity, but you might want to check out the VI Analyzer Toolkit. It reports the following for a reentrant VI that uses property nodes:

"You are using an implicit property node in this reentrant VI. This can result in unexpected block diagram behavior, as a reentrant VI will occupy multiple data spaces but will maintain only a single front panel. You should consid
er either making this VI non-reentrant, or eliminating the use of implicit property nodes."

I'm not sure how many people would know what the message means, but they would be forewarned and hopefully check into it further (e.g. test with this specifically in mind).

I filed a bug report to have this investigated further and at least documented better.

Roy
0 Kudos
Message 4 of 7
(3,685 Views)
Hi,

>>Is there any solution to pass a global by reference?
You don't have to pass a reference to a global into a subVI to get access to it's value. All you need to do is place the global variable in the subVI. You can then read and write to it.

I hope this helps.

Sincerely,
Feroz
0 Kudos
Message 5 of 7
(3,685 Views)
It would be so simple if I just had to use a local/global variable. In fact, the variable to read/write is depending on which instance of the re-entrant VI use it. I can't use a simple local wiring !
The problem is the same for global variables.

I thank you for your help. I think I have found the solution : not to use re-entrant fonctionnality, but duplicate the VI in different name at run time, and execute them, then destroy them when closing the application.

Sincerely,

-Michael-
0 Kudos
Message 6 of 7
(3,685 Views)
You could also try launching aVI Template via VI server. This way the naming and destroying is done automatically ba LabVIEW.

You could also drop a case statement into your sub-VI choosing which global should be written to/read from, thus allowing each sub-vi to react with different values depending on what is required.....

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 7 of 7
(3,685 Views)