NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can a CVI module access the UUT serial number already stored in TestStand?

I'm using the parallel model and I need to program each of my UUT's EEPROM with its serial number. I know that
TestStand has the serial number and I've gathered from the Developer exchange that it is stored in RunState.Caller.Locals.UUT.SerialNumber, but how does my CVI module access it? Can it be passed to the module, if so, how? or what is the exact form of the TestStand API function that can be used to access the serial number. Thank-you for any suggestions.
0 Kudos
Message 1 of 6
(3,614 Views)
If you create a CVI step in TestStand, then select "Specify Module", select the "Source Code" tab, the select "Create Code", you will get a starting point for the code you need. The key function is:

tsErrChk (TS_PropertyGetValString(testData->seqContextCVI, &errorInfo,
"RunState.Caller.Locals.UUT.SerialNumber",
0, &serialNumber));

Mark
0 Kudos
Message 2 of 6
(3,614 Views)
I am using the Batch process model and using the following command to retrieve the UUT serial number:

tsErrChk(TS_PropertyGetValString(testData->seqContextCVI, &errorInfo,
"RunState.Caller.RunState.Caller.Locals.UUT.SerialNumber",0, &serialNumber));

Note the additional RunState.Caller reference in the lookup string.

Scott Trosper
0 Kudos
Message 3 of 6
(3,614 Views)
Are you saying that RunState.Caller has to be repeated
and that the two appearances of it in the example of
the function call you sent me is not a typo?
0 Kudos
Message 4 of 6
(3,614 Views)
Hi lynx,
if you have a look at the way in which the parallel and batch process models work, they're a two stage process model, i.e. the process model sequence your (main) sequence sees is called by an another process model. In this case, RunState.Caller on it's own only takes you up one level, but RunState.Caller.RunState.Caller will take you to the top level process model. When dealing with multi-UUT models, it depends on which serial number you're after (parallel serial numbers are stored in the TestUUTs model entry point->Locals.ModelData.TestSockets[0].UUT.SerialNumber
where the [0] signifies the testsocket you're looking at (i.e. if it's the third testsocket, use [2].)
batch serial numbers are stored in the same place, with the addition of the BatchSerialNumber (i.e. TestUUTs model entry point->Locals.ModelData.TestSockets[0].UUT.BatchSerialNumber, however there is also a BatchSerialNumber in TestUUTs model entry point->Locals.ModelData.BatchSerialNumber which is the same as the above one.

You can always use the RunState.Root to get to the main calling process model, and in the case of the parallel and batch process models, the serial numbers are passed down from the top level execution entry point anyway into RunState.Root.Parameters.ModelData.TestSockets[0].UUT.SerialNumber
(otherwise, if you're very buried in sequences, i.e. your mainsequence calls another which calls another etc etc, your call gets longer and longer - in cases like this I tend to use a Parameter, and pass the serial number down through the levels)
If you want the data as if it came from the top level, since the LabVIEW adapter needs to see the data in a particular place, you can also use
RunState.Root.Locals.UUT.SerialNumber.

The quickest way I've found to find stuff is to create a new sequence file with just a label step in it. Set the sequence file to use the appropriate process model you're interested in, and set the label step to a breakpoint. You can then look at the context tab once you've set the sequence running from your desired execution entry point, and browse away.

There's some great documentation in \Components\NI\Models\TestStandModels\TestStandProcessModels.PDF
explaining how the process models actually work.

A word of warning though - if you decide to change the serial numbers on the fly (one particular case is if you needed a bar code serial number which included information on failures for example), because the serial number is available in several places, you need to check where the report generation is picking up it's serial number information from.

Hope that helps

Sash.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 5 of 6
(3,614 Views)
This was not a typo. I had done what Sacha described where I paused the sequence and found the information using the Watch window. From Sacha's response it appears that the information may reside in other locations as well, but for the batch sequence I am using, the RunState.Caller.RunState.Caller... reference seems to work fine. Sorry for the delayed response, email issues over the past few days.. Scott
0 Kudos
Message 6 of 6
(3,614 Views)