NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand: Pass scalar or array to same LabVIEW VI input

Hi everyone,

I’m integrating a LabVIEW VI into TestStand and would like to design the VI so that it can process both single numeric values and numeric arrays — but using only one input terminal on the VI.

In other words, depending on the test step, I might want to pass:

  • a single number (e.g., 5.2), or

  • an array of numbers (e.g., [1.1, 2.2, 3.3])

I’d like the same VI input to handle both cases automatically, without needing separate terminals or separate polymorphic instances.


What’s the best way to implement it so that TestStand can pass either a scalar or an array seamlessly to the VI?

 

Thanks in advance for your help!

0 Kudos
Message 1 of 5
(144 Views)

Use a variant in the VI.  Variant can take any data type.

Convert variant back to numeric/array, the one without error is the actual input.

See attached VI in LabVIEW 2018.

 

George Zou
Message 2 of 5
(118 Views)

@zou wrote:

Use a variant in the VI.  Variant can take any data type.

Convert variant back to numeric/array, the one without error is the actual input.

See attached VI in LabVIEW 2018.

 


Hey zou thanks for your reply.

We get a smiliar solution like yours but we are not so happy with that because we think its not a nice solution to try out which type it is...
If you have a interface which can include multiple tpyes like numeric, numeric arrays, strings, array of strings, containers (clusters) how would you handel that?

 

And if you take look at the variant information passed by teststand you can see the datatype but I didn't find a solution to get this typeinforamtion to convert it to its LabVIEW Datatype.

python007_0-1760527939528.png

 

0 Kudos
Message 3 of 5
(104 Views)

If you have a interface which can include multiple tpyes like numeric, numeric arrays, strings, array of strings,

> containers (clusters) how would you handel that?

Already show you how in my VI.  That's how NI determine what data type is.

 

And if you take look at the variant information passed by teststand you can see the datatype,

> but I didn't find a solution to get this typeinforamtion to convert it to its LabVIEW Datatype.

I know you can see the data in the variant.  But this is not documented.  NI could change it in next release.

 

George Zou
0 Kudos
Message 4 of 5
(87 Views)

It would be a lot easier if you can specify the data type in your sequence.

 

Variant.png

 

George Zou
0 Kudos
Message 5 of 5
(79 Views)