Unit 4 Common Data Structures

Unit 4 Common Data Structures

Unit 4 – Common Data Structures

Engineering Computations with LabVIEW Assignment 4-3-1: Clusters Review


Clusters are an important data structure in LabVIEW. While they bear some similarities to arrays, there are some key differences. The goal of this assignment is for you to acquire a good understanding of the fundamental concepts associated with clusters.

Answer the following questions in the space provided. Feel free to add additional space, as needed. If the addition of screenshots would help to answer/explain, then include screenshots. Submit a copy of this file to your teacher when you have completed the assignment.

Front Panel & Block Diagram

This assignment focuses on creating and working with clusters in LabVIEW. Do not delete blocks from the VI as you go through the questions in this assignment unless explicitly told to do so. Don’t make this assignment just about answering questions. Spend enough time playing around to understand what clusters are and how they work.

Creating Clusters

  1. Create constants for the following on the block diagram with the specified labels.
  2. a scalar Boolean value labeled as Boolean
  3. a one-dimensional array of integer values labeled as IntArray
  4. a two-dimensional array of double precision values labeled DoubleArray
  1. Create a cluster containing the three constants from Question 1 by wiring the output of each constant as an input to a single Bundle block.
  2. Describe what happens when each input is wired to the Bundle block.
  1. Right-click and create an indicator for the output of the Bundle block. What does the cluster indicator contain?
  1. Now, right-click on the output of the Bundle block and create a constant. Describe the result.
  1. Right-click on the output of the Bundle block one more time and create a control. Describe the result.
  1. Place an Cluster Constant on the block diagram. Hold the control key down while dragging (left-click) the Boolean Constant into the Cluster Constant. When you release the mouse button, a copy of the Boolean Constant should be inside the Cluster Constant (while the original Boolean Constant remains unchanged). Repeat this process for the constants with the 1D array of integers and the 2D array of double precision values. (Hint: When dragging arrays around on the block diagram or front panel, it is easiest to “grab” the index display.)
  2. With Context Help on, hover over the Cluster Constant that you just created.
  3. Now, hover over the output from the Bundle block in Question 2.b and the constant and control that you created in Question 2.c and 2.d.
  4. Compare the descriptions of each of these clusters. Are they all the same? What is the description of the cluster? Be specific.
  1. On the front panel, create a string control, a numeric control, and a 1D array of Boolean controls.
  2. On the block diagram, wire the output from each of these controls to a single Bundle block. Describe what happens when you wire each input.
  1. On the block diagram, wire the output from the string control to a Bundle By Name block. Describe what happens when you wire the string control to the left hand input.
  1. Now, connect the output from the Bundle block in Part a to the top input terminal on the Bundle By Name block. Describe what happens when you make this connection.
  1. Now, pull down on the Bundle By Name block so that there are a total of three input terminals on the left. What do you see as to add more input terminals? Wire in the other controls. Change the label of the controls on the front panel. What changes about the Bundle By Name block? Left-click on the name of the controls within the Bundle By Name block. What does this allow you to do?
  1. Connect the output from the cluster created in Question 1 to each of the blocks listed below.
  2. Unbundle
  3. Describe what you see after making the connection.
  1. Try dragging down or up on the Unbundle block. Describe what happens. Why is this the case?
  1. Unbundle By Name
  2. Describe what you see after making the connection.
  1. Drag down on the Unbundle By Name block to add an additional output. Left click on the output names and set the block to output the value of the string control and the double precision array only.
  1. Use a cluster shell on the front panel to create a cluster of controls that have the same format as the cluster from Question 1 (a single Boolean control, a 1D array of integer controls, and a 2D array of double precision controls). Wire the output of the cluster of controls to the indicator created in Question 2.b. Run the VI and play around with the control values and the corresponding indicator values.
  1. Right-click on the outer edge of the cluster of controls from Question 6. Change the order of the three controls. Confirm the chance by wiring the output from the terminal to a new Unbundle block.
  1. A waveform is a cluster with a specific format. A waveform is a bundle of two elements and one array. The first element is a numeric value that represents the initial “x” value for the waveform. The second elements is a numeric value that represents the uniform spacing between x values (Δx). The third component in the cluster is a 1D or 2D array representing one or more series of y values.
  2. Create a waveform cluster using the Bundle block. Choose your own values for x, Δx, and y. Make y a 1D array with 100 elements.
  1. From the controls palette, go to the Graph subpalette and place a Waveform Graph on the front panel.
  1. Connect the waveform from Part a to the Graph block and run the VI. Describe the results.
  1. Create a second, different 1D array with 100 elements. Use the Build Array block to combine the two 1D arrays into a single 2D array.
  1. Replace the 1D array input in the waveform cluster with the 2D array. Run the VI again and describe the results.
  1. Error clusters are special clusters in LabVIEW that also contain three components – a Boolean value, and integer value, and a string. On the Array, Matrix, & Cluster palette on the front panel, there is an Error In cluster of controls and an Error Out cluster of indicators. On the Dialog & User Interface palette on the block diagram, there is an Error Constant. When you place any of these on the VI, you will notice that the color associated with the error cluster is a dark yellow. Error clusters will be covered in more detail in a future unit that includes basic error trapping and error propagation.