09-27-2016 07:45 AM - edited 09-27-2016 07:46 AM
Im building a front panel with 46 controls and indicators, all boolean type.
the logic is control > send serial command > receive > set indicator. i attach part of my front panel (with 2 sets of control and indicator) and my block diagram.
i need to be able to control programmatically and from the front panel the control status and the indicators, individually or all by once (e.g. to reset them at once). this should be achieved from the tab they are in, and from another one.
thought of property nodes but still i would have 46+46 of them. same for local variables.
is there i way to refer to a control/indicator by its label(string) and change its value?
would it be easier to create two boolean arrays that hold their boolean value?
please advise me about the options i have. i'm new to labview.
thanks in advance.
Solved! Go to Solution.
09-27-2016 07:54 AM
The idea of interacting with 46 Boolean Controls or Indicators is a little frightening! Can you possibly think about the design (from the standpoint of User Interaction) and make it simpler?
Multiple Boolean Indicators can often be represented by a Boolean Array. There's an issue of labelling them, but you can do that with decorations. For example, here is a TypeDef of a Cluster showing the outputs of a set of Digital I/O registers, a 16-bit register on top, and selected bits of 4 8-bit registers below. As you can see, the Cluster is made up of 5 Arrays of Boolean, sized appropriately with Cluster names and (in the case of the top one) a Decoration serving as identifiers.
Bob Schor
09-27-2016 07:58 AM
@afetsis wrote:is there i way to refer to a control/indicator by its label(string) and change its value?
Yes, there are 2 methods:
1) Use the Ctrl Val.Set method
2) Put the control references into a variant attribute lookup table (do this once at the start) or use the get/set control value by index functions
The second method I believe is more efficient, but the first method is much easier:
I would also agree that you might want to look at ways to reduce the 'duplication' in your VI. You might want to take a look at using X-Controls (custom controls you can give additional functionality to) or perhaps find a different way of displaying the data (I have used a table control with background colours to highlight error fault codes in the past).
09-27-2016 08:04 AM
unfortunately those 46 control indicator sets must be on my front panel. the user must be able to see whats on or off.
the Ctrl Val.Set method seems to be doing the job. will implement and then ill accept it as a solution just if anything else comes up.
09-27-2016 08:11 AM
How about using cluster of elements?
09-27-2016 08:43 AM
@Bob_Schor wrote:The idea of interacting with 46 Boolean Controls or Indicators is a little frightening! Can you possibly think about the design (from the standpoint of User Interaction) and make it simpler?
Multiple Boolean Indicators can often be represented by a Boolean Array. There's an issue of labelling them, but you can do that with decorations. For example, here is a TypeDef of a Cluster showing the outputs of a set of Digital I/O registers, a 16-bit register on top, and selected bits of 4 8-bit registers below. As you can see, the Cluster is made up of 5 Arrays of Boolean, sized appropriately with Cluster names and (in the case of the top one) a Decoration serving as identifiers.
Bob Schor
Sometimes I like to label the individual elements of an array explicitly for clarity's sake. In that case, I convert it into a cluster. This usually when I have word that is a bunch of flags.
09-27-2016 08:47 AM - edited 09-27-2016 09:00 AM
changed things a little bit. this seems to work. but i need to be able to control them from another tab. i need some sort of "global variable" that contains all my 46 controls and 46 indicators so i can use it wherever i want in my iv. any ideas?
just to be a little more clear.
i've got two tabs. manual and auto. in manual tab i can turn on and off my 46 controls manually. in auto tab i set a schedule for those controls to turn on and of automatically.
so. i need sth so that i can change the value of the indicators when im in auto mode and disable/gray out all my controls in manual tab.
09-27-2016 09:19 AM
Your problem is not only that you need to deal with lots of controls/indicators, but you try to program in a way as you would program in a text based language. Flat sequence structures are always a good indicator of "design went bad"... http://www.ni.com/newsletter/51735/en/
Do not use a Global variable, use a PROPER State Machine design (any subcategory might be good, depending on your taste). The idea is that, you create a type definied cluster for your lots of controls. This can be also used as the indicator (you can create multiple typdef clusters or sub-clusters too). If you use a proper State Machine, you would have a SINGLE event case where you capture any user interaction with the Typedef "super" cluster. You can have the typdef indicator outside of your Event structure, but inside the main While loop. Use a Shift REgister to maintain the typedef values over the steps of your State Machine.
In this way you can easily read out (Unbundle by name) or modify (Bundle by name) any element of your typdef cluster in any state! No need for performance killer property nodes and other tricks!
09-27-2016 11:25 AM
Will something like that help?
I do not like idea of making 42 identical bundle cases, and / or registering 42 events for the same controls
One event handles array value change. To avoid synchronizing scrolls, check where did user scroll indicator array. This gives you index of channel to work with.
To close VI, close FP - this event is monitored and discarded
09-27-2016 12:32 PM
eh. as i said im new and this is my first attempt to build something that actually works.
is there any example with clusters i could take some ideas?
thank you