Labview Lesson 5 - Clusters
Labview Lesson 5 - Clusters
Labview Lesson 5 - Clusters
Lesson Overview
What are clusters?
How to create a cluster.
How to create a constant cluster.
How to use the various cluster functions.
I. What is a cluster?
a. A cluster is similar to the structure function in C-Programming.
b. Clusters allow you to simplify your block diagram by grouping all types of data
elements into one terminal. This reduces wire clutter by bundling all the loose
wires from each component into one wire for the cluster.
c. The only restriction with clusters, which is also the case with arrays, is that
each cluster can only be either a control or indicator. No mixing of the two
types can occur.
II. Creating a Cluster.
a. For a control or indicator cluster, proceed as follows in the front panel:
1
3. The cluster order can be viewed and modified by
Right-Click on Cluster Border Reorder Controls in
Cluster (Should change the toolbar and clusters similar to
Figure 5.1.)
2
i. Insert a Cluster on the Front Panel and Resize it to fit
three different controls.
3
Figure 5.2: Indicator Cluster Order with Boolean Position Change
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 5.3.
4
Figure 5.4: Block Diagram of Simple Control and Indicator Clusters
5
i. Bundle and Bundle by Name :
1. These two functions perform the same operation; however, their
terminals on the block diagram differ. Both functions can be used
to either assemble or bundle elements into a new cluster or to
change the values in an existing cluster without having to assign
new values to all the elements.
2. The main difference between the two bundle functions is that the
Bundle function lists the elements by data type in the terminal on
the block diagram, while the Bundle by Name function lists the
elements by their name.
3. Also, the Bundle function requires that the number of inputs into
the function match the number of elements in the output cluster.
The Bundle by Name function does not have this requirement as it
references the data by name and not by element order.
6
on one end and a cold bath on the other. The thermocouples will be
placed one near the heat source, one on the cold bath end, and one
halfway between the two.
ii. This VI will show how clusters may be incorporated into a VI to solve this
problem. Additionally, the use of the different bundle and unbundle
functions will be demonstrated as well as how to incorporate a constant
cluster. Note: Actual temperature measurements will not be used;
instead, the temperatures will be simulated using a random number
generator.
iii. Begin by opening up TempForLoop.VI that we created in Lesson 4.
iv. Starting with the Block Diagram.
1. Delete the Boolean Toggle Switch Terminal and Replace it with a
Boolean True Constant.
Functions Palette Arith/Compare Boolean True
Constant Wire to Thermometer SubVI
2. Delete the terminals for the Temperature (Deg F) Chart and the
Current Temp Numerical Indicator.
3. Compact the remaining Temperature Group and Copy twice
(Select group Hold Ctrl and Drag). These will simulate the three
temperature readings since we dont have access to thermocouples
and DAQ (Data Acquisition) equipment.
4. Move the Iteration Terminal and everything attached to it to the
top of the For Loop.
5. You may need to stretch out the For Loop so that you have plenty
of room to work.
6. The Block Diagram should look similar to Figure 5.6.
7
Figure 5.6: Modified Block Diagram for TempForLoop.VI
v. Switch to the Front Panel.
1. Delete the following text: Indicate Temperature Scale, Deg
C, and Deg F
2. Insert 2 Clusters (one will be for initial values and one will be for
actual current values).
Controls Palette All-Controls Array & Cluster
Cluster
a. Name one cluster Initial Conditions and the other
Temperature Data
b. Configure the 2 Clusters as shown in Figure 5.7 (Ignore the
values).
c. Note: The Current Elapsed Time Numerical Indicator was
drug into the Temperature Data Cluster.
8
Figure 5.7: Temperature VI Cluster Configurations
3. Insert 2 Waveform Charts, which will be used to plot the
temperature data over time and allow for any overall trends to be
observed.
Controls Palette Graph Inds Waveform Chart
a. Name one graph Temperature Plot (This one will be used to
display the temperature at each location.) and the other
Temperature Changes (This one will be used to display the
change in temperature at each location.)
b. In order to display the 3 temperatures on each graph, expand
the top-right box upwards by dragging its border. This box will
serve as your Legend, so you will want to rename the plot
lines.
c. Each Waveform Chart should look similar to Figure 5.8
without the anything plotted. Plotting techniques will be
discussed in the next lesson.
9
4. Lastly, insert 3 Numerical Indicators, which will be used to display
the instantaneous change in temperature for each location. Name
the Numerical Indicators appropriately.
5. The Front Panel should now look similar to Figure 5.9 without all
the data.
10
should appear with the Names of the inputs to the Bundle by
Name function.
11
Right-Click on the For Loop Border Add Shift
Register
b. Branch a wire from the wire connecting the Bundle function to
the Temperature Plot Waveform Chart to the Right Shift
Register.
c. Create a Cluster Constant outside the For Loop next to the
Left Shift Register and wire to the Left Shift Register. This
cluster will initialize the For Loop and Shift Register every
time the VI is ran.
d. Insert 3 Numerical Constants inside the Cluster Constant
and leave at 0, since the initial temperature change is 0.
e. Insert the Subtract function, branch a wire from the wire
connected to the Right Shift Register to the Top Terminal of
the Subtract function, and then wire the Left Shift Register to
the Bottom Terminal.
f. Wire the Subtraction Output to the Temperature Changes
Waveform Chart.
g. Now to display the individual temperature changes, insert the
Unbundle function.
h. Wire the Subtraction Output to the Unbundle Input and the
Unbundle Outputs to their corresponding Numerical
Indicators. Remember, the order of the elements in the
cluster as these should correspond to the individual indicators.
5. Your Block Diagram should look similar to Figure 5.10.
6. Save VI as 3TempCluster.VI and then, initialize some values and
run.
12
Figure 5.10: Block Diagram for Temperature Cluster VI
13