Anda di halaman 1dari 28

Sri Lanka Institute of Information Technology

Faculty of Engineering
Department of Electrical and Computer
Engineering
EC3501: Control Systems
Lab 02: DC Motor Control and PID Control

Name

Index Number

De Silva O.R.M.

EN14536458

Kaushalya S.A.D.T.P.

EN14535468

Kehelalla P.H.

EN14522802

Group

: Group 03

Submission Date : 18th April 2016

Contents
List of Figures ................................................................................................................................. 2
Introduction ..................................................................................................................................... 4
Modeling a DC Motor..................................................................................................................... 5
Model a DC Motor using the physical model Approach ............................................................ 5
Modelling the Mechanical Portion of the System....................................................................... 5
Modified Mechanical Portion of the System .............................................................................. 6
Modified Mechanical Portion of the System for a Translation Motion ...................................... 6
Proportional Control ....................................................................................................................... 8
PD Control ................................................................................................................................ 11
PI Control .................................................................................................................................. 13
PID Control ............................................................................................................................... 15
Tuning Kp .................................................................................................................................. 16
Tuning Ki .................................................................................................................................. 17
Tuning Kd .................................................................................................................................. 18
Tuned PID Controller ............................................................................................................... 19
PID Control Design with Control System Toolbox ...................................................................... 20
Proportional controller .............................................................................................................. 20
PI Controller.............................................................................................................................. 21
PID controller............................................................................................................................ 22
Tune PID controller for a DC Motor in MATLAB SIMULINK .................................................. 23
Conclusion .................................................................................................................................... 27
Bibliography ................................................................................................................................. 27

Page | 1

List of Figures
Figure 1: Current Scope in DC Motor ............................................................................................ 5
Figure 2: Physical Model of a DC Motor ....................................................................................... 5
Figure 3: Current Scope of the mechanical portion ........................................................................ 5
Figure 4: DC Motor with Mechanical portion ................................................................................ 5
Figure 5: Modified Mechanical Portion of the System ................................................................... 6
Figure 6: Scope 1 Output ................................................................................................................ 6
Figure 7: System for a Translation Motion ..................................................................................... 6
Figure 8: Scope 1 ............................................................................................................................ 6
Figure 9: Scope of translational motion .......................................................................................... 7
Figure 11: Scope of Translational spring rate 100 .......................................................................... 7
Figure 10: Scope of Translational spring rate 10 ............................................................................ 7
Figure 1 - Variation of Overshoot for different Kp values ............................................................. 8
Figure 2 - Overshoot vs Kp ............................................................................................................. 9
Figure 3 - Variation of Settling Time for different Kp values ...................................................... 10
Figure 4 - Settling Time vs. Kp .................................................................................................... 10
Figure 5 - Step Response of the system with PD controller for various Kd values ...................... 11
Figure 6 - Overshoot vs Kd ........................................................................................................... 12
Figure 7 - Step Response for the system with PI controller ......................................................... 13
Figure 8 - Settling time vs Ki ........................................................................................................ 14
Figure 9 - Step Response with PID controller .............................................................................. 15
Figure 10 - Tuning for Kp ............................................................................................................. 16
Figure 11 - Tuning for Ki.............................................................................................................. 17
Figure 12 - Tuning for Kd ............................................................................................................. 18
Figure 13 Step Response Before Tuning and After Tuning of PID ........................................... 19
Figure 1: Variation of the system response with increasing response time .................................. 20
Figure 2: Effect of the variation of response time on the response. ............................................. 22
Figure 1: System model ................................................................................................................ 23
Figure 2: Initial parameters given for the PID controller ............................................................. 24
Figure 3: System response for the given parameters .................................................................... 24
Figure 4: Initial tuned response..................................................................................................... 25
Page | 2

Figure 5: Kp,ki and kd values for tuned response ........................................................................ 25


Figure 6: Tuned response .............................................................................................................. 26
Figure 7: Obtained response for tuned controller. ........................................................................ 26

Page | 3

