0% found this document useful (0 votes)
16 views94 pages

Unit 3

The document provides an overview of virtual instrumentation, detailing its architecture, advantages, and the role of graphical programming techniques. It discusses the components of virtual instruments, including sensor modules, processing modules, and user interfaces, as well as the data types used in LabVIEW. Additionally, it explains the concepts of loops in programming, specifically the FOR and WHILE loops, and their application in LabVIEW for repetitive operations.

Uploaded by

shubhextuk07
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)
16 views94 pages

Unit 3

The document provides an overview of virtual instrumentation, detailing its architecture, advantages, and the role of graphical programming techniques. It discusses the components of virtual instruments, including sensor modules, processing modules, and user interfaces, as well as the data types used in LabVIEW. Additionally, it explains the concepts of loops in programming, specifically the FOR and WHILE loops, and their application in LabVIEW for repetitive operations.

Uploaded by

shubhextuk07
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/ 94

UNIT 3

Virtual instrumentation: Graphical programming techniques, Data types,


Advantages 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
Virtual Instrumentation (Introduction)

• 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.

• A virtual instrument consists of an industry-standard computer or workstation equipped with


powerful application software, cost-effective hardware such as plug-in boards, and driver software,
which together perform the functions of traditional instruments.
Virtual Instrumentation (Introduction)

• Virtual instrumentation is an interdisciplinary field that merges sensing, hardware, and


software technologies to create flexible and sophisticated instruments for control and
monitoring applications.

• Virtual instrumentation is the use of customizable software and modular measurement


hardware to create user-defined measurement systems, called virtual instruments.
History of Virtual Instrumentation
• A history of virtual instrumentation is characterized by a continuous increase of the flexibility
and scalability of measurement equipment. Starting from the first manual-controlled vendor-
defined electrical instruments, the instrumentation field has made great progress toward
contemporary computer-controlled, user-defined, sophisticated measuring equipment.
Instrumentation had the following phases:

• Analog measurement devices ( such as oscilloscopes etc.)

• Data Acquisition and Processing devices ( allowed processing of data)

• Digital Processing based on a general-purpose computing platform (interfacing of hardware


instruments with computers)

• Distributed Virtual Instrumentation


Virtual Instrumentation- Architecture
A virtual instrument is composed of the following blocks:

• 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.

• Many virtual instruments use Database Management Systems(DBMSs). They


provide efficient management of data and standardized insertion, update, deletion,
and selection. Most of these DBMSs provided a Structured Query Language (SQL)
interface, enabling transparent execution of the same programs over a database from
different vendors.
Information System Interface
• Virtual instruments are increasingly integrated with other information systems, such as hospital
information systems. They can be used to create executive dashboards, supporting decision
support, real-time alerts, and predictive warnings.

• 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.

• In Web-based applications this integration is usually implemented using Unified Resource


Locators (URLs). Each virtual instrument is identified with its URL, receiving configuration
settings via parameters. The virtual instrument store the results of the processing in a database
identified with its URL.
User Interface, Display and Control

• Terminal User Interface

• Graphical User Interface

• Multimodal User Interface


Advantages of VI
• Engineers and scientists need an application that is flexible and can create
solutions to different problems, VI fulfills their requirements without replacing the
entire device because of the application software installed on the PC and the wide
range of available plug-in hardware.
• Performance enhancement
• Platform-independent nature
• Flexibility
• Low cost
• Plug-in and networked hardware capability
• System time consumption can be calculated
• Setup and configuration time is less
• Graphical representation of programs
Comparison of traditional instruments and
Virtual instruments
Graphical Programming Techniques
• It is a technique where visual block connections are used to code instead of text code; this
makes it easy for noncoders to implement algorithms.

• Graphical programming refers to the process of creating a computer program by using


graphical elements and interfaces, rather than writing codes in traditional programming
language.

• This approach is often used in fields where visual representation of systems is important

such as in robotics, automation, simulations, and game development.


Some common graphical programming
techniques are:
• Flowcharts

• 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.

• LabVIEW( Laboratory Virtual Instrument Engineering Workbench)

• 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

• Automated Test Environments

• Data flow programming

• 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

(Place items on the


Block Diagram Window)

Structure:
While Loop
Status Toolbar

Run Button

Continuous Run Button

Abort Execution

Additional Buttons on the


Diagram Toolbar

Execution Highlighting Button


Retain Wire Values Button
Step Function Buttons
Demonstration 1: Creating a VI
Front Panel Window

Graph
Indicator

Block Diagram Window

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

* However, Sequence structure forces


flow
Debugging Techniques
• Finding Errors
Click on broken Run button.
Window showing error appears.
• Execution Highlighting
Click on Execution Highlighting button; data
flow is animated using bubbles. Values are
displayed on wires.
• Probes
Right-click on wire to display probe and it shows
data as it flows through wire segment.

You can also select Probe tool from Tools palette


and click on wire.
What are Data types?
Data type is a data storage format that contains a specific type or range of values.
When a computer program stores data in a variable, each variable must be assigned a
specific data type.
• Some common data types include:
• Integers
• Floating Point Numbers
• Characters
• Strings
• Arrays
Data Types Used in LabVIEW
• LabVIEW software uses different data types to store and convey information to and from different parts of the
program.

