Me2009 - Control System Technology Lab Assignment 4: Hochiminh City University of Technology Mechatronics Department

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

HoChiMinh City University of Technology Mechatronics Department

HoChiMinh City University of


ME2009 - Control System
Technology Technology
Faculty Mechanical of Engineering
Lab Assignment 4
Mechatronics Department
PID control with MATLAB

1. INTRODUCTION
You have learned how to code for implementing a microcontroller through the Arduino
IDE for previous lab experiment No.1. As well, you have already been able to control a DC
motor with a feedback controller. This lab experiment will guide you on how to obtain a
Proportional, Integral, Derivative (PID) controller for a given system. You should obtain a
system modeling for any given control system by using physical laws and measurements or
system identification methods. The system modeling enables the development of a model-
based controller for the given system that usually comes with the controller parameters. For
the design of a PID controller, the most important thing is to determine its well-known
controller gains called as K p , K i , K d . There are several approaches to obtain these controller
parameters, such as the trial-and-error method, Nicole Ziegler tunning, and the model-based
control design method.

2. LAB METHODOLOGY
2.1 Problem Statement
This lab gives an example of speed control for a DC brushed motor. Before designing the
PID controller, you should achieve a system modeling of the given DC motor. The system
modeling describes the dynamic behavior output of the physical structure of the DC motor
when it is applied an input voltage. For DC motors made from well-known manufacturers as
Maxon, the motor parameters are provided fully through a document for the manufacture. In
the case of using a DC motor without given parameters, you should identify the parameters
through experiment.
In this lab experiment, the parameters of a DC motor are given as follows:
Table 1 DC motor specification

Speed constant K b =85 ×10−3 V . s /rad


Armature resistance R=0.55 Ω
Armature inductance L=25 × 10−3 H
Rotor inertia J=0.09 kg . m2
Viscous damping b=0.05 N . m. s / rad

ME2009 Control system technology – Lab Assignment 4


1/ 10
HoChiMinh City University of Technology Mechatronics Department

The equivalent circuit of the motor consists of a voltage source, a resistor, an inductor,
and a Back EMF, as shown in Figure 1.

Figure 1. Equivalent circuit of DC motor


where θ is the angular displacement of the rotor.
By applying Kirchhoff’s voltage law, the equation illustrating the armature circuit is given
as follows:

di ( t )
v ( t )=i (t ) R + L + K b ω(t ) (1)
dt
where v(t) is the supply voltage for the DC motor, i(t) is the armature current, and ω (t)
is the rotational velocity.
The rotor torque is proportional to the armature current and is expressed as follows:

T =K t i(t) (2)
where K t is the motor torque constant and can be ideally obtained as K t =K b (¿ K ).
By applying Newton-Euler for both the mechanical part and the mechanical part, the
dynamic equation of the DC motor can be obtained as:

dω ( t )
Ki ( t )=J + bω(t ) (3)
dt
Taking the Laplace transform of Eq. (1), (3), it yields:

V ( s )=I ( s )( R+ sL ) + K Ω ( s ) KI ( s )=( sJ +b)Ω(s) (4)


Eliminating the term of I (s ) of Eq. (4), it becomes

(sJ +b)
V ( s )=( R+ sL ) Ω(s)+ K Ω( s) (5)
K
Eq. (5) can be rearranged to obtain the plant transfer function G p:

Ω( s) K
G p= = (6)
V ( s) J . L. s + ( J . R+ L. b ) . s+( R . b+ K 2 )
2

ME2009 Control system technology – Lab Assignment 4


2/ 10
HoChiMinh City University of Technology Mechatronics Department

By substituting the given parameters shown in Table 1 into Eq. (6), you can achieve the
plant transfer function of the given DC motor that allows you to estimate the rotational
velocity when you apply a supply voltage to the DC motor.
2.2 PID controller design
To be able to achieve the steady-state error of zero for a step input, the PID controller is
required to control the DC motor where the integral component is utilized to eliminate the
steady-state error, whereas the proportional and derivative terms control the rise time and the
maximum overshoot, respectively. The transfer function of the PID controller is expressed as
follows

Ki
G C ( s )=K p + +s Kd (7)
s
where K p , K i , K p are the controller gains.
By using the transfer function of the PID controller for a closed loop of the given system
of Eq. (6), the overall transfer function G(s)is achieved as:

G p . Gc
G= (8)
1+G p .Gc
Substituting the parameters shown in Table 1 into Eq. (8), it yields

