01-15-2009 03:56 PM
How can a VI tell programmatically which of its input controls are wired and getting data?
For example consider the attached temperature converter. It has Celsius, Fahrenheit and Kelvin controls and also indicators. I want it to figure out which control was wired and do all the conversions based on that one. Now it also has an enum control that specifies which case, which calculation, to do for all the outputs. So, is there a way to get rid of the enum, automating it? I know, it may need cases for more or less than one control wired.
In many cases having a default in the control takes care of it easily, but not so here. Maybe the default could be -999999 and you could test for that, but that seems ugly.
01-15-2009 04:24 PM
This kind of question has come up before and I believe has been put in to the product suggestion center. As far as I know, there is no way inherent to LabVIEW to determine whether an input is wired. One possibility would be to make a polymorphic VI.
Another would be to create an impossible default value for all 3 inputs. Perhaps Nan, or -Inf, or something like that. Compare each of the inputs to the impossible value (you will have to experiment to make sure the comparison actually works). Whichever input shows that it is not the impossible value, run the appropriate case of the case structure.
01-16-2009 05:57 AM - edited 01-16-2009 05:58 AM
A leasson learned from Jim Kring regarding VIs that have extra inputs and different calling req's taught me...
To create a wrapper VI for each type of call to the VI.
Each wrapper has all of it's inputs marked as required.
The docs for the wrapper describe how the core will be used
Take this to the next level
The VI plus its wrapper become a library
The VI (tht started this discusion, think of it as the the core) gets marked as private so it is only accesable from another VI in the same library.
The Wrappers get marked as public.
Then password protect the library
Now other developers can use the library through the wrappers that you have wired up such that your core VI is always being used correctly.
Just tryin to help,
Ben
Ravens Fan,
I hope for an interesting game on Sunday where nobody gets hurt. May the best team (Steelers?) win!
01-16-2009 10:01 AM
Ben wrote:Ravens Fan,
I hope for an interesting game on Sunday where nobody gets hurt. May the best team (Steelers?) win!
Too bad I can't mark your reply as an incorrect solution. The correct answer is may the best team Ravens win.![]()
I wished they could have played this game this past Monday or Tuesday to get it over with. The result of this game will either be a huge high or depressing low. I think whichever team wins will be the odds on favorites to win the Superbowl.
I hope I can this a few times in the game. http://images.sportsline.com/u/photos/football/nfl/img9830045.jpg![]()
01-16-2009 10:28 AM
Owch!
I did tell you that I have established a new policy in my office that "All commnets regarding the performance of athletes must mention both the first AND last names." Didn't I? I just got tired of people coming in on Monday morning and hearing "Ben is an As..." etc. ![]()
Take care,
Ben