week 2 - labview student ambassadors_v1
TRANSCRIPT
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
1/95
TOPICS
ni.com/training
LabVIEW Core 1
1
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
2/95
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
3/95
ni.com/training
H. Dataflow
3
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
4/95
ni.com/training
Dataflow
LabVIEW follows a dataflow model for running VIs. A node executes only when data are available at all of its
required input terminals.
A node supplies data to the output terminals only when thenode finishes execution.
4
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
5/95
ni.com/training
Dataflow Quiz
Which node executes first?a) Addb) Subtract
c) Random Numberd) Dividee) Sine
5
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
6/95
ni.com/training
Dataflow Quiz Answers
No single correct answer.
Which node executes first?
a) Add Possiblyb) Subtract Definitely notc) Random Number Possiblyd) Divide Possibly
e) Sine Definitely not
6
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
7/95GOAL
Group Exercise 1-4Concept: Dataflow
Identify dataflow execution order in the following blockdiagrams.
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
8/95DISCUSSION
Group Exercise 1-4Concept: Dataflow
Which node executes first? Last?Where are the data dependencies?
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
9/95DISCUSSION
Group Exercise 1-4Concept: Dataflow
Which Express VI executes last?
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
10/95DISCUSSION
Group Exercise 1-4Concept: Dataflow
Which Express VI executes last?
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
11/95DISCUSSION
Group Exercise 1-4Concept: Dataflow
Which Tone Measurementexecutes last?
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
12/95
ni.com/training
I. Building a Simple VI
12
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
13/95
ni.com/training
Building a Simple VI
13
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
14/95
ni.com/training
Acquire Express VIs
DAQ Assistant Express VI
Instrument I/O Assistant Express VI
Simulate Signal Express VI
Read from Measurement File Express VI
14
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
15/95
ni.com/training
Analyze Express VIs
Amplitude and Level Measurements Express VI
Statistics Express VI
Spectral Measurements Express VI
Tone Measurements Express VI
Filter Express VI
15
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
16/95
ni.com/training
Present Express VIs and Indicators
Display Message Express VI
Play Waveform Express VI
Report Express VI
Write Measurement File Express VI
DIAdem Report Express VI
16
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
17/95
ni.com/training
Building and Running a VI
1. Place Express VI on the block diagram.2. Configure the dialog box that opens.3. Wire Express VIs together.4. Save and run the VI.
The Run button appears broken when the VI you
are creating or editing contains errors.
17
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
18/95
GOAL
Exercise 1-5, Part A Group ExerciseSimple Acquire, Analyze, and Present Design
Scenario: Acquire a sine waveform 0.1 seconds. Determine the average value of the waveform. Log the data. Display the data to a graph.
18
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
19/95
DISCUSSION
Exercise 1-5, Part A Group ExerciseSimple Acquire, Analyze, and Present Design
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
20/95
DISCUSSION
Exercise 1-5, Part A Group ExerciseSimple Acquire, Analyze, and Present Design
Which Express VI would you use for following tasks? Acquiring a sine wave from a data acquisition device
Determining the average value Logging data to a file Displaying data to a graph Displaying average value
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
21/95
GOAL
Exercise 1-5, Part BSimple Acquire, Analyze, and Present VI
HOMEWORK
Create a simple VI that acquires data, analyzes data, andpresents the results.
21
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
22/95
DISCUSSION
Exercise 1-5Simple Acquire, Analyze, and Present VI
How do you determine the file path of the generated text file?
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
23/95
ni.com/training
SummaryQuiz
1. Which function executes first: Add or Subtract?a) Addb) Subtractc) Unknown
2323
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
24/95
ni.com/training
SummaryQuiz Answer
1. Which function executes first: Add or Subtract?a) Addb) Subtract
c) Unknown
2424
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
25/95
ni.com/training
SummaryQuiz
2. Which function executes first:Sine or Divide?a) Sineb) Divide
c) Unknown
2525
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
26/95
ni.com/training
SummaryQuiz Answer
2. Which function executes first:Sine or Divide?a) Sineb) Divide
c) Unknown
2626
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
27/95
ni.com/training
SummaryQuiz
3. Which of the followingfunctions executes first:Random Number, Add orDivide?
a) Random Numberb) Dividec) Addd) Unknown
2727
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
28/95
ni.com/training
SummaryQuiz Answer
3. Which of the followingfunctions executes first:Random Number, Add orDivide?
a) Random Numberb) Dividec) Addd) Unknown
2828
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
29/95
ni.com/training
SummaryQuiz
4. Which of the followingfunctions executes last:Random Number, Subtract or Add?
a) Random Numberb) Subtractc) Addd) Unknown
2929
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
30/95
ni.com/training
SummaryQuiz Answer
4. Which of the followingfunctions executes last:Random Number, Subtract or Add?
a) Random Numberb) Subtractc) Addd) Unknown
3030
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
31/95
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
32/95
ni.com/training
SummaryQuiz Answer
5. What are the three parts of a VI?a) Front panelb) Block diagramc) Projectd) Icon/Connector pane
32
32
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
33/95
TOPICS
ni.com/training
Lesson 2
Troubleshooting and Debugging VIs
A. Correcting Broken VIsB. Debugging TechniquesC. Undefined or Unexpected DataD. Error Handling
33
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
34/95
ni.com/training
A. Correcting Broken VIs
34
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
35/95
ni.com/training
Correcting Broken VIs
Broken Run arrow VI cannot be compiled VI cannot be executed
35
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
36/95
ni.com/training
Common Causes of Broken VIs
Broken wires exist on the blockdiagram. You wired a Boolean control to a
String indicator.
You wired a numeric control to anumeric control.
A required block diagramterminal is unwired.
A subVI is broken.
36
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
37/95
ni.com/training
B. Debugging TechniquesExecution HighlightingSingle-SteppingProbes
Breakpoints
37
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
38/95
ni.com/training
Debugging Techniques
What to look for if a VI produces unexpected data or behavior: Are there any unwired or hidden subVIs? Is the default data correct? Does the VI pass undefined data? Are numeric representations correct? Are node executed in the correct order?
38
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
39/95
ni.com/training
Execution Highlighting
Use execution highlighting to watch the data flow throughthe block diagram.
If the VI runs more slowly than expected, confirm that youturned off execution highlighting in subVIs.
39
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
40/95
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
41/95
ni.com/training
Probes
Use the Probe tool to observe intermediate datavalues and check the error output of VIsand functions, especially those performing I/O.
Specify to retain the values in the wires so that
you can probe wires for data after execution.
41
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
42/95
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
43/95
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
44/95
ni.com/training
Undefined or Unexpected Data
Check for unexpected Inf values or NaN values in yourmathematical operations:
(Inf) Infinity Produced by dividing a number by zero.
NaN Not a number Produced by invalid operations, such as taking the square root
of a negative number.
44
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
45/95
GOAL
Exercise 2-1Concept: Debugging
HOMEWORK
Use the debugging tools built into LabVIEW.
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
46/95
DISCUSSION
Exercise 2-1Concept: Debugging
If you have a VI with a brokenRun arrow, what should youdo first?
After you fixed your brokenRun arrow, your VI results showunexpected data. What can you do next?
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
47/95
ni.com/training
D. Error Handling Automatic and Manual Error HandlingMerge Errors FunctionError Clusters
Warnings
47
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
48/95
ni.com/training
Error Handling
You cannot predict every problem a user can encounter. Without a mechanism to check for errors, you know only that
the VI does not work properly. Error handling tells you why and where errors occur.
Automatic error handling Manual error handling
Error Handling Anticipation, detection,and resolution of warnings and errors
48
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
49/95
ni.com/training
Automatic Error Handling
By default, LabVIEW automatically handles any known errorwhen a VI runs by: Suspending execution. Highlighting the subVI or function where the error occurred. Displaying theError list window.
Automatic error handling is: Acceptable for quick prototypes.
Not recommended for professional application development. Not included in LabVIEW-built executables.
49
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
50/95
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
51/95
DEMONSTRATION
Automatic vs. Manual Error Handling
Demonstrate the difference between automatic and manualerror handling.
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
52/95
ni.com/training
Disable Automatic Error Handling
Options Dialog Box Block Diagram page Uncheck
Enable automatic error handling in new VIs Enable automatic error handling dialogs
Other suggested changes Front Panel page
Set Control Style for New VIs toSilver style Block Diagram page
Uncheck Place front panel terminals as icons
ConfigureBlock Diagram Cleanup to customize your block diagram
52
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
53/95
ni.com/training
Merge Errors
Propagate errors along wires. Merge errors from different wire paths.
53
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
54/95
ni.com/training
Merge Errors Function
Merge Errors function returns the first error found. If no erroris found, it returns the first warning. The Merge Errors function does not concatenate errors.
54
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
55/95
ni.com/training
Error Clusters
Use the error cluster controls and indicators to create errorinputs and outputs in subVIs. The error in and error
out clusters include thefollowing componentsof information: Status
Code Source
55
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
56/95
ni.com/training
Errors and Warnings
Status = TRUEStatus = FALSECode = Non-zero
Error Warning
56
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
57/95
ni.com/training
Errors and Warnings Recommendations
Report errors and warnings with the Simple Error Handler VI Modify Type of Dialog to detect warnings.
Call the Simple Error Handler VI from the top-level VI. Avoid error dialogs in subVIs.
57
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
58/95
ni.com/training
SummaryQuiz
1. Which of the following will result in a broken run arrow?a) A subVI is broken.b) The diagram includes a divide by zero.
c) A required subVI input is unwired.d) A Boolean terminal is wired to a numeric indicator.
58
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
59/95
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
60/95
ni.com/training
SummaryQuiz
2. Which of the following are the components and data typesof the error cluster?a) Status: Boolean
b) Error: Stringc) Code: 32-bit integerd) Source: String
60
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
61/95
ni.com/training
SummaryQuiz Answer
2. Which of the following are the components and data typesof the error cluster?a) Status: Boolean
b) Error: Stringc) Code: 32-bit integerd) Source: String
61
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
62/95
ni.com/training
SummaryQuiz
3. All errors have negative error codes and all warnings havepositive error codes.
a) True
b) False
62
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
63/95
ni.com/training
SummaryQuiz Answer
3. All errors have negative error codes and all warnings havepositive error codes.
a) True
b) False
63
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
64/95
ni.com/training
SummaryQuiz
4. Merge Errors function concatenates error information frommultiple sources.
a) True
b) False
64
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
65/95
ni.com/training
SummaryQuiz Answer
4. Merge Errors function concatenates error information frommultiple sources.
a) True
b) False
65
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
66/95
TOPICS
ni.com/training
Lesson 3
Implementing a VI
A. Front Panel BasicsB. LabVIEW Data TypesC. Documenting Code
D. While LoopsE. For Loops
F. Timing a VIG. Data Feedback in LoopsH. Plotting Data Waveform Chart
I. Case Structures
66
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
67/95
ni.com/training
A. Front Panel Basics
67
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
68/95
ni.com/training
Front Panel Basics
Front panel controls and indicators create terminals on theblock diagram.
68
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
69/95
ni.com/training
B. LabVIEW Data TypesShortcut Menu and Properties Dialog BoxNumeric TypesBoolean Types
String TypesEnums and Other Types
69
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
70/95
ni.com/training
LabVIEW Data Types
Terminals visually communicate information about the datatype represented
70
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
71/95
ni.com/training
Shortcut Menus All LabVIEW objects have
associated shortcutmenus.
Use shortcut menu items
to change the look orbehavior of objects. To access the shortcut
menu, right-click theobject.
71
71
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
72/95
ni.com/training
Properties Dialog Box All LabVIEW objects have
properties. To access properties,
right-click the object andselect Properties .
Property options aresimilar to shortcut menuoptions.
Select multiple objects tosimultaneously configureshared properties.
72
72
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
73/95
ni.com/training
Numerics
Various data typerepresentations: Floating-point Unsigned integers Signed integers
73
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
74/95
ni.com/training
Numeric Conversion
Coercion dots indicate that LabVIEWconverted the value passed into a node toa different representation. Occurs when a node expects an input with a
different representation. LabVIEW chooses the representation that
uses more bits. Avoid coercion by programmatically
converting to a matching data type.
Coercion Dot
74
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
75/95
ni.com/training
Booleans Behavior of Boolean
controls is specified by themechanical action.
Boolean have onlyTRUE/FALSE values.
75
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
76/95
ni.com/training
Mechanical Action of Booleans
76
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
77/95
DEMONSTRATION
Mechanical Action of Booleans
Use the PropertiesOperations tab of a Boolean control tolearn about the different switch and latch actions.
S i
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
78/95
ni.com/training
Strings A string is a sequence
of ASCII characters. Strings have various
display styles. Backslash codes Password Hex
78
E
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
79/95
ni.com/training
Enums Enums give users a list of
items from which toselect.
Each item represents apair of values. String 16-bit Integer
79
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
80/95
ni.com/training
Other Data Types
Refer toLabVIEW Help
for complete list of terminal symbolsfor different types of controls and indicators. Dynamic
Stores the information generated or acquired by an Express VI. Path
Stores the location of a file or directory using the standardsyntax for the platform you are using.
Waveform Carries the data, start time, and dt of a waveform.
80
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
81/95
DEMONSTRATION
Searching Help for Data Types
Use LabVIEW Helpto learn about LabVIEW data types.
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
82/95
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
83/95
ni.com/training
Documenting Code
VI
Name Description
Front Panel
Label Names Tip Strips Descriptions Free Labels
Block Diagram
Label Names Free Labels Owned
Labels
SubVIDescriptions
83
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
84/95
ni.com/training
Creating Descriptions and Tip Strips
Use the Properties dialog box to createdocumentation foran object.
84
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
85/95
ni.com/training
Documenting Block Diagram CodeOwned labels: Explain data contents of wires
and objects. Move with object.
Have transparentbackgrounds. Select Visible ItemsLabel
from the shortcut menu tocreate.
Free labels: Describe algorithms. Have pale yellow backgrounds. Double-click in any open space
to create.
85
Exercise 3-1
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
86/95
GOAL
Exercise 3 1Temperature Warnings VI
Create and document a VI.
Exercise 3-1
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
87/95
DISCUSSION
Exercise 3 1Temperature Warnings VI
What happens if the Max. Temperature value is lower than theMin. Temperature value?
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
88/95
ni.com/training
D. While LoopsIteration and Conditional TerminalsTunnelsError Checking
88
h l
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
89/95
ni.com/training
While Loops
LabVIEW While Loop Flowchart Pseudo Code
Repeat (code);
Until Condition met;
End;
89
h l
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
90/95
ni.com/training
While LoopsIteration terminal Returns number of times loop
has executed. Is zero-indexed.
Conditional terminal Defines when the loop stops. Has two options.
Stop if True
Continue if True
Iteration Terminal Conditional Terminal
90
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
91/95
Whil L E Ch ki d E H dli
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
92/95
ni.com/training
While Loops Error Checking and Error HandlingUse an error cluster in a While Loop to stop the While Loop ifan error occurs.
92
Exercise 3-2
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
93/95
GOAL
e c se 3Auto Match VI
DEMONSTRATION
Use a While Loop and an iteration terminal and pass datathrough a tunnel.
Exercise 3-2
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
94/95
DISCUSSION
Auto Match VI
How many times is theNumber of Iterations indicatorupdated? Why?
-
8/10/2019 Week 2 - LabVIEW Student Ambassadors_v1
95/95
End of Week 2