( K ¿¿ d s2 + K p s + K i)
G ( s )=17. ¿ (9)
0.45 s3 + ( 17. K d +10.15 ) . s2 + ( 17. K p +6.945 ) . s+ 17. K I
It can be seen that the transfer function of the system expressed in Eq. (9) is a third orders
system with two zeros. For the sake of simplification, this lab experiment offers the method
that first involves calculating estimates the controller gains by setting K i=0 , and then it can
be fine-tuned by the trial-and-error approach. If you set K i=0, the control system of Eq. (9)
reduces to a second orders system with a zero.

9.( K d . s+ K p )
0.45
G ( s )= (10)
(17. K d +10.15) (17. K p+ 6.945)
s 2+ s+
0.45 0.45
The standard form of the second-order system is given by:

ω2n
2 2 (11)
s + 2ζ d ωn s+ω n
If you ignore the effect of the zero of Eq. (9), the damping ratio ζ d of the characteristic
equation of the standard form second-order system required for a maximum overshoot of
MP=1 % is calculated by:

ME2009 Control system technology – Lab Assignment 4


3/ 10
HoChiMinh City University of Technology Mechatronics Department

−ζ d . π
2
(12)
e √ 1−ζ =MP
d

Solving Eq. (11) for ζ d, it gives as

ζ d=0.826 (13)
Referring to [1], for ζ d=0.826<1 , the natural frequency of the characteristic equation
that meet the required rise time t rof 0.1 second is calculated by:

1−0.4167 ζ d +2.917 ζ 2d
t r= (14)
ωn
Solving Eq. (13) for ω n, it gives as

ω n=26.464 (15)
Then the denominator of the standard form second-order system that meets the
requirement of the rise time and the maximum overshoot is achieved as follows:

s2 +43.719 s+700.343 (16)


Equating Eq. (16) to the denominator of Eq. (10), we get

(17. K d +10.15) (17. K p +6.945) 2


s2 + s+ =s + 43.719 s +700.343 (17)
0.45 0.45
From Eq. (17), solving for K d , it can get

K d =0.56 (18)
From Eq. (17), solving for K p, it can get

K p =18.13 (19)
These controller gains are the estimates that can be used as a starting point to obtain the
required controller gains using an iterative approach. The integral term eliminates the steady-
state error for a step input, and it's magnitude determines the settling time. Therefore the
value of the integral gain can be increased until the settling time specification is met, and then
the other gains can be adjusted to ensure that the remaining specifications are also met.
2.3 Simulation Setup
This lab experiment guides you on how to simulate the dynamic behavior of the DC
motor under the control of a traditional PID controller that was designed in the previous
section. This lab experiment uses MATLAB Simulink to implement the simulation. First, you
launch MATLAB software, then start a new blank model in the Simulink environment.
Press “Ctrl” + “.” and type “DC motor” in the context menu with the Blocks tab to pick
the Simscape model of DC brushed motor as shown in Figure 2.

ME2009 Control system technology – Lab Assignment 4


4/ 10
HoChiMinh City University of Technology Mechatronics Department

Figure 2 Simscape model of DC brushed motor


The positive (+) and negative (-) terminals of the DC motor symbol are used for
supplying the voltage. The terminal “R” stands for the rotor part, whereas the terminal “C”
denotes the case of the DC motor. To measure the rotor speed, you press again “Ctrl” + “.”
and type “Ideal rotational” in the context menu to pick the Ideal Rotational Motion sensor.
Then locate it with the appropriate position using the context command “Rotate & Flip”. It
should be seen as shown in Figure 3.

Figure 3 Location of ideal rotational motion sensor


Next, you need to connect the DC motor and the motion sensor as well as add the
Mechanical Rotational Reference as shown in Figure 4. In Simulink, you just click on the
source terminal, then drag & drop into the destination terminal that you want to connect.
However, it should be noted that there is no permission for connection between various types
of terminals.

Figure 4 Motion sensor connected to DC motor

ME2009 Control system technology – Lab Assignment 4


5/ 10
HoChiMinh City University of Technology Mechatronics Department

You can connect a block of Scope to the “W” terminal of the motion sensor to monitor the
rotor speed of the DC motor. It is noted that you might be required to use a utility block
called PS-Simulink converter (see Figure 5).

Figure 5 Monitoring the rotor speed


By double-click on the DC motor symbol, you type the given parameters shown in Table
1 into the appeared window (see Figure 6).

Figure 6 Parameters of DC motor