Introduction
Proportional-Integral-Derivative (PID) control is the most common control algorithm used in
industry and has been universally accepted in industrial control. The popularity of PID
controllers can be attributed partly to their robust performance in a wide range of operating
conditions and partly to their functional simplicity, which allows engineers to operate them in a
simple, straightforward manner. PID algorithm consists of three basic coefficients proportional,
integral and derivative which are varied to get optimal response.
The basic idea behind a PID controller is to 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. The proportional term produces an output value that is
proportional to the current error value, the contribution from the integral term is proportional to
both the magnitude of the error and the duration of the error and in the derivative of the process
error is calculated by determining the slope of the error over time and multiplying this rate of
change by the derivative gain. [1]
The process of setting the optimal gains for P, I and D to get an ideal response from a control
system is called tuning. PID controller tuning appears easy, but finding the set of gains that
ensures the best performance of your control system is a complex task. Traditionally, PID
controllers are tuned either manually or using rule-based methods. Manual tuning methods are
iterative and time-consuming. But MATLAB can automatically tune PID controllers to achieve
the optimal system design and to meet design requirements, even for plant models that traditional
rule-based methods cannot handle well.
DC motors are widely used in industrial control systems because they are well understood and
easy to control. Usually, the cogging torque, commutation torque, and friction exist in DC
motors, causing torque ripples in the motor output torque. For cost reduction reasons, cheaper
DC motors are used more in a lot of commercial products such as scanners. For cheap DC
motors, these disturbance torques can be quite large, causing performance issues like speed
ripples. Usually, the closed and/or open-loop control are used to suppress the disturbances. The
main objective of this laboratory is to understand and familiarize with the Simulink function of
the MATLAB software as well as getting the results of DC motor controls and PID controls

Page | 4

Modeling a DC Motor
Model a DC Motor using the physical model Approach

Here in the scope current value is a constant of 1A since there is no current decaying and
a DC Voltage source is used

Figure 2: Physical Model of a DC Motor

Figure 1: Current Scope in DC Motor

Modelling the Mechanical Portion of the System

Here the current is flowing through rotational electromechanical converter so the current
is decaying. The resulting torque is positive because the current flowing from the positive
to negative terminal is positive

Page | 5
Figure 4: DC Motor with Mechanical portion

Figure 3: Current Scope of the mechanical portion

Modified Mechanical Portion of the System

The Ideal Rotational Motion Sensor block represents an ideal mechanical rotational
motion sensor. Here ideal rotational motion sensor controls current signal proportional to
angular velocity or angle. Initially it will take some time then becomes a constant value.
The sensor is ideal since it does not account for inertia, friction, delays, energy
consumption, and so on. It starts from zero because DC offset is zero.

Figure 5: Modified Mechanical Portion of the System

Modified Mechanical Portion of the System for a Translation Motion

The Wheel and axle block represents wheel and axle mechanism as an ideal converter
between mechanical rotational and mechanical translational motions. Here Port A is the
mechanical rotational conserving port associated with the axle and Figure 6: Scope 1 Output
port P is the mechanical translational conserving port associated
with the wheel periphery. The wheel and the axle have the same axis, and the axis is
assumed to be rigidly connected to the frame making this mechanism it converts
mechanical rotational into mechanical translational motion.
Initially it oscillates with a larger amplitude an it drops with time so that finally it reaches
an oscillation with a uniform amplitude.

Page | 6

Figure 7: System for a Translation Motion

Figure 8: Scope 1

Connecting PSS Simulink converter to port A after disconnecting from Port W

Figure 9: Scope of translational motion

A springs Spring Rate is the amount of weight required to deflect a spring one inch. The
lower the Spring Rate, the softer the spring. The softer the spring, the smoother the ride.
The magnitude of the spring force is equal to the product of physical signal input and the
relative displacement between two translational conserving ports.
A minimal spring rate prevents non-physical values. When Translational spring rate is at
100 this Oscillate faster than the Translational spring rate is at 10.

Figure 10: Scope of Translational spring rate 100


Figure 11: Scope of Translational spring rate 10

Page | 7

Proportional Control
The below closed loop transfer function was analyzed using MATLAB.

KP was varied to observe the behavior of overshoot and settling time. Below figure shows the
variation of overshoot for the step responses of above system at different values of KP.

Figure 12 - Variation of Overshoot for different Kp values

The characteristics of each of the above step responses were obtained from MATLAB
stepinfo() function and tabulated as below.
Table 1 - Step Response Characteristics for various Kp Values

