0% found this document useful (0 votes)
54 views65 pages

Unit 3 Full

The document provides an overview of virtual instrumentation, emphasizing its components, advantages, and the LabVIEW software used for creating virtual instruments. It discusses the architecture of virtual instruments, including sensor modules, processing modules, and user interfaces, as well as programming concepts like loops, arrays, and clusters. Additionally, it highlights the benefits of virtual instrumentation techniques such as simplification, customization, and cost-effectiveness compared to traditional instrumentation methods.
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)
54 views65 pages

Unit 3 Full

The document provides an overview of virtual instrumentation, emphasizing its components, advantages, and the LabVIEW software used for creating virtual instruments. It discusses the architecture of virtual instruments, including sensor modules, processing modules, and user interfaces, as well as programming concepts like loops, arrays, and clusters. Additionally, it highlights the benefits of virtual instrumentation techniques such as simplification, customization, and cost-effectiveness compared to traditional instrumentation methods.
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/ 65

UNIT-03

Virtual Instrumentation
Virtual Instrumentation: Graphical
programming techniques, Data types, Advantage
of Virtual Instrumentation techniques, Concept
of WHILE & FOR loops, Arrays, Clusters &
graphs, Structures: Case, Sequence & Formula
nodes, Need of software based instruments for
industrial automation.
2
Virtual Instrumentation
A virtual instrumentation system is software that is used by the
user to develop a computerized test and measurement system,
for controlling an external measurement hardware device from
a desktop computer, and for displaying test or measurement
data on panels in the computer screen. The test and
measurement data are collected by the external device
interfaced with the desktop computer. Virtual instrumentation
also extends to computerized systems for controlling processes
based on the data collected and processed by a PC based
instrumentation system.

3
Architecture of Virtual Instrumentation

A virtual instrument is composed of the following blocks:


– Sensor module
– Sensor interface
– Information systems interface
– Processing module
– Database interface
– User interface

4
5
Sensor module
The sensor module detects physical signal and transforms it into
electrical form, conditions the signal, and transforms it into a digital
form for further manipulation. The sensor module interfaces a virtual
instrument to the external, mostly analog world transforming
measured signals into computer readable form. A sensor module
principally consists of three main parts:
– The sensor
– The signal conditioning part
– The A/D converter
The sensor detects physical signals from the environment.
The signal-conditioning module performs (usually analog) signal
conditioning prior to AD conversion. This module usually does the
amplification, transducer excitation, linearization, isolation, or filtering
of detected signals.
The A/D converter changes the detected and conditioned voltage into a
digital value. 6
Sensor interface
Through a sensor interface, the sensor module communicates with a
computer. There are many interfaces used for communication
between sensors modules and the computer. According to the type of
connection, sensor interfaces can be classified as wired and wireless.

Processing module
Once the data are in a digital form on a computer, they can be
processed, mixed, compared, and otherwise manipulated, or stored in
a database. Then, the data may be displayed, or converted back to
analog form for further process control.

Database Interface
Computerized instrumentation allows measured data to be stored for
off-line processing, or to keep records as a part of the patient record.
There are several currently available database technologies that can
be used for this purpose. Many virtual instruments use DataBase.7
Management Systems (DBMSs)
They provide efficient management of data and standardized
insertion, update, deletion, and selection.

Display and control


Without the displays, knobs and switches of conventional,
external box-based instrumentation products, a virtual
instrument uses a personal computer for all user interaction
and control. In many common measurement applications, a
data acquisition board or card, with a personal computer and
software, can be used to create an instrument.

8
9
Software
A Virtual Instrument (VI) is a Lab VIEW programming element.
Lab VIEW (Laboratory Virtual Instrument Engineering Workbench)
is a graphical programming environment which has become
prevalent throughout research labs, academia and industry. It is a
powerful and versatile analysis and instrumentation software system
for measurement and automation.

A VI consists of a front panel, block diagram, and an icon that


