Professional Documents
Culture Documents
Experiment No. 02 Name of The Experiment: Modeling of Physical Systems and Study of Their Closed Loop Response Objective
Experiment No. 02 Name of The Experiment: Modeling of Physical Systems and Study of Their Closed Loop Response Objective
02
Name of the experiment: Modeling of Physical systems and study of their closed loop response
Objective:
(i) The objective of this experiment is the modeling of physical systems and study of their
closed loop response.
(ii) Study closed loop system with the variation of different parameters of the system
(iii) Simulation of a dc motor
(iv) Study of PID controller
(v) Study of feedback
(vi) Check the state-space representation of the system.
Introduction:
We will consider the following unity feedback controlled system, where the plant is assumed as a dc motor
and the controller is used as a P, I, D, PI, PD or PID controller.
Figure: A dc motor
System Equations:
In SI units, the motor torque and back emf constants are equal, that is, Kt = Ke; therefore, we will use K to
represent both the motor torque constant and the back emf constant.
1. Transfer Function
Applying the Laplace transform, the above modeling equations can be expressed in terms of the Laplace
variable s.
2. State-Space
In state-space form, the governing equations above can be expressed by choosing the rotational speed and
electric current as the state variables. Again the armature voltage is treated as the input and the
rotational speed is chosen as the output.
Design requirements
First consider that our uncompensated motor rotates at 0.1 rad/sec in steady state for an input voltage of
1 Volt. Since the most basic requirement of a motor is that it should rotate at the desired speed, we will
require that the steady- state error of the motor speed be less than 1%. Another performance requirement
for our motor is that it must accelerate to its steady-state speed as soon as it turns on. In this case, we
want it to have a settling time less than 2 seconds. Also, since a speed faster than the reference may
damage the equipment, we want to have a step response with overshoot of less than 5%. In summary, for a
unit step command in motor speed, the control system's output should meet the following requirements.
Settling time less than 2 seconds
Overshoot less than 5%
Steady-state error less than 1%
MATLAB representation
1. Transfer Function
We can represent the above open-loop transfer function of the motor in MATLAB by defining the
parameters and transfer function as follows. Running this code in the command window produces the output
shown below.
J = 0.01;
b = 0.1;
K = 0.01;
R = 1;
L = 0.5;
s = tf('s');
P_motor = K/((J*s+b)*(L*s+R)+K^2)
P_motor =
0.01
--------------------------- Continuous-time transfer function.
0.005 s^2 + 0.06 s + 0.1001
2. State Space
We can also represent the system using the state-space equations. The following additional MATLAB
commands create a state-space model of the motor and produce the output shown below when run in the
MATLAB command window.
The above state-space model can also be generated by converting your existing transfer function model into
state-space form. This is again accomplished with the ss command as shown below.
motor_ss = ss(P_motor);
PID controller:
The output of a PID controller, equal to the control input to the plant, in the time-domain is as follows:
(1)
The transfer function of a PID controller is found by taking the Laplace transform of Eq.(1).
Kp = 1;
Ki = 1;
Kd = 1;
s = tf('s');
C = Kp + Ki/s + Kd*s
Alternatively, we may use MATLAB's pid controller object to generate an equivalent continuous-time controller as follows:
C = pid(Kp,Ki,Kd)
Controller = tf(C)
Note that these correlations may not be exactly accurate, because K p, Ki, and Kd are dependent on each
other. In fact, changing one of these variables can change the effect of the other two. For this reason, the
table should only be used as a reference when you are determining the values for K p, Ki, and Kd .
SHAKIL MAHMUD BOBY, LECTURER, DEPT. OF EEE, NSTU
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system, follow the steps shown below to obtain a
desired response.
1. Obtain an open-loop response and determine what needs to be improved
2. Add a proportional control to improve the rise time
3. Add a derivative control to improve the overshoot
4. Add an integral control to eliminate the steady-state error
5. Adjust each of Kp, Ki, and Kd until you obtain a desired overall response. You can always refer to the
table shown in this "PID Tutorial" page to find out which controller controls what characteristics.
Lastly, please keep in mind that you do not need to implement all three controllers (proportional, derivative,
and integral) into a single system, if not necessary. For example, if a PI controller gives a good enough
response (like the above example), then you don't need to implement a derivative controller on the system.
Keep the controller as simple as possible.
Proportional Control:
Let's first try employing a proportional controller with a gain of 100, that is, C(s) = 100. To determine the
closed-loop transfer function, we use the feedback command. Add the following code to the end of your m-
file.
Kp = 100;
C = pid(Kp);
sys_cl = feedback(C*P_motor,1);
Now let's examine the closed-loop step response. Add the following commands to the end of your m-file and
run it in the command window. You should generate the plot shown below. You can view some of the system's
characteristics by right-clicking on the figure and choosing Characteristics from the resulting menu. In the
figure below, annotations have specifically been added for Settling Time, Peak Response, and Steady
State.
t = 0:0.01:5;
step(sys_cl,t)
grid
title('Step Response with Proportional Control')
PID control
Let's try a PID controller with small Ki and Kd. Modify your m-file so that the lines defining your control are as follows.
Running this new m-file gives you the plot shown below.
Kp = 75;
Ki = 1;
Kd = 1;
C = pid(Kp,Ki,Kd);
sys_cl = feedback(C*P_motor,1);
step(sys_cl,[0:1:200])
title('PID Control with Small Ki and Small Kd')
Inspection of the above indicates that the steady-state error does indeed go to zero for a step input.
However, the time it takes to reach steady-state is far larger than the required settling time of 2 seconds
In this case, the long tail on the step response graph is due to the fact that the integral gain is small and,
therefore, it takes a long time for the integral action to build up and eliminate the steady-state error. This
process can be sped up by increasing the value of Ki. Go back to your m-file and change Ki to 200 as in the
following. Rerun the file and you should get the plot shown below. Again the annotations are added by right-
clicking on the figure and choosing Characteristics from the resulting menu.
Kp = 100;
Ki = 200;
Kd = 1;
C = pid(Kp,Ki,Kd);
sys_cl = feedback(C*P_motor,1);
step(sys_cl, 0:0.01:4)
grid
title('PID Control with Large Ki and Small Kd')
Kp = 100;
Ki = 200;
Kd = 10;
C = pid(Kp,Ki,Kd);
sys_cl = feedback(C*P_motor,1);
step(sys_cl, 0:0.01:4)
grid
title('PID Control with Large Ki and Large Kd')
As we had hoped, the increased Kd reduced the resulting overshoot. Now we know that if we use a PID
controller with