Post on 16-Oct-2021
EI2357 - Virtual Instrumentation Laboratrory Manual
1
INDEX
Sl. No
Exp. Date Name of the Experiment Date of
submission Page No.
Marks Staff Sign
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
2
List of experiments
University Syllabus
EI2357 - VIRTUAL INSTRUMENTATION LAB
1. Creating Virtual Instrumentation for simple applications
2. Programming exercises for loops and charts
3. Programming exercises for clusters and graphs.
4. Programming exercises on case and sequence structures, file Input / Output.
5. Data acquisition through Virtual Instrumentation.
6. Developing voltmeter using DAQ cards.
7. Developing signal generator using DAQ cards.
8. Simulating reactor control using Virtual Instrumentation.
9. Real time temperature control using Virtual Instrumentation.
10. Real time sequential control of any batch process.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
3
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.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
4
Functions Palette Controls Palette
Fig. Front Panel of Virtual Instrumentation.vi
Fig. Block Diagram of Virtual Instrumentation.vi
LabVIEW Palettes LabVIEW palettes give provide the options needed 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. By selecting 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.
The Tools palette can be placed anywhere on the screen. If automatic tool selection is enabled and as the cursor is moved over objects on the front panel or block diagram, LabVIEW automatically selects
the corresponding tool from the Tools palette.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
5
The Controls palette The Controls palette is available only on the front panel. The Controls palette contains the
controls and indicators used to create the front panel. to display the Controls palette, Select Window »
Show Controls Palette or right-click the front panel workspace. The Controls palette can be placed
anywhere on the screen. The Functions palette
The Functions palette is available only on the block diagram. The Functions palette contains
the VIs and functions used to build the block diagram. To display the Functions palette, select Window » Show Functions Palette or right-click the block diagram workspace. The Functions palette
can be placed 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.
Procedure: 1. Open NI LabVIEW 8.5 and press <Ctrl_N> to open a blank VI.
2. Press <Ctrl_T> to tile front panel and block diagram windows.
3. Pull up the Functions Palette by right clicking on the white space on the LabVIEW block diagram window.
4. Then click Express palette.
5. Select the Simulate Signal function and drag it to the block diagram. The Configuration screen will appear and click OK.
6. Select Programming » Structures »While Loop and draw a loop covering the Simulate Signal:
7. Pull up the Controls Palette by right clicking on the Front panel.
8. Select Express » Numeric Controls »Knob and drop on the front panel. 9. Repeat it to have two knobs on the front panel and name Amplitude and Frequency.
10. Now connect the controls to the respective input terminals of the Simulate Signal in the Block
Diagram 11. Select Express » Graph Indicators » Waveform Graph and drop in the front panel.
12. Connect the output terminal of the Simulate Signal to the input of Graph.
13. Now click Run from front panel or block diagram and observe the Sine Wave Generated in the
front panel. 14. Vary the Frequency, Amplitude in the front panel and observe the corresponding sinusoidal
waveform.
15. Save the file with extension “.vi”, a virtual instrument.
Result:
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.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
6
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.
Block diagram- for loop
While Loop While Loop executes a subdiagram until a condition is met. The While Loop executes the
subdiagram until the conditional terminal, an input terminal, receives a specific Boolean value. The
default behavior and appearance of the conditional terminal is Continue If True. When a conditional terminal is Continue If True, the While Loop executes its subdiagram until the conditional terminal
receives a FALSE value. To change the behavior and appearance of the conditional terminal, right-
click on the terminal and select Stop If True. When a conditional terminal is Stop If True, the While
Loop executes its subdiagram until the conditional terminal receives a TRUE value. Because the VI checks the conditional terminal at the end of each iteration, the While Loop always executes at least
one time. The VI is broken if the conditional terminal is not wired.
Basic error handling can be performed using the conditional terminal of a While Loop. When an error cluster s wired to the conditional terminal, only the TRUE or FALSE value of the status
parameter of the error cluster passes to the terminal. Also, the Stop If True and Continue If True
shortcut menu items change to Stop If Error and Continue while Error. 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.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
7
Block diagram- while loop
Procedure:
1. Open NI LabVIEW 8.5 and press <Ctrl_N> to open a blank VI.
2. Press <Ctrl_T> to tile front panel and block diagram windows.
3. Pull up the Functions Palette by right_clicking on the white space on the LabVIEW block diagram window.
4. Select Programming>>Structures>>For Loop and drop in the Block Diagram.
5. Right click on count terminal (N) of loop and select create constant. 5. Select Programming>>Numeric>>Add and place it inside the loop in the Block Diagram.
6. Right click any one of the input terminal and select create constant and set it to 1.
7. For Time Delay select Programming>>Timing>>Wait(ms) and give 100 ms delay. 8. For the feedback node take the output from the adder and connect it to the other input.
9. Select indicator from Express>>Numeric Indicator and place in the front panel.
10. Place waveform graph in the front panel f rom Express>>Graph indicators.
11. Connect indicator and chart to the output of adder in the Block Diagram. 12. Repeat the procedure for While Loop and make the Block Diagram.
13. Now Run the VI and observe the numeric data and the Chart for both For Loop and While Loop.
14. Save the file with extension “.vi”, a virtual instrument.
Fig. Front Panel of Loops and Charts.vi
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
8
Fig. Block Diagram of Loops and Charts.vi
Result:
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?
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
9
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 text-based 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.
Block diagram- clusters
Cluster elements have a logical order unrelated to their position in the shell. The first object placed in the cluster is element 0, the second is element 1, and so on. If an element is deleted, the
order adjusts automatically. The cluster order determines the order in which the elements appear as
terminals on the Bundle and Unbundle functions on the block diagram. The cluster order can be viewed and modified by right-clicking the cluster border and selecting Reorder Controls in Cluster
from the shortcut menu.
To wire clusters, both clusters must have the same number of elements. Corresponding
elements, determined by the cluster order, must have compatible data types. For example, if a double-precision floating-point numeric in one cluster corresponds in cluster order to a string in the other
cluster, the wire on the block diagram appears broken and the VI does not run. If numeric of different
representations, LabVIEW coerces them to the same representation. Use the Cluster functions located on the Functions»Cluster palette to create and manipulate clusters, such as the following tasks:
• Extract individual data elements from a cluster.
• Add individual data elements to a cluster.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
10
• Break a cluster out into its individual data elements.
Graphs Graphs display only the most recent array of values written to them and do not have a history
of data. Graphs and charts differ in the way they display and update data. VIs with graphs usually
collect the data in an array and then plot the data to the graph, which is similar to a spreadsheet that
first stores the data then generates a plot of it. In contrast, a chart appends new data points to those already in the display. On a chart, the current reading or measurement in context with data previously
acquired can be viewed.
Procedure: 1. Open NI LabVIEW 8.5 and press <Ctrl_N> to open a blank VI.
2. Press <Ctrl_T> to tile front panel and block diagram windows.
3. Pull up the Functions Palette by right clicking on the white space on the LabVIEW block diagram window.
4. Select Programming>>Cluster, Class & Variant>>Cluster Constant
5. Give different data types like Arrays, Numerics and Strings and build two cluster data.
6. Use Bundle and Unbundle functions to split the data and build Block Diagram as shown. 7. Now Run the VI and observe the cluster results in both data types and the waveform Graph which
plots the result of the two arrays.
8. Save the file with extension “.vi”, a virtual instrument.
Fig. Front Panel of Clusters and Graphs.vi
Fig. Block Diagram of Clusters and Graphs.vi
Result:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
11
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.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
12
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.
Block Diagram File input/output
File Input and Output functions used for writing into and reading from various file formats
can used in various zones of Virtual Instrumentation for data logging, plotting, displaying and
reporting.
Procedure:
1. Open NI LabVIEW 8.5 and press <Ctrl_N> to open a blank VI.
2. Press <Ctrl_T> to tile front panel and block diagram windows.
3. Pull up the Functions Palette by right clicking on the white space on the LabVIEW block diagram window.
4. Select Programming>>Structures>>While loop in the block diagram.
5. Select Programming>>Structures>> Case Structure and place it inside while loop 6. Select Programming>>Structures>>Sequence Structure and place it inside case structure
7. Select Programming>>File I/O and select different functions like Write to Text file, Read from
Text file, Close File etc, inside sequence structure 8. Use the Strip Path and Build Path functions to make the path and draw the Block Diagram as
shown.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
13
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.
Fig. Front Panel of Structures and File IO.vi
Fig. Block Diagram of Structures and File IO.vi
Result:
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?
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
14
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.
Data acquisition Pop up window
4. Click on Configure and Test This Device to open Measurement & Automation Explorer
(MAX) to view the connected devices, if not detected repeat steps1 to 3.
Note: To test the device
Devices and Interfaces section under My System shows all the National Instruments devices
installed and configured on the PC. The NI_DAQmx Devices folder shows all the NI_DAQmx
compatible devices. By default, the NI USB DAC shows up with the name.
This section of MAX also shows the installed modules as well as empty slots in the DAQ.
Right_click on NI USB DAC and click on Self_Test.
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.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
15
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 resistance measurement application with a DAQ, click on Analog Input»Resistance,
select channel ai0, and click Finish. This adds a physical channel to the measurement task.
DAQ Configure window
11. Click OK to close the Express block configuration window to return to the LabVIEW block diagram.
12. Connect given resistor to the analog input channel of the DAQ card.
13. Click the Run button, resistance reading is observed in the front panel window.
14. Save the file with extension “.vi”, a virtual instrument.
Fig. Front Panel of Data Acquisition.vi
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
16
Fig. Block Diagram of Data Acquisition.vi
Result:
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?
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
17
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.
Data acquisition Pop up window
4. Click on Configure and Test This Device to open Measurement & Automation Explorer
(MAX) to view the connected devices, if not detected repeat steps1 to 3. Note: To test the device
Devices and Interfaces section under My System shows all the National Instruments devices
installed and configured on the PC. The NI_DAQmx Devices folder shows all the NI_DAQmx
compatible devices. By default, the NI USB DAC shows up with the name.
This section of MAX also shows the installed modules as well as empty slots in the DAQ.
Right_click on NI USB DAC and click on Self_Test.
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.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
18
DAQ configure window
11. Click OK to close the Express block configuration window to return to the LabVIEW block diagram.
12. Connect the voltage source to the analog input channel of the DAQ card.
13. Click the Run button. The voltage readings set in the source can be viewed in front panel window.
14. Save the file with extension “.vi”, a virtual instrument.
Fig. Block Diagram of Voltmeter.vi
Fig. Front Panel of Voltmeter.vi
Result:
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?
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
19
5. Why resistor is connected in parallel for voltage measurement?
Ex. No: 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.
Data acquisition Pop up window
4. Click on Configure and Test This Device to open Measurement & Automation Explorer
(MAX) to view the connected devices, if not detected repeat steps1 to 3. Note: To test the device
Devices and Interfaces section under My System shows all the National Instruments devices
installed and configured on the PC. The NI_DAQmx Devices folder shows all the NI_DAQmx
compatible devices. By default, the NI USB DAC shows up with the name.
This section of MAX also shows the installed modules as well as empty slots in the DAQ.
Right_click on NI USB DAC and click on Self_Test.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
20
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.
DAQ configure window
11. Click OK to close the Express block configuration window to return to the LabVIEW block
diagram.
12. Connect the CRO to the analog output channel of the DAQ card.
13. Click the Run button. The signal generated in LabVIEW is viewed in CRO. 14. Save the file with extension “.vi”, a virtual instrument.
Fig. Front Panel of Signal Generation.vi
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
21
Fig. Block Diagram of Signal Generation.vi
Result:
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?
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
22
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.
Block Diagram- Simulation loop
Procedure:
1. Open NI LabVIEW 8.5 and press <Ctrl_N> to open a blank VI.
2. Press <Ctrl_T> to tile front panel and block diagram windows. 3. Pull up the Functions Palette by right_clicking on the white space on the LabVIEW block diagram
window.
4. Select Control Design and Simulation>> Simulation>> Simulation loop
5. Place Step input from Control Design and Simulation>> Simulation>> signal generation.
6. Place blocks Derivative, Integrator, Transfer function, Transport delay from Control Design and
Simulation>> Simulation>> continuous
7. Place gain & summation block from Control Design and Simulation>> Simulation>> signal
arithmetic.
8. Select simulation time waveform from Control Design and Simulation>> Simulation>> graph
utilities. 9. Connect respective terminals in the blocks.
9. Right click on proportional and integral blocks, configuration>> select parameter >>parameter
source and change to terminal.
10. Now Run the VI and observe the waveform Graph which plots the response of the reactor. 11. Save the file with extension “.vi”, a virtual instrument.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
23
Fig. Block Diagram of reactor control.vi
Fig. Front Panel of Reactor control.vi
Result:
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?
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
24
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 ≈ SΔT
Where ΔV is the change in voltage, S is the Seebeck coefficient, and dT is the change in temperature.
Figure 1. J-Type Thermocouple
Several types of thermocouples are available, and different types are designated by capital letters that
indicate their composition according to American National Standards Institute (ANSI) conventions.
For example, a J-type thermocouple has one iron conductor and one constantan (a copper-nickel alloy) conductor. Other types of thermocouples include B, E, K, N, R, S, and T.
To measure a thermocouple Seebeck voltage, simple connection between the thermocouple
and a voltmeter or other measurement system is not enough, because connecting the thermocouple wires to the measurement system creates additional thermoelectric circuits known as cold junctions.
Thermocouples require some form of temperature reference to compensate for the unwanted
parasitic "cold" junctions. The most common method is to measure the temperature at the reference
junction with a direct-reading temperature sensor and subtract the parasitic junction voltage contributions. This process is called cold-junction compensation.
The voltage, a data acquisition system measures, depends only on the thermocouple type, the
thermocouple voltage, and the cold-junction temperature. The measured voltage is in fact independent of the composition of the measurement leads and the cold junctions.
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.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
25
Data acquisition Pop up window
4. Click on Configure and Test This Device to open Measurement & Automation Explorer
(MAX) to view the connected devices, if not detected repeat steps1 to 3.
Note: To test the device
Devices and Interfaces section under My System shows all the National Instruments devices
installed and configured on the PC. The NI_DAQmx Devices folder shows all the NI_DAQmx compatible devices. By default, the NI USB DAC shows up with the name.
This section of MAX also shows the installed modules as well as empty slots in the DAQ.
Right_click on NI USB DAC and click on Self_Test.
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.
DAQ Configure window
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
26
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.
Fig. Front panel of temperature on off control.vi
Fig. Block diagram of temperature on off control.vi
Result:
Review questions:
1. Whether additional devices needed in the circuit for temperature measurement?
2. How Thermistor is used to do the temperature measurement?
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
27
3. Define seebeck effect.
4. What is a cold junction in thermocouple? 5. What is meant by positive temperature coefficient?
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
28
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
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
29
D. Go to Step A and Repeat
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.
Data acquisition Pop up window
4. Click on Configure and Test This Device to open Measurement & Automation Explorer
(MAX) to view the connected devices, if not detected repeat steps1 to 3. 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. Click on Analog Input »Voltage, select channel ai0, and click Finish, to sense bottle.
11. Click OK to close the Express block configuration window to return to the LabVIEW block
diagram.
12. Repeat steps 7 to 11, now select channel ai1, and click Finish, to sense conveyor status. 13. Repeat steps 7 to 9, Click on Analog Output>> Voltage, select channel ao0, to control the
conveyor.
14. Connect the blocks in Block diagram panel with appropriate input and output. 15. Make necessary connection from DAQ card to the bottle filling setup
15. Click the Run button. The sequence operation is executed.
16. Save the file with extension “.vi”, a virtual instrument.
Fig. Front Panel of bottle filling system.vi
www.Vidyarthiplus.com
www.Vidyarthiplus.com
EI2357 - Virtual Instrumentation Laboratrory Manual
30
Fig. Block Diagram of bottle filling system.vi
Result:
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?
www.Vidyarthiplus.com
www.Vidyarthiplus.com