Planning Labview Applications
VIRTUAL INSTRUMENTATION
ALEJANDRO PINEDA
ITESM CSF
1
Lesson 15
Planning LabVIEW Applications
TOPICS
Planning and design tips for developing a LabVIEW application
How to convert your design outline into LabVIEW subVIs
Common LabVIEW programming architectures
How to use Boolean clusters as menus
2
1
Instrumentación Virtual
Planning andDesign Process
Bottom-Up
Top-Down
Define Project
Process
Customer
Feedback
Test & Release
Final Product
Design
Flowchart
Integrate SubVIs
into Project
Implement
Nodes as VIs
Test SubVIs
3
Define the Project
• Careful planning in the beginning allows for an easier
implementation process
• Be sure to clearly determine
– System requirements
– End user’s expectations– Exact specifications of the application
– What future modifications may be necessary
• Develop outline and get approval
• Design a flowchart to specify exactly how the program will
operate; flowchart nodes become subVIs
4
2
Instrumentación Virtual
Project Flowchart
5
Implementation Process
• Use subVIs for flowchart nodes
• Break application into logical tasks andbuild subVIs for each
• Why use subVIs?
–
–
–
–
–
•
•
•
•
You can find and fix design flaws early
You can perform unit testing
Simpler source code management
Size and speed benefits
Makes it easier to modify an application later
Build and test subVIs separately
Combine subVIs to finish the application
Test application thoroughly and release
Use customer feedback for futurechanges
6
3
Instrumentación Virtual
Simple VI Architecture
Functional VI that produces results when run
• No “start” or “stop” options
• Suitable for lab tests, calculations
Example: Convert C to F.vi
7
General VI Architecture
Three main steps:
(1) Startup
(2) Main application
Shutdown
(3)
8
4
Instrumentación Virtual
Parallel Loops ArchitectureAdvantages
+ Handles simultaneous
multiple independent
processes
Disadvantages
− Synchronization
− Data exchange
9
Multiple Case Structures Architecture
Advantages
+ Synchronization and data
exchange are simplified
Disadvantages
− Loop can get large and
difficult to view
− Handling one event can
block other events
− All events are handled at the
same rate
10
5Instrumentación Virtual
State Machine Architecture
States:
0: Startup
1: Idle
2: Event 1
3: Event 2
4: Shutdown
Advantages
+ Can go to any state from any other
+ Easier to modify and debug
Disadvantages
− Can lose events if two occur at same time
11
Mechanical Action of Booleans
Switch When Pressed
Switch When Released
Switch Until Released
Latch When Pressed
Latch WhenReleased
Latch Until Released
Change state on a button press. Remain there
until another button press.
Change state on a button release. Remain
there until another button release.
Change state on a button press. Change back
when the button is released.
Change state on a button press. Change back
when the control is read by LabVIEW.
Change state on a button release. Change
back when thecontrol is read by LabVIEW.
Change state on a button press. Change back
when released and read by LabVIEW.
• Switch action:
Control is toggled
until changed by
hand
• Latch action:
Control reverts to
default state when
read by diagram
12
6
Instrumentación Virtual
Using Boolean Clusters as Menus
Cluster of labeled buttons (mechanical action is latch when
released)
ClusterOrder:
(0) Configure button
(1) Test 1 button
(2) Test 2 button
You must set the cluster size
13
State Machine Programming
• Useful in programming
user interface VIs
• One case for each state
in the machine
• Relatively easy to modify
14
7
Instrumentación Virtual
State Machine Programming
Value
State
Name
Description
Next State
–1
No Event...
Regístrate para leer el documento completo.