11
Föreläsning i kursen Experimentell Fysik B (TIF080B) för F2 22 januari 2014: LabVIEW. Föreläsare: Johan Hillergren, National Instruments Lars Hellberg, Tillämpad fysik Fysik, Chalmers (Kursdelsansvarig) 13.15-13.25 Introduktion (L.H.) 13.25-13.40 Introduktion Datoriserad datainsamling och mätteknik. (J.H.) 13.40-14.00 LabVIEW-introduktion. (Programmiljö, "Högerknappen") (J.H.) 14.00-14.10 Rast 14.15-14.35 LabVIEW-introduktion fortsätter. (J.H.) 14.35-15.00 Strukturer(Indexing). (J.H.) Diagram (Attribute node, Lokala variabler). (J.H.) Filhantering. (J.H.) 15.00-15.30 Fikarast (National Instruments bjuder på fika) 15.20-16.05 LabVIEW + GPIB: Allmän introduktion. (J.H.) Teknikintroduktion. (J.H.) Demonstration: Musik(?) med funktionsgenerator. (L.H.) 16.05-16.15 Rast 16.15-17.00 Felsökning. (J.H.) Framtidsperspektiv. (J.H.) Kursinformation. (L.H.) Frågestund. (J.H., L.H.) Introduction to NI LabVIEW Jonas Mäki, FSE National Instruments 3 ni.com Our Mission We equip engineers and scientists with tools that accelerate productivity, innovation, and discovery. 4 ni.com Who Chooses NI’s Virtual Instrumentation Platform Eighty-five percent of Fortune 500 manufacturing companies have adopted NI virtual instrumentation. 5 ni.com Alkoholbom för yrkesförare Stena Lines, Göteborgshamnen https://www.gp.se/ekonomi/1.1944253- alkobom-for-yrkesforare 6 ni.com Deploying a Ground Fault Detection System in an Electricity Distribution Network The Challenge: Deploying an embedded ground fault detection system inside a transformation station in the 12 kV distribution grid to continuously monitor, trigger and log sub-ms transient signals and then send the data over the 3G wireless network. The Solution: Using NI CompactRIO and NI LabVIEW to develop a system that separates less critical information, such as disturbance recordings, from control and protection. "E.ON has the ambition to be the best grid operator in Sweden, therefore we are using this new technology, which helps us to run our grid more efficiently. We find the disturbance recorder very useful, and plan to install more in our distribution network." - Tomas Johannesson, E.ON Elnät Sverige AB !"#$ #&’() *+ +,-.*/ 7 ni.com Using CompactRIO for Control and Measurement in Marine Substation at the Lysekil Wave Power Research Site – Uppsala Universitet 8 ni.com Automatic Calibration of an Internal Combustion Engine Using LabVIEW and CompactRIO "The tight integration between the Alma Automotive test environment, based on NI CompactRIO and NI LabVIEW, and the ESTECO optimization framework, helped us quickly create a demonstrator to automatically tune two ECU subsystems.“ - E. Corti, ALMA AUTOMOTIVE The Challenge: Implementing an automatic calibration system for an engine control unit (ECU) on a test bench that focuses on fuel-film dynamics in a port fuel injection (PFI) internal combustion engine. The Solution: Using NI LabVIEW and NI CompactRIO for flexible, real- time engine parameter calibration. 9 ni.com CERN Uses NI LabVIEW Software and PXI Hardware to Control World’s Largest Particle Accelerator Challenge: Measuring and controlling, in real time, the position of bulk components to absorb energetic particles out of the nominal beam core with high reliability and accuracy at the world’s most powerful particle accelerator, the Large Hadron Collider (LHC). Solution: Using LabVIEW, the LabVIEW Real-Time Module, the LabVIEW FPGA Module, and NI SoftMotion software with NI R Series reconfigurable I/ O hardware for PXI to develop an FPGA-based motion control system capable of intercepting misguided or unstable particle beams. !"# %#&#’(#) (*# +,-./0" ,1) 23/ %4&5(641 748 (*# )#9&4:;#1( 9&,(748; )5# (4 (*# %;,&& %6<#= 85>>#)1#%%= ,1) ’4%( %,?61>% 4?#8 (*# (8,)6(641,& .@0 ,1) 984>8,;;,-&# &4>6’ ’41(84&&#8A-,%#) ;4)#&B C D E4-#8(4 +4%6(4= F0EG !"#$ #&’() *+ +,-.*/

Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