• Data types cannot be interconnected

• 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

• Consists of only two values:


• True (1)
• False(0)
• Provides output in the form of 0 or 1.
• Indicated by a GREEN data wire
• LabVIEW stores the Boolean data as 8-bit wires.
Numeric Data Types
• Integers: Integers are a sub-type of numeric data, where only whole numbers can be
represented. This means no decimal points are allowed. They are available in several sizes,
ranging from 8-32 bits, and are indicated by blue outlines and wires. Integers can either be
signed or unsigned, meaning one of the bits indicates whether the number is positive or

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

• Group of specific data types


• Determine by thicker data wires
• Stores numeric, string, double, or Boolean data types
• Size of array increases according to the number of
elements
CLUSTERS
• Consists of different data types in a single unit
• Indicated by thicker BROWN Colour for numeric and PINK colour for other
Graphs/Waveform data types
• The waveform data type that is used to store and display periodic signal measurement i.e.
the waveform creates a graph and charts of the particular data.
• It provides you with exact and precise information about your data in charts and graphs
form.
Enumerated Data types
• ENUMS are the combination of data types mainly consisting of a pair of data values i.e. a
string and a numeric value.
• For example, we can have an Enum to hold the four weather seasons, in which case we'll
have a numeric value for each one: 0-"spring", 1-"summer", 2-"autumn", and 3-"winter"
Structures in LabVIEW
• Structures are graphical representations of loops and case statements
of text-based programming languages.
• In text-based programs this can be accomplished with
if, else, and case statements
• In graphical programming it is done with sub-diagrams and with
conditions
• Decision-making by a function
What are loops?
• It is a process where a set of instructions is repeated in a sequence a specified number of
times or until a specified condition is made.
• When a set of instructions is executed again it is called a loop.
• The programmer uses loops to cycle through values, repeated functions or many other
things.
TYPES OF LOOPS
• For loop
• While loop
For Loop
for (initialization; condition; iteration)
{
//body of for loop
}
When the loop is executed, the initialization condition is executed first,
followed by the condition check. If the condition is met, the body of the loop
is executed, followed by the iteration statement. The condition is then
checked again to determine whether the loop will iterate further or
terminate.
Flowchart of For loop
While loop

• 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.

(1) Index Display | (2) Element Display

Figure 1. Array Control of Numerics


Arrays in Virtual Instrumentations
Creating Array Controls and Indicators:

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 2. Placing a Numeric Control in an Array Shell


Arrays in Virtual Instrumentations:
Two-Dimensional Arrays
The previous examples use 1D arrays. A 2D array stores elements in a grid. It requires a
column index and a row index to locate an element, both of which are zero-based.
Figure 3 shows an 8 column by 8 row 2D array, which contains 8 × 8 = 64 elements.

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.

Figure 4. 2D Uninitialized Array


In a 2D array, after you initialize an element, any uninitialized element in that column and in previous
columns are initialized and populated with the default value for the data type.
Types of Waveform and Charts
Waveform Charts
• The Waveform Chart is a numeric indicator that displays one or more plots of scalar data. The
plots are usually generated from inside loops. They display and retain data that has been
acquired and append new data as it is acquired. The Y values represent new data and the X
values represent time. The Y and X scale ranges can be modified to fit data values by editing
the text on the Y and X scales.
Waveform Chart Update Display Modes
• Strip chart mode- The display continues to scroll to the right like a
paper strip chart. When the data reaches the right side of the display,
the data on the left disappears.
• Scope chart mode - When the data plot reaches the right side of the
display, the display goes blank and starts over from the left side of the
display.
• Sweep chart mode - This is like the scope chart, but when the data
plot reaches the right side of the display, a vertical line that moves
across the display marks the beginning of new data.
Waveform Graphs
Waveform XY Graphs
Digital Waveform graphs
• The digital waveform graph to display digital data, especially when you work with
timing diagrams or logic analyzers. The digital waveform graph accepts the digital
waveform data type, the digital data type, and an ARRAY of those data types as an
input. By default, the digital waveform graph collapses digital buses, so the graph plots
digital data on a single plot. If you wire an array of digital data, the digital WAVEFORM
GRAPH plots each element of the array as a different plot in the order of the array.
Digital waveform graphs
Chart and Graph Features
CASE Structure in LabVIEW
• A Case Structure is a primitive Structure that can have multiple Sub-diagrams (also known as
"Cases"), one of which is selectively executed at runtime. A selector value determines which
case is executed at runtime.
• For example: In a Boolean case structure,
• If the TEMP scale is TRUE, execute the True case;
• If the TEMP scale is FALSE, execute the False case
• We can enter a single value or lists and a range of values in the CASE selector label
• We can create multiple input and output tunnel for a case structure
Components of CASE Structure
CASE STRUCTURES FOR DIFFERENT DATA TYPES
Example of Boolean control case structure
Sequence Structure
• The Sequence Structure is used to control the data flow in a VI's Block Diagram. They are
used to control the order of execution of nodes that are not data-dependent on each other. The
nodes within each frame are data-dependent.

• 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.

You might also like