06-28-2011 05:22 PM
For example, if the symbolic value for the reverse gear on an automotive bus is 2, then I need a constant, REVERSE, that is accessible from all of the sequences in a file and cannot be changed from 2. It is not obvious how to do this in the Variables tab.
Actually, I would like a way to share the constant among files - so it only has to be set in one place - and without using a Station Global because other projects may not use the same value for reverse, but I gather from my colleagues that NI's software doesn't normally offer that kind of flexibility.
06-28-2011 06:37 PM
Maybe a resource string?
http://zone.ni.com/devzone/cda/tut/p/id/3650
Not sure if that will fix your issue of people needing to override it though.
06-29-2011 01:03 AM
Unfortunately TestStand doesn't have constant so you are left with using a variable.
Use the FileGlobals if you want it accessible to all sequences in a sequencefile.
One way would be to set the attribute flag so that you cant edit it but once set then the only way to change it is by deleting the variable.
06-29-2011 08:54 AM
Thanks. File globals that are set to Not Editable seem the easiest, but as I said this value will need to be accessed my multiple files without being a Station Global. Is all of the functionality for accessing text files built in to Test Stand?
06-29-2011 09:04 AM
Yes it is. In fact I would recommend you look into property object files. You can read about them in the help and if you have any questions let me know.
Unfortunately by setting a variable flag to not editable doesn't mean that you can't change the runtime value of that variable. Because you can! So that doesn't really buy you anything.
06-29-2011 09:09 AM
Thanks for the heads up. I am just getting started with TestStand, so right now I only have a handful of sequence files. I will look into the property object files while the the library is still small.
07-01-2011 07:18 AM
As a follow up to my previous question, is it easy to accidentally assign a value to a variable in TestStand? I'm used to programming in a C like language where it was beneficial to have constants because it was very easy to accidentally change something.
07-01-2011 10:11 AM
Unfortunately TestStand doesn't have the ability to do constants unless you use a resource string. But then you are stuck with a string type which is always easy to convert.
However, if you never assign that variable to anything and always just read it then you'll be fine. But you have to have the wherewithal to assure that you don't assign it. It actually is pretty easy to assign variables (e.g. Locals.Foo = 5) And the thing is you can do this in any expression (which are scattered all over TestStand). For instance each step has at least 3 expressions in the Pre, Post and Status. So somebody could assign it and it wouldn't be easily recognized without doing searches and the like.
You are more than welcome to suggest this in the idea exchange: http://forums.ni.com/t5/NI-TestStand-Idea-Exchange/idb-p/teststandideas
Not sure if a product suggestion was ever made but you can also do that as well: http://forums.ni.com/t5/NI-TestStand/is-there-a-way-to-define-my-own-constants-in-teststand/td-p/735...
07-04-2011 01:31 AM
Hi,
Just an other solution...
If I have the requierement to share variables over sequence files i am using a queue.
http://forums.ni.com/t5/NI-TestStand/passing-information-between-callbacks/m-p/1261228#M30467
Hope this helps
Juergen