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: 

multiple vi instances

Solved!
Go to solution

Hi,

 

I have the same VI being called a few times, which I have working. But each instance needs to have different parameters passed to it. 

I have set it up along the lines of: http://digital.ni.com/public.nsf/allkb/9CE784F50F816EA18625751900775EBB

Is there a way to access the connectors of the sub VI?

 

Thanks,

 

Michael

0 Kudos
Message 1 of 13
(3,517 Views)

Hi Michael,

 

If you connect a type specifier to "Open VI Reference" you can use the "Call by Reference" node to call the VI.

To create a type specifier, right-click the corresponding connector of open VI ref, create a constant and drag the VI you're going to call dynamically on the constant.

 

Hope this helps,

Daniel

 

0 Kudos
Message 2 of 13
(3,503 Views)
Solution
Accepted by topic author lax815

You can't exactly access a clone's connector pane, but you can pass data to it. There is a VI method that you can access through an invoke node (called Ctrl Val.Set) that allows you to set the value of controls on the clone's front panel as long as you know the control's name. Call this method to set the inputs before you run the clone.

 

Mike...

 

PS: if you have a bunch of inputs, feel free to bundle them into a single cluster - just be sure to make the cluster a typedef!


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 13
(3,502 Views)

For what he's wanting to do a call by reference node won't work becuse it links the VI to the parent. He's wanting the called VI (actually multiple instances of the called VI) to be running independently.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 13
(3,500 Views)

@Mike: are you sure about that? If you have multiple VI references obtained through the open VI ref by cloning the VI I thought you can have multiple independent instances of the VI. Whether you call the VI using the invoke node or call by reference node doesn't make a difference, you just need a strictly typed VI ref for call by ref.

I don't have LV here so I can't verify.

 

Message Edited by dan_u on 01-31-2009 09:43 AM
0 Kudos
Message 5 of 13
(3,479 Views)

Just a thought...

If you need to pass different parameters, you just wire different parameters.

Normally one vi will wait for the other to finish before starting running itself.

If you need both to be running simultanusly you just have to make them reentrant.

 

It is much easyier, although i don't know if this is what you need.

0 Kudos
Message 6 of 13
(3,469 Views)

@Mike: now I understand what you mean.

Of course you can't run the multiple instances in a for loop like the example does, because call by ref always waits for the SubVI to finish.

But you can still open multiple instances in parallel and call them simultaneously.

 

Daniel

 

0 Kudos
Message 7 of 13
(3,466 Views)

Yes, that will work if:

  1. You know ahead of time how many instances you need.
  2. You don't have a problem with these parallel instances potentially blocking the execution of additional code until they finish. 
Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 8 of 13
(3,450 Views)

Hi,

 

Thanks a lot for the responses - they sound like what I am looking for.

 

I can't find the Ctrl Val.... method in the list for the Invoke Node object. I am using LV 7.1.1.

 

The number of instances is fixed before run time, and the sub VI being called should run continuously once called.

 

Cheers,

 

Michael

0 Kudos
Message 9 of 13
(3,394 Views)
The method is called Set Control Value or Set Control Value [Variant].
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 10 of 13
(3,380 Views)