Tikz 框图 三角形

Tikz 框图 三角形

我想制作一个类似于附图的框图,但我无法正确获得加法器块。是否有函数/命令可以创建一个带有加号和减号的夏季块。如果可能的话,我还想将 Ki 和 Kp 块更改为三角形。任何帮助都很好。

\documentclass[tikz,14pt,border=10pt]{standalone}
\usepackage{textcomp}
\usetikzlibrary{shapes,arrows}

\begin{document}
\tikzset{%
    block/.style    = {draw, thick, rectangle, minimum height = 3em,
        minimum width = 3em},
    sum/.style      = {draw, circle, node distance = 2cm}, % Adder
    input/.style    = {coordinate}, % Input
    output/.style   = {coordinate} % Output
}
% Defining string as labels of certain blocks.
\newcommand{\suma}{\Large$+$}
\newcommand{\inte}{$\displaystyle \int$}
\newcommand{\derv}{\huge$\frac{d}{dt}$}
    \begin{tikzpicture}[auto, thick, node distance=2cm, >=triangle 45]
    \draw
    % Drawing the blocks of first filter :
    node at (-0.5,0)     {$\theta_a$} 
    node at (0,0)      [input,name=input1,thick,above]{}
    node at (-0.5,-2.5)  {$\omega_g$} 
    node at (0,-2.5)   [input,name=input2,thick,above]{}

    node at (1,0)[sum] (sum1) {}
    node at (2,-0.15) (joint1) {}
    node at (4,0) [block](inte1) {\inte}
    node at (6,0) [block](ki){$K_i$}
    node at (4,2) [block](kp){$K_p$}
    node at (7.5,0)[sum] (sum2) {}
    node at (8.5,0)[sum] (sum3) {}
    node at (10,0) [block](inte2) {\inte}
    node at (11,0.15) (joint2) {}
    node at (11,-1.5)(joint3) {}
    node at (11.5,0) (out) {}
    node at (12,0)  {$\theta_f$};

% Commands \draw with options like [->] must be written individually
    \draw[->](input1) -- node {}(sum1);
    \draw[->](sum1) -- node {} (inte1);
    \draw[->](joint1) |- node {} (kp);
    \draw[->](inte1) -- node {} (ki);
    \draw[->](ki) -- node {} (sum2);
    \draw[->](kp) -| node {} (sum2);
    \draw[->](input2) -| node {} (sum3);
    \draw[->](sum2) -- node {} (sum3);
    \draw[->](sum3) -- node {} (inte2);
    \draw[->](inte2) -- node {} (out);
    \draw(joint2) -- node {} (joint3);
    \draw[->](joint3) -| node {} (sum1);
    \end{tikzpicture}
    \end{document}

在此处输入图片描述

答案1

三角增益模块可以使用以下形状来实现isosceles triangle

从总和块开始,我正在处理同样的问题最近。代码如下;我为joints 添加了样式并修剪了中间坐标joint3

\documentclass[tikz,14pt,border=10pt]{standalone}
\usepackage{textcomp}
\usetikzlibrary{shapes,arrows}

\begin{document}
\tikzset{%
    block/.style    = {draw, thick, rectangle, minimum height = 3em,
        minimum width = 3em},
    gain/.style     = {draw, thick, isosceles triangle, minimum height = 3em,
        isosceles triangle apex angle=60},
    port/.style     = {inner sep=0pt, font=\tiny},
    sum/.style n args = {4}{draw, circle, node distance = 2cm, minimum size=5mm, alias=sum,
        append after command={
            node at (sum.north) [port, below=1pt] {$#1$}
            node at (sum.west) [port, right=1pt] {$#2$}
            node at (sum.south) [port, above=1pt] {$#3$}
            node at (sum.east) [port, left=1pt] {$#4$}
        },
    }, % Adder
    joint/.style    = {circle, draw, fill, inner sep=0pt, minimum size=2pt},
    input/.style    = {coordinate}, % Input
    output/.style   = {coordinate} % Output
}
% Defining string as labels of certain blocks.
\newcommand{\suma}{\Large$+$}
\newcommand{\inte}{$\displaystyle \int$}
\newcommand{\derv}{\huge$\frac{d}{dt}$}
    \begin{tikzpicture}[auto, thick, node distance=2cm, >=triangle 45]
    \draw
    % Drawing the blocks of first filter :
    node at (-0.5,0)     {$\theta_a$} 
    node at (0,0)      [input,name=input1,thick,above]{}
    node at (-0.5,-2.5)  {$\omega_g$} 
    node at (0,-2.5)   [input,name=input2,thick,above]{}

    node at (1,0)[sum={}{-}{+}{}] (sum1) {}
    node at (2,0) [joint] (joint1) {}
    node at (4,0) [block](inte1) {\inte}
    node at (6,0) [gain](ki){$K_i$}
    node at (4,2) [gain](kp){$K_p$}
    node at (7.5,0)[sum={+}{+}{}{}] (sum2) {}
    node at (8.5,0)[sum={}{-}{+}{}] (sum3) {}
    node at (10,0) [block](inte2) {\inte}
    node at (11,0) [joint] (joint2) {}
    node at (11.5,0) (out) {}
    node at (12,0)  {$\theta_f$};

% Commands \draw with options like [->] must be written individually
    \draw[->](input1) -- node {}(sum1);
    \draw[->](sum1) -- node {} (inte1);
    \draw[->](joint1) |- node {} (kp);
    \draw[->](inte1) -- node {} (ki);
    \draw[->](ki) -- node {} (sum2);
    \draw[->](kp) -| node {} (sum2);
    \draw[->](input2) -| node {} (sum3);
    \draw[->](sum2) -- node {} (sum3);
    \draw[->](sum3) -- node {} (inte2);
    \draw[->](inte2) -- node {} (out);
    \draw(joint2) -- ++(0,-1.5) [->] -| node {} (sum1);
    \end{tikzpicture}
    \end{document}

结果

相关内容