Embed Size (px)

Citation preview

Page 1: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

ni.com

Föreläsning i kursen Experimentell Fysik B (TIF080B) för F2 !

22 januari 2014: LabVIEW. !

Föreläsare: !Johan Hillergren, National Instruments!

! ! Lars Hellberg, Tillämpad fysik Fysik, Chalmers (Kursdelsansvarig)!

13.15-13.25 !Introduktion (L.H.)!

13.25-13.40 !Introduktion Datoriserad datainsamling och mätteknik. (J.H.)!

13.40-14.00 !LabVIEW-introduktion. (Programmiljö, "Högerknappen") (J.H.)!14.00-14.10 !Rast !

14.15-14.35 !LabVIEW-introduktion fortsätter. (J.H.)!14.35-15.00 !Strukturer(Indexing). (J.H.)!

! !Diagram (Attribute node, Lokala variabler). (J.H.)"

! !Filhantering. (J.H.)!15.00-15.30 !Fikarast (National Instruments bjuder på fika)!

15.20-16.05 !LabVIEW + GPIB:!! !Allmän introduktion. (J.H.)!

! !Teknikintroduktion. (J.H.)!

! !Demonstration: Musik(?) med funktionsgenerator. (L.H.)!16.05-16.15 !Rast!

16.15-17.00 !Felsökning. (J.H.)!! !Framtidsperspektiv. (J.H.)!

! !Kursinformation. (L.H.)!

! !Frågestund. (J.H., L.H.)!

Introduction to NI LabVIEW

Jonas Mäki, FSE National Instruments

3 ni.com

Our Mission

We equip engineers and scientists with tools that accelerate

productivity, innovation, and discovery.

4 ni.com

Who Chooses NI’s Virtual Instrumentation Platform

Eighty-five percent of Fortune 500 manufacturing

companies have adopted NI virtual instrumentation.

5 ni.com

Alkoholbom för yrkesförare

Stena Lines, Göteborgshamnen

https://www.gp.se/ekonomi/1.1944253-

alkobom-for-yrkesforare

6 ni.com

Deploying a Ground Fault Detection System

in an Electricity Distribution Network

•! The Challenge: Deploying an embedded ground

fault detection system inside a transformation

station in the 12 kV distribution grid to continuously monitor, trigger and log sub-ms transient signals

and then send the data over the 3G wireless

network.

•! The Solution: Using NI CompactRIO and NI

LabVIEW to develop a system that separates less critical information, such as disturbance recordings,

from control and protection.

"E.ON has the ambition to be the best grid operator in Sweden, therefore we are using this new

technology, which helps us to run our grid more efficiently. We find the disturbance recorder very useful,

and plan to install more in our distribution network." - Tomas Johannesson, E.ON Elnät Sverige AB

!"#$%#&'()%*+%+,-.*/%

7 ni.com

Using CompactRIO for Control and

Measurement in Marine Substation at the Lysekil

Wave Power Research Site – Uppsala Universitet

8 ni.com

Automatic Calibration of an Internal Combustion

Engine Using LabVIEW and CompactRIO

"The tight integration between the Alma Automotive test environment, based on NI CompactRIO and NI

LabVIEW, and the ESTECO optimization framework, helped us quickly create a demonstrator to

automatically tune two ECU subsystems.“ - E. Corti, ALMA AUTOMOTIVE

•! The Challenge: Implementing an

automatic calibration system for an

engine control unit (ECU) on a test bench that focuses on fuel-film

dynamics in a port fuel injection (PFI)

internal combustion engine.

•! The Solution: Using NI LabVIEW

and NI CompactRIO for flexible, real-time engine parameter calibration.

