Professional Documents
Culture Documents
Virtual Instrumentation
(ICPC-404)
Course Coordinator
Dr Roop Pahuja
Associate Professor
Room No. 507 (ICE Dept.)
Contact No : 9988651877
3.3 Signal Analysis
• Signal analysis is a fundamental part of many test, measurement
and control applications.
• Analyzing a signal gives you additional insight into what your data
means—you can get a clearer picture of your desired signal or
monitor a signal for a particular behavior.
• In TD (time domain or discrete form) signal is available in discrete
form ( sampled data points as array) or as waveform data for
analysis
• Different types of signal analysis required : Time domain, freq.
domain, mixed time and frequency domain, pattern information.
• Prior to signal analysis signal processing is sometimes needed to
transform the signal, remove noise disturbances, or compensate
for environmental effects.
3.3 Signal Analysis (contd..)
• Graphical representation of discrete signal.
as Sampled data form ( X axis : no. of samples)
3.3 Signal Analysis (contd..)
• Graphical representation of discrete signal.
as Analog data form ( X axis : no. of samples)
3.3 Signal Analysis (contd..)
• Graphical representation of discrete signal.
as Analog data form ( X axis : Time)
3.3 Signal Analysis (contd..)
• Graphical representation of discete signal.
3.3 Signal Analysis (contd..)
• Graphical representation of discrete signal.
as Waveform data form ( data samples with
timing info)
• Study of typical functions (related to signal analysis : Time
Domain and frequency domain
Measurement function : Detection of some parameters
(attributes) of the signal.
(i) Mean value of DS:
(ii) RMS value of DS:
E.g 1 Calculate average and rms value of 10 samples of
randomly generated data in the range (0-100)
(iii) Cycle RMS : (signal P waveform meas)
Returns the rms value (root mean square value) of the cycle of
periodic waveform / array of waveforms
(iii) Cycle RMS
E.g 1 Make a VI that calculates RMS value of sine signal
(iv) Basic DC-RMS
Pk-pk
HL
LL
Returns the highest level, lowest level and difference between the
highest and lowest value of the signal (amp) of the input waveform
/array of waveforms
E.g. : Generate the sine waveform and cal signal peak to peak,
highest and lowest level.
E.g Amp and level of waveform
(vi) Max and min value of discrete data
Returns the max and min values of discrete samples of signal as
input array and index (es) of max and min
(vii) Extract single-tone info
Returns the amplitude and frequency of single tone input
waveform having frequency in the specified range.
The input signal should have frequency range
[min frequency, max frequency] = [2*f, (N/2 – 2)* f]
Where :
-- f = Fs/N is the frequency resolution ,
-- Fs is the sampling rate (1/t),
-- N is the number of samples in the waveform. For example, consider a waveform with a
-- t is time increment between samples sampling rate of 10 kS/s that contains
N = 1000 samples. The frequency resolution
for this waveform is 10 Hz.
The frequency of the tone you want to
measure should be in the range [20 Hz, 4.98
kHz].
E.g. Generate a std sinusoidal signal and extract single tone info
(viii) Extract Multi-tone info
The function provides the waveform of mixed signal and also indicates the
individual tone frequencies in the mixed signal .
E.g : Generate a multi-tone signal of frequency 10, 20, 30 Hz. Each
signal is of zero phase and 1unit amplitude. Use default sampling
info.
(x) Total Harmonic Analyzer (THA)
Used to analyze total harmonic content in the original single tone signal
due to non-linearity in a system.
A sinusoidal signal of frequency 5 Hz, amplitude of 1unit and zero phase is mixed with DC signal of 2 unit
amplitude and sinusoidal signal of frequency 10Hz, amplitude 1 unit and phase angle of zero degree.
Indicate the original signal and mixed signal on the same graph .
Calculate the total harmonic content in percentage and fundamental frequency in mixed waveform .
Q A sinusoidal signal of frequency 5 Hz, amplitude of 1unit and zero
phase is mixed with DC signal of 2 unit amplitude and sinusoidal signal
of frequency 10Hz, amplitude 1 unit and phase angle of zero degree.
Indicate the original signal and mixed signal on the same graph .
Calculate the total harmonic content in percentage and fundamental
frequency in mixed waveform .
Spectrum analysis ( Freq. domain analysis) Introduction……
Any TD signal can be represented in frequency domain using
Fourier’s Transform
X = {x[i]}
(FFT) X (f)
To transform samples of the data (discrete signal) from the time domain into the frequency
domain, algorithm used is the discrete Fourier transform (DFT) or FFT.
The DFT establishes the relationship between the samples of a signal in the time domain
and their representation in the frequency domain.
DFT algorithm :
States that each frequency component is the result of a dot product of the
sampled TD signal with the complex exponential at that frequency and is
given by the following equation.
𝑖=𝑁−1
2𝜋𝑖𝑘 2𝜋𝑖𝑘
𝑋 𝑘 = 𝑥 𝑖 {cos − 𝑗 𝑆𝑖𝑛 }
𝑁 𝑁
𝑖=0
If the sampling interval is Δt seconds and the first data sample (i = 0) is at
Where 0 seconds, the ith data sample, is at iΔt seconds.
-- X[k] : Freq. domain representation Similarly, if the frequency resolution is Δf Hz, the kth sample of the DFT
of sampled TD signal x [i], that gives mag. occurs at a frequency of kΔf Hz. However,
of frequency component k of the signal this is valid for only up to the first half of the frequency components. The
other half represent negative frequency components
(xi) Spectral measurements (express VI)
Performs the DFT/FFT-based FD analysis of time domain signal
waveform and represents freq -mag ( spectrum graph) of the
waveform. The magnitude of each of the freq. component is
obtained in terms of peak or rms value
Input
Waveform
FFT info o/p provides cluster of three data : initial freq f0, increment
frequency f , array of computed FFT values [Y] at each frequency component with
frequency resolution of f components
Waveform graph represents the freq-magnitude ( spectral response) graph
of the signal
Where [Y] is array of computed FFT values at each freq component
Yo is FFT value at DC component ; Y1 is at f , Y2 is at 2f , Y3 = 3f ,
…….. Yk is at N/2 ( no. of samples are even) or (N-1)/2 ( no. of
samples odd)
• k = N/2 is called Nyquist freq component. , f = Fs/N
Examples Spectral measurement (e.g single tone)
Generate single -tone signal and display FFT data and show
the magnitude-freq graph of the signal
Spectral measurements (e.g. Dual-tone signal)
PC comm port
To PC
Driver layer and application software to extract and analyze
data and control DAQ device
3.4 Data Acquisition
Signal types for DAQ
3.4 Data Acquisition
• DAQ Classification : Depends upon …
(i) General purpose or Specialized
(signal measurement : analog/digital
sound/ vibration, motion controller, image
acq.
(ii) Local or distributed (network- based)
Plug-in type
internal bus of a computer through a plug-
in slot.
Portable ( serial, USB, parallel port)
External PC ports.
3.4 Data Acquisition
• DAQ : An Introduction
• DAQ Classification : Depends upon …
(iii) NI DAQ devices or third party DAQ devices
(driver software compatible with LabVIEW)
3.4 Data Acquisition
• Use of General –Purpose NI-DAQ
Salient features/specification
--- Multifunctional : input and output .
----- Plug-in/ portable
--- Suited for general purpose signals,
Classified depending the way it conveys info
Analog : DC, TD, FD
Digital : ON/OFF (TTL levels), Pulse train
----- No. of channels ( AI, AO, DI, DO) channels
------ Signal modes for analog : Differential and single
ended channels
3.4 Data Acquisition
• Use of General –Purpose DAQ
• Salient features/specification
---- Signal ranges : ±10V; Multiple ranges (± 1V, ± 5V)
----- Sampling rate : max sampling rate for the device
e.g.. 200kS/s
sampling rate per CH = Max sampling rate /no.
of used CH
max freq. of input signal = Max sampling rate/2.N
----- Resolution of ADC : no. of bits of ADC
10bit, 12 bit, 16 bit
3.4 Data Acquisition
• Use of General –Purpose DAQ
• Salient features/specification
---- Code width : Min level of the signal measured
VISA is Standardized software interface to communicate with DAQ hardware using any communication
protocol.
Data Acquisition
•
Flow model for PC –based data acquisition/measurement
in LabVIEW
2 Modes
V Power
supply
+ -
(ii) To make a VI : Place DAQ Assistant on BD and configure
it
Select Device : Daq 6015 (dev1)
Select acq mode : Acquire or generation
signal type : Analog input, voltage
Select Ch no. : AI 0
Terminal Conf: Differential (only mode available)
Voltage range : ± 10V
Select sample mode : Sample on demand
Click OK….. Wait …… DAQ Ass builds…. Data
Terminal is available
(iii) Complete VI program with while loop, voltage
indicator and a waveform chart
3.4 Data Acquisition
(iV) Run program and read voltage value as acquired from
the designated CH on panel
3.4 Data Acquisition
(iv) Actual physical system displaying value
Reading Analog voltage using NI DAQ 6009 , AI2 ( RSE)
3.4 Data Acquisition
DAQ VI program : Reading and writing signal to
different CH of DAQ
(b) Make a VI program that writes analog
voltage (0 to10)connected to AO0 CH of DAQ
(i) Physical connecting signal to designated CH
Voltage
Indicating
meter
- +
3.4 Data Acquisition
(ii) To make a VI : Place DAQ Assistant on BD and configure
it
Select Device : DAQ 6015 (dev1)
Select signal type : Analog output
Select Ch no. : A0 0
Voltage range : 0 to 10V
Select sample mode : Sample on demand
Click OK….. Wait …… DAQ Ass builds…. Data
Terminal is available
3.4 Data Acquisition
(iii) Complete VI program :
Generate analog output voltage at output
Q. Make a VI program to generate random voltage in
the range 0-10V at output channel AO0 after 5s of time
interval until STOP button is pressed.
3.4 Data Acquisition
DAQ VI program : Reading and writing signal to
different CH of DAQ
(c) Make a VI program that writes digital signal (T/F) to
ON/OFF LED connected to digital line P0.0
(i) Physical connecting signal to designated CH
+ 250ohm
Mechanical switch
5V
Place DAQ Assistant on BD and configure it for one analog input channel
Select Device : Daq 6015 (dev1)
Mode : Acquisition
Select signal type : Analog input, voltage
Select Ch no. : AI 0
Terminal Conf: RSE
Voltage range : ± 10V
Select sample mode : Sample on demand
Click OK….. Wait …… DAQ Ass builds…. Data
Terminal is available
+
V1
+
V2
Convert dynamic
data
to array
DAQ program with mixed- multiple signals :
Eg. Read Analog, Read Digital signal , write analog, write digital
• To read mixed signals from DAQ, Use DAQ Assistant for each signal type .
ADD Chs if multiple signals of same signal type are required.
• Place DAQ Assistant in sequence structure to read different type of
signals from channels of DAQ simultaneously.
[Note : If the operation is not providing sequencing n in the use of DAQ
Assistant then use of Sequence structure is a must otherwise it is
optional]
• In as sequence structure there are different frames and code executes in
a sequential manner.
• The output from each frame is available to other frames or outside the
frame.
• Each frame has a DAQ Assistant configured to read/write analog/ digital
signal and data from one frame flows to another depending upon the
program code.
• Sequence structure
Example Program : Mixed signals Acquisition
• --------------------
Steps followed to study and implement a case study.
Knowledge of process
Types of signals
Sensor selection and characterization data
Actuator selection
DAQ selection
Requirement of the project
What functions to be specified
Make System block diag : Hardware and Software
Make Interfacing and circuit diagram ( circuit design)
Flow chart of virtual instrument program
Design of typical algorithm used for signal processing, analysis, control , predict etc.
Optionally simulate the algorithm for testing the same
physically connect all hardware devices and signals with PC
Make a VI program with all functions and features and attractive user interface
Taking care that system can be expanded easily
Test the developed VI system real-time performance
Improve on system performance if required or add new functions.
Design layout of VI : Main VI , subVI
Optionally simulating the functionality of VI program ( what
the system will overall do)
Implementing the program for real time application each
program steps, testing and proceeding
Full program for real tie application is complete
Final testing and validating program results
Logically designing the front panel as professional GUI /MMI
Building exe file.
Allow the user to use the VI system
Taking feedback from user for further improvement
Bringing the next version with improved features.
Program:
Interface analog input signal from power supply to analog input CH 0 of NI 6009 card
and make a VI program to graphical display the voltage on chart until STOP button is
pressed. Also compare the input value with threshold limit and generate an alarm.
Set data acquisition rate of 1s
• CASE Study : PC based VI system for
Temperature Monitoring and
Logging
Problem
Make a VI program to continuously monitor room temperature until
STOP button is pressed using LM35 smart temperature transducer
Display the temperature variations on chart and log the readings
Time in s
Set up to measure ambient temp of LAB using LM35 sensor and vary temp by heating the
sensor
Notepad file
Another Program : Continuous acquisition of temperature array data and averaging
to minimize random noise
Problem :
Make a VI program to continuously monitor temperature of a room
using LM35 sensor after 1s of time interval until STOP button is
pressed. Use DAQ 6015, provide 5V excitation signal to sensor from
DAQ channel AO0.
Display temperature variation on a chart and log relative time -temp
data in a file. Also compare temp value with high and low alarm
status and display low and high alarm status.
Procedure:
Do physical interfacing : Provide excitation of 5V to sensor from
DAQ AO0 and connect sensor output to analog input channel AI2
Make VI program
Use three frame sequence structure VI :
Seq structure : Frame 1 : Configure DAQ Asst. to write analog
voltage value of 5V to AO0
Seq structure : Frame 2 : Use wait fn with 20ms wait time to
stabilize excitation signal for sensor to take reading.
• Seq structure : Frame 3 : Configure DAQ Asst. to read sensor
voltage signal at ch AI0
Convert sensor voltage to Temp in C using S value of 10mV/C.
Display temp
log time-temp data in file,
Analyse temp value for to activate alarms .
Display alarms
For continuous monitoring use outer while loop with time interval of 1s
and Stop button
Excitation signal of 5V is given to sensor from DAQ AO0
Output voltage of sensor is interfaced to DAQ ch AI0 (selected as diff)
AI0
AI0
AI8
Agnd
+5 V AO0
AO gnd
Gnd
DAQ 6015
Time -Temp logging in file
To develop temperature ON-OFF Controller
If Ti > TSLH
Heater (Hi) ON ( T)
Else If Ti < TSLL
Heater (Hi) OFF ( F)
Otherwise Hi = Hi-1
Where Ti presents value of temperature at current ith iteration
Hi presents status of heater at current ith iteration
Hi-1 presents status of heater at i-1 iteration