NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to manage variables in dynamically loaded sequence

mishaw,

The modifications to the sequence locals that you make in your UpdateClientSequence function do not take effect because the sequence file was unloaded from memory when you called the ReleaseSequenceFileEx function. To get the behavior you want you need to keep the client sequence file loaded while you are modifying it and before executing it. For example, you could save a reference to the client sequence file in a File Global variable in the PreUUT callback and call the ReleaseSequenceFileEx function in the PostUUT callback.


0 Kudos
Message 11 of 15
(1,672 Views)

Erik,

I have implemented all your recommendations:
-to remove ReleaseSequenceFileEx() call from PreUUT
-to save a reference to the client sequence file in a FileGlobals of ProcessModel file
-to release this reference in PostUUT.
It works fine, except for "Abort". In this case PostUUT and therefore ReleaseSequenceFileEx() is not called.
How to ensure GetSequenceFileEx()-ReleaseSequenceFileEx() calls balance for all cases?

Thanks,
Misha

0 Kudos
Message 12 of 15
(1,649 Views)
Misha,

The Abort command does not run any cleanup, so there is no way to ensure that ReleaseSequenceFile is called in this case. I can think of a couple of options for you:

  1. The Abort command is enabled only for users that have the Abort privilege enabled. You can disable this privilege for all of your users.
  2. Instead of setting client file local variables in PreUUT, you could pass parameters to the client file. In this case you don't have to keep the file loaded. Here's how it would work:  
  • In PreUUT, load the client file, set FileGlobals.clientParameters to the parameters you want to pass and set the ClientFile property. You can do this in a statement step:
FileGlobals.ClientParameters = "New Value",
FileGlobals.ClientFile = RunState.Engine.GetSequenceFileEx("d:\\temp\\B.seq"),
RunState.Execution.ClientFile = FileGlobals.ClientFile,
RunState.Engine.ReleaseSequenceFileEx(FileGlobals.ClientFile)
  • In B.seq, add a parameter that corresponds to the data you want to pass.
  • In TestUUTs, edit the step named "MainSequence Callback" and add a parameter to the step using the prototype of B.seq.
  1. To workaround a bug in TestStand, select the MainSequence Callback step and change the value of the Step.TS.SData.UsePrototype property to true. This is a hidden property so it is visible in the Variables pane only if you have Show Hidden Properties enabled in the Station Options dialog.
  2. Click on the Load Prototype button on the Module tab of the step settings pane and browse to B.seq and press OK.
  3. Type in FileGlobals.ClientParameters in the Value column for the parameter that was added.
This option will work even if your client files take different types of data as long as you set FileGlobals.ClientParameters correctly.
Hope this helps,
-Erik
0 Kudos
Message 13 of 15
(1,636 Views)

We have a similar requirement in our test solutions.  We have the PreUUT to collect data and part of this included the client sequence file that should be executed for the supplied serial number.  If the current ProcessModelClient is not the correct file we load the correct file using the TS API and change the Execution.ClientFile property to the new file.  

There is additional data that is collected about the UUT that the test solution will need so we want to make this data available in the client sequence.  We have found that we can edit RunState.ProcessModelClient.Data.Seq[\"MainSequence\"].Locals after we have checked and swapped the client file if required then we can happily delete and reinsert updated version of the locals in the client sequence.  To make things simple we have defined a data type for all the UUT data that has an unstructured container within it to allow us to add new variables in the future without upsetting TestStand with a type change.

As I say this all works well as TestStand appears to take the current version of the ProcessModelClient's MainSequence each time TestUUTs makes the call.  So if we change RunState.ProcessModelClient.Data.Seq[\"MainSequence\"].Locals in PreUUT the next iteration of the TestUUTs loop then the new values appear in the Locals of the client file.

The files in the attached zip can be added to you components\user\models folder and provide an cut-down example of what we are doing (set you model to PMSwapSequentialModel.seq).  Yuo can start execution from any sequence file but the example always runs PMClient.seq and its locals are updated.

We do have a problem though and that is the Parallel and Batch models.  This just will not work as there is only a single ProcessModelClient for all test sockets.  Therefore you have no way to edit the Locals of each executions

I am still looking for a better way to manage the Client File and test data in our applications.  Any suggestions welcome!  Maybe a consideration for NI is to add unstructured container as a parameter for all MainSequence's.  Then the process models could be updated to allow data be added to this container in PreUUT and then passed to the Client's MainSequence?

Message Edited by Chris at Motorola on 09-25-2008 10:50 AM
0 Kudos
Message 14 of 15
(1,467 Views)
Hello Chris, I am speaking with R&D about this so we can try and come up with a method. This should be possible but please bear with me while I investigate.
With warm regards,

David D.
0 Kudos
Message 15 of 15
(1,446 Views)