简体   繁体   中英

Why does TestStand "RunState.TestSockets.MyIndex = -1" at Runtime?

I am using TestStand 2014 SP1 and LabVIEW 2014 SP1 as the test adapter to test up to two UUTs (Unit Under Test) using BatchModel.seq. The test sequence has been running fine until recently when the

RunState.TestSockets.MyIndex

variable has been returning a "-1" and causing my array index selection and the dynamic report path generations to go awry (nasty runtime errors). I have an expression in the ReportOptions to use RunState.TestSockets.MyIndex value to create the report paths at runtime.

I am new to TestStand and I am no expert in using the Batch Model but, from my understanding, if I only test 1 UUT, RunState.TestSockets.MyIndex = 0 . If I test 2 UUTs, RunState.TestSockets.MyIndex = 1 (so I can then use the index of "0" or "1" in the my array, say, testInfo[0,1], or uutInfo[0,1], blah, blah.

But if RunState.TestSockets.MyIndex = -1 , testInfo[-1] or uutInfo[-1] would be invalid and return a step execution error, crashing the test basically.

Again, this RunState.TestSockets.MyIndex = -1 state is only recent. My TestStand "Model Options" is set for 4 test sockets (default, I think). In the ModelOptions.seq it is overriding the default with expression:

Parameters.ModelOptions.NumTestSockets = 2

I did not change anything to the TestStand's batchmodel.seq as that is restricted from edits. So I am at a loss where this "RunState.TestSockets.MyIndex = -1" is coming from.

Thanks in advance, Aldrin

Value of RunState.TestSockets.MyIndex depends on the execution callback. It has value 0 or greater just for those callbacks, which are executed for each test socket. And for ProcessSetup, ProcessClenup, PreBatch, PostBatch - callbacks, which are executed only once - RunState.TestSockets.MyIndex = -1, because code actually runs not for socket, but in general for all sockets at once. But in case of PreUUT, PostUUT, MainSequence callbacks that variable will have proper value, based on the test socket. Because, those callbacks are executed in parallel, for each test socket. Also it means, that for example, if you have some code in SequenceFilePostResultListEntry, and that code relies on RunState.TestSockets.MyIndex value, then you need to rememeber from which callback it is called. Because, SequenceFilePostResultListEntry is called for every step - so during ProcessSetup execution it will have -1 value for RunState.TestSockets.MyIndex variable, but during MainSequence execution it will have socket index value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM