NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Run test uut entry point only once

Hi,
 
I want to avoid that users can run test uuts entry point more than once. I use an operator interface written in CVI 7.1.1 and netry point button is deactivated when run state changes. But after loading the application sometimes is too slow so the user can press this button twice before it is deactivated.
So is there any possibility to avoid running this entry point more than one time?
 
Regards
Steffen
 
 
0 Kudos
Message 1 of 13
(5,439 Views)
If you have an Operator Interface, you can use the PreCommandExecute Event to check to see if any executions are running.  If there are, cancel the command.
 
Allen P.
NI
0 Kudos
Message 2 of 13
(5,419 Views)
Hi Allen,
 
sounds like a good idea. But I couldn't find any API function like "Cancel Command"! How would you cancel the command??
 
Regards
Steffen
 
 
0 Kudos
Message 3 of 13
(5,410 Views)
Hi,
 
Its an event of the ApplicationMgr.
 
You will need to add an event callback VI in your OI to handle this.  Have a look at the 'Using TestStand with LabVIEW' manual and /or the FULL OI top level VI for guidance.
 
Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 4 of 13
(5,407 Views)

Hi Ray,

the ApplicationMgr event PreCommand.... is not the problem.

What I need now is a possibility to abort that command that has fired this event!

Regards, Steffen

0 Kudos
Message 5 of 13
(5,404 Views)
There is an output parameter in the PreCommandExecute callback called "cancel" that you can set to true or false.
0 Kudos
Message 6 of 13
(5,400 Views)
Ray and Steffen,
 
I am trying to do the same thing as Steffen, but I am stuck.  I know how to register for event callbacks so I have been able to register for the PreCommandExecute event.  But, what do I do after that?  I see that I can pass a Boolean to the Cancel parameter in order to cancel the execution command.  However, I assume I only want to do this after the first execution has started.  It seems to me that I will need to establish a count or at least a flag in my OI that keeps track of whether an execution has started.  Is that right?  If so, how do I know when the execution has ended so that I can reset the flag or the count?  I tried doing the same thing using the Application Manager StartExecution and EndExecution events, but they are fired at strange times that aren't necessarily related to the user pressing the Test UUTs button.  Steffen, did you get this to work?  I am using LabVIEW instead of CVI.
0 Kudos
Message 7 of 13
(4,976 Views)
Allen, Steffen, and Ray,
 
I managed to get counters working that increment each time the Test UUTs button or Single Pass button are pressed.  I do this by checking the EntryPointIndex of the Command and determining if it is 0 or 1.  If the index is 0 or 1, I examine the current count and if the count is > or = to 1, I cancel the command.  This seems to work correctly.  However, I can't seem to figure out how to tell when the execution has completed so I can reset the counters.  I tried using PostCommandExecute but I can't seem to make that work.  I also tried a different method of using the StartExecution and EndExecution Application Manager events.  The first thing I saw was that when the OI loads, you get StartExecution and EndExecution events and the same is true when the OI shuts down or login/logout are invoked.  That isn't that big of a deal, but I thought it a little strange.  I wrote code that disabled various UI buttons, such as Test UUTs and Single Pass, upon receipt of the StartExecution event and enabled the buttons upon receipt of the EndExecution event.  This caused strange behaviors in the OI such as causing the sequence view to not display any information and the sequence file combo box to not select a sequence file after the sequence file has been opened.  It appears that the control managers don't like it when you try to override some of their behaviors.  Any suggestions?
 
 
 
0 Kudos
Message 8 of 13
(4,958 Views)

Hi Ryan,

you might use something similar to the CVI Callback ExecutionViewMgr_OnRunStateChanged to check whether the execution starts or has finished.

I solved the whole problem with the following workaround: I don't use a TS activeX entry point button any more but a normal CVI button with its callback. In this callback (when the button is hit) I first of all dim the button and then use the following functions to get the execution started:

 - TSUI_SequenceFileViewMgrGetCommand (gMainWindow.sequenceFileViewMgr, &errorInfo, TSUIConst_CommandKind_ExecutionEntryPoints_Set, 0, &runTestUUTCommand);
 - TSUI_CommandExecute (runTestUUTCommand, &errorInfo, VFALSE);

To reactivate the button I use the ExecutionViewMgr_OnRunStateChanged callback.

Maybe this is also an idea for you.

Regards, Steffen

0 Kudos
Message 9 of 13
(4,950 Views)

Steffen,

Thank you so much for the help.  You recommendations worked perfectly.  Both of us implemented more or less the same behavior in our operator interfaces, although we used slightly different methods.  Here is what I did:

I established a count variable in my operator interface that is initially set to 0.  Each time the Test UUTs or Single Pass button is pressed, I increment the count by 1.  I determine that the Test UUTs or Single Pass button is pressed by registering for and handling the Application Manager PreCommandExecute event.  In my callback for this event, I examine the returned Command and look at its EntryPointIndex property to see if the index is 0 (Test UUTs) or 1 (Single Pass).  If it is, I increment the count variable count by 1.  If the index is not 0 or 1, I do nothing.  Once execution has stopped, I reset the count variable back to 0.  I do this by registering for and handling the ExecutionView Manager RunStateChanged event (as you recommended).  In my callback for this event, I examine the returned newRunState to see if it stopped (numerical value of 3).  If it is, I set the value of the count variable back to 0.  If it isn't stopped, I do nothing.

This method is basically the same as the one you propose.  This method allows you to use the built in TestStand buttons instead of having to use those found in your development environment.  The only drawback is that they don't disable and gray out during execution; they just do nothing when an execution is in progress and the operator presses them.

Message 10 of 13
(4,932 Views)