LabVIEW has a mechanism called Polymorphic VI. It's a block that can assume several predefined behaviours. Showing it is easier than explaining. In this post, I explain a polymorphic block that can configure 3 very different temperature probes.
|
Example from the DMM6500 driver: Configure temperature settings
The driver has configuration blocks to define the parameters for measurement modes. Example: voltage, current, resistance, temperature, capacitance, … . Most require a straightforward configuration. But temperature is a configuration that has different ways of working, dependent on the probe used. The settings for a thermocouple are very different than those for a RDC or thermistor. In that case, it makes sense to create a polymorphic block:
The driver developer (Keithley) creates a block for each of the 3 specific cases: thermocouple, rdc and thermistor. They also create a polymorphic bock for generic temperature configuration.
The driver user (me and you) use the polymorphic block, and at design time*, check for what input probe type we want to configure it. Based on the selected instance, the block will present different parameters.
The image below shows the different parameters for a thermocouple vs an RTD:
When you drop a Temperature block on your workflow, you'll be presented with the parameter connectors for the implementation that you select after placing the block. If you select Thermocouple, you don't see (or have to deal with) RTD parameters such as RTD type, … (or thermistor settings). When you select RTD, you don't have to deal with all the thermocouple and thermistor settings.
Also for the driver implementor (Keithley), it's easier, because the flows behind the polymorphic instances are simpler and only have to deal with one scenario at a time.
In this example flow, you'll find two different places where a Temperature polymorphic VI is used:
The first temperature VI is set to RTD. It's used in this flow to define the parameters of a cold junction reference placed on a scanner card. The second temperature VI is set to Thermocouple. This one configures the other channels of that scanner card, as thermocouple inputs.
* this is design time polymorphism. LabVIEW also has a mechanism to define the implementation based on the type of parameters passed. It 'll then decide the correct instance at run time.