LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Identical reentrant FGV's? How to tell them apart?

Solved!
Go to solution

I think I'm having a brain fart.  I have an FGV state machine that I need to use for several different state machines in an application.  That is, each of the 'instances' of the state machine VI needs its own separate state data, and will execute with different actions & parameters.  So I develop and get the FGV debugged, make it reentrant, and copy/paste them all in nice row like little soldiers.  I can initialize them all in the same place, yeah fine.  But then, all throughout the code, hereafter each 'instance' clone would not be identifiable to me.  By that I mean, (obviously) the icon for each 'instance' will always be the same, and each instance will just have clone number.

 

Am I hallucinating?  Will I have to make copies of the VI and save each one with a different name?  That sure smells to me, having to maintain N identical copies.

 

But then I think "Use the Asynchronous Call/VI Server, Luke!" and pump out the needed 'instances'.  But then I'm left with the same problem - once these babies leave the maternity ward, they all look exactly alike!

 

What am I missing here? Many thanks for any correction of my thinking, paul

0 Kudos
Message 1 of 25
(1,387 Views)

I remember something about this, so I Googled labview clone reference.  (I remembered something about clone references.)  I think there are several entries in the top 5 that will interest you.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 25
(1,351 Views)
Solution
Accepted by topic author PaulOfElora

When an infant is born, one of the first things they do in the delivery room is to put a band around its wrist that says "Baby Boy, mother Judy Smith".  If the mother had twins, the wrist bands might say "Baby Boy 1, mother Judy Smith", "Baby Boy 2, mother Judy Smith".

 

When Mother and Babies are ready to "leave the maternity ward", the nurses check the Wrist Bands (a.k.a. "Clone References") -- by referring to the Reference Numbers (eventually replaced by Parent-chosen "names", like "Jim" or "Bob"), the parents can always identify the First Born ("Hey, Jim"), and can "call them by their Reference Number", keeping them straight.

 

Note -- even when the children clones aren't identical, but just treated as individual children, with their own identities, we still often refer to them by their "names", but if Birth Order is important, we may want to have an array that lists them in Birth Order, e.g. ["Jim", "Bob"].

 

Bob Schor

0 Kudos
Message 3 of 25
(1,336 Views)

@PaulOfElora wrote:

I think I'm having a brain fart.  I have an FGV state machine that I need to use for several different state machines in an application.  That is, each of the 'instances' of the state machine VI needs its own separate state data, and will execute with different actions & parameters.  So I develop and get the FGV debugged, make it reentrant, and copy/paste them all in nice row like little soldiers.  I can initialize them all in the same place, yeah fine.  But then, all throughout the code, hereafter each 'instance' clone would not be identifiable to me.  By that I mean, (obviously) the icon for each 'instance' will always be the same, and each instance will just have clone number.

 

Am I hallucinating?  Will I have to make copies of the VI and save each one with a different name?  That sure smells to me, having to maintain N identical copies.

 

But then I think "Use the Asynchronous Call/VI Server, Luke!" and pump out the needed 'instances'.  But then I'm left with the same problem - once these babies leave the maternity ward, they all look exactly alike!

 

What am I missing here? Many thanks for any correction of my thinking, paul


I think you're having a brain fart, yes. Isn't the whole idea of an FGV that it _isn't_ reentrant?

Ditch it into a class and make an array of FGV objects. 🙂

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

Qestit Systems
Certified-LabVIEW-Developer
Message 4 of 25
(1,326 Views)

A method of preallocated clone FGVs called by reference is described in this conversation.

Message 5 of 25
(1,317 Views)

To identify each instance of a reentrant vi, include a required input called something like "ID" or "Index".

This can be a simple numeric or for better readability, an enumerated type can be used (Type Defined of course).

When you place an instance on the block diagram, create a (unique) constant for the "ID" input.

 

The "ID" input is used internally in your vi (shift register) to differentiate itself from the other instances.

 

This covers showing a unique ID on the block diagram and using this ID internally.

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 6 of 25
(1,307 Views)

Ahhh thanks billko, will pursue & digest - paul

0 Kudos
Message 7 of 25
(1,300 Views)

That's exactly what I'm looking for, thanks much Dr. Powell! paul

0 Kudos
Message 8 of 25
(1,296 Views)

Ahhh Yamaeda, that's a whole different direction for me!?!?  To be clear, do you mean 1) Create a class for the FGV, 2) Make the FGV's internally stored data the class data 3) Replace each 'Action' of the FGV with a class method? Thanks as always, paul

0 Kudos
Message 9 of 25
(1,293 Views)

Thank you much Bob, that's a whole Core 3 lesson right there - will play with this - paul

0 Kudos
Message 10 of 25
(1,292 Views)