9 ni.com

CERN Uses NI LabVIEW Software and PXI Hardware to Control

World’s Largest Particle Accelerator

•! Challenge: Measuring and controlling, in real time, the position of bulk components to absorb energetic particles out of the nominal beam core with high

reliability and accuracy at the world’s most powerful particle accelerator, the Large Hadron Collider (LHC).

•! Solution: Using LabVIEW, the LabVIEW Real-Time Module, the LabVIEW FPGA Module, and NI

SoftMotion software with NI R Series reconfigurable I/O hardware for PXI to develop an FPGA-based motion control system capable of intercepting misguided or unstable particle beams.

!"#$%#&#'(#)$(*#$+,-./0"$,1)$23/$%4&5(641$748$(*#$)#9&4:;#1($9&,(748;$)5#$(4$(*#$%;,&&$%6<#=$

85>>#)1#%%=$,1)$'4%($%,?61>%$4?#8$(*#$(8,)6(641,&$.@0$,1)$984>8,;;,-&#$&4>6'$'41(84&&#8A-,%#)$

;4)#&B$C$$D$E4-#8(4$+4%6(4=$F0EG$$

!"#$%#&'()%*+%+,-.*/%

Page 2: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

10 ni.com

Mål med kursen

•! Bli bekant med LabVIEW utvecklingsmiljön

•! Använda LabVIEW för att lösa ett applikationsproblem

•! Grundlig kunskap i strukturer i LabVIEW

•! Utföra kommunikation med instrument och hårdvara från

LabVIEW

11 ni.com

The Origin of Automated Measurements

•! Traditional pen-and-paper approach

•! Redundant circuitry between instruments (e.g., displays)

•! Manual data recording and analysis

•! Error-prone processes

•! Difficult to reproduce or redo

12 ni.com

The Foundation of LabVIEW: Virtual Instrumentation Automation through software led to a realization about fixed-functionality instrumentation…

Redundancy: Displays

Instrument vendors provide a limited-

quality display per instrument, even though

monitor technology is far more advanced.

Redundancy: Processors

Chip manufacturers rapidly enhance

processors according to Moore’s law, but

instruments have fixed processing power.

Redundancy: Memory

PCs can quickly capitalize on a

performance boost from a memory upgrade

from readily available RAM.

Redundancy: Storage

Each instrument duplicates onboard

storage even though PC hard drives are

plentiful and cost-effective.

Redundancy: Power Supplies

Each separate instrument requires its own

power supply to run measurement circuitry

that captures the real-world signal.

13 ni.com

The Foundation of LabVIEW: Virtual Instrumentation By leveraging COTS PC components, the software becomes the instrument

LabVIEW unlocks the power of instrument and data acquisition hardware

by capitalizing on the PC industry and abstracting redundant circuitry.

14 ni.com

Industries and Applications

Hardware and I/O Devices

PXI and Modular Instruments

Desktops and PC-Based DAQ

NI CompactRIO

Test Monitor Embedded Control Cyber Physical

Open Connectivity With Third-Party I/O

POWERED BY

National Instruments’ Strategy: Graphical System Design

ni.com

Introduction to LabVIEW

System Design Software for Any Measurement Application

16 ni.com

Because It Has Been Proven Over Nearly 30

Years… Withstanding the test of time across operating systems, buses, technologies, and more

17 ni.com

…LabVIEW Is the Standard for Making Measurements

0% 5% 10% 15% 20% 25% 30% 35% 40%

NI LabVIEW

Microsoft Visual C/C++

Microsoft Visual Basic

Microsoft Visual Basic 6.0

NI - LabWindows™/CVI

Microsoft C#

The MathWorks, Inc. - MATLAB®

NI Measurement Studio

Agilent VEE

NI TestStand

Agilent IO Libraries Suite

Python

GeoTest ATEasy

Other

Don't use

Software Used for Data Acquisition and Instrument Control

18 ni.com

LabVIEW Front Panels in Action

All of the front panels above were contributed for sharing and reuse by members of the

global LabVIEW community.

Dozens of LabVIEW front panels at SpaceX Mission Control during successful launch of Dragon

Photo Credit: Elon Musk

Page 3: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

19 ni.com

Therefore, LabVIEW Building Blocks Are Called

Virtual Instruments (*.VI)

LabVIEW Front Panel

The user interface of a VI

LabVIEW Block Diagram

The source code of a VI

Note: A *.vi file encapsulates

all three elements 20 ni.com

Project Explorer

•! Find, access, and organize

project files

•! Prevent, detect, and resolve

incorrect links

•! Deploy or download files to

targets

•! Manage code for build options

o! Executables, installers,

and zip files

•! Integrate with source code

control providers

21 ni.com

With LabVIEW, You Can Program the Way You Think

22 ni.com

With LabVIEW, You Can Program the Way You Think

The graphical, dataflow-based G programming language

is ideal for programming parallel data acquisition hardware.

23 ni.com

What Is Data Flow?

•! Each block diagram node executes only when it receives all inputs

•! Each node produces output data after execution

•! Data flows along a path defined by wires

•! The movement of data determines execution order

Formula: Result = (A+B*C) / (D-E)

24 ni.com

What Is Data Flow?

•! Each block diagram node executes only when it receives all inputs

•! Each node produces output data after execution

•! Data flows along a path defined by wires

•! The movement of data determines execution order

The [Multiply] and [Subtract] operations can execute at the same time since they

don’t have any data dependencies.

25 ni.com

Dataflow Languages Naturally Express Parallelism The LabVIEW compiler will automatically multithread code expressed in parallel

Data Parallelism

Task Parallelism

26 ni.com

Execution Control Structures: Loops

Count Terminal The code contained within this For

Loop will execute N times.

Conditional Terminal The code within this While Loop will run until a True value is evaluated.

Loop Iteration Terminals This provides the current loop

iteration count, which ranges from

0 to N-1.

For Loop

While Loop

27 ni.com

Event and Case Structures

Event Selector Label This indicates which subdiagram is

visible and details the event that the

code within the diagram handles.

Selector Terminal The value wired to this terminal

determines which of the subdiagrams,

or cases, will execute.

Event Structure

Case Structure Case Selector Label

This indicates which subdiagram is visible.

Page 4: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

28 ni.com

Exploring a LabVIEW Block Diagram

While Loops Iterate continuously until a true value is passed to the stop terminal

Case Structure Executes different subdiagrams based on the value of its selector terminal

Event Structure Executes different subdiagrams based on events and interrupts

29 ni.com

Exploring a LabVIEW Block Diagram

Input Terminal Input terminals are connected to front panel controls and receive input data

from the user interface.

You can tell whether a terminal is a control or indicator

by examining the direction it faces.

Output Terminals Output terminals are connected to front panel indicators and display

data as output to the user interface.

30 ni.com

Exploring a LabVIEW Block Diagram

Constants These constant values are hard-coded on the block diagram and can only be

modified at edit-time.

The color of the constant indicates the

type of data represented.

31 ni.com

Exploring a LabVIEW Block Diagram

Wires Data flows on wires between nodes on the block diagram.

The color of the wire indicates its data type, which is strictly enforced at edit-time. 32 ni.com

The Color, Style, and Thickness of Common Wires

Wire Type Scalar 1D Array 2D Array Color

Floating Point Orange

Integer Blue

Boolean Green

String Pink

Error Yellow

33 ni.com

Front Panel

34 ni.com

Front Panel Object Styles

35 ni.com

Block Diagram

36 ni.com

Block Diagram

•! Block diagram items:

•! Terminals

•! Constants

•! Nodes

o! Functions

o! SubVIs

o! Structures

•! Wires

•! Free labels

Page 5: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

37 ni.com

Terminals

Same label name

38 ni.com

View Terminals as Icons

•!By default, View as Icon

option enabled.

•!Deselect View as Icon for a

more compact view.

39 ni.com

Nodes

Nodes are objects on the block diagram that have inputs and/or outputs

and perform operations when a VI runs.

Nodes

40 ni.com

LabVIEW Help

•! Contains detailed descriptions and instructions for most palettes,

menus, tools, VIs, and functions.

40

•! Can be accessed by:

!!Selecting Help» LabVIEW Help from the menu.

!!Clicking the Detailed help link in the Context Help window.

!!Right-clicking an object and selecting Help from the shortcut menu.

41 ni.com

SubVI Nodes

•! SubVIs :

o! Are VIs that you use on the block diagram of another VI.

o! Have front panels and block diagrams.

o! Use the icon from the upper-right corner of the front panel as the

icon that appears when you place the subVI on a block diagram.

•! When you double-click a subVI, the front panel and block

diagram open.

•! Any VI has the potential to be used as a subVI.

42 ni.com

Context Help

•! Displays basic information about wires and nodes when you move the cursor over an object.

•! Can be shown or hidden in the following ways.

o!Select Help»Show Context Help from the LabVIEW menu.

o!Press <Ctrl-H>.

o!Click the following button on the toolbar:

42

43 ni.com

Examples

•! LabVIEW

includes hundreds of

example VIs.

•!Use NI Example

Finder to browse and search

installed

examples.

o!Select

Help»Find

Examples in

the menu. 43

•!Click the example buttons in LabVIEW Help

topics.

44 ni.com

Controls Palette

•!Contains the

controls and indicators you use to

create the front panel.

•!Navigate the subpalettes or use

the Search button to

search the Controls palette.

45 ni.com

Functions Palette

•!Contains the VIs,

functions, and constants you use to

create the block diagram.

•!Navigate the subpalettes or use the

Search button to

search the Functions palette.

Page 6: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

46 ni.com

Searching with Quick Drop

•! Lets you quickly find

controls, functions, VIs, and other items

by name.

•!Press the <Ctrl-

Space> keys to display the Quick

Drop dialog box.

47 ni.com

Selecting a Tool

•! A tool is a special operating mode of the

mouse cursor.

•! Create, modify, and debug VIs using

the tools provided by LabVIEW.

•! By default, LabVIEW automatically

selects tools based on the context of

the cursor.

•! If you need more control, use the Tools palette to select a specific tool.

o!Select View»Tools Palette to

open the Tools palette.

47 48 ni.com

Correcting Broken VIs

Broken Run arrow ! VI cannot be compiled ! VI cannot be executed

49 ni.com

Single-Stepping

•! Single-step through the VI to view each action of the VI on the

block diagram.

•! Suspend the execution of a subVI to edit values of controls and

indicators, to control the number of times it runs, or to go back to

the beginning of the execution of the subVI.

o! Open subVI and select Operate»Suspend When Called from the

shortcut menu.

49 50 ni.com

Execution Highlighting

•! Use execution highlighting to watch the data flow through the

block diagram.

•! If the VI runs more slowly than expected, confirm that you turned

off execution highlighting in subVIs.

50 51 ni.com

While Loops

LabVIEW While Loop Flowchart Pseudo Code

Repeat (code);

Until Condition met;

End;

52 ni.com

For Loop/While Loop Comparison

For Loop

•! Executes a set number of

times unless a conditional

terminal is added.

•! Can execute zero times.

•! Tunnels automatically

output an array of data.

While Loop

•! Stops executing only if the

value at the conditional

terminal meets the

condition.

•! Must execute at least once.

•! Tunnels automatically

output the last value.

53 ni.com

Wait Functions

A wait function inside a loop:

•! Allows the VI to sleep for a set amount of time.

•! Allows the processor to address other tasks during the wait time.

•! Uses the operating system millisecond clock.

54 ni.com

Block Diagram 1st run 2nd run

Initialized

Shift

Register Output = 5 Output = 5

Not

Initialized

Shift Register

Output = 4 Output = 8

Initializing Shift Registers

VI finishes Run again Run once

Page 7: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

55 ni.com

Case Structures

Case Selector Label

Selector Terminal

•!Case Selector Label

o!Contains the name of the current case.

o!Has decrement and

increment arrows.

•!Selector Terminal

o!Lets you wire an input value, or selector, to

determine which case

executes.

56 ni.com

Understanding Modularity – SubVIs

Repeated code can become subVIs.

57 ni.com

Understanding Modularity – SubVIs

58 ni.com

Understanding Modularity – SubVIs

Function Code Calling Program Code

function average (in1, in2,

out)

{

out = (in1 + in2)/2.0;

}

main

{

average (point1, point2,

pointavg)

}

SubVI Block Diagram Calling VI Block Diagram

59 ni.com

Creating Icons - Icon Editor

Open the Icon Editor using one of these methods:

o! Right-click the icon in the upper-right corner of the front panel or

block diagram and select Edit Icon.

o! Double-click the icon.

60 ni.com

What are Resources?

•! LabVIEW includes VIs and functions to allow you to

access your resources.

•! Resources are known to the system by a path, name,

port, or other identifier.

Resources – An addressable file, hardware device, object, or network connection available on your system

61 ni.com

Accessing Resources in LabVIEW

A typical resource operation involves the following process:

Open,

Initialize or Create

Read

and/or Write

Close Check for

Errors

•! Specify the path or device name.

•! LabVIEW creates a refnum as a unique identifier to the resource.

•! A refnum is a temporary pointer to the resource.

•! The refnum becomes obsolete.

62 ni.com

Accessing Resources in LabVIEW

•! Sample refnum wires:

63 ni.com

File I/O

•! Understanding File I/O

•! File Formats

•! High-Level File I/O VIs

•! Low-Level File I/O VIs

Page 8: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

64 ni.com

Understanding File I/O

•! File I/O writes to or reads from a file.

•! A typical file I/O operation involves the following process:

Open/

Create/ Replace File

Read

and/or Write to File

Close

File

Check for

Errors

65 ni.com

Understanding Low-Level File I/O VIs

66 ni.com

GPIB – General Purpose Interface Bus

GPIB is a standard

interface for

communication between a controller

and instruments from

various vendors.

67 ni.com

Instrument Control Programming

Virtual Instrument Software Architecture (VISA):

o! Is a high-level API that calls low-level drivers.

o! Can control instruments over GPIB, USB, Ethernet, serial, and other

interfaces as it makes the appropriate driver calls depending on the type of instrument used.

68 ni.com

VISA

VISA

Virtual Instrument System Architecture

Serial GPIB Ethernet USB

69 ni.com

VISA Write and Read Example

70 ni.com

Demo av Lars Hellberg

Musik(?)

71 ni.com

B. GPIB Communication

GPIB Instruments

GPIB Cable

GPIB Interface

72 ni.com

Standards Introduction

1965

1987

1990

1992

1993

1975

HP designs HP-IB (Hewlett Packard Interface Bus)

HP-IB becomes IEEE 488

IEEE 488.2 adopted IEEE 488 becomes IEEE 488.1

SCPI (Standard Commands for Programmable Instruments) added to IEEE 488.2

IEEE 488.2 revised

HS488 proposed

1999 HS488 approved

Page 9: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

73 ni.com

GPIB Hardware Specifications

•!Max cable length between devices = 4 m (2 m average)

•!Max cable length = 20 m

•!Max number of devices = 15 (2/3 powered on)

1

12

13

24

DIO5

DIO6

DIO7

DIO8

REN

GND (TW PAIR W/DAV) GND (TW PAIR W/NRFD) GND (TW PAIR W/NDAC) GND (TW PAIR W/IFC) GND (TW PAIR W/SRQ) GND (TW PAIR W/ATN)

SIGNAL GROUND

DIO1

DIO2

DIO3

DIO4

EOI DAV

NRFD

NDAC

IFC

SRQ

ATN

SHIELD

74 ni.com

1)! Koppla ihop instrumenten och datorn med GPIB-kablar

