0% found this document useful (0 votes)
20 views45 pages

Prog-Dev Chap4

Uploaded by

waelmed.charaoui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views45 pages

Prog-Dev Chap4

Uploaded by

waelmed.charaoui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Instrumentation and

Programmable Devices

Pr. H. BENTARZI

Chapter IV Introduction to data acquisition and


virtual instruments.

Graphical Programming for


Test, Measurement, and
Control
• Rapid application
development and easy-to-
use graphical
environment
• Interactive measurement
assistants and powerful
redesigned DAQ
interface for connecting
to all types of I/O

1
Chapter IV Introduction to data acquisition and
virtual instruments.

Signal Conditioning Circuit

How is composed a Virtual


Instrument (VI)

Front Panel
• Controls = Inputs
• Indicators = Outputs

Block Diagram
• Accompanying
“program”
for front panel
• Components wired
together
4

2
Chapter IV Introduction to data acquisition and
virtual instruments.

Acquire, Analyze, and Present


Nearly all test, measurement, and control applications can be divided
into 3 main components: the ability to acquire, analyze, and present
data.
LabVIEW = acquiring, analyzing, and presenting real-world data.

Acquire with LabVIEW


LabVIEW can acquire data using
the following devices and more:
• GPIB, Serial, Ethernet, USB, VXI,
PXI Instruments
• Data Acquisition (DAQ)
• PCI eXtensions for Instrumentation
(PXI)
• Image Acquisition (IMAQ)
• Motion Control
• Real-Time (RT) PXI
• PDA
• Modular Instruments
6

3
Analyze with LabVIEW
LabVIEW includes the following
tools to help you analyze your data:
• More than 400 measurement analysis
functions for Differential Equations,
Optimization, Curve Fitting, Calculus,
Linear Algebra, Statistics, etc.
Powerful measurement
analysis is built in to • 12 new Express VIs specifically
the LabVIEW designed for measurement analysis,
development including filtering and spectral analysis
environment. • Signal Processing VIs for Filtering,
Windowing, Transforms, Peak
Detection, Harmonic Analysis,
Spectrum
7 Analysis, etc.

4
5
How is composed a Virtual
Instrument (VI)

Front Panel
• Controls = Inputs
• Indicators = Outputs

Block Diagram
• Accompanying “program”
for front panel
• Components wired
together

11

How is composed the Front Panel Window

Front Panel VI Icon


Toolbar

Free Text
Simple
Numeric
Numeric Indicator
Control

Numeric Waveform
Indicator Graph

Scale
Legend

12

6
How is composed the Block Diagram Window

Block
Diagram
Toolbar

SubVI
(VI Express)
Numeric Graph
Constant Terminal

Wire
Data Numerical
Indicator
Terminal

While Loop
Structure
Timing Boolean Control
Function Terminal
13

Express VIs, VIs and Functions

Express VIs: interactive VIs with configurable dialog page


Standard VIs: modularized VIs customized by wiring
Functions: fundamental operating elements of
LabVIEW; no front panel or block diagram

14

7
Tools Palette
• LabVIEW can automatically select the tool needed
• Available on the front panel and the block diagram
• A tool is a special operating mode of the mouse cursor
• Use the tools to operate and modify front panel and
block diagram objects
• To show the tools palette, select
Window»Show Tools Palette

15

Front Panel − Controls Palette

Controls Palette
Contains the most commonly used controls

All Controls Palette


Shows all controls

16

8
Block Diagram − Functions Palette

Functions Palette
Contains the Express VIs (interactive VIs with
configurable dialog page) and the most commonly
used functions
All Functions Palette
Shows all functions
17

Tools Palette
Click pushpin to tack down palette

Up to Owning Search Palette Options


Palette

Graphical, floating palettes


Subpalettes can be converted to floating
palettes
Use Palette Options to change palette view
from Express to Advanced

18

9
Menu

File Edit Operate Tools Browse Window Help

19

Front Panel and Block Diagram Toolbars

Run button Font ring


Continuous Run button Alignment ring
Abort button Distribution ring
Pause/Continue button Resize ring
Reorder ring
Additional Buttons on the Block
Diagram Toolbar Context Help Button
Warning indicator • Execution Highlighting button
Enter button • Step Into button
• Step Over button
Broken Run button
• Step Out button

20

10
Labview help

1. Information about LabVIEW programming


