LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to load mulitple different type of vis

I have a question regarding the User Interface. I am currently having some trouble calling multiple different VI. There is a function called a Call to Reference that I am using. However, the function only accepts a static refnum which is handy if I know what type of Vi I want to call. However, However, I am running that function in a loop as its calling multiple different SUB Vi's. However, say one sub-vi is a 2 input adder, and then a 3 input adder. Lab view wont let me do that. I want to call multiple different type of VI's, is there any help you can give me regarding this problem?

 

 

0 Kudos
Message 1 of 8
(2,617 Views)

I am currently working on a project where I am trying to create a main VI to load in an unknown amount of subvis. The subvis are all different types,eg(2 input addition), (3 input subtraction), 2 input sine graph, etc.  I am trying to call them in my main Vi but I can only have  a strict refnum, not a dynamic refnum. Is there any way to load in multiple different type of subvis in Labview? Any help would be greatly appreciated. 

0 Kudos
Message 2 of 8
(2,574 Views)

Hi Rayzab,

 

You might want to check out this other method, with which you can send the values using the Label of the controls in the subVI, rather than wiring the connector pane itself: Passing Data to Another VI Using an Invoke Node with VI Server.

 

Nevertheless, I find interesrting why you would need to call VIs for which you're unsure of how their icon/connector pane will be. Following your example, as simple as it is, you could send an array with those numbers, and have the VI do the addition regardless of how many items you have. That being said, I consider it would be a good idea to share with us the reasoning behind using this method, as there might be a different way of solving it without much troubles calling dynamic VIs.

 

All the best,

0 Kudos
Message 3 of 8
(2,585 Views)

Whilst I agree that there's probably a better and/or simpler way to solve this problem, and that some more information might lead to something more helpful, I'll also just ask the easy question - is it possible to write all of your SubVIs with the same panel? For example, in the pair you gave, you could have 3 inputs and call one "unused" in the 2 input case.


GCentral
Message 4 of 8
(2,562 Views)

@Rayzab wrote:

There is a function called a Call to Reference that I am using. 


The build in function is called Call By Reference. Think you're referring to that...

 


@Rayzab wrote:

However, the function only accepts a static refnum which is handy if I know what type of Vi I want to call.


It only accepts strict typed references. That is something different then a static reference. A static VI reference has an option to return a strict type reference, but so does Open VI Reference.

 


@Rayzab wrote:

However, However, I am running that function in a loop as its calling multiple different SUB Vi's. However, say one sub-vi is a 2 input adder, and then a 3 input adder. Lab view wont let me do that.


Not with a Call By Reference (as you found out). You need to use 'normal' dynamic VI calling.

 

This has consequences. For instance, Call By Reference will be able to call VI's that are already running, where the run method will fail. You'll either need to make sure it's not running, or make the VI reentrant and open a clone.

 


@Rayzab wrote:

I want to call multiple different type of VI's, is there any help you can give me regarding this problem?


So you need to open references, set the input names by label or index, run the VI and retrieve the values by name or by index.

 

There are other solutions that avoid this problem. For instance, give each calculation and array of values. If you need support for multiple types, pass an array of variants. Then you could make one VI that accepts a calculation enum... (This will get kludgy, and that's where OO comes in...) Once you have that, you can execute any calculation with any set of parameters, without VI server. If you put the output back on the input array with the inputs removed (a stack) you can make this calculation recursive, so you can execute an array of calculations.

0 Kudos
Message 5 of 8
(2,526 Views)

Maybe a little more detail on what you are actually trying to do would help as your attached program makes no sense .

 

"I am currently having some trouble calling multiple different VI." Does not really make any sense unless you do not understand the "data flow" paradigm that LabVIEW is based on. 

 

"However, I am running that function in a loop as its calling multiple different SUB Vi's. However, say one sub-vi is a 2 input adder, and then a 3 input adder. Lab view wont let me do that."

 

Also makes no sense at all, you simply put BOTH sub-vi's in your main vi and use some logic like a case to run only the sub-vi you need to run at that time.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 8
(2,510 Views)

Hello Oscar, the reason I am doing this is because I am in the middle of the attempt to write a tester. Right now I am just designing the basic code to read through an ini file with all the vi locations. I am just using basic add/subtract functions because I have not officially designed the testers yet. The testers can be different vi files.

0 Kudos
Message 7 of 8
(2,484 Views)

@Rayzab wrote:

Hello Oscar, the reason I am doing this is because I am in the middle of the attempt to write a tester. Right now I am just designing the basic code to read through an ini file with all the vi locations. I am just using basic add/subtract functions because I have not officially designed the testers yet. The testers can be different vi files.


 

I think you lack some basic understanding of LabVIEW programming and how to develop a program that can run different tests (call then different VI's if you want) based on user input, test results, model selected, or whatever.

 

Because you are getting hung up on details that you really do not need to even worry about at this point in your program development.

 

========================
=== Engineer Ambiguously ===
========================
Message 8 of 8
(2,477 Views)