July 2, 2015 Compiled on October 15, 2023 at 3:43am

Let us consider a closed loop control system with proportional controller \(k_{p}\) and with plant transfer function given by standard second order mass-spring-damper system \(G\left ( s\right ) =\frac {1}{ms^{2}+cs+k}\) where \(m\) is the mass and \(c\) is the damping coeﬃcient and \(k\) is the stiﬀness coeﬃcient of the spring. In block diagram, the system is

The error is \(e\left ( s\right ) =y_{r}\left ( s\right ) -y\left ( s\right ) \) where \(y_{r}\left ( s\right ) \) is the reference input that we want the output \(y\left ( s\right ) \) to track. We are now interested in ﬁnding how adding the controller and closing the loop changes the dynamics of the plant by viewing the changes in the diﬀerential equation of the new system. Without the controller and the closed loop, the system was

In time domain this is represented by the diﬀerential equation \(my^{\prime \prime }+cy^{\prime }+ky=f\left ( t\right ) \) where \(F\left ( s\right ) \) is the Laplace transform of \(f\left ( t\right ) \). We now ask, how does this diﬀerential equation changes by adding the controller \(k_{p}\) and closing the loop? From the ﬁrst diagram, \(F\left ( s\right ) =e\left ( s\right ) k_{p}\) or \(F\left ( s\right ) =\left ( y_{r}\left ( s\right ) -y\left ( s\right ) \right ) k_{p}\), hence the plant now appears as

Hence\[ y\left ( s\right ) \left ( ms^{2}+cs+k+k_{p}\right ) =y_{r}\left ( s\right ) k_{p}\] And in time domain, the diﬀerential equation now becomes\[ my^{\prime \prime }+cy^{\prime }+\left ( k+k_{p}\right ) y=\mathcal {L}^{-1}\left ( y_{r}\left ( s\right ) k_{p}\right ) \] Considering the case where the reference signal is a unit step (with amplitude that has units of distance or length), then \(\mathcal {L}\left ( y_{r}\left ( s\right ) \right ) =\frac {1}{s}\) and the above reduces to\begin {equation} my^{\prime \prime }+cy^{\prime }+\left ( k+k_{p}\right ) y=k_{p}\tag {1} \end {equation} We see now that the eﬀect of adding a proportional controller \(k_{p}\) is to increase the stiﬀness of the plant by an amount \(k_{p}\) and also forcing the plant with constant force \(k_{p}\) (actuating force). Increasing the eﬀective stiﬀness also means the natural frequency \(\omega \) of the plant will increase, since \(\omega =\sqrt {\frac {k_{effective}}{m}}\)and the mass remained the same. A note on the units: The controller \(k_{p}\) has units of Newton per unit length in this case (stiﬀness coeﬃcient units) and the force \(k_{p}\) 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 \(k_{p}\) appears as stiﬀness 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\left ( t\right ) \) of the closed loop for a unit step input \(y_{r}\left ( t\right ) \), and compare it the solution of the diﬀerential equation as given by (1). The diﬀerential 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 diﬀerential equation given by (1) has an analytical solution when the force is constant \(k_{p}\) and assuming the damping ratio is \(\xi <1\) (under-damped), where \(\xi =\frac {c}{c_{r}}=\frac {c}{2\sqrt {km}}\). The analytical solution is given by\[ y\left ( t\right ) =e^{-\xi \omega t}\left ( \left ( -\frac {k_{p}}{k+k_{p}}\right ) \cos \omega _{d}t-\frac {k_{p}}{k+k_{p}}\xi \frac {\omega }{\omega _{d}}\sin \omega _{d}t\right ) +\frac {k_{p}}{k+k_{p}}\] Where \(\omega _{d}\) is the damped natural frequency \(\omega _{d}=\omega \sqrt {1-\xi ^{2}}\) and \(\omega \) is the undamped natural frequency \(\omega =\sqrt {\frac {k+k_{p}}{m}}\). We see now that as \(\lim _{t\rightarrow \infty }y\left ( t\right ) =\frac {k_{p}}{k+k_{p}}\) 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 \(k_{p}\) 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 \(1-\frac {k_{p}}{k+k_{p}}\) where \(k_{p}\) is the controller gain and \(k\) is the plant original stiﬀness coeﬃcient. The term \(\frac {k_{p}}{k+k_{p}}\) is called the static deﬂection. The ﬁnal steady state can also be found in Laplace domain using ﬁnal value theorem as follows.\begin {align*} F(s)\frac {1}{ms^{2}+cs+k} & =y\left ( s\right ) \\ \frac {\left ( y_{r}(s)-y\left ( s\right ) \right ) k_{p}}{ms^{2}+cs+k} & =y\left ( s\right ) \\ y\left ( s\right ) \left ( ms^{2}+cs+k\right ) & =y_{r}\left ( s\right ) k_{p}-y\left ( s\right ) k_{p}\\ y\left ( s\right ) \left ( ms^{2}+cs+k+k_{p}\right ) & =y_{r}\left ( s\right ) k_{p}\\ y\left ( s\right ) & =\frac {k_{p}}{ms^{2}+cs+k+k_{p}}y_{r}\left ( s\right ) \end {align*}

Assuming \(y_{r}\left ( s\right ) \) is unit step, then\[ y\left ( s\right ) =\frac {\frac {k_{p}}{s}}{ms^{2}+cs+k+k_{p}}\] And using ﬁnal value theorem\begin {align*} y\left ( \infty \right ) & =\lim _{s\rightarrow 0}sy\left ( s\right ) \\ & =\lim _{s\rightarrow 0}\frac {k_{p}}{ms^{2}+cs+k+k_{p}}\\ & =\frac {k_{p}}{k+k_{p}} \end {align*}

