LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HOW DO I ACCESS A FGV OR LV2G RUNNING INSIDE A CLONE WHICH IS A QUEUE MACHINE

Hello,

I have developed a QUEUE based architecture which I have made it as PREALLOCATED CLONE REENTRANT EXECUTION . Name of the engine is <DEMO_ENGINE_TRIALS.vit> . I want to run 15 instances of this engine, therefore I have made it as a clone. This Clone engine has a FGV called <DEMO_LV2G.vi>. I have made another 2 vi's viz: <FIRST CLIENT.vi> and <SECOND CLIENT.vi> .

My requirement is that, when the Clone engine starts. i.e when First and Second Client opens the 2 instances of the DEMO_ENGINE_TRIALS, and when i change the state of the switch in the clone engine, the FGV inside should update the status in calling VI

Currently, when I am turning the state in the clone engine, the FGV is updating the data in both the calling vi's , which is undesirable

 

Attached is the code. This is not my actual code. But I have tried to express my issue through this demo.

In my actual code, I have a Main.vi which has 15 consumers and each consumer will call the clone CAN_ENGINE's i.e <15 clones will be called> and the status of the CAN should get updated in the calling consumer loop.

Open G is required to be installed to run this code

0 Kudos
Message 1 of 9
(451 Views)

@VihangPatil wrote:

Hello,

I have developed a QUEUE based architecture which I have made it as PREALLOCATED CLONE REENTRANT EXECUTION . Name of the engine is <DEMO_ENGINE_TRIALS.vit> . I want to run 15 instances of this engine, therefore I have made it as a clone. This Clone engine has a FGV called <DEMO_LV2G.vi>. I have made another 2 vi's viz: <FIRST CLIENT.vi> and <SECOND CLIENT.vi> .

My requirement is that, when the Clone engine starts. i.e when First and Second Client opens the 2 instances of the DEMO_ENGINE_TRIALS, and when i change the state of the switch in the clone engine, the FGV inside should update the status in calling VI

Currently, when I am turning the state in the clone engine, the FGV is updating the data in both the calling vi's , which is undesirable

 

Attached is the code. This is not my actual code. But I have tried to express my issue through this demo.

In my actual code, I have a Main.vi which has 15 consumers and each consumer will call the clone CAN_ENGINE's i.e <15 clones will be called> and the status of the CAN should get updated in the calling consumer loop.

Open G is required to be installed to run this code


If you make the FGV preallocated clone as well, each will maintain their state.  But this would have some ramifications to existing code, and I confess I did not look at the code so I can't tell if they would be acceptable or not.

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.
0 Kudos
Message 2 of 9
(443 Views)

Why would you have a VI with a vit extension?

 

Your FGV is not reentrant and thus shared by all clones. If you want to keep state for all clones, you could make it contain an array where each index corresponds to one of the clones.

If you make the FGV reentrant, it will no longer be an FGV!

 

 

0 Kudos
Message 3 of 9
(440 Views)

Making the FGV as pre allocated clones does not work. I tried making it Shared Clones and Pre allocated Clones. Both these methods doesn't update the calling vi with the correct status

0 Kudos
Message 4 of 9
(435 Views)

Could you kindly modify the code and share, so that I get a workable solution

I am kind of stuck at this point in this development

0 Kudos
Message 5 of 9
(433 Views)

Your FGV could do management based on the clone name, for example.

 

altenbach_0-1723137693498.png

 

Each clone would call it with it's ID and the FGV would manage it (e.g. keep an array of clone names, add an array element for a new clone ID and do a lookup and find the relevant index for each later call from the same clone).

 

 


@VihangPatil wrote:

Could you kindly modify the code and share, so that I get a workable solution


Sorry, that is not part of my job. See how far you get. Good luck!

0 Kudos
Message 6 of 9
(425 Views)

@altenbach wrote:

Your FGV is not reentrant and thus shared by all clones. If you want to keep state for all clones, you could make it contain an array where each index corresponds to one of the clones.


Depending on how you want to access the information, a map may be desirable (using a string "Name" as the lookup).  Using the Name as a lookup helps readability as the names are self-describing.  But an array using the index would be a lot simpler.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 9
(407 Views)

Yes, I actually had a Map in the back of my head when I wrote my answer. They seem to be using LabVIEW 2020 (did not check before), so a map is available and recommended, of course. 😄

0 Kudos
Message 8 of 9
(403 Views)

Can you please post an example. 

0 Kudos
Message 9 of 9
(398 Views)