Presentation is loading. Please wait.

Presentation is loading. Please wait.

Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 10 Clusters and Matrices  Read Bishop, Sections 6.4 to 6.10.  Lab #10 and Homework #10 due next week.

Similar presentations


Presentation on theme: "Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 10 Clusters and Matrices  Read Bishop, Sections 6.4 to 6.10.  Lab #10 and Homework #10 due next week."— Presentation transcript:

1 Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 10 Clusters and Matrices  Read Bishop, Sections 6.4 to 6.10.  Lab #10 and Homework #10 due next week.  Exam #2 next week.

2 Floyd, Digital Fundamentals, 10 th ed Polymorphism  Polymorphism is a feature of functions in modern programming languages such as LabVIEW.  It lets a single function work on inputs of different dimensions and data types.  This allows one function to do the work that you’d need several different functions to do in older languages that don’t have polymorphism. (Bishop, p. 310)

3 Floyd, Digital Fundamentals, 10 th ed Polymorphism Example: Add  LabVIEW’s Add function is an example of a polymorphic function.  It can add a scalar plus a scalar, or a scalar plus an array, or an array plus an array.  In non-polymorphic languages, this would require several different functions.

4 Floyd, Digital Fundamentals, 10 th ed Clusters  Recall that an array is a variable-sized collection of elements that are all of the same data type (such as numeric, string, or Boolean).  In contrast, a cluster is a fixed-sized collection of elements of mixed data types. (Bishop, p. 313)

5 Floyd, Digital Fundamentals, 10 th ed Usefulness of Clusters  Clusters are useful when you have a related group of elements of different data types that you want to associate with each other. Example: you might group a string containing a person’s name together with an integer containing his/her age and a Boolean indicating his/her citizenship status.  Clusters often let you simplify block diagrams by reducing the number of wires on the diagram. (Bishop, p. 314)

6 Floyd, Digital Fundamentals, 10 th ed Creating a Cluster of Controls or Indicators  To create a cluster of controls or indicators: 1. Place a cluster shell on the front panel from the Controls >> Modern >> Array, Matrix & Cluster palette. 2. Place controls or indicators inside that cluster shell. (Bishop, pp. 314-315)

7 Floyd, Digital Fundamentals, 10 th ed Brown or Pink?  On the block diagram, cluster terminals and cluster wires are colored brown if all of the items in the cluster are numeric.  But the terminals and wires are colored pink if one or more of the items are non- numeric.

8 Floyd, Digital Fundamentals, 10 th ed Order within a Cluster  Individual items within a cluster are referred to by the order in which they were placed in the cluster.  The first item placed in a cluster becomes element 0, the next item placed in the cluster becomes element 1, and so on.  To change the order, right-click a cluster’s border on the front panel and select Reorder Controls in Cluster. (Bishop, p. 316)

9 Floyd, Digital Fundamentals, 10 th ed Connecting Control Cluster to Indicator Cluster  You can wire a control cluster to an indicator cluster if they contain the same number of elements and if the data types of the corresponding elements match. Example: if a control cluster’s element 0 is a string control and its element 1 is a numeric control, you could not wire it to an indicator cluster whose element 0 is a numeric indicator and whose element 1 is a string indicator. (Bishop, p. 317)

10 Floyd, Digital Fundamentals, 10 th ed Cluster Functions  LabVIEW provides several functions for working with clusters, including: Unbundle Unbundle By Name Bundle Bundle By Name  These and others are on the Functions >> Programming >> Cluster & Variant palette. (Bishop, p. 319)

11 Floyd, Digital Fundamentals, 10 th ed Unbundle and Unbundle By Name  The Unbundle and Unbundle By Name functions are used to split a cluster into its individual objects. (Bishop, p. 323)  Recommendation: Use Unbundle By Name instead of Unbundle.

12 Floyd, Digital Fundamentals, 10 th ed Bundle  One use of the Bundle function is to assemble objects into a new cluster.

13 Floyd, Digital Fundamentals, 10 th ed Bundle and Bundle By Name  Another use of the Bundle function is to change the value of elements in an existing cluster. The Bundle By Name function can also be used in this way.  Recommendation: Use Bundle By Name instead of Bundle.

14 Floyd, Digital Fundamentals, 10 th ed Cluster Example: Displaying Multiple Plots on a Chart  Many LabVIEW indicators and functions have input terminals that can accept clusters.  Example: To display more than one plot on a waveform chart, bundle the data together using the Bundle function. (We’ll discuss charts in more detail next week.) (Bishop, p. 351)

15 Floyd, Digital Fundamentals, 10 th ed Matrices  A matrix is a two-dimensional array of numbers. (And a vector is a one- dimensional array of numbers.)  The branch of math called linear algebra studies rules and techniques for manipulating matrices and vectors.  Scientists and engineers use matrices and vectors to solve many types of problems.

16 Floyd, Digital Fundamentals, 10 th ed Matrices in LabVIEW  LabVIEW has a matrix datatype that is basically a special case of the array datatype.  A matrix must be two-dimensional, and it can only hold numbers (real or complex).  LabVIEW does not have a special vector datatype: just use a 1-D array.

17 Floyd, Digital Fundamentals, 10 th ed LabVIEW Matrix Functions  LabVIEW has a large collection of powerful functions that work on matrices and vectors. See the Programming > Array > Matrix palette and the Mathematics > Linear Algebra palette.

18 Floyd, Digital Fundamentals, 10 th ed Solving Systems of Linear Equations  As a simple example, matrices can be used to solve systems of linear equations, which arise in many applications.  Applications include the circuit-analysis techniques called mesh analysis and nodal analysis that you studied in DC Circuits (EET 1150). Suppose we want to find the currents in the circuit on the next slide….

19 Principles of Electric Circuits: Conventional Current Version, 8e By Thomas L. Floyd © 2007 Pearson Education, Inc. Pearson Prentice Hall Upper Saddle River, NJ 07458 Figure 9–14

20 Floyd, Digital Fundamentals, 10 th ed Mesh Analysis  Mesh analysis (also called “loop analysis”) involves three steps: 1. Apply Kirchhoff’s Voltage Law (KVL) around each loop to set up a system of linear equations. LabVIEW can’t help with this step; you have to do it by hand. 2. Solve the system of linear equations. Doing this by hand can be tedious, but with LabVIEW it’s easy. 3. Interpret the results of Step 2.

21 Floyd, Digital Fundamentals, 10 th ed Step 1. Applying KVL

22 Floyd, Digital Fundamentals, 10 th ed Step 2. Solving the System of Equations in LabVIEW

23 Floyd, Digital Fundamentals, 10 th ed Step 3. Interpreting the Results


Download ppt "Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 10 Clusters and Matrices  Read Bishop, Sections 6.4 to 6.10.  Lab #10 and Homework #10 due next week."

Similar presentations


Ads by Google