. EE501 Term Project Position Control of a DC Servo System using a PID Controller Submitted By: Haider Ali MS-13-24359 Atif Jameel MS-13-23941 Muhammad Muzaffar Khan MS-13-21082 Dept of Electrical Engineering Pakistan Institute of Engineering & Applied Sciences Course Instructor: Dr. Ghulam Mustafa
28
Embed
Position Control of a DC Servo System using a PID Controller
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
.
EE501 Term Project
Position Control of a DC ServoSystem using a PID Controller
Submitted By:
Haider Ali MS-13-24359Atif Jameel MS-13-23941
Muhammad Muzaffar Khan MS-13-21082
Dept of Electrical EngineeringPakistan Institute of Engineering & Applied Sciences
In this report, position control of a DC Servo Motor using a Proportional-Integral-Derivative (PID)controller is presented. The electrical and mathematical modeling of a typical DC Servo Motor isdiscussed. After obtaining a generic system model, the system parameters are determined using thesystem’s closed loop response. The obtained system is then modeled, simulated and analysed usingthe root locus technique via the aid of MATLAB and Simulink. The desired system specificationsare then defined and MATLAB PID autotuner is used to find the gain values of the PID controllercorresponding to those specifications. Lastly, hardware implementation of a PID using operationalamplifiers is discussed along with the method to find the component values i.e. resistors andcapacitors.
Chapter 1
Introduction
Most of the industrial applications nowadays such as automation, robotics, production lines, CNCmachines and numerically controlled machinery require high dynamics on their position and speedcontrol 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 servomotorshave a large market share in the Industry Automation and Drive Technologies. Because of theirimportance, the design of the controllers for these servo systems has become an interesting area ofresearchers all over the world.The proportional-Integral-Derivative controllers (PID) have been extensively used over the pastfew decades due to their efficiency, robustness and simplicity. It is estimated that PID controllersare 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 areusually implemented either in hardware using analog components or in software using computerbased 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 servomotorand the PID controller. Mathematical modeling of the servomotor is described in chapter 2. Inchapter 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.1 A Brief Overview of DC Servomotor
A DC servomotor is an electromechanical device which allows for precise control of angular positionand motion using an input voltage. A DC servomotor is actually an assembly of three maincomponents 1.1: a simple DC motor, a feedback sensing device (potentiometer in case of positioncontrol) and a control circuit. The motor is attached to the wheel using gears. A control signalrepresenting the desired output position of the servo shaft is applied to the servomotor. As themotor rotates, the resistance of the potentiometer changes and the control circuit can preciselyregulate both the position of the shaft and the direction of its movement. As the motor shaft is atthe desired position, power supplied to the motor is stopped.
Servomotors are controlled using the technique of Pulse Width Modulation (PWM) in whichelectrical pulses of variable widths are sent via control wires. The duration of the positive-goingpulse determines the position of the servo shaft. Generally, a pulse of 1.5ms defines the centerposition of the motor. A greater pulse width turns the motor 900 in clockwise direction and a
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 every20ms 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 motorsare most commonly employed in closed loop control systems where the programmed position ofmotion and velocity feedback controllers are required [4]. Different studies and researches havebeen conducted on the servo motor control. Currently, the conventional method of servo motorcontrol is based on proportional integral derivative.
1.2 PID Controller
Proportional-Integral-Derivative (PID) control is the most common control algorithm used in in-dustry and has been universally accepted in industrial control. The popularity of PID controllerscan be attributed partly to their robust performance in a wide range of operating conditions andpartly to their functional simplicity, which allows engineers to operate them in a simple, straight-forward manner.As the name suggests, PID algorithm consists of three basic coefficients; proportional, integral andderivative which are varied to get optimal response. The basic idea behind a PID controller isto read a sensor, then compute the desired actuator output by calculating proportional, integral,and derivative responses and summing those three components to compute the output. Differentvariants of a PID controller include PI, PD, P or I controller in the absence of the respective controlaction. All the three constituents of PID are explained in detail in 3.
2
Chapter 2
Mathematical Modeling
In this chapter, we discuss the steps involved in driving the mathematical model of an open loopsystem of a DC servomotor. The figure 2.1 shows a DC motor attached to an inertial load. Thevoltages 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 armaturesides of the motor. The motor can either be field controlled or armature controlled. In a fieldcontrolled motor, the armature current ia is held constant and the field current if is controlledthrough the field voltage Vf . On the other hand, the field current if is constant in an armaturecontrolled motor and the armature current ia is controlled via the armature voltage Va.
Figure 2.1: DC Motor Equivalent Circuit
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 = Kaiaφ
T = KaiaKf if
and Ka is also a constant. The DC servo system under examination is an armature control motorfor which armature current ia is variable, as mentioned earlier. The motor torque K is defined asthe product of Ka, Kf and if , therefore:
T = (KaKf if )ia
T = Kia
The speed of an armature controlled DC motor is controlled by the armature voltage va which issupplied by a power supply. The differential equation for the armature circuit as obtained from thefigure is:
va = Raia + Ladiadt
+ vb
where vb is the back emf voltage which is proportional to the angular velocity dθdt . Thus, with a
back emf constant Kb, we have:
vb = Kbdθ
dt
So, the armature circuit equation can be re-written as:
va = Raia + Ladiadt
+Kbdθ
dt(2.1)
The armature current produces the torque T which is applied to the inertia and friction followingthe equation:
T = Jd2θ
dt2+B
dθ
dt
Kia = Jd2θ
dt2+B
dθ
dt(2.2)
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 LaplaceTransform:
Va(s) = (Las+Ra)Ia(s) +KbsΘ(s)
KIa(s) = (Js2 +Bs)Θ(s)
Now, considering Θ(s) as the output and Va(s) as the output, the transfer function, after simplifyingcan be written as:
Θ(s)
Va(s)=
K
s[LaJs2 + (LaB +RaJ)s+RaB +KKb]
4
The armature inductanceLa is usually very small and can be easily neglected. Neglecting La, thetransfer function can be reduced to:
Θ(s)
Va(s)=
K
s[RaJs+RaB +KKb]
Θ(s)
Va(s)=
Km
s(Tms+ 1)(2.3)
where,
Km =K
RaB +KKb= motor gain constant
Tm =RaJ
RaB +KKb= motor time constant
We know that, angular velocity can be obtained by taking derivative of angular position, i.e.
w =dθ
dtor Ω(s) = sΘ(s)
The transfer function relating angular velocity and applied voltage can now be written as:
Ω(s)
Va(s)=
Km
Tms+ 1(2.4)
Equations (2.3) and (2.4) represent the angular position and angular velocity related to the appliedarmature voltage respectively. We will be concerned withe angular position control in this project,so the transfer function under observation will be:
G(s) =Km
s(Tms+ 1)(2.5)
The equation (2.5) gives the open loop response of a DC servo motor as shown in figure 2.2 below:
Figure 2.2: Open Loop Control of DC Servo Motor
5
Chapter 3
PID Controllers
In this chapter, a brief overview of the Proportional-Integral-Derivative (PID) controller is pre-sented. We will consider a closed loop system with unity feedback and discuss how each of thethree parameters of a PID controller affect the response of a closed loop system individually.
3.1 Closed Loop System
A closed loop control system, commonly referred to as a feedback control system, is the one in whichthe output of the system is constantly fed back into the input of the control system. This feedbackconfiguration allows the system to constantly know the state of its output. This information helpssystem to continuously correct the actual input to the system to reach the desired state. Typically,a DC servomotor closed loop system with unity feedback is shown in figure 3.1.
Figure 3.1: Unity Feedback Closed Loop System
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 isthe difference between the output and the actual input of the system. Va and θ are the input andoutput of the system respectively.Now, some performance parameters of a general 2nd order closed loop system shown (3.1) byequation are presented:
G(s) =ω2n
s2 + 2ζωn + ω2n
(3.1)
The response of such a system, marked with the transient response specifications that are definedbelow, 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 firsttime.
• 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 fromthe 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 responsewhen the system reaches a steady state.
These performance measures help quantify the desired system requirements which, typically, are:
• faster response
• minimal overshoot
• lesser settling time and
• minimum steady-state error
3.2 PID Theory
The basic idea behind a PID controller is to read a sensor and then compute the error e between theactual input Va and the sensor output. This error e is then fed to the PID controller which calculatesits proportional, integral and derivative responses and the output θ is produced by summing these
7
three responses. The output of a PID controller, equal to the control input to the system, in timedomain is as follows:
u(t) = Kpe(t) +Ki
∫e(t) dt +Kd
de
dt
The transfer function of a PID controller is found by taking Laplace transform of the above equation:
Gc(s) = Kp +Ki
s+Kds
Gc(s) =Kds
2 +Kps+Ki
s(3.2)
where Kp, Ki and Kd are the controlling parameters of a PID controller defined as:
Kp = Proportional gain constant
Ki = Integral gain constant
Kd = Derivative gain constant
We now discuss the contribution of each of the three parameters in improving the system response.
3.2.1 Proportional Response
The proportional component has the effect of reducing the rise time and steady state error of thesystem and depends only on the difference between the actual input and the sensor output whichis called error e. The proportional gain Kp determines the ratio of the output response to theerror signal. In general, increasing the proportional gain Kp increases the speed of the system butthe tendency towards oscillations also increases . However, if Kp is increased too large, the sensoroutput will begin to oscillate. If it is increased further, the oscillations will become larger and thesystem may become unstable. The proportional term is given by:
P = Kpe(t)
3.2.2 Integral Response
The integral component sums the error term e over time and gives the accumulated offset thuseliminating the steady state error. The integral term accelerates the movement of the processtowards setpoint and eliminates the residual steady-state error that occurs with a pure proportionalcontroller. It, however, increases the settling time of the system along with the oscillations. Theintegral term is given by:
I = Ki
∫e(t) dt
3.2.3 Derivative Response
The derivative response of the controller is proportional to the rate of change of the sensor out-put. It is calculated by determining the slope of the error over time and multiplying this rateby the derivative gain constant Kd. Derivative action predicts system behavior and has the ef-fect of increasing the stability of the system, reducing the overshoot, and improving the transientresponse.Most practical control systems use very small derivative gain constant Kd, because the
8
derivative response is highly sensitive to noise in the sensor output signal. The derivative term isgiven by:
D = Kdde
dt
9
Chapter 4
Design, Simulation and Analysis
In this chapter, we will first find the parameters of our actual DC servo system to find its openloop and closed loop unity feedback transfer functions. Then the system is modeled and analysedusing Simulink. Lastly, PID controller implementation using MATLAB is discussed.
4.1 Parameter Estimation
The transfer function of the system can be obtained if we know the values of all the systemparameters i.e. Ra, B, J , Kb and the like, which, in this case, are not known. So we use thealternate method of estimating the parameters from the output plot. This plot is given in figure4.1 which shows the response of the unity feedback DC servo system. The open loop transferfunction of our system as obtained in equation (2.5) is:
G(s) =Km
s(Tms+ 1)
The unity feedback closed loop transfer function can thus obtained as:
T (s) =G(s)
1 +G(s)
Putting the value of G(s) and simplifying:
T (s) =Km
Tms2 + s+Km(4.1)
Rearranging the above equation, we can write that:
T (s) =KmTm
s2 + sTm
+ KmTm
(4.2)
The equation (4.1) can easily be compared with the transfer function of a typical second ordersystem involving its parameters ζ and ωn as given in equation (3.1). Comparing, we get:
Km =ωn2ζ
(4.3)
Tm =1
2ζωn(4.4)
10
Figure 4.1: Parameter Estimation via Response Curve11
Now, looking at the response curve shown in figure 4.1, we can find the peak overshoot by thefollowing relation:
Mp =θ(t)− θ(∞)
θ(∞)
Mp =4− 3.2
3.2= 0.25
Equating this value of peak overshoot Mp with e−(ζ/√
1−ζ2)π:
0.25 = e−(ζ/√
1−ζ2)π
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)
From the response plot 4.1, tp = 0.58sec, therefore:
0.58 =π
ωn(1− ζ2)
Solving for ωn:
ωn = 5.92 rad/sec (4.6)
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 puttingthe values of Km and Tm in equation (2.5) and (4.2) respectively:
G(s) =7.332
0.2092s2 + s(4.7)
T (s) =35.04
s2 + 4.78s+ 35.04(4.8)
4.2 MATLAB Implementation
In this section, the DC servo system model as obtained previously is modeled, simulated andanalysed using MATLAB.
12
4.2.1 Simulink Modeling and Analysis
The closed loop system as modeled in Simulink is shown in figure 4.2 below:
Figure 4.2: Simulink Model of Closed Loop System
A step input of magnitude 3.2 is applied to the system and the response curve obtained is shownin figure 4.3:
Figure 4.3: Response Curve of Closed Loop System
We can see that the response obtained from Simulink as shown in figure 4.3 is exactly theresponse of the original system as shown in figure 4.1 with both having an overshoot of 0.25, peaktime 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 ofMATLAB sisostool. As mentioned earlier, we have assumed our objectives to reduce the percentageovershoot less than 10% and settling time less than 1 sec. The ζ and ωn corresponding to theseparameter objectives are obtained as 0.5912 and 6.7664 sec respectively. The root locus of theoriginal system and the desired values of ζ and ωn are plotted in the figure 4.4 below:
−5 −4 −3 −2 −1 0 1
−6
−4
−2
0
2
4
60.591
0.591
6.77
6.77
Root Locus of Uncontrolled DC Servo System
Real Axis (seconds−1)
Imag
inar
y A
xis
(sec
onds
−1 )
Figure 4.4: Root locus of Uncontrolled DC Servo System
It is evident from the above figure that the points corresponding to the desired parameter valuesdo not fall on the root locus of the system. Therefore, the required specifications cannot be achievedby simple gain adjustment method.
4.2.3 PID Controller Design
After analysing the root locus of our DC servo system, we have deduced that there is a need to addsome poles and/or zeros to change the root locus thus allowing it to pass through our desired points.Consequently, a PID controller is designed for this purpose. Specifically, we need to determine theparameters Kp, Ki and Kd of our PID controller which are obtained using PID tuner block availablein MATLAB Simulink as shown in figure 4.5 below:
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 thesystem’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 ≤ 1secare shown on the right side window:
Figure 4.6: PID Tuning
Therefore, our required gain values are:
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 inequation (4.12) to obtain Gc(s). The controller transfer function can thus be written as:
Gc(s) =0.15033s2 + 1.2153s+ 0.22636
s(4.12)
The updated system now has the configuration of figure 3.1 in which the controller transfer functionis multiplied by the system transfer function. This updated system is now implemented in MATLABand the root locus now looks like:
15
−25 −20 −15 −10 −5 0 5−6
−4
−2
0
2
4
6
Root locus of Controlled System using PID
Real Axis (seconds−1)
Imag
inar
y A
xis
(sec
onds
−1 )
Figure 4.7: Root Locus of Controlled System using PID
The comparison between the transient responses of controlled and uncontrolled systems is shownin the figure 4.8 below:
0 0.5 1 1.5 2 2.5 3 3.5 4 4.50
0.2
0.4
0.6
0.8
1
1.2
1.4
Transient behavior Comparison
Time (seconds)
Am
plitu
de
Uncontrolled SystemControlled System
Figure 4.8: Comparison of Transient Behaviors
16
It is evident from the above figure that the transient response of the system has been improvedin terms of rise time, peak overshoot and settling time.Now that we have obtained the values of gains corresponding to the desired specifications, wecan now translate these gain values into an electronic circuit using operational amplifiers, theimplementation 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 componentsi.e. operational amplifiers is discussed. Firstly, each of the three components with their transferfunctions 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 infigure 5.1 below.
Figure 5.1: Inverting Gain Op-Amp
The transfer function is given by:
G(s) = −RfRin
The proportional gain is given by the following relation of resistors:
Kp =RfRin
Let Rin = 10 kΩ and Kp is 1.2153 as obtained in equation (4.9), then:
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:
Figure 5.2: Op-Amp Integrator
The transfer function in this case is given by:
G(s) = − 1
sRC
In this case, the relation among Ki, R and C is given by:
Ki =1
RC
Assuming, C = 100 µF and Ki = 0.22636 (4.11), then:
R =1
100× 10−6 × 0.22636
R = 44.177 kΩ
5.3 Differentiator
The figure 5.3 shows the circuit to implement the derivative part of the PID:
Figure 5.3: Op-Amp Differentiator
The transfer function of a differentiator is given by:
G(s) = −sRC
19
In the case of a differentiator:
Kd = RC
Again, assume that C = 100 µF and Ki = 0.15033 (4.10), then:
R =0.15033
100× 10−6
R = 1.503 kΩ
5.4 Proportional-Integral-Derivative
The complete circuit of a PID controller can now be implemented by combining the above threeparts using an Op-Amp summer. The output of the summer is inverted, therefore, an inverter isused at the summer output to change the controller output phase. The complete circuit is shownin figure 5.4 below:
Figure 5.4: PID Circuit
20
Chapter 6
Summary
This report presents a formal approach to designing a PID controller of a DC Servo System. Acomplete design process of the DC Servo System, following all steps, is discussed. The problemaddressed is: “Given a model of a DC Servo System, design a PID controller to meet the desiredperformance specifications”. First of all, the given system is identified by determining its variablesand specifications. Then, the system’s electrical and mathematical modeling is carried out to findits transfer function and establish its configuration. After system definition and modeling, the gainvalues of the PID controller are obtained using MATLAB Simulink. Lastly, these parameters arethen tuned to get the desired response.The difference between the results of hardware implementation and the MATLAB simulation canbe attributed to the approximations made in the modeling of the system. This is because we haveestimated our original 3rd order system with a 2nd order system by ignoring motor’s armatureinductance La. Another consideration in this regard is the change in the values of the electroniccomponents i.e. resistors and capacitors with the environmental changes.The efficiency of the designed controller can be improved by taking the original 3rd order systeminstead 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 microcontrollerinstead of analog electronic components because microcontrollers, unlike analog components, areless susceptible to environmental changes.
% transfer function of Controller=========================
num1=[kd kp ki];
denum1=[1 0];
Gc_s=tf(num1,denum1);
cmbind_tf=(G_s)*(Gc_s); % Combined transfer function of plant and PID controller
figure(3)
rlocus(cmbind_tf);
title(’Root locus of Controlled System using PID’)
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 3rdEuropean 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 IntelligentMechatronics (AIM), 2012 IEEE/ASME International Conference on, pages 731–736, July2012.
[4] Rong-Jong Wai and R. Muthusamy. Fuzzy-neural-network inherited sliding-mode control forrobot manipulator including actuator dynamics. Neural Networks and Learning Systems, IEEETransactions on, 24(2):274–287, 2013.