represents the program. The front panel is used to display controls
and indicators for the user, and the block diagram contains the code
for the VI. The icon, which is a visual representation of the VI, has
connectors for program inputs and outputs. Programming languages
such as C and BASIC use functions and subroutines as programming
elements.
10
Lab VIEW uses the VI. The front panel of a VI handles the function
inputs and outputs, and the code diagram performs the work of the
VI. Multiple VIs can be used to create large scale applications; in
fact, large scale applications may have several hundred VIs. A VI
may be used as the user interface or as a subroutine in an application.
User interface elements such as graphs are easily accessed, as drag-
and drop units in Lab VIEW.

Lab VIEW programs are called virtual instruments (VIs),


because their appearance and operation imitate physical
instruments like oscilloscopes. Lab VIEW is designed to facilitate
data collection and analysis, as well as offers numerous display
options. With data collection, analysis and display combined in
a flexible programming environment, the desktop computer
functions as a dedicated measurement device. Lab VIEW
contains a comprehensive set of VIs and functions for acquiring,
analyzing, displaying, and storing data, as well as tools to
troubleshoot code. 11
Software Environment

There are three steps to create our application in the software


environment:
● Design a user interface
● Draw our graphical code
● Run our program
A virtual instrument (VI) has three main components—the front
panel, the block diagram and the icon/connector pane.

THE FRONT PANEL

When a blank VI is opened, an untitled front panel window appears.


This window displays the front panel and is one of the two Lab
VIEW windows used to build a VI. The front panel is the window
through which the user interacts with the program
12
The input data to the executing program is fed through the front panel
and the output can also be viewed on the front panel, thus making it
indispensable. One of the most powerful features that Lab VIEW
offers engineers and scientists is its graphical programming
environment to design custom virtual instruments by creating a
graphical user interface on the computer screen to
● Operate the instrumentation program
● Control selected hardware
● Analyze acquired data
● Display results
The front panel can include knobs, push buttons, graphs and various
other controls (which are user inputs) and indicators (which are
program outputs). Controls are inputs used to simulate instrument
input devices and supply data to the block diagram of the VI, and
indicators are outputs displays used to simulate instrument output
devices and display data the block diagram acquires or
generates.
13
The front panel is customized to emulate control panels of traditional
instruments, create custom test panels, or visually represent the
control and operation of processes.

BLOCK DIAGRAM

The block diagram window holds the graphical source code of a Lab
View’s block diagram corresponds to the lines of text found in a more
conventional language like C or BASIC – it is the actual executable
code. The block diagram can be constructed with the basic blocks
such as: terminals, nodes, and wires.
The components of a block diagram are lower-level VIs, built-in
functions, constants and program execution control structures. Wires
have to be drawn to connect the corresponding objects together to
indicate the flow of data between each of them. Front panel objects
have analogous terminals on the block diagram so that data can pass
easily from the user to the program and back to the user.
14
Use Express VIs, standard VIs and functions on the block diagram to
create our measurement code. Block diagram objects include the
terminals, sub VIs, functions, constants, structures and wires.

Icon/Connector Pane

To use a VI as a sub VI, it must have an icon and a connector pane.


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. The icon can contain both text and images. To use a VI as a sub
VI, you need to build a connector pane. The connector pane is a set
of terminals that correspond to the controls and indicators of that VI.

15
The various windows associated with Lab VIEW is summarized
below:
•FRONT PANEL TOOLBAR
•BLOCK DIAGRAM TOOLBAR
•PALETTES
•Tools Palette
•Front Panel—Controls Palette
•Block Diagram—Functions Palette
•FRONT PANEL CONTROLS AND INDICATORS

16
17
18
19
20
21
Advantages of Lab VIEW
The following are the advantages of Lab VIEW:
● Graphical user interface: Design professionals use the drag-and-
drop user interface library By interactively customizing the hundreds
of built-in user objects on the controls palette.
● Drag-and-drop built-in functions: Thousands of built-in
functions and IP including analysis and I/O, from the functions
palette to create applications easily.
● Modular design and hierarchical design: Run modular Lab
VIEW VIs by themselves or as SubVIs and easily scale and
modularize programs depending on the application.
● Multiple high level development tools: Develop faster with
application specific development tools, including the Lab VIEW
State chart Module, Lab VIEW Control Design and Simulation
Module and Lab VIEW FPGA Module.

22
● Professional Development Tools: Manage large, professional
applications and tightly integrated project management tools;
integrated graphical debugging tools; and standardized source
code control integration.

23
DATA Types
Data types indicate what objects, inputs and outputs you can wire
together. For example, if a switch has a green border, you can wire a
switch to any input with a green label on an Express VI. If a knob has
an orange border, you can wire a knob to any input with an orange
label. However, you cannot wire an orange knob to an input with a
green label. Notice the wires are the same color as the terminal. The
dynamic data type stores the information generated or acquired by an
Express VI. The dynamic data type appears as a dark blue terminal.
Most Express VIs accept and/or return the dynamic data type. You
can wire the dynamic data type to any indicator or input that accepts
numeric, waveform or Boolean data. Wire the dynamic data type to
an indicator that can best present the data. Indicators include a graph,
chart or numeric indicator.

24
Advantages of Virtual Instrumentation Techniques
➢Simplification:
Suppose you want to check out an electronic circuit,by noting its
response to a test signal. You will need a Signal Generator, an
oscilloscope and the necessary accessories. And take the readings.With a
computer based testing system, one can have the complete system
integrated to a single application and the user can do the required testing
operating from a easy to use graphical user interface(GUI).That makes
the things easy to work , simplifying the process.
➢Customization:
With the conventional test devices like function generators or
oscilloscopes the scope for customization is very limited. Since the
software forms the element of the instrumentation in the virtual
instrumentation, it offers the scope of customizing the testing
applications to the user’s needs. This is a very important advantage since,
many of the times there exists the need for custom made testing in the
25
science and engineering.
➢Cost Advantage:
There is definitely a cost advantage compared to the traditional
instrumentation, because the applications can be easily customized and
the programming can be carried out so that the single application can
replace multiple devices (which may be required otherwise).

➢Computer Based:
Virtual instrumentation takes advantage of the ever evolving computer
technology - the increasing processing speeds,the easy device interface
options, larger memory and so on.Hence enhancing the application
performance and development process.

➢Portability:
Portability is an essential feature some times.The virtual instrumentation
based applications are powerful and compact so that they can be easily
set up and easy to carry.
26
For example, one needs to carry out an engine testing by simulating
certain conditions, the complete signal set to and fro from the engine
under test can be interface to something like laptop through an USB
interface and the testing can be controlled through an application
program executing on the computer. so carrying a simple laptop and
the USB interface is sufficient. This is a great feature,when you need
a good number of systems interfaced during, say, some system testing
applications.

27
Concept of For loops:

A For Loop is a structure you use to execute a block of code a


set number of times. When the VI runs, the iteration count is
evaluated, and then the code is executed.

A For Loop can be configured to conditionally stop code


execution in addition to its iteration-based exit. In these cases,
the code will execute until the count terminal setting is
reached or the condition is met – whichever happens first.

28
29
Concept of While loops:

A While Loop is structure you use to execute a block of


code repeatedly until a given condition is met. When the VI
runs, the code inside the While Loop executes, and then the
terminal condition is evaluated.

Unlike a For Loop, While Loop execution does not depend


on iteration count; thus, a While Loop executes indefinitely
if the condition never occurs.