Which is the static deﬂection from the analytical solution of the diﬀerential equation found above.

Let us now look at the dynamics of the plant when the controller is a PID given by \(k_{p}+k_{D}s+k_{i}\frac {1}{s}\). The block diagram of the system is

The error is \(e\left ( s\right ) =y_{r}\left ( s\right ) -y\left ( s\right ) \) where \(y_{r}\left ( s\right ) \) is the reference input that we want the output \(y\left ( s\right ) \) to track. As was done for the case of the proportional controller, the plant now appears as

Hence\begin {align*} y\left ( s\right ) \left ( ms^{2}+cs+k\right ) & =\left ( y_{r}\left ( s\right ) -y\left ( s\right ) \right ) \left ( k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) \\ y\left ( s\right ) \left ( ms^{2}+cs+k+k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) & =y_{r}\left ( s\right ) \left ( k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) \end {align*}

And in time domain, the diﬀerential equation now becomes\[ my^{\prime \prime }+\left ( c+k_{D}\right ) y^{\prime }+\left ( k+k_{p}\right ) y+k_{i}\int \limits _{0}^{t}y\left ( \tau \right ) d\tau =k_{p}y_{r}+k_{D}y_{r}^{\prime }+k_{i}\int \limits _{0}^{t}y_{r}\left ( \tau \right ) d\tau \] For the special case when the reference signal is a unit step\begin {align*} my^{\prime \prime }+\left ( c+k_{D}\right ) y^{\prime }+\left ( k+k_{p}\right ) y+k_{i}\int \limits _{0}^{t}y\left ( \tau \right ) d\tau & =k_{p}+k_{i}\int \limits _{0}^{t}y_{r}\left ( \tau \right ) d\tau \\ my^{\prime \prime }+\left ( c+k_{D}\right ) y^{\prime }+\left ( k+k_{p}\right ) y & =k_{p}+k_{i}\int \limits _{0}^{t}\left ( y_{r}\left ( \tau \right ) -y\left ( \tau \right ) \right ) d\tau \end {align*}

The term \(\int \limits _{0}^{t}\left ( y_{r}\left ( \tau \right ) -y\left ( \tau \right ) \right ) d\tau \) is the integral of the error \(e\left ( t\right ) \). When \(y_{r}\left ( t\right ) \) is unit step the above becomes\begin {align*} my^{\prime \prime }+\left ( c+k_{D}\right ) y^{\prime }+\left ( k+k_{p}\right ) y & =k_{p}+k_{i}\int \limits _{0}^{t}\left ( 1-y\left ( \tau \right ) \right ) d\tau \\ & =k_{p}+k_{i}t-k_{i}\int \limits _{0}^{t}y\left ( \tau \right ) d\tau \end {align*}

Therefore, using a PID controller has the eﬀect of making the system more damped, since the eﬀective damping coeﬃcient has now become \(c+k_{D}\) compared to just \(c\) before, and making the system more stiﬀ by adding \(k_{p}\) to the stiﬀness coeﬃcient. The actuating force has two components (for the special case of unit step reference), which is constant force of \(k_{p}\) and a force which is proportional to the error: \(k_{i}\int \limits _{0}^{t}\left ( 1-y\left ( \tau \right ) \right ) d\tau \).

PID controller allows the steady state to become zero. This can be seen by using ﬁnal value theorem in Laplace domain as follows. The transfer function can be found in Laplace domain using ﬁnal value theorem as follows.\begin {align*} F(s)\frac {1}{ms^{2}+cs+k} & =y\left ( s\right ) \\ \frac {\left ( y_{r}\left ( s\right ) -y\left ( s\right ) \right ) \left ( k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) }{ms^{2}+cs+k} & =y\left ( s\right ) \\ y\left ( s\right ) \left ( ms^{2}+cs+k\right ) & =\left ( y_{r}\left ( s\right ) -y\left ( s\right ) \right ) \left ( k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) \\ y\left ( s\right ) \left ( ms^{2}+cs+k+k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) & =y_{r}\left ( s\right ) \left ( k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) \\ y\left ( s\right ) & =\frac {\left ( k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) }{\left ( ms^{2}+cs+k+k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) }y_{r}\left ( s\right ) \end {align*}

Assuming \(y_{r}\left ( s\right ) \) is unit step, then\[ y\left ( s\right ) =\frac {\left ( k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) }{\left ( ms^{2}+cs+k+k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) }\frac {1}{s}\] And using ﬁnal value theorem\begin {align*} y\left ( \infty \right ) & =\lim _{s\rightarrow 0}sy\left ( s\right ) \\ & =\lim _{s\rightarrow 0}\frac {\left ( k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) }{\left ( ms^{2}+cs+k+k_{p}+k_{D}s+k_{i}\frac {1}{s}\right ) }\\ & =\lim _{s\rightarrow 0}\frac {sk_{p}+k_{D}s^{2}+k_{i}}{\left ( ms^{3}+cs^{2}+ks+k_{p}s+k_{D}s^{2}+k_{i}\right ) }\\ & =\frac {k_{i}}{k_{i}}\\ & =1 \end {align*}

Hence \(y\left ( \infty \right ) \) 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. \(k_{i}\) 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}}]} ]