NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TerminationStateChanged Callback Only Fires Once

Hi,

 

I have a TestStand OI that has a callback VI registered for TerminationStateChanged event.  Essentially, I'd like to show an image anytime the user hits the terminate button to shutdown the sequence.  It seems that the first time I run the sequence, everything works fine.  I click terminate during a sequence, TS fires my callback VI -- I trap newTermState 2 (Terminating) and am able to display the image without a problem.  However, it seems that when the user runs the sequence again, the callback VI never fires on a termination.  If I click terminate this time, TS must have received the command because the sequence does in fact terminate... but the callback VI is never called.

 

Am I missing something?   Does this callback only work once? 

 

Thanks!

0 Kudos
Message 1 of 7
(3,172 Views)

Anyone?

 

...or is there another way to detect a the termination state on the OI?

0 Kudos
Message 2 of 7
(3,147 Views)
Looks like I figured out a workaround.  Instead, I can use the UIMessage Event callback and watch for UIMessage 5 (Terminating).  This fires every time.
0 Kudos
Message 3 of 7
(3,146 Views)

Hi jplotzke,

 

It's hard to say exactly what may be causing this problem. One workaround this problem might be to simply add your step in your Cleanup step group of your MainSequence since this group will be called upon terminating your test sequence. You can then create a precondition on this step to be called only when your sequence terminates. This can be done by using the RunState.Execution.GetTerminationMonitorStatus function. Note however, that in order to use the Termination Monitor, you ,must first initialize it in your setup by calling  RunState.Execution.InitTerminationMonitor.

 

Even though this solution may have come a little too late, I just thought I would throw in an alternative solution.

 

I hope this helps,

S_Hong
National Instruments
Applications Engineer
0 Kudos
Message 4 of 7
(3,139 Views)

Hi jplotzke,

 

I just wanted to clarify from my earlier post that although using the Execution.GetTerminationMonitorStatus function will detect a termination state change in your sequence, you may simply be able to use the Execution.GetStates method instead as it does not require any initialization. Note however that we can use this function without any penalty in this case since the sequence runs inside of the TestStand engine and so there is no performance hit when calling this method. On the other hand, if you were to call this method from a UI, you will be crossing a client/server boundary, which in turn will result in some performance penalty. So if you wanted to make changes to the UI instead of adding extra steps in your sequence, I recommend using the ExecutionViewMgr methods to track the Termination State as it will have the smallest impact on performance.

 

I hope this clarifies some questions.

S_Hong
National Instruments
Applications Engineer
0 Kudos
Message 5 of 7
(3,120 Views)

Thanks, S_Hong for your reply --

 

I am trying to do this from the UI.  I have an indicator which displays the different states/results of my sequence to the user -- Running/UUT Passed/UUT Failed/Aborting.  So, I wanted to keep this solely on the UI in order help de-couple the sequence and the OI and to avoid having to pass data directly between the two.

 

What I ended up doing is implementing this solely using the UIMessage Event Callback.  Since there are UIMessages for each of these, I can catch those messages and update my control via a reference accordingly.  This seems to be working fine and is really sequence-independent since there's no additional code that needs to be in the sequence.  I'm surprised that such as indicator isn't present in the base OIs with TS.

 

Anyways, thanks again for your help!

0 Kudos
Message 6 of 7
(3,100 Views)

In the TestStand full featured UIs, the execution state is shown in the list control on the left of the panel.  The display next to the execution's name will change based on the state of the execution.  For instance, it will be Green if running, have a red X if a unit failed, etc.

 

I'm glad you found a way to get your custom display working.

Message Edited by Josh W. on 10-07-2008 06:03 PM
Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 7 of 7
(3,068 Views)