---
# System prepended metadata

title: PID Controller

---

# PID Controller
$$
\lambda(t)\ =\ K_pe(t)\ +\ K_i\int_{0}^{\tau}\ e(\tau)\ d\tau\ +\ K_d\dfrac{d}{dt}e(t)
$$
$$
e(t)\ =\ Q^* - Q(t)
$$
$$
\dfrac{d}{dt}e(t)\ =\ -(\lambda(t) - \gamma)
$$
$$
\lambda(t)\ =\ K_p(Q^* - Q(t))\ +\ K_i\int_{0}^{\tau}\ (Q^* - Q(\tau))\ d\tau\ -\ K_d(\lambda(t) - \gamma)
$$
$$
\dfrac{d}{dt}\lambda(t)\ =\ -K_p(\lambda(t) - \gamma)\ +\ K_i(Q^* - Q(t))\ -\ K_d\dfrac{d}{dt}\lambda(t)
$$
$$
(1\ +\ K_d)\dfrac{d}{dt}\lambda(t)\ =\ -K_p(\lambda(t) - \gamma)\ +\ K_i(Q^* - Q(t))
$$
$$
\dfrac{d}{dt}\lambda(t)\ =\ \dfrac{-K_p(\lambda(t) - \gamma)\ +\ K_i(Q^* - Q(t))}{(1\ +\ K_d)}
$$
$$
\lambda(t + 1)\ =\ \lambda(t)\ +\ \dfrac{-K_p(\lambda(t) - \gamma)\ +\ K_i(Q^* - Q(t))}{(1\ +\ K_d)}
$$

