NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

ProcessModelPreStep usage

Is ProcessModelPreStep can cause to skip the current step. If yes, how to program it?
0 Kudos
Message 1 of 6
(3,944 Views)
Hi Misha,

Generally, if you want to skip a step dependant upon some previous occurance, it is better to use pre-condition. The thing to bear in mind with a ProcessModelPreStep is that it will run before the engine executes each step in any sequence that the process model calls, and each step in any resulting subsequence calls.

Hope this helps,

Nick
0 Kudos
Message 2 of 6
(3,944 Views)
Thanks, Nick,

1. I need to skip a step, depending on some condition, which should be evaluated by some side software. Therefore the only way, is the call this code from station model-ProcessModelPreStep.
2. This feature should impact thousands of steps. To accomplish your proposal, there is needed to manually edit each step. This is little bit inconviniently.

Misha.
0 Kudos
Message 3 of 6
(3,944 Views)
Hi Misha,

OK I see now why you want to use the PreStep and for this many steps it would appear to be the correct way in this case. What is the side software you refer to?

Nick
0 Kudos
Message 4 of 6
(3,944 Views)
Hi Nick,

This should work as follows:
ProcessModelPreStep callback contains the step, which calls to the function in my dll:
PreStep("Parameters.Step").
void PreStep(CAObjHandle hStep)
{
BOOL bIsSkipRequired=FALSE;

bIsSkipRequired=DetermineWhetherSkipRequired();

if(bIsSkipRequired)
{
//Configure step to be skipped
}
}
Consider that the "side software" is DetermineWhetherSkipRequired() function.
The difficulty is to perform skip itself (commented line).
I tried to do this by two different ways:
1. TS_StepSetRunModeEx(hStep, 0, TS_RunMode_Skip, CA_DEFAULT_VAL);
2. TS_StepSetProperty(hStep, 0, TS_StepPrecondition, CAVT_CSTRING, "false");
Neither of both attempts succeed.
In both cases I observe the similar behaviour
:
1. the step is executing
2. only after the step execution is completed, execution flow field of TS Sequence Editor is updated as desired.
It seems me like Execution object not accepts the changes made on step.
I need something like "refresh".

Thanks.
Misha
0 Kudos
Message 5 of 6
(3,944 Views)
Hi Misha,

I now see your problem. Unfortunately you will not be able to achieve what you want in this way. The step execution sequence evaluates the run mode before running the prestep so the run mode is already set to normal and the step is commited to run. ( see TestStand user manual Chapter 6 page 25 ) it is this sequence that led to my initial answer because the pre condition is evaluated before the run mode so skipping is easily achieved. A work around may be to use the processmodelpoststep callback and get the next step index and determine whether you need to skip the next step or not.

Hope this helps,

Nick
0 Kudos
Message 6 of 6
(3,944 Views)