Professional Documents
Culture Documents
ni.com/training
Computer running
LabVIEW Professional
Development System 2009 and
Windows 2000/XP
ni.com/training
File Locations
The course installer places the course files in the following
location:
ni.com/training
Instructional Methods
Lecture gives a foundation
in the topic
Instructor reinforces
foundation through
demonstrations and quizzes
Use concept exercises to further explore a topic
Watch a simulation, experiment with example VIs
ni.com/training
New User
LabVIEW Core 1
Experienced User
LabVIEW Core 3
LabVIEW Core 2
Managing Software
Engineering in LabVIEW
LabVIEW OOP System
Design
Advanced Architectures
in LabVIEW
Certifications
Certified LV Associate
Developer Exam
Certified LabVIEW
Developer Exam
Certified LabVIEW
Architect Exam
ni.com/training
ni.com/training
Course Goals
This course prepares you to:
Establish a software lifecycle for future project development
Communicate with customers during project definition
Develop professional user interfaces
Develop applications that are scalable, readable, and
maintainable
Investigate and implement techniques for timing a VI
Handle errors that may occur during code execution
Document Vis effectively
ni.com/training
Lesson 1:
Successful Development Practices
(Pre-Course Work)
TOPICS
A. Scalable, Readable, and Maintainable VIs
B. Successful Development Practices
C. Course Project Overview
ni.com/training
Lesson 2:
Analyzing the Project
TOPICS
A.
B.
C.
D.
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
Abstracting Components
ni.com/training
Procedural Abstraction
Procedure
Abstracted
Implementation
Data Abstraction
Separates what data will be stored from how the data will be
stored physically
Provides a more logical view of the data
For example, group related data together as a cluster
ni.com/training
ni.com/training
Cue
Timing
Error
File
Write Color
Initialize Front
and Intensity Panel
Add Cue
Wait Time
Report
Errors
Save
Cues
Update Front
Panel
Fade Time
Handle
Errors
Read
Cues
Select Cue
Follow Time
ni.com/training
Object-Oriented Design
Procedural abstraction creates:
List of abstracted components
List of verbs associated with each component (methods)
ni.com/training
Object-Oriented design
ni.com/training
ni.com/training
Coupling
Cohesion
ni.com/training
ni.com/training
Dataflow Diagrams
Data Store Files or repositories in the system
Process Accepts incoming data, processes the
data, and generates outgoing data
External Entity Items outside the system that
the system communicates with
Data Flow Pipes that indicate the flow of data
ni.com/training
ni.com/training
Summary Quiz
1. Match each document to its purpose.
Requirements Document
Flowchart
Data Flow Diagram
ni.com/training
ni.com/training
Summary Quiz
2. Match each application design concept with its definition
Coupling
Cohesion
Abstraction
a.
b.
c.
Describes an application by
generalizing it and removing
details
Reliance of a code module on
other code modules
Focus of a code module on a
single goal
ni.com/training
b.
Cohesion
c.
Abstraction
a.
ni.com/training
Lesson 3:
Designing the User Interface
TOPICS
A.
B.
C.
D.
E.
ni.com/training
ni.com/training
Colors
Color can distract the user from important information
Use complementary colors that vary primarily in brightness
Grayscale Spectrum
Muted Color Spectrum
Highlight Color Spectrum
Transparency Box
ni.com/training
Graphics
Import bitmaps, Macintosh PICTs, Windows Enhanced
Metafiles, and text objects to use as front panel
backgrounds
Imported graphics slow down screen updates
Do not place indicators and controls on top of a graphic
object
Split large graphics into smaller ones
ni.com/training
ni.com/training
Run-Time Menus
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
Key Navigation
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
Summary - Quiz
1. Which of the following control types does not specifically
improve front panel organization?
a. Subpanel control
b. Tab control
c. Boolean button
Lesson 4:
Designing the Project
TOPICS
A. Design Patterns
B. Event-Based Design
Patterns
C. Advanced Event-Based
Design Patterns
D. Creating a Hierarchical
Architecture
A. Design Patterns
State Machine
Parallel Loops
Producer/Consumer (Data)
ni.com/training
ni.com/training
ni.com/training
Considerations
Timing the producer
Sending data from the
consumer to the producer
ni.com/training
ni.com/training
Event-Driven Programming
Events influence block diagram execution
Events are asynchronous notification that something has
occurred
Events originate from the user interface, external I/O, or
other parts of the program
Configure events by right-clicking the Event structure border
and selecting Edit Events Handled by This Case from the
shortcut menu
Event registration ensures no events are missed or
processed out of order
ni.com/training
ni.com/training
ni.com/training
Producer/Consumer (Events)
Benefits:
Efficiently responds asynchronously to the user interface
Queues can transfer any data type
ni.com/training
Producer
User
Event
Queue
Consumer
ni.com/training
User Events
Create
& Register
User Event
Generate
User Event
Unregister
User Event
Destroy
User Event
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
DISCUSSION
Design
Pattern
Guide
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
Files page
ni.com/training
Saving a Project
You must save new, unsaved files in a project before you
can save the project
When you save a project, LabVIEW does not save items
under Dependencies as part of the project file
Select FileSave Project to save a project
ni.com/training
Auto-populating folder
Adds a directory on disk to the project
LabVIEW continuously monitors and updates the folder
according to changes made in the project and on disk
ni.com/training
Project Dependencies
Select Dependencies to open the list of subVIs that VIs
under a given target require
Right-click Dependencies and select Refresh from the
shortcut menu to update the list
ni.com/training
ni.com/training
Public items are visible when users view the project library.
Other VIs and applications can call public VIs
Private items do not appear visible when users view the
project library or palettes. Other VIs and applications that the
project library does not own cannot call a private VI
ni.com/training
LabVIEW Classes
A LabVIEW class is a special type of project library where
the member VIs collectively define a new data type
Consider classes as a more
powerful cluster type
Consists of:
A data control (cluster)
Member VIs to access that data
ni.com/training
Throughout this course, you will use the LabVIEW project file that
you created in this exercise to build the TLC application
LabVIEW projects are not necessary for every application, but
they are required for any application that you want to build into an
executable
DISCUSSION
Find SubVIs
Find Callers
Find Project Items
Resolve Conflicts
ni.com/training
Find SubVIs
Finds all subVIs of a specific item in the project
ni.com/training
Find Callers
Finds all callers of a specific item in the project
ni.com/training
ni.com/training
Resolve Conflicts
Projects can contain items that conflict with other items in the
project
ni.com/training
Examples of Conflicts
Two VIs within a project have the same name
A VI in the project is calling a subVI outside the project that
has the same name as a VI in the project
ni.com/training
ni.com/training
ni.com/training
ni.com/training
Conflicts can arise from using multiple files with the same name
Always be as specific as possible when naming your files
DISCUSSION
Scalar Data
Arrays
Clusters
LabVIEW Class
ni.com/training
Scalar Data
Most basic data structure in LabVIEW
Examplesa number, a Boolean value
Use scalar data only if future modifications will not require a
more complex data structure
ni.com/training
Arrays of Data
Arrays group data elements of the same type
Use arrays when:
Data includes more than one element of the same data type
Each data element is associated with the others
ni.com/training
Clusters of Data
Data structures that contain any type of data
A cluster is very useful for storing data about objects
Use clusters when you need to group data into an individual
data type
ni.com/training
Type Definitions
For any data type that controls execution of your application,
save the data type as a type definition
Type-defined data types are more scalable
Modifications to the type definition are propagated to each
instance of that data type in your applications
LabVIEW Classes
A LabVIEW class is a more powerful cluster data type
Class file (.lvclass) stores class information
Data control definition (the data stored as part of the cluster)
List of member VIs
Properties for each member VI
Properties of the class itself (such as wire appearance)
ni.com/training
Design and create the data types that you need for this
application.
GOAL
G. Information Hiding
In this example, it is possible for any module to access the
global variable and change its value without any other module
knowing that the global variable has changed.
ni.com/training
Information Hiding
Implement information hiding by creating a VI that accesses
the global data
Read and write to the global data by calling the VI
Information hiding protects the global data
Good
Information
Hiding:
ni.com/training
ni.com/training
ni.com/training
Encapsulation
Non-Member VI Diagram
Illegal
Legal
ni.com/training
Each time this module executes, it retains data from the previous
execution
This is a clean, efficient method for passing data throughout an
application
DISCUSSION
ni.com/training
ni.com/training
ni.com/training
HOMEWORK:
Develop a strategy to handle errors in the application
GOAL
DISCUSSION
Summary Quiz
1. Which of the following describes good module hierarchy?
a.
b.
c.
d.
ni.com/training
ni.com/training
Summary Quiz
2. Which design pattern is best suited for an application that
can be described using a state transition diagram?
a.
b.
c.
d.
State machine
Master/slave
User interface event handler
Producer/consumer (data)
ni.com/training
State machine
Master/slave
User interface event handler
Producer/consumer (data)
ni.com/training
Summary Quiz
3. Which design pattern is best suited for a non-sequential
application that requires that the user interface events and
updates be separated from processor-intensive code?
a.
b.
c.
d.
ni.com/training
ni.com/training
Lesson 5:
Implementing the User Interface
TOPICS
A. Implementing User Interface-Based Data Types
B. Implementing Meaningful Icons
C. Implementing Appropriate Connector Panes
ni.com/training
ni.com/training
ni.com/training
HOMEWORK:
Implement user interface-based data types
GOAL
You will focus on this VI for most of the remaining exercises in the course
DISCUSSION
ni.com/training
HOMEWORK:
Implement a meaningful icon for the VI
GOAL
ni.com/training
ni.com/training
ni.com/training
ni.com/training
HOMEWORK:
Implement an appropriate connector pane for the TLC Main VI
GOAL
Summary Quiz
1. Which of the following array types can you create in
LabVIEW? (Multiple answers)
a.
b.
c.
d.
ni.com/training
ni.com/training
Summary Quiz
2. Which of the following methods helps create a unified
icon style among a group of VIs? (Multiple answers)
a.
b.
c.
d.
ni.com/training
ni.com/training
Summary Quiz
3. Which connector pane terminal setting should you use for
inputs that users must wire for a calling VI to run properly?
a.
b.
c.
d.
Required
Recommended
Optional
None of the above
ni.com/training
Required
Recommended
Optional
None of the above
ni.com/training
ni.com/training
Single Frame
Sequence Structure
ni.com/training
Initialization
State
ni.com/training
ni.com/training
ni.com/training
Variant Data
Use To Variant to convert
any data type in LabVIEW
to a variant
Use Variant to Data to
convert a variant into any
LabVIEW data type
Variants are not supported
on LabVIEW Real-Time
Use strings or LabVIEW
classes
ni.com/training
ni.com/training
ni.com/training
This exercise establishes the code architecture you will use for the rest of the
course project
Design patterns are only starting points for developing an architecture
Using type-defined data, events, and Case structures help make an
application more scalable
Custom menus help to remove functionality from the user interface
DISCUSSION
Refer to the LabVIEW Style Checklist topic of the LabVIEW Help for
more guidelines.
ni.com/training
ni.com/training
ni.com/training
ni.com/training
ni.com/training
Execution Timing
Design patterns where the
timing is based on the
occurrence of events do not
need execution timing
ni.com/training
ni.com/training
ni.com/training
ni.com/training
Synchronization Timeout
ni.com/training
Timed Structures
Use timed structures on the block diagram to repeat blocks
of code and to execute code in a specific order with time
bounds and delays
Two timed structures
Timed Sequence Structure
Timed Loop
ni.com/training
DISCUSSION
ni.com/training
ni.com/training
ni.com/training
A display loop further separates the user interface from the processing of commands
Producer loopmonitors user activity
Consumer loopprocesses data that the user generates
Display loophandles all updates to the user interface
DISCUSSION
ni.com/training
ni.com/training
HOMEWORK:
Develop a module that handles the errors in the application
GOAL
DISCUSSION
Summary Quiz
1. Which of the following LabVIEW data types can adapt to any
other data type? (Multiple answers)
a.
b.
c.
d.
Numeric
String
Variant
Boolean
Numeric
String
Variant
Boolean
Summary Quiz
3. You need to connect two terminals that are at opposite
ends of a block diagram that contains a large Event
structure in a While Loop. Which is the preferred wiring
technique?
a.
b.
c.
d.
ni.com/training
ni.com/training
Lesson 7:
Implementing a Test Plan
TOPICS
A.
B.
C.
D.
ni.com/training
ni.com/training
Code Reviews
During the code review, discuss quality goals and consider the
following questions:
What happens if a specific VI or function returns an error?
Are there any race conditions?
Is the block diagram implemented well?
Are the algorithms efficient in terms of speed and/or memory
usage?
Is the block diagram easy to maintain?
Does the developer adhere to established guidelines?
ni.com/training
ni.com/training
ni.com/training
Functional Tests
Determine whether a VI functions as expected
Boundary Conditions Values above or below a set
maximum
Hand Checks Pass a set of data with a known return value
ni.com/training
Boundary Conditions
Requirements state a maximum value
Sample test parameters:
maximumvalue+1
maximumvalue1
maximumvalue
ni.com/training
Hand Checking
If you know the value that a VI should return when run with a
certain set of inputs, use those values as a test
Sin(253.4569)= Difficult to know the answer
Sin(3.14159)= Answer is known and exercises the VI
the same way as 253.4569 because the values are of the
same data type
ni.com/training
Error Tests
Test the error handling codecreate test plans that force
errors
Verify that the proper errors are reported and recovered
Verify that the error handling code handles errors gracefully
ni.com/training
ni.com/training
Test the lowest-level VIs first, using driver VIs or control programs
As you proceed, replace control programs with VIs that are higher in
the hierarchy
Sandwich Testing
ni.com/training
ni.com/training
HOMEWORK:
Initialize and shutdown a set of code modules
GOAL
HOMEWORK:
Update the front panel controls
GOAL
DISCUSSION
ni.com/training
HOMEWORK:
Pass data from the user interface to the rest of the application.
Use an Event structure to create a dialog box
GOAL
ni.com/training
HOMEWORK:
Execute a state machine design pattern in a
producer/consumer (events) design pattern
GOAL
Applications often require the use of multiple design patterns to develop the overall
architecture
tlc_Play works with the timing module to calculate new intensity and color values and
works with the display loop to update the UI as it executes
DISCUSSION
ni.com/training
HOMEWORK:
Integrate an error handling module into the design pattern
GOAL
ni.com/training
Configuration Tests
Test variations in system and software configurations
Test on multiple operating systems, as stated by
requirements document
Test on different screen resolutions (minimum and
maximum) for proportionality and distortion
ni.com/training
Performance Tests
System responds to the user within the predefined limits
The software performs well with external hardware and
interfaces
Define and verify performance benchmarks for features of
the VI
Includes tests for:
Execution Time
Memory Usage
File Sizes
ni.com/training
Stress/Load Tests
Push a VI beyond the required limits in the specifications
Examples:
Large quantities of data
Extended time testing
Running a large number of applications concurrently
ni.com/training
Functionality Tests
Check functionality to the level stated in the requirements
document
Must involve the customer
ni.com/training
Reliability
Pilot testing (alpha and beta) to test system in nondevelopment environment
Alpha and beta testing are not substitutes for other forms of
testing that rigorously test each component
ni.com/training
Usability
Measures the potential of a system to accomplish the
goals of the user
A usable VI has the following characteristics:
Easy to learn
Easy to remember
Enjoyable to use
Efficient to use
Provides quick recovery
Visually pleasing
from errors
ni.com/training
Summary Quiz
1. Top-down, bottom-up, big-bang, and sandwich are all
methods of performing what kind of test?
a.
b.
c.
d.
Regression
Integration
Performance
Usability
ni.com/training
Regression
Integration
Performance
Usability
ni.com/training
Summary Quiz
2. Which type of test involves testing at each step of
integration to verify that previously tested features still
work?
a.
b.
c.
d.
Regression
Stress/load
Performance
Configuration
ni.com/training
Regression
Stress/load
Performance
Configuration
ni.com/training
Summary Quiz
3. Which of the following are foci of system testing? (Multiple
answers)
a.
b.
c.
d.
e.
Performance
Stress/load
Functionality
Code style
Usability
ni.com/training
Performance
Stress/load
Functionality
Code style
Usability
ni.com/training
Lesson 8:
Evaluating VI Performance
TOPICS
A. Identifying Performance Problems
B. Using VI Metrics to Identify VI Issues
C. Fixing Performance Problems
ni.com/training
ni.com/training
ni.com/training
ni.com/training
DISCUSSION
ni.com/training
ni.com/training
Coercion
To improve memory use:
Minimize coercion
Eliminate coercion entirely
ni.com/training
VI Execution Speed
Examine the following items to determine the causes of slow
performance:
Input/Output (I/O) (files, GPIB, data acquisition, networking)
Screen Display (large controls, overlapping controls, too many
displays)
ni.com/training
Input/Output
For examplefiles, GPIB, data acquisition, networking
Reduce the number of I/O calls you make
Structure application to transfer large amounts of data with
each call, rather than multiple I/O calls with smaller amounts
of data
ni.com/training
Screen Display
Reduce number of controls
Keep displays as simple as possible
For charts and graphs, turn off autoscaling, scale markers,
and grids
Do not overlap controls
Pass larger amounts of data to a chart at a time
Leave asynchronous display as the default setting for
controls
ni.com/training
ni.com/training
ni.com/training
ni.com/training
Summary Quiz
1. What are possible reasons for the VI Metric tool to report
a high number of structures and a high number of
diagrams? (Multiple answers)
a.
b.
c.
d.
ni.com/training
ni.com/training
Summary Quiz
2. Which of the following function(s) can slow VI execution
by causing memory reallocation?
a.
b.
c.
d.
Build Array
Initialize Array
Replace Array Subset
Transpose 2D Array
ni.com/training
Build Array
Initialize Array
Replace Array Subset
Transpose 2D Array
ni.com/training
HOMEWORK: Lesson 9:
Implementing Documentation
TOPICS
A.
B.
C.
D.
Designing Documentation
Developing User Documentation
Describing VIs, Controls, and Indicators
Creating Help Files
ni.com/training
Lesson 10:
Deploying the Application
TOPICS
A. Implementing Code for Stand-Alone Applications
B. Building a Stand-Alone Application
C. Building an Installer
ni.com/training
ni.com/training
ni.com/training
ni.com/training
Create an About dialog box that you can use in your own
applications
GOAL
DISCUSSION
ni.com/training
DISCUSSION
C. Building an Installer
Caveats and Recommendations
You must include or exclude build specifications and project
libraries as a whole to be included with the installer
Verify that the project does not include files on a network
When you add an NI product installer to the installer build,
you are adding only the components that are installed on the
computer where the build was made
Include custom error codes with the installer
ni.com/training
Summary - Quiz
1. Which of the following code changes should you consider
before building a VI into an executable? (Multiple
answers)
a.
b.
c.
d.
ni.com/training
ni.com/training
Summary - Quiz
2. Which of the following can you include when building an
installer for your executable?
a.
b.
c.
d.
ni.com/training
ni.com/training
ni.com/training
New User
Experienced User
LabVIEW Core 1
LabVIEW Core 3
LabVIEW Core 2
Managing Software
Engineering in LabVIEW
LabVIEW OOP
System Design
Advanced Architectures
in LabVIEW
Certifications
Certified LV Associate
Developer Exam
Certified LabVIEW
Developer Exam
Certified LabVIEW
Architect Exam
ni.com/training
Thank you!
ni.com/training