# Feedback control loop

> A controller and a plant with the output measured and fed back to a summing junction. A Block diagrams example with its LaTeX source.

A Block diagrams example in the TeXeR TikZ library: https://texer.org/library/block-diagrams/feedback-loop

Package: [Block diagrams](https://texer.org/library/block-diagrams.md), on CTAN at https://ctan.org/pkg/pgf.

Tags: feedback, control loop, transfer function

## Source

```latex
\usetikzlibrary{arrows.meta, positioning}

\begin{tikzpicture}[
  node distance=8mm and 10mm,
  block/.style={draw, thick, minimum height=10mm, minimum width=16mm},
  sum/.style={draw, thick, circle, inner sep=0pt, minimum size=6mm},
  arrow/.style={-{Stealth}, thick},
]
  \coordinate (in);
  \node[sum, right=of in] (sum) {};
  \node[block, right=of sum] (ctrl) {$C(s)$};
  \node[block, right=of ctrl] (plant) {$G(s)$};
  \coordinate[right=6mm of plant] (tap);
  \coordinate[right=10mm of tap] (out);
  \node[block, below=of plant] (sensor) {$H(s)$};

  \draw[arrow] (in) -- node[above] {$r$} (sum);
  \draw[arrow] (sum) -- node[above] {$e$} (ctrl);
  \draw[arrow] (ctrl) -- node[above] {$u$} (plant);
  \draw[thick] (plant) -- (tap);
  \draw[arrow] (tap) -- node[above] {$y$} (out);
  \draw[arrow] (tap) |- (sensor);
  \draw[arrow] (sensor) -| node[pos=0.9, right] {$-$} (sum);
  \fill (tap) circle (1.5pt);
  \node at ([shift={(-4mm,4mm)}]sum) {$+$};
\end{tikzpicture}
```

## As a complete document

The same example in a document that compiles on its own with pdfLaTeX:

```latex
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{amssymb}
\usetikzlibrary{arrows.meta, positioning}

\begin{document}

\begin{tikzpicture}[
  node distance=8mm and 10mm,
  block/.style={draw, thick, minimum height=10mm, minimum width=16mm},
  sum/.style={draw, thick, circle, inner sep=0pt, minimum size=6mm},
  arrow/.style={-{Stealth}, thick},
]
  \coordinate (in);
  \node[sum, right=of in] (sum) {};
  \node[block, right=of sum] (ctrl) {$C(s)$};
  \node[block, right=of ctrl] (plant) {$G(s)$};
  \coordinate[right=6mm of plant] (tap);
  \coordinate[right=10mm of tap] (out);
  \node[block, below=of plant] (sensor) {$H(s)$};

  \draw[arrow] (in) -- node[above] {$r$} (sum);
  \draw[arrow] (sum) -- node[above] {$e$} (ctrl);
  \draw[arrow] (ctrl) -- node[above] {$u$} (plant);
  \draw[thick] (plant) -- (tap);
  \draw[arrow] (tap) -- node[above] {$y$} (out);
  \draw[arrow] (tap) |- (sensor);
  \draw[arrow] (sensor) -| node[pos=0.9, right] {$-$} (sum);
  \fill (tap) circle (1.5pt);
  \node at ([shift={(-4mm,4mm)}]sum) {$+$};
\end{tikzpicture}
\end{document}
```
