NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Create background task

Solved!
Go to solution

Hi

 

I need to launch a VI that monitors emergency stop as a background task. The main sequence launches this VI but it doesn’t wait for it to finish, so the execution in the main sequence continues and completes it's execution. And the monitor stays open and the next execution of the main sequence will launch the monitor that already is open.

 

/Christian
0 Kudos
Message 1 of 8
(4,291 Views)

Hi,

 

You can just kill that execution in your clean-up of your main sequence. Store a reference to your back ground task in TestStand so that you can use this in the Terminate method.

 

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 8
(4,267 Views)

Hi Ray

 

Is it possible that you can show me how to store a reference from my back ground task in TestStand so that I can use this in the Terminate method. I have attached an example of my code. The "Heartbeat parallel_2.seq" is the to level sequnece.

 

Thanks in advance

 

/Christian

0 Kudos
Message 3 of 8
(4,258 Views)

Hi Christian,

 

I have done two things.

1. add a step to terminate the execution.

2. add some monitoring in the VI to exit if the execution is seen to be terminating.

 

See attached pictures.

 

This is a solution but I don't like it as it gives the appearance that the sequence has terminated in the results.

 Anyway see how you get on with this.

 

Also instead of running the VI in a Sequence you can launch the VI via the LabVIEW Utility steptype "Run VI Asynchronously".

 

Regards

Ray Farmer

 

 

 

 

 

Regards
Ray Farmer
Download All
0 Kudos
Message 4 of 8
(4,236 Views)

Thanks Ray

 

It's almost there Smiley Happy

 

Can I monitor the main sequence in the Heartbeat.VI or force the Heartbeat.vi to close from the main sequence when main sequence comes to certain point; without using Terminate. Because, as you also observed it is generating a Terminate dialog and it loges in the report. I only want to use Terminate if an emergency occurred. So when the sequence runs normally it just closes the Heartbeat.vi without any action as Terminate.

 

/Christian
0 Kudos
Message 5 of 8
(4,221 Views)

Hi,

 

(It was getting late when I posted my reply, so the brain had stopped working. )

Yes, a better method would be to use the Synchronzation step type and use a Notification to tell the heartbeat to stop.

 

I'll have a look at this latter today, if you dont solve it your self in the mean time.

 

Regards

Ray Farmer

Regards
Ray Farmer
Message 6 of 8
(4,217 Views)

Hello Ray

 

I've taken a totally new approach. I've made sub sequence that is monitoring the Emergency input in a new thread. The sub sequence can terminate execution if needed, and the sub sequence is stopped by using a StationGlobals that is set by the calling main sequence. The disadvantage it that there is nothing visual indicating to the user that the monitor is running or not, but I can live with that Smiley Happy

 

Thanks a lot for your help Smiley Wink

 

/Christian

0 Kudos
Message 7 of 8
(4,209 Views)
Solution
Accepted by Christian Kjeld

Christian,

 

You might also be interested in the example here:  http://forums.ni.com/ni/board/message?board.id=330&message.id=20875#M20875

Josh W.
Certified TestStand Architect
Formerly blue
Message 8 of 8
(4,194 Views)