To control the supply voltage across two positive and negative terminals of the DC motor,
you need a block called a controlled voltage source. As well, you might be interested in
measuring the load current of the DC motor; consequently, you need a current sensor. Pick,
locate and connect these symbols to the DC motor in the manner as shown in Figure 7. It is
noted that the electrical reference is required to connect the controlled voltage source.

Figure 7 Addition of controlled voltage source and current sensor

ME2009 Control system technology – Lab Assignment 4


6/ 10
HoChiMinh City University of Technology Mechatronics Department

To implement the PID controller, you can use a subsystem and modify it by double-
clicking it with the designed PID controller in the previous section (see Figure 8).

Figure 8 Addition of subsystem


You might need the following to implement this step such as gain, sum, integrator,
derivative.

Figure 9 Modification of subsystem

Figure 10 Addition of error calculation


Additionally, you have to calculate the tracking error by using the sum block with the
feedback of the rotor speed and the given reference of the step input that is provided by a
constant block, as shown in Figure 10. Before you starting the simulation, it requires that a
solver configuration is connected to your physical model to specifies the solver parameters
before you can begin simulation (see Figure 11).

ME2009 Control system technology – Lab Assignment 4


7/ 10
HoChiMinh City University of Technology Mechatronics Department

Figure 11 Overall Simscape model of DC motor speed control


For the first simulation with the step reference input of 100, the output response of the
given system is illustrated in Figure 12. To view the characteristic on the response plot, you
click on Tool >> Measurement menu, then choose Bilevel Measurements.

Figure 12 Output response of the given system


It can be seen easily from Figure 12 that the rise time reaches a certain value of
106.081miliseconds, while the overshoot is 0.44%. This implies that the output response
meets the required overshoot and rise time. It is also noted that the output response keeps a
significant error from the step reference input. Now, it is your turn to obtain the steady-state
error by tunning the K i controller gain and slightly adjusting K p , K d controller gains while
keeps to maintain the requirement of the control system.
2.4 References
1. Golnaraghi, D.F., Kuo, D.B.C.: Automatic Control Systems, Tenth Edition. McGraw-
Hill Education (2017).

3. EXPERIMENTAL CONTENTS
(Student submits the following pages to the Instructor after the experiment class)
1. Describe the behavior of the output response when you increase the K i controller gain.
_________________________________________________________________________

ME2009 Control system technology – Lab Assignment 4


8/ 10
HoChiMinh City University of Technology Mechatronics Department

_________________________________________________________________________
2. Describe the behavior of the output response when you decrease the K p controller gain.
_________________________________________________________________________
_________________________________________________________________________
3. What controller gain will you tune to reduce the rise time? (Multi-choice is required)
☐K p ☐K i ☐K d
☐Increase ☐Decrease
4. What controller gain will you tune to reduce the overshoot? (Multi-choice is required)
☐K p ☐K i ☐K d
☐Increase ☐Decrease
5. Describe the procedure tunning to achieve the steady-state error of zero and the required
maximum overshoot and maximum rise time.
_________________________________________________________________________
_________________________________________________________________________
6. What thing does the ideal rotational motion sensor block represent in practice?
_________________________________________________________________________
7. How do you measure the load current in practice?
_________________________________________________________________________
8. What thing does the controlled voltage source block represent in practice?
_________________________________________________________________________
9. What thing does the subsystem block represent in practice?
_________________________________________________________________________
10. List the best controller gains which you have tuned to obtain the requirement.
K p =¿ K i=¿ K d =¿ Rise time: Overshoot:
11. Assume that you have to control a DC motor given in the below picture with part number
618572. Find out and list the specification of the given motor necessary for the
development of the PID controller.
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________

ME2009 Control system technology – Lab Assignment 4


9/ 10
HoChiMinh City University of Technology Mechatronics Department

12. List the new controller gains which you have tuned to obtain the requirement with the
given motor.
K p =¿ K i=¿ K d =¿ Rise time: Overshoot:
13. How much is the maximum voltage supplied to the DC motor?
_________________________________________________________________________
14. How much does the maximum armature current cross to the DC motor?
_________________________________________________________________________
15. Do you think that these values of questions 13 & 14 are reality?
☐Yes ☐No Explain why:
_________________________________________________________________________
_________________________________________________________________________

Student full name: …………………………………


ID:………………….Group:………………
Experiment date:……………………….

ME2009 Control system technology – Lab Assignment 4


10/ 10

You might also like