Polymorphic and Malleable VIs

Today we’re going to discuss some different VI types and talk about when to use them!

Polymorphic VIs:

Polymorphic VIs adapt to different data types. A polymorphic VI is a collection of VIs with the same connector pane patterns. Each VI in the collection is an instance of the polymorphic VI, and each instance has at least one input or output terminal that accepts a different data type than in the other instances.

Malleable VIs:

Malleable VIs are inlined into their calling VIs, and they adapt each terminal to input data type. I know they sound very similar to polymorphic VI but the benefit is they are more flexible. Unlike polymorphic VIs, you don’t need to create handler of all possible data types. This is done automatically by computing whether the data type is acceptable by implementation. So, if you have an Increment function, it will automatically accept numeric data types, arrays, etc. – but will ignore strings (so it’ll just pass data through). Also, Malleable VIs use Type Specialization Structure, which basically decides, whether input data type is acceptable.

Custom Control: Links neither data nor control appearance to instances in source code
Type Def: Links data but no linking of appearance to all instances in source code
Strict Type Def: Links both data and apperance to all instances in source code

Malleable VIs differ from polymorphic VIs in the following ways:

  • A polymorphic VI uses a predefined set of acceptable data types. A malleable VI computes whether a data type is acceptable by implementation. A malleable VI is more flexible when determining which data types are acceptable.
  • A malleable VI is one single VI. A polymorphic VI is a collection of instance VIs.
  • You convert any standard VI into a malleable VI by changing the file extension to .vim. For polymorphic VIs, you must create an instance VI for each data type and combine the instance VIs into one polymorphic VI.
  • A malleable VI has the same set of terminals for any data type. A polymorphic VI consists of a collection of instance VIs that can have different sets of terminals for different data types. A malleable VI performs the same operation with the same implementation on any acceptable data type. A polymorphic VI can be configured to perform the same operation with different implementations across data types.
  • A malleable VI adapts to any acceptable input data type. A polymorphic VI has the flexibility of predefining the acceptable data types.

Use malleable VIs when you perform the same operation on any acceptable data type and the operation can be implemented in the same way for different data types. To perform the same operation on a predefined set of data types or if the operation must be implemented differently across data types, use polymorphic VIs instead.

To learn more about VIs and working with LabVIEW make sure to check out the wiki, and grab your copy today!

Be the 1st to vote.

Leave a Reply

Your email address will not be published. Required fields are marked *