NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Step Type Passing Status from Pre-Step to Main Adaptor

Hello,

I am in the process of creating a custom step type. This step type will consist of a Pre-Step and the main adaptor (test VI). The Pre-Step will perform some pre-test functions, such as setting up test equipment (i.e GPIB DC power supply voltage levels, etc.). The main adaptor will perform the actual test.
One of the situations that might occur in this test step is if the Pre-Step should fail (i.e. a GPIB DC power supply goes dead, etc.), and thus, I would not want to run the main adaptor (test VI) since the test results would be invalidated by the bad DC power supply. Thus my question is in regards to the best way to track and pass the custom step type's pass/fail status from the Pre-Step to the main adaptor, and ultimately to the test step's test report?
I have been trying to pass an error cluster from the Pre-Step VI (an output from this VI) as an input into the main adaptor (test VI), all within the same custom step type, but this does not appear to work. I have also looked at using the Sequence Context and the TSUtil TestStand VIs to access the step properties in the Pre-Step and main adaptor VIs, however this seems to be a little cumbersome. I was hoping for a simpler solution such as passing an error cluster among the VIs.
I was hoping to get some input from those of you that might have come across a similar situation and how you resolved it, or what might be the best way to pass this status among VIs in a custom step type.
Thank you in advance for your time and assistance.

Thank you,
Jim
0 Kudos
Message 1 of 5
(3,624 Views)
Hi Jim,

I'm going to assume you are doing this in LabVIEW, but it wouldn't be much different for other adapters.

If you have an error cluster as an output for your pre-step, you can attach that to the Step.Result.Error container in TestStand. If it gets an error, the Code Module for your step is not called. (it sounds like this is what you want).

If you want your code module to be called anyway, you can create a custom step property that holds the value of the error cluster (basically a clone of Step.Result.Error), and you can pass that into your code module if you want.

An interesting feature is that Post-Steps will always execute, regardless of error condition. This is to allow post-steps to allow for error handling.

Allen P.
TestStand R&D
0 Kudos
Message 2 of 5
(3,601 Views)
Hi Allen,

Thank you very much for your response. Your response resolved my initial problem, so that I am now able to have a custom step type that will not execute the main adaptor code module if the pre-step module of the custom step fails. However, I have run into a secondary problem regarding how the step reports it's result status. I need the step to report "Passed" or "Failed". Using the Step.Result.Error container, the default step result status are "Done" or "Error". I have been able to modify the Post Expression of my custom test step to report a "Passed" result status if the step has completed successfully, however I am not able to change the result status from "Error" to "Failed" when the custom step fails.
I've enclosed a zip file containing a simple PreStep.vi and MainTest.vi which are called by my custom step type for it's pre-step and main adaptor modules, respectively. The custom step type resides in the CustomStepTypeHandling.seq, also included in the zip file. I would greatly appreciate if you could take a look at my simplified example and determine what I am doing wrong to not allow the custom step type to report "Failed" instead of "Error" when the step fails.
As always, I appreciate your time and effort, and look forward to your response.

Thank you,
Jim
0 Kudos
Message 3 of 5
(3,594 Views)
Newbie,

The results "Failed" and "Error" are kept seperate by design. Typically, "Failed" is saved for steps that execute completely and correctly but result in something outside of limits, etc. whereas "Error" is used any time that an error actually occurs in a code module, which is what you are simulating in your Pre-Step. Therefore, the status expression is only evaluated when an error does not occur which is why it is working for you "Passed" case but not "Failed" To get around this, you can use an Engine Callback sequence to change the status when an error occurs. Go to Edit >> Sequence File Callbacks and double click the SequenceFilePostStepRuntimeError and hit OK. You will now see a sequence by this same name in your sequence file. This sequence will be called after each step in which an error occurs. There are parameters for Step and Result that you can alter the original step information. In this case, you will want to change Parameters.Step.Result.Status to be equal to "Failed" which should achieve the results you're looking for. Give this a try and let me know if you have any questions. Thanks and have a good one.

Adam B.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(3,576 Views)
Jim -
Another useful API method to be aware of is Step.CancelCurrentExecution. A substep can call this to prevent the "step" from continuing. The substep that calls this method can also set the status before returning.
Scott Richardson
https://testeract.com
0 Kudos
Message 5 of 5
(3,538 Views)