10-12-2007 04:25 PM - edited 10-12-2007 04:25 PM
Message Edited by Michael Aivaliotis on 10-12-2007 05:26 PM
10-15-2007 09:50 AM
http://forums.ni.com/ni/board/message?board.id=330&message.id=16683
Yep once the thread is dead the sequence context no longer exists. There are no more RunState variables and therefore any information except what's in the report or is saved in the sequence file itself become lost. The proper way to pass variables from a sequence to a UI during execution is to use UI Messages. If you understand those then you'll be set for life. 🙂
Read the link above.
Regards,
10-15-2007 10:03 AM
Also note that the default process models (and process models based on them that haven't been too radically altered) post a UIMsg_ModelState_Identified message to publish the UUT serial number to the UI. You could handle this message directly or take advantage of the fact that the UI controls cache this information. You can access the cached information via:
string serialNumber = executionViewManager.GetCaptionText(CaptionSource_UUTSerialNumber, true);
or, you could call:
executionViewManager.ConnectCaption(<TestStand label, expression edit, or status bar pane>, CaptionSource_UUTSerialNumber, true);
to connect the caption to a control that will then automatically update whenever the serial number changes.
(note: I haven't tried compiling the code above, but it should be pretty close...)
10-15-2007 01:23 PM
I was hoping that TS would have a facility where I could get sequence execution state caching for free. I guess I need to add that myself. Oh well.
... The proper way to pass variables from a sequence to a UI during execution is to use UI Messages. If you understand those then you'll be set for life. 🙂
10-15-2007 02:07 PM
Hey Michael,
Another great question. The way that I've seen it done by most users is to use UI Messages again. How? So when you need to get the variable from the UI into your sequence you post a UI Message that passes the sequence context. Then in the callback for the UI Message you can assign the LV variable to your sequence variable using a lookup string and the SetProperty VI in the TestStand pallette. You are correct in assuming that the UI Messages are driven by your sequence- as they should be. After all, the UI is simply a thin client for user interaction. The process model and sequence drive the engine. If you wanted to sync the UI and sequence then you would have to use some sort of notifications or rondezvous or something like that.
Hope that helps some,
10-15-2007 02:26 PM
Ah, yes, never thought to pass the sequence context via UI messages. This is a great tip, thanks!
@~jiggawax~ wrote:
... The way that I've seen it done by most users is to use UI Messages again. How? So when you need to get the variable from the UI into your sequence you post a UI Message that passes the sequence context...
10-16-2007 08:05 AM
Michael,
I have just finished the road that you are embarking on. I too wanted to post messages from the UI to teststand. During my trek I came across many BUGS that were officially reported. I ended up using UI messages, the only documented BUG that I found with them is that if your call back VI is not fast enought or WINDOZE does not respond to the message you will lose the sequences context especially when passing it through the UI message. To get around this be sure to make all of your UI Messages that send over a sequence context synchronous if you do not you will get into trouble.
for the other question, what I did to remedy sending data to teststand was to create an LV2 Global and update it via the UI and then when I needed the data in teststand I simply used a UI message and paased the sequence context into the message, then inside my event handler for that message i called my global and wrote it to a variable using the set property method.
Here is the car report on one of the bugs that I found that really stumped NI.
This issue was
filed under CAR# 4EEG5C0N
10-16-2007 10:50 AM
Hey Michael,
Just to note: The sequence context is already passed implicitly with a UIMessage. The Thread object is passed as a parameter to your UIMessage handler and contains a property for the Sequence Context.
10-16-2007 01:30 PM - edited 10-16-2007 01:30 PM
@AndrewMc wrote:
Just to note: The sequence context is already passed implicitly with a UIMessage. The Thread object is passed as a parameter to your UIMessage handler and contains a property for the Sequence Context.
That sounds great but can you give me some more to go by. I'm more of a visual person.
Message Edited by Michael Aivaliotis on 10-16-2007 11:31 AM
10-16-2007 02:23 PM
Hey Michael,
I meant a method instead of a property called GetSequenceContext. Sorry about that.
It looks like you have the idea; just change the Property Node to an Invoke Node and select GetSequenceContext from the list.