2)! Ta reda på adresser och notera dessa 3)! Ta fram manualen och leta reda på innehållsförteckningen

4)! Leta reda på kapitlet om ”Remote och leta reda på intressanta kommandon.

5)! Leta, i innehållsförteckninge, reda på exempelprogram skrivna i t.ex. C och

få inspiration 6)! *idn? är ett bra generellt testkommando

7)! Använd GPIB-write och GPIB-read kommandon. Glöm inte ”byte count”

Metod för anslutning av GPIB-instrument

Slut på

musikdemonstrationen! 75 ni.com

Instrument Drivers

•! Are an organized set of VIs that

control a programmable instrument.

o! Each VI performs multiple

instructions.

o! Grouped by operation type (configuration, data, etc).

•! Reduce development time.

o! Simplify instrument control.

o! Are reusable.

o! Are a common architecture and

interface.

Instrument Commands (*idn?, meas?)

Bus Communication Protocol (configure, read, write, trigger)

Application Development

Environment (ADE)

Instrument Driver

76 ni.com

Instrument Driver Example

77 ni.com

DAQ Programming – Basic Flow

•! A basic DAQmx application involves the following process:

Configure

Task

Acquire or

Generate Data

Clear

Task

Create

Task

Start

Task

Check

for Errors

78 ni.com

