LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to nest polymorphic VI's

Solved!
Go to solution

Is it possible to nest polymorphic VI's, or can somebody suggest alternate ways of achieving my goals.

 

I have several VI's written that communicate over a serial port to my device under test. I have combined them into a user selectable polymorphic VI. See the left column of my picture. I also have a very similar set of VI's that communicate with my device under test over Ethernet. I have also combined them into a user selectable polymorphic VI. (middle column). 

 

I can also make polymorphic VI's that automatically choose based on whether they are given a serial port or an IP Address. These are shown as the rows on my picture. 

 

I would like to combine these two ideas into one, as shown by the lower right corner of my picture. The user would select the 'function' they want and theat would then select the appropiate VI based on communication type.

 

Is there any way to make this work?

—Ben
Prevent your computer from sleeping programmatically!
Use Power Requests
Download from GitHub

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

You can make nested menus inside a single polyVI (see the DAQmx read/write VIs for an example). If memory serves, you do this by using a colon in the VI name inside the polyVI to indicate a new level in the menu (e.g. Serial: Open), but I'm sure the help covers this.


___________________
Try to take over the world!
Message 2 of 7
(2,764 Views)

You may consider using LVOOP and define a communication class. Use dynamic dispath to call the appropriate method for your interface.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 7
(2,757 Views)

I was hoping to abstract the difference between Serial and TCP away from the user so they just choose a function and the polymorphic vi picks the right communication type for them.

 

Thanks,

—Ben
Prevent your computer from sleeping programmatically!
Use Power Requests
Download from GitHub

0 Kudos
Message 4 of 7
(2,740 Views)
Solution
Accepted by topic author Ben_Manthey

If you only want serial and TCP, then I would consider using VISA for the TCP calls instead of the TCP primitives. That way the code will be the same and I believe the difference will be only in how you build the VISA resource name.

 

If that doesn't work for you, then Mark's suggestion is good, but you should be aware that OO has a learning curve and it's relatively easy (certainly in the beginning) to make design decisions which you will regret later.


___________________
Try to take over the world!
0 Kudos
Message 5 of 7
(2,732 Views)

The LVOOP option does abstract everything from the user. The only method which is specific to the interface is the configuration. Everything else the user sees is generic communication activities such as read or write.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 7
(2,720 Views)

Thanks everybody. I'm going to use the VISA session suggestion. It allows me to keep the abstraction without the added complexity of OOP.

—Ben
Prevent your computer from sleeping programmatically!
Use Power Requests
Download from GitHub

0 Kudos
Message 7 of 7
(2,693 Views)