Download presentation
Presentation is loading. Please wait.
1
Monroe L. Weber-Shirk S chool of Civil and Environmental Engineering Learning LabVIEW ä Learning ä LabVIEW ä Data Acquisition ä Control ä Learning ä LabVIEW ä Data Acquisition ä Control
2
Learning ä How do you learn the best? ä What conditions make it easiest for you to learn? ä What factors make it difficult to learn? ä How do you learn the best? ä What conditions make it easiest for you to learn? ä What factors make it difficult to learn?
3
Play, Fun, Curiosity ä Children learn by exercising their curiosity and by playing ä Successful students will also think of learning as fun ä Children learn by exercising their curiosity and by playing ä Successful students will also think of learning as fun
4
What is the role of “The Educator” ä The sage on the stage (banking theory) ä Deposit the knowledge (lectures) ä Withdraw it later (exams) ä Learners are passive recipients of sage’s wisdom ä The guide by your side ä Learners are active participants ä The sage on the stage (banking theory) ä Deposit the knowledge (lectures) ä Withdraw it later (exams) ä Learners are passive recipients of sage’s wisdom ä The guide by your side ä Learners are active participants
5
Take Responsibility! ä Who takes the initiative to learn? ä Educator or student? ä It’s an attitude! ä Are the tasks set by the educator chores that you get through with as little work as possible? ä Are the tasks learning opportunities that you engage in fully because you are interested in learning? ä Allow yourself to go beyond the minimum ä Learn because YOU want to learn! ä Role of confidence ä Believe in your strengths ä Be comfortable with your weaknesses ä Use all of your resources ä Ask for help ä Who takes the initiative to learn? ä Educator or student? ä It’s an attitude! ä Are the tasks set by the educator chores that you get through with as little work as possible? ä Are the tasks learning opportunities that you engage in fully because you are interested in learning? ä Allow yourself to go beyond the minimum ä Learn because YOU want to learn! ä Role of confidence ä Believe in your strengths ä Be comfortable with your weaknesses ä Use all of your resources ä Ask for help
6
Life Long Learning ä How will you respond when your employer asks you to do something that you didn’t learn how to do at Cornell? ä Sorry, I wasn’t trained to do that. (banking theory) ä I know where some resources are that I could use to learn how to do that. ä How will you respond when your employer asks you to do something that you didn’t learn how to do at Cornell? ä Sorry, I wasn’t trained to do that. (banking theory) ä I know where some resources are that I could use to learn how to do that.
7
Why should you learn LabVIEW? ä LabVIEW is the best environment for developing computer interface with the real world ä Software development in LabVIEW is 4 to 10 times faster than in text based languages ä Graphical ä No syntax errors ä No need to memorize function calls ä Automation is everywhere: as engineers you should understand how computers make decisions ä LabVIEW is the best environment for developing computer interface with the real world ä Software development in LabVIEW is 4 to 10 times faster than in text based languages ä Graphical ä No syntax errors ä No need to memorize function calls ä Automation is everywhere: as engineers you should understand how computers make decisions
8
Learning Software ä Curiosity ä Explore the menus, toolbars, palettes ä Right click everywhere! ä Try to figure out what the different options do ä Explore the help and example files ä Play ä Give yourself permission to be “unproductive”! ä Give yourself a challenge ä If you can’t figure something out ask a friend (or a sage) ä Don’t allow yourself to get frustrated ä Curiosity ä Explore the menus, toolbars, palettes ä Right click everywhere! ä Try to figure out what the different options do ä Explore the help and example files ä Play ä Give yourself permission to be “unproductive”! ä Give yourself a challenge ä If you can’t figure something out ask a friend (or a sage) ä Don’t allow yourself to get frustrated
9
Learning LabVIEW ä Learning resources ä Help ä Example files ä Right click ä Control and Function palettes ä Don’t reinvent the wheel! ä Before writing any code ask: ä Is this code that someone else might have already written? ä Where might I find an example of this code? ä Learning resources ä Help ä Example files ä Right click ä Control and Function palettes ä Don’t reinvent the wheel! ä Before writing any code ask: ä Is this code that someone else might have already written? ä Where might I find an example of this code?
10
Programming Overview ä Virtual Instruments (VIs) ä Front panel (Graphical User Interface) ä Block diagram (code) ä SubVIs ä A Virtual Instrument that can be called by another Virtual Instrument ä Represented by an icon ä Modular code! ä Programming Structures ä Data Structures ä Virtual Instruments (VIs) ä Front panel (Graphical User Interface) ä Block diagram (code) ä SubVIs ä A Virtual Instrument that can be called by another Virtual Instrument ä Represented by an icon ä Modular code! ä Programming Structures ä Data Structures
11
Virtual Instruments ä Modular pieces of code that can easily be used wherever they are needed ä Input (______) → logic → output (_______) ä Ex. Peristaltic pump calculator ä Given tubing size and pump rpm calculate flow rate ä Or inverse problem: Given tubing size and flow rate calculate pump rpm ä Modular pieces of code that can easily be used wherever they are needed ä Input (______) → logic → output (_______) ä Ex. Peristaltic pump calculator ä Given tubing size and pump rpm calculate flow rate ä Or inverse problem: Given tubing size and flow rate calculate pump rpm control indicator
12
Programming Structures ä Loops ä For (n times) ä Execute a fixed number of times determined before the loop executes ä While (something is true) ä Executes until the exit condition is met ä Event ä Executes when a user changes something on the front panel (usually inside a _______ loop) ä Cases (more general than if-then statements) ä Select one option from a set of options ä Sequences ä Forces code to execute in a set order ä Loops ä For (n times) ä Execute a fixed number of times determined before the loop executes ä While (something is true) ä Executes until the exit condition is met ä Event ä Executes when a user changes something on the front panel (usually inside a _______ loop) ä Cases (more general than if-then statements) ä Select one option from a set of options ä Sequences ä Forces code to execute in a set order while
13
Data types: Standard Types ä Numbers ä Positive integers (U8, U16, U32) ä Integers (I8, I16, I32) ä Real numbers (SGL: 6 digit, DBL: 15 digit, EXT) ä Complex numbers ä Booleans (true or false) ä Strings (text) ä Enumerated ä Graphs ä Numbers ä Positive integers (U8, U16, U32) ä Integers (I8, I16, I32) ä Real numbers (SGL: 6 digit, DBL: 15 digit, EXT) ä Complex numbers ä Booleans (true or false) ä Strings (text) ä Enumerated ä Graphs
14
User Defined Data Types: Arrays and Clusters ä Array ä An ordered sequence of identical data types ä The number of elements can be changed while a program is running ä Cluster ä Contains a set of data types ä The number of elements is fixed while a program is running ä Array ä An ordered sequence of identical data types ä The number of elements can be changed while a program is running ä Cluster ä Contains a set of data types ä The number of elements is fixed while a program is running
15
Cluster with an array with a cluster Cluster Array Cluster Array index Note: The number of elements in the array is still variable!
16
How do you choose a data structure? ä A well defined data structure will make your programming easier ä Example: Sensor data and Control settings ä Data that is related should be kept together ä The data should be organized in a logical manner ä The data structures will likely evolve as you build your program ä User defined data structures can be saved as type definitions (makes revising the code easier) ä A well defined data structure will make your programming easier ä Example: Sensor data and Control settings ä Data that is related should be kept together ä The data should be organized in a logical manner ä The data structures will likely evolve as you build your program ä User defined data structures can be saved as type definitions (makes revising the code easier)
17
Data Flow ä Data flows in wires from one SubVI to the next ä SubVIs wait until all input wires contain the necessary data to execute ä The exact order in which SubVIs execute isn’t known ä Except when there is data dependency ä Data flows in wires from one SubVI to the next ä SubVIs wait until all input wires contain the necessary data to execute ä The exact order in which SubVIs execute isn’t known ä Except when there is data dependency
18
Student Exercises ä Water Treatment Plant Designer ä Peristaltic pump calculator ä Enumerated type, arrays, SubVIs ä Alum dose ä Case structure ä Plant control logic ä Complex data structures (clusters) ä Boolean logic ä HMI (Human – Machine Interface) ä Water Treatment Plant Designer ä Peristaltic pump calculator ä Enumerated type, arrays, SubVIs ä Alum dose ä Case structure ä Plant control logic ä Complex data structures (clusters) ä Boolean logic ä HMI (Human – Machine Interface)
19
Data acquisition using Web- based Data Server Technology ä A computer (the Data Server) in the environmental teaching lab continuously monitors 128 analog channels at 100 Hz. ä The computer “listens” for any computers (Clients) that connect to it and request data ä Four commands can be sent to the data server ä Idle ä Send data continuously ä Send single sample of requested channels (used repeatedly by WTP) ä Logoff ä In addition the Client sends the Data Server a data structure with information on which channels to send and how frequently to send the data ä A computer (the Data Server) in the environmental teaching lab continuously monitors 128 analog channels at 100 Hz. ä The computer “listens” for any computers (Clients) that connect to it and request data ä Four commands can be sent to the data server ä Idle ä Send data continuously ä Send single sample of requested channels (used repeatedly by WTP) ä Logoff ä In addition the Client sends the Data Server a data structure with information on which channels to send and how frequently to send the data
20
Data Server SubVIs ä Logon ä Read data (inside while loop) ä Logoff ä Calibrate ä Select ports ä Apply conversions from volts to physical units ä Conversion information is stored in a global variable that is also accessed by the read data subVI ä Logon ä Read data (inside while loop) ä Logoff ä Calibrate ä Select ports ä Apply conversions from volts to physical units ä Conversion information is stored in a global variable that is also accessed by the read data subVI
21
Digitization ä Analog: continuously variable ä Digital: finite number of values ä Analog to Digital converter maps voltage to numbers ä Analog: continuously variable ä Digital: finite number of values ä Analog to Digital converter maps voltage to numbers
22
Effect of Noise on Digitization
23
Techniques to reduce noise ä Increase the number of bins (buy a more expensive Analog to Digital converter) ä 12 bit (used in the lab) - _____ bins ä 16 bit - ______bins ä More precisely match the voltage range of the A/D converter to the signal voltage range (apply appropriate gain) ä Over sample and average ä Sample faster than your application requires ä Increase the number of bins (buy a more expensive Analog to Digital converter) ä 12 bit (used in the lab) - _____ bins ä 16 bit - ______bins ä More precisely match the voltage range of the A/D converter to the signal voltage range (apply appropriate gain) ä Over sample and average ä Sample faster than your application requires 4096 65536
24
Control with Stamp Microprocessor ä Three SubVIs use the Sensor data and Control settings to calculate the desired valve and pump settings ä The control settings are sent to the Stamp SubVI ä The Stamp SubVI codes the settings as a string of 2 ASCII characters (letters) and sends the string to the serial port ä The Stamp microprocessor ä Reads the codes from the serial port ä Turns the correct valves on ä Sets the pump rpm ä Three SubVIs use the Sensor data and Control settings to calculate the desired valve and pump settings ä The control settings are sent to the Stamp SubVI ä The Stamp SubVI codes the settings as a string of 2 ASCII characters (letters) and sends the string to the serial port ä The Stamp microprocessor ä Reads the codes from the serial port ä Turns the correct valves on ä Sets the pump rpm
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.