How do the loops stop in this example?

•! Passing data among parallel loops is a challenge.

78

79 ni.com

Local Variables

•! Use local variables to pass data within a single VI.

79 80 ni.com

Arrays

An array:

•! Is a collection of data elements that are of same type.

•! Has one or more dimensions.

•! Contains up to (231)–1 elements per dimension, memory permitting.

•! Accesses elements by its index.

Note: The first element is index 0.

81 ni.com

ID array One row of 10-elements

1.2 3.2 8.2 8.0 4.8 5.1 6.0 1.0 2.5 1.7

0 1 2 3 4 5 6 7 8 9

2D array Five-row by seven-column table of 35 elements

0 1 2 3 4 5 6 0 1 2 3 4

Arrays – 1D and 2D Examples

Index

numbers

Page 10: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

82 ni.com

Common Array Functions

•! Array Size

•! Initialize Array

•! Array Subset

•! Build Array

•! Index Array

83 ni.com

Auto-Indexing Input

•! If the iteration count terminal is wired and arrays of

different sizes are wired to auto-indexed tunnels, the

actual number of iterations becomes the smallest of the choices.

83 84 ni.com

Charts vs. Graphs – Single-Plot

85 ni.com

Why Use Build Specifications?

•! Use build specifications to build the following:

•! Stand-alone applications

