NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Working with multiple execution views

Trying to keep this simple but it's hard. I think what LabVIEW users need is a LabVIEW TestStand toolkit. I know this sounds crazy but I think it's necessary. On to my main problem:

I am running a modified version of the Full operator UI example. I have kept the executions listbar on the left. So if I run multiple executions, I end up with several executions in the list which is fine. When I toggle between the executions, I would like to get some variables from the main sequence or (or process model) for that execution then display them in my UI. So my UI would update with the variables from those executions.

I'm having a hard time getting this feature going. I found the callback VI called: ExecutionChanged Event. I put some code in there (see image). This seems to work while the executions are running but give me an error in post execution mode: error -17300... thread index 0 is not valid. I guess the thread dies, is this why? So, if that's the case then what's the right way to do this?



Message Edited by Michael Aivaliotis on 10-12-2007 05:26 PM



Michael Aivaliotis
VI Shots LLC
0 Kudos
Message 1 of 11
(4,904 Views)

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,

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

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...)

0 Kudos
Message 3 of 11
(4,872 Views)

... 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. 🙂

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.

On the topic of UI messages. I'm already using UI messages for certain things. I agree, It's a great thing... the sequence gathers startup information from the main UI and it posts information to the main UI while a sequence is running. This is all fine and great but perhaps I'm missing something. It seems like the UI messages communication is always sequence initiated. How do I initiate a message from the UI and have the sequence receive it. For example, I have a variable on the main UI that will change during the test run. I don't see a way using UI mesages to set this variable in the sequence. It seems like the only way is to include a step that polls the main UI for this variable. I assume that on the sequence side, you would have to start another sequence that runs on a parallel thread to do this. Thoughts?


Michael Aivaliotis
VI Shots LLC
0 Kudos
Message 4 of 11
(4,864 Views)

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,

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

@~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...

Ah, yes, never thought to pass the sequence context via UI messages. This is a great tip, thanks!


Michael Aivaliotis
VI Shots LLC
0 Kudos
Message 6 of 11
(4,857 Views)

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




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 7 of 11
(4,833 Views)

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.

Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 8 of 11
(4,823 Views)

@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



Michael Aivaliotis
VI Shots LLC
0 Kudos
Message 9 of 11
(4,814 Views)

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.

Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 10 of 11
(4,807 Views)