LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Misuse of Polymorphic VIs

Newer <> better

 

Yokogawa decided to get all fancy and use the new Polymorphic feature on a lot of their VIs.

 

I get it Polymorphic VIs can be a nice feature but there is a point where they are actually worse than the old VI's.

 

Example creating a measurement list for any Yokogawa power analyzer like the WT-500 I could do this:

 

OldCapture.PNG

 

But with the fancy new polymorphic VIs that came with our fancy new WT-1800 power analyzer I have to do this to obtain the same results:

 

NewCapture.PNG

 

OH, yeah that is soooo much better... NOT!

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 10
(2,450 Views)

Haha, you're right, OVERUSE

 

Use polymorphic only when the VI supports more than one connector pane format and/or change in input data type. Datatype handling was improvised with the introduction of malleable VIs.

 

In your case, neither the connector pane nor the data type seems to change, then it should be a single VI with case structure handling.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution
0 Kudos
Message 2 of 10
(2,445 Views)

@RTSLVU wrote:

Yokogawa decided to get all fancy and use the new Polymorphic feature on a lot of their VIs.


 

Polymorphic VIs are a very old feature. Malleable Vis are relatively recent. (Cannot tell from the picture what you have there)

0 Kudos
Message 3 of 10
(2,441 Views)

@altenbach wrote:

@RTSLVU wrote:

Yokogawa decided to get all fancy and use the new Polymorphic feature on a lot of their VIs.


 

Polymorphic VIs are a very old feature. Malleable Vis are relatively recent. (Cannot tell from the picture what you have there)


I am not sure if I even know the difference between polymorphic and mailable VIs. 

 

But LabVIEW 2018 is the most recent version Yokogawa has VIs for, maybe it's not so new.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 10
(2,429 Views)

From what I can see, it looks like they decided to break up a single VI with A LOT of cases into separate VIs/methods.  I would say this is an improvement in readability.

 

Otherwise, it looks like they were trying to copy DAQmx.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 10
(2,422 Views)

@crossrulz wrote:

From what I can see, it looks like they decided to break up a single VI with A LOT of cases into separate VIs/methods.  I would say this is an improvement in readability.

 


I don't agree. The "old way" took one single instance of one VI that looked like this inside:

orgCapture.PNG

The "Function" ring contained every measurement possible. This VI actually had more functionality than the "new" ones because it could also call up the Preset and it handled building the entire string and writing it to the instrument.

 

The "new way" requires one of the Polys and a second VI just to complete the string and write it to the instrument

n1Capture.PNGn2Capture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 10
(2,396 Views)

A great rule of thumb is to implement your own wrapper around any external dependencies whose API you don't control. That way you can limit the scope of change in your application.

 

In your case, a wrapper VI using an enum (for the calls you need) plus any common parameters. That internally calls the correct polymorphic VI instance (either the specific VI or the polymorphic VI).

0 Kudos
Message 7 of 10
(2,378 Views)

@tyk007 wrote:

A great rule of thumb is to implement your own wrapper around any external dependencies whose API you don't control. That way you can limit the scope of change in your application.

 

In your case, a wrapper VI using an enum (for the calls you need) plus any common parameters. That internally calls the correct polymorphic VI instance (either the specific VI or the polymorphic VI).


So you create a VI to recombine all the code that was originally separated from a single VI.  That takes Rube-ish code to a new level!  😄  However, yes, that is how I might implement this as well.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 10
(2,365 Views)

@RTSLVU wrote:

The "new way" requires one of the Polys and a second VI just to complete the string and write it to the instrument

n1Capture.PNGn2Capture.PNG


Well, the extra VI is kind of silly.  I think I would have just had the ability to add to the list in the previous VI.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 10
(2,343 Views)

@billko wrote:

@tyk007 wrote:

A great rule of thumb is to implement your own wrapper around any external dependencies whose API you don't control. That way you can limit the scope of change in your application.

 

In your case, a wrapper VI using an enum (for the calls you need) plus any common parameters. That internally calls the correct polymorphic VI instance (either the specific VI or the polymorphic VI).


So you create a VI to recombine all the code that was originally separated from a single VI.  That takes Rube-ish code to a new level!  😄  However, yes, that is how I might implement this as well.


Haha yes, that's probably how I would have started, and then be amused how it ended. I've been bitten many times with vendor API changes that the extra work involved in providing my own abstraction up front was worth doing.

Message 10 of 10
(2,334 Views)