Download presentation

Presentation is loading. Please wait.

Published byLorenzo Tolliver Modified about 1 year ago

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/2012Programming comparison2

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/2012Programming comparison3

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/2012Programming comparison4

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/2012LabVIEW Components5

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

7
Front Panel Inputs: – BinaryMore Numeric 3/28/2012LabVIEW Components7

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

9
Loops For Loop – 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/2012LabVIEW Components9

10
Data Types Waveforms – Values, t o, 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/2012LabVIEW Components10

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

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/2012Programming Examples12

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

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

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

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

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

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

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

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/2012Programming Examples20

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

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

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

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

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/2012Programming comparison28

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google