NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Process Model: Get reference to sequence that loaded the process model

I am defining a custom process model based off the Sequential model.  The idea is to have a customized, standard platform for all our testers.

 

One thing I want to do is to have some code execute when you open a sequence that has been configured to use this process model; essentially to set up some of the environment and ready the sequence file (for example, all my sequences have a set of paths defined within FileGlobals, and I want to make sure they are created in the sequence right away.

 

I would like this to happen automatically when the model is loaded.  This way as soon as you select it in the process model for your new sequence, it will load and mod the sequence/platform.

 

The problem is that I can't see how to get a reference to the calling sequence that loaded the process model when you load the sequence.  I paused on sequence file load within the model, and looking through the runstate, I don't see a reference... and I don't even see it in the threads/call stack.  Is nothing passed to the model when it loads?

0 Kudos
Message 1 of 4
(804 Views)

Unfortunately I don't think this is possible.  My assumption is that the client is tied to the process model and the process model doesn't know about clients until a non-interactive execution begins.  SequenceFileLoad is an interactive execution.  Meaning there is not a client file associated with it.

 

There are 3 states a sequence file can be in:

  • Disk
  • Edit
  • Execution

 

Obviously you cannot change a disk copy unless you bring it into Edit mode and change and then save it back to disk.  You can change an execution copy of the sequence file, and in fact that happens whenever you change variable values during execution.  But you would have to commit those changes back to the edit copy and then back to disk.  I guess my question is: which version of the sequence file do you really want changed?  My thought is that you really just want the execution copy changed.  That wouldn't exist until you actually ran an interactive execution.  So why not perform your updates during process setup callback?  This way they don't get saved back to the Edit or Disk copies.  Just a thought.

 

BTW- even if the SequenceFileLoad for the process model did bring the client into the execution state then setting those paths would be useless without committing them back to edit state.  This is because the load execution would complete and the execution copy would would no longer exist...losing your values.

 

Also, you do have to have a development license to commit changes to disk... so take that into consideration if you are dynamically changing files on a deployed state.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 4
(777 Views)

Thanks for all that info, that's what I figured.

 

The idea here was that I could have a set of process models for various types of tests, and when I selected one for a new sequence (or maybe an old one) it would immediately add some "framework" to my new sequence.  But I suppose I can do this with a template too, and with a lot less coding.

0 Kudos
Message 3 of 4
(762 Views)

This makes sense.  If I were you I would create a tool.  The tool could easily do all of this and reassign the process model.

 

This way your users would just go to Tools>>Set New Model.  Then a dialog would pop up and part of it would be a list of the models that they needed.  Then based on that you could "frameworkize" your sequence file.

 

Actually a great use case for this.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 4 of 4
(756 Views)