30
31
Lab VIEW Arrays and Clusters
An array, which consists of elements and dimensions, is either a control
or an indicator – it cannot contain a mixture of controls and indicators.
Elements are the data or values contained in the array. A dimension is the
length, height, or depth of an array. Arrays are very helpful when you are
working with a collection of similar data and when you want to store a
history of repetitive computations.
Array elements are ordered. Each element in an array has a
corresponding index value, and you can use the array index to access a
specific element in that array. In NI Lab VIEW software, the array index
is zero-based. This means that if a one-dimensional (1D) array contains n
elements, the index range is from 0 to n – 1, where index 0 points to the
first element in the array and index n – 1 points to the last element in the
array.

32
Clusters group data elements of mixed types. An example of a cluster is
the Lab VIEW error cluster, which combines a Boolean value, a
numeric value, and a string. A cluster is similar to a record or a struct in
text-based programming languages.
Similar to arrays, a cluster is either a control or an indicator and cannot
contain a mixture of controls and indicators. The difference between
clusters and arrays is that a particular cluster has a fixed size, where a
particular array can vary in size. Also, a cluster can contain mixed data
types, but an array can contain only one data type.

33
Creating Array Controls and Indicators
To create an array in Lab VIEW, you must place an array shell on the
front panel and then place an element, such as a numeric, Boolean, or
waveform control or indicator, inside the array shell.
➢Create a new VI.
➢Right-click on the front panel to display the Controls palette.
➢On the Controls palette, navigate to Modern » Array, Matrix, &
Cluster and drag the Array shell onto the front panel.

34
➢On the Controls palette, navigate to Modern » Numeric and drag and
drop a numeric indicator inside the Array shell

➢Place your mouse over the array and drag the right side of the array to
expand it and display multiple elements.

35
To create a 2D array, you must first create a 1D array and then add a
dimension to it. Return to the 1D array you created earlier.
➢ On the front panel, right-click the index display and select Add
Dimension from the shortcut menu.

36
➢Place your mouse over the array and drag the corner of the array to
expand it and display multiple rows and columns.

37
Creating Clusters

➢ Create a new VI.


➢ Right-click on the front panel to display the Controls palette.
➢ On the Controls palette, navigate to Modern » Array, Matrix, &
Cluster and drag the Cluster shell onto the front panel.

38
➢Resize the Cluster shell so that it is big enough to contain multiple
elements.

➢On the Controls palette, navigate to Modern » Numeric and drag and
drop a numeric control inside the Cluster shell.

39
➢On the Controls palette, navigate to Modern » String & Path and
drag and drop a String Control inside the Cluster shell.

➢On the Controls palette, navigate to Modern » Boolean and drag and
drop a Vertical Toggle Switch inside the Cluster shell

40
➢Your cluster should now look similar to the one shown below.

You can now wire the numeric, string, and Boolean controls throughout
the block diagram with one wire rather than three separate wires.

41
Graphs and Charts
Lab VIEW includes the following types of graphs and charts:
Waveform Graphs and Charts—Display data typically acquired at a
constant rate.
XY Graphs—Display data acquired at a non-constant rate and data
for multi valued functions.
Intensity Graphs and Charts—Display 3D data on a 2D plot by
using colour to display the values of the third dimension.
Digital Waveform Graphs—Display data as pulses or groups of
digital lines.
Mixed Signal Graphs—Display data types accepted by waveform
graphs, XY graphs, and digital waveform graphs. Also accept clusters
that contain any combination of those data types.
2D Graphs—Display 2D data on a 2D front panel plot.
3D Graphs—Display 3D data on a 3D front panel plot.
42
Structure in Lab VIEW
A structure is defined as a graphical representation of a loop ( i.e., a
loop is nothing but a set of code blocks that are executed based on the
condition match). In reality, structures have control over the execution
flow within a Virtual Instrument (VI).
There are different types of structures available within Lab VIEW

Case Structure:

Case structures are widely used in the scenarios where the program or
the users have to take a decision. The decision is categorized into two
options, i.e. True or False.
At any point of execution, only one condition (or case, i.e. True or
False) will be executed.