concepts, step-by-step instructions for using
LabVIEW, and

2. Reference information about LabVIEW VIs,


functions, palettes, menus, tools, properties,
methods, events, dialog boxes, and so on.

21

Property Page
Right-click a control
or indicator on the
front panel and select
Properties from the
shortcut menu to
access the property
dialog box for that
object

Labview 2009-2010 22

11
Some shortcuts

Labview 2011-2012 23

Creation of a new VI and


customization

TOPICS
New VI creation
Dataflow Programming
Customization of VI

24

12
Exercise 1 - Convert °K to °F

• Goal
– Create a simple VI
– Topic : convert a Kelvin temperature into Fahrenheit
• Concepts
– Simple mathematic function, numeric format
– Commands and indicators
– Dataflow, help, debugging
– Displays customized

• Homework
– Open a new VI
– Build a VI that converts °K to °F
– Save in « 1_KtoF.vi »

25

Step 1 : Creating a new VI


• File»New VI to open a blank VI

• File»New… to open the New dialog box and configure a VI template,


global variable, control, etc…

26

13
Composition of a new VI

Diagram (D)

Front Panel (FP)

27

Creating a VI Front Panel

Build the front panel with controls (inputs)


and indicators (outputs)

Numeric
Owned Indicator
Labels

Increment
Buttons Numeric
Boolean Boolean Control
Control Indicator

Labview 2009-2010 28

14
Step 2 : Create the Front Panel
Create this Front Panel using the Controls Palette

29

Shortcut Menus for Front Panel


Objects
Right-click the digital display
to access its shortcut menu

Right-click the label to


access its shortcut menu

Labview 2009-2010 30

15
Step 3 : Creating a VI Block Diagram
Front Panel

Control Indicator Block Diagram

Control
Terminal

Constant Indicator
Wires Nodes Terminal
31

Wiring Techniques

Hot Spot
• Automatic Wiring
• Use Context Help Window when wiring
• Right-click wire and select Clean Up Wire
• Tip Strips
• Automatic wire routing
• Right-click terminals
and select Visible
Items»Terminals
View the terminal connections to a function
32

16
Block Diagram Terminals

• Terminals are entry and exit ports


that exchange information between
the panel and diagram
• Terminals are analogous to
parameters and constants in text-
based programming languages
• Right-click and toggle View As Icon
to change the icon view

33

Context Help
To display the Context Help window, select
Help»Show Context Help, press the <Ctrl-H> keys,
or press the Show Context Help Window button in
the toolbar
Move cursor over object
to display help
Connections:
Required – bold
Recommended – normal
Optional - dimmed
Simple/Detailed Context Help Lock Help More Help
34

17
LabVIEW Help
Click the More Help button in the Context Help
window
Select Help»VI, Function, & How-To Help
Click the sentence Click here for more help in the
Context Help window.

Contains detailed descriptions of most palettes, menus,


tools, VIs, and functions, step-by-step instructions for
using LabVIEW features, links to the LabVIEW
Tutorial, PDF versions of all the LabVIEW manuals
and Application Notes, and technical support
resources. 35

Dataflow Programming

• Block diagram executes


dependent on the flow of data;
block diagram does NOT
execute left to right

• Node executes when data is


available to ALL input terminals

• Nodes supply data to all output


terminals when done
Labview 2009-2010 36

18
Step IV : Save the VI

Save the VI as “1_KtoF.vi”


(in a specific folder)

Then execute it !

37

Customization of displays
Goals
Insert comments for users
Adapt displays to the application

What sort of customization ?


Free text
Models of commands and indicators
Scale

38

19
1) Free text
Useful to inform user
Authorized on FP et D

In example,
1. Add something like : ‘ Temperature
conversion ’.
2. Then, change font, size, color … (via FP
Toolbar)
39

2) Customization of displays

1. Shortcut menu of object

2. Choose the right indicator

40

20
Customization of displays

• Goal
– Modify a VI
– Topic : Customization with specific models of indicator and messages

• Concepts
– Free text
– Customization of displays

• Homework
– Open « 1_KtoF.vi »
– Replace numerical indicator with temperature indicator
– Insert free text in FP and D to legend them
– Save in « 2_KtoF.vi » 41

Exercise 2 : FP customized

42

21
Exercise 2 : D customized

43

Modular Programming

TOPICS
SubVIs
Icon and Connector Pane
Using SubVIs
Creating a SubVI from sections of a VI

