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: 

problem running duplicate SubVIs

I have a SubVI that I want the user to be able to launch (up to) 4 separate instances of.  It's a small grouping of indicators that represent possible error conditions for 4 separate but identical sections of the hardware being monitored.

 

To accomplish this, I set up the following code:

reentrant.png

 

I need the indicators that are in the SubVI to be updated even when the user isn't looking at them (because there is separate history tracking going on), so as you can see above, I make 4 (nearly) identical calls to run the VI, then in an event structure, when the user clicks on the control associated with each section, it executes the FP.Open command for that particular VI's reference.

 

When I executed this, the only one that will open is the first one (vertically), the one that's set to the base address of 10000.  I presume this is because it's the fist reference that runs when the main program executes.

 

So then I went and edited the properties for the SubVI to set its reentrant execution to "preallocated clone reentrant execution", but this made no difference.

 

Any thoughts on how to solve this problem?  thanks in advance

0 Kudos
Message 1 of 7
(2,534 Views)

You need to pass in a 0x40 to the options on the Open VI Reference

 

I would also put the intialization inside of a FOR loop and autoindex the reference.  Then you have an array of VIs and you just have to choose which index to mess around with.  This will make it very simple when you need to add another VI.  It is also a lot easier to have just 1 set of wires instead of 4 being passed around.


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
0 Kudos
Message 2 of 7
(2,530 Views)

I'm sorry, can you be more specific?  You mean the FP.Open method?  What property?

0 Kudos
Message 3 of 7
(2,522 Views)

I'm sorry, Open VI Ref...I see what you mean, my bad.  Thanks

0 Kudos
Message 4 of 7
(2,519 Views)

I thought I was pretty clear by calling the function the Open VI Reference.  That is its name after all.

 

Here's what I am suggesting.


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
0 Kudos
Message 5 of 7
(2,513 Views)

I followed your example...now each one opens, but they all have the same base address value of 10000...I double checked that I used 4 different indices in the event structures:

reentrant.png

0 Kudos
Message 6 of 7
(2,498 Views)

Looks like I mislead you.  You need the options to be set to 0x08.  0x08 is "Prepare for reentrant run" while 0x40 is "Enable simultaneous calls on reentrant VIs".  Since you are using the Run method, we need to use 0x08.


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
0 Kudos
Message 7 of 7
(2,487 Views)