NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving TS Sequence Context to LV Variable

I want to monitor an external process using a LabView OI that will allow me to terminate an executing TestStand sequence file. The goal is to maintain the TestStand Sequence Context value within LabView to allow the LV Operator interface to Terminate a currently executing sequence file.

Problem: Once the TS Sequence Context variable is saved to a LabView variable, the property node and invoke node method fails to work.

Is there a simple method other than using UIMessages to allow an externally monitored thread to abort an executing TestStand sequence? I'm using TestStand 3.1, LabView 7.1
0 Kudos
Message 1 of 9
(4,889 Views)
The Sequence Context is only good for the VI in which it exists, I believe. Therefore when you save the Sequence Context to a global, the value of the global is no longer a valid Sequence Context in a different vi. You can fix this by saving the Sequence Context to a global in the same vi that you are using the Sequence Context global. See attached vi. However, this defeats the purpose of using a global. Why save to a global or any variable when you can use the Sequence Context itself.
I believe the context defines a link between TestStand and the VI it appears in. Therefore the same context is not a valid link for a different VI. So you cannot use a global to store the context and expect it to work in multiple VIs.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 9
(4,879 Views)
Before I read this thread, I had created a subVI that allows one to pass in a lookup variable, and its desired value (if doing a Set) - It also allows you to do a get.  I tested the VI by calling it directly from TestStand, passing in 'ThisContext' in my sequence file call.  Everything worked great, until I dropped the subVI into several VIs that needed it.  The first thing I do in the subVI is check for a valid sequence context reference (using the 'Not a Number / Path / Refnum?'.  The sequence context is valid in the VI being called from TestStand.  But, just as you mentioned, once I pass the sequence context into my new subVI, I get the invalid ref error.  The sequence context is just a 32-bit number, correct?  Why does it get blown away in this manner?  Is there any way to get around copying all the code from my subVI into all VIs that need similar functionality?
0 Kudos
Message 3 of 9
(4,629 Views)
Hello mrbean,

I was able to pass the sequence context to a subVI and not have any problems with it.  I made an example with a simple sequence file that I think is doing what you are describing.  I did this in TestStand 4.0, let me know if you are using an earlier version and I can try it in that also.
Kristen
National Instruments
0 Kudos
Message 4 of 9
(4,603 Views)
The SequenceContext is an ActiveX reference, which is more than just a 32-bit number.  The 32-bit number refers to how LabVIEW holds the reference internally, but LabVIEW will attempt to clean up any of these references once a VI stops running. However, if you are just passing in the reference, there isn't a reason why this wouldn't work.  However, if you are trying to cast it to an integer and pass that, you may see problems.

Allen P.
NI
0 Kudos
Message 5 of 9
(4,596 Views)

It seems to me that I'm doing the exact same thing, but for some reason, the reference is good when it comes into my top VI, but not good in the subVI.  Here is the subVI I'm using in various locations.

As an aside, I would appreciate any comments on the subVI.  It's supposed to allow you to set/get a parameter in your sequence file by passing in the variable name in the LookupString.  In testing, (when I called it directly from TestStand 4.0) it worked fine.   However, I'm wondering if my 'actual' scenario has any affect on the outcome.  In the real test, I have a number of subsequences.  It's in one of those subSequences that I call the Top-level VI that then calls this utility subVI.  Does "ThisContext" mean something different depending on which sequence you're in? 

Also, I learned that parameters are local to the sequence you created them in.  I created my parameters in the MainSequence, but I want to set/get them from any of the subSequences.  Even though I'm running a different sequence, it seems to think the parameter "Exists" (see code)

0 Kudos
Message 6 of 9
(4,585 Views)
Hi,

Your SubVI seems to look fine.  Do you have a small sequence file and topVI you can attach that shows this behavior? 

Also, parameters are local to the sequence you create them in, but you can get a reference to the calling sequence from the Caller Property.  (search TestStand help for Caller for more info)
Kristen
National Instruments
0 Kudos
Message 7 of 9
(4,558 Views)
What I found was that, as a stand-alone VI, my utility works fine.  However, when embedded within a larger caller, one that needs the sequence context to stay valid, the 'close' operation I was doing at the end was not wise.  I removed that, and everything started cooperating.  Thanks.
0 Kudos
Message 8 of 9
(4,555 Views)
Great!  I'm glad you got it working.
Kristen
National Instruments
0 Kudos
Message 9 of 9
(4,542 Views)