Mod 3 Virtual Instrumentation
Mod 3 Virtual Instrumentation
Virtual Instrumentation
Virtual Instrumentation:
• Virtual instrumentation combines mainstream commercial technologies, such as the PC,
with flexible software and a wide variety of measurement and control hardware.
• Engineers use virtual instrumentation to bring the power of flexible software and PC
technology to test, control and design applications making accurate analog and digital
measurements.
• Engineers and scientists can create user-defined systems that meet their exact application
needs.
• Industries with automated processes, such as chemical or manufacturing plants use virtual
instrumentation with the goal of improving system productivity, reliability, safety,
optimization and stability.
Application Software: Most people think immediately of the application software layer. This is
the primary development environment for building an application.
Test and Data Management Software: Above the application software layer the test executive
and data management software layer. This layer of software incorporates all of the functionality
developed by the application layer and provides system-wide data management.
Figure shows the general architecture of a virtual instrument. 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. Through a sensor interface, the sensor module communicates with
a computer. 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. Virtual instruments are often
integrated with some other information systems. In this way, the configuration settings and the
data measured may be stored and associated with the available records.
Sensor Module
The sensor module performs signal conditioning and transforms it into a digital form for further
manipulation. Once the data are in a digital form on a computer, they can be displayed,
processed, mixed, compared, stored in a database, or converted back to analog form for further
process control. The database can also store configuration settings and signal records. 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. If the parameter being measured is not
electrical, the sensor must include a transducer to convert the information to an electrical signal,
for example, when measuring blood pressure.
The A/D converter changes the detected and conditioned voltage into a digital value. The
converter is defined by its resolution and sampling frequency. The converted data must be
precisely time-stamped to allow later sophisticated analyses.
Sensor Interface
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.
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.
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. 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.
The iteration terminal contains the current number of completed loop iterations; 0 during the first
iteration, 1 during the second, and so on, up to N-1 (where N is the number of times the loop
executes).
The For Loop is located on the Functions>>Programming>>Structures Palette. Select the For
Loop from the palette and use the cursor to drag a selection rectangle to create a new For Loop
or around the section of the block diagram you want to repeat. You also can place a While Loop
on the block diagram, right-click the border of the While Loop, and select Replace with For
Loop from the shortcut menu to change a While Loop to a For Loop.
Array:
A group of homogeneous elements of a specific data type is known as an array.
Arrays hold a sequence of data elements, usually of the same size and same data
type placed in contiguous memory locations.
Individual elements are accessed by their position in the array.
The position is given by an index, which is also called as subscript
Some arrays are multi-dimensional; generally one and two dimensional arrays are
the most common.
Can build arrays of numeric, Boolean, path, string and cluster data types.
Array Controls
Create an array control or indicator on the front panel by placing an array on the front
panel and dragging a data object or element, which can be numeric, Boolean, string.
Array shell can be selected from Controls > Modern > Arrays, Matrix and Clusters
palette
The array elements must be controls or indicators.
2D Arrays
A 2D arrays stores elements in a grid.
It requires a column index and a row index to locate an element both of which are zero-
based.
To create a 2D array on the front panel, right click the index display of the array and
select Add Dimension from the shortcut menu.
Array Functions:
Array functions are used to create and manipulate arrays.
Common array operations such as Extracting individual data elements from an array,
inserting, deleting or replacing data elements using array functions.
Array functions including Index Array, Replace Array Subset, Insert Into Array,
Delete From Array and Array Subset
Case Structure:
A case structure executes one sub diagram depending on the input value passed to the structure.
Complete the following steps to create a Case structure.
1. Place a Case structure on the block diagram.
2. Wire an input value to the selector terminal to determine which case executes. You must
wire an integer, Boolean value, string, or enumerated type value to the selector terminal.
You also can wire an error cluster to the selector terminal to handle errors.
3. Place objects inside the Case structure to create sub diagrams that the Case structure can
execute. If necessary, add or duplicate sub diagrams. If the data type of the selector
terminal is Boolean, the structure has a TRUE case and a FALSE case. If the selector
terminal is an integer, string, or enumerated type value, the structure can have any
number of cases.
4. For each case, use the Labeling tool to enter a single value or lists and ranges of values in
the case selector label at the top of the Case structure. For lists, use commas to separate
values. For numeric ranges, specify a range as 10.20, meaning all numbers from 10 to 20
inclusively. If necessary (optional), specify a default case.
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.
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.
Formula Nodes:
The Formula Node is a convenient text-based node you can use to perform mathematical
operations on the block diagram.
In addition to text-based equation expressions, the Formula Node can accept text-based
versions of If statements, While loops, For loops, and Do loops which are familiar to C
programmers.
Formula Nodes are useful for equations that have many variables or are otherwise
complicated and for using existing text-based code. You can copy and paste the existing
text-based code into a Formula Node rather than recreating it graphically.
Formula Nodes use type checking to make sure that array indexes are numeric data and
that operands to the bit operations are integer data.
Formula Nodes also check to make sure array indexes are in range.
File I/O:
A typical file I/O operation involves the following process,
1. Create or open a file. Indicate where an existing file resides or where you want to
create a new file by specifying a path or responding to a dialog box to direct
LabVIEW to the file location. After the file opens, a refnum represents the file.
2. Read from or write to the file.
3. Close the file.
String:
A string is a sequence of displayable or non-displayable ASCII characters. Strings provide a
platform-independent format for information and data. Some of the more common applications
of strings include the following:
Creating simple text messages.
Passing numeric data as character strings to instruments and then converting the strings to
numeric values.
Storing numeric data to disk. To store numeric data in an ASCII file, you must first
convert numeric data to strings before writing the data to a disk file.
Instructing or prompting the user with dialog boxes.
String functions behave similarly to array functions; in fact, strings are really just arrays of
ASCII data. Use the String functions to concatenate two or more strings, extract a subset of
strings from a string, convert data into strings, and format a string for use in a word processing or
spreadsheet application. Use the String functions located on the Functions»All
Functions»String palette to edit and manipulate strings on the block diagram.
Virtual Instrumentation
1. What is virtual instrumentation?
2. With a neat sketch, explain the layer of virtual instrumentation software.
3. Differentiate between traditional instrument and virtual instrument with a diagram.
4. Explain the architecture of virtual instrumentations with a neat sketch.
5. With a neat sketch, explain the features in front panel toolbar used in programming.
6. Describe Arrays in LabVIEW, explain any two array functions in detail.
7. Explain STRINGS and Case Structure in LabVIEW through an example.
8. Describe the function of Sequence Structure. Give an example for sequence local.
9. Explain the following: Loop, Charts, Array, Cluster, Graphs, Structure - Case, Sequence, String.