06-16-2016 11:42 AM
Hello,
I would like to execute multiple instances of a Reentrant VI. The twist is that this VI has a lot of SubVIs and some of those SubVIs are "Functional Global Variable" (shift-register on while loop).
Thus, those instances share the same memory allocation for that variable. I would like those instances to share nothing at all and be completly independent...
Is there a way to make sure that any SubVI has its own memory allocation within his scope (Reentrant Root VI)?
Thanks a lot!
Vincent
Solved! Go to Solution.
06-16-2016 02:14 PM - edited 06-16-2016 02:18 PM
So you want some of your FGVs to act like normal as non-reentrant VIs that will keep a shared memory space wherever used, but others to not share the memory space? What's the point of using the FGV as subVIs of the reentrant VIs if you don't use the shared memory space? If you get rid of the memory space share, you might as well just not use the FGV.
You can't change a VI's reentrancy for different instances. You could potentially create two versions of the FGV (one reentrant, one non-reentrant), and use a case structure to choose which one to run. But this is very roundabout and it just seems to me like you need to do away with the FGV in these instances.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
06-16-2016 02:25 PM
Hello James,
Thanks for your anwser!
I'm very well aware utility of a FGV. The thing is that the reentrant VI that I'm talking about is very complexe and have several SubVIs, FGV, GUI etc. They are vision inspection station that must be launch on 1 or several computer and many instance of any of these stations can run on the same machine at the same time. This is what I'm trying to acheive.
Thus, those FGV are very useful inside their own instance of the station.
Any suggestion?
Vincent
06-16-2016 02:35 PM - edited 06-16-2016 02:36 PM
Like I said above, you would have to change the way you use the FGVs because there is no way around the non-reentrant settings by instance. Creating a reentrant version of your FGV code and switching between the two may be your best option.
How do you use the FGVs? What data do you want to use if the FGV were reentrant? If it can't access the memory space, then the data has to come from somewhere else, right?
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
06-16-2016 02:41 PM
We did something like this a few years ago -- we had 24 "stations", each consisting of a Camera and additional I/O hardware, and launched each one using Start Asynchronous Call. We passed into each Station a Station ID (a number from 0 .. 23) which we used to create (where needed) uniquely-named entities (like Queue names) on a per-Clone basis. Within each top-level Clone, those VIs that needed to be specific to the Clone were coded as Reentrant, those that could be "shared" were not. We didn't use FGVs, but if we'd needed a Clone-specific FGV, we'd have made it Reentrant.
Bob Schor
06-16-2016 02:42 PM
Yeah, I guess I'll have to do that...
What about instead of using a FGV, I use a Lossy Queue of a size of 1... Instead of deqeueing, I only do a preview of the queue to get the data.
What I would need to do is to store a unique name for each instance and use it to create/get access to the right queue.
I think that does make sense...
06-16-2016 02:44 PM
Thanks Bob...
I was writing the same as you while you wrote yours...
I guess that is the best way to do it! I'll give it a try!
06-16-2016 02:57 PM
@vgravel wrote:What about instead of using a FGV, I use a Lossy Queue of a size of 1... Instead of deqeueing, I only do a preview of the queue to get the data.
That sounds a lot like a Global Variable to me. Or, if you want to keep the reference setup, a Data Value Reference.
06-16-2016 03:02 PM
Well... yes indeed...
Maybe I just didn't use the right term... When I speak of FGVs, I usually mean an uninitialize shift-register.