NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

When to use Parameters vs File Global variables?

What is the rule of thumb on when to use "Parameter" variables vs. using "File Global" variables?  TestStand documentation explains to use Parameters to pass data to a called subsequence from a sequence or vice versa.  However, File Globals are accessible by all sequences.  It seems easier to just use a File Globals but I also see documentation that says use File Globals only when really needed.  Thanks!

0 Kudos
Message 1 of 11
(2,324 Views)

If you use FileGlobals, it limits your sub-Sequence to be closely tied to the variable names and the variables being a FileGlobal in the new sequence where you reuse it.

 

If you had used Parameters, the sub-sequence can take in any type of variable and not be closely coupled to any sequence file.

 

This is analogous to whether you use controls on the connector pane for a VI or directly use Global variables inside the VI.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 11
(2,316 Views)
General rule of thumb in programming is to use the lowest access scope possible for variables. There are many reasons for that, e.g. transparency, data safety, debug-ability. For TestStand this means to use Locals whenever possible. Use Parameters only when Locals are unsufficient. Use FileGlobals only when Locals and Parameters are unsufficient. Use StationGlobals only when Locals, Parameters and FileGlobals are unsufficient. As always in life there are exceptions, but you'll never wrong badly following that. Stefan
Message 3 of 11
(2,284 Views)

It sounds like you might know the answer I seek.  Which one is used to stuff the $(UUT) macro when specifying the report filename path by expression?  None have worked for me.  Perhaps you know what I don't.

0 Kudos
Message 4 of 11
(2,248 Views)

I am not sure this is related to the original question, but whatever you set to the Parameters.UUT.SerialNumber variable in the PreUUT callback sequence will be used to replace the $(UUT) macro.

Message 5 of 11
(2,245 Views)

I see it as related, and I thank you for a response.

 

I'm trying to set it from mainsequence.  I don't think it's possible.  This is the sequential model by the way.

0 Kudos
Message 6 of 11
(2,241 Views)

I am by no means profound on that topic as we do not use the NI process models but I believe that it should not be possible from the MainSequence.
When you set a breakpoint in the Model before the MainSequence is called, you will see that the report file is already created at that time (only the content will be added later). Which makes sense when thinking about On-The-Fly reporting.


So it is hard to imagine you'd be able to interfere with the file name after it is already created.

 

Stefan

Message 7 of 11
(2,218 Views)

Hence, the serial number absolutely must be known before the start of the test of the UUT.

 

Thank you.

 

 

0 Kudos
Message 8 of 11
(2,203 Views)

You can move all steps until and including the one that gets the UUTs serial number from the MainSequence callback into the PreUUT callback sequence.
Other than that, I don't think there are reasonable options.

0 Kudos
Message 9 of 11
(2,199 Views)

Or you can obviously modify the template SequentialModel to work the way you need it to.

 

Stefan

Message 10 of 11
(2,196 Views)