NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand variable Pass-by-reference

I am using the TestStand 'UUT' container to accumulate information about the device under test for the Report Header.  'UUT' is a LOCAL variable in my SequentialModel.seq, and it is also a Parameter in my Pre-UUT and MainSequence, passed by reference to both.  The members of the 'UUT' container that I update in PreUUT are passed back to the SequentialModel correctly, but when I step into the MainSequence, the 'UUT' container reverts back to default values, as though 'UUT' were a LOCAL variable, not a parameter.  The values of the 'UUT' container Parameter that are set during the execution of the MainSequence are not preserved when execution returns to the SequentialModel. the MainSequence Callback in SequentialModel.seq should use the prototype of the actual MainSequence, which specifies that 'UUT' is passed by reference.
0 Kudos
Message 1 of 4
(5,909 Views)

Hi,

By default the MainSequence doesn't have any Parameters.

If you have added the UUT container to the Parameters of MainSequence, This is still not going to work unless you have added the Parameters.UUT to the MainSequence in the Process Model sequence file. Also update the step MainSequence Callback in Test UUTs and Single Pass.

To aviod changing the Process Model sequence file, you can pick the value of UUT by using the Lookup string of RunState.Caller.Locals.UUT.

For example, you can use an Statement Step and set a local copy off UUT into your MainSequence by using the expression Locals.UUT = RunState.Caller.Locals.UUT

Hope this helps

Regards

Ray Farmer

 

Regards
Ray Farmer
Message 2 of 4
(5,892 Views)
Thanks, Ray.  I thought the Run MainSequence callback used the prototype of the Main Sequence when it's loaded at run time ...?  If I 'pick' the value of UUT as you say, can I modify UUT so that the updated members are available in the Process Model?
0 Kudos
Message 3 of 4
(5,887 Views)
Hey brendave,

You are actually correct that it will load the prototype of MainSequence at run time.  I think Ray mentioned this because you can't directly pass anything into the parameters in the traditional way from the sequence call within the process model.  When you are modifying RunState.Caller.Locals.UUT you are actually modifying the value inside of the process model itself.

In TestStand there is an idea of a Call Stack (Process Model->Main Sequence->Sequence 2, etc).  RunState.Caller is going one level up in the call stack.  There is also RunState.Root which always accesses the top most level of the Call Stack.  This is usually your process model unless you have spawned off an execution on your own. This is a little easier to see if you set a breakpoint and view the Call Stack at Run Time.  By default in the sequence editor it will show up in the bottom left of your execution window. Hope this helps!
Pat P.
Software Engineer
National Instruments
Message 4 of 4
(5,863 Views)