CLAD Study Guide.doc

(1344 KB) Pobierz



CLAD Study Guide

 

 

Prepared by LabVIEW Student Ambassadors:

Julian Ferrer-Rios

Kristen Heck

Francesca Ramadori

Kelvin Tang

 

 

 

 

-23-


Table of Contents


Section 1: LabVIEW Programming Concepts              2

Section 2: LabVIEW Environment              6

Section 3: Software Constructs in LabVIEW              10

Section 4: Programming Vis and functions              17

Section 5: Data Communication and Synchronization VIs and Functions              19

Section 6: VI Server and Functions              22

Section 7: Errors handling VI’s and Functions              26

Section 8: VI Design Patterns              29

Section 9: SubVI Design              37

Section 10: Debugging VI’s              39

Section 11: VI Design and Documentation              43

Section 12: Memory, Performance, and Determinism              45


Section 1: LabVIEW Programming Concepts

 

Data Flow

 



LabVIEW follows a dataflow model for running Vis.

 

A block diagram node executes when all its inputs are available. When a node completes execution, it supplies data to its output terminals and passes the output data to the next node in the dataflow path.

 

Visual Basic, C++, JAVA, and most other text-based programming languages follow a control flow model of program execution. In control flow, the sequential order of program elements determines the execution order of a program.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Consider the block diagram above. It adds two numbers and then multiplies by 2 from the result of the addition. In this case, the block diagram executes from left to right, not because the objects are placed in that order but because one of the inputs of the Multiply function is not valid until the Add function has finished executing and passed the data to the Multiply function. Remember that a node executes only when data are available at all of its input terminals, and it supplies data to its output terminals only when it finishes execution. In the second piece of code, the Simulate Signal Express VI receives input from the controls and passes its result to the graph.

 

You may consider the add-multiply and the simulate signal code to coexist on the same block diagram in parallel. This means that they begin executing at the same time and run independently of one another. If the computer running this code had multiple processors, these two pieces of code could run independently of one another (each on its own processor) without any additional coding.

Polymorphism

 



 

 

 

 

 

 

 

 

 

 

 

A programming language feature that allows values of different data types to be handled using a uniform interface.

 

In LabVIEW: the ability of VIs and functions to automatically adapt to accept input data of different data types (i.e. Numeric Functions); Useful when performing the same operation on different data types

 

Section 1 Practice Questions

 

1.              You develop a SubVI that only outputs a value and need to use this SubVI in a (calling) VI. Which of the following is the best way to enforce dataflow to control the execution of the SubVI?

a. Use the SubVI in a Sequence structure

b. Modify the SubVI to have dummy inputs that can be used from the calling VI

c. Modify the SubVI to have Error clusters that can be used from the calling VI

d. Modify the SubVI to have a global variable and use it from the calling VI

 

2.              Which of the following does not conform to data flow programming paradigm?
 

a. Shift Registers

b. Tunnels

c. SubVIs

d. Local Variables





 

 



 

3.              In the figure below, what will Result equal when this calculation is executed?



a. 55

b. 70

c. 65

d. Indeterminate

 

4.              What is the value in XOR Result after the following code has executed?



a. 0

b. 1

c. True

d. False


5.              What determines the program order of execution of code in LabVIEW?

 

a. The time when you entered the code
b. It goes from left to right.
c. The data flow

 

 

 

 

 

 

 

 

 

 

6.              In the following VI, what will be the execution order of functions?

 

 

d.    

 

Section 1 Answers

1. C

2. D

3. B

4. B

5. C

6. C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Section 2: LabVIEW Environment

 

LabVIEW programs are called virtual instruments (Vis).

              Controls are inputs and indicators are outputs.

Each VI contains three main parts:

Front panelHow the user interacts with the VI



Block diagramThe code that controls the program



Icon/connectorThe means of connecting a VI to other Vis



              In LabVIEW, you build a user interface by using a set of tools and objects. The user interface is known as the front panel. You then add code using graphical representations of functions to control the front panel objects. The block diagram contains this code. In some ways, the block diagram resembles a flowchart.

              You interact with the front panel when the program is running. You can control the program, change inputs, and see data updated in real time. Controls are used for inputs such as adjusting a slide control to set an alarm value, turning a switch on or off, or stopping a program. Indicators are used as outputs. Thermometers, lights, and other indicators display output values from the program. These may include data, program states, and other information.

              Every front panel control or indicator has a corresponding terminal on the block diagram. When you run a VI, values from controls flow through the block diagram, where they are used in the functions on the diagram, and the results are passed into other functions or indicators through wires.

 

Controls Palette

Use the Controls palette to place controls and indicators on the front panel. The Controls palette is available only on the front panel. To view the palette, select View»Controls Palette. You also can display the Controls palette by right-clicking an open area on the front panel. Tack down the Controls palette by clicking the pushpin on the top left corner of the palette.

 

Functions Palette

Use the Functions palette to build the block diagram. The Functions palette is available only on the block diagram. To view the palette, select View»Functions Palette. You also can display the Functions palette by right-clicking an open area on the block diagram. Tack down the Functions palette by clicking the pushpin on the top left corner of the palette.

 

Tools Palette



 



 

 

You can view the Tools Palette on both the front panel and block diagram. To view the palette, select View»Tools Palette. You also can display the Tools palette by holding shift+ right-clicking an open area on the front panel or block diagram.

If you enable the automatic selection tool and you move the cursor over objects on the front panel or block diagram, LabVIEW automatically selects the corresponding tool from the Tools palette. Toggle automatic selection tool by clicking the Automatic Selection Tool button in the Tools palette.

 

Use the Operating Tool to change the values of a control or select the tex...

Zgłoś jeśli naruszono regulamin