Control Block Diagram with TikZ
作者
Siang Lim
最近上传
6 年前
许可
Creative Commons CC BY 4.0
摘要
Clean and simple way to generate a control block diagram with TikZ. Adapted from http://www.texample.net/tikz/examples/control-system-principles/
Clean and simple way to generate a control block diagram with TikZ. Adapted from http://www.texample.net/tikz/examples/control-system-principles/
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usepackage{verbatim}
\begin{comment}
:Title: Control system principles
:Tags: Block diagrams
An example of a control system with a feedback loop. Block diagrams like this
are quite time consuming to create by hand. The relative node placement feature
makes it a bit easier, but it works best when the nodes have equal widths.
However, the results are quite pleasing and hopefully worth the effort.
You can probably speed up the process by creating custom macros.
http://www.texample.net/tikz/examples/control-system-principles/
\end{comment}
\thispagestyle{empty}
\begin{document}
\tikzstyle{block} = [draw, rectangle,
minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]
% The block diagram code is probably more verbose than necessary
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
% We start by placing the blocks
\node [input, name=input] {};
\node [sum, right of=input] (sum) {};
\node [block, right of=sum] (controller) {$G_c(s)$};
\node [block, right of=controller,
node distance=3cm] (system) {$G_p(s)$};
% We draw an edge between the controller and system block to
% calculate the coordinate u. We need it to place the measurement block.
\draw [->] (controller) -- node[name=u] {$U$} (system);
\node [sum, right of=system, node distance=2cm] (disturbance) {};
\node [block, above of=disturbance] (g_d) {$G_d(s)$};
\node [input, left of=g_d] (dist_input){$D$};
\node [output, right of=disturbance] (output) {};
\node [block, below of=u] (measurements) {$G_m(s)$};
% Once the nodes are placed, connecting them is easy.
\draw [draw,->] (input) -- node {$Y_{sp}$} (sum);
\draw [->] (sum) -- node {$E$} (controller);
\draw [->] (system) -- node {$Y_u$} (disturbance);
\draw [->] (disturbance) -- node [name=y] {$Y$}(output);
\draw [->] (g_d) -- node {$Y_d$} (disturbance);
\draw [draw, ->] (dist_input) -- node {$D$} (g_d);
\draw [->] (y) |- (measurements);
\draw [->] (measurements) -| node[pos=0.99] {$-$}
node [near end] {$Y_m$} (sum);
\end{tikzpicture}
\end{document}