44

22
LabVIEW Hierarchy

SubVI

45

SubVIs
Function Pseudo Code Calling Program Pseudo Code
function average (in1, main
in2, out) {
{ average (point1, point2,
out = (in1 + in2)/2.0; pointavg)
} }

SubVI Block Diagram Calling VI Block Diagram

46

23
Icon/Connector

terminals
Icon

An icon represents a VI in other block


diagrams
Connector

A connector passes data to and receives


data from a subVI through terminals terminals

47

SubVI Example
– Conversion temperature
• A VI within another VI is called a subVI
• To use a VI as a subVI, create an icon and a connector pane after
building the front panel and block diagram

48

24
Steps for creating a SubVI
Create the Icon
Create the Connector
Assign Terminals
Save the VI
Insert the VI into a Top Level VI

49

Creating the Icon


• Icon: graphical representation of a VI
• Right-click in the icon pane (Panel or Diagram)
• Always create a black and white icon
Default Icon
Create a custom icon

50

25
Creating the Connector

Right-click the icon


(Front Panel only)

51

Creating the Connector - continued


Click with
wiring tool

52

26
Assign terminals via
the Connector Pane
Terminal colors match the data types to which they are connected
Click the terminal to see its associated front panel object

53
… and save the VI !

Using a VI as a SubVI

All Functions » Select a VI…


<OR>
Drag icon onto target diagram
<OR>

Drag file onto target diagram

54

27
Help and Classifying Terminals

Classify inputs and outputs:


• Required — Error if no connection
• Recommended — Warning if no connection
• Optional — No effect if no connection
55

Exercise 3 – Generate temperature using SubVI

• Goal
– Create a simple VI
– Topic : convert a Kelvin temperature into Fahrenheit
• Concepts
– SubVI

• Homework
– Create icon and connector of « 1_KtoF.vi », save it and close
– Create a new VI in order to generate a randomly temperature between T0–DT et
T0+DT :
• 2 inputs T0(°K) and DTmax(°K)
• 2 outputs T(°K) and T(°F)
– You have to use the VI « 1_KtoF.vi »
– Save in « 3_Gen_temp_conv.vi »

56

28
Searching for Controls, VIs, and Functions

• Press the search button to


perform text searches of the
palettes
• Click and drag an item from
the search window to the
block diagram or
double-click an item to
open the owning palette

For the exercise, search for “Random number”


57

Exercise 3 : D

58

29
Exercise 3 : FP

59

Complement : another way for creating a subVI

It exists an other way to simply create SubVi.


Indeed, just by selecting the part of the program in which you're
interested in creating a SubVi you can achieve it.
But this method performs some automatic assignments and you will have
to be careful when you use it…

60

30
Selection of the program part

61

Creation of the Sub Vi

62

31
Terminal assignment & icon

Once the creation is achieved, the selected program part becomes an


icon. You can edit it to customize its appearance.
Moreover, if you look at the terminal assignment, it has automatically
be generated. However, you can change it with the method studied in
lesson 2.

63

Exercise 4

• Goal
– SubVI creation

• Homework
– Open "3_Gen_temp_conv.vi".
– Replace the generation part by a subVI.
– Customize the SubVI icon.
– Suppress the automatic assignment of "T0" and "dTmax"
– Save the SubVI as "3Compl1_Gen_temp_conv.vi"

64

32
Summary

• VIs can be used as subVIs after you make the icon and connector
• Icon created using Icon Editor
• Connector defined by choosing number of terminals
• Load subVIs using the Select a VI option in the All Functions palette
or dragging the icon onto a new diagram
• Online help for subVIs using the Show Context Help option
• Descriptions document functionality
• Use Create SubVI feature to easily modularize the block diagram

65

Simple acquisition

TOPICS
Replacing simulation by acquisition
Data acquisition, acquisition of 1 point

66

33
Data Acquisition Hardware

Data Acquisition Hardware

34
Data Acquisition Hardware

Data Acquisition Hardware

35
Data Acquisition Hardware
Data acquisition (DAQ) basics DAQ Device

Connecting Signals
Simple DAQ application

Computer
Sensors
Cable

Terminal Block

71

Data Acquisition Hardware


Channel names
Sine Wave 1
ai 0
Signals
ai 1 Sine Wave 2

ai 2 Sine Wave 3

Tasks
Timing and Triggering

