Presentation is loading. Please wait.

Presentation is loading. Please wait.

LabVIEW Introduction Alan Jennings.

Similar presentations


Presentation on theme: "LabVIEW Introduction Alan Jennings."— Presentation transcript:

1 LabVIEW Introduction Alan Jennings

2 Programming in general
The Data: MATLAB, C, Java Variables, stack LabVIEW, Simulink, FPGA Connections (wires) 1 Output, Many inputs Excel Predefined by cells 3/28/2012 Programming comparison

3 Programming in general
The Instructions: Inputs and outputs MATLAB, C, Java, Excel function, operator, method [m,b]= linearfit(x, 3*x+4) LabVIEW, Simulink, FPGA Blocks with inputs and outputs 3/28/2012 Programming comparison

4 Programming in general
Structure: Order of execution MATLAB, C, Java, Excel Sequential: Line after line Routing commands Loops, conditional, break, goto, LabVIEW, As data is available Loops Simulink, FPGA Blocks with inputs and outputs FPGA physically simultaneous Simulink numerically simultaneous 3/28/2012 Programming comparison

5 Setting up a LabVIEW Program
Front Panel Controls: how the user controls the program Indicators: Displaying results Function Wiring for using your VI’s by other VI’s Block Diagram Data: All controls and indicators, Also constants Doing something: Add functions Control what happens: Add structure 3/28/2012 LabVIEW Components

6 Front Panel Inputs: Number, Array, Matrix File names, Categories
3/28/2012 LabVIEW Components

7 Front Panel Inputs: Binary More Numeric 3/28/2012 LabVIEW Components

8 Function Blocks Icons Blocks Default values Using Context help
Icons: little to no description Function Blocks Icons Blocks Default values Using Context help Hover over icons, blocks or wires to see what it is and the different signals Blocks expand to show all possible signals 3/28/2012 LabVIEW Components

9 Loops For Loop While Loop Sequence loops Case loops
Indexing over arrays While Loop Wait for an event to stop (such as user or trigger) Feedback block Sequence loops Specify execution order Important for local variables Case loops Conditional Execution 3/28/2012 LabVIEW Components

10 Data Types Waveforms Arrays (column) 2d Arrays
Values, to, Sample frequency Arrays (column) 2d Arrays Clusters (similar to structures) Objects (typical for controlling DAQ’s, etc) Easiest thing to do is use the port and create constant to see 3/28/2012 LabVIEW Components

11 Ex: Finding Largest Value
Generate Data Compare each value to current best 3/28/2012 Programming Examples

12 Ex: Finding Largest Value
Generate Data Use Gaussian generation block Set standard deviation and number of samples Convert data type Compare each value to current best Initialize the current largest value Use `for’ loop to index over signal Change selection based on logic test 3/28/2012 Programming Examples

13 Ex: Finding Largest Value
Generate Data Set standard deviation and number of samples Use Gaussian generation block Convert data type Compare each value to current best Initialize the current largest value Use `for’ loop to index over signal Change selection based on logic test Ex: Finding Largest Value 1 5 2 3 4 6 4 3 3/28/2012 Programming Examples

14 Ex: Finding Largest Value
Generate Data Set standard deviation and number of samples Use Gaussian generation block Convert data type Compare each value to current best Initialize the current largest value Use `for’ loop to index over signal Change selection based on logic test Ex: Finding Largest Value These are controlled by the front panel 3/28/2012 Programming Examples

15 Ex: Finding Largest Value
Generate Data Set standard deviation and number of samples Use Gaussian generation block Convert data type Compare each value to current best Initialize the current largest value Use `for’ loop to index over signal Change selection based on logic test Ex: Finding Largest Value 3/28/2012 Programming Examples

16 Ex: Finding Largest Value
Generate Data Set standard deviation and number of samples Use Gaussian generation block Convert data type Compare each value to current best Initialize the current largest value Use `for’ loop to index over signal Change selection based on logic test Ex: Finding Largest Value To pull of individual values, convert to an array Other blocks may require other formats 3/28/2012 Programming Examples

17 Ex: Finding Largest Value
Generate Data Set standard deviation and number of samples Use Gaussian generation block Convert data type Compare each value to current best Initialize the current largest value Use `for’ loop to index over signal Change selection based on logic test Ex: Finding Largest Value Pull the 0 index as the initial condition Use it to initialize feedback block 3/28/2012 Programming Examples

18 Ex: Finding Largest Value
Generate Data Set standard deviation and number of samples Use Gaussian generation block Convert data type Compare each value to current best Initialize the current largest value Use `for’ loop to index over signal Change selection based on logic test Ex: Finding Largest Value Indexed (pulls each value) Non-Indexed (returns last) Non-Indexed 3/28/2012 Programming Examples

19 Ex: Finding Largest Value
Generate Data Set standard deviation and number of samples Use Gaussian generation block Convert data type Compare each value to current best Initialize the current largest value Use `for’ loop to index over signal Change selection based on logic test Ex: Finding Largest Value Flow if current largest is largest Flow if current value is largest 3/28/2012 Programming Examples

20 Ex: Approximating Human Control
Dynamic System Generate disturbance, Or possibly tracking path Find the command as function of error and its derivative Do linear fit to find average gain values Find how well the gains describe behavior 3/28/2012 Programming Examples

21 Ex: Approximating Human Control
TankControl.vi Simple Tank Control (loss proportion to height) 3/28/2012 Programming Examples

22 Ex: Approximating Human Control
TankControl_2.vi Include maximum time Do linear estimation of control policy Use local variables 3/28/2012 Programming Examples

23 Ex: Approximating Human Control
Doesn’t Work! Zeros for linear fit first time Troubleshooting planar fit error 3/28/2012 Programming Examples

24 Ex: Approximating Human Control
TankControl_3.vi Add 2D and 3D graphs Add control for set point Add start button 3/28/2012 Programming Examples

25 I didn’t say the graphs looked good.

26 Sequence loop separates activation

27 Data Type conversions to use graphics
Need to separate the array and bundle x & y as pairs

28 Other Program Challenges
Programming Problems: Finding prime numbers Binary to dec converter tausiq.wordpress.com/2009/07/27/push-ups-with-blaze/ Rock, paper, scissor tournament Currency Converter Verifying 8 Queens 3/28/2012 Programming comparison


Download ppt "LabVIEW Introduction Alan Jennings."

Similar presentations


Ads by Google