NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how to generate TS_error using background VI

Hello everyone.

I have a problem with seting TestStand properties using LabVIEW.
My sequence is working in while loop (till termination).
There is a VI running in background (it could LabVIEW exe file, not in TS sequence) waiting for an user event. After event occurs it should generate RunState.SequenceError.Occurred=TRUE.
Reading some topics I created an VI but id doesn't work (I copied an Sequence Context from some example - if I create some new one I don't know how to do a reference to actual running TS sequence - but this is a side_problem).

Could anyone help me with this problem.
Thanks a lot.

Message Edited by pruk on 11-29-2006 03:13 AM

Message Edited by pruk on 11-29-2006 03:13 AM

0 Kudos
Message 1 of 11
(3,658 Views)
pruk,

After looking over your VI it wasn't clear if you wanted to handle a user event caused by a user using the VI or by a user operating a test in TestStand. In addition, I was curious to see what you are trying to accomplish with this part of your program. The last part of your comment is correct in that your VI at the moment has no way of telling which sequence is running in TestStand with the reference you have in it at the moment. There are ways to implement this however I'll need to know the answers to my first questions before I can recommend a solution for your app since some are easier and more straightforward depending on what your app is meant to do.

Test Engineer - CTA
0 Kudos
Message 2 of 11
(3,625 Views)
I made a step forward and it seems to work well (now I need do add some extras). The problem was because of no reference to TestStand - now I'm opening a VI by Run VI Asynchrously.
0 Kudos
Message 3 of 11
(3,617 Views)
Hi,

the problem still isn't solved.

program works well only in first UUT test. I guess that RunVI has reference only for the first UUT (when it was loaded, later it is skipped).
I was trying to pass the reference with Global.vi but it then there is an error in monitor.vi

please, could anyone check if there is a solution?

(I have to use Error in TestStand not Termination).

Best Regards.

to run program please crate StationGlobals.RunVI

Message Edited by pruk on 12-07-2006 02:07 AM

Download All
0 Kudos
Message 4 of 11
(3,598 Views)
pruk,

Going back to my first question, what are you trying to accomplish with this part of your application? Once you handle the error and set SequenceError.Occurred=True do you want both the VI and the execution of your sequence to stop? It's not clear what your goal is and I could provide more assistance if I knew overall what you're trying to do from a higher level.
Test Engineer - CTA
0 Kudos
Message 5 of 11
(3,576 Views)

Hi Jon,

This VI is running in background, it monitos if there are specific answers in RS232 port or an user event. If so it has to generate an error (new execution should go to the cleanup to some defined actions before new execution could start up). The VI should be working all the time. I have to use background VI to have ability of debugging the program.

Best regards.

0 Kudos
Message 6 of 11
(3,544 Views)
Hi pruk,

So, you mentioned in your comment before that you really wanted to use this rather than use Termination. We HIGHLY recommend using termination for situations like this. I've attached a VI that uses a stop button to simulate your user event that provides the same functionality.

The reason that I believe it was only working in the first UUT is because once the first sequence finished executing it creates a new one under that execution reference.

You could also use a global variable that is checked the end of each test to see if an error has occurred as well. This global would be set by your VI. You would have to add the code to one of the PostUUT callbacks in order for it to check the global and then set have that case set Error.Occured=True.

Message Edited by Jon M on 12-13-2006 01:12 PM

Test Engineer - CTA
0 Kudos
Message 7 of 11
(3,532 Views)

Halo Jon,

Could you explain why you recommend using Termination for similar cases? I found it problematic because when I terminate the execution it doesn't go to CleanUp (for example it's impossible to shut down a power supply).

Using StationGlobal in this case isn't comfortable - I would have to check the Gloabal value at the end of every step and if it occurse jump to clean up.

For this moment my well working solution is:

  • to close backgroundVI (by using LabVIEW Globals) in PreUUT
  • to open backgroundVI using Run VI Asynchrously in Main sequence
    • if any unwelcome state occurse on the RS232port TestStand error is generated and the procedure jumps to CleanUp
    • if there are no error-generating events proces works without any interruptions

The week side od this solution is that I have to re-open my bacgroundVI in every single testUUT. I hope I won't loose to much time for this.

 

Jon, thanks a lot for help, and please explain why you recommend Termination (how to execute all the steps I had to do before ending a procedure when it doesn't go to CleanUp).

Best regards

0 Kudos
Message 8 of 11
(3,520 Views)

pruk,

There terminate and abort.

If you terminate, then the cleanup should be performed before the execution is terminated. I say should, but it also depends what has been set in your Station Options for runtime errors.

If you abort, then cleanup are not run.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 9 of 11
(3,516 Views)
pruk,

Ray is correct in that the execution should go to cleanup when you call termination. Thus our recommendation for using over most other methods of ending your execution.
Test Engineer - CTA
0 Kudos
Message 10 of 11
(3,509 Views)