NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop while until measurement is passing

Solved!
Go to solution

Hello! I would like to ask what would be the best way to program this in TestStand. I have a sequence that has many UUT’s in batch mode. During the first of the sequence, the operator must load the parts and the test will do a simple voltage test. If the part is not loaded properly it will fail the voltage test.

 

Here are the conditions I would like to build in but I’m unsure how to build the expression or loop structure.

 

  • Part tested (if previoustest.result is "passed" then continue to next test)
    • If fails, message user and wait for the user to reposition the part OR allow user to disable socket and acknowledge
  • Once acknowledge received, test again (if disable socket continue)
  • Do this 5 times and after then just continue

 

I’m just not sure of how to do the loop structure (DO while, or while ) expressions etc.

 

Thanks!

Bill Lewis
0 Kudos
Message 1 of 8
(7,031 Views)

I assume you have TestStand set to use BatchModel.seq or maybe some customized variant.  

 

In the PreBatch callback, I would do something like 

 

For (Number of Loops =  GetNumElements(Parameters.ModelData.TestSockets) )

 

Prompt user to load the nth UUT

Perform the voltage test

If (VoltageTestFailed)

     Prompt User to reposition or Disable

End

 

End (For loop)

 

Pulido Technologies LLC

0 Kudos
Message 2 of 8
(7,021 Views)

Consider this example.  It uses the SequenceFilePostStepFailure.

 

Let me know if you have any questions.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 3 of 8
(7,012 Views)

I ended up doing it this way. Do you guys see anything wrong? Each UUT will have to be looked at so i put it as part of the main sequence

 

 

2016-06-29_12h24_53.png

 

Bill Lewis
0 Kudos
Message 4 of 8
(7,003 Views)

My opinion is that if you're trying to see if a UUT is installed correctly or needs to repositioned somehow, that ought to be in PreBatch.  I try to reserve MainSequence steps for the actual tests and would like to assume that the UUTs have already been placed in the correct position by the time I get there.  Also, if you want the user to be able to disable a test socket, that's definitely something to be handled in PreBatch.

 

Pulido Technologies LLC

Message 5 of 8
(6,999 Views)

As a general rule of thumb I try to avoid GO TOs and Breaks.  They will work and get the job done.  It is just hard to follow the code for maintenance reasons.  Case in point: the sequential model used to contain GO TO steps.  When they redid it they removed them all and used while loops, similar to what pulido did in his pseudo code above.

 

The great thing about the TestStand is there are 50 ways to do things.  The worst thing about TestStand is that there are about 50 ways to do things...pick your poison.

 

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 6 of 8
(6,998 Views)

Ok so if I put it in the prebatch callback i have a few questions:

 

  • the prebatch callback has 2 items in it now. Where do I need to place the code before of after those two items?
  • the if statement will cycle through each and prompt
    • If (VoltageTestFailed)

           Prompt User to reposition or Disable

      End

  • How would be the best way to disable other than the operator clicking on the disable socket control
  • By modifiying the callback does that get rid of the normal batch popup?
Bill Lewis
0 Kudos
Message 7 of 8
(6,987 Views)
Solution
Accepted by Bill_Lewis

When you put the PreBatch callback (or any other callback) in your client sequence, the code in your client sequence is what is called instead of what's in the model.

 

If it was me, I would get rid of the two default PreBatch steps and make my own prompts (in your desired language) that work within the loop.  You would also have to populate the ModelData Container with all of the pertinent information, especially so you can tell TestStand which sockets are disabled.

 

I think the examples for overriding PreBatch are pretty good, so hopefully that's a good starting point.

<TestStand Public>\Examples\ProcessModels\BatchModel\OverrideSerialNumForBatchModel1.seq

 

Pulido Technologies LLC

0 Kudos
Message 8 of 8
(6,979 Views)