Submitted By:
Haider Ali MS-13-24359
Atif Jameel MS-13-23941
Muhammad Muzaffar Khan MS-13-21082
1 Introduction 1
1.1 A Brief Overview of DC Servomotor . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 PID Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Mathematical Modeling 3
3 PID Controllers 6
3.1 Closed Loop System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 PID Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2.1 Proportional Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.2 Integral Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3 Derivative Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
5 Hardware Implementation 18
5.1 Proportional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.2 Integrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.3 Differentiator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.4 Proportional-Integral-Derivative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6 Summary 21
1
List of Figures
2
Abstract
Introduction
Most of the industrial applications nowadays such as automation, robotics, production lines, CNC
machines and numerically controlled machinery require high dynamics on their position and speed
control and their starting and stopping functions need to be controlled quickly and accurately [3].
These systems incorporate DC servomotors as one of their vital components. DC servomotors
have a large market share in the Industry Automation and Drive Technologies. Because of their
importance, the design of the controllers for these servo systems has become an interesting area of
researchers all over the world.
The proportional-Integral-Derivative controllers (PID) have been extensively used over the past
few decades due to their efficiency, robustness and simplicity. It is estimated that PID controllers
are still employed in 95% of the industrial processes [1] and are widely used in the fields of ser-
vomotor control, robotics, temperature control and power electronics. These PID controllers are
usually implemented either in hardware using analog components or in software using computer
based systems.
This report provides a systematic approach to designing an efficient PID controller for a DC servo-
motor. The content is organized as follows: Chapter 1 gives a brief overview of the DC servomotor
and the PID controller. Mathematical modeling of the servomotor is described in chapter 2. In
chapter 3, different parts of a PID controller are discussed. Simulink modeling and hardware im-
plementation are presented in chapter 4 and chapter 5 respectively. Chapter 6, the last section,
drafts the summary of the whole discussion.
1
Figure 1.1: Components of a Servo Motor
smaller pulse width turns it 900 in anti-clockwise direction. The servo expects to see a pulse every
20ms and the position pulse must be repeated to instruct the servo to remain in position [2].
Servo motors are used extensively in robotics industry and radio-controlled airplanes. These motors
are most commonly employed in closed loop control systems where the programmed position of
motion and velocity feedback controllers are required [4]. Different studies and researches have
been conducted on the servo motor control. Currently, the conventional method of servo motor
control is based on proportional integral derivative.
2
Chapter 2
Mathematical Modeling
In this chapter, we discuss the steps involved in driving the mathematical model of an open loop
system of a DC servomotor. The figure 2.1 shows a DC motor attached to an inertial load. The
voltages applied to the armature and field sides of the motor are represented by Vf and Va respec-
tively. Similarly, Rf , Lf , Ra and La indicate the resistances and inductances of field and armature
sides of the motor. The motor can either be field controlled or armature controlled. In a field
controlled motor, the armature current ia is held constant and the field current if is controlled
through the field voltage Vf . On the other hand, the field current if is constant in an armature
controlled motor and the armature current ia is controlled via the armature voltage Va .
The air gap flux φ of the motor is proportional to the field current and can be written as:
φ = Kf if
where Kf is a constant. The torque T delivered by the motor, in turn, is proportional to the
3
product of armature current ia and air gap flux as:
T = Ka ia φ
T = Ka ia Kf if
and Ka is also a constant. The DC servo system under examination is an armature control motor
for which armature current ia is variable, as mentioned earlier. The motor torque K is defined as
the product of Ka , Kf and if , therefore:
T = (Ka Kf if )ia
T = Kia
The speed of an armature controlled DC motor is controlled by the armature voltage va which is
supplied by a power supply. The differential equation for the armature circuit as obtained from the
figure is:
dia
va = Ra ia + La + vb
dt
dθ
where vb is the back emf voltage which is proportional to the angular velocity dt . Thus, with a
back emf constant Kb , we have:
dθ
vb = K b
dt
So, the armature circuit equation can be re-written as:
dia dθ
va = Ra ia + La + Kb (2.1)
dt dt
The armature current produces the torque T which is applied to the inertia and friction following
the equation:
d2 θ dθ
T =J +B
dt2 dt
2
d θ dθ
Kia = J 2 + B (2.2)
dt dt
To solve the differential equations (2.1) and (2.2), we use the technique of Laplace Transform.
Assuming that all the initial conditions are zero, we obtain the following equations in Laplace
Transform:
Now, considering Θ(s) as the output and Va (s) as the output, the transfer function, after simplifying
can be written as:
Θ(s) K
= 2
Va (s) s[La Js + (La B + Ra J)s + Ra B + KKb ]
4
The armature inductanceLa is usually very small and can be easily neglected. Neglecting La , the
transfer function can be reduced to:
Θ(s) K
=
Va (s) s[Ra Js + Ra B + KKb ]
Θ(s) Km
= (2.3)
Va (s) s(Tm s + 1)
where,
K
Km = = motor gain constant
Ra B + KKb
Ra J
Tm = = motor time constant
Ra B + KKb
We know that, angular velocity can be obtained by taking derivative of angular position, i.e.
dθ
w= or Ω(s) = sΘ(s)
dt
The transfer function relating angular velocity and applied voltage can now be written as:
Ω(s) Km
= (2.4)
Va (s) Tm s + 1
Equations (2.3) and (2.4) represent the angular position and angular velocity related to the applied
armature voltage respectively. We will be concerned withe angular position control in this project,
so the transfer function under observation will be:
Km
G(s) = (2.5)
s(Tm s + 1)
The equation (2.5) gives the open loop response of a DC servo motor as shown in figure 2.2 below:
5
Chapter 3
PID Controllers
Here, G(s) represents the transfer function of the actual system i.e. DC servomotor, Gc (s)
shows the Laplace Transform of the controller i.e. PID and e represents the error signal which is
the difference between the output and the actual input of the system. Va and θ are the input and
output of the system respectively.
Now, some performance parameters of a general 2nd order closed loop system shown (3.1) by
equation are presented:
ωn2
G(s) = (3.1)
s2 + 2ζωn + ωn2
The response of such a system, marked with the transient response specifications that are defined
below, is shown in figure 3.2.
• Rise time(tr ): Time required for the response to go from 10% to 90% of the final value.
6
Figure 3.2: Typical 2nd Order Motor Response and Transient Characteristics
• Delay time(td ): Time required for the response to reach 50% of the final value the very first
time.
• Peak time(tp ): The time required for the response to reach the first overshoot.
• Maximum Overshoot(Mp ): The maximum peak value of the response curve measured from
the steady-state value.
• Settling time (ts ): The time required for the response curve to settle within a certain per-
centage of the final value.
• Steady-state error(ess ): Difference between the desired nal output and the actual response
when the system reaches a steady state.
These performance measures help quantify the desired system requirements which, typically, are:
• faster response
• minimal overshoot
7
three responses. The output of a PID controller, equal to the control input to the system, in time
domain is as follows:
Z
de
u(t) = Kp e(t) + Ki e(t) dt + Kd
dt
The transfer function of a PID controller is found by taking Laplace transform of the above equation:
Ki
Gc (s) = Kp + + Kd s
s
Kd s2 + Kp s + Ki
Gc (s) = (3.2)
s
where Kp , Ki and Kd are the controlling parameters of a PID controller defined as:
We now discuss the contribution of each of the three parameters in improving the system response.
P = Kp e(t)
8
derivative response is highly sensitive to noise in the sensor output signal. The derivative term is
given by:
de
D = Kd
dt
9
Chapter 4
In this chapter, we will first find the parameters of our actual DC servo system to find its open
loop and closed loop unity feedback transfer functions. Then the system is modeled and analysed
using Simulink. Lastly, PID controller implementation using MATLAB is discussed.
Km
G(s) =
s(Tm s + 1)
The unity feedback closed loop transfer function can thus obtained as:
G(s)
T (s) =
1 + G(s)
Km
T (s) = (4.1)
Tm s2 + s + Km
Rearranging the above equation, we can write that:
Km
Tm
T (s) = s Km
(4.2)
s2 + Tm + Tm
The equation (4.1) can easily be compared with the transfer function of a typical second order
system involving its parameters ζ and ωn as given in equation (3.1). Comparing, we get:
ωn
Km = (4.3)
2ζ
1
Tm = (4.4)
2ζωn
10
Figure 4.1: Parameter Estimation via Response Curve
11
Now, looking at the response curve shown in figure 4.1, we can find the peak overshoot by the
following relation:
θ(t) − θ(∞)
Mp =
θ(∞)
4 − 3.2
Mp = = 0.25
3.2
√
2
Equating this value of peak overshoot Mp with e−(ζ/ 1−ζ )π :
√
2
0.25 = e−(ζ/ 1−ζ )π
Solving for ζ:
ζ = 0.4037 (4.5)
Now, to find natural frequency ωn , we use peak time tp which is given by:
π
tp =
ωn (1 − ζ 2 )
Solving for ωn :
Putting the values of ωn and ζ obtained in equations (4.6) and (4.7) in equations (4.3) and (4.4),
we get the following values of Km and Tm :
Km = 7.332
Tm = 0.2092
The open loop and closed loop transfer functions of the DC servo motor can be obtained by putting
the values of Km and Tm in equation (2.5) and (4.2) respectively:
7.332
G(s) = (4.7)
0.2092s2 + s
35.04
T (s) = 2 (4.8)
s + 4.78s + 35.04
12
4.2.1 Simulink Modeling and Analysis
The closed loop system as modeled in Simulink is shown in figure 4.2 below:
A step input of magnitude 3.2 is applied to the system and the response curve obtained is shown
in figure 4.3:
We can see that the response obtained from Simulink as shown in figure 4.3 is exactly the
response of the original system as shown in figure 4.1 with both having an overshoot of 0.25, peak
time of 0.58 sec and settling time of 1.67 sec.
Design Objectives
We have assumed our design objectives as:
• Peak Overshoot less than 10%
• Settling time less than 1 sec
13
4.2.2 Root Locus
In this section, the system model is analysed using the technique of root locus via the aid of
MATLAB sisostool. As mentioned earlier, we have assumed our objectives to reduce the percentage
overshoot less than 10% and settling time less than 1 sec. The ζ and ωn corresponding to these
parameter objectives are obtained as 0.5912 and 6.7664 sec respectively. The root locus of the
original system and the desired values of ζ and ωn are plotted in the figure 4.4 below:
6.77
6
0.591
4
Imaginary Axis (seconds−1)
−2
−4
0.591
−6
6.77
−5 −4 −3 −2 −1 0 1
−1
Real Axis (seconds )
It is evident from the above figure that the points corresponding to the desired parameter values
do not fall on the root locus of the system. Therefore, the required specifications cannot be achieved
by simple gain adjustment method.
14
Figure 4.5: Simulink Model of PID Controller
The PID tuner allows you to set your desired system specifications i.e. whether to make the
system’s response time or transient behavior slower or faster thus changing the values of rise time,
settling time, peak time and peak overshoot which, in turn, change the values of Kp , Ki and Kd .
The following figure shows the tuning window. Note that the gain values for ζ ≤ 10% and ts ≤ 1sec
are shown on the right side window:
Kp = 1.2153 (4.9)
Ki = 0.22636 (4.10)
Kd = 0.15033 (4.11)
These gain values are now inserted in the transfer function of the PID controller as obtained in
equation (4.12) to obtain Gc (s). The controller transfer function can thus be written as:
15
Root locus of Controlled System using PID
−2
−4
−6
−25 −20 −15 −10 −5 0 5
Real Axis (seconds−1)
The comparison between the transient responses of controlled and uncontrolled systems is shown
in the figure 4.8 below:
1.4
Uncontrolled System
Controlled System
1.2
1
Amplitude
0.8
0.6
0.4
0.2
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (seconds)
16
It is evident from the above figure that the transient response of the system has been improved
in terms of rise time, peak overshoot and settling time.
Now that we have obtained the values of gains corresponding to the desired specifications, we
can now translate these gain values into an electronic circuit using operational amplifiers, the
implementation of which is described in the next chapter.
17
Chapter 5
Hardware Implementation
In this chapter, the practical implementation of a PID circuit using analog electronic components
i.e. operational amplifiers is discussed. Firstly, each of the three components with their transfer
functions are presented and then they are combined to form the PID controller.
5.1 Proportional
The proportional part of a PID controller is implemented using an inverting amplifier as shown in
figure 5.1 below.
Rf = 1.2153 × 10 kΩ
Rf = 12.153 kΩ
18
5.2 Integrator
The circuit to implement the integrator part is shown in figure 5.2 below:
5.3 Differentiator
The figure 5.3 shows the circuit to implement the derivative part of the PID:
G(s) = −sRC
19
In the case of a differentiator:
Kd = RC
5.4 Proportional-Integral-Derivative
The complete circuit of a PID controller can now be implemented by combining the above three
parts using an Op-Amp summer. The output of the summer is inverted, therefore, an inverter is
used at the summer output to change the controller output phase. The complete circuit is shown
in figure 5.4 below:
20
Chapter 6
Summary
This report presents a formal approach to designing a PID controller of a DC Servo System. A
complete design process of the DC Servo System, following all steps, is discussed. The problem
addressed is: “Given a model of a DC Servo System, design a PID controller to meet the desired
performance specifications”. First of all, the given system is identified by determining its variables
and specifications. Then, the system’s electrical and mathematical modeling is carried out to find
its transfer function and establish its configuration. After system definition and modeling, the gain
values of the PID controller are obtained using MATLAB Simulink. Lastly, these parameters are
then tuned to get the desired response.
The difference between the results of hardware implementation and the MATLAB simulation can
be attributed to the approximations made in the modeling of the system. This is because we have
estimated our original 3rd order system with a 2nd order system by ignoring motor’s armature
inductance La . Another consideration in this regard is the change in the values of the electronic
components i.e. resistors and capacitors with the environmental changes.
The efficiency of the designed controller can be improved by taking the original 3rd order system
instead of using its approximation, which will give us more information about the system. An-
other improvement can be obtained by implementing the PID controller using a microcontroller
instead of analog electronic components because microcontrollers, unlike analog components, are
less susceptible to environmental changes.
21
Appendix
MATLAB Code
%************************************************************************%
%FILE NAME: PROJECT_CSD.m
%Objective : Design and Modeling of PID controller for DC Servo System
%
%**************************************************************************
clc
clear all
%**************************************************************************
% DC Servo System in unity feedback without any Controller
% tp=0.58sec, PO=25% for step input
%**************************************************************************
Mp=0.25;
tp=0.58;
a=(-(log(Mp))/pi)^2; % Mp=exp(-zeta*pi/sqrt(1-zeta^2))
system_zeta=sqrt(a/(1+a));
system_wn=pi/(tp*sqrt(1-(system_zeta)^2)); % tp=pi/wd;
required_zeta=0.5912;
required_wn=6.7664;
%**************************************************************************
% our open loop transfer function is G(s)=km/(Tms^2+s)
% by parameter estimation Tm=0.2092; and Km=7.331;
%**************************************************************************
num=[7.332];
denum=[0.2092 1 0];
G_s=tf(num,denum);
figure(1)
rlocus(G_s)
sgrid(required_zeta,required_wn)
axis([-5 1 -7 7])
title(’Root Locus of Uncontrolled DC Servo System’)
Mp=0.05;
22
ts=0.5;
b=(-(log(Mp))/pi)^2; % Mp=exp(-zeta*pi/sqrt(1-zeta^2))
desired_zeta=sqrt(b/(1+b));
desired_wn=4/((desired_zeta)*ts); % ts=4/sigma;
%**************************************************************************
% thsi can be achievd using PID controller==========================
% by using Nichols Ziegler criteria we found the values of Kp, Ki, and Kd
%**************************************************************************
kp=1.2153;
ki=0.22636;
kd=0.15033;
closd_tf=cmbind_tf/(1+cmbind_tf);
figure(4)
step(closd_tf);
title(’Step response of Controlled System using PID’)
23
Bibliography
[1] K.J. Astrom and T. H. Hagglund. New tuning methods for pid controllers. In Proc. of 3rd
European Conference, pages pp. 2456–2462, 1995.
[2] B. Kocherov M. Baron. Vision guided motor control for semi-autonomous military vehicle.
Technical report, Institute Technology of Steven, 2007.
[3] K. Seki, H. Yokoi, and M. Iwasaki. Experimental evaluations of friction behavior in micro-
displacement region positioning for servo motor with air bearings. In Advanced Intelligent
Mechatronics (AIM), 2012 IEEE/ASME International Conference on, pages 731–736, July
2012.
[4] Rong-Jong Wai and R. Muthusamy. Fuzzy-neural-network inherited sliding-mode control for
robot manipulator including actuator dynamics. Neural Networks and Learning Systems, IEEE
Transactions on, 24(2):274–287, 2013.
24