控制系统框图

控制系统框图

我正在尝试使用 TikZ 绘制此框图,到目前为止我已经完成了:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,arrows.meta,decorations.markings,shapes,arrows}

% Definition of blocks:
\tikzstyle{block} = [draw, fill=gray!20, rectangle, 
    minimum height=2em, minimum width=2em]
\tikzstyle{sum} = [draw, fill=gray!20, circle, node distance=2cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]
\begin{document}
\begin{figure}[!hbt]
\centering
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
    % We start by placing the blocks
    \node [input, name=input] {};
    \node [sum, right of=input] (sum1) {};
    \node [block, right of=sum1] (controller) {$\frac{1}{s}$};
    \node [block, right of=controller] (k3) {$k_3$};
    \node [sum, right of=k3] (sum2) {};
    \node [sum, right of=sum2] (sum3) {};
    \node [block, right of=sum3] (system1) {$\frac{1}{s}$};
    \node [block, right of=system1] (system2) {$\frac{1}{s}$};
    % We draw an edge between the controller and system block to 
    % calculate the coordinate u. We need it to place the measurement block. 
    \node [block, below of=system1] (k2) {$k_2$};
    \node [block, below of=k2] (k1) {$k_1$};
    \node [block, above of=system1] (gain2) {$2$};
    \node [block, above of=gain2] (gain1) {$1$};

%    % Once the nodes are placed, connecting them is easy. 
    \draw [draw,->] (input) -- node {$r$} (sum1);
    \draw [->] (sum1) -- node {$e$} (controller);
    \draw [->] (controller) -- node[name=x3] {$x_3$} (k3);
    \draw [->] (k3) -- (sum2);
    \draw [->] (sum2) -- node[name=u] {$u$} (sum3);   
    \draw [->] (sum3) -- (system1);   
    \draw [->] (system1) -- node[name=x2] {$x_2$} (system2);
    \node [output, right of=system2] (output) {};
    \draw [->] (system2) -- node [name=y] {$x_1$}(output);
    \end{tikzpicture}
\end{figure}
\end{document}

但我在图表中绘制反馈时遇到了问题。

以及如何在每个箭头的左边添加加号和减号?

在此处输入图片描述 在此处输入图片描述

答案1

以下是一些供您参考的提示:

\coordinate (X) at ($(output)!0.5!(system2)$);
\draw[->] (gain1)  -| (sum3);
\draw[->] (gain2)  -- ++(-1,0) -- (sum3);
\draw[->] (sum1) -- ++(0,-5) -| (X);

++(-1,0)正在相对于先前的坐标创建一个新坐标。|--|用于制作有角度的连接点。

答案2

有一些例子texsample.net网站。

相关内容