09-10-2007 05:45 PM
09-11-2007 12:50 PM
A few issues from doing it this way-
1- You should try an make your process model such that it can handle almost any sequence file thrown at it. MainSequence may not a) contain that local variable and b) be at array element 0. Unless you do some serious error checking then using your process model elsewhere will be a problem because it will throw errors.
2- It all depends on where you are changing that variable at. Remember with the Batch Model that you are dealing with multiple copies of your client sequence. If you change a Locals in the process model which threads does it actually affect?
3- Locals is to be used for the sole purpose of the sequence it resides in. Just like in text based programming where you have a function call:
MyFunc(int x, int y){
string foo;
}
foo is local and really shouldn't be changed outside of MyFunc. x and y are parameters and should be how data is shared among different sequences in TestStand. There are variables for bigger scopes as well (i.e. StationGlobals, FileGlobals).
I recommend using either a StationGlobal or passing the data as a parameter.
In the end you are the engineer and the flexibility that TestStand gives you makes it so you can do things however you want.
My 2 Cents,
09-11-2007 03:26 PM
Sam,
Thanks for your comments. I am relatively new to TestStand and this is the only method I could find to get my variables copied from the batch model to my client sequence. I understand the comments about scope.
I just tried RunState.ProcessModelClient.Data.Seq[0].Parameters.MyVariable and that also works fine but of course I'm still calling Seq at the array index 0.
I tried to pass parameters through the subsequence calls but was unable to get past the subsequence calls that use variables for the called subsequence name (Create Test Socket Execution which calls the Test UUTs-Test Socket Entry Point and the MainSequence Callback).
I would appreciate any information concerning a better or more reliable way to get my variables copied from the batch model to my client sequence.
Thanks,
Steve
09-12-2007 08:03 AM
09-12-2007 11:29 AM
09-12-2007 02:43 PM
Guys,
Thanks for the suggestions, I've got my code working now. Í'll explain what I did in case it may help someone else.
I was not aware that I needed to set the shared flag for FileGlobal variables so they would be available throughout a file. The shared flag I'm talking about is accessed through the advanced menu item when right-clicking on the variable.
I use a UImessage to load several arrays and variables from our user interface. The UI message is the 1st step in the Test UUTs Main of my modified batch process model. I place the variables in the batch process model FileGlobals so they can be available for various initialization steps in the process model.
Next, I built a custom callback (although one of the existing callbacks would work) in my batch model. Then in my client sequence I added the callback to the subsequence list and set it up to receive parameters from the batch model per Sam's suggestion. I then copy the variables into the FileGlobals in the client sequence, set the shared flag for each variable and they are available in all sequences in the file. Eureka!
I also spent some time working with the load prototype button when the target sequence is specified by expression, I was able to get that working as well.
Thanks for the help!
Steve