You are on page 1of 13

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/266222999

Virtual Instrumentation for Control Applications

Conference Paper  in  Communications in Computer and Information Science · March 2012


DOI: 10.1007/978-3-642-28962-0_38

CITATIONS READS

2 11,852

4 authors, including:

Syed Ali Asad Rizvi Sham Sunder


University of Virginia ZF Friedrichshafen
22 PUBLICATIONS   71 CITATIONS    2 PUBLICATIONS   2 CITATIONS   

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Multilevel Power Electronics Converters for Renewable Energy integration with Power Grid View project

All content following this page was uploaded by Sham Sunder on 01 April 2015.

The user has requested enhancement of the downloaded file.


Virtual Instrumentation for Control Applications

Syed Ali Asad Rizvi, Sham Sunder, Farah Haroon, and Ashab Mirza

Institute of Industrial Electronics Engineering (IIEE)-PCSIR, Karachi, Pakistan


{s.ali.asad,ss.lohana,farah,ashab}@iiee.edu.pk

Abstract. The virtual instrumentation (VI) is rapidly replacing classical analog


as well as digital instrumentation systems owing to the availability of high
performance microprocessors based PCs, fast Analog-to-Digital Converters
(ADCs) and sophisticated data communication technology. Therefore,
investigation of more and more efficient and effective VI based solutions to
modern instrumentation problems is one of the main research areas for design
engineers. The work presented in this paper is application oriented and thus the
contribution of the paper is how to instigate the already known control
algorithms in NI LabVIEW. Instead of relying on commercially available
expensive hardware, a low-cost self-developed DAQ card is employed. The
elaboration of the idea is carried out by designing a VI based DC drive and a
thermal system. Modeling, PID controller and user-interface development is
presented for both examples. The positive results of this study establish the
utility of virtual instrumentation especially for control applications.

Keywords: Virtual instrumentation, DAQ, LabVIEW, digital control, thermal


system, DC drive.

1 Introduction

The idea of using software practices in engineering education has been widely
explored [1]. From design simulation to implementation phases, the role of software
has been proven outstanding. Another trend that we have been experiencing is the
replacement of existing bulky electronics hardware with computer programs by
bearing the functionality of the real one. This is what virtual instrumentation is all
about. The key idea is that an engineer can use routines running on a computer
combined with data acquisition hardware to define a custom built-to-order test and
measurement system.
An important contribution of our work is the realization of graphical programming
language not only for data acquisition and measurement as in [2] but also for
designing intelligent controllers for real time control purpose. The DC drive
application in this paper extends the work in [3] where only the monitoring system of
drives for performance analysis is provided. The thermal system application also
enhances the work in [4] in which a VI based ON-OFF controller is developed
whereas; a PID controller is exercised for both control applications presented in this
paper.

B.S. Chowdhry et al. (Eds.): IMTIC 2012, CCIS 281, pp. 397–408, 2012.
© Springer-Verlag Berlin Heidelberg 2012
398 S.A.A. Rizvi et al.

The paper is organized in five sections. The inclination of software oriented


practices in engineering systems is presented in Section 1. An overview of virtual
instrumentation is provided in Section 2. The design of a low-cost DAQ card solution
to practice instrumentation and control experiments is carried out in Section 3.
However, a major portion of the work presented in this paper is explored in Section 4
in which the VI focused design of an Insulated Gate Bipolar Transistor (IGBT) based
DC drive and a thermal feedback control system is explained. Finally, Section 5
concludes the work in the light of the results of the applications presented.

2 Virtual Instrumentation

An instrument is a device designed to collect data from an environment or a system


under test and to display information based on the acquired data. Common examples
of traditional instruments that we encounter in our labs are oscilloscope, function
generator, multi-meter, spectrum analyzer etc. In contrast, the more exigent is VI
which is the use of customizable software and modular measurement hardware for the
creation of user-defined measurement systems.
Traditional instrumentation systems involve a general workflow in which a
physical phenomenon such as temperature, pressure etc. is converted into electrical
signals using sensors; followed by a signal conditioning unit and a measurement
equipment. Whereas in a virtual instrumentation system, the measurement equipment
is replaced by a DAQ which is followed by a personal computer (PC) equipped with
measurement software. The flow of signals in these two practices is shown in the Fig.
1 which shows that there exists a major difference due to the presence of DAQ and
computing platform instead of an actual instrument.
The first two stages including the sensors/transducers and the signal conditioning
are essentially found in both techniques. This is so because they are directly

Fig. 1. Signal flow in Traditional and Virtual Instrumentation systems


Virtual Instrumentation for Control Applications 399

