0% found this document useful (0 votes)
67 views13 pages

Lab 1 Instrumentation

This document outlines a laboratory exercise for EE-383: Instrumentation & Measurement, focusing on the LabVIEW programming environment. Students learn to create Virtual Instruments (VIs) and perform various calculations, including temperature conversion and slope calculation, using LabVIEW's graphical programming features. The lab emphasizes the importance of user interfaces, dataflow programming, and creating subVIs for modular design.

Uploaded by

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

Lab 1 Instrumentation

This document outlines a laboratory exercise for EE-383: Instrumentation & Measurement, focusing on the LabVIEW programming environment. Students learn to create Virtual Instruments (VIs) and perform various calculations, including temperature conversion and slope calculation, using LabVIEW's graphical programming features. The lab emphasizes the importance of user interfaces, dataflow programming, and creating subVIs for modular design.

Uploaded by

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

Department of Electrical Engineering

Faculty Member: Sir Usman Dated: 20/01/20

Semester: 6 Section: C

EE-383: Instumentation& Measurement

Lab 1: Introduction to Lab View

CLO3/PLO4/BT Level B4 PLO4/PLO5, CLO5/ CLO6/


BT PLO8 PLO9
levelA3,A4
Name Reg. No Viva / Analysis Modern Ethics Individual
Quiz / Lab of data Tool and and Team
Performa in Lab Usage Safety Work
nce Report

5 Marks 5 Marks 5 Marks 5 Marks 5 Marks


Shanawar Ali 214241

Zain Ishtiaq 213387

Hamza Atta 221587

EE-XXX: Course Title Page 1


Introduction
In this Lab, you will learn about the LabVIEW programming environment. You will also write a simple Virtual
Instrument (VI) to incorporate basic operations and programming structures in Lab VIEW. The structures
featured include For Loops, While Loops, Case Structures, Sequence Structures, and Formula Nodes.

Objectives
 Learn the three parts of a VI.

 Learn the three palettes.

 Learn how data is passed in LabVIEW.

 Distinguish between controls and indicators on the front panel and block diagram.

 Create a subVI using two different methods.

Theory
LabVIEW Programming Basics

Introduction

LabVIEW is a graphical programming language that uses icons instead of lines of text to create applications.
In contrast to text-based programming languages, where instructions determine program execution, LabVIEW
uses dataflow programming, where the flow of data determines execution.

In LabVIEW, you build a user interface by using a set of tools and objects.
The user interface is known as the front panel. You then add code using graphical representations of functions
to control the front panel objects.
The block diagram contains this code. In some ways, the block diagram resembles a flowchart.

LabVIEW programs are called virtual instruments, or VIs, because their appearance and operation imitate
physical instruments, such as oscilloscopes and multimeters. Every VI uses functions that manipulate input
from the user interface or other sources and display that information or move it to other files or other
computers.

A VI contains the following three components:


• Front panel—Serves as the user interface.
• Block diagram—contains the graphical source code that defines the functionality of the VI.

EE-XXX: Course Title Page 2


• Icon and connector pane—identifies the VI so that you can use the VI in another VI. A VI within another VI is
called a subVI. A subVI corresponds to a subroutine in text-based programming languages.

Front Panel

The front panel is the user interface of the VI. You build the front panel with controls and indicators, which are
the interactive input and output terminals of the VI, respectively. Controls are knobs, pushbuttons, dials, and
other input devices. Indicators are graphs, LEDs, and other displays. Controls simulate instrument input devices
and supply data to the block diagram of the VI. Indicators simulate instrument output devices and display data
the block diagram acquires or generates.

Block Diagram

EE-XXX: Course Title Page 3


After you build the front panel, you add code using graphical representations of functions to control the front
panel objects. The block diagram contains this graphical source code. Front panel objects appear as terminals
on the block diagram.

Additionally, the block diagram contains functions and structures from built-in LabVIEW VI libraries. Wires
connect each of the nodes on the block diagram, including control and indicator terminals, functions, and
structures.

LabVIEW Palettes

LabVIEW palettes give you the options you need to create and edit the front panel and block diagram.

The Tools palette is available on the front panel and the block diagram.
A tool is a special operating mode of the mouse cursor. When you select a tool, the cursor icon changes to the
tool icon. Use the tools to operate and modify front panel and block diagram objects.

Select Window»Show Tools Palette to display the Tools palette. You can place the Tools palette anywhere on
the screen.

If automatic tool selection is enabled and you move the cursor over objects on the front panel or block
diagram, LabVIEW automatically selects the corresponding tool from the Tools palette.