Kp
4
8
12
16
20
24
28
32
36
40

Overshoot
0
0.0038
0.2640
0.8772
1.7322
2.7221
3.7803
4.8642
5.9523
7.0269

Settling Time
1.2383
0.9833
0.8004
0.6727
0.5824
0.8603
0.8538
0.8308
0.8033
0.7752

It is evident from the figure 2 that the peak overshoot increases with the increasing of KP.
Page | 8

Figure 13 - Overshoot vs Kp

It should also be noted that the step response moves from an over damped response to an under
damped response with the increase of KP. This variation is justified by the below calculation.

(
(

)
)(

Therefore, the step response variation could be given as:


Kp<5 Over damped
Kp=5 Critically damped
Kp>5 Under damped
Figure 1 verifies the above stated conditions.

Below figure shows the variation of settling time for the step responses of above described
system at different values of KP.

Page | 9

Figure 14 - Variation of Settling Time for different Kp values

The settling time of the above responses are varied as shown in figure 4.

Figure 15 - Settling Time vs. Kp

The settling time decreases with the increase of KP in the range of 4 to 20. However, during the
transition of of 20 to 24, settling time increases by a small amount. This could be explained by
using the definition of the settling time: the maximum time taken to reach 98% of the steady
state value. Overshoot is less than 2% in 4 to 20 range, hence settling time comes before the
overshoot take place. But the overshot is greater than 2% from 24 onward. Therefore, the time
taken by the system to reach 98% of its steady state value comes after the overshoot. Considering
the overall variation in figure 4, it could be concluded that the settling time decreases with the
increase of KP.

Page | 10

PD Control
The below closed loop transfer function with a PD controller was analyzed using MATLAB.

The KP value was fixed at 300 and Kd was changes from 10 to 50. The step response for each
case is shown in figure.

Figure 16 - Step Response of the system with PD controller for various Kd values

The characteristics of each of the above step responses were obtained from MATLAB
stepinfo() function and tabulated as below.
Table 2 - Step Response Characteristics for various Kd Values

Kd
10
20
30
40
50

Overshoot
15.3418
5.7909
1.7723
0.0662
0

Settling Time
0.2897
0.2723
0.0920
0.0890
0.0839

Even though the settling time is decreased with the increase of Kd, it is not much significant. The
overshoot is significantly reduced with the increase of Kd. The variation of overshoot with the
derivative gain is plotted in figure 6.

Page | 11

Figure 17 - Overshoot vs Kd

The overshoot exponentially decreases with the increase of Kd. This could be mathematically
represented with below proof. In the above closed loop transfer function,

Since Kp is constant, n is also constant.

Since the damping constant is increased with the increase of Kd, overshoot will eventually get
decreased.
The increasing of the overshoot was the major drawback in the proportional controller, even
though it significantly reduces the settling time. The increasing of overshoot could be addressed
by using the PD controller where the derivative gain helps to reduce the overshoot while keeping
the properties of the proportional gain unchanged. Combining both the properties, PD controller
is an efficient way to reduce both the settling time and overshoot.

Page | 12

PI Control
The below closed loop transfer function with a PI controller was analyzed using MATLAB.

The KP value was fixed at 30 and Ki was changes from 0 to 90. The step response for each case
is shown in figure 7.

Figure 18 - Step Response for the system with PI controller

The characteristics of each of the above step responses were obtained from MATLAB
stepinfo() function and tabulated as below.
Table 3 - Step Response Characteristics for different Ki values

Ki
0
10
20
30
40
50
60
70
80
90

Settling Time
0.8433
14.2547
6.7359
4.2037
2.9101
2.0976
1.5607
0.6182
1.0613
1.1472

Overshoot
4.3210
0
0
0
0
0
0
1.2588
5.1966
8.9141

Settling Max
0.6259
0.9977
0.9973
0.9999
0.9970
0.9977
0.9985
1.0126
1.0520
1.0891

Page | 13

Below figure shows the variation of settling time with the variation of Ki.

Figure 19 - Settling time vs Ki

The PI controller becomes a proportional controller at Ki = 0. At Ki = 0 the settling max value is


0.6259, which implies that there is a permanently resident error in the response. The purpose of
the integral term of the PI controller is to eliminate this permanently resident error. After adding
the integral gain, the system reaches its expected steady state value with an increment of the
settling time. The settling time could be minimized by tuning the integral gain. It can be seen
from the figure 8 that the settling time decreases with the increase of Ki in the range 10 to 70.
The settling time increases when the Ki is increased further. The settling time comes before the
overshoot at the Ki <= 70 cases. But when Ki is increased further, the settling time comes after
the overshoot is occurred, hence the settling time increases. Therefore, Ki = 70 is the most
suitable value for Ki in this system. The over increment of Ki causes large overshoots in the
response.

Page | 14

PID Control
The closed loop transfer function of the system with PID controller is given below.

Step response for this system was obtained by setting Kp = 350, Ki = 300 and Kd = 50.

Figure 20 - Step Response with PID controller

The characteristics of the step response were obtained from the stepinfo() function of MATLAB.
RiseTime

: 0.0548

SettlingTime : 0.8308
SettlingMin

: 0.9006

SettlingMax

: 0.9959

Overshoot

:0

Undershoot

:0

Peak

: 0.9959

PeakTime

: 2.4775

These characteristics could be optimized by tuning the proportional, integral and derivative
gains.

Page | 15

Tuning Kp
KP is varied while keeping the Ki = 300 and Kd = 50.

Figure 21 - Tuning for Kp

The original response is shown by the red color graph. It could be identified that the KP = 450
(light blue) graph gives a better settling time. Hence the proportional gain was tuned to value
450. The characteristics of the step response were obtained from the stepinfo() function of
MATLAB.
RiseTime

: 0.0473

SettlingTime : 0.7898
SettlingMin

: 0.9015

SettlingMax

: 0.9837

Overshoot

:0

Undershoot

:0

Peak

: 0.9837

PeakTime

: 1.0853

Page | 16

Tuning Ki
Ki is varied while keeping the Kp = 450 and Kd = 50.

Figure 22 - Tuning for Ki

The KP tuned response is shown by the green color graph. It could be identified that the
Ki = 1100 (yellow) graph gives a better settling time and a good steady state value. Hence the
integral gain was tuned to value 1100. The characteristics of the step response were obtained
from the stepinfo() function of MATLAB.
RiseTime

: 0.0462

SettlingTime : 0.0911
SettlingMin

: 0.9010

SettlingMax

: 1.0010

Overshoot

: 0.0984

Undershoot

:0

Peak

: 1.0010

PeakTime

: 0.2139

Page | 17

Tuning Kd
Kd is varied while keeping the Kp = 450 and Ki = 1300.

Figure 23 - Tuning for Kd

The KP and Ki tuned response is shown by the blue color graph. The increment of Kd decreases
the rise time and increases settling time. Therefore, the derivative gain was kept at the value 50.
The characteristics of the step response were obtained from the stepinfo() function of MATLAB.
RiseTime

: 0.0462

SettlingTime : 0.0911
SettlingMin

: 0.9010

SettlingMax

: 1.0010

Overshoot

: 0.0984

Undershoot

:0

Peak

: 1.0010

PeakTime

: 0.2139

Page | 18

Tuned PID Controller


Below figure shows the step response before and after tuning of the PID controller.

Figure 24 Step Response Before Tuning and After Tuning of PID

Below table can be used to compare the characteristics of the response before and after tuning
the PID controller.
Table 4 - PID Tuning Comparison

KP
Ki
Kd
Rise Time
Settling Time
Settling Min
Settling Max
Overshoot
Undershoot
Peak
Peak Time

Before Tuning
350
300
50
0.0548
0.8308
0.9006
0.9959
0
0
0.9959
2.4775

After Tuning
450
1300
50
0.0462
0.0911
0.9010
1.0010
0.0984
0
1.0010
0.2139

PID control could be used to obtain a fast response at the expected steady state value. The
proportional term of the PID controller accounts for decreasing of the settling time and
increasing of the overshoot. Settling time decreases with the increasing of KP. To overcome the
Page | 19

increasing of overshoot, derivative term of PID controller could be used. Overshoot decreases
with the increasing of Kd. The integral term of the PID controller removes the permanent error
induced in the response and it also decreases the rise time and settling time of the response. The
combination of these three terms produces a faster response for the step input.

PID Control Design with Control System Toolbox


Following transfer function was created

Afterwards the sys transfer function was opened in PIDTOOL.

Proportional controller

Figure 25: Variation of the system response with increasing response time

Plot
1
2
3
4

Rise time(s)
1.86
1.73
0.914
NaN

Settling time(s)
8.42
8.51
20.7
NaN

Overshoot %
14.1
17
58.9
NaN

Peak
0.573
0.634
1.3
Inf

Page | 20

Variation of the response for with response time for a proportional controller is pretty straight
forward. It is evident that the response starts from a stable response and after a certain point it
becomes unstable with rising response time. At the 4th plot it can be seen that the almost all the
parameters are NaN(Not a Number). This is because these quantities cannot be computed for an
unstable response. And the peak of the 4th plot is infinity. This also shows that the response is
unstable. And at this point the pidtool is unable to find a stabilizing controller.

PI Controller

Figure 26: System response variation with varying Kp and Ki

Plot
1
2
3
4

Rise time(s)
19.2
3.33
1.35
NaN

Settling time(s)
36
10.1
167
NaN

Overshoot %
0
7.89
13.5
NaN

Peak
0.999
1.08
1.14
Inf

In the PI controller it can be seen that with increasing response time the overshoot of the
response starts to increase and become unstable at some point. It can be also seen that the rise
time of the response gets decreased with the increasing response time. Both of these behavior are
because of the involvement of the Integration controller in the PI controller.

Page | 21

PID controller

Figure 27: Effect of the variation of response time on the response.

Plot
1
2
3
4
5

Rise time(s)
19.2
4.89
1.68
0.678
0.15

Settling time(s)
36
13.5
4.26
285
14.5

Overshoot %
0
4.48
4.29
0
53

Peak
0.999
1.04
1.04
0.999
1.53

Page | 22

By observing figure it can be seen that as the response time is increased the overshoot is also
increased. This is because for a faster response time it is required to increase the ki. And the ki
increses the overshoot also increases. It can also be seen that as the response time increases the
settling time also increases. But this increase is not a gradual one. But by tuning the other
controller variables kd and kp it is possible to get the best response for the desired response time
using the pidtool. It should be also noted that the response never gets unstable in PID controllers
as in Proportional and PI controllers.

Tune PID controller for a DC Motor in MATLAB SIMULINK

A model of a dc motor was created in simulink and a PID controller was designed for it.

Figure 28: System model

Initially following parameters were given to the PID controller and the output effect was
observed.

Page | 23

Figure 29: Initial parameters given for the PID controller

Afterwards the simulation was run and the following output was obtained. It can be seen that the
measured speed of the motor is far from the desired speed. This is due to the inappropriate
choosing of the value for kp, ki and kd.

Figure 30: System response for the given parameters

But Matlab provides automatic tuning for PID controllers which linearizes the model at the
default operating point and automatically determines the values for kp, ki and kd to achieve better
Page | 24

response which is robust. When the tune button is pressed the pidtool opens up and presents a
enhanced system reponse. When the update button is pressed the kp, ki and kd values are updated
in the Function block parameters dialog box for PID controllers.

Figure 31: Initial tuned response

Figure 32: Kp,ki and kd values for tuned response

Page | 25

Figure 33: Tuned response

Figure 34: Obtained response for tuned controller.

Page | 26

Conclusion
Analyzing the system control for a particular system and designing it for a particular application
is the objective of this laboratory test. So by the above set of models we can conclude that
proportional controller (KP) will have the effect of reducing the rise time and will reduce but
never eliminate the steady-state error. An integral control (KI) will have the effect of eliminating
the steady-state error for a constant or step input, but it may make the transient response slower.
A derivative control (KD) will have the effect of increasing the stability of the system, reducing
the overshoot, and improving the transient response. [2] PID Controller block generates a voltage
signal driving the dc motor to track desired shaft rotation speed. In addition to voltage, the dc
motor subsystem takes torque disturbance as an input, allowing us to simulate how well the
controller rejects disturbances.

Bibliography
[1] [Online]. https://en.wikipedia.org/wiki/PID_controller
[2] PID Control. [Online]. http://in.mathworks.com/discovery/pid-control.html

Page | 27

Anda mungkin juga menyukai