NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

2 issues: constants and passing params

TESTSTAND :
1. I know how to create variables - but how can I define / declare a constant in a TestStand sequence file. Eg. MAX_LOOP_VALUE = 100 ?
(So that the execution will never be able to modify it)

2. How can I pass parameters between Process Model and a Sequence File (both : to and from) ?
I do NOT want to use station globals or file sequence globals - I want to pass parameters when eg. a new PROCESS MODEL step is invoked from a SEQUENCE FILE.

Chris
0 Kudos
Message 1 of 10
(4,970 Views)
Chris,

If you want to create a constant in TestStand, you can create a variable as you normally would by Right-clicking and inserting a variable. In order to ensure that the execution will not be able to modify that variable, you can set the property of NotEditable to make the variable constant. To do this, right-click on your variable. Choose Properties and then click on the Advanced button. Scroll down the list of properties and the last checkbox should be "PropFlags_NotEditable". Select this to make your variable uneditable. You will get a warning saying "If you turn on PropFlags_NotEditable you will no longer be able to edit or delete the object. This means that you will have no way of turning the flag off again." You can select ok if you are sure you want to make this local a constant.

As for passing parameters between the process model and the sequence file, there are two different ways to do this. If you are just trying to access the local variables of each sequence, you can use RunState.Caller to access the calling sequence's information. For example, if you are in the client sequence and you'd like to access a process model local variable, within the client sequence file you would use the lookup string "RunState.Caller.Locals.ProcessModelVariable". If you are in the process model and want to access a client sequence variable you would use the lookup string "RunState.ProcessModelClient.Data.Seq["MainSequence"].Locals.ClientSequenceLocalVariable".

The other option would be to customize your process model to pass data to your client sequence file. To do this, modify the MainSequence of your client sequence file to receive some data values in the parameters tab. Then modify the MainSequence Callback of the process model to pass those data values to your client sequence MainSequence. Note that if you do this, you will be making the process model specific to this one particular client sequence file. Usually, we recommend that you do not modify a process model to be unique to a specific client sequence file.

Hopefully this answered your questions. If you need further clarification, please let us know.

Regards,
Shannon Rariden
Applications Engineer
National Instruments
Message 2 of 10
(4,970 Views)
1. RE CONST :
This does not seem to be an option because:
- after it is done then you are not able to edit ANYTHING during dev process for a particular item
- it will still not have the properties of a "CONSTANT" : I was able to change its value - see attached example : const_try1.seq.

In const_try1.seq : const_1 was set to value of 15 and marked as NOT_EDITABLE at design time and I was able to change it s value to 20 at run time. And this is exactly what I do not want.

2. RE PARAMS - I will try it and see
- chris -
0 Kudos
Message 3 of 10
(4,970 Views)
Thanks a lot for hints - I tried Option 1 and it seems that only PROCESS_MODEL--->CLIENT part of it works.

Please see 2 attached WORD docs (in ZIP file):
- passing_params_problem__screen_dump.doc:
PROCESS MODEL does not see tru value of client's i variable (but client can see proper values from Process Model - which is good)

- Where is RunState_ProcessModelClient listed.doc:
Typing the RunState.ProcessModelClient.Data.Seq["MainSequence"].Locals.i into expression works fine but how do I get to :
RunState.ProcessModelClient.Data.Seq["MainSequence"].Locals.i
in BUILD EXPRESSION dialog ?

------------
I also attached 2 sequence files :
- testcase_passing_params.seq
- seq_model_passing_params.seq
with my attempts to use your hint


Cheers
-chris-
0 Kudos
Message 4 of 10
(4,970 Views)
Chris,

Perhaps I can offer you some more information for this.

As for creating a constant, TestStand does not provide a method for creating a constant that cannot be modified at run-time. The non-editable flag is the closest that TestStand offers at this time.

Regarding sharing client sequence file and process model data, I think that a Discussion Forum post by one of my collegues may be of help to you. ""Run Sequence in New Execution - parameters passing"

Another option is to pass all the parameters to your client sequence by value. Then when you change these variables, your process model copy of the variables will also reflect those changes.

In addition, I recommended that you should use "RunState.Caller.Locals.ProcessModelVariable" to access a process model variable from your client sequence file. However, using the path "RunState.Root.Locals.ProcessModelVariable" would be a better solution. Using "Root" instead of "Caller" will ensure that you will always access the process model. If you use "Caller" you are referencing the sequence that called the current sequence which may not necessarily always be the process model.

You cannot see the expression "RunState.ProcessModelClient.Data.Seq["MainSequence"].Locals.i" in the Build Expression dialog because this expression is dependent on the sequences that you choose to execute. Many different properties of TestStand depend on the exact system settings and sequence files that you are using. These different properties are not loaded until run-time since before run-time TestStand does not know which sequences you plan to execute. If you wish to see the available properties at run-time, you can insert a breakpoint into your sequence file and start the execution. When the execution stops, change to the context tab. This will have the current information that TestStand has gathered about the current execution.

Hopefully that will clarify my first attempt to answer your questions.

Regards,
Shannon
0 Kudos
Message 5 of 10
(4,970 Views)
i have a very similar need, however, I have a question about entry points.  If I run from Test UUT or Single Pass, it seems like all of the RunState.Caller.Locals would be available.  What do I do if the user selected a Run Selected Steps or Run <some sequence>.  I want to be able to call my client sequence (LabVIEW) steps and pass in the same parameters either way.  Thoughts?
0 Kudos
Message 6 of 10
(4,623 Views)

Hello Mrbean,

The best way to ensure you always have the same input is to use Station Global Variables. These are in an ini file and constant for the station. Additionally, you could include constants in your LabVIEW code if you knew that those values never changed.

Regards,

Hillary E
National Instruments
0 Kudos
Message 7 of 10
(4,583 Views)
I'm wondering about StationGlobals (SG) vs FileGlobals (FG).  Obviously if I create the variables in SG then I only have to do it once, versus declaring the variables for every sequence file's FGs.  Other than the scope issues, is there any advantage (ease of use, available utilities, etc) of one over the other?
0 Kudos
Message 8 of 10
(4,572 Views)
There isn't a difference between Sequence File Globals and Station Globals other than the scope.
Regards,

Hillary E
National Instruments
0 Kudos
Message 9 of 10
(4,550 Views)

Actually there is a difference.

One is available at runtime and after execution has stopped.

The other you have to change both static version and dynamic version to get the same effect.

One is available across all Sequence Files

The other is only available across sequence files if set for this condition in the sequence file properties and if parallel process model or batch model is being used.

 

regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 10 of 10
(4,549 Views)