11-18-2014 01:53 PM
Hello,
I'm using the Pass/Fail count set to one Pass to capture an event generated by my DUT. I originally used a numerical compare step with the Looping type of Pass/Fail count to accomplish this. Unfortunately the implementation changed and now I need to execute a few steps that can not be combined within one code module as before. Nor can these steps be put into a subroutine. One of the steps executes a .NET asembly and I haven't figured out how to pass the reference to the subroutine. When the subroutine is intered the reference is lost and the methode does not execute correctly.
I have an evaluation function the exits the loop when the expected conditions are met. Everything works except for the Overall Pass/Fail result of the For loop. If the loop exits due to the first numerical compare test passing, I want the loop overall execution to report as "Passed". If the loop reaches it's predetermined number of iterations, the overall result needs to report as "Failed". It would also be nice to have the radio button functionality of "Record Result of Each iteration". Some conditions require a wait over a minute for the event to occur and I don't want to generate needless data for the report.
Currently I get the pass/fail status for each For loop iteration, but only "Done" for each loop iteration. I don't want the initial few failures to cause the test to fail.
Does anyone know how to do this? Suggestions?
Thanks,
11-19-2014 01:14 PM
I think this problem would be easier to understand if it were broken into pieces:
When the first instance of the numerical compare within the For Loop passes, Step.Result for the loop = “Passed” AND the loop is terminated.
OR
If the For Loop reaches the maximum count, the Loop Status should report as “Failed” (Locals.index < 5 is no longer true).
I have the loop termination piece worked out with a function to set the index out of range: PreviousStep.Result.Status == "Passed" ? (Locals.index = 100) : (Locals.index = Locals.index)
I believe I’ll need to uncheck the “Step Failure Causes Sequence Failure” Run Options Property for all the numerical compares. This allows the steps that fail to not effect the overall sequence failure while it is iterating through until the event is detected.
I can also use the Result Recording Option of Disabled for the loops that run long.
I think I’ll need to use a separate step to record the iteration result as “Done” and ultimately “Passed” / “Failed” depending on if the event is detected or the loop limit is exceeded. Is there a way to access the Status Expression of a multiple numerical compare? I have to jump through these extra hoops because the status expression is not available.
Please advise if this approach is plausible or any better way of accomplishing this.
Thanks,
Tim
11-19-2014 05:03 PM
11-20-2014 07:56 AM
I have 2 steps in the loop that can not be combined into one step. This forces me to implement the behavior in some form of loop. A While Loop could be an option. I would need to pass the Step.Result.Status from the Multiple Numerical compaire step to the condition of the While Loop. I tried to use the Step.TS.ID without success. Some form of reference to the numerical compare step would be needed. I'm using a For Loop as I do want to limit the number of iterations of the loop. In the case where the loop iterations are reached, the event I am trying to detect did not occur at the correct time and a failure needs to be reported.
I came up with something based on my comments in the second post:
1) To start with I configured a Locals.ForLoop_5 variable. This is used to set the limit on the loop iterations and for comparison after the loop has finished executing. More on that later.
2) The first step inside the loop invokes a method within a .NET assembly that has been packed in a DLL This method gets the required data from the DUT and stores it to a text file.
3) The next step is the Multiple Numeric Limit step. This step invokes a VI that extracts the data from the text file. This step has been customized in several ways.
i) In Run Options, the Results Recording Option was disabled. This prevents recording of "Failed" while the loop executes when waiting for the event to happen.
ii) In Run Options, the Step Failure Causes Sequence Failure is unchecked. Same reasoning as i) These steps are not true failures.
iii) A Post Action is configured to go to the nexxt step after the For Loop End step On Condition True with the logic of Step.Result.Status == "Passed". This causes the loop to exit when the first "Passed" is encountered which corrolates with the event I'm trying to detect. On Conditon Fail remains set to default.
4) The step after the For Loop End is an expression step with everythin set to default except for the Status Expression logic set to: Locals.Loopindex < Locals.ForLoop_5 ? (Step.Result.Status = "Passed") : (Step.Result.Status = "Failed"). This step performs the overall Pass/Fail reporting for the For Loop. If the number of loop iterations is less than the maximum it could have only gotten there by the previous logic triggered by the numerical compare passing, therefore "Passed". If the loop index has reached the limit, then the event was not detected, therefore Failed.
I have tested this work around with success, it just a pain to now have to implement this on my 40 some odd For Loops.
If there is a better way, I'd still like to hear it.
11-21-2014 04:53 PM
11-24-2014 07:37 AM
Hello,
How is the result from the numerical compare used in the While Statement logic?
I've tried RunState.PreviousStep.Result without success. I've also tried using the TestStand Step ID:# as well without success.
I'm sure I'm missing something simple.
11-25-2014 05:01 PM