NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to manage variables in dynamically loaded sequence

Variables in dynamically loaded sequence files are not managed properly.
Steps to reproduce:
1. Unpack attached zip file
2. Launch TestStand Sequence Editor
3. Add directory of unpacked files to Search Directories list (Configure>>Search Directories...)
4. Set Station Model to unpacked "UpdatedSequentialModel.seq" (Configure>>Station Options...; Model tab in TestStand Sequence Editor)
5. Load unpacked "A.seq" sequence file  (File>>Open Sequence File.. in TestStand Sequence Editor)
6. Check "Execute>>Break on First Step"
7. Run "Test UUTs"
8. When execution breaks, note the following:
a) "Locals.SomeVar" contain "The value, which stored in the file" instead of "New value"
b) Although actual running sequence file is "B.seq", the tab title is: "Test UUTs - A.seq"
Try also:
1. To examine "RunState.ProcessModelClient.Data.Seq["MainSequence"].Locals.SomeVar" variable, when breakpoint is set at <End Group> of PreUUT of Station Model "UpdatedSequentialModel.seq".
2. Open unpacked "B.seq" sequence file in TestStand Sequence Editor and repeat all the checks
Additional info:
1. I use TestStand 4.0.0.326
2. Attached Process Model file "UpdatedSequentialModel.seq" is original "SequentialModel.seq" with only one step "UpdateClientSequence" added in PreUUT.
3. The source of mentioned above new added step is attached as well.
thanks.misha
0 Kudos
Message 1 of 15
(4,532 Views)
Hello Mishaw,

We appreciate your feedback and especially appreciate you providing this example that explains exactly what you are describing.  I've been looking into this this afternoon, and will continue to tomorrow morning. I see the behavior your are describing and I will let you know as soon as I find something.

Also, to get you going as soon as possible, I was wondering if you could explain a little bit about your application and why you want to switch the sequence file in the PreUUT callback?
Kristen
National Instruments
0 Kudos
Message 2 of 15
(4,498 Views)

Kristen,

There is production process, which defined at our factory.
The production process includes requirements to test process, which applied to all test stations and all products.
According to these requirements:
1. Actions, which test operator shall take:
1.1. Place UUT into test station
1.2. Read UUT serial number barcode. At this point tests sould start automatically
1.3. When tests complete, remove UUT
1.4. Proceed to next UUT
2. Single test station should be able to test several different products

"My application" is Process Model, which intended to serve all the factory test stations in unified way.
This Process Model is based on NI "SequentialModel.seq".
PreUUT of this Process Model performs the following steps:
1. Ask operator for UUT serial number
2. Get product ID from database (using serial number, which obtained in previous step)
3. Get test data from database (using product ID, which obtained in previous step). Test data includes sequence file name as well as test related data (MAC address, for example). There is single sequence file provided for each product.
4. Load sequence file (which name obtained in previous step)
5. Store test data in ["MainSequence"].Locals of new loaded sequence file. This make possible to access test data from within test modules.

"Why I want to switch the sequence file in the PreUUT callback".
When UUT is inserted into test station, there is unknown, which sequence file to use, until reading the UUT barcode.

thanks.misha

0 Kudos
Message 3 of 15
(4,481 Views)
Hello Mishaw,

I think you are running into these problems because when you set "RunState.ProcessModelClient.Data.Seq[\"MainSequence\"].Locals.SomeVar" you are editing the "edit copy" of the of the variable not the "runtime copy", but you've already loaded the sequence into memory so you don't see the variable change until you've loaded it a second time.  This is why the value is not reflected until the second iteration.

I am wondering why you have chosen to architect this this way.  I think it may be easier to instead of editing the process model, to just have one main sequence which selects the sequence to call.  This main sequence can take the SerialNumber and query the database and then have a SequenceCall step.  You can programmatically set which sequence to call by setting the SequenceCall step to Specify by Expression, and specifying a variable with the filename in it.  I think by doing it this way you will be much less likely to run into problems with variable edit vs. runtime copies and variable scope. 

Let me know if you have any questions.
Kristen
National Instruments
0 Kudos
Message 4 of 15
(4,470 Views)

Kristen,

"Why I architect "My application" this way?"
"My application" is intended to serve significant amount of test stations and products. Each product is represented by its own test sequence file.
"My application" and client sequence files are independent products. Client sequence files are responsible for products testing, while "My application" is responsible for common tasks.
Process Model is most pertinent place to perform common tasks (common for all test stations and for all products).
Providing supplemental sequence file just to perform SequenceCall, is completely unnatural.
Moreover, if using SequenceCall, I see no way to update local variables of new launched sequence file, before it starts to execute (step 5 of "Message 3 of 4").
Thus, the solution, which you propose, cannot satisfy our factory requirements.
Back to my questions.
1. Is something wrong with the way, which I implement the task?
2. Is it possible to implement my task using NI TestStand?
3. Is my problem caused by incorrect usage of "edit copy" and "runtime copy" of the variable? TestStandReferenceManual says:
"Built-in properties of steps and sequences are flagged to be shared at run time. For these shared properties, TestStand does not create a unique run-time copy, but instead references the edit-time copy. Any changes to the run-time reference of these built-in properties edits the original Step or Sequence object in the sequence file."
The variable, which we discussing is not Built-in property.
4. If previous correct, how differentiate between "edit copy" and "runtime copy" of the variable?

thanks.misha



Message Edited by mishaw on 06-05-2008 07:17 AM
0 Kudos
Message 5 of 15
(4,422 Views)
Hello Mishaw,

I want to make sure we suggest the best way to architect this to do everything you need.  I am talking to my colleagues about this and I will post an example illustrating how as soon as possible.  I just wanted to let you know we are looking at this.

Thanks.
Kristen
National Instruments
0 Kudos
Message 6 of 15
(4,398 Views)
Hi mishaw,

Please see the attached example for a different approach to designing your application.  Here, there is a Main Sequence that obtains a serial number and then queries a database for the sequence file associated with that serial number.  It then dynamically loads the correct sequence file associated with that serial number.

Please let me know if you have any questions on the example.



Message Edited by J_Stape on 06-16-2008 11:59 AM
Jessica
National Instruments
Product Support Engineer
0 Kudos
Message 7 of 15
(4,335 Views)

Jessica, Kristen,

I failed to open attached example because it's incompatible with the TestStand version, which I use (4.0 (4.0.0.326) vs. 4.1 (4.1.0.228)).
Referenced in Message 1.

thanks.misha

0 Kudos
Message 8 of 15
(4,307 Views)
Hi Misha,

I am sorry about that.  I have opened and saved these sequence files for TestStand 4.0.  Please let me know if you run into any more problems opening them.


Jessica
National Instruments
Product Support Engineer
0 Kudos
Message 9 of 15
(4,302 Views)

Jessica, Kristen,

Again you suggest to use step of type "Sequence Call" in client sequence file.
Our development team has examined, discussed and rejected this approach earlier, since it cannot satisfy our factory requirements (see previous messages).
If possible, can you review my original question: "how to handle variables in sequence, which was loaded dynamically from Process Model"?

thanks.misha

0 Kudos
Message 10 of 15
(4,291 Views)