lavezza Posted June 19, 2004 Report Share Posted June 19, 2004 There has been a recent discussion on Info-LabVIEW about how to implement constants in LabVIEW. We are talking about a constant value that is used many times in a program. These are defined at compile-time, not run-time. Several options were discussed (Globals=nasty, Simple VI with constant output=a file for each constant!, VI with cluster=have to have vi and unbundle for each call). I think a Global Variable-like VI (no block diagram) that automatically 'Set Current Values to Default' would be good. When dropped on a diagram, it would show up as an enum-like constant. It would be polymorphic. (see attachment) Quote Link to comment
Michael Aivaliotis Posted June 22, 2004 Report Share Posted June 22, 2004 I guess there is a place for a new type of constant however I don't feel that it is really such a big issue. Personally I prefer to use a sub-VI for placing constants. I don't understand why you need to have one VI per constant. Most of the time constants belong in groups. For example you would have DAQ settings or Instrument settings. You would then place all constants on the diagram of a subVI. Of course you would put them inside of a cluster then output that cluster to a terminal of the VI. A simple unbundle will give you what you need. If you don't like clusters and unbundle then use multiple output terminals instead. Why is this so hard? There is also a hidden potential here that is not evident at first but I will explain. If you created a VI for each functional group of constants you could easily convert them (down the road) from static hard coded data objects into flexible variables that can be abstracted and manipulated externally, even as a built executable. Each constant VI can be edited and replaced with a read\write from ini file. This allows you to implement code Quote Link to comment
lavezza Posted June 23, 2004 Author Report Share Posted June 23, 2004 After reading Conway-Watts I've started putting all 'constants' in INI files. There just seemed to be a desire from some to have a 'cleaner' compile-time constant, so I made a suggestion. I can think of other things I would like to see in LabVIEW first. Quote Link to comment
Michael Aivaliotis Posted June 23, 2004 Report Share Posted June 23, 2004 After reading Conway-Watts I've started putting all 'constants' in INI files. There just seemed to be a desire from some to have a 'cleaner' compile-time constant, so I made a suggestion. I can think of other things I would like to see in LabVIEW first. Yes the Conway-Watts book you refer to has some great examples of this. As far as the value of posted suggestions\wishes, we have quite a bit of influence in the direction of future versions of LabVIEW as long as the wishes get posted to the right location: LAVA wish list policy. My opinion is just that, an opinion and does not indicate right or wrong. Keep those opinions and suggestions comming, they are all welcome! :thumbup: Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.