Tikz 初学者,哪里可以找到手册

Tikz 初学者,哪里可以找到手册

我查看了 LaTex 代码,来自这篇文章:使用 Tikz 的框图
我的问题是,在哪里可以得到有关输入、总和、块等的描述...我想使用乘法,但是在任何地方都找不到这些元素的文档。

编辑:我知道了这些块来自哪里,现在我想问一下是否有某种可以导入的预制块,对于我来说,在 LaTex 中绘图真的很困难,而且我觉得没有能力制作自己的块。

\tikzset{
block/.style = {draw, fill=white, rectangle, minimum height=3em, minimum width=3em},
tmp/.style  = {coordinate}, 
sum/.style= {draw, fill=white, circle, node distance=1cm},
input/.style = {coordinate},
output/.style= {coordinate},
pinstyle/.style = {pin edge={to-,thin,black}
}
}

    \begin{tikzpicture}[auto, node distance=2cm,>=latex']
        \node [input, name=rinput] (rinput) {};
        \node [sum, right of=rinput] (sum1) {};
        \node [block, right of=sum1] (controller) {$k_{p\beta}$};
        \node [block, above of=controller,node distance=1.3cm] (up){$\frac{k_{i\beta}}{s}$};
        \node [block, below of=controller,node distance=1.3cm] (rate) {$sk_{d\beta}$};
        \node [sum, right of=controller,node distance=2cm] (sum2) {};
        \node [block, above = 2cm of sum2](extra){$\frac{1}{\alpha_{\beta2}}$};  %
        \node [block, right of=sum2,node distance=2cm] (system) 
    {$\frac{a_{\beta 2}}{s+a_{\beta 1}}$};
        \node [output, right of=system, node distance=2cm] (output) {};
        \node [tmp, below of=controller] (tmp1){$H(s)$};
        \draw [->] (rinput) -- node{$R(s)$} (sum1);
        \draw [->] (sum1) --node[name=z,anchor=north]{$E(s)$} (controller);
        \draw [->] (controller) -- (sum2);
        \draw [->] (sum2) -- node{$U(s)$} (system);
        \draw [->] (system) -- node [name=y] {$Y(s)$}(output);
        \draw [->] (z) |- (rate);
        \draw [->] (rate) -| (sum2);
        \draw [->] (z) |- (up);
        \draw [->] (up) -| (sum2);
        \draw [->] (y) |- (tmp1)-| node[pos=0.99] {$-$} (sum1);
        \draw [->] (extra)--(sum2);
        \draw [->] ($(0,1.5cm)+(extra)$)node[above]{$d_{\beta 2}$} -- (extra);
        \end{tikzpicture}

答案1

如果我正确理解了你的问题,你实际上对 PI 控制器方案不感兴趣,而是对如何设计一些元素感兴趣...我将尝试分两步回答:

  • 使用现在更可取的语法来使您的 MWE 现代化(如果您仔细比较两种解决方案,您会很容易发现差异)

  • 建议如何设计一些用于绘制控制方案的“构建块”

您对 MWE 的第一次修订:

在此处输入图片描述

 \documentclass[border=3mm,
                tikz]{standalone}
\usetikzlibrary{arrows, 
                calc,
                quotes,
                positioning,
                babel} % <--- added for
    \tikzset{
       block/.style = {rectangle, draw, %fill=white, 
                       minimum size=3em},
         tmp/.style = {coordinate},
         sum/.style = {circle, draw, minimum size=1ex, inner sep=1pt,
                       node contents={} },
         dot/.style = {sum, fill=black, minimum size=2pt,
                       node contents={} },
       input/.style = {coordinate},
      output/.style = {coordinate},
    pinstyle/.style = {pin edge={to-,thin,black}}
            }

    \begin{document}
        \begin{tikzpicture}[auto, 
    node distance = 3mm and 13mm,
                > = latex']
    \coordinate (input) at (0,0);
    \node (sum1)   [sum, right=of input];
    \node (input') [dot, right=of sum1];
    \node (cntrl)  [block, right=of input'] {$k_{p\beta}$};
    \node (up)   [block, above=of cntrl]    {$\frac{k_{i\beta}}{s}$};
    \node (rate) [block, below=of cntrl]    {$sk_{d\beta}$};
    \node (sum2) [sum, right=of cntrl];
    \node (extra)[block, 
                  above=of up.north -| sum2]     {$\frac{1}{\alpha_{\beta2}}$};  %
    \node (extra') [above=of extra]              {$d_{\beta 2}$};
    \node (system) [block, right=of sum2]        {$\frac{a_{\beta 2}}{s+a_{\beta 1}}$};
    \coordinate[right=of system] (output);
    \node [tmp, below=of cntrl] (tmp1)      {$H(s)$};
    %
    \draw[->]   (input)     to ["$R(s)$"]   (sum1) 
                (sum1)      edge["$E(s)$"]  (input')
                (input')    edge            (cntrl)
                (cntrl)     edge       (sum2)
                (sum2)      edge["$U(s)$"]  (system)
                (system)    edge["$Y(s)$"]  (output)
                (extra')    edge            (extra);
    \draw[->]   (input') |- (up);
    \draw[->]   (input') |- (rate);
    \draw[->]   (up)     -| (sum2);
    \draw[->]   (rate)   -| (sum2);
    \draw       (extra)  -- (extra |- up);
    \draw[->]   ($(system.east)!0.5!(output)$) node[dot] -- + (0,-22mm)   -| (sum1);
         \end{tikzpicture}
    \end{document}

您已经可以在这里观察到,它们是如何设计的sumdot求和符号以及乘法符号没有标准化(实际上,它们是标准化的,但很少使用...)。因此,您需要首先决定它们的外观。以下是信号处理和控制中相当常见的符号示例。

\documentclass[border=1mm,
               tikz,{standalone}
\usetikzlibrary{arrows,
                calc,
                quotes,
                positioning,
                babel}

    \begin{document}
\begin{tikzpicture}[
shorten <>/.style = {shorten >=#1, shorten <=#1},
mlt-s/.style={fill=#1,   % <-- symb. for multiplication, square
    rectangle, draw, minimum size=6mm,
    path picture={\draw[very thick,shorten <>=1.5mm]
    (path picture bounding box.north west)edge(path picture bounding box.south east)
    (path picture bounding box.south west) -- (path picture bounding box.north east);
                },% end of node contents
            node contents={}},
mlt-c/.style={fill=#1,    % <-- symb. for multiplication, circle
    circle, draw, minimum size=6mm,
    path picture={\draw[very thick,shorten <>=2mm]
    (path picture bounding box.north west)edge(path picture bounding box.south east)
    (path picture bounding box.south west) -- (path picture bounding box.north east);
                },% end of node contents
            node contents={}},
sum/.style={fill=#1,    % <-- symb. for summation
    circle, draw, minimum size=6mm,
    path picture={\draw[very thick,shorten <>=1mm]
    (path picture bounding box.north)edge(path picture bounding box.south)
    (path picture bounding box.west)  -- (path picture bounding box.east);
                },% end of node contents
            node contents={}},
                    ]
\node (a) [sum=gray!10];
\node (b) [mlt-s=gray!10,right=of a];
\node (c) [mlt-c=gray!20,right=of b];
\draw (a) -- (b);
\end{tikzpicture}
    \end{document}

示例图像演示了这些符号的使用。注意:由于这些符号没有任何文本,因此它们的设计使得空文本成为节点定义的一部分,因此不需要空花括号。这要求节点名称应位于节点定义之前(参见上面的代码)。

在此处输入图片描述

编辑:TikZ 库的使用quotes对所使用的 babel 包很敏感。对于某些语言(斯洛文尼亚语是其中之一),请将 catcode 更改为引号。为了消除此问题,设计了库babel。因此,对于非英语语言的文档,明智的做法是添加它,因为它现在已在上述两个代码中完成。

相关内容