<<

Lecture 4: PID of a Spring Damper system

Venkata Sonti∗

Department of Mechanical Engineering Indian Institute of Science Bangalore, India, 560012 This draft: March 12, 2008

In this lecture we shall look at the PID control of a 1-DOF spring mass damper system (Figure 1). The open loop is given by:

Open loop step response From: U(1) 0.05

0.045

0.04 M=1, K=20, C=10 0.035

0.03

0.025

Amplitude 0.02

0.015

0.01 C 0.005 M 0 0 0.5 1 1.5 2 K Time (sec.)

Figure 1:

F (s) X(s)= Ms2 + Cs + K The open loop step response is given in figure 1. It can be seen that the open loop is inadequate. The response saturates at 0.05 and has a of 1 sec. The poles of the open loop system are at s=-7.23 and -2.76. Both are on the real axis and hence heavily damped with no oscillatory imaginary parts. The step response is in league with the pole positions.

1 1 Proportional Controller

We should first reduce the steady state error, for which we look at the proportional controller. The block diagram for the proportional controller is given in figure 2.

Proportional controller step response

1.4

1.2 Kp=300, M=1, K=20, C=10 1

0.8

0.6 Amplitude

0.4 r(t) 1 + Kp R(s) - s2 +10s+20 0.2 0 0 0.2 0.4 0.6 0.8 1 1.2 Time (sec.)

Figure 2: Block diagram for proportional controller. Step response of proportional controller. Kp=300.

The closed loop transfer function is given by

kp G s2+10s+20 kp Tf = = k = 2 1+ GH p s + 10s + (kp + 20) 1+ s2+10s+20 where H=1 for us. It can already be seen that for Kp = ∞ Tf=1. Hence larger values of Kp will reduce steady state error. The relevant Matlab commands for step response and look as follows:

• numc = kp denc = [1 10 20 + kp] −→ step(numc, denc). This is directly in terms of the closed loop.

• or we can begin with the loop transfer function GH, i.e., num = kp, den = [1 10 20] −→ [numc, denc] = cloop(num, den) −→ step(numc, denc). The cloop command converts the loop Tr.Fn.=GH to closed loop Tr. Fn. and then we get the step response.

• In root locus, as seen before we use the loop transfer function KpG∗H∗. rlocus(num, den) plots the rlocus for Kp, where num and den are as defined above. The step response is shown in figure 2 for a Kp=300. As can be seen there is a significant improvement in the steady state error. We will try to understand this using Root Locus.

k ∗ ∗ 1+ GH =1+ p =1+ k G H s2 + 10s + 20 p The root locus is given in figure 3. The on the locus marked as kp=31.28 should give an indication where kp=300 would lie. At kp=300 the roots are far from the real axis hence is low and so the system is underdamped and is high. At kp=300 the poles are at −5±i17.1756. Let us say that we have the following requirements: the step response should have a) < 10% overshoot, b) rise time < 0.1 sec and c) no steady state error.

2 Root locus for the proportional controller 6 kp=31.28

4

2 S=−7.23 kp=0 0 S=−2.76 kp=0 Imag Axis −2

−4

−6 −8 −6 −4 −2 0 2 Real Axis

Figure 3: Root locus for the proportional controller.

2 Proportional Derivative (PD) Controller

We will first try a PD controller Derivative so that we reduce the overshoot and settling time.

r(t) 1 c(t) + Kp+Kd s R(s) - s2 +10s+20 C(s)

Figure 4: Block diagram for proportional and derivative controller.

Prop−Der control step response Root locus for the prop. der. controller Kp=300 1 20 s=−5 + j 17

0.8 10 kp=300 and kd=20

0.6 Kd=25.6613 0 To: Y(1)

0.4 Imag Axis Amplitude −10 0.2

0 −20 0 0.2 0.4 0.6 0.8 1 1.2 −20 −15 −10 −5 0 Time (sec.) Real Axis

Figure 5: Step response of Proportional Derivative Controller. Kp=300 and Kd=20. Root locus of proportional derivative controller.

k + k s G = p d H = 1 s2 + 10s + 20

3 kp+kds G s2+10s+20 kp + kds = k +k s = 2 1+ GH p d s + (10 + kd)s +20+ kp 1+ s2+10s+20 The above expression can be used to find the step response of the PD controller. We take Kp=300 and Kd=20. The poles at these values are given by −15 ± i9.7468. The absolute value of the root is the natural frequency. It is 17.88 here. And so ξ the damping coefficient is given by 15/17.88 = 0.8385 which is very heavy damping, close to critical. We shall look at the root locus diagram for Kd. When Kd=0 the poles are at −5 ± i17.1756. Hence this is where the root locus diagram will begin. Looking at 1+GH, the root locus expression for Kd is

2 1+ GH = s + 10s +20+ kp + kds = 0

kds 1+ 2 = 0 s + 10s +20+ kp The step response of PD controller and the root locus for Kd at Kp=300 are shown in figure 5. The root locus begins at the points s = −5 ± j17 and proceeds towards the real axis. The point kd=25 is very close to the real axis and thus kd=20 is also quite close. This explains the damped nature of the step response in figure 5. If you actually compute the break-in point it is at kd = 25.775 and the pole locations are s = ±17.8885. So Kd reduces overshoot but not the steady state error.

3 Proportional controller

Here we look at the PI combination. The G/(1 + GH) is given by

kps + ki T r.fn. = 3 2 s + 10s + (20 + kp)s + ki

It can be seen that ki raises the denominator order. Lets plot the step response for kp=300, ki=1000 and the root locus for ki at kp=300 in figure 6. The poles of the system at these kp,ki values are at s = −3.3±i17 and s = −3.36. There is a system zero at s = −3.3. The real pole and zero approximately cancel and the response is mainly due to the complex poles. It may be noted that the locus begins at the poles of the proportional controlled system at s = −5 ± i17. The rlocus crosses the imaginary axis going right at ki=3164 at which point the system is unstable. To be noted is that ki gives an overshoot since the roots move toward the imaginary axis which reduces damping. Also, system becomes relatively more unstable. However, ki eliminates steady state error. Thus, it is evident that just proportional and integral controller cannot match the specs. We need the derivative controller.

4 PID Controller

The PID controller and the rlocus for kd is shown in figure 7. The kd parameter chosen is kd=50 where we get a remarkably good response. The reason being that here pole zero cancellations occur. The numerator zeros are at s = −3 ± i3.317 and the poles are at s = −54.4614 and s = −2.7693 ± i3.27. The zeros and poles nearly cancel giving a good response although there are regions where all the poles and zeros are on the real axis. When kd is around 21-35, the poles are closer to the origin hence there is an overshoot. However, around kd=40, the zeros come closer to the origin reducing the overshoot.

4 Comparison Prop VS PI controller Rlocus for Ki at Kp=300 20 2

1.8 15 ki=300

1.6 Kp=300, Ki=1000 10 1.4 5 1.2

1 0 To: Y(1) Imag Axis Amplitude 0.8 Kp=300, M=1, K=20, C=10 −5 0.6 −10 0.4 −15 s=−5 − j 17 ki=3164 0.2

0 −20 0 0.3 0.6 0.9 1.2 1.5 1.8 −6 −4 −2 0 2 Time (sec.) Real Axis

Figure 6: Step response of Proportional Integral Controller. Kp=300 and Ki=1000. Root locus of proportional integral controller for Ki.

Comparison P vs PI vs PID controller Rlocus for Kd at Kp=300,ki=1000 1.6 20 Kp=300, Ki=1000 s=−3.3+i17 1.4 15

1.2 10 Kp=300, Ki=1000 and kd=50 1 5 kd=36.7 kd=21.7 0 0.8 Kp=300, M=1, K=20, C=10 kd=1674 Imag Axis −5 0.6 Step response −10 0.4 −15 0.2 −20 0 −15 −10 −5 0 0 0.3 0.6 0.9 1.2 1.5 1.8 Real Axis

Figure 7: Step response of PID Controller. Kp=300 and Ki=1000 and kd=50. Root locus of PID controller for kd.

5 Table 1: PID gains tuning using Zeigler Nichols method. Type of Controller Kp Ti Td P 0.5 Ku 0 0 Pu PI 0.45 Ku 1.2 0 Pu Pu PID 0.6 Ku 2 8

5 Ziegler Nichols tuning

Instead of this trial and error method, Ziegler and Nichols based on empirical observations gave a rule which quickly gets you to a reasonable controller. From here you should iterate and apply to your problem. They said, for a higher order system, first raise the gain so that sustained oscillations occur, i.e., the system is almost unstable. Note the gain Ku and time period Pu at this value and based on this design the controller. Let the PID form be given by 1 Kp 1+ + Tds  Tis  The system above with just proportional controller never goes unstable. Hence, we have to go till our amplifier saturates. Say this happens at Ku=6000. So we take 0.6Ku = 3600. Pu can be seen as 0.0819. Hence Ti = 0.04 and Td = 0.01 The PID controller looks as 25 3600 1+ + 0.01s  s  The above controller has a large overshoot and so we make the derivative gain equal to 0.05. The response looks as follows. 25 3600 1+ + 0.05s  s 

Step response using Ziegler Nichols tuning 1.4

1.2

1

0.8 Kp=300, Ki=25*Kp, Kd=0.05*Kp

0.6 Amplitude

0.4

0.2

0 0 0.5 1 1.5 2 Time (sec.)

Figure 8: Step response of PID Zeigler Nichols Controller.

Figure 8 shows the final step response.

6