Department of Control Engineering & Automation – FEEE - HCMUT
LAB 3
ANALYZE DISCRETE PID CONTROLLER
I. LABORATORY OBJECTIVES
In this lab, students will examine the effects of parameters in discrete PID controller
on performance criteria (POT, settling times, steady-state error) in two cases: speed and
position control of DC motor.
In addition, students also investigate the effect of sampling time on the quality of the
control system.
Objectives after completing this lab:
Know how to construct and simulate control system to control the speed and position of
DC motor using discrete PID controller.
Evaluate the effects of the coefficients in discrete PID controller and the sampling time on
the system performance.
II. THEORETICAL BASIS
2.1. Discrete PID controller
Students refer to the "Automatic Control Theory" textbook to better understand the
PID controller. In this lab, we will examine the discrete PID controller as follows:
KIT z 1 KD z 1
G( z) K P
2 z 1 T z
2.2. Characteristics of P, I, D controllers
Proportional controller (Kp) reduces the rising time and reduces but does not eliminate
steady-state error. Integral control (KI) eliminates steady-state error but can worsen transient
response. Differential control (KD) increases system stability, reduces overshoot, and
improves transition response. The effect of each Kp, KI and KD controller on the closed-loop
system is summarized in the table below (Table 1).
Table 1: The effect of each KP, KI and KD controller
Closed-loop Rising time POT Settling time Steady-state
response error
Kp Decrease Increase Minor change Decrease
Ki Decrease Increase Increase Eliminate
Kd Minor change Decrease Decrease Minor change
Note that these relationships are not exactly correct because KP, KI, and KD are
interdependent. Therefore, this table is only used as reference when determining KP, KI, and
KD parameters.
1/7
Department of Control Engineering & Automation – FEEE - HCMUT
III. LAB DESCRIPTION
See the Lab Description section of Lab 1.
IV. PREREQUISITES
4.1. Speed control of DC motor
yellow
2 magenta
ek uk
0.3s+1 Scope
Set point Zero-Order Transfer Fcn
(rpm) Discrete Hold
PID Controller
Figure 1. Simulink diagram to control DC motor speed
Kp
Kp
z+1
1 Ki*T/2
ek z-1
1
I
Ki uk
z-1
Kd/T
z Add
Kd D
Figure 2. Discrete PID Controller
Assume the motor has transfer function:
Y (S ) K
G(s)
R(S ) s 1
where K group index, 0.3
Design discrete PID controller by follow the steps:
a) Create simulation file as shown in Figure 1, where PID controller block is described
in Figure 2.
b) Set the Set point to 800, and KP = 1, KI = KD = 0, sampling time T 0.005s .
Note: When changing the sampling time, we must change T parameter in the
"Discrete PID controller" block and overall sampling time of the system (on the
Simulation -> Configuration menu).
c) Run the simulation
d) Open the scope to see system response; determine POT, settling time and steady-state
error.
2/7
Department of Control Engineering & Automation – FEEE - HCMUT
e) Repeat step b) to step d) with parameters (KP = 1, KI = 10, KD = 0). Comment on
simulation results in 2 cases: when there is no integral term (KI = 0) and when there is
integral term (KI = 10).
4.2. Position control of DC motor model
Design discrete PID controller by follow the steps:
a) Create simulation file as shown in Figure 3, where PID controller block is described
in Figure 2.
b) Set the Set point to 100, and KP = 5, KI = 1, KD = 0, sampling time T 0.005s .
Note: When changing the sampling time, we must change T parameter in the
"Discrete PID controller" block and overall sampling time of the system (on the
Simulation -> Configuration menu).
c) Run the simulation
d) Open the scope to see system response; determine POT, settling time and steady-state
error.
e) Repeat step b) to step d) with parameters (KP = 5, KI = 1, KD = 1). Comment on
simulation results in 2 cases: when there is no derivative term (KD = 0) and when
there is derivative term (KD = 1)
yellow
2 1 magenta
ek uk
0.3s+1 s
Scope
Set point Zero-Order Transfer Fcn Integrator
(rad) Discrete Hold
PID Controller
Figure 3. Simulink diagram to control DC motor position
V. IN-LAB PROCEDURE
5.1. Speed control of DC motor
In this section, we will examine the effects of KP, KI, KD parameters of discrete PID
controller and the sampling time on the quality of the motor speed response.
a. Analyze the effect of KP parameter
Experimental steps:
a) Open motor_speed_ctrl.mdl file.
b) Set the Set point to 800 rpm, and KP = 0.02, KI = KD = 0, sampling time T 0.005s .
Note: When changing the sampling time, we must change T parameter in the
"Discrete PID controller" block and overall sampling time of the system (on the
Simulation -> Configuration menu).
c) Compile the model and run it.
d) Open the scope to see system response; determine POT, settling time and steady-state
error.
e) Write the results in Table 2.
f) Repeat step b) to step d) with remaining KP values in Table 2.
3/7
Department of Control Engineering & Automation – FEEE - HCMUT
Table 2. Analyze the effect of KP parameter (KI = 0, KD = 0)
KP 0.02 0.05 0.1 0.5 1
Rising time (s)
Settling time (s)
POT (%)
Steady-state error (rpm)
b. Analyze the effect of KI parameter
Perform the steps as in Section 5.1.a, write the results in Table 3.
Table 3. Analyze the effect of KI parameter (KP = 0.02, KD = 0)
KI 0.02 0.035 0.05 0.075 0.1
Rising time (s)
Settling time (s)
POT (%)
Steady-state error (rpm)
c. Analyze the effect of sampling time T
Perform the steps as in Section 5.1.a, write the results in Table 4.
Table 4. Analyze the effect of T parameter (KP = 0.02, KI = 0.1, KD = 0)
T 0.005 0.01 0.02 0.03 0.05
Rising time (s)
Settling time (s)
POT (%)
Steady-state error (rpm)
5.2. Position control of DC motor
In this section, we will examine the effects of KP, KI, KD parameters of discrete PID
controller and the sampling time on the quality of the motor position response.
a. Analyze the effect of KP parameter
Experimental steps:
a) Open motor_pos_ctrl.mdl file.
b) Set the Set point to 10000, and KP = 0.005, KI = KD = 0, sampling time T 0.005s .
4/7
Department of Control Engineering & Automation – FEEE - HCMUT
Note: When changing the sampling time, we must change T parameter in the
"Discrete PID controller" block and overall sampling time of the system (on the
Simulation -> Configuration menu).
c) Compile the model and run it.
d) Open the scope to see system response; determine POT, settling time and steady-state
error.
e) Write the results in Table 5.
f) Repeat step b) to step d) with remaining KP values in Table 5.
Table 5. Analyze the effect of KP parameter (KI = 0, KD = 0)
KP 0.005 0.05 0.1 0.2 0.5
Rising time (s)
Settling time (s)
POT (%)
Steady-state error (rpm)
b. Analyze the effect of KI parameter
Perform the steps as in Section 5.2.a, write the results in Table 6.
Table 6. Analyze the effect of KI parameter (KP = 0.02, KD = 0)
KI 0.002 0.005 0.008 0.01 0.02
Rising time (s)
Settling time (s)
POT (%)
Steady-state error (rpm)
c. Analyze the effect of KD parameter
Perform the steps as in Section 5.2.a, write the results in Table 7.
Table 7. Analyze the effect of KD parameter (KP = 0.02, KI = 0.02)
KD 0.0005 0.0008 0.001 0.002 0.005
Rising time (s)
Settling time (s)
POT (%)
Steady-state error (rpm)
5/7
Department of Control Engineering & Automation – FEEE - HCMUT
d. Analyze the effect of sampling time T
Perform the steps as in Section 5.2.a, write the results in Table 8.
Table 8. Analyze the effect of T parameter (KP = 0.005, KI = 0.002, KD = 0.0002)
T 0.005 0.01 0.03 0.05 0.1
Rising time (s)
Settling time (s)
POT (%)
Steady-state error (rpm)
6/7
Department of Control Engineering & Automation – FEEE - HCMUT
LAB REPORT
Full name: Group: Date:
1. From the experimental results in Section 5.1, comment on the effects of KP, KI, KD
parameters and sampling time on the performance of motor speed control system.
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
2. From the experimental results in Section 5.2, comment on the effects of KP, KI, KD
parameters and sampling time on the performance of motor position control system.
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
7/7