From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute a cleanup-sequence if stop-button was pressed?

Hello,

when running a testplan it may happen that the user presses the stop-button. Then all instruments are still turned on.

Is there a callback-function that executes once the stop-button is pressed where i can cleanup my instruments?

 

If i would put the steps in the "normal" cleanup then it executes always but i want a special sequence that only runs if the stop-button was pressed.

 

Thanks for help

TM

 

0 Kudos
Message 1 of 7
(5,744 Views)

Hi TM

 

The simplest way to do what you want is to overwrite the ProcessCleanup callback. It is one of the last called callbacks in our standard process models.

 

Otherwise when you have a custom process model add a new callback in process models Cleanup area.

 

Kind regards,
Andreas
0 Kudos
Message 2 of 7
(5,707 Views)

Hi,

can you tell me in detail what to do?

In my model there is a "ProcessCleanup"-sequence. It was empty and i inserted a message-popup to see that it executed.

In my dummy testplan i activated the ProcessCleanup (Menue edit + SequenceFiueCallback) now the ProcessCleanup-sequence is also visible in my dummy-testplan.

 

The testplan contains only:

passfail test

wait 0.5

passfail test

wait 0.5

passfail test

wait 0.5

passfail test

wait 0.5

passfail test

wait 0.5

 

Now i started the testplan and pressed the terminatExecution-Button after the second passfail-test.

But the ProcessCleanup did not execute (no popup was shown.)

 

What am i doing wrong?

 

Thx

0 Kudos
Message 3 of 7
(5,704 Views)

Hi TM

 

First you need to clarify which stop button you mean.

 

Are you talking about Sequential process model and run execution entry point "test UUT"? And you mean the stop button from this dialog where you can insert the S/N?

 

Steps to do:

1. Open your Sequence File

2. Right click into the sequence pane >> Sequence File Callback >> ProcessCleanup and press Add

3. Add your Clean up Code there (first step add the Dummy Code like the message pop up)

4. Run Sequence

5. When you stop the dialog where you can insert the S/N you'll see that the message box pops up.

6. Even you break your sequence and press "Terminate Execution" You Should see the message box

 

Kind regards,
Andreas
0 Kudos
Message 4 of 7
(5,697 Views)

My fault... the steps "Process Setup Callback" and "Process Cleanup Callback" were skipped in the model as i skipped all unused steps in there 🙂

Now it shows me the popup when the TerminateExecution-Button is pressed.

But also if the testplan is running normal to the end.

 

What to change that it only executes if strop was pressed?

I could check for the result of MainSequence callback and use this as precondition, or? (Like "do not execute if result was passed or failed)

 

But then i could also insert any normal subsequence in the model to shutdown my instruments.

The advantage of a callback is only that i can use different cleanups for differtent testplans when i overwrite the callback, or?

 

Thx

 

0 Kudos
Message 5 of 7
(5,696 Views)

My model goes in "Test UUTs" what currently only contains

Process Setup Callback (empty)

MainSequence Callback

Process Cleanup Callback (with popup)

 

The rest of the teststeps is skipped, so i dont have a serialnumber-popup.

I am pressing the TerminatExecution-button while the testplan is running,

 

TM

0 Kudos
Message 6 of 7
(5,692 Views)

Hi TM

 

Yes the benefit of callback is that he is a part of our process model. So every custom SequenceFile which will be run in

this process model calls this sequence. In case of ProcessCleanup an empty sequence as normal, but customized

when you overwrite it in your sequence file.

 

Please hold in mind that normally you always want to run this ProcessCleanup. Independent if you stop or terminate

your test process. I both case you should free you refnums (hardware, file,...).

 

Andreas

Kind regards,
Andreas
0 Kudos
Message 7 of 7
(5,614 Views)