LabVIEW for CHEM-5161 & 5181 Teaching Schedule
Resources:
A) Learn Labview - 9 modules – several videos of several minutes for each module
A2) Learn Data Acquisition – 3 modules – several videos of several minutes for each module
B) Labview Basics - 12 modules – html pages
C) Self-Paced Training - 40 modules, videos with exercises in pdf
Other LabVIEW Resources
"LabVIEW for Everyone", Wells and Travis
"LabVIEW Graphical Programming", Johnson and Jennings
"A Software Engineering Approach to LabVIEW", Conway and Watts
www.ni.com
LAVA - http://lavag.org/
ALARM - https://decibel.ni.com/content/groups/alarm
NI Alliance - http://www.ni.com/alliance/
Class 1 – Thu November 21 – David, Rainer, Jose
Introduction to LabVIEW – Overview of key elements
Required Reading before Class 1
- A) 1. LabVIEW Environment – videos 1 and 3
- A) 2. Loops and Structures – videos 1, 2, 3, and 4
- A) 3. Data Types and Structures – videos 1, 2, 3, and 4
- A) 4. Graphical Programming – video 1
- A) 5. Tools
Optional Reading
- B) 1. Environment
- B) 2. Dataflow Programming Basics
- B) 3. Common Tools
- B) 5. Data Structures
- B) 6. Execution Structures
- C) 1. VIs
- C) 3. Front Panel
- C) 4. Block Diagram
- C) 6. Dataflow
- C) 7. Programming
- C) 12. Data Types
- C) 13. More Data Types
- C) 15. While Loops
- C) 16. For Loops
- C) 18. Case Structures
- C) 20. Arrays
- C) 21. Array Functions
- C) 22. Clusters
Resources from B and C can be used for further clarification. Students can choose which format they find most useful.
Goals: (to be completed in homework before class, reviewed in class)
- Open LabVIEW, load a VI, look at the block diagram
- Run the VI
- Modify the block diagram to create an output to the screen
Topics of discussion:
- Key elements – VIs, front panel, diagram, tools, control palette, function palette
- Key concept – data flow
- Key structures – controls, indicators, terminals, wires, for loops, while loops, case structures, sequences
Class Activities:
- Review homework
- Debug homework example
- Questions
- Discussion of key elements, concept, and structures
- Check understanding of data flow, shift registers
- Homework is posted at http://tinyurl.com/hw-5181 and http://cires.colorado.edu/science/groups/volkamer/wiki/index.php/CHEM5161#Lecture_Schedule
Class 2 – December 5 – Don Jose, Ken
Debugging and Documentation – Synthetic Data Example
Required reading before Class 2
- C) 8. LabVIEW Help
- C) 9. Basic Debugging
- C) 14. Commenting Code
- C) 19. Wiring/Debugging
- C) 17. Timing Functions
- C) 23 Plotting Data
- C) 38. Variables
Homework (due before the start of class)
- Finish example program that calculates refractive index and Rayleigh scattering of a standard atmosphere.
- Sort an array of numbers using any algorithm you choose.
Optional Reading
- A) 6. Debugging and Errors – video 1
- A) 9. Example Finder – video 1
- B) 4. Debugging Tools
- B) 8. Handling Errors
- B) 9. Finding Examples
- B) 10. In-Product Help
- B) 11. Online Help
- B) 12. Additional Help
Class Goals:
- Emphasize documentation
- Learn debugging techniques
- Become aware of all the various help resources
Topics of discussion:
- Debugging techniques and tools
- Documentation options – VI description, control and indicator description, free text comments, self-documenting code
- Help tools – CTRL-H, LV Help, ni.com, Example Finder, icons
- Discuss error handling - introduce error cluster, discuss error chaining, emphasize always handling errors - show error dialog, explain that whenever there is an error into a VI, the general rule is that the VI contents don’t execute - with certain exceptions…
- Show automatic error dialog for unwired errors
- More LV elements – locals, globals
- Advanced (mention, don’t spend time on) - graphical diff, show buffers
- Introduce basic concept of PID control
Class Activities:
Homework assignment for 3rd class - 5 minutes
- Open “USB 6008 P controller w simulated data.vi”.
- Debug it so that it runs. Note that debugging does not include removing the simulated error in “Simulated AO Data.vi”.
- Add error clusters to Simulated AI Data.vi.
- Add error chaining between Simulated AI Data.vi and Simulated AO Data.vi.
- Add logic so that the loop stops if there is an error.
- Document the code according to best practices
- consider icons, VI descriptions, labels and explanatory text, control and indicator descriptions, etc.
- Add a plot of the input and the output channels over time
- The Simulated AI Data.vi contains a timing function that causes the VI to run at approximately 10 Hz.
- Add diagnostic code that measures the time each loop cycle takes, and display that loop time in a graph or chart.
- Add some sort of timing function to the main loop of the main VI that causes the loop to run at 1 Hz. (The timing in the Simulated AI Data.vi can be left as is.)
Class 3 – December 10 – David, Don
Data Acquisition – Don's example with hardware
Required reading before Class 3
- A2) 2. Acquire and Generate Data – videos 1 and 2
- Taking a Measurement
- Generating a Signal
- C) 25. File IO
- C) 26. Low Level File IO
- C) 30. Instrument Control – read and be aware, but do not need to complete exercise
Homework (due before the start of class)
- see above
Optional Reading
- C) 27. DAQ
- C) 28. DAQ Programming
Class Goals:
- Interface to the real world – acquire data!
- Connect and configure USB-6008
- Read from USB-6008
- Create output from USB-6008
- Add feedback loop to drive LED from measurement
Topics of discussion:
- Why use LabVIEW – real world signals, acquisition and generation
- The efficiency of LabVIEW
- DAQ in LabVIEW
Class Activities:
- Review homework
- Questions
- Introduce Don's Measurement/Input VI with hardware
- Introduce Don's Generation/Output VI with hardware
- Introduce Don's Main VI with hardware
Class 4 – December12 – David, Rainer
Review Don's program and Advanced Topics
Required reading before Class 4
- C) 10. Undefined Data/Errors
- C) 31. Modularity
- C) 32. Icon/Connector Pane
- C) 33 Sub-VIs
- C) 34 Sequential Programming
- C) 35 State Programming
- C) 36 State Machines
- C) 37 Parallelism
- C) 39 Functional Global Variables
- C) 40 Race Conditions
Homework due at start of class
- revise the homework VI you did for Class 3, replacing simulated data in and out with real data in and out
- add file writing to log set point, error, and output
- be sure to write channel names as a column headers at the beginning of the file
Class Goals:
- Finish data acquisition example
- Lay groundwork for future success in LabVIEW
Topics of discussion:
Best Practices in LabVIEW
- size of front panel and diagram, use of sub-VIs
- front panel design
- avoid spaghetti code
- documentation!
- error handling
- globals, locals, and sequence structures are “evil”
- inherent parallelism
- race conditions
- LV is great for quick prototyping
- plan for maintainability, extensibility
Advanced Topics – Things to Think about Going Forward
- event structures
- feedback node
- projects
- type definitions
- state machine
- functional globals
- performance measuring - profiler, timing functions, buffer allocation
Class Activities:
- Review and debug homework
- Questions
- Discussion of Best Practices
- Discussion of Advanced Topics