NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Array of Clusters containing Binary Strings through LabVIEW adapter

Solved!
Go to solution
I need to pass through LabVIEW adapter an array of clusters containing binary strings.
These data will be later logged into MySQL database.

I need to force the option "Binary string" option for the ValBinary item even if my output array is empty.

Is it possible ?

Versions used : TestStand 4.2.1 + LabVIEW 8.6.1

Attached file : test valbinary2.vi containing the output array of clusters.

Jean-Louis SCHRICKE
CTA - Certified TestStand Architect (2008 - 2022)
CTD - Certified TestStand Developer (2004 & 2007)
CLD - Certified LabVIEW Developer (2003 & 2005)

0 Kudos
Message 1 of 6
(5,620 Views)

Jean-Louis -

 

In order to pass a cluster from LabVIEW to a TestStand container, you must create a custom data type (container) that matches your LabVIEW cluster. The easiest way to do this is to use the "Create Custom Data Type..." button located in the Type column of the Parameters Table for your VI.

 

create.png

 

For example, your VI has an array of clusters as one of it's outputs (RFTS_TestData). Upon clicking the "Create Custom Data Type..." button, you will be prompted by the "Create Custom Data Type From Cluster" dialog. In this dialog you can name your custom data type as well as specify what type of string each string element of the cluster is supposed to be. Set the ValBinary Cluster Element to be a Binary String.

 

binary.png

 

Once you've clicked the Create button, this new custom data type will by default be added to the current sequence file. You can then create an Array of this custom data type and pass it to and from TestStand.

 

local.png

 

 

local2.png

 

Have you tried this? Please let me know if this helps.

Manooch H.
National Instruments
0 Kudos
Message 2 of 6
(5,574 Views)

Hi Manooch,

 

Thanks for your detailed explaination.

 

Of course I created a TestStand DataType corresponding to the RFTS_TestData cluster.

 

As I wrote I my first message, the destination of this data is to be logged into a MySQL database.

Thus, the TestStand destination of this LabVIEW cluster is : Step.Result.RFTS_TestData

 

This is done in a generic TestStand StepType, which doesn't know how many element the array RFTS_Data will contain.

The RFTS_Data is empty. If I had one element, there is no way to force the "Binary String" option within this generic StepType.

 

And If I could programmatically do this, I still don't know what will be the number of elements at execution.

In this application, it is the called VI which knows at execution how many elements will be returned into RFTS_Data array.

 

My feelling is this notion of "Binary String" must be manually pre-defined at sequence edition.

LabVIEW doesn't know that a string is a binary string.

TestStand LabVIEW adapter has no way to take into account automatically or dynamically (at execution) this "binary string" notion.

 

Am I wrong ?

 

Jean-Louis SCHRICKE
CTA - Certified TestStand Architect (2008 - 2022)
CTD - Certified TestStand Developer (2004 & 2007)
CLD - Certified LabVIEW Developer (2003 & 2005)

0 Kudos
Message 3 of 6
(5,559 Views)
Solution
Accepted by topic author Jean-Louis

Howdy Jean-Louis,

 

Apologies, I do not quite follow your question. You're right that LabVIEW does not know a string is a binary strong; LabVIEW, which stores strings in a Pascal format, looks at all strings the same way. Because TestStand stores strings in C-style format, on the other hand, null characters (0x00) can cause confusion when interpreting strings in TestStand as you have come to understand. This is of course the reason TestStand has the functionality to interpret strings as Binary Strings.

 

As Manooch references in his post, to illustrate his point I created within TestSTand an array of the same custom data type to store data passed out of your test valbinary.vi. For testing reasons, I also edited the VI to outputsome constant values to the cluster. (See the following screenshot). Notice that the last string (labeled ValBinary) in the cluster contains a hexadecimal string with a null character inserted as the 3rd character in the screen (before the actual end of the string).

 

binstring_inact_3_vi.png

 

Here is a screenshot of the sequence file created that calls into the VI and then displays to the user the number of elements contained in the array coming from the VI.  Note that the Locals.MyTestData array is empty before execution of the sequence.

 

binstring_inact_1.png

 

Lastly, as the sequence executes, I opened the Variables pane to show the contents of the Locals.MyTestData array. Here I confirmed that the "binary" string from LV was successfully passed into and stored by TestStand.

 

binstring_inact_2.png

 

 Lastly, the message popup in the second step of the sequence indeed displayed a message indicating there were two elements in Locals.MyTestData.

 

 

This sequence was able to successfully execute even without manually specifiying a size of Locals.MyTestData beforehand; TestStand dynamically allocated elements as necessary to store the results of test valbinary.vi.

Warm regards,

pBerg
Message 4 of 6
(5,537 Views)

Hi pBerg,

 

Great job!

 

I was able to reproduce your example in my context and pass binary strings through this array of containers.

 

It seems that my understanding was distorted by the fact that if the vi has not an empty output RFTS_Data array, an ASCII string appears in the "Specify Module", which I assume is the default type for a string, even if the string will be passed as a binary string (checkbox in the TestStand TypeDef) :

 

RFTS_TestData1.PNG

 

In order the reproduce this display, simply set a default value of one element within the test valbinary2.vi.

You will observe the picture above.

 

Now I know that I can use binary strings for my application.

I will go on in this direction and log these data into the MySQL Database.

 

Best regards and many thanks.

 

Jean-Louis SCHRICKE
CTA - Certified TestStand Architect (2008 - 2022)
CTD - Certified TestStand Developer (2004 & 2007)
CLD - Certified LabVIEW Developer (2003 & 2005)

0 Kudos
Message 5 of 6
(5,524 Views)

Jean-Louis,

 

Ah, yes, I now see where the misunderstanding arose, courtesy of default output values from the VI. 

 

Thank you for the kind words, I'm glad you found the information helpful. I'm elated to hear, too, that you're now able to move forward with your sequence development.

 

Take care!

Warm regards,

pBerg
0 Kudos
Message 6 of 6
(5,518 Views)