Professional Documents
Culture Documents
LEARNING OBJECTIVES
At the end of this lab session, you would have learned to:
Navigate the LabVIEW graphical programming language environment.
Create a VI code to perform simple math operations and use of formula
node
Use For and While Loop structures
Disply results on Waveform Charts and Graphs
RESOURCES
o Lab Module # 1
o Text book by R. Bishop
o LabView on line tutorial
o National instrument website: www.ni.com
o Instructors
SETUP
Insert (connect) your CD or floppy disk (USB mobile disk) into the
appropriate drive (USB port). Check the disk directory to make sure
your disk is free of any viruses.
Launch LabVIEW from the LabVIEW group in the Start menu of the
task bar.
When prompted to open an existing or new VI, select New VI.
When the new VI windows appear, select Windows»Show Tools
Palette to display the Tools palette.
From the File menu, select Save As and save the file to your CD or
USB disk under a suitable name. The file extension must be *.vi. It is a
good idea to save the file every few minutes during the development
process. Save the file after making a change you want to keep.
WHAT IS LabVIEW
Labview program is a visual programming tool that provides a
programming environment to develop programs with graphics rather than
use text-based languages to create lines of code. LabVIEW is an acronym
MECH 374: Measurements and Lab Module # 1; Pag
Instrumentation e1
for Laboratory Virtual Instrument Engineering Workbench. A LabVIEW
program is called a Virtual Instrument (VI) because its appearance and
operation imitate actual instruments. A VI has two main parts, the front
panel and the Block Diagram. LabVIEW programming consists of drawing
pictures that specify data dependencies. The LabVIEW programming
environment includes a large set of blocks grouped in two main palettes
to specify operations, the control palette and the functions palette. The
different blocks are wired using the wiring tool to connect them together.
The Front Panel (FP) is the interactive user interface of a VI mimicking
the "face" of the instrument. On it can be placed all the controls and
indicators (knobs, graphs, etc.) necessary to make the virtual instrument
look real. Associated with the front panel is the Control tool box or
Palette. The Controls are the Inputs that simulate typical input devices
such as knobs and switches. The Indicators are the Outputs that
simulate output displays that show data the program requires or
generates. Controls and indicators are not functionally equivalent. The
Toolbar located at the top of the FP contains buttons used to control the
execution of the program and alignment and distribution of objects.
Illustrative Example
Assume a control application involving two switches and two sensors, an
LVDT and a potentiometer. One switch represents an IR emitter/detector
used at a door and the other is a filling station control switch used to
activate or stop a tank filling operation. The LVDT measures the level of
fluid in a tank and is represented by a slide indicator and the pot control
defines the angular position of a valve and is represented by a knob
control. The LVDT output is given by 0.01h, where h is the fluid level in the
tank. If the two switches are closed, a security light turns on and the tank
filling at a rate of 5Aθ , A is area of the tank and θ is the angular output
of the potentiometer. If the output of the LVDT is 100 mm, a siren should
go off for 2 seconds and the valve should close. Develop a LabVIEW code
to implement the control process.
Charts
The strip chart is similar to a typical paper strip chart used in laboratories
such as EKG machine. The display scrolls to the left as ecah new data
point arrives. The scope and sweep charts are similar to the action of an
oscilloscope. In the scope chart the entire plot is erased and the plotting
begins again from the left side whenever the data reaches the right
border of the chart. In the sweep chart a vertical line marks the beginning
INTERACTIVE EXAMPLES
A LabVIEW program, called a virtual instrument (VI), is a two-window
system. The code is in one window and the user interface (inputs and
outputs) appears in a separate window. The program window is the block
diagram window, and the user inputs and outputs are in the front panel
window. The following examples demonstrate the process of creating a VI.
They will help you learn the basics of LabVIEW programming. Follow each
step completely before executing the step. By the end of the session, you
will have written a VI that displays a sine function on a chart. After
completing this tutorial, you should be able to complete the rest of the
lab.
Example - I
As an introductory example, let us construct a VI to determine the
acceleration a of an object of mass m subject to a F resulting from a
pressure P acting on the object surface area A. Figure 1 shows the block
diagram window that implements the calculations involved: F = PA and a
= F/m
STEPS
The program calculates the force from pressure and area, and
then the acceleration of the object on which the force acts. The
numbers are entered into the computer and displayed in the
front panel window shown in Figure 2. The blocks on the left
(labeled pressure, area, and mass) are controls. The gauge box
and the slide on the right labeled force and acceleration are the
outputs or indicators. The boxes are associated with like labeled
boxes in the diagram window shown in Figure 2.
Example - II
Develop a VI to generate the following signals and show them on the
same plot:
x = 3sin t
y = 4e − t 5
z = xy
w = 2x − z
for t = ( π 10 ) * i; i = 1,..,100
STEPS
Practice
Consider the distance required for an automobile to stop when the driver
suddenly applies the brakes, locking the wheels so that a skid occurs. The
car has mass m which at time t = 0 has velocity v0 (20 m/s). For time t>0,
MECH 374: Measurements and Lab Module # Page 11
Instrumentation 1
the only force acting on the car are the tire-pavement resistance force Fr
= µ mg and the weight mg of the car which generates the normal force
between the car and the pavement; m (800 kg) is the mass, µ (0.8) is the
coefficient of friction for the tire-pavement interface, and g (9.81 m/s2) is
the acceleration of gravity. Determine the stopping distance and indicate
on the front panel. Determine and plot the variation of acceleration,
velocity, and position during stopping.
References
• Rober H. Bishop, Learning with LabVIEW 7 Express, Prentice-Hall
(2004)
• LabVIEW Tutorial, National Instruments, Inc., Austin, TX.
www.ni.com
VOCABULARY