LABVIEW – CLUSTER CONTROLS, INDICATORS AND CONSTANT
CLUSTER CONTROLS AND INDICATORS
A cluster can be created by placing a cluster shell on the front panel and then placing one of the front panel objects inside the cluster as shown in the below Figure. Select a cluster on the Controls>>All Controls>>Arrays & Cluster palette, place it on the front panel and drag a data object or element, which can be a numeric, Boolean, string, path, refnum, array, or cluster control or indicator, into the cluster shell. Resize the cluster shell by dragging the cursor while you place the cluster shell on the front panel. On the block diagram the cluster wire will appear as a rope. Similar to the arrays objects can be deposited inside the cluster and all of them are either controls or indicators.
One very important item to note when creating a cluster is the order of its contents. As you insert components into a cluster, they are assigned a number that corresponds to the order in which they were inserted.
- Cluster order follows the same numbering pattern as arrays. The first component is assigned as the 0 element, the second as the 1 element, and so on.
Example: Simple Control and Indicator Clusters
This example shows how to construct simple control and indicator clusters on the front panel as well as how to ensure that the cluster orders are compatible with one another
a. Creating the Control Cluster
i. Insert a Cluster on the Front Panel and Resize it to fit three different controls.
ii. Insert a Numerical Control
Controls Palette → Num Ctrls → Num Ctrl
iii. Insert a Boolean Push Switch
Controls Palette → Buttons → Push Switch
iv. Insert a String Control
Controls Palette → Text Ctrls → String Ctrl
b. Creating the Indicator Cluster
i. Insert another Cluster on the Front Panel and Resize it so that it is about twice as wide as the other.
ii. Insert a Gauge
Controls Palette → Num Inds → Gauge
iii. Insert a String Indicator
Controls Palette → Text Inds → String Ind
iv. Insert an LED
Controls Palette → LEDs → Square LED
c. Check the cluster order of the control cluster and then, verify that the cluster order of the indicator cluster is the same. The Boolean and String elements should be out of place. To reorder the elements proceed as follows:
i. Type 1 in the “Click to Set to” Text Box.
ii. Left-Click inside the black box that surrounds the Boolean LED (this should change the 2 in the black box to a 1 for the LED and the 1 to a 2 in the black box for the String). The Front Panel should look similar to Figure below, which shows the original order in the white boxes and the new order in the black boxes.
iii. Left-Click on the Confirm Button to accept the new order, which correctly pairs the data types in the two clusters.
d. The Front Panel should look similar to Figure below.
e. Switch to the Block Diagram and Wire the 2 Clusters together so that it looks similar to Figure below.
f. Left-Click on the Run Continuously Button and then, try typing inputs into the String Control, switching the Boolean Push Button, and changing the Numerical Control value to see how it affects the Indicator Cluster.
To create a cluster constant on the block diagram, first select a cluster constant on the Functions palette. Next place the cluster shell on the block diagram, and finally place a string constant, numeric constant, or cluster constant in the cluster shell. The below Figure shows a cluster constant with three numeric constants. You can use a cluster constant to store constant data or as a basis for comparison with another. If you have a cluster control or indicator on the front panel and you want to create a cluster constant containing the same elements on the block diagram, you can either drag that cluster from the front panel to the block diagram or right-click the cluster on the front panel and select Create»Constant from the shortcut menu. When you place objects in the constant shell, you define the data type of the cluster constant. You can also copy or drag an existing cluster control on the front panel to the block diagram to easily create a constant with the same element data types.