associated with the characteristics of the physical quantity being measured and are not
concerned with how the measurement obtained will be viewed and/or processed by
subsequent stages. The presence of software programs in VI contrasts it from the
conventional instrumentation. Consequently, this new paradigm has its own set of
characteristics. Table 1 summarizes the differences between the two approaches.

Table 1. Differences between traditional and virtual instrument

Conventional Instrumentation Virtual Instrumentation


Pre-defined hardware components User-defined measurement system
Limited functionality due to Versatile functionality using
hardcoded functions customizable software
Complex and expensive hardware Complex hardware functionality
implemented on software
Re-calibration is required Re-calibration is not required
Bulky and stimulus specific Compact and portable

A virtual instrument system comprises of three main components that are:

• Flexible software
• Modular data acquisition hardware (DAQ)
• Computing platform (e.g. PC)
The flexible software is the computer program on which the virtual instrument is
made; modular hardware is a plug-in input/output data acquisition hardware that
transforms the real world signals into digital form. The third important component is
the computing platform for e.g. a PC that provides the interface between flexible
software and data acquisition hardware along with the necessary synchronization
between the first two components.

3 Development of IIEE USB DAQ Hardware


The aim of this activity is to develop a low-cost DAQ hardware instead of relying on
commercially available expensive cards for low speed applications [5]. This DAQ
card is now a patented [6] property of authors’ engineering institute, IIEE.
USB interface has been utilized instead of PCI card owing to its portability feature
[7]. For this reason this DAQ features USB connectivity and is a USB powered
device. The heart of this device is an USB microcontroller.
This card is designed to work with popular programs used for virtual
instrumentation and control applications such as Mathworks MATLAB and National
Instruments LabVIEW. The usage, however, is not restricted to only the commercial
softwares because a number of applications have also been developed in Microsoft
Visual Studio programming environment. A block diagram of IIEE DAQ card is
presented in the Fig. 2 which reveals its quick specifications. In the control
applications discussed in this paper, we will be concerned with analog input channels
that are of 5V range and two raw PWM generators. They can be used in either filtered
or unfiltered mode.
400 S.A.A. Rizvi et al.

Fig. 2. Block diagram of IIEE DAQ Card

4 Virtual Instrumentation in Control Applications

Virtual instrumentation covers a broad spectrum of industrial and laboratory control


applications. These systems are even found in industrial processes. Two examples are
presented with VI as the main focus of their design.

4.1 IGBT Based DC Drive


A DC Drive is designed which is based on IGBT power electronic converter (PEC). A
DC Motor rated at 75 V and 2.1 A with 3000 RPM speed is used for demonstration.
The specifications of IGBTs are 600V and 40A. An external load in the form of
another motor is used to evaluate the constant speed capability of the drive using shaft
coupling. Our objective is to develop a virtual instrument to monitor and control the
speed. For this purpose we use IIEE DAQ as discussed in Section 3.
A block diagram of the proposed design is shown in the Fig. 3. The measurement
of motor speed is carried out using the analog channels and control signals are
generated through the PWM channels of the DAQ. The PEC incorporates a half-
bridge IGBT driver circuit which accepts the DAQ originated PWM signals and
transforms them into high voltage level PWM signals of 75V. A PID controller is
employed as shown in the block diagram. This controller along with visual user-
interface for monitoring and control of the motor speed is developed in LabVIEW
which comes under the umbrella of virtual instrumentation.
Virtual Instrumentation for Control Applications 401

Fig. 3. Block diagram of IGBT based DC Drive

Modeling of DC Motor. In this section we develop a mathematical model of the DC


motor and deduce a transfer function for voltage and speed. The motor torque ‘T’ is
related to the armature current ‘i’ by a constant factor K:
T = Ki (1)
The back emf, Vb, is related to the angular velocity by:

Vb = Kω = K (2)
dt
We can write the following equations based on the Newton’s law combined with the
Kirchhoff’s law:

d 2θ dθ
J 2
+b = Ki (3)
dt dt
di dθ
L + Ri = V − K (4)
dt dt
The Laplace transform of (3) and (4) can be written as:

Js 2θ ( s ) + bsθ ( s ) = KI ( s ) (5)

LsI ( s) + RI ( s ) = V − Ksθ ( s ) (6)

V − Ksθ ( s)
I (s) = (7)
R + Ls
V − Ksθ ( s)
Js 2θ ( s) + bsθ ( s) = K (8)
R + Ls
Hence, the transfer function from the input voltage ‘V’ to the angular velocity ω(s) is:
402 S.A.A. Rizvi et al.

ω ( s) K
G ( s) = = (9)
V ( s) ( R + Ls)( Js + b) + K 2

The model assumes that rotor and shaft are rigid. Also, the effect of change of
coupling factor when a load motor is driven through shaft couplers is ignored.

