NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Teststand array element names?

I'm attempting to pass a TestStand array of containers to a lump of code as a parameter.  In my case it's .net code, but the same concept applies to LabVIEW code.
 
TestStand has an array attribute that I haven't seen in any other language... array elements can have individual names.  I can't work out how to find out these names from the code that the array is passed to.
 
To see this, create a Multiple Numeric Limit Test, set up two limits called "Voltage" and "Current".  Now open tree view and have a look at (step).Result.Measurement.  This is a 1D array of containers.  However, the words "Voltage" and "Current" are attached to the array indices.  I would have expected these names to be a string value within each of the elements, along with the other variables, as you would have to do in LabVIEW or any other language.
 
I can successfully pass a structure like the "Measurement" array to some code (in either LabVIEW or .net).  I've done this by checking the Cluster Passing and .NET Struct Passing.  The only thing I can't get from the code module is the name of each element.
 
I've even tried adding an additional element to the struct which is a string called "Name".  However, I can't find a way of telling TestStand to populate this string with the name of the element.  I just get an error from TestStand to say that it doesn't know what to populate it with.  I don't think this is the way to do it!
 
I know that there are a million other ways in which this could be achieved.  In our case, it is important that we are able to throw the entire array across in one hit, rather than looping through the elements in TestStand or something.  We need to keep the execution time really tight.
 
I'm trying more experiments, but basically my question is - how can a code module, which is passed a 1D array by TestStand, find out the names of the array elements?  Without doing calls via the sequence context or anything - just using the array value.
 
Many thanks for any help!
0 Kudos
Message 1 of 7
(6,005 Views)

Sean,

Have you looked at chapter 4-6 Creating a New Data Type and chapter 4-7 Creating TestStand Data Types from LabVIEW Clusters in 'Using LabVIEW Data Types With TestStand.

 

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 7
(5,997 Views)
Hello.
 
Yes, I have read it but it only covers the basics.  I'm after the names of the elements, which is a property, rather than a value.  I'd like to be able to explicitly pass this name together with the contents of the container, but I can't find a way of doing it.
 
In TestStand, I can get the names of the Multiple Numeric Limit Test limits by using the Nameof function within a For Each loop (for each element of the original array) to build a 1D array of strings, e.g....
 
Nameof( RunState.Sequence.Main["ID#:3/Q6ZHCdwUKsj77tGPuUWA"/* Unique Id of 'Multiple Numeric Limit Test' */].Result.Measurement[Locals.Offset] )
 
This will get me a separate array of the names of the array elements.  This is my best solution so far - I can then pass this 1D array of strings in as a parameter alongside the original array.  I'd prefer to be able to pass the array of containers in one hit in a way that the code module it's passed to can be passed this information.
 
It seems to me that TestStand has a concept of array elements having a name attribute.  I've not seen this concept in any other language.  You kind of get an extra hidden string for free.  This is fine within TestStand, but I'm after a way for other languages to find this out.
 
0 Kudos
Message 3 of 7
(5,997 Views)

Hi,

Here is a little example I did for obtaining the subproperties of a container.

http://forums.ni.com/ni/board/message?board.id=330&message.id=2138&query.id=376710#M2138

Hope this helps

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 4 of 7
(5,990 Views)

I'm not too sure what the example does, but the Message Popup is trying to display the numeric Locals.size without a Str() function, so it just gives an error.

I'm trying to avoid doing processing in TestStand to make things efficient.  I want to be able to throw an array of containers at a lump of code (either .net or LabVIEW).  The problem is that there doesn't seem to be any equivalent to TestStand's concept of each element having its own name.

I already have a workaround in doing a For...Each loop in TestStand to get a 1D array of the names.  Ideally, I'd like to be able to directly populate some form of array of structs so that the names of the elements gets passed directly in.

Call me old-fashioned, but I prefer to keep data in one form instead of doing programmatic re-processing of it to pass it from one module to another.

0 Kudos
Message 5 of 7
(5,981 Views)

Hi,

  I've attached some code below that should give you the correct roadmap. It has to use the For loop method since you have to get each Named object individually.

I may be missing your point of the need to pass in the array directly including the matching memory structure to include the names, but I really don't think that's going to work.

Hope it helps

Thanks

Sacha Emery National Instruments (UK)

Message Edited by SachaE on 11-15-2006 03:01 PM

// it takes almost no time to rate an answer Smiley Wink
Download All
Message 6 of 7
(5,958 Views)

Ta Sacha.  That's basically my workaround that I've done in TestStand, using the Nameof function.

So the conclusion is that TestStand's model of an array of containers/clusters/structs is different from any other language.  It has a concept of the array elements each having an individual name.  You almost get an extra hidden array of strings.  This means that you can't always get all the data out of an array of containers by passing it directly to a code module.

As long as I know I'm doing this in the most elegant way possible.  I didn't want to do it my way and later find out there's a better option.

Thanks

-Sean

0 Kudos
Message 7 of 7
(5,943 Views)