The Controls palette is available only on the front panel. The Controls palette contains the controls and
indicators you use to create the front panel. Select Window»Show Controls Palette or right-click the front
panel workspace to display the Controls palette. You can place the Controls palette anywhere on the screen.

EE-XXX: Course Title Page 4


The Functions palette is available only on the block diagram. The Functions palette contains the VIs and
functions you use to build the block diagram. Select Window»Show Functions Palette or right-click the block
diagram workspace to display the Functions palette. You can place the Functions palette anywhere on the
screen.

Dataflow Programming

LabVIEW follows a dataflow model for running VIs. A block diagram node executes when all its inputs are
available. When a node completes execution, it supplies data to its output terminals and passes the output
data to the next node in the dataflow path.

Creating SubVIs

Introduction

After you build a VI and create its icon and connector pane, you can use it in another VI. A VI called from the
block diagram of another VI is called a subVI. A subVI corresponds to a subroutine in text-based programming
languages. A subVI node corresponds to a subroutine call in text-based programming languages. The node is not
the subVI itself, just as a subroutine call statement in a program is not the subroutine itself.

Setting up the Connector Pane

To use a VI as a subVI, you need to build a connector pane. The connector pane is a set of terminals that
corresponds to the controls and indicators of that VI, similar to the parameter list of a function call in text-based
programming languages. The connector pane defines the inputs and outputs you can wire to the VI so you can
use it as a subVI.

Define connections by assigning a front panel control or indicator to each


of the connector pane terminals. To define a connector pane, right-click the icon in the upper right corner of the
front panel window and select Show Connector from the shortcut menu. The connector pane replaces the icon.
Each rectangle on the connector pane represents a terminal. Use the rectangles to assign inputs and outputs. The
number of terminals LabVIEW displays on the connector pane depends on the number of controls and indicators
on the front panel.

EE-XXX: Course Title Page 5


The connector pane has, at most, 28 terminals. If your front panel contains more than 28 controls and indicators
that you want to use programmatically, group some of them into a cluster and assign the cluster to a terminal on
the connector pane.

Select a different terminal pattern for a VI by right-clicking the connector pane and selecting Patterns from the
shortcut menu. Select a connector pane pattern with extra terminals. You can leave the extra terminals
unconnected until you need them. This flexibility enables you to make changes with minimal effect on the
hierarchy of the VIs.

If you create a group of subVIs that you use together often, give the subVIs a consistent connector pane with
common inputs in the same location to help you remember where to locate each input. If you create a subVI that
produces an output another subVI uses as the input, align the input and output connections to simplify the wiring
patterns. Place the error in clusters on the lower left corner of the front panel and the error out clusters on the
lower right corner.

Setting Required, Recommended, and Optional Inputs and Outputs

You can designate which inputs and outputs are required, recommended, and optional to prevent users from
forgetting to wire subVI connections.

Right-click a terminal in the connector pane and select This Connection Is from the shortcut menu. A
checkmark indicates the terminal setting. Select Required, Recommended, or Optional.

For terminal inputs, required means that the block diagram on which the
subVI is dropped will be broken if the required inputs are not wired.
Required is not available for terminal outputs. For terminal inputs and outputs, recommended means that the
block diagram on which the subVI is dropped can be run if the input is not wired but the Warnings dialog box
will generate a warning that the input has not been wired. Optional means that the block diagram on which the
subVI is dropped can be run and will not generate any warnings if the terminal input or output is not wired.

Inputs and outputs of VIs in vi.lib are already marked as Required, Recommended, or Optional. LabVIEW
sets inputs and outputs of VIs you create to Recommended by default. Set a terminal setting to required only if
the VI must have the input or output to run properly.

In the Context Help window, required connections are bold, recommended connections are plain text, and
optional connections are dimmed if you have the Detailed view selected or do not appear if you have the
Simple view selected.

Creating an Icon

EE-XXX: Course Title Page 6


Every VI displays an icon in the upper right corner of the front panel and block diagram windows. An icon is a
graphical representation of a VI. It can contain text, images, or a combination of both. If you use a VI as a
subVI, the icon identifies the subVI on the block diagram of the VI.

The default icon contains a number that indicates how many new VIs you have opened since launching
LabVIEW. Create custom icons to replace the default icon by right-clicking the icon in the upper right corner of
the front panel or block diagram and selecting Edit Icon from the shortcut menu or by double-clicking the icon
in the upper right corner of the front panel.

You also can drag a graphic from anywhere in your file system and drop it in the upper right corner of the front
panel or block diagram. LabVIEW converts the graphic to a 32 X 32 pixel icon.

Depending on the type of monitor you use, you can design a separate icon for monochrome, 16-color, and 256-
color mode. LabVIEW uses the monochrome icon for printing unless you have a color printer.

