NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

typecasting Labview variant in Teststand

Hi SmokeMonster,

 

Can you provide an example sequence file and VI that show this issue?  I'd like to see if I can reproduce it here.

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 11 of 19
(2,681 Views)

Hi Al,

 

Sorry I'm just now responding.  I had kinda forgotten about this thread because what I coded up works (even if I don't exactly like it).

 

I'm attaching a sequence and the VI I'm using.  On the Test Stand side I have a custom type that called CalibrationPoint that is 2 numerics (essentially sensor voltage and the engineer value this voltage represents).

 

We have a procedure where we are able to compare multiple sensors against 1 reference for multiple points.  So the the columns of the 2D array are each calibrated point.  The rows are each sensor.  TestStand is clunky when it comes to handling arrays and I was sort of hoping I could pass this 2D array to a LabVIEW variant and let it index a single row out of the 2D data and give it back to me and somehow TestStand would figure out what I was trying to do with it.

 

 

-SM

Download All
0 Kudos
Message 12 of 19
(2,646 Views)

Hi SM,

 

Thanks for the code, I now understand what you mean.  Unfortunately, this is a known limitation with LabVIEW variants in TestStand.  When LabVIEW variant data is returned to a TestStand from a LabVIEW code module, the data overwrites the property.  TestStand does not have a mechanism to "fit" the returned variant data to the TestStand type, so unfortunately you will need to either remap the data to the type as you are doing, or use a cluster rather than a variant.  

 

Since these approaches are not ideal, I also want to mention that TestStand 2012 significantly improves array manipulation in TestStand, so that you could avoid the need for this altogether.  For example, in TestStand 2012, you can index out a row of a 2D array using the syntax variable[index], and you can specify ranges of elements, such as variable[0][0..2]. There are also a number of new expression functions for array manipulation.  for more information,  refer to the TestStand 2012 new features help topic.

 

Hopefully this clarifies things for you.  Let me know if you have any additional questions!

 

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 13 of 19
(2,625 Views)

Hi Al,

 

Funny thing, I was searching for some help on a related issue and this thread was high up in my search results.

 

This is possibly more of a LabVIEW question but I'm not sure.  I'm trying to use the GetValVariant PropertyObject function to pass a 1-D array of a Type (Generic Gauge) with 4 Strings.  Weird thing, I'm using Variant to Data and passing it the correct Type.  On the conversion I get the number of array elements I am expecting but the individual Strings are empty when I probe.  I confirm that they are populated on the TestStand side.  I'm at a loss as to what is happening.  

0 Kudos
Message 14 of 19
(2,593 Views)

I'm not sure why your vi isn't working, but there are some wrapper vis that ship with teststand already to get arrays from TestStand using GetValVariant. You can probably either use them directly or look at how they are implemented. On the block diagram, in the TestStand palette you can use the Get Property Value vi to get array values.

 

-Doug

 

 

0 Kudos
Message 15 of 19
(2,586 Views)

Hi SM,

 

Unfortunately, you cannot use getvalvariant to read entire containers (or arrays of containers) as you are doing in the example code.  This method only works for arrays of standard data types.  In order to get the value of the items in a container, you will need to call the get method on each item individually. In the case of an array of containers, you can use the following procedure:

 

  1. Use getNumElements to determine the number of elements in the array
  2. Use getNthSubProperty within a for loop to get each element
  3. Use getValString to get each element, using the name of the element in the type as the lookup string.
  4. Build the array of clusters from this data

 

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 16 of 19
(2,568 Views)

Seriously ? Why container/cluster conversion cannot be done automatically ?

 

Are they unsupported/hacky features withing Teststand/Labview ?

 

David Koch

0 Kudos
Message 17 of 19
(2,285 Views)

Hi Al B.,

 

Can you show an example of this? What lookup string should I pass to  getNthSubProperty? Also, what index do I pass tothe getNthSubProperty invoke node, do I just pass "i" from the iteration of the for loop?  What lookup string to I pass to the getvalString invoke node?

 

I have an array of clusters (or array of containers) and each array element contains a string and a number (dbl). I want to unpack both of these for each element in the array (for each container).

 

I'm not having much success with steps 2 and 3. Step 1 and 4 make good sense to me.

 

Thanks,

 

Marco

0 Kudos
Message 18 of 19
(2,162 Views)

Hi Marco,

 

You are correct in assuming that you will just need to pass in the iteration count of the for loop to the getNthSubProperty invoke node. Are you looking to unpack your elements using TestStand or are you calling into a VI in LabVIEW that will do the unpacking. Do you already have some code in development? If so, posting where you are can help me determine where you will need to go. I don't have the example Al of exactly what he was talking about, but any more info on what you are working with would help me out. Thanks.

 

Paul C

Paul C
0 Kudos
Message 19 of 19
(2,134 Views)