NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

checking parameters in sequence file before execution

Background:

 

I am using teststand sequence file using .NET adapter. My challenge is, if I made changes to my assembly, let us say a number of parameters of method "ExecuteA" and then compile it. Obviously the teststand will throw you an error  like "Invalid parameters specified..."  but the teststand will ONLY throw you the error when it started executing each step not even before it will execute ALL the step.  To give you background of the scenario, if I have 100 steps in my sequence file and  step 1, 25, 50  are using the method ExecuteA, but then I forgot to change and update the step50. It means I will realize that there is error once it only starts executing the 50. To make the scenario even worst, is step 1 to 25 takes 2 days to execute... so that will be a lot of wasted time. 

 

Question : 

How will I know if  the steps in my sequence file  are in good condition? Is there any function that I can call? I tried using the CheckExpression but it is only covering the expression of the property type and not the parameter. I also set my file properties option to "Preload when opening sequence file"... I badly needly solution for this ASAP. 

 

 

Thanks in advance. 

 

 

 

Message 1 of 14
(5,674 Views)

Try calling Module.IsPrototypeIncompatible() on each step in your sequence (You can write a tool which does this - look at ForEach.seq in the <TestStand>\Components\Tools directory for an example of a tool which iterates through all of the steps in a sequence file and performs an operation on each one.). If this method returns true then the prototype is out of date. If this method returns false then that doesn't necessarily mean the step is runnable though as it will return false if the module can't be loaded or is unspecfied too. You can try to load the modules to check this as well by using Module.Load(). NOTE: Module is a property on the Step interface.

 

That said, the issue of needing to verify a sequence is runnable before executing it is something we are looking into addressing better in a future version of TestStand.

 

If you need help getting the tool to work, please let me know what version of TestStand you are using and I'll attach an example sequence.

 

Hope this helps,

-Doug

0 Kudos
Message 2 of 14
(5,644 Views)

Hi Doug  - Sorry for delayed response, Ive been out of the office for 3 days.

 

Anyway, I've looked at the ForEach.seq sample, I cannot seem to find the Module.IsPrototypeIncompatible(). What I saw is a step that is calling the TSForEach.dll - and looking at the code, seems like that is where the looping/scanning is happening. When you say module, you mean the Step object? If yes, is this the code that you are referring Step.LoadModule(,)?

 

Correct me if I'm wrong, but based on my understanding to what you said.. you are suggesting that I have to loop through my steps before ACTUALLY running it. The method for these will not require "real" execution, right? because if it does then it will change the state of my equipment.

 

 

My teststand version is 4.2.1. 

 

 

0 Kudos
Message 3 of 14
(5,615 Views)

The Module API is a property of the Step API. For example:

 

Step.Module.IsPrototypeIncompatible() is a call you can make.

 

I meant the foreach.seq is an example of sequence designed to be used as a tool sequence to iterate through all of the steps in the current sequence file. It does not yet have any calls for checking the prototype. I was suggesting you write such a tool based on the code in foreach.seq and calling  Step.Module.IsPrototypeIncompatible() on each step in the currently selected file when the user invokes the tool sequence you write. Then whenever you want to check a file you would run the tool on it to check the prototypes.

 

NOTE: A tool sequence is one designed to be called from the tool menu of your UI or sequence editor. You can add items to the tool menu such that when they are selected they execute a sequence. Many of the existing tool menu items are implemented this way so you can take a look at the existing ones as an example.

 

Step.LoadModule() does not execute the code modules, but it does load them. If there is a negative sideeffect to loading the modules (this is unlikely in most use cases) then that might be an issue, but in that case then preloading is probably already a problem for you. It's basically going to have the tool load the modules and make sure they are all loadable. If you are using Preloading (which is the default) then you are probably already indirectly doing this so calling Step.LoadModule() probably isn't really necessary as you would get a load error upfront anyway.

 

If you would like an example sequence, we can put one together, but it will take some time to do. Let us know.

 

-Doug

Message Edited by dug9000 on 03-04-2010 10:48 AM
0 Kudos
Message 4 of 14
(5,610 Views)

Yes - I would like to see an example. 

 

Thanks Doug!

 

0 Kudos
Message 5 of 14
(5,599 Views)

Here's an example sequence file. To use it:

 

1) Save to your computer somewhere (I'd recomment <TestStand Public>\Components\Tools)

2)  Go to the tools menu and select the "Customize" item at the bottom of the menu.

3) Click the "Add..." button

4) Select "Sequence" as the item type. and browse for the sequence file you saved for 1)

5) Choose "Tool Menu Item Entry Point" as the sequence name

6) Click "Ok"

7) Change the item text expression to something like "Analyze current sequence file"

😎 Click ok.

9) Select  the file you want to analyze as the active sequence file in the sequence editor. Then choose the new tool menu item you created

10) you should see a summary dialog and if any errors where found the details will show up in the output window.

 

Feel free to add more code to the sequences in this file in order to check for other things in the steps or sequences of your files that you might want the tool to check for.

 

Hope this helps,

-Doug

0 Kudos
Message 6 of 14
(5,597 Views)
Thanks Dug - I will take a look at it now.
0 Kudos
Message 7 of 14
(5,595 Views)

Hi Doug -  Thanks for this. I think this will support some of the stuff that I need to cover in my verification.  

I have couple of questions though

- when I am running a good sequence file, it is still throwing me an error "Module Prototype is not compatible ". What does it mean? I tried searching it and I cannot find the explanation of it.

      - Is there anyway I can call this programmatically from my .net end? How can I get the result from the output window into my string collections?

 

Thanks,

Maria 

 

0 Kudos
Message 8 of 14
(5,570 Views)

1) What adapter are you using? The Module prototype not being compatible sounds like the prototype for the code module has changed. These sorts of errors are adapter specific though so it would help to know what adapter you are seeing this with. You could add to that tool sequence code to call Step.Module.Load() as a way to also verify that the module is loadable which might help catch additional errors depending on the adapter involved.

 

2) Do you have a custom UI? Where are you trying to get the strings into? If you are writing your own custom UI you can handle the UIMessageEvent on the ApplicationMgr and handle the UIMessage_OutputMessages event (see the UIMessageCodes help for this UIMessage in the online help for more info). Or you can always rewrite the tool to just store the strings to a station global or some other location you require instead of posting output messages.

 

Hope this helps,

-Doug

0 Kudos
Message 9 of 14
(5,555 Views)

Hi Doug -  

- What do you mean when you say adapter? 

- I think the error "Module prototype not being compatible" is coming from when I recompile the .net dll attached to my step, but it shouldn't throw me an error since nothing change in the structure (I maybe wrong, this is just a guess). When you called the IsPrototypeIncompatible in the step, what it is exactly doing?

 

To answer your question, yes I have a custom UI. the UIMessage_OutputMessagees will work.

 

But again, how will I run the   Analyzing current sequence file tool programmatically from my .Net side without the need of attaching this in each of my sequence file?

 

Thanks! 

0 Kudos
Message 10 of 14
(5,520 Views)