NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to unload a substep (post, edit, etc.)?

This has been bothering me for a while, and now it has actually caused my code to not function properly.

1.  I have been wanting to add a substep for edit code for my post step (similar to edit code if you have available if you use specify module), but have been unable to determine how to unload the module.  Because the step module is none.  I cannot determine how to unload the module via the TestStand API without unloading all the modules.

2.  I have a VI now that I use the first run LV primitive, and since TestStand doesn't unload the module, the code works properly the first time called, and doesn't after that.  So, I tried setting the step load options, and that didn't work.  I saw in my step type definition, that the advanced TestStand properties shows the post step and has the module load and unload options under it, but setting those also did not work.

Is there anyway to do either of the tasks I wish to do?  I know for 2 I can call it dynamically, but I would prefer not to.

Thanks.
0 Kudos
Message 1 of 5
(3,552 Views)

Matthew,

The Edit sub step allow the user to modify the properties of the Step. Its not used during the Sequence execution. The execution part of the step can be the Pre, the Code Module  and Post sub step. You can have any combination of these sub steps. There isn't different Edit Sub steps.

Can you post an example of your custom step?

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 5
(3,548 Views)
Ray,

I wasn't clear enough in what I want to do.  I've been working too late.

In regards to my original #1:  If you specify a module for a step type, or use one of NI's step types, say Action with the LV module, TestStand has a menu item called Edit Code which will unload the module, open the VI, and allow you to edit it.  I have grown tired of having to unload all modules or navigate through the custom step type list to go to Properites->SubSteps, choose the Post Step (or Edit step if my step has one), specifty module, edit VI to be able to do the same thing.  So I wanted to add an edit step to my step type which basically repliactes the Edit Code menu item that is in the TestStand menu item when I specify module.  But, I cannot figure out how to unload the Post Step VI, so the VI can be edited.  I am not trying to do this during sequence execution, but during sequence creation.  My two issues have similar basis (I think) in that I need to unload the Post Step VI module and I don't know how to do it.

In regards to my #2:  I attached an example and it has actually made me more confused than I was before.  The VI is simple.  It just has a first call LV primitive.  If the VI is unloaded, it will say "This is the first run".  If the VI has not been unloaded, the next time it will say "This is NOT the first run."  This demonstrates the basic problem I have with a Post Step now.  I have some feedback nodes and First runs that need to be reset every time the step runs.  If I can get the VI to unload, then it resets and functions properly.  The problem is I cannot get it to unload.  The part that confuses me know is that in my example, I tried to use the NI Action step to demonstrate how I want it to work, and even with the steps set to unload after the step executes and load dynamically, it still doesn't unload the VI as it does if I go to File->unload all modules.  Perhaps I misunderstand how these settings work.


Message Edited by Matthew Kelton on 11-28-2007 04:54 AM
0 Kudos
Message 3 of 5
(3,544 Views)

Matthew,

I think I've found a way to do what you are trying to accomplish, but I haven't tested it thoroughly.

To get a reference to the step's pre- or post-step, you must go through the step's step type reference.  You don't say what version of TestStand you are using, but in TestStand 4.0, you could accomplish this by using the following expression:

Step.StepType.Substeps["Name of Substep"].UnloadModule()
If you don't have 4.0, you can accomplish the same thing using ActiveX steps.

Since it is possible to have substeps of the same name, you can also reference them by index using a number instead of a string.

Hope this helps!

Josh W.
Certified TestStand Architect
Formerly blue
Message 4 of 5
(3,509 Views)
Josh,

Thank you.  I finally had a chance to revisit this and this is exactly what I was looking for.  I was able to solve both of my problems with this.

0 Kudos
Message 5 of 5
(3,434 Views)