72

36
Data Acquisition in LabVIEW

NI-DAQmx
Traditional NI-DAQ
Next generation driver:
Specific VIs for
• VIs for performing a
performing:
task
• Analog Input
• One set of VIs for all
• Analog Output
measurement types
• Digital I/O
• Counter operations

73

Steps for creating and acquisition task

How to create a task to acquire an analog voltage ?

In Block Diagram, open Functions Palette


Express > Input > Assistant DAQ
Acquire a signal > analog input > Voltage
Parameters :
Terminal Configuration : RSE (ground ref.)
Acquisition Mode : 1 sample in demand

74

37
Exercise 4 – Simple Data Acquisition
• Goal
– Acquire analog signal
– Topic : acquire voltage from thermistor
• Concepts
– Assistant acquisition data
and hardware
– Formula node
• Homework
– Step 1 : In a blank vi, create an acquisition task, 1point, tension, -10/+10, RSE
– Step 2 : Convert the measured voltage into temperature with formula node or
express. Save it as “Acq_Temp.vi”
– Step 3 : Open the vi “Sim_temp_conv2.vi” and replace the simulation part
(“specifications and generation”) by the acquisition part and save it in
“Acq_Temp_conv.vi”

75

Exercise 4 – Simple Data Acquisition

76

38
Vcc
Electronic system

R0
Rth = f(Uth) ?

RTh Vcc = +10V


Uth
R0 = 10 500 Ohms

77

Ref thermistor :
Ambient temperature
vs
thermistor value

325
1
320 T(R)=
R
315 Ln( )
1 10500
310 +
298.15 5524
305
T(°K)

300
295
290
285
280
0 5000 10000 15000 20000 25000
R(Ohms)

78

39
Exercise 4 – D

79

Exercise 4 – FP

80

40
Exercise 4 – D

With express VIs

With subVI

81

Exercise 4 : Front Panel (FP)

82

41
Complement : another way for
implementing mathematical function

For sure, basic mathematical functions for huge calculus won't be very
practical nor very efficient. They lead to complicated programs, and
Labview propose the use of higher level functions like "expression node"
or "formula node"…

83

Exercise 5

• Goal
– Use of higher level function for mathematical calculus
– Creation of SubVI

• Homework
– Open "4_Acq_Temp_conv.vi"
– Replace the Calculus part by a "formula node" or an "expression node"
– Create a SubVI performing the acquisition and the conversion.
This SubVI won't have any input terminal and just one output terminal.
– Save as "4Compl2_Acq_Temp_conv.vi"

84

42
Chapter IV Introduction to data acquisition and
virtual instruments.

Graphical Programming
for Test, Measurement, and
Control
• Rapid application
development and easy-
to-use graphical
environment
• Interactive
measurement assistants
and redesigned DAQ
interface for connecting
to all types of I/O

Chapter IV Introduction to data acquisition and


virtual instruments.

Example: PC based Power Circuit Inductio

protective system :
supply breaker n motor

A block diagram represents a block Sensors

diagram of PC based protective Signal


conditioning and

system . For the incoming signals filtering circuit

from the sensors are first filtered to Data acquisition

eliminate the noise or the unwanted


card AD622

frequencies. After that, it should be


conditioned, so that data acquisition PC

card can handle it (±5V selectable


input for AD622). Simulink
Model
Workspace

43
Chapter IV Introduction to data acquisition and
virtual instruments.

Data Acquisition Card:


The data acquisition card is designed for the need of connecting PC compatible computer to real
world signals. The main function of this hardware is to convert analog signals to digital signals,
and to convert digital signals to analog signals.
The AD622 contains 8 channel fast 14 bit A/D converter with simultaneous sample/hold circuit, 8
independent 14 bit D/A converters, 8 bit digital input port and 8 bit digital output port. The card
is designed for standard data acquisition and control applications and optimized for use with Real
Time Toolbox for Simulink. AD622 card features fully 32 bit architecture for fast through put.
Application of the AD622 data acquisition board:
• DC voltage measurement
• Transducer and sensor interfacing
• Vibration and transient analysis
• Process monitoring and control
• Waveform acquisition and analysis
• Real-time simulation
• Multichannel data acquisition
• Programmable voltage output

Chapter IV Introduction to data acquisition and


virtual instruments.

Example:
PC based
protective system :

The implemented protective relay using AD622

44
Thank You

45

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy