Hands-on introduction to LabVIEW for scientists and engineers - GBV

253 downloads 4211 Views 198KB Size Report
Hands-On Introduction to. LabVIEW for Scientists and Engineers. Second Edition. John Essick. Reed College. New York. Oxford. OXFORD UNIVERSITY PRESS ...
Hands-On Introduction to

LabVIEW for Scientists and Second Edition

John Essick Reed

College

New York

Oxford

OXFORD UNIVERSITY PRESS

Engineers

Contents .

Preface 1.

THE WHILE LOOP AND WAVEFORM CHART

1

1.1

LabVIEW Programming Environment

1.2

Sine-Wave Plot

1.3

Block

1.4

LabVIEW

1.5

Front Panel

22

1.6

27

1.7

Pop-Up Menu Finishing the Program

1.8

Program Execution

31

1.10

Program Improvements Date-Type Representations

33

1.11

Automatic Creation Feature

46

1.12

Program Storage

48

Do It Yourself

50

Problems

51

1.9

2.

xiii

using a While

Loop

1

and Waveform Chart

3

Diagram Editing

Help Window Editing

20

30

43

THE FOR LOOP AND WAVEFORM GRAPH For

2.2

Sine-Wave Plot

2.3

Waveform Graph

2.4

Owned and Free Labels

2.5

Creation of Sine Wave

2.6

Cloning Block-Diagram Icons

2.7

56

Basics

2.1

Loop

using

2

56 For Loop and Waveform

a

Graph

57 58

59

using

a

For

Loop

60 63

Feature

65

2.8

Auto-Indexing Running the VI

2.9

x-Axis Calibration of the Waveform

2.10

Sine-Wave Plot using

2.11

Array Indicators and the

68 a

While

Graph

Loop and Waveform Graph

Probe Watch Window

69 75

79

Do It Yourself

90

Problems

92

vii

Contents

THE MATHSCRIPT NODE AND XY GRAPH

3.

3.1

MathScript Node Basics Quick MathScript Node Example: Sine-Wave Plot Debugging with Error List Waveform Simulator using a MathScript Node and XY Graph Creating an xy Cluster

3.2 3.3 3.4 3.5 3.6

Running

109 111 115

117

3.8

MathScript Adding Shape Options

3.9

The Enumerated Type Control

122

3.10

Finishing the Block Diagram

124

3.11

Running the VI

128

3.12

Control and Indicator Clusters

129

3.13

Creating

3.14

Icon

3.15

Connector

142

Do It Yourself

146

Problems

148

DATA

an

Icon

to Waveform Simulator

using the Icon

Editor

121

136

137

Design Assignment

ACQUISITION USING DAQ ASSISTANT

152 152

4.3

Acquisition Vis Data Acquisition Hardware Analog Input Modes

4.4

Range and Resolution

157

4.5

Sampling Frequency and the Aliasing Effect Measurement & Automation Explorer (MAX) Simple Analog Input Operation on a DC Voltage Digital Oscilloscope

158

4.9

Analog Output

184

4.10

DC

4.11

Software-Timed Sine-Wave Generator

192

4.12

Hardware-Timed Waveform Generator

194

4.1 4.2

4.6 4.7 4.8

4.13 4.14 4.15

viii

99 102

116

the VI

Interactive Window

3.7

4.

99

Data

Voltage

153 155

160

164 175

185

Source

on a Diagram Placing Completing and Executing Waveform Generator (Express)

197

Modified Waveform Generator

201

Do It Yourself

203

Problems

204

a Custom-Made VI

Block

199

CONTENTS

DATA FILES AND CHARACTER STRINGS 5.1

ASCII Text and Binary Data Files

5.2

Storing

211 211 File

5.4

Spreadsheet-Formatted Storing Array Transpose Option

5.5

Storing a Two-Dimensional

5.6

Controlling the Format

5.7

The Path Constant and Platform

5.8

Fundamental File I/O Vis

5.9

Adding Text Labels to

5.10

Blackslash Codes

237

Do It Yourself

239

Problems

243

5.3

Data in a

a

213

One-Dimensional Data

Data

214 217 220

Array

of Stored Data

a

224

Portability

226 227

Spreadsheet File

233

SHIFT REGISTERS

252

6.1

Shift Register Basics

252

6.2

255

6.3

Quick Shift Register Example: Integer Sum Numerical Integration and Differentiation using Shift Registers

6.4

Power Function Simulator VI

258

6.5

Numerical

Integration via the Trapezoidal Rule Trapezoidal Rule VI using Single Shift Register Convergence Property of the Trapezoidal Rule Numerical Differentiation using a Multiple Shift Registers Modularity and Automatic SubVI Creation

264

Do It Yourself

289

Problems

289

6.6 6.7 6.8

6.9

THE CASE STRUCTURE

258

267

275 278 284

296

7.1

Case Structure Basics

7.2

Quick

7.3

Numerical Integration using Case Structures

310

7.4

Numerical Integration via Simpson's Rule

310

7.5

Parity Determiner using

7.6

Summation of Partial Sums

7.7 7.8

7.9

Case Structure

296

Example: Runtime Options using Property Nodes 299

a

Boolean Case Structure

Top-Level

313

Numeric Case Structure

using Trapezoidal Rule Contribution using a

a

Boolean Case Structure

Simpson's Rule VI

Comparison

of the Trapezoidal Rule and

318 321

323

Simpson's

Rule

326

Do It Yourself

329

Problems

330

ix

Contents

8.

DATA DEPENDENCY AND THE SEQUENCE STRUCTURE 8.1

Data

Dependency and Sequence Structure Basics using a Sequence Structure Event Timer using Data Dependency Highlight Execution

338

8.2

Event Tinier

342

Do It Yourself

354

Problems

355

8.3 8.4

9.

352

9.1

Thermistor

Resistance-Temperature Data File

364

9.2

Temperature Measurement using Thermistors

367

9.3

The Linear

370

Method

Least-Squares a VI using

Data to

Front-Panel Control

371

9.5

Inputting Inputting

9.6

Slicing Up

9.7

Curve

9.8

Residual Plot

391

Do It Yourself

394

Problems

397

Data to a

a

VI

a

by Reading from

Multi-Dimensional

a

Disk File

376

379

Array

Fitting using the Linear Least-Squares Method

ANALYSIS VIS: FAST FOURIER TRANSFORM

385

405

10.1

The Fourier Transform

405

10.2

Discrete Sampling and the Nyquist Frequency

406

10.3

The Discrete Fourier Transform

407

10.4

The Fast Fourier Transform

408

10.5

Frequency

409

10.6

FFT of Sinusoids

10.7

Applying the FFT to Various Sinusoidal

10.8

421

10.10

Magnitude Complex-Amplitude Observing Leakage Analytic Description of Leakage

10.11

Description of Leakage Using the Convolution Theorem

430

10.12

Windowing Estimating Frequency and Amplitude Aliasing

440

Do It Yourself

444

Problems

445

10.9

10.13 10.14

x

349

364

ANALYSIS VIS: CURVE FITTING

9.4

10.

338

Calculator VI

412

Inputs

of the

414 417 427 434

443

CONTENTS

11.

DATA ACQUISITION AND GENERATION USING DAQMX Vis 11.1

11.4

DAQmxVIs Simple Analog Input Operation on a DC Voltage Digital Oscilloscope Express VI Automatic Code Generation

11.5

Limitation of Express Vis

11.6 11.7

Improving Digital Oscilloscope using Analog Output Operations

11.8

Waveform Generator

481

Do It Yourself

485

Problems

485

11.2

11.3

12.

451 451 453 459

466 467

State Machine Architecture

480

PID TEMPERATURE CONTROL PROJECT 12.1

Voltage-Controlled

491

Bidirectional Current Driver for

Thermoelectric Device

12.2

PID

12.3

PID

491

Algorithm Temperature Control System Temperature Control

492 495

CONTROL OF STAND-ALONE INSTRUMENTS

13.

469

498

13.1

Instrument Control

13.2

The VISA Session

using VISA Vis

498 499

13.3

The IEEE 488.2 Standard

503

13.4

Common Commands

503

13.5

Status

504

13.13

Reporting Device-Specific Commands Specific Hardware used in this Chapter Measurement & Automation Explorer (MAX) Simple VISA-Based Query Operation Message Termination Getting and Setting Communication Properties using Performing a Measurement over the Interface Bus Synchronization Methods

13.14

Measurement VI Based on the Serial Poll Method

538

13.15

Measurement VI Based on the Service

545

13.6 13.7 13.8 13.9

13.10 13.11

13.12

13.16 13.17

508

509 511 518

522 a

Property Node 523

Request Method

Instrument Driver

Creating an Using the Instrument Driver to

527 532

551 Write

an

Application Program

565

Do It Yourself

571

Problems

572

APPENDIX I: CONSTRUCTION OF TEMPERATURE CONTROL SYSTEM

575

APPENDIX II: PROGRAM CROSS REFERENCE TABLE

583

Index

585

xi

Suggest Documents