NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Can convert some data types from variant, but not others

Solved!
Go to solution

Hi there,

 

I have been using LabVIEW for a couple years, but I am brand new to TestStand. I have just inherited some code, and I would like to "pick off" data while running a test stand sequence and save to a .csv so that I can look at it later, I've made a LabVIEW VI to do this.

 

The test has a couple different data types, like waveforms and custom clusters, so as the input I have a Variant Control and an Enum Control to select different cases. I have had success converting from a variant to numeric, but I get an error when I try to convert from variant to 1D array of waveforms. 

 

Is it possible to do what I want? Am I just making a silly error? Do I have to have a separate input for these odd datatypes, instead of the variant and case structure?

 

I've attached an example created using LV 2012 and TS 2012.

0 Kudos
Message 1 of 13
(4,401 Views)

Hi gregoryj,

 

 

I don't see you assigning the output values Array of Waveforms or Numeric to anything. You can try to store these values both inside of separate local variables or somewhere else, and just not use the one you want. The VI you have coded should output a default value to both outputs no matter what.

Mathew H.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 13
(4,379 Views)

Hi Mathew,

 

I did not assign the outputs to any TestStand variables in this case. I just ran it to see if I would get any errors. In the case of converting a variant to a numeric there was no error. But, in the case of converting a variant to an array of waveforms, there was an error. Although, perhaps the error occurs when TestStand tries to turn the array of waveforms into a variant to pass it to the LabVIEW VI. Hopefully I clarified the issue I am looking at. Thank you,

 

Gregory

0 Kudos
Message 3 of 13
(4,377 Views)
Gregory,

Can you tell me what the error is that you are getting? Is there an error when you run just the LabVIEW VI or is this just an error you're receiving in TestStand?
Mathew H.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 13
(4,353 Views)

Hi Mathew,

 

I just tried to step through it, and the LabVIEW VI doesn't actually get executed when I input the Array of Waveforms to the Variant input (Data) of the VI. Here is the error I see in TestStand:

 

Report

Error: Parameter 'Data':
Type of argument expression 'Locals.WfmArr' is incompatible with parameter.
Specified value does not have the expected type.[Error Code: -17313, Could not accept the parameter passed in. ]
0 Kudos
Message 5 of 13
(4,347 Views)
I think it may be that you are trying to pass an array, but it is expecting a single point. Can you pass just one waveform data point?
Mathew H.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 13
(4,319 Views)

Hi Mathew, 

 

I'm sorry for my lack of response. As with most things at work I just had to get it running quickly without much time to experiment. I had 3 or 4 different types of data (like clusters with many components), and instead of using my idea where they all go in to the same input as a variant, I just made a different input for each data type and chose which one to use with an enum.

 

I will test your idea to see if a single waveform, rather than an array of waveform, is allowed to be sent into the variant input. Thank you,

 

Gregory

0 Kudos
Message 7 of 13
(4,288 Views)

Hi Mathew, I get the following error when I try to pass a waveform or array of waveforms into the variant input. I do not get this error when I pass a number into the variant.

 

 TestSequenceError.JPG

0 Kudos
Message 8 of 13
(4,265 Views)

Hi Gregory,

 

I can't seem to find why this is happening in TestStand as it isn't an issue that is recreatable in LabVIEW although I do notice that in LabVIEW the array of waveforms has to be coerced to a variant datatype.

 

I would recommend passing this information from TestStand to LabVIEW using the Container datatype and unbundling the cluster in your LabVIEW code. Can you try this work around out for your application?

 

Mathew H.
Applications Engineer
National Instruments
0 Kudos
Message 9 of 13
(4,248 Views)

Hi Mathew,

 

I'm not sure I understand your suggestion, am I supposed to create a local variable that is an empty container?

 

Even though when specifying the module the variant input says "Anything", it seems that TestStand restricts what can be passed into a variant input. Is there a list somewhere that says what TestStand allows? Or is there a way in TestStand to typecast a variable to a variant?

0 Kudos
Message 10 of 13
(4,243 Views)