43
The case structure functionality is explained with a block
diagram below:
➢Firstly, draw the cases so that it has a true value and also a
false value.
➢This can be selected from the main menu of case structure
within Lab VIEW.
➢Within this explanation, we will be calculating the log
value and we want the case structure to monitor only for
positive values.
➢The true condition block diagram is shown below where
the user will have an option to enter a value in ‘X’ from the
front end of Lab VIEW ( which can be seen on the left-hand
side of the block diagram).

44
False condition case block diagram is shown below:

45
Execute the above program in Lab VIEW by entering a positive value
from the front end of Lab VIEW and after that, enter a negative value
from the front end of the Lab VIEW.
In this case, the result of a true condition case structure is displayed in
the front panel of Lab VIEW.

46
The result shows a negative value within the front panel of Lab VIEW.

47
Sequence Structure:
A sequence structure contains one or more sub diagrams, or
frames, that execute in sequential order. Within each frame of
a sequence structure, as in the rest of the block diagram, data
dependency determines the execution order of nodes.
Sequence structures are not used commonly in Lab VIEW.
Use the sequence structures to control the execution order
when natural data dependency does not exist and flow-
through parameters are not available. There are two types of
sequence structures— the Flat Sequence structure and the
Stacked Sequence structure

48
•Flat Sequence Structure:
The Flat Sequence structure, shown as follows, displays all the frames at
once and executes the frames from left to right and when all data values
wired to a frame are available, until the last frame executes. The data
values leave each frame as the frame finishes executing.
Use the Flat Sequence structure to avoid using sequence locals and to
better document the block diagram. When you add or delete frames in a
Flat Sequence structure, the structure resizes automatically.

49
To convert a Flat Sequence structure to a Stacked Sequence structure,
right-click the Flat Sequence structure and select Replace with Stacked
Sequence from the shortcut menu. If you change a Flat Sequence to a
Stacked Sequence and then back to a Flat Sequence, Lab VIEW moves
all input terminals to the first frame of the sequence. The final Flat
Sequence should operate the same as the Stacked Sequence. After you
change the Stacked Sequence to a Flat Sequence with allinput terminals
on the first frame, you can move wires to where they were located in the
original Flat Sequence.

•Stacked Sequence Structure:

The Stacked Sequence structure, shown as follows, stacks each frame so


you see only one frame at a time and executes frame 0, then frame 1, and
so on until the last frame executes.
50
The Stacked Sequence structure returns data only after the last frame
executes. Use the Stacked Sequence structure if you want to conserve
space on the block diagram. To convert a Stacked Sequence structure to a
Flat Sequence structure, right-click the Stacked Sequence structure and
select Replace » Replace with Flat Sequence from the shortcut menu.
The sequence selector identifier, shown as follows, at the top of the
Stacked Sequence structure contains the current frame number and range
of frames.

51
Use the sequence selector identifier to navigate through the available
frames and rearrange frames. The frame label in a Stacked Sequence
structure is similar to the case selector label of the Case structure. The
frame label contains the frame number in the center and decrement and
increment arrows on each side. Click the decrement and increment
arrows to scroll through the available frames. You also can click the
down arrow next to the frame number and select a frame from the pull-
down menu. Right-click the border of a frame, selects Make This Frame,
and select a frame number from the shortcut menu to rearrange the order
of a Stacked Sequence structure. Unlike the case selector label, you
cannot enter values in the frame label. When you add, delete, or
rearrange frames in a Stacked Sequence structure, Lab VIEW
automatically adjusts the numbers in the frame labels.

To pass data from one frame to any subsequent frame of a Stacked


Sequence structure, use a sequence local terminal shown.
where you wired the sequence local.
52
An outward-pointing arrow appears in the sequence local terminal of
the frame that contains the data source. The terminal in subsequent
frames contains an inward-pointing arrow, indicating that the terminal is
a data source for that frame. You cannot use the sequence local terminal
in frames that precede the first frame.

