EI2357 - Virtual Instrumentation Laboratory Manual - Dgpride
EI2357 - Virtual Instrumentation Laboratory Manual - Dgpride
EI2357 - Virtual Instrumentation Laboratory Manual - Dgpride
INDEX
Sl.
Exp. Date
No
Date of
submission
Page
Marks
No.
Staff
Sign
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
http://studyzone.dgpride.com
List of experiments
University Syllabus
EI2357 - VIRTUAL INSTRUMENTATION LAB
http://studyzone.dgpride.com
Ex. No:
Date:
Creating Virtual Instrumentation for simple application
Aim:
To understand the principles of Virtual Instrumentation (VI) and learn the basics for creating
Virtual Instrument.
Equipments Required:
PC with National Instruments LabVIEW 8.5.
Theory:
Virtual Instrumentation:
Virtual instrumentation is the use of customizable software and modular measurement
hardware to create user-defined measurement systems, called virtual instruments. Traditional
hardware instrumentation systems are made up of pre-defined hardware components, such as digital
multimeters and oscilloscopes that are completely specific to their stimulus, analysis, or measurement
function. Because of their hard-coded function, these systems are more limited in their versatility than
virtual instrumentation systems. The primary difference between hardware instrumentation and virtual
instrumentation is that software is used to replace a large amount of hardware. The software enables
complex and expensive hardware to be replaced by already purchased computer hardware; e. g.
analog-to-digital converter can act as a hardware complement of a virtual oscilloscope, a potentiostat
enables frequency response acquisition and analysis in electrochemical impedance spectroscopy with
virtual instrumentation.
LabVIEW
Laboratory Virtual Instrumentation Engineering Workbench (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, a user interface
can be build by using a set of tools and objects. The user interface is known as the front panel. Then
code can be added 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 one of the suitable for 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.
Icon and connector panel - Identifies the VI so that the VI can be used in another VI. A VI
within another VI is called a subVI. A subVI corresponds to a subroutine in text-based
programming languages.
The front panel is the user interface of the VI. The front panel is build 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. After the
front panel is build, 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.
http://studyzone.dgpride.com
Functions Palette
Controls Palette
http://studyzone.dgpride.com
Review Questions.
What is virtual instrumentation?
What are the different palettes in VI?
What is sub VI?
What are the advantages of VI?
Compare hardware instrumentation and VI.
http://studyzone.dgpride.com
Ex. No:
Date:
Programming Exercises for Loops and Charts
Aim:
To understand the principles of Virtual Instrumentation Programming and learn the basics of
different Loops and Charts.
Equipments Required:
PC with National Instruments LabVIEW 8.5.
Theory:
Virtual Instrumentation:
Loops are used for controlling the iteration and execution flow of programs. Charts display
the recent data and update periodically by maintaining a history of the past data.
For Loop
For Loop executes a subdiagram for set number of times. The value in the count terminal (an
input terminal) indicates how many times to repeat the subdiagram. Set the count explicitly by wiring
a value from outside the loop to the left or top side of the count terminal, or set the count implicitly
with auto-indexing. The iteration terminal (an output terminal) contains the number of completed
iterations. The iteration count always starts at zero. During the first iteration, the iteration terminal
returns 0. Both the count and iteration terminals are signed long integers. If a floating-point number is
wired to the count terminal, LabVIEW rounds it and coerces it to within range. If 0 or a negative
number is wired to the count terminal, the loop does not execute. Add shift registers to the For Loop
to pass data from the current iteration to the next iteration.
http://studyzone.dgpride.com
http://studyzone.dgpride.com
Review questions:
1. What are the different loops available in LabVIEW?
2. Distinguish between for and while loop.
3. What is loop iteration control?
4. How to make Chart Axes scaling?
5. What is Multitracing?
http://studyzone.dgpride.com
Ex. No:
Date:
Programming Exercises for Clusters and Graphs
Aim:
To understand the principles of Virtual Instrumentation Programming and learn the basics of
Clusters and Graphs
Equipments Required:
PC with National Instruments LabVIEW 8.5.
Theory:
Clusters are implemented in a programming language as data types and the references (e.g.
relationships, links and pointers) and operations that are possible with them. Clusters group data
elements of mixed types, such as a bundle of wires, as in a telephone cable, where each wire in the
cable represents a different element of the cluster. A cluster is similar to a record or a struct in textbased programming languages. Bundling several data elements into clusters eliminates wire clutter on
the block diagram and reduces the number of connector pane terminals that subVIs need. The
connector pane has, at most, 28 terminals. If front panel contains more than 28 controls and indicators
that want to be used programmatically, group some of them into a cluster and assign the cluster to a
terminal on the connector pane.
Although cluster and array elements are both ordered, all cluster elements must be unbundled
at once rather than index one element at a time. To access specific cluster elements the Unbundle by
Name function is used. Clusters also differ from arrays in that they are a fixed size. Like an array, a
cluster is either a control or an indicator. A cluster cannot contain a mixture of controls and indicators.
Most clusters on the block diagram have a pink wire pattern and data type icon. Clusters of numerics,
sometimes referred to as points, have a brown wire pattern and data type icon. Numeric clusters can
be wired to Numeric functions, such as Add or Square Root, to perform the same operation
simultaneously on all elements of the cluster.
http://studyzone.dgpride.com
10
http://studyzone.dgpride.com
Review questions:
1. What is array? How it can be assigned?
2. Define Clusters in VI.
3. Distinguish Array and Clusters.
4. How do graphs are made in VI?
5. Mention the difference between graph and charts.
11
http://studyzone.dgpride.com
Ex. No:
Date:
Programming Exercises on case and sequence structures, file Input/output
Aim:
To understand the principles of Virtual Instrumentation Programming and learn the basics of
Case and Sequence Structures, File Input and Output
Equipments Required:
PC with National Instruments LabVIEW 8.5.
Theory:
Case structure has one or more subdiagrams, or cases, exactly one of which executes when
the structure executes. The value wired to the selector terminal determines which case to execute and
can be Boolean, string, integer, or enumerated type. Right-click on structure border to add or delete
cases. Use the Labeling tool to enter value(s) in the case selector label and configure the value(s)
handled by each case.
Sequence Structure consists of one or more subdiagrams, or frames, that execute
sequentially. Use the Flat Sequence structure to ensure that a subdiagram executes before or after
another subdiagram. Data flow for the Flat Sequence structure differs from data flow for other
structures. Frames in a Flat Sequence structure execute from left to right and when all data values
wired to a frame are available. The data leaves each frame as the frame finishes executing. This means
the input of one frame can depend on the output of another frame.
12
http://studyzone.dgpride.com
9. Now Run the VI and read the data from the text file. Also write some text on the respective box and
write it to the file.
10. Save the file with extension .vi, a virtual instrument.
Review Questions:
1. What are the difference Structures for Programming?
2. Can Boolean operation done by sequence structure?
3. Mention different file formats that can handle by File I/O functions.
4. Can image file be appended in other files using file I/O function?
5. What is need for file I/O operation in VI?
13
http://studyzone.dgpride.com
Ex. No:
Date:
Data Acquisition through Virtual Instrumentation
Aim:
To understand the principles of Data acquisition through Virtual Instrumentation presenting
the data
Equipments Required:
PC with National Instruments LabVIEW 8.5.
LabVIEW DAQmx driver
NI USB 6251
Resistor
Theory:
Definition of Data Acquisition:
Data acquisition (abbreviated DAQ) is the process of sampling of real world physical
conditions and conversion of the resulting samples into digital numeric values that can be manipulated
by a computer. Data acquisition and data acquisition systems (abbreviated with the acronym DAS)
typically involves the conversion of analog waveforms into digital values for processing. The
components of data acquisition systems include: Sensors, that convert physical parameters to
electrical signals, Signal conditioning circuitry, to convert sensor signals into a form that can be
converted to digital values, Analog-to-digital converters, which convert conditioned sensor signals to
digital values. Data acquisition begins with the physical phenomenon or physical property to be
measured. Examples of this include analog voltage, current, temperature, light intensity, gas pressure,
fluid flow, and force.
Procedure:
1. Connect the NI USB 6251 to the PC using the USB cable
2. Make sure that the NI USB is powered on.
3. NI_DAQmx driver installed on the PC automatically detects the chassis and brings up the
following window.
The device passes the self test, which means it is configured properly and ready to be used in the
LabVIEW application.
5. Open NI LabVIEW 8.5 and press <Ctrl_N> to open a blank VI.
14
http://studyzone.dgpride.com
15
http://studyzone.dgpride.com
Review Questions:
1. What is data acquisition?
2. How data acquisition done by VI?
3. Mention different types of DAQ cards used in VI.
4. What are the different data types acquired by DAQ?
5. What is the maximum analog value that can be acquired by DAQ?
16
http://studyzone.dgpride.com
Ex. No:
Date:
Developing Voltmeter using DAQ Card
Aim:
To understand the principles of Data acquisition using DAQ Cards and develop a voltmeter.
Equipments Required:
PC with National Instruments LabVIEW 8.5.
LabVIEW DAQmx driver
NI USB 6251
Voltage source
Theory:
Definition of Data Acquisition:
Data acquisition (abbreviated DAQ) is the process of sampling of real world physical
conditions and conversion of the resulting samples into digital numeric values that can be manipulated
by a computer.
Procedure:
1. Connect the NI USB 6251 to the PC using the USB cable
2. Make sure that the NI USB is powered on.
3. NI_DAQmx driver installed on the PC automatically detects the chassis and brings up the
following window.
The device passes the self test, which means it is configured properly and ready to be used in the
LabVIEW application.
5. Open NI LabVIEW 8.5 and press <Ctrl_N> to open a blank VI.
6. Press <Ctrl_T> to tile front panel and block diagram windows.
7. Pull up the Functions Palette by right_clicking on the white space on the LabVIEW block diagram
window.
8. Select Express Input palette, and click the DAQ Assist Express VI.
9. Drag DAQ Assistant VI to the block diagram, now configure window appears.
10. To configure a voltage measurement application with a DAQ, click on Analog Input Voltage,
select channel ai0, and click Finish. This adds a physical channel to the measurement task.
17
http://studyzone.dgpride.com
Review Questions:
1. What is data acquisition?
2. How voltage is acquired by VI?
3. How range of voltmeter can be extended?
4. Whether DAQ can be used as ammeter?
18
http://studyzone.dgpride.com
Date:
Developing Signal Generator using DAQ Card
Aim:
To understand the principles of signal generation using DAQ Cards and presenting the data
Equipments Required:
PC with National Instruments LabVIEW 8.5.
LabVIEW DAQmx driver
NI USB 6251
CRO
Theory:
Signal Generation using DAQ:
DAQs can be used to generate various forms of signals depending on its features and
specifications. It will be having Digital-to-Analog converters, which convert digital values to analog
signals.
Signal Generation:
A signal generator, also known as function generator, arbitrary waveform generator, or
frequency generator is an electronic device that generates repeating or non-repeating electronic
signals (in either the analog or digital domains). They are generally used in designing, testing,
troubleshooting, and repairing electronic or electroacoustic devices; though they often have artistic
uses as well. There are many different types of signal generators, with different purposes and
applications (and at varying levels of expense); in general, no device is suitable for all possible
applications. Traditionally, signal generators have been embedded hardware units, but since the age of
multimedia- PCs, flexible, programmable software tone generators have also been available.
Procedure:
1. Connect the NI USB 6251 to the PC using the USB cable
2. Make sure that the NI USB is powered on.
3. NI_DAQmx driver installed on the PC automatically detects the chassis and brings up the
following window.
19
http://studyzone.dgpride.com
The device passes the self test, which means it is configured properly and ready to be used in the
LabVIEW application.
5. Open NI LabVIEW 8.5 and press <Ctrl_N> to open a blank VI.
6. Press <Ctrl_T> to tile front panel and block diagram windows.
7. Pull up the Functions Palette by right_clicking on the white space on the LabVIEW block diagram
window.
8. Select Express Input palette, and click the DAQ Assist Express VI.
9. Drag DAQ Assistant VI to the block diagram, now configure window appears.
10. To configure a Signal generation application with a DAQ, click on Analog Output Voltage,
select ao0, and click Finish. This adds a physical channel to the measurement task.
20
http://studyzone.dgpride.com
Review Questions:
1. What are the types of signal that can be generated using VI?
2. Can Virtual Instrument used as CRO?
3. What is Arbitrary waveform generation, is it possible using VI
4. Whether signals can be stored?
5. What is the signal used to generate various types of signal in signal generator?
21
http://studyzone.dgpride.com
Ex. No:
Date:
Simulating reactor control using Virtual Instrumentation
Aim:
To simulate and understand the closed loop response of a reactor using VI
Equipment list:
Equipments Required:
PC with National Instruments LabVIEW 8.5
Theory
Reactor is one of the important processing units in industries. Control of such reactors pays
more attention in the field of measurement and instrumentation. Many controllers are available to
control the system, conventional PID controllers always gives promising responses for servo and
regulator operation. Design of controller in hardware form requires more troubleshooting, instead
virtual instrumentation can be used for controller which can greatly reduce the physical design
complexity.
22
http://studyzone.dgpride.com
Review questions:
1. What is the use of simulation loop?
2. What are the controllers that can be used for reactor control?
3. What does the function of integral controller?
4. What is servo and regulatory response?
5. What are the different types of CSTR?
23
http://studyzone.dgpride.com
Ex. No:
Date:
Real Time Temperature Control using Virtual Instrumentation
Aim:
To design an On-Off controller for a real temperature process using VI
Equipments Required
PC with National Instruments LabVIEW 8.5 with DAQmx driver
NI USB 6251
Temperature sensor (thermocuple)
Theory:
A thermocouple is created whenever two dissimilar metals touch and the contact point
produces a small open-circuit voltage as a function of temperature. This thermoelectric voltage is
known as the Seebeck voltage, named after Thomas Seebeck, who discovered it in 1821. The voltage
is nonlinear with respect to temperature. However, for small changes in temperature, the voltage is
approximately linear, or
V ST
Where V is the change in voltage, S is the Seebeck coefficient, and dT is the change in temperature.
24
http://studyzone.dgpride.com
The device passes the self test, which means it is configured properly and ready to be used in the
LabVIEW application.
5. Open NI LabVIEW 8.5 and press <Ctrl_N> to open a blank VI.
6. Press <Ctrl_T> to tile front panel and block diagram windows.
7. Pull up the Functions Palette by right_clicking on the white space on the LabVIEW block diagram
window.
8. Select Express Input palette, and click the DAQ Assist Express VI.
9. Drag DAQ Assistant VI to the block diagram, now configure window appears.
10. To configure a temperature measurement application with a thermocouple, click on Analog Input
Temperature Thermocouple, select channel ai0, and click Finish. This adds a physical channel to
the measurement task.
25
http://studyzone.dgpride.com
11. Select the thermocouple type. Change the CJC source to Built In and Acquisition Mode to
Continuous. Click the Run button. The temperature readings from the thermocouple are observed in
front panel window.
12. Click OK to close the configuration window and return to the LabVIEW block diagram.
13. Place greater than equal to comparator and less than equal to comparator from Programming
>> Comparison in the Block diagram with the set point of 40 & 20 respectively
14. Place two LEDs from Express>>LEDs in the front panel and connect those to output of
comparator functions in the block diagram.
15. Select Waveform chart to record temperature changes over a period.
16. Place a temperature indicator from Express>>Numeric indicator>>Thermometer in the Front
panel.
17. Save the file with extension .vi, a virtual instrument.
Review questions:
1. Whether additional devices needed in the circuit for temperature measurement?
2. How Thermistor is used to do the temperature measurement?
26
http://studyzone.dgpride.com
27
http://studyzone.dgpride.com
Ex. No:
Date:
Real time sequential control of bottle filling system
Aim:
To implement virtual instrumentation for sequential control such as bottle filling system
Equipment list:
PC with National Instruments LabVIEW 8.5 with DAQmx driver
NI USB 6251
Bottle filling system set up
Theory
Sequential process is one of the common operations in industries. Control of sequential
operation is equally important for many processes. There are several sequential process existing in
industries, In this study the simple bottle filling operation is considered for experiment. It is possible
for a continuous control system to be part of a discrete-state process-control system. As an example,
we consider this experiment. This system consists of a conveyor on which the bottles are placed; the
conveyor motor is controlled by VI. Periodically a bottle comes into position under the outlet valve is
opened and the bottle is filled. This requirement may be necessary to ensure a constant pressure head
during bottle filling. This process will require that a continuous-level control system be used to adjust
the input flow rate during bottle-fill through the output valve. The continuous control system will be
turned on or off just as other discrete device like motor. Thus the continuous control process is a part
of the overall discrete-state process.
Schematic of bottle filling system:
Algorithm:
The basic algorithm for bottle filling system involves the following sequence. The objective is to
fill bottles moving on a conveyor. Assume that when a command is given to stop the continuous
control system, the input valve is driven to the closed position. Then the sequence would be
A. Start the bottle Conveyor
B. When a bottle is in position:
1. Stop the conveyor
2. Open the output valve
3. Turn ON the Level-Control System to keep the level constant during Bottle Fill
C. When the bottle is full:
1. Close the output valve
2. Stop the level control System
28
http://studyzone.dgpride.com
29
http://studyzone.dgpride.com
Review questions:
1. What is meant by sequential operations?
2. What is the use of shift register in while loop?
3. Give examples of sequential process.
4. Mention the difference between parallel and sequential operations
5. What type of sensor is used to sense bottle in bottle filling system?
30
http://studyzone.dgpride.com