Introduction
In this part we’ll define controllers in the Laplace domain.
Let’s firstly cover feedback again.
$N$th-Order systems
In controls, we’ll often study system which can be described with differential equations. A $N$th-order system means we can describe said system with a $N$th-order differential equation.
We also say that the transfer function has degree $N$.
Feedback system
Let’s find the general transfer function for a feedback system, from $r(t)$ to $y(t)$.
- $G(s)$ - System/Process
- $F(s)$ - Controller
- $R(s)$ - Reference value
- $U(s)$ - Input signal
- $Y(s)$ - Output signal
- $E(s)$ - Control error = R(s) - Y(s)
Let $G_{ry}(s) = \dfrac{Y(s)}{R(s)}$
$$ Y(s) = G(s) U(s) $$
We know that: $$ U(s) = F(s) E(s) $$
$$ E(s) = R(s) - Y(s) $$
Therefore: $$ U(s) = F(s)(R(s) - Y(s)) $$
$$ U(s) = F(s)R(s) - F(s)Y(s) $$
Therefore: $$ Y(s) = G(s)(F(s)R(s) - F(s)Y(s)) $$
$$ Y(s) = G(s)F(s)R(s) - G(s)F(s)Y(s) $$
$$ Y(s) + G(s)F(s)Y(s) = G(s)F(s)R(s) $$
$$ Y(s)(1 + G(s)F(s)) = G(s)F(s)R(s) $$
Therefore: $$ G_{ry}(s) = \dfrac{G(s)F(s)}{1 + G(s)F(s)} $$
Let’s denote $G(s)F(s)$ as $L(s)$. $$ G_{ry}(s) = \dfrac{L(s)}{1 + L(s)} $$
This describes the relation between $r(t)$ and $y(t)$ and their stability.
Feedback system
Pros:
- $y(t)$ can be equal to $r(t)$ (with the right controller).
- Can compensate for interference
Cons:
- Can be unstable
Zeroes and poles
$G_{ry}(s)$ can be written as:
$$ G_{ry}(s) = \dfrac{B(s)}{A(s)} $$
The zeros are given by the equation $B(s) = 0$.
The poles are given by the equation $A(s)$.
We’ll see later on how zeros and the poles affect the stability of a system.
Controllers in Laplace
- P-controller - $u(t) = K_p\ e(t)$
- I-controller - $u(t) = K_i\ \int_0^t e(\tau)\ d\tau$
- PI-controller - $u(t) = K_p\ e(t) + K_i \int_0^t e(\tau)\ d\tau$
In Laplace:
- P-controller - $U(s) = K_p\ E(s)$
- I-controller - $U(s) = K_i\ \dfrac{1}{s}\ E(s)$
- PI-controller - $U(s) = K_p\ E(s) + \dfrac{K_i}{s}\ E(s)$
Let’s rewrite the PI controller a bit: $$ \begin{align*} U(s) & = K_p\ E(s) + \dfrac{K_i}{s}\ E(s) \newline & = E(s) \left(K_p + \dfrac{K_i}{s}\right) \newline & = E(s) \left(K_p\left(1 + \dfrac{K_i}{K_p} + \dfrac{1}{s}\right)\right) \newline & = E(s) \left(K_p\left(1 + \dfrac{1}{T_i \cdot s}\right)\right) \newline & = E(s) \left(K_p \cdot \dfrac{1 + T_i \cdot s}{T_i \cdot s} \right) \end{align*} $$
Where $T_i = \dfrac{K_p}{K_i}$
Car example v2
Let’s add some engine dynamics:
$$ F_d(s) = \dfrac{K_u}{1 + T_u \cdot S} \cdot U(s) $$
Car dynamic: $$ G_{car}(s) = \dfrac{K}{1 + sT} = \dfrac{1}{ms + b} $$
From the differential equation (just like last time) we get: $$ Y(s)(ms + b) = \dfrac{K_u}{1 + T_u \cdot s} \cdot U(s) $$
Let’s find transfer function from $U(s) \to Y(s)$.
$$ G_{uy}(s) = \dfrac{Y(s)}{U(s)} $$
$$ G_{uy}(s) = \dfrac{K_u}{(ms + b)(1 + T_u\ s)} $$
Given some values:
- $m = 10^3\ kg$
- $b = 200\ \dfrac{Ns}{m}$
- $K_u = 10k\ \dfrac{N}{rad}$
- $T_u = 1\ sec$
$$ G_{uy}(s) = \dfrac{10^3}{(10^3s + 200)(1 + s)} = \ldots = \boxed{\dfrac{50}{(1 + 5s)(1 + s)}} $$
P-controller
Say that our controller was a P-controller.
Let’s find $G_{ry}(s)$.
$L(s) = K_p \cdot G_{uy}(s)$
$$ L(s) = \dfrac{50K_p}{(1 + 5s)(1 +s)} $$
$$ G_{ry}(s) = \dfrac{\dfrac{50K_p}{(1 + 5s)(1 +s)}}{1 + \dfrac{50K_p}{(1 + 5s)(1 +s)}} $$
$$ G_{ry}(s) = \dfrac{50K_p}{(1 + 5s)(1 + s) + 50K_p} $$
$$ G_{ry}(s) = \dfrac{10K_p}{s^2 + \dfrac{6}{5}s + \dfrac{1}{5} + 10K_p} $$
Gradually increasing reference value
Say that we have $r(t) = r_0 \cdot \sigma(t)$
This means: $$ R(s) = \dfrac{r_0}{s} $$
Let’s study $y(\infty)$.
$$ \lim_{t \to \infty} y(t) = \lim_{s \to 0} sY(s) $$
$$ \lim_{t \to \infty} y(t) = \lim_{s \to 0} s \cdot G_{ry}(s) \cdot R(s) $$
$$ \lim_{t \to \infty} y(t) = \lim_{s \to 0} s \cdot \dfrac{10K_p}{s^2 + \dfrac{6}{5}s + \dfrac{1}{5} + 10K_p} \cdot \dfrac{r_0}{s} $$
$$ \lim_{t \to \infty} y(t) = \lim_{s \to 0} \dfrac{10K_p}{\dfrac{1}{5} + 10K_p} \cdot r_0 $$
Thus $$ \lim_{t \to \infty} y(t) = \lim_{s \to 0} \dfrac{10K_p}{\dfrac{1}{5} + 10K_p} \cdot r_0 < r_0 $$
This means that, a P-controller will never be enough for a system to get an output that is exactly the same as the reference value.
Let’s see how a PI-controller behaves.
Example PI-controller
If we use the same system.
$G_{ry}(s)$ is a 2nd order transfer function. (The denominator is a polynomial of degree 2).
The general formula for 2nd order transfer functions can be written as: $$ G_{ry}(s) = \dfrac{K \omega^2_n}{s^2 + 2 \zeta \omega_n s + \omega^2_n} $$
Where:
- $\omega_n$ - Natural frequency
- $K$- Gain
- $\zeta$ - Damping ratio
So, in the case $G_{ry}(s) = \dfrac{10K_p}{s^2 + \dfrac{6}{5}s + \dfrac{1}{5} + 10 K_p}$
We can rewrite it with: $$ \omega_n = \sqrt{0.2 + 10 K_p} \newline K = \dfrac{10K_p}{0.2 + 10 K_p} \newline \zeta = \dfrac{1.2}{2\ \sqrt{0.2 + 10 K_p}} $$
Back to the PI-controller example.
$$ G_{ry}(s) = \dfrac{L(s)}{1 + L(s)} $$
We know that: $$ L(s) = F(s) G(s) $$
We know: $$ F(s) = K_p \left(\dfrac{1 + T_i s}{T_i s} \right) \newline G(s) = \dfrac{50}{(1 + 5s)(1 + s)} $$
From $G(s)$ we can see that we have two poles. One pole is “fast”, $T = 1\ sec$ $(1 + s)$. The other “slow”, $T = 5\ sec$ $(1 + 5s)$.
If we choose $T_i = 5\ sec$, then: $$ F(s) = K_p \left(\dfrac{1 + 5s}{5s} \right) \newline $$
Which means: $$ L(s) = K_p \left(\dfrac{1 + 5s}{5s} \right) \dfrac{50}{(1 + 5s)(1 + s)} $$
$$ L(s) = \dfrac{50 K_p}{(5s)(1 + s)} $$
Which means: $$ G_{ry}(s) = \dfrac{L(s)}{1 + L(s)} $$
$$ G_{ry}(s) = \dfrac{\dfrac{50 K_p}{(5s)(1 + s)}}{1 + \dfrac{50 K_p}{(5s)(1 + s)}} $$
$$ G_{ry}(s) = \dfrac{50 K_p}{(5s)(1 + s) + 50 K_p} $$
$$ G_{ry}(s) = \dfrac{10 K_p}{s^2 + s + 10 K_p} $$
If we now study: $$ \lim_{t \to \infty} y(t) = \lim_{s \to 0} s \cdot Y(s) $$
$$ \lim_{t \to \infty} y(t) = \lim_{s \to 0} s \cdot G_{ry}(s) R(s) $$
$$ \lim_{t \to \infty} y(t) = \lim_{s \to 0} s \cdot \dfrac{10 K_p}{s^2 + s + 10 K_p} \cdot \dfrac{r_0}{s} $$
$$ \lim_{t \to \infty} y(t) = \lim_{s \to 0} \dfrac{10 K_p}{s^2 + s + 10 K_p} \cdot r_0 $$
$$ \lim_{t \to \infty} y(t) = \lim_{s \to 0} \dfrac{10 K_p}{10 K_p} \cdot r_0 $$
$$ \boxed{\lim_{t \to \infty} y(t) = r_0} $$
So, we see that a PI-controller gets us exactly the reference value.