•! Installers

•! Source distributions

•! Zip files

•! Shared libraries

•! Packed Project libraries

•! .NET Interop Assemblies

•! Web services

85 86 ni.com

Building Applications Checklist

Refer to the Building Applications Checklist topic of the LabVIEW Help

for more information about:

•! Preparing files.

•! Configuring build specifications.

•! Distributing builds.

87 ni.com

Self-Paced Online training

•!Skapa en profil på ni.com

•!Chalmers/Göteborgs universitets email-adress

•!MyNI

•!24/7 tillgång till

utbildningsmaterial

88 ni.com

LabVIEW eller C

http://www.ni.com/newsletter/51675/en/

89 ni.com

User Community

9,000+ Certified Users 700+ Alliance Partners

60+ Registered User Groups

LabVIEW Tools Network

1,000,000+ Add-Ons Downloaded 26+ Certified Add-Ons

100+ Available Add-Ons

Leveraging the LabVIEW Ecosystem

Modules and Toolkits

40+ Toolkits and Modules Including:

LabVIEW Real-Time Module

LabVIEW FPGA Module

LabVIEW Embedded Module for ARM

LabVIEW Touch Panel Module

LabVIEW Wireless Sensor Network Module

LabVIEW C Code Generator

NI Real-Time Hypervisor