•Formula Node:
The Formula Node in Lab VIEW software is a convenient, text-based
node you can use to perform complicated mathematical operations on a
block diagram using the C- syntax structure. It is most useful for
equations that have many variables or are otherwise complicated.
The text-based code simplifies the block diagram and increases its
readability. Furthermore, you can copy and paste existing code directly
into the Formula Node rather than recreating it graphically. The
Formula Node is available in all development versions of Lab VIEW
and does not require an additional toolkit or add-on.
53
This tutorial is useful for familiarizing yourself with the Formula Node.
Follow the steps to create a simple structure to compute different
formulas depending on input values. Then, compare the simplicity of
your block diagram using a formula node to its counterpart using
graphical programming. The Formula Node is a tool that allows the
benefits of text-based code within the easy-to-use graphical Lab VIEW
architecture.
➢Selecting File » New VI to open a blank VI.
➢Place a Formula Node on the block diagram.
•Right-click on the diagram and navigate to Programming
»Structures » Formula Node.
•Left-click to select the Formula Node.
•Place the Formula Node on the block diagram by left-clicking,
dragging, and releasing the mouse.
➢Right-click the border of the Formula Node and select Add
Input from the shortcut menu.
➢Label the input variable x.
54
➢Repeat steps 3 and 4 to add another input and label it y.

➢Right-click the border of the Formula Node and select Add


Output from the shortcut menu.

55
➢Label the output z1.
➢Repeat step 5 to create another output, and label this output z2.

56
➢Enter the expressions below in the Formula Node.
•Make sure that you complete each command with a semicolon.
Notice, however, that the if-statement does not require a semicolon
on the first line.
If (x*y>0)
z1 = 3*x**2 - 2*y**3;
else z1 = 0;
z2 = sinh(z1);
➢Create controls and indicators for the inputs and outputs.
•Right-click on each input and select Create » Control from the
shortcut menu.
•Right-click on each output and select Create » Indicator from the
shortcut menu.
Note that you can change the control and indicator names to their
respective variable by editing their labels

57
➢Place a While Loop With Button around the Formula Node and the
controls.
➢Add a Wait (ms) function inside the loop to conserve memory usage,
and wire in 100 milliseconds as a wait time. Your block diagram should
appear as follows:
58
➢Click the Run button to run the VI. Change the values of the input
controls to see how the outputs change.
In this case, the Formula Node helps minimize the space required on
the block diagram. Accomplishing the same task without the use of a
Formula Node requires the following code:

59
60
Need of software based instruments for Industrial
Automation
➢Programmable Logic Controller (PLC):

A PLC is a ruggedized, digital industrial computer control


system that is pre-programmed to carry out automatic
operations in industrial processes. The PLC continuously
monitors and receives information from input devices or
sensors, processes the information, and triggers the connected
output devices, to complete the task in the industrial process
or machinery.

61
62
➢Supervisory Control and Data Acquisition (SCADA):
SCADA systems control and monitor industrial processes. The system
acquires and processes real-time data through direct interaction with
devices, such as sensors and PLCs, and records events into a log file.
SCADA is important for data analysis, and enables effective decision-
making for optimization in industrial processes.

63
➢Human Machine Interface (HMI):

An HMI is a software application that enables interaction and


communication between a human operator and the machine, or
production system. It translates complex data into accessible
information, enabling better control of the production process and its
various applications.

➢Artificial Neural Network (ANN):

An ANN is a computing system that is built like the human brain, a


network of interconnected neuron nodes. ANNs simulate the way a
human brain analyzes and processes information.

64
➢Distributed Control System (DCS):

A DCS is a central monitoring network that interconnects devices to


control different elements within an automated system.

➢Robotics:

Robots can efficiently perform tasks in complicated or dangerous


situations, improve production flow and quality, and increase safety
for employees. Additionally, robots can make daily life much more
comfortable

65
Thank You

66

You might also like