LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

should I use a polymorphic VI

I am attempting to create a VI that will be used to run a set of commands to run a power source.  The issue is that the source used can be one of a few possibilities of vendors.  I was looking to create a VI that would take a command (basic to all types) and perform the necessary actions to get that method/property retrieve done without the used having to know what supply is being used.  I first thought of Polymorphic VIs since polymorphism is what would be used in text programming, but as I read up on them, it seems that data type is the deciding factor.  Should a polymorphic vi be used for what I am looking to accomplish?

0 Kudos
Message 1 of 5
(2,692 Views)

I would highly recommend that you consider using LVOOP (LabVIEW OOP) for this. This is the perfect example of when a class definition is useful and an OOP solution will solve your problem quite nicely.



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 2 of 5
(2,688 Views)

I did something very similar years ago (before LVOOP) that I'm still using today.

 

Instead of using a polymorphic vi I made what is commonly referred to in this forum as an 'Action Engine'.

 

Because all of the powersupplies I control used GPIB to communicate I initialize the parameters needed at the start (Supply type and GPIB address) and they're stored in shift registers for when I call the function next.

 

Heres a simple example of how it's used.

 

 

No polymorphism, no LVOOP, no references needing to passed around, very simple to use.

 

The only drawback will be if you want to control more than one powersupply simultaneously.

Then you may need to go with LVOOP.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 3 of 5
(2,679 Views)

Why don't I just post the vi?

 

You'll need to install the (downloadable) drivers for the powersupplies for the instrument driver vis to be added to your LabVIEW \ instr.lib directory for it to work.

(may need to relink location)

 

Power supply list:

HP6032A

HP664xA,

HP665xA

HP667xA

HP668xA

HP669xA

Xantrex XFR2060

Xantrex XPD3316

HPD1520

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 4 of 5
(2,674 Views)

WOW,

this takes me back a few years-----

Back in the day, I worked to develop something my co-wires called "IVI-lite",   I called them "function drivers" or "IVI Anorexic"   Basically I replaced the VISA Session with a variant,  included the specific instrument as a property of the variant and used a case (on variant property>inst) to select how the current instrument connected to was commanded to do a "Function" needed by the test enviroment.  E.G. "Set Voltage" or "Atten Signal"

 

LVOOP AND IVI have given more flexability but, "IVI Anorexic" was adopted by the group despite the burden of validation for each equipment type.  I do not recommend this approach for the faint of heart.

 

In a limited set of tests on a specific DUT (like Design validation of a series of implantable medical devices) a set PS function driver that can use a low wattage DCPS, a High current DCPS or a battery (manual) to provide function "Set Voltage" can help........but,  This is a specific case of "high-mix" and "low reuse" with limited options

 

 

A LVOOP Class is most often preferable in current LabVIEW versions


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 5
(2,665 Views)