NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to give parameters to a sequence when calling it with "Specify by expression"

Hello,

 

When running a Sequence Call specified by expression, TestStand automatically loads the called sequence with its parameters by default.

 

Has anyone any idea how you can give your own parameters?

 

NB: I cannot use the Load Prototype functionnality because there are about 50 possible sequences to call and they all have very different sets of parameters.

 

Thanks in advance

Marcia

0 Kudos
Message 1 of 10
(8,401 Views)

Hi Marcia,

 

You need to script using the hidden properties of the step (make them showing off by enabling "show hidden properties" in station option>> preference).

I created a simple exemple picturing how to do what you want.

 

You also could use an easier method opening the sequenceFile before executing it, configure the default  value of  the parameters or some locals, fileglobals, save it ... and then configure the SequenceFile Path Expression and SeqNameExpr properties of the sequence Call Step in your caller sequence

This would definitely work for non object type property as you cannot configure manually the default value for them. (i.e it would work for numeric, string, boolean and also container containing subproperties of those types)

 

Regards

 

 

Romain DUVAL || RF & Semiconductor Staff System Engineer || CLA || CTA
National Instruments France

Download All
Message 2 of 10
(8,163 Views)

just forgot to mention that this example implies that I already know the name of the  parameter I want to configure and also its type but you could easily get those infos parsing the parameters container of the sequence you want to execute.

Those pieces of information are important since the ActualArgspropertyObject is an argument List therefore not a conventional container /array and you cannot use the following syntax to access parameters Runstate.NextStep.TS.SData.ActualArgs[0] for example (at least from what I experienced).

 

regards

Romain DUVAL || RF & Semiconductor Staff System Engineer || CLA || CTA
National Instruments France

0 Kudos
Message 3 of 10
(8,161 Views)

Hey Romain -

 

Have you found anyway to access Parameters as any array (as you mentioned in your last post)?  

 

I'm trying to do the same thing as the OP:

Essentially, I'll read in a text file that is formatted as "SubsequenceName,Param1,Param2..." (several lines), and then have a for loop that executes sequence calls by expression. Like OP mentioned, the number of parameters and names will be different for each subsequence.   I'd like to be able to set parameters via indices if possible

0 Kudos
Message 4 of 10
(8,082 Views)

Hi CHiefwigms,

 

I hope you will find attached what you need.

In this exemple, the subsequence you want to execute has many parameters of string type.

 

Throught a statement step looped, TestStand script the value of each parameter dynamically. Those value are store statically in some locals string but as you required it could come from a UDP datagram or any other strings source.

The scripting of the subsequence is entirely dynamical here.

When implementing the code I took into account you input more parameters than required by the called subsequence which would normally result in a runtime error. (look the loop while expression of the statement step)

 

As a TestStand Architect, I would suggest another technic though, since  this one is not very maintanable.

 

The other technic would be to :

 

1°) Receive your UDP datagram and parse it to extract values for SequenceFile Path, Sequence Name, parameter 1 string value,....parameter n string Value.

With those information, just use the engine to open the sequenceFile store on disk, make the modification on the parameters, commit your values changes by saving if you want and then execute it.

The mapping of the sequence parameter and the value u want to give them won't be based on the paramater name but on the parameter index within you datagram .i.e  "parameter 1 string value" relate to the first parameter in the parameter container of the sequence you want to execute.

 

Hope everything helps!

Romain DUVAL || RF & Semiconductor Staff System Engineer || CLA || CTA
National Instruments France

Download All
0 Kudos
Message 5 of 10
(7,961 Views)

Hrm - so there are no API calls that allow you to access the Parameters as an array?  I guess this would work - I guess I forgot to mention - the sequences have variable parameter names ("Sequence1","CenterFrequency","Amplitude" etc). I thought about doing it this way, as well as just having a parameter that is an array (Parameter.ParameterList[]), however again you don't have any useful information on what the parameters mean without a lookup table.

 

Thanks for all your help - this example is extremely useful!

0 Kudos
Message 6 of 10
(7,953 Views)

No,

 

The prototype of Sequence call is a container and ActualArgs is an argument list.

 

You could workaround doing this:

 

From your sequence that receive the UDP datagram, open a reference on a sequencefile, open a reference on the mainSequence of that sequenceFile and get a reference on a step of type SequenceCall that you would have placed inside this MainSequence.

 

Then use the LoadPrototype() method on the module property of the SequenceCall Step, save and then script the value of the parameter that are contained in Step.TS.SData.Prototype.

Then execute it!

I think it cannot be done within the same sequence file as the sequencefile is copied in memory before being executed.

 

Regards

Romain DUVAL || RF & Semiconductor Staff System Engineer || CLA || CTA
National Instruments France

0 Kudos
Message 7 of 10
(7,947 Views)

Hello Romain_Duval,

 

I'm trying to use your scripts for passing arguments specified by expressions, but I just can't find the type for boolean, and some of my parameters are boolean.

 

So far i have found 1 for Container, 2 for String, and 4 is Number (from your example). Could you please tell me what is boolean, or where can I find this information ?

 

Thank you,

DFrancois

0 Kudos
Message 8 of 10
(7,918 Views)

Hi DrFrançois,

 

Here is a screenshot of the hidden properties for a boolean parameter.

 

bool_type.JPG

 

Regards

Romain DUVAL || RF & Semiconductor Staff System Engineer || CLA || CTA
National Instruments France

0 Kudos
Message 9 of 10
(7,911 Views)

@MarciaDub23 wrote:

Hello,

 

When running a Sequence Call specified by expression, TestStand automatically loads the called sequence with its parameters by default.

 

Has anyone any idea how you can give your own parameters?

 

NB: I cannot use the Load Prototype functionnality because there are about 50 possible sequences to call and they all have very different sets of parameters.

 

Thanks in advance

Marcia


Rather than use a sequence call step, you might want to consider calling the Execution.NewThread() API instead and then calling Thread.WaitForEnd on it to make it synchronous. I would recommend against dynamically modifying a sequence while it is running. Many properties on steps are shared among all instances of the step currently running, so modifying those properties at runtime can cause issues if you are executing that sequence in more than one thread at a time.

 

-Doug

Message 10 of 10
(7,849 Views)