Vision Development Module for LabVIEW

Sound and Vibration Measurement Suite

Sound and Vibration Toolkit

LabVIEW Advanced Signal Processing Toolkit

LabVIEW Adaptive Filter Toolkit

LabVIEW Digital Filter Design Toolkit

LabVIEW MathScript RT Module

Spectral Measurements Toolkit

Modulation Toolkit for LabVIEW

LabVIEW Robotics Module

LabVIEW Biomedical Toolkit

ECU Measurement and Calibration Toolkit

GPS Simulation Toolkit for LabVIEW

Measurement Suite for Fixed WiMAX

WLAN Measurement Suite

Automotive Diagnostic Command Set

LabVIEW GPU Analysis Toolkit

Multicore Analysis and Sparse Matrix Toolkit

LabVIEW PID and Fuzzy Logic Toolkit

LabVIEW Control Design and Simulation Module

LabVIEW System Identification Toolkit

LabVIEW Simulation Interface Toolkit

LabVIEW SoftMotion Module

LabVIEW Datalogging and Supervisory Control Module

LabVIEW Report Generation Toolkit for Microsoft Office

LabVIEW Database Connectivity Toolkit

LabVIEW DataFinder Toolkit

LabVIEW SignalExpress

LabVIEW VI Analyzer Toolkit

