NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

passing global variables

Boy this thread got out of hand... 🙂

 

This is a very interesting topic though because I see so many people struggle with where to put variables.  There are 4 (technically 5 if you count step properties) places where you can create variables in TestStand: Locals, FileGlobals, StationGlobals, Parameters

 

Let me put my 2 cents in for each:

 

Locals: Used to share data between steps in a sequence.

 

Parameters: Used to receive and modify data from a caller.  Ensures modularity as Dug eluded to above

 

FileGlobals: Set once during execution and never set again (according to the TestStand training manual).  General rule of thumb- the only time you should ever write to a FileGlobal is inside of a callback.  In fact if you are writing to or reading from a FileGlobal inside of a Normal Sequence (i.e. the light blue ones) then chances are you are doing it incorrectly.

 

StationGlobals: My opinion- avoid at all costs!!!  However, they are obviously there for a reason.  According to the manual they are to be used for bench settings such as GPIB aliases.  Things that are used to configure an entire station/bench.  If you are smart though you will use Property Object files instead (which StationGlobals are.  They are just shared by everyone).  The biggest problem with StationGlobals is if you have multiple developers creating automations for the same test station then there is a good chance they will all try to create a variable in there called PowerSupply (or something like that).  The problem with this is that they could be writing to it with different information and screwing up the other automations.  With your own PO file you can have disk saved configuration settings all to yourself.  At the beginning of the automation read them in and set a FileGlobal.

 

Take it for what it's worth.

 

Cheers,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 11 of 11
(1,177 Views)