Unit 3
Unit 3
• The rapid adoption of the PC in the last 20 years catalyzed a revolution in instrumentation for testing,
measurement, and automation.
• One major development resulting from the ubiquity of the PC is the concept of virtual
instrumentation, which offers several benefits to engineers and scientists who require increased
productivity, accuracy, and performance.
• Sensor Module
• Sensor Interface
• Information Systems Interface
• Processing Module
• Database Interface
• User Interface.
Sensor Module
• The sensor module detects the physical signal and transforms it into
electrical form, conditions the signal, and transforms it into a digital form
for further manipulation.
• Sensor: Senses the physical quantity
• Signal conditioning part: transforms the signal into digital form for further
manipulation
• A/D converter
Sensor Interface
There are many interfaces used for communication between sensor modules and the computer.
According to the type of connection, sensor interfaces can be classified as wired and wireless:
Wired Interfaces
• GPIB
• Small Computer Systems Interface (SCSI)
• System buses (PCI extension for Instrumentation PXI or VME Extensions for Instrumentation
(VXI)
• Serial buses (RS232 or USB interfaces).
Wireless Interfaces
• Typical interfaces include the 802.11 family of standards
• Bluetooth, or GPRS/GSM interface
Processing Module
The integration of microprocessors/ microcontrollers of general Analytic functions define clear functional
Use allowed the flexible implementation of sophisticated relations among input parameters. Some of
processing Functions. the common analyses used in virtual
instrumentation include spectral analysis,
filtering, windowing, transforms, peak
detection, or curve fitting.
Artificial intelligence technologies, such as
neural networks, fuzzy logic, and expert
systems, are applied in various applications,
including sensor fusion to high-level sensors,
system identification, prediction, system
control, complex measurement procedures,
calibration, and instrument fault detection and
isolation. Various nonlinear signal processing,
including fuzzy logic and neural networks,
are also common tools in the analysis of
biomedical signals.
Data Base Interface
• Computerized instrumentation allows measured data to be stored for offline
processing, or to keep records. Several currently available database technologies are
Xtensible Markup Language (XML) and SQL Server and Oracle.
• Some virtual interface toolkits, such as LabVIEW, provide mechanisms for customized
components, such as ActiveX objects, that allow communication with another information
system, hiding details of the communication from virtual interface code.
• This approach is often used in fields where visual representation of systems is important
• Block-based programming: This approach involves dragging and dropping visual blocks or
elements that represent code constructs. Scratch is an example of block-based programming.
• Simulink
• Graphical User Interfaces( GUIs): GUI programming involves designing user interfaces
through graphical elements like buttons, sliders, menus and windows Tools like Qt, Tkinker,
and JavaFX allow developers to create GUI applications.
Some common graphical programming
techniques are:
• Visual Scripting in game engines
• CAD (Computer-Aided Design) Software: CAD Software like AutoCAD, SolidWorks, and
Blender use graphical interfaces for designing and modeling objects in various industries
including engineering, architecture, and animation.
• Node-based programming
Difference between Graphical programming
and Text based programming
Graphical Programming Text-based Programming
Proper syntax is not required Text-based coding requires syntax
information
The execution of the program is from The execution of the program is from
left to right top to bottom
Errors are indicated as we wire the To check the errors program has be
block compiled or executed
Graphical programming is highly Text-based programming is not
interactive interactive.
Logical error finding becomes a Logical error finding is easy
complex task
Icon based programming Programs are written in text
LabVIEW – Laboratory Virtual Instrument
Engineering Workbench
• Graphical programming language that allows for instrument control, data acquisition, and
pre/post-processing of acquired data
• LabVIEW relies on graphical symbols rather than textual language to describe programming
actions
• The principle of dataflow, in which functions execute only after receiving the necessary data,
straightforwardly governs execution.
Components of LabVIEW
• Graphical programming: LabVIEW uses a graphical programming language called G, which is
based on dataflow programming.
• Instrument control: LabVIEW provides tools for interfacing with a wide range of instruments and
sensors.
• Data Acquisition: LabVIEW includes libraries and drivers for data acquisition hardware, allowing
users to acquire and process data from sensors, cameras, and other data sources.
• Real-time and FPGA Programming: Real-time systems are used for time-critical applications
while FPGA programming provides hardware-level customization for high-speed and parallel
processing tasks.
Components of LabVIEW
• User interface design: LabVIEW enables the creation of custom user interfaces (UIs) for visualization
of data and control of the systems.
• Math and Analysis Functions: LabVIEW includes a wide range of built-in math and signal processing
functions making it well-suited for applications that require data analysis and processing.
• Integration with other languages: LabVIEW can be integrated with other programming languages like
C, C++, and . NET.
• Third-party Add-ons: LabVIEW community and NI offer a variety of third-party add-ons, libraries,
and toolkits.
How does a LabVIEW work?
• LabVIEW programs are
called:
• Virtual Instruments (VIs)
because their appearance and
operation imitate actual
instruments.
LabVIEW Programs Are Called Virtual Instruments (VIs)
Each VI has 2 Windows
Front Panel
• User Interface (UI)
– Controls = Inputs
– Indicators = Outputs
Block Diagram
• Graphical Code
– Data travels on wires from
controls through functions to
indicators
– Blocks execute by Dataflow
Controls Palette (Place items on the Front Panel Window)
(Controls & Indicators)
Control: Customize
Numeric Palette View
Indicator:
Numeric Slide
Functions (and Structures) Palette
Structure:
While Loop
Status Toolbar
Run Button
Abort Execution
Graph
Indicator
Output
Terminal
Boolean
Control
Input
Terminals
Dataflow Programming
• Block diagram execution
– Dependent on the flow of data
– Block diagram does NOT execute
left to right*
• Node executes when data is
available to ALL input terminals
• Nodes supply data to all output
terminals when done
• There are some unique colors assigned to each data type. Commonly used data types in LabVIEW are:
• BOOLEAN
• NUMERIC
• STRING
• ARRAY
• CLUSTER
• WAVEFORM
BOOLEAN Data Type
negative.
Double-precision Floating Points (Doubles)
• Doubles are another sub-type of numeric data. Unlike integers, they can represent a
decimal number. A double has 15-digit precision, as some of the memory places the
decimal point. Numeric indicators and controls of doubles are outlined in orange.
String data type
• String data type stores text data—everything from names, status messages, detailed
descriptions, and converted data to be written to files. Strings move along pink wires from
icons with a pink outline.
• Controlling instruments by sending text commands to instruments and returning data in the
form of either ASCII or binary string which can then be converted to numeric values.
Arrays
• A while loop programming repeatedly executes a target statement as long as the given
statement is true.
While(condition)
{
Statements
}
• Here statement may be a block of statements
• The loop iterates until the condition is true.
• When the condition becomes False, the program control passes to the next statement
after the loop.
Flowchart of While loop
Using Loops in VIs
• LabVIEW consists of for and while loop
• Loops are used to control repetitive operations in virtual instruments
• They are used to perform an action frequently with variation in
details.
While loop example
Ex: This program converts temperature in degrees to
Fahrenheit.
Using Loops in LabVIEW
• The virtual instrument program is working fine but we have to run the
program again and again for different values of input temperature in
degrees Celsius, which is not convenient.
• So here we can use the loops in virtual instrumentation
Adding While loop
With a while loop and without a while loop
Example of While Loop
• This example run until either the user clicks the stop button or
number of iterations is greater than 10.
For Loop
• A For Loop executes a sub-diagram a set number of times. The Figure below shows an
empty For Loop in LabVIEW.
• A For loop executes its sub-diagram n times, where n is the value wired to the count (N)
terminal. The iteration (i) terminal provides the current loop iteration count, which ranges
from 0 to n-1.
For Loop
• After you create a For Loop, you can use shift registers to pass values from one iteration to the next.
• If you wire an array to a For Loop, you can read and process every element in that array by enabling
auto-indexing.
• You also can enable auto-indexing by configuring a For Loop to return an array of every value
generated by the loop.
• You can add a conditional terminal to configure a For Loop to stop when a Boolean condition or an
error occurs. A For Loop with a conditional terminal executes until the condition occurs or until all
iterations are complete, whichever happens first.
• To add a conditional terminal to a For Loop, right-click the For Loop border and select Conditional
Terminal from the shortcut menu. You must wire the conditional terminal and either wire the count
terminal or auto-index an input array for the loop to execute and for the VI to run.
Arrays in Virtual Instrumentations
Arrays
Sometimes it is beneficial to group related data. Use arrays and clusters to group related data
in LabVIEW. Arrays combine data points of the same data type into one data structure, and
clusters combine data points of multiple data types into one data structure.
An array consists of elements and dimensions. Elements are the data points that make up the
array. A dimension is the length, height, or depth of an array. An array can have one or more
dimensions and as many as (231)—1 elements per dimension, memory permitting.
Arrays in Virtual Instrumentations
You can build arrays of numeric, Boolean, path, string, waveform, and cluster data types.
Consider using arrays when you work with a collection of similar data points and when you
perform repetitive computations. Arrays are ideal for storing data you collect from
waveforms or data generated in loops, where each iteration of a loop produces one element
of the array.
Note: Array indexes in LabVIEW are zero-based. The index of the first element in the
array, regardless of its dimension, is zero.
Array elements are ordered. An array uses an index so you can readily access any particular
element.
The index is zero-based, which means it is in the range of 0 to n-1, where n is the number of
elements in the array. For example, n-12 represents the 12 months of the year, so the index
ranges from 0 to 11. March is the third month, so it has an index of 2.
Arrays in Virtual Instrumentations
Figure 1 shows an example of an array of numeric.
The first element shown in the array (3.00) is at index 1, and the second element (1.00)
is at index 2.
The element at index 0 is not shown in this image because element 1 is selected in the
index display. The element selected in the index display always refers to the element
shown in the upper left corner of the element display.
Create an array control or indicator on the front panel by adding an array shell to the front
panel, as shown in Figure 2, and dragging a data object or element, such as a numeric or
string control, into the array shell.
Figure 3. 2D Array
To add a multidimensional array to the front panel, right-click the index display and select Add Dimension from the shortcut
menu. You also can resize the index display until you have as many dimensions as you want.
Arrays in Virtual Instrumentations:
Initializing Arrays
You can initialize an array or leave it uninitialized. When an array is initialized, you defined
the number of elements in each dimension and the contents of each element. An
uninitialized array contains a fixed number of dimensions but no elements. Figure 4 shows
an uninitialized 2D array control. Notice that the elements are all dimmed. This indicates
that the array is uninitialized.
• The output tunnels of Sequence Structures can only have one data source which, unlike Case
Structures, has outputs that must have one data source per case. The output can come from
any frame, but the data will not leave the structure until the last frame in the structure has
completed its execution. Data input is available to all frames.
Flat sequence structure
• The Flat Sequence structure, shown as follows, executes frames from left to right 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.
Stacked sequence structure
• Returns data only after the last frame executes.
Event Structures
• It waits until an event happens and then executes the appropriate case to handle that
event.
• An event is an action that triggers a change in state.
❖User initiated
❖Button press
❖Mouse click
• OS initiated
❖Timed out
• Software initiated
❖Message from another program
❖Variable reaches a specific value
Parts of an Event Structure
Parts of an Event Structure
Formula Node
• Formula node is a box where you can enter algebraic formulas directly in the
block diagram. It is useful when the equation is complicated and it has many
variables.
Formula Node
• The Formula Node in LabVIEW 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.
Numerical based assessment
1) A strain gauge is bonded to a beam 0.1m long and has a cross-sectional area of 4cm2. Young’s modulus for
steel is 207 GN/m2. The strain gauge has an unstrained resistance of 240 Ω and a gauge factor of 2.2. When
a load is applied, the resistance of the gauge changes by 0.013Ω. Calculate the changes in the length of the
steel beam and the amount of force applied to the beam.
2) A strain gauge has a gauge factor of 4. If the strain gauge is attached to a metal bar that stretches from 0.25m
to 0.255m when strained, what is the percentage change in resistance? If the unstrained value of gauge is 120
Ω, what is the resistance value of gauge after application of strain?
3) The LVDT with a secondary voltage of 5V has a range of ±100 mm, Find i) the output voltage when the
core is -7.5mm from the center. (b) Plot the output voltage versus core position for a core movement going
from +7.5mm to -40 mm.
Numerical based assessment
4) A quartz piezo electric crystal having thickness of 2mm and voltage sensitivity of 0.055V-m/N is subjected to
a pressure of 1.5MN/m2. Calculate the voltage output. If the permittivity of quartz is 40.6×10-12 F/m. Calculate
its charge sensitivity.
5)A piezo electric crystal having dimensions of 5mm×5mm×1.5mm and a voltage sensitivity of 0.055V-m/N is
used for force measurement. Calculate the force if the voltage developed is 100 V.
6) A Hall Effect element used for measuring a magnetic field strength gives an output voltage 10mv. The
element is made of silicon and is 3.0×10-3m thick and carries a current 2 amp. The hall co-efficient is 4.1×10-6
vm/A- w/W. Find magnetic field strength.
7) A platinum resistance thermometer has a resistance of 150 Ω at 0°C. what is the resistance when the
temperature is 200°C? When the temperature has a resistance of 400Ω, what is the value of temperature?
Platinum has a resistance temperature coefficient of 0.0039/°C.
Numerical based assessment
• Define the gauge factor and derive the equation of gauge factor for a
strain gauge.
• Derive the output voltage for a hall effect sensor.