home

PDF (letter size)

A differential equation view of closed loop control systems

Nasser M. Abbasi

July 2, 2015   Compiled on January 31, 2024 at 1:02am

Contents

1 Proportional controller
2 PID controller

1 Proportional controller

Let us consider a closed loop control system with proportional controller kp and with plant transfer function given by standard second order mass-spring-damper system G(s)=1ms2+cs+k where m is the mass and c is the damping coefficient and k is the stiffness coefficient of the spring. In block diagram, the system is

The error is e(s)=yr(s)y(s) where yr(s) is the reference input that we want the output y(s) to track. We are now interested in finding how adding the controller and closing the loop changes the dynamics of the plant by viewing the changes in the differential equation of the new system. Without the controller and the closed loop, the system was

In time domain this is represented by the differential equation my+cy+ky=f(t) where F(s) is the Laplace transform of f(t). We now ask, how does this differential equation changes by adding the controller kp and closing the loop? From the first diagram, F(s)=e(s)kp or F(s)=(yr(s)y(s))kp, hence the plant now appears as

Hencey(s)(ms2+cs+k+kp)=yr(s)kp And in time domain, the differential equation now becomesmy+cy+(k+kp)y=L1(yr(s)kp) Considering the case where the reference signal is a unit step (with amplitude that has units of distance or length), then L(yr(s))=1s and the above reduces to(1)my+cy+(k+kp)y=kp We see now that the effect of adding a proportional controller kp is to increase the stiffness of the plant by an amount kp and also forcing the plant with constant force kp (actuating force). Increasing the effective stiffness also means the natural frequency ω of the plant will increase, since ω=keffectivemand the mass remained the same. A note on the units: The controller kp has units of Newton per unit length in this case (stiffness coefficient units) and the force kp will have units of Newton only (since we multiplied it by the unit step reference single which had units of length). Even though the term kp appears as stiffness on the left side and as force in the right side, it represents only the magnitude, and the units will depend on the context.

It is easy to verify the above. We can connect the system, view the output y(t) of the closed loop for a unit step input yr(t), and compare it the solution of the differential equation as given by (1). The differential equation is solved using zero initial conditions. We see below that the same result shows up.

m = 1; c = 1; k = 20; kp = 400; 
 
plant       = TransferFunctionModel[1/(m s^2 + c s + k), s]; 
controller  = TransferFunctionModel[kp, s]; 
sys         = SystemsModelSeriesConnect[plant, controller]; 
sys         = SystemsModelFeedbackConnect[sys]; 
o           = OutputResponse[sys, UnitStep[t], {t, 0, 6}]; 
p1          = Plot[o, {t, 0, 6}, Frame -> True, PlotRange -> All, 
                FrameLabel -> {{"y(t)", None}, {"t (sec)", 
                "response of closed loop system"}}, BaseStyle -> 14, ImageSize -> 350, 
                Epilog -> {Red, Line[{{0, 1}, {10, 1}}]}]; 
 
sol = First@DSolve[{m y''[t] + c y'[t] + (k + kp) y[t] == kp,y[0] == 0, y'[0] == 0}, y, t]; 
 
p2 = Plot[Evaluate[y[t] /. sol], {t, 0, 6}, Frame -> True, 
         PlotRange -> All, FrameLabel -> {{"y(t)", None}, 
         {"t (sec)", "solution of closed loop differential equation"}}, 
         BaseStyle -> 14, ImageSize -> 350]; 
 
Grid[{{p1, p2}}]
 

The differential equation given by (1) has an analytical solution when the force is constant kp and assuming the damping ratio is ξ<1 (under-damped), where ξ=ccr=c2km. The analytical solution is given byy(t)=eξωt((kpk+kp)cosωdtkpk+kpξωωdsinωdt)+kpk+kp Where ωd is the damped natural frequency ωd=ω1ξ2 and ω is the undamped natural frequency ω=k+kpm. We see now that as limty(t)=kpk+kp and hence the steady state solution will never reach unity (which is the reference signal in this example) but will get closer to it as kp is made larger and larger. This is the reason why response to a unit step using a proportional controller will always have a steady state error given by 1kpk+kp where kp is the controller gain and k is the plant original stiffness coefficient. The term kpk+kp is called the static deflection. The final steady state can also be found in Laplace domain using final value theorem as follows.F(s)1ms2+cs+k=y(s)(yr(s)y(s))kpms2+cs+k=y(s)y(s)(ms2+cs+k)=yr(s)kpy(s)kpy(s)(ms2+cs+k+kp)=yr(s)kpy(s)=kpms2+cs+k+kpyr(s)

