LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

polymorphic units break automatic selection of polymorphic vi

I have a polymorphic vi that can have a single DBL input, or a array of DBL.  Normally, that works fine.
Also, when I give those inputsa unit, for example 'km' it works as expected.
 
However, when I give a polymorphic unit '$1'  then the automatic selection of the polymorphic vi doesn't work anymore. I get a broken wire.
The vi still works.  When I manually change 'select type'  from automatic to the array instance, it works again.
 
 
I wonder if this behaviour is a bug or a design decision?    I understand that adding polymorphic units make the automatic selection more difficult...
 
 
I added a zip with a simple example:  polymorphic vi & instances, plus a vi that uses it.
0 Kudos
Message 1 of 5
(3,256 Views)
I'm not quite clear how you're using these VIs.  The "Use polymorph vi.vi" opens runnable in LabVIEW 8.5 on my machine (that's the version they're saved in, so I assume that's what you're using too).
 
Is there a set of steps that you're taking that causes the VI to become broken when you wouldn't expect it to be?  I wasn't sure if you were trying to change the units on the poly VI instances, or on the constants / indicators on the VI that calls the poly VI.  I know a thing or two about poly VIs, but am not particularly familiar with units.  If you can provide a little more info on this I'll do my best to help out.

Message Edited by Jeff B on 10-24-2007 02:04 PM

0 Kudos
Message 2 of 5
(3,240 Views)

I see I wasn't clear about this.   I'll try to explain.

The polymorphic vi isn't broken.  But the automatic selection of the correct instance of the polymorphic vi is broken.    If you right-click on the polymorphic vi in the example program, and change 'Select Type'  to ' Automatic'  you get broken wires.   You must select the instance manually to run the program.  

Normally, Labview will recognize the difference between a single element and an array, and will automatically select the array instance instead of the single element instance.  So you don't need to select the correct instance manually.

 

Try to the following:  Edit the 'array element'  vi, and remove the units.  Save 'array element' and 'polymorphic element'.   Also remove the units of the input array in 'use polymorphic vi'.  
If you now set 'Select Type' to 'Automatic', you don't get broken wires.  Labview automatically recognizes that it should use the array instances, and not the single element instance of the polymorphic vi.  

 

(I see where the confusion comes from...   I saved the example program with the correct manual selection.  Change the selection to automatic, and you'll get the broken wires immediately.) 

Message Edited by Anthony de Vries on 10-25-2007 10:05 AM

0 Kudos
Message 3 of 5
(3,221 Views)
Hi Anthony, hi Jeff,

evaluating Anthony's VIs, i found that changing the array's unit string to "$1" did resolve the wiring conflict, as now the correct instance of the VI is selected.

It seems that polymorph units are not supported in the polymorphic VI decision routine...
0 Kudos
Message 4 of 5
(3,202 Views)
Ah yes, your comment at the bottom was key.  While I was trying to figure out where the problem was I even checked the selection type, but I only checked the top subVI, which is set to automatic selection.  Turns out that one is probably just defaulting to the first instance, which happens to be correct for the input wired to it.
 
While I can't confirm this yet, I can't think of any reason poly VI selection couldn't work with polymorphic units.  This was reported to R&D (4EO6OT1W) for further investigation, sorry for the inconvenience.
0 Kudos
Message 5 of 5
(3,201 Views)