Introduction
In this part we’ll see how we can design different type of controllers to make a system behave as wanted.
PD-controller
$$ G(s) = \dfrac{K}{s(1 + sT)} $$
$$ F(s) = K_p + K_d s $$
The loop transfer function is: $$ L(s) = F(s)G(s) = \dfrac{K(K_p + K_d s)}{s(1 + sT)} = \dfrac{\frac{K}{T} (K_p + K_d s)}{s^2 + \frac{1}{T} s} $$
$$ G_{ry}(s) = \dfrac{L(s)}{1 + L(s)} = \dfrac{\dfrac{\frac{K}{T} (K_p + K_d s)}{s^2 + \frac{1}{T} s}}{1 + \dfrac{\frac{K}{T} (K_p + K_d s)}{s^2 + \frac{1}{T} s}} = \dfrac{\frac{K}{T}(K_p + K_d s)}{s^2 + \frac{1}{T} s + \frac{K}{T}(K_p + K_d s)} = \dfrac{K_p \frac{K}{T} + K_d \frac{K}{T} s}{s^2 + (1 + K_d K) s + K_p \frac{K}{T}} $$
Which we can view as a second-order system where: $$ \omega_n = \sqrt{K_p \frac{K}{T}} \newline $$
$$ \zeta = \dfrac{1 + K_d K}{2 \omega_n} = \dfrac{1 + K_d K}{2\sqrt{K_p \frac{K}{T}}} $$
If $K_d$ increases, $\zeta$ will also increase. This means that the phase margin will increase.
If $K_d$ decreases, $\zeta$ will also decrease. This means that the phase margin will decrease.
Example
In this case we have a simple I-controller.
$$ u(t) = K_i \int_0^t e(\tau)\ d\tau \iff F(s) = \dfrac{K_i}{s} $$
Given that our process is: $$ G(s) = \dfrac{b}{s + a} $$
Our loop transfer function is: $$ L(s) = F(s)G(s) = \dfrac{K_i b}{s(s + a)} $$
What should $K_i$ be if we want a phase margin of $45^\circ$, meaning $\phi_m = 45^\circ$. $$ L(j\omega) = \dfrac{K_i b}{j\omega(j\omega + a)} $$
We defined the phase margin as: $$ \phi_m = arg(L(j\omega_c)) + 180^\circ $$
$$ 45^\circ = arg(L(j\omega_c)) + 180^\circ $$
$$ arg(L(j\omega_c)) = -135^\circ $$
$$ -90^\circ - arctan(\dfrac{\omega_c}{a}) = -135^\circ $$
$$ arctan(\dfrac{\omega_c}{a}) = 45^\circ $$
$$ \dfrac{\omega_c}{a} = 1 $$
$$ \omega_c = a $$
Using the fact that $|L(j\omega_c)| = 1$: $$ |L(j\omega_c)| = 1 $$
$$ \dfrac{K_i b}{\omega_c \sqrt{\omega_c^2 + a^2}} = 1 $$
$$ \dfrac{K_i b}{a \sqrt{a^2 + a^2}} = 1 $$
$$ \dfrac{K_i b}{a \sqrt{2a^2}} = 1 $$
$$ \dfrac{K_i b}{\sqrt{2}\ a^2} = 1 $$
$$ K_i b = \sqrt{2}\ a^2 $$
$$ K_i = \dfrac{\sqrt{2}\ a^2}{b} $$
Let’s put this into $L(s)$ $$ L(s) = \dfrac{\sqrt{2}\ a^2}{s(s + a)} $$
Let’s now find $G_{ry}(s)$ $$ G_{ry}(s) = \dfrac{L(s)}{1 + L(s)} = \ldots = \dfrac{\sqrt{2}\ a^2}{s(s + a) + \sqrt{2}\ a^2} = \dfrac{\sqrt{2}\ a^2}{s^2 + as + \sqrt{2}\ a^2} $$
Second-order system! $$ \omega_n = \sqrt{\sqrt{2}\ a^2} = 2^{\frac{1}{4}}\ a \newline \zeta = \dfrac{a}{2 \omega_n} = \dfrac{a}{2(2^{\frac{1}{4}}\ a)} = \dfrac{1}{2 \cdot 2^{\frac{1}{4}}} = 0.42 $$
Example
Let’s now do a PI-controller
Given the system: $$ G(s) = \dfrac{1}{s(s + 8)^2} $$
Design a PI-controller so that the phase margin is $50^\circ$, given that $\omega_c = 0.3 \omega_{\pi}$
NB: This notation, $\omega_c = C \cdot \omega_{\pi}$ means that $|G(j\omega_c)| = 1$ and $arg(G(j\omega_{\pi}) = -180^\circ$, not the loop transfer function. One can also denote it as $\omega_{cG}$
A general PI-controller is written as: $$ F(s) = K_p + \dfrac{K_i}{s} = K_p(1 + \dfrac{1}{T_i s}) = K_p(\dfrac{1 + T_i s}{T_i s}) $$
We know that: $$ arg(G(j\omega_{\pi})) = -180^\circ $$
$$ G(j\omega) = \dfrac{1}{j\omega(j\omega + 8)^2} $$
Which means: $$ arg(G(j\omega)) = -90^\circ - 2 arctan(\dfrac{\omega}{8}) $$
$$ -90^\circ - 2 arctan(\dfrac{\omega_{\pi}}{8}) = -180^\circ $$
$$ 2 arctan(\dfrac{\omega_{\pi}}{8}) = 90^\circ $$
$$ arctan(\dfrac{\omega_{\pi}}{8}) = 45^\circ $$
$$ \dfrac{\omega_{\pi}}{8} = 1 $$
$$ \omega_{\pi} = 8 $$
From our initial condition: $$ \omega_c = 0.3 \cdot \omega_{\pi} = 2.4 $$
A phase margin of $50^\circ$ means: $$ \phi_m = 50^\circ \iff arg(L(j\omega_c)) + 180^\circ = 50^\circ $$
We actually don’t need to calculate what the loop transfer function is here, we can use the fact that $L(s) = F(s)G(s)$, which means $arg(L(j\omega)) = arg(F(j\omega)) + arg(G(j\omega))$.
$$ arg(G(j\omega)) = -90^\circ - 2 arctan(\dfrac{2.4}{8}) = -123.4^\circ $$
$$ F(j\omega) = K_p(\dfrac{1 + T_i j\omega}{T_i j\omega}) $$
$$ arg(F(j\omega)) = arctan(T_i \omega) - 90^\circ $$
$$ arg(L(j\omega_c)) + 180^\circ = 50^\circ $$
$$ arctan(T_i \omega_c) - 90^\circ -123.4^\circ + 180^\circ = 50^\circ $$
$$ arctan(T_i \omega_c) = 83.4^\circ $$
$$ 2.4 T_i = tan(83.4^\circ) $$
$$ T_i = \dfrac{tan(83.4^\circ)}{2.4} = 3.6 $$
Now, let’s use that $|L(j\omega_c)| = 1$ $$ |L(j\omega_c)| = 1 $$
$$ |F(j\omega)G(j\omega)| = 1 $$
$$ |F(j\omega)| |G(j\omega)| = 1 $$
$$ K_p \cdot \dfrac{\sqrt{1^2 + (\omega_c \cdot T_i)^2}}{\omega_c \cdot T_i} \cdot \dfrac{1}{\omega_c \sqrt{\omega_c^2 + 8^2}^2} = 1 $$
$$ K_p = \ldots \approx 166.31 $$