Creating Sub VIs from Sections of a VI

Convert a section of a VI into a subVI by using the Positioning tool to select the section of the block diagram
you want to reuse and selecting Edit»Create SubVI. An icon for the new subVI replaces the selected section of
the block diagram. LabVIEW creates controls and indicators for the new subVI and wires the subVI to the
existing wires.

Creating a subVI from a selection is convenient but still requires careful planning to create a logical hierarchy of
VIs. Consider which objects to include in the selection and avoid changing the functionality of the resulting VI.

EE-XXX: Course Title Page 7


Objectives:

 Learn the basics of Lab View software


 Familiarize with the parts of VI(Virtual Interface)
 Distinguish between controls and indicator
 Learn three palettes in the Labview
 Creating subVI

Introduction:
Labview is used for Automated Manufacturing test of a component/system. Automated
Product design validation of a component/sub-system/system. It is used for control and/or monitoring
of a machine/piece of industrial equipment/process. It can also be used for condition monitoring of a
machine/piece of industrial equipment. It provides the Virtual Instrument (VI) in order to test virtually
with the graphical programming language and dataflow along with block diagram to ease the user.

Lab Task1:

Converting ºC to ºF

The formula for converting degrees Celsius to degrees Fahrenheit is as follows:


°F = (1.8 * °C) + 32

For example, to convert a Celsius temperature of 100 degrees into degrees Fahrenheit, first multiply
the Celsius temperature reading by 1.8 to get 180. Then add 32 to 180 and get 212 degrees Fahrenheit.

Task: Implement the above formula theoretically and in Lab View using

C=35, 46, 70, 75, 90 degrees

Compare & Submit both theoretical and Lab View results

EE-XXX: Course Title Page 8


Theoretically:
°F = 1.8×C + 32

No Temperature(°F) Temperature(°C)

1 35 95

2 46 114.8

3 70 158

4 75 167

5 90 194

Labview:
Block Diagram:

Figure : Temperature Convertor

User Interface:

Figure: Celsius Temperature(35,46,70,75,90)

Comparison between theoretical and labview results:

EE-XXX: Course Title Page 9


Results are same in both theoretical and labview. It means that labview is a reliable
instrument for these calculations.

Lab Task 2:
Slope of a Line

The formula for the slope of a line is as follows:

Slope = (Y2 – Y1) / (X2 – X1)

where (X1, Y1) and (X2, Y2) are points on the line.

Task: Implement the equation of slope theoretically and in Lab view using

{(1,5),(5,7)},{(2,6),(9,5)},{(6,9),(5,3)},{(1,6),(7,3)},{(9,5),(2,6)}

Compare & Submit both theoretical and Lab View results

Theoretically:

Slope = (Y2 – Y1) / (X2 – X1)

No Points Slope

1 {(1,5),(5,7)} 0.5

2 {(2,6),(9,5)} -0.1428

3 {(6,9),(5,3)} 6

4 {(1,6),(7,3)} -0.5

5 {(9,5),(2,6)} -0.25

LABVIEW:

EE-XXX: Course Title Page 10


Block Diagram:

(X1,Y1) and (X2,Y2) are control/input and Slope(m) is indicator/output.+,-,/ are operational blocks.

Figure : Slope Calculator

User Interface (X1, Y1) and (X2, Y2):

{(1,5),(5,7)} {(2,6),(9,5)} {(6,9),(5,3)}

{(1,6),(7,3)} {(9,5),(2,6)}

EE-XXX: Course Title Page 11


Comparison between theoretical and labview results:

Results are same in both theoretical and labview. It means that labview is a reliable
instrument for these calculations.

Task 3

Write a VI that adds, subtracts, multiplies, divides, and averages two input numbers and
displays the results on the front panel. Save your VI as Calculator.vi.
Block Diagram:

Numeric 1 and Numeric 2 are two inputs/controls and +, -, x, / are operational blocks and add, sub,
multiply, divide and average are indicator /output.

Figure : Calculator

EE-XXX: Course Title Page 12


Front Panel:

Results:

Simple calculations performed using labview. Temperature convertor, slope calculator and a
simple calculator that gave the same results as theoretically. User interface is friendly and one can
perform calculations in runtime.

Conclusion:

In this lab, we learned to use the basics of labview.Using the front panel,controls and tools
to create some simple calculations and then verifying the results with some inputs and comparing it
with theoretical results. Labview proved to be very useful tool as it offers graphical programming
environment which is quite user freinfly and you can perform a lot of analysis in virtual environment
rather than using hardware for simulation.

EE-XXX: Course Title Page 13

You might also like