LabVIEW Statechart Module

LabVIEW Desktop Execution Trace Toolkit

NI Requirements Gateway

NI Real-Time Execution Trace Toolkit

LabVIEW Unit Test Framework Toolkit

LabVIEW Application Builder for Windows ni.com

Questions

Page 11: Introduction to NI LabVIEW Our Mission - Page closedfy.chalmers.se/~f7xlh/elmatB/forelasning.pdf · Automatic Calibration of an Internal Combustion ... based on NI CompactRIO and

ni.com

Min syn på kursen (L.H.)

•! Pedagogik ? Problembaserad inlärning!

•! "Rollspel" - Djungelpatrullens Konsult AB!

•! Jag är "chef", Ni är "anställda” - men ta det inte så allvarligt!!

•! För att förbättra löneutvecklingen och karriärmöjligheten bör ni övertyga chefen om att ni gjort ett bra jobb.!

•! Produktpresentation!

•! Förstudier och Projekt!

ni.com

•Gå igenom gula (oranga) häftet av Lars Bengtsson mha. DDs-datorer."

•Gör en grov plan för hur projektet skall genomföras."

•Skissa på detaljerna. Testa nyckelfunktionen på t.ex. DD."

•Skaffa en överblick över instrumentmanualerna och leta reda på några användbara

instrumentkommandon."

•För betyg 5 skall ovanstående även göras ORDENTLIGT för extrauppgiften.!

Vad behöver göras under förstudien

ni.com

•!Formen på förstudien skall följa kriterierna på kurshuvudhemsidan."

•!Ett preliminärt (behöver inte alls vara komplett) LabVIEW-program skall bifogas liksom

gärna ett flödesdiagram. Idéerna är det viktiga. Ni behöver inte detaljläsa manualerna men ni skall ha skaffat er en viss insikt i funktionen och kommandona och ge exempel på några

lämpliga kommandon.!

•!Glöm inte att använda förtryckt försättsblad.!

OBS! Ni får INTE ta med egna disketter till labben!!

ni.com

Riktlinjer för betyg i LabVIEW

Förutom den allmänna informationen i kursPM gäller!

•! För 3:a. Fungerande grunduppgift. En rapport som beskriver utförandet.

Rapporten skall berätta något, inte bara vara "en hög med bokstäver".

Programmet skall ha kommentarer.!

•! För 4:a. Som för 3:a, men inklusive extrauppgift.!

•! För 5:a. Som för 4:a, men allt skall vara bra, d.v.s. snyggt, rättstavat, gärna bilder

i texten. Välstrukturerat program. Som nämnts ovan så måste även

extrauppgiften vara ordentligt förstuderad.!

•! Rapporten bör vara effektiv, d.v.s så få sidor som möjligt så länge all relevant

information finns med. Nivån skall vara sådan att era klasskompisar kan förstå

vad och hur ni gjort.!

Det skall vara lätt att sätta 5a!

ni.com

http://fy.chalmers.se/~f7xlh/elmatB/

elmatB.html