2010 Lab View Course Students

Embed Size (px)

Citation preview

  • 8/6/2019 2010 Lab View Course Students

    1/47

    Getting started First Steps Programming Examples and Tasks

    Labview Introduction in 3 hours

    Volkmar Zabel

    Maik BrehmDaniel Arnold

    Institute of Structural Mechanics

    Bauhaus University Weimar

    Weimar, Germany

    2010

    Zabel/Brehm/Arnold 2010 1 / 47 ,

  • 8/6/2019 2010 Lab View Course Students

    2/47

    Getting started First Steps Programming Examples and Tasks

    Outline

    1 Getting started

    2 First Steps

    3 Introduction to LabVIEW Programming

    4 Examples and Tasks

    Zabel/Brehm/Arnold 2010 2 / 47 ,

  • 8/6/2019 2010 Lab View Course Students

    3/47

    Getting started First Steps Programming Examples and Tasks

    Start LabVIEWstart from terminal with:

    user@computer > /parrot/apps/natinst/LabVIEW-2009/labview

    Zabel/Brehm/Arnold 2010 3 / 47 ,

  • 8/6/2019 2010 Lab View Course Students

    4/47

    Getting started First Steps Programming Examples and Tasks

    Virtual instruments (VIs)LabVIEW programs are called virtual instruments (VIs),

    containing 2 Windows: Front Panel and Block DiagramFront Panel = Front End

    User Interface

    Controls = inputsIndicators = outputs

    Block Diagram = Back End

    Graphical code

    Data flow trough wiresfrom controls over functions toindicators

    Blocks executes by data flowZabel/Brehm/Arnold 2010 4 / 47 ,

  • 8/6/2019 2010 Lab View Course Students

    5/47

    Getting started First Steps Programming Examples and Tasks

    Controls Palette

    Controls Palette

    Use the Controls palette to place controls and indicators on the frontpanel. You can display the Controls palette by right-clicking an open areaon the front panel.

    Zabel/Brehm/Arnold 2010 5 / 47 ,

  • 8/6/2019 2010 Lab View Course Students

    6/47

    Getting started First Steps Programming Examples and Tasks

    Functions Palette

    Functions Palette

    The Functions palette is available only on the block diagram. You candisplay the Functions palette by right-clicking an open area on the blockdiagram.

    Zabel/Brehm/Arnold 2010 6 / 47 ,

    G i d Fi S P i E l d T k

  • 8/6/2019 2010 Lab View Course Students

    7/47

    Getting started First Steps Programming Examples and Tasks

    Status Toolbar

    Status Toolbar Buttons

    Run button Run the VI once.Countinuous Run button Run the VI until you abort it.

    Abort button Stop the VI immediately.

    Additional Buttons on the Diagram ToolbarExecution highlight button

    Retain wire value button

    Step function button

    Zabel/Brehm/Arnold 2010 7 / 47 ,

    G tti t t d Fi t St P i E l d T k

  • 8/6/2019 2010 Lab View Course Students

    8/47

    Getting started First Steps Programming Examples and Tasks

    Data Types

    LabVIEW uses many common data types

    Boolean, numeric, strings, clusters, . . .

    The color and symbol of each terminal indicate the data type of thecontrol or indicator. Control terminals have a thicker border than indicatorterminals. Also, arrows appear on front panel terminals to indicate whetherthe terminal is a control or an indicator. An arrow appears on the right ifthe terminal is a control and on the left if the terminal is an indicator.

    Zabel/Brehm/Arnold 2010 8 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    9/47

    Getting started First Steps Programming Examples and Tasks

    Data Flow

    LabVIEW Data Flow

    Block diagram execution

    Dependend on the flow of dataBlock diagram does NOT executefrom left to right

    Node executes when ALL input data areavailable

    Nodes supply to all output terminalswhen done

    Zabel/Brehm/Arnold 2010 9 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    10/47

    Getting started First Steps Programming Examples and Tasks

    Debugging TechniquesFinding Errors

    Click on the broken arrow button, LabVIEW will show an error list.

    Execution Highlight

    Click on Execution Highlight button;

    Data flow will be visualized with bubbles and values.

    Probe Values

    Toggle On/Off Probe values.

    Right-click on the wire of interest

    context menu

    Probe will display a probe window.Breakpoint

    Set pauses at different locations on the diagram.Click on wires or objects with the Breakpoint tool to set breakpoints.

    Zabel/Brehm/Arnold 2010 10 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    11/47

    Getting started First Steps Programming Examples and Tasks

    Help

    Show Context Help

    Displays basic information about LabVIEWobjects. Objects with context help informationinclude VIs, functions, constants, structures,palettes, properties, methods, events, anddialog box components.

    Open context help window

    Ctrl + HHelp menu Show Context Help

    Hover over nodes to update help window

    Get detailed help

    Click on Detailed help in Context Help

    Right-click on the node, then choose HelpZabel/Brehm/Arnold 2010 11 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    12/47

    Getting started First Steps Programming Examples and Tasks

    Loops

    WhileLoop

    Run at least once (Do-While-Loop)

    loop counter

    loop stop conditionLoop runs until its input is True

    ForLoop

    loop counter

    Run loop until number of iterations.

    Zabel/Brehm/Arnold 2010 12 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    13/47

    g p g g p

    Creating Loops

    PaletteChoose the Structures partfrom Functions Palette

    Drawing the loopEnclose code to be repeated.

    Drag-and-Drop Nodes into

    pre-defined structure.

    Zabel/Brehm/Arnold 2010 13 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    14/47

    g p g g p

    Sequences

    Parallel Execution

    All encapsulated codefragments areexecuted in parallel.

    Sequence Execution

    For sequentialcomutation create aSequence structure.

    Zabel/Brehm/Arnold 2010 14 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    15/47

    Have fun using LabVIEW

    Whish you a successful start using

    Zabel/Brehm/Arnold 2010 15 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    16/47

    Example 1: Generate and save signals

    Working directory:

    cd /2010 LabviewCourse/example1

    Task

    Simulation of one time signal with variable properties

    4096 Samples per second; 8192 samples per block

    Save the time history as *.lvm file

    Main VIs to use

    Block Diagram Right Click Express Input Simulate SignalBlock Diagram Right Click Express Output Write Meas.File

    Block Diagram Right Click Express Arith & Comp Comparison Comparison

    Zabel/Brehm/Arnold 2010 16 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    17/47

    Example 1: Generate and save signalsSimulate signal Configuration

    Zabel/Brehm/Arnold 2010 17 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    18/47

    Example 1: Generate and save signals

    Front Panel proposal

    Zabel/Brehm/Arnold 2010 18 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    19/47

    Example 1: Generate and save signalsBlock Diagram proposal

    Zabel/Brehm/Arnold 2010 19 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    20/47

    Example 1: Generate and save signalsHead of .lvm file

    Zabel/Brehm/Arnold 2010 20 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    21/47

    Example 2: Read and process data

    Working directory:

    cd /2010 LabviewCourse/example2

    Task

    Read and visualize a signal from an .lvm file

    Calculate the averaged Power Spectrum of the signal

    Main VIs to use

    Block Diagram Right Click Express Input Read Meas. FileBlock Diagram Right Click Express Signal Analysis Spectral

    Zabel/Brehm/Arnold 2010 21 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    22/47

    Example 2: Read and process dataRead file configuration

    Zabel/Brehm/Arnold 2010 22 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    23/47

    Example 2: Read and process dataSpectral configuration

    Zabel/Brehm/Arnold 2010 23 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    24/47

    Example 2: Read and process dataFront Panel proposal

    Zabel/Brehm/Arnold 2010 24 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    25/47

    Example 2: Read and process data

    Block Diagram proposal

    Zabel/Brehm/Arnold 2010 25 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    26/47

    Task 1: Generate and save signals

    Working directory:cd /2010 LabviewCourse/task1

    Task: Add second signal

    Based on Example 1 add a second signal with 4096 Samples persecond and 8192 samples per block

    Save both signal as *.lvm file

    Load the signals similar to Example 2 and calculate the Power

    Spectrum

    Main VIs to use

    Same as in Example 1 and Example 2

    Zabel/Brehm/Arnold 2010 26 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    27/47

    Task 1: Generate and save signals

    Front Panel proposal

    Zabel/Brehm/Arnold 2010 27 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    28/47

    Task 1: Generate and save signals

    Block Diagram proposal

    Zabel/Brehm/Arnold 2010 28 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    29/47

    Structural system

    System

    k1

    m1 k4

    k2

    k5

    k6

    m2

    m3

    k3

    Measurement ofrandom signal at DOF 1

    acceleration at all DOFs

    Zabel/Brehm/Arnold 2010 29 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    30/47

    Task 3-1: Identify natural frequencies

    Working directory:

    cd /2010 LabviewCourse/task3 1

    File information

    data is in file Measured data.lvmColumns: | time | acce dof 1 - 3 | force dof 1 - 3 |No header information; Comma delimiter

    block size for average: 8192

    Task

    Identify the natural frequencies of the structure

    Zabel/Brehm/Arnold 2010 30 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    31/47

    Task 3-1: Identify natural frequenciesRead file configuration

    Zabel/Brehm/Arnold 2010 31 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    32/47

    Task 3-1: Identify natural frequencies

    Front Panel proposal

    Zabel/Brehm/Arnold 2010 32 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    33/47

    Task 3-1: Identify natural frequencies

    Block Diagram proposal

    Zabel/Brehm/Arnold 2010 33 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    34/47

    Example 3-2: Read and visualize transfer functions

    Working directory:

    cd /2010 LabviewCourse/example3 2

    File information

    data is in file H matrix rea.lvm

    Columns: | H11 | H12 | H13 | H21 | H22 | H23 | H31 | H32 | H33 |No header information; Comma delimiter

    Additional feature

    Tab Control

    Zabel/Brehm/Arnold 2010 34 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    35/47

    Example 3-2: Read and visualize transfer functionsRead file configuration

    Zabel/Brehm/Arnold 2010 35 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    36/47

    Example 3-2: Read and visualize transfer functions

    Front Panel proposal

    Zabel/Brehm/Arnold 2010 36 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    37/47

    Example 3-2: Read and visualize transfer functions

    Block Diagram proposal

    Zabel/Brehm/Arnold 2010 37 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    38/47

    Task 3-2: Add imaginary part

    Working directory:

    cd /2010 LabviewCourse/task3 2

    File information

    data is in file H matrix ima.lvm

    Columns: | H11 | H12 | H13 | H21 | H22 | H23 | H31 | H32 | H33 |No header information; Comma delimiter

    Additional feature

    Tab Control

    Zabel/Brehm/Arnold 2010 38 / 47 ,

    Getting started First Steps Programming Examples and Tasks

  • 8/6/2019 2010 Lab View Course Students

    39/47

    Task 3-2: Add imaginary part

    Front Panel proposal

    Zabel/Brehm/Arnold 2010 39 / 47 ,

    Getting started First Steps Programming Examples and Tasks

    3 2

  • 8/6/2019 2010 Lab View Course Students

    40/47

    Task 3-2: Add imaginary part

    Block Diagram proposal

    Zabel/Brehm/Arnold 2010 40 / 47 ,

    Getting started First Steps Programming Examples and Tasks

    E l 3 3

  • 8/6/2019 2010 Lab View Course Students

    41/47

    Example 3-3:Calculate and visualize transfer functions

    Task

    Calculate the complex transfer function (Accelerance) based onmass-normalized eigenvectors [], eigenvalues

    {

    }and modal

    damping ratios {}

    Formula

    [Hxf()] =

    2 [][D()][]T (1)

    (D())ll

    =l 2

    2ll

    2l 2l2 + 4 + 4l22l

    (2)

    Zabel/Brehm/Arnold 2010 41 / 47 ,

    Getting started First Steps Programming Examples and Tasks

    E l 3 3

  • 8/6/2019 2010 Lab View Course Students

    42/47

    Example 3-3:Calculate and visualize transfer functions

    Working directory:

    cd /2010 LabviewCourse/example3 3Additional feature

    Simple mathematical matrix and scalar operations

    For-loop

    Zabel/Brehm/Arnold 2010 42 / 47 ,

    Getting started First Steps Programming Examples and Tasks

    E l 3 3

  • 8/6/2019 2010 Lab View Course Students

    43/47

    Example 3-3:Calculate and visualize transfer functions

    Front Panel proposal

    Zabel/Brehm/Arnold 2010 43 / 47 ,

    Getting started First Steps Programming Examples and Tasks

    E l 3 3

  • 8/6/2019 2010 Lab View Course Students

    44/47

    Example 3-3:Calculate and visualize transfer functions

    Block Diagram proposal

    Zabel/Brehm/Arnold 2010 44 / 47 ,

    Getting started First Steps Programming Examples and Tasks

    Task 3 3: Add imaginar part (Homework)

  • 8/6/2019 2010 Lab View Course Students

    45/47

    Task 3-3: Add imaginary part (Homework)

    Working directory:

    cd /2010 LabviewCourse/task3 3

    Task

    Add imaginary part of transfer function using Example 3-3

    Additional feature

    Use boolean switch

    Zabel/Brehm/Arnold 2010 45 / 47 ,

    Getting started First Steps Programming Examples and Tasks

    Task 3 3: Add imaginary part

  • 8/6/2019 2010 Lab View Course Students

    46/47

    Task 3-3: Add imaginary part

    Front Panel proposal

    Zabel/Brehm/Arnold 2010 46 / 47 ,

    Getting started First Steps Programming Examples and Tasks

    Task 3 3: Add imaginary part

  • 8/6/2019 2010 Lab View Course Students

    47/47

    Task 3-3: Add imaginary part

    Block Diagram proposal

    Zabel/Brehm/Arnold 2010 47 / 47 ,