NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change at run-time the type of a step?

Hi,

 

How topic title, i need to know how change at run-time the type of a step. I have, i my sub-sequence, a step whose type must change at run-time based upon the occurrence of a condition. How can do it?

 

ChangeSteptype.GIF

 

Thanks.


0 Kudos
Message 1 of 7
(3,145 Views)

There is a StepType sub property but it is Read Only. You may have to delete the step and place a new step with the desired type.

CTA, CLA, MTFBWY
0 Kudos
Message 2 of 7
(3,139 Views)

I will try how you said just when i have one moment free,

 

Thanks

0 Kudos
Message 3 of 7
(3,131 Views)

There is a method called ChangeStepType on the step object.

 

I have no idea what the consequences are of doing this at runtime.  You should check the Step.CanChangeStepType property first and make sure it's true before doing it.  Use at your own risk.

0 Kudos
Message 4 of 7
(3,119 Views)

Writing self-modifying sequences is not recommended. If multiple threads are running the same sequence at the same time you will need to use locks or some other mechanism of synchronizing the edits and execution of the step so that two or more threads aren't trying to do it in parallel. Also you might want to disable the sequence property "Optimize non-reentrant calls" since that will likely not work correctly since it will be trying to use a cached copy of the sequence whenever you call the sequence, yet the cache might be out of data since it wasn't expecting you to modify the sequence while it was running.

 

It might work, but there might also be a better way to do it. If you explain exactly what you are trying to do, it's possible we might be able to suggest some alternatives.

 

Hope this helps,

-Doug

0 Kudos
Message 5 of 7
(3,115 Views)

I need to do this: At verify of a condition, one specific step at the end of sequence must change from statement to numeric limit test and viceversa.

 

However, is right to no writing self-modifyinf sequence  unless handle rece condition on step that i want change at run-time.

 

Moreover i ask myself: If for change the type of a step i need first delete the substep and later create a new one relative to the step that I want, then it is better and make more sense to create dynamically the step that i would like to have depending on the condition that occurs, right?

 

Thanks

0 Kudos
Message 6 of 7
(3,090 Views)
Leave the step as multiple numeric limit and change the evaluation type of the limit based on the condition.
CTA, CLA, MTFBWY
0 Kudos
Message 7 of 7
(3,088 Views)