Assuming yr(s) is unit step, theny(s)=kpsms2+cs+k+kp And using final value theoremy()=lims0sy(s)=lims0kpms2+cs+k+kp=kpk+kp

Which is the static deflection from the analytical solution of the differential equation found above.

2 PID controller

Let us now look at the dynamics of the plant when the controller is a PID given by kp+kDs+ki1s. The block diagram of the system is

The error is e(s)=yr(s)y(s) where yr(s) is the reference input that we want the output y(s) to track. As was done for the case of the proportional controller, the plant now appears as

Hencey(s)(ms2+cs+k)=(yr(s)y(s))(kp+kDs+ki1s)y(s)(ms2+cs+k+kp+kDs+ki1s)=yr(s)(kp+kDs+ki1s)

And in time domain, the differential equation now becomesmy+(c+kD)y+(k+kp)y+ki0ty(τ)dτ=kpyr+kDyr+ki0tyr(τ)dτ For the special case when the reference signal is a unit stepmy+(c+kD)y+(k+kp)y+ki0ty(τ)dτ=kp+ki0tyr(τ)dτmy+(c+kD)y+(k+kp)y=kp+ki0t(yr(τ)y(τ))dτ

The term 0t(yr(τ)y(τ))dτ is the integral of the error e(t). When yr(t) is unit step the above becomesmy+(c+kD)y+(k+kp)y=kp+ki0t(1y(τ))dτ=kp+kitki0ty(τ)dτ

Therefore, using a PID controller has the effect of making the system more damped, since the effective damping coefficient has now become c+kD compared to just c before, and making the system more stiff by adding kp to the stiffness coefficient. The actuating force has two components (for the special case of unit step reference), which is constant force of kp and a force which is proportional to the error: ki0t(1y(τ))dτ.

PID controller allows the steady state to become zero. This can be seen by using final value theorem in Laplace domain as follows. The transfer function can be found in Laplace domain using final value theorem as follows.F(s)1ms2+cs+k=y(s)(yr(s)y(s))(kp+kDs+ki1s)ms2+cs+k=y(s)y(s)(ms2+cs+k)=(yr(s)y(s))(kp+kDs+ki1s)y(s)(ms2+cs+k+kp+kDs+ki1s)=yr(s)(kp+kDs+ki1s)y(s)=(kp+kDs+ki1s)(ms2+cs+k+kp+kDs+ki1s)yr(s)

Assuming yr(s) is unit step, theny(s)=(kp+kDs+ki1s)(ms2+cs+k+kp+kDs+ki1s)1s And using final value theoremy()=lims0sy(s)=lims0(kp+kDs+ki1s)(ms2+cs+k+kp+kDs+ki1s)=lims0skp+kDs2+ki(ms3+cs2+ks+kps+kDs2+ki)=kiki=1

Hence y() is a unit step. So using PID controller it was possible to achieve the same value as the desired tracking signal. Hence the steady state error is zero.

Plot of the step response of the above is given below. ki was made large to force the steady state error to go to zero in about 6 seconds.

m = 1; c = 1; k = 20; kp = 400; kd = 1; ki = 200; 
 
plant      = TransferFunctionModel[1/(m s^2 + c s + k), s]; 
controller = TransferFunctionModel[kp + kd s + ki 1/s, s]; 
sys        = SystemsModelSeriesConnect[plant, controller]; 
sys        = SystemsModelFeedbackConnect[sys]; 
o          = OutputResponse[sys, UnitStep[t], {t, 0, 6}]; 
p1         = Plot[o, {t, 0, 6}, Frame -> True, PlotRange -> All, 
              FrameLabel -> {{"y(t)", None}, {"t (sec)", 
              "response of closed loop system, PID controller"}}, 
              BaseStyle -> 14, ImageSize -> 400, 
              Epilog -> {Red, Line[{{0, 1}, {10, 1}}]} 
              ]