Digital PID Controller Design. The PID controller is the most common form of
controllers and there are several algorithms [8] for implementation of a digital PID.
Depending upon the design requirements, one algorithm may be better suited than the
other. The PID equation that serves as the basis for implementing digital PID is given
by equation (10).
Kd
m(n) = Kpe(n) + KiTs (n) + [e(n) − e(n − 1)] (10)
T
Where, Kp, Ki and Kd are the gain parameters, T is the sampling time, e(n) is the error
at nth sample and s(n) is the sum term of the integral.
The pseudo code for the control law given in equation (10) is as follows:

1: Start
2: Initialize Kp, Ki, Kd, T, s[n]
3: Initialize PID equation
4: forevery e[n] {
5: P := Kp * e[n]
6: s[n] := s[n-1] + e[n]
7: I= Ki * T * s[n]
8: D := Kd * (e[n]-e[n-1]) / T
9: m[n] := P+I+D
10: if (m[n] > mmax)
11: m[n] := mmax
12: }
13: End

Pseudo code 1: Algorithm for PID Controller

A simple conditional limit of exceeding the sum term may be added to prevent
integral windup. This added flexibility of controller modification is a clear advantage
of using a software solution provided by virtual instrumentation. Finally, a LabVIEW
block diagram-m code for the PID controller is developed as shown in Fig. 4.
The PID controller output is meaningless for DAQ PWM channels until it is
converted to its equivalent PWM form. As we know that valid PWM duty-cycle
ranges lie between 0 – 100% which means that there is a need to devise a method of
PID to PWM conversion. This can be achieved using equation (11) as,

PIDout
PWM = × 100 (11)
PID max
Virtual Instrumentation for Control Applications 403

Fig. 4. LabVIEW Implementation of PID Controller

where, PIDout is the controller output and PIDmax is its maximum value. The next
question that immediately arises here is the value of PIDmax that must be kept. Using
computer simulation the output of PID controller is determined for safe gain ranges.
The PID output values remained within 5000. Thus, PIDmax can be assigned this value.
In this way PWM actuation signals are generated.

Results of VI in DC Drive. The user-interface for DC Drive system is shown in the


Fig. 5. There are controls for PID tuning, set-point control, output speed, PEC status

Fig. 5. Front Panel VI for DC Drive System


404 S.A.A. Rizvi et al.

and I/O response plots for measuring transient and steady-state response of the drive.
To improve the user interaction, the status of PWM switching circuit (not actual
PWM circuit but a simplified motor switching animation) is updated by the use of
animated indicators at the front panel. The effect of PID tuning and sampling rate can
be observed in the wave-form chart that are also updated in real-time; thereby
increasing our sense of transient specifications being changed with respect to the
gains and the sampling interval.
The results displayed in the response show that the motor approaches the set-point
in 5 seconds with time constant of 2.3 seconds and an error of 1.3 %. A low-pass filter
is employed to reduce spikes arising from vibrations due to imperfect coupling
between the drive and load motors. However, the use of filter slows down the
transient response as well.

4.2 Thermal Feedback Control System


The objective in this task is to design a digital measurement and control system with
temperature as the physical quantity of interest. The body of this system comprises a
wooden box which provides a closed environment. However, an external disturbance
in the form of heat-loss is present and therefore a digital PID controller is designed. A
sketch of this system is shown in the Fig. 6. An electric bulb and a cooling fan are the
means of actuation.

Fig. 6. Physical description of the thermal system

The essential parts of the overall system are shown in block diagram of Fig. 7. The
plant in this case is the wooden chamber whose temperature is being controlled using
continuous control technique of PWM actuation. The bulb is triggered with these PID
proportional PWM command signals.
The actual response of the physical system is practically determined and the data is
plotted in Fig. 8. The system can be approximated by first order differential equation
like that of simple RC network [9]. The temperature response may be given by

−t
T (t ) = (Tss − Ta )(1 − e τ ) + Ta (12)
Virtual Instrumentation for Control Applications 405

Fig. 7. Block diagram of thermal feedback control system

where, T(t) is the temperature at time t, Tss is the steady-state temperature, Ta is the
ambient temperature, and τ is the time constant.

Fig. 8. Plot of temperature function of the system with respect to time

Cooling Source. The fan is used to achieve rapid heat-loss by cooling at a higher rate
than achieved by natural convection. It obeys the Newton's Law of Cooling given by:

= −kωfan(T − Ta )
dT
(13)
dt
The minus sign in equation (13) shows falling temperature. The solution is given by:
− kω fant
T (t ) = Ta + (Ti − Ta )e (14)

where, k is the constant factor related to wooden box, ωfan is the fan angular speed
(assumed constant), Ti is the initial temperature before cooling, Ta is the ambient
temperature and T is the temperature at time t.
406 S.A.A. Rizvi et al.

Steady-State and DC gain. The response shown in the Fig. 8 is a general open-loop
response of the system. Instead of reaching the maximum value of 100 °C a lower set-
point of about 91 °C is provided. The system is able to achieve this temperature and
has no steady-state error. However, the transient response speed can be improved.
The first order transfer function of the system is obtained from its mathematical
model equation and is given by:
1
H ( s) = (15)
sτ + 1

Controller Design and Implementation. In this section we design a controller for


thermal system given by transfer function given in equation (13). We use Matlab for
determining the proper gains to achieve better transient response as in [10]. Once a
controller is designed, it can be implemented in LabVIEW as has been done for the
drive application.
The system is subjected to step-input and the responses are shown in the Fig. 9.
The PI controller (Kp = 2.5, Ki =1) has significantly improved the overall transient
response of this thermal system. Particularly, there is a reduction in rise-time and
settling–time as compared to the open-loop response. However, the integral gain
should be kept only a fraction of the proportional gain to prevent overshoots.

Fig. 9. Step Response with and without controller

Results of VI in Thermal Feedback System. The visual interface shown in Fig. 10


is very similar to the one used in previous application. The controller can be
implemented using the earlier code of our DC drive application with a change of gain
parameters and PIDmax value. The optimum measurement and control range is above
room temperature and below 100 °C.
Virtual Instrumentation for Control Applications 407

Fig. 10. Front Panel VI for thermal feedback control system

When the fan is used to introduce disturbance intentionally, the error initially
increases but the bulb PWM actuation is also increased further to counteract it. The
practical gains were found to be close to the ones determined using simulation. The
final response obtained after some slight tuning is shown in the Fig 11.

Fig. 11. Final PI tuned system response

5 Conclusion

The applications presented in this paper are based on a hardware software co-design
technique. This strategy minimizes the hardware involvement and consequently
reduces the overall system cost. The virtual instrumentation techniques allow rapid
application development. The portability and large storage capability offered by new
PCs enables to carry large number of virtual instruments anywhere. Since,
commercially available DAQ cards are expensive, therefore it is imperative to design
and develop such systems locally. In the light of the results of both VI based designs,
408 S.A.A. Rizvi et al.

it is found that is possible to perform laboratory control experiments without relying


on dedicated hardware. However, better results were obtained for slow systems
(thermal) than for fast mechanical systems (drive). These limitations are not
associated with the VI approach itself and therefore can be overcome by employing a
fast DAQ along with careful modeling and better implementation of the system under
consideration.

Acknowledgements. This work was supported by the authors’ institution, IIEE.

References
1. Ugurlu, Y.: Measuring the Impact of Virtual Instrumentation for Teaching and Research.
In: IEEE Global Engineering Education Conference (EDUCON), pp. 152–158 (2011)
2. Portillo, E., Cabanes, I., Marcos, M., Orive, D., Sanchez, J.A.: Design of a Virtual-
Instrumentation System for a Machining Process. IEEE Transactions on Instrumentation
and Measurement 56(6), 2616–2622 (2007)
3. Eren, H., Fung, C.C.: A Virtual Instrumentation of Electric Drive Systems for Automation
and Testing. In: Proceedings of the 17th IEEE Instrumentation and Measurement
Technology Conference, IMTC, vol. 3, pp. 1500–1505 (2000)
4. Prema, K., Kumar, N.S., Sunitha, K.A.: Online Temperature Control Based on Virtual
Instrumentation. In: International Conference on Control, Automation, Communication
and Energy Conservation, pp. 1–4 (2009)
5. Tang, Z., Xian, F., Fen, L.: Design and Implementation of a Temperature Control System
Base on Convenient DAQ. In: 27th Chinese Control Conference, CCC, pp. 374–376
(2008)
6. Mirza, A., et al.: IPO Pakistan patent 14063: USB Data Acquisition Card. Issued (June 29,
2011)
7. Chen, J., Zeng, X., Zhang, C.: The Portable Data Acquisition System of Cutting Tool
Condition Monitoring Based on Labview & Wavelet Analysis. In: International
Conference on Computer Application and System Modeling (ICCASM), vol. 7, pp. 375–
378 (2010)
8. Seborg, D.E., Edgar, T.F., Mellichamp, D.A., Doyle, F.J.: Process Dynamics and Control,
3rd edn., pp. 145–146. John Wiley and Sons (2010)
9. Bolton, W.: Control Systems, 1st edn., Newnes, pp. 49–50 (2002)
10. Hellerstein, J., Diao, Y., Parekh, S., Tilbury, D.M.: Feedback Control of Computing
Systems, pp. 332–333. Wiley-IEEE (2004)

View publication stats

You might also like