更新

更新

所以我想重现这张图片(我不想改变我的风格,只是想获取图中块之间的链接):

在此处输入图片描述

这是我的代码:

   \documentclass{article}
   \usepackage{tikz}

  \usetikzlibrary{shapes,arrows,calc,positioning,decorations.pathmorphing} 
   \tikzset{
     pinstyle/.style={pin edge={to-,thin,black}},
     block/.style = {draw, rectangle,
       minimum height=1cm,
      align = center
    %   minimum width=2cm
    },
    input/.style = {coordinate,node distance=1cm},
     output/.style = {coordinate,node distance=1cm},
     arrow/.style={draw, -latex,node distance=2cm},
     pinstyle/.style = {pin edge={latex-, black,node distance=2cm}},
     sum/.style = {draw, circle, node distance=1cm},
     gain/.style = {regular polygon, regular polygon sides=3,
      draw, fill=white, text width=1em,
      inner sep=0mm, outer sep=0mm,
      shape border rotate=-90}
 }

 \begin{document}

   \begin{figure}
    \begin{center}
    \begin{tikzpicture}[auto,>=latex',every node/.append style=
    {font=\scriptsize}]

    %DEFINIZIONE BLOCCHI
    \node [input, name=input] {};
    \node [sum, right=of input] (speed_sum) {};
    \node [gain, right=of speed_sum] (Kp) {$K_{p}$};
    \node [gain, below=of Kp] (Ki) {$K_{i}$};
    \node [block, right=of Ki] (integrator) {$\frac{1}{s}$};
    \node [gain, right=2cm of integrator] (Kc) {$K_{c}$};
    \node [gain, right=2cm of Kc] (Kt) {$K_{t}$};
    \node [block, right=of Kt] (system) {$L(s)$};
    \node [output, right=of system] (output) {};

    \node at ($(speed_sum)!0.5!(Kp)$) (snodo1) {};
    \node [sum, right=of Kp] (control_sum) {};

    %DEFINIZIONE COLLEGAMENTI IN CATENA DIRETTA
    \draw [->] (input) -- node {$\omega_{M}^{\mathrm{DES}}(s)$}(speed_sum);
    \draw [->] (speed_sum) -- node {$E_{v}(s)$}(snodo1);
    \draw [->] (snodo1) -- (Kp);
    \draw [->] (snodo1) --(Ki);
    \draw [->] (Ki) --(integrator);
    \draw [->] (Kp) -- (control_sum);
    \draw [->] (integrator) --(control_sum);
    \draw [->] (control_sum) --(Kc);
    \draw [->] (Kc) -- node {$I^{\mathrm{DES}}(s)=I(s)$}(Kt);
    \draw [->] (Kt) -- node {$C_{\mathrm{M}}(s)$}(system);
    \draw [->] (system) -- node [name=motor_speed] {$s\theta_{M}(s)$}
     (output);

    %DEFINIZIONE COLLEGAMENTI FEEDBACK
    \draw [->] (motor_speed) -- ++ (0,-2) -| node [pos=0.99] {$-$} 
   (speed_sum);

    \end{tikzpicture}
    \end{center}

   \caption{Anello di controllo di velocit\`a implementato}
    \label{fig:speed_loop_semplificato}
    \end{figure} 

     \end{document}

这就是我得到的糟糕结果: 在此处输入图片描述

答案1

根据我的评论。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{shapes,arrows,calc,positioning,decorations.pathmorphing} 
\tikzset{
  -|-/.style={
    to path={
      (\tikztostart) -| ($(\tikztostart)!#1!(\tikztotarget)$) |- (\tikztotarget)
      \tikztonodes
    }
  },
  -|-/.default=0.5,
  |-|/.style={
    to path={
      (\tikztostart) |- ($(\tikztostart)!#1!(\tikztotarget)$) -| (\tikztotarget)
      \tikztonodes
    }
  },
  |-|/.default=0.5,
}
\tikzset{
%   pinstyle/.style={pin edge={to-,thin,black}}, % you have another one below
   block/.style = {draw, rectangle,
       minimum height=1cm,
       align = center
    %   minimum width=2cm
   },
   input/.style = {coordinate,node distance=1cm},
   output/.style = {coordinate,node distance=1cm},
   arrow/.style={draw, -latex,node distance=2cm},
   pinstyle/.style = {pin edge={latex-, black,node distance=2cm}},
   sum/.style = {draw, circle, node distance=1cm},
   gain/.style = {
     regular polygon, regular polygon sides=3,
     draw, fill=white, text width=1em,
     inner sep=0mm, outer sep=0mm,
     shape border rotate=-90
   },
   dot/.style={circle,fill,draw,inner sep=0pt,minimum size=3pt}
 }

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}[auto,>=latex',every node/.append style=
    {font=\scriptsize}]

    %DEFINIZIONE BLOCCHI
\node [input, name=input] {};
\node [sum, right=of input] (speed_sum) {};
\node [gain, above right=of speed_sum] (Kp) {$K_{p}$};
\node [gain, below=of Kp] (Ki) {$K_{i}$};
\node [dot] at ($(speed_sum)!0.5!(Kp)$) (snodo1) {};
\node [sum, right=of Kp] (control_sum) {};
\node [block] (integrator) at (Ki-|control_sum) {$\frac{1}{s}$};
\node [gain, right=2cm of integrator] (Kc) {$K_{c}$};
\node [gain, right=2cm of Kc] (Kt) {$K_{t}$};
\node [block, right=of Kt] (system) {$L(s)$};
\node [output, right=of system] (output) {};


    %DEFINIZIONE COLLEGAMENTI IN CATENA DIRETTA
\draw [->] (input) -- node {$\omega_{M}^{\mathrm{DES}}(s)$}(speed_sum);
\draw [->] (speed_sum) |- node {$E_{v}(s)$}(snodo1);
\draw [->] (snodo1) |- (Kp);
\draw [->] (snodo1) |-(Ki);
\draw [->] (Ki) --(integrator);
\draw [->] (Kp) -- (control_sum);
\draw [->] (integrator) -- (control_sum);
\draw [->] (control_sum) to[-|-] (Kc);
\draw [->] (Kc) -- node {$I^{\mathrm{DES}}(s)=I(s)$}(Kt);
\draw [->] (Kt) -- node {$C_{\mathrm{M}}(s)$}(system);
\draw [->] (system) -- node [name=motor_speed] {$s\theta_{M}(s)$}
     (output);

    %DEFINIZIONE COLLEGAMENTI FEEDBACK
\draw [->] (motor_speed) -- ++ (0,-2) -| node [pos=0.99] {$-$} 
   (speed_sum);
\node [dot] at (motor_speed.south) {};
\end{tikzpicture}
\caption{Anello di controllo di velocit\`a implementato}
\label{fig:speed_loop_semplificato}
\end{figure} 

\end{document}

更新

这更像是你的图像:

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{shapes,arrows,calc,positioning,fit} 

\tikzset{
%   pinstyle/.style={pin edge={to-,thin,black}}, % you have another one below
   block/.style = {draw, rectangle,
       minimum height=1cm,
       align = center
    %   minimum width=2cm
   },
   input/.style = {coordinate,node distance=1cm},
   output/.style = {coordinate,node distance=1cm},
   arrow/.style={draw, -latex,node distance=2cm},
   pinstyle/.style = {pin edge={latex-, black,node distance=2cm}},
   sum/.style = {draw, circle, node distance=1cm},
   gain/.style = {
     regular polygon, regular polygon sides=3,
     draw, fill=white, text width=1em,
     inner sep=0mm, outer sep=0mm,
     shape border rotate=-90
   },
   dot/.style={circle,fill,draw,inner sep=0pt,minimum size=3pt}
 }

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}[>=latex',every node/.append style=
    {font=\scriptsize},node distance=5mm]

    %DEFINIZIONE BLOCCHI
\node [input, name=input] {};
\node [sum, right=of input] (speed_sum) {};
\node [dot, right=8mm of speed_sum] (snodo1) {};
\node [gain, above right=7mm and 5mm of snodo1] (Kp) {$K_{p}$};
\node [gain, below right=7mm and 5mm of snodo1] (Ki) {$K_{i}$};

\node [block,right=of Ki] (integrator) {$\frac{1}{s}$};
\node [sum, xshift=7mm] at (snodo1-|integrator) (control_sum) {};
\node [gain, right=1cm of control_sum] (Kc) {$K_{c}$};
\node [gain, right=1cm of Kc] (Kt) {$K_{t}$};
\node [block, right=8mm of Kt] (system) {$L(s)$};
\node [output, right=of system] (output) {};


    %DEFINIZIONE COLLEGAMENTI IN CATENA DIRETTA
\begin{scope}[auto]
\draw [->] (input) -- node {$\omega_{M}^{\mathrm{DES}}(s)$} (speed_sum);
\draw [->] (speed_sum) -- node {$E_{v}(s)$}(snodo1);
\draw [->] (snodo1) |- (Kp);
\draw [->] (snodo1) |- (Ki);
\draw [->] (Ki) -- (integrator);
\draw [->] (Kp) -| (control_sum) node[very near end,swap] {$-$};
\draw [->] (integrator) -| (control_sum) node[very near end] {$-$};
\draw [->] (control_sum) -- (Kc);
\draw [->] (Kc) -- node [align=center] {$I^{\mathrm{DES}}(s)$\\$=$\\$I(s)$}(Kt);
\draw [->] (Kt) -- node {$C_{\mathrm{M}}(s)$}(system);
\draw [->] (system) -- node [name=motor_speed] {$s\theta_{M}(s)$}
     (output);
\end{scope}

    %DEFINIZIONE COLLEGAMENTI FEEDBACK
\draw [->] (motor_speed) -- ++ (0,-2.5) -| node [pos=0.99,right] {$-$} node[dot,pos=0.28] (snodo2) {}
   (speed_sum);
\node [dot] at (motor_speed.south) {};

\draw [->] (snodo2) -- ++(0,0.5) node[above,draw] (KiKd) {Ki.Kd};
\draw [->] (KiKd) -- ++(0,1) -- node[above,pos=0.5] {$-$}(control_sum);

\node [draw,dashed,inner ysep=5mm,fit=(speed_sum)(Kp)(KiKd)(snodo2)] (sc) {};
\node [above right] at (sc.south west) {Speed controller};
\end{tikzpicture}
\caption{Anello di controllo di velocit\`a implementato}
\label{fig:speed_loop_semplificato}
\end{figure} 

\end{document}

答案2

这是在@Torbjorn T. 帮助后我的尝试。由于我必须进行一些编辑,因此与第一个 .png 图片有一些不同:

在此处输入图片描述

 \documentclass{article}
 \usepackage{tikz}

  \usetikzlibrary{shapes,arrows,calc,positioning,decorations.pathmorphing} 
  \tikzset{
 -|-/.style={
  to path={
  (\tikztostart) -| ($(\tikztostart)!#1!(\tikztotarget)$) |- (\tikztotarget)
  \tikztonodes
}
 },
  -|-/.default=0.5,
  |-|/.style={
to path={
  (\tikztostart) |- ($(\tikztostart)!#1!(\tikztotarget)$) -| (\tikztotarget)
  \tikztonodes
   }
 },
 |-|/.default=0.5,
}
\tikzset{
%   pinstyle/.style={pin edge={to-,thin,black}}, % you have another one 
  below
    block/.style = {draw, rectangle,
   minimum height=1cm,
   align = center
  %   minimum width=2cm
  },
  input/.style = {coordinate,node distance=1cm},
  output/.style = {coordinate,node distance=1cm},
  arrow/.style={draw, -latex,node distance=2cm},
  pinstyle/.style = {pin edge={latex-, black,node distance=2cm}},
  sum/.style = {draw, circle, node distance=1cm},
 gain/.style = {
 regular polygon, regular polygon sides=3,
 draw, fill=white, text width=1em,
 inner sep=0mm, outer sep=0mm,
 shape border rotate=-90
 },
  dot/.style={circle,fill,draw,inner sep=0pt,minimum size=3pt}
}

 \begin{document}

\begin{figure}
\centering
\begin{tikzpicture}[auto,>=latex',every node/.append style=
    {font=\scriptsize}]

%DEFINIZIONE BLOCCHI
\node [input, name=input] {};
\node [sum, right=of input] (speed_sum) {};
\node [gain, above right=2cm of speed_sum] (Kp) {$K_{p}$};
\node [gain, below right=2cm of speed_sum] (Ki) {$K_{i}$};
\node [dot,right=of speed_sum] (snodo1) {};
\node [sum, right=4cm of speed_sum] (control_sum) {};
\node [block, right=of Ki] (integrator) {$\frac{1}{s}$};
\node [gain, right=2.5cm of control_sum] (Kc) {$K_{c}$};
\node [gain, right=2cm of Kc] (Kt) {$K_{t}$};
\node [block, right=of Kt] (system) {$L(s)$};
\node [output, right=of system] (output) {};

\node [dot] at (6.68,-3.75) (snodo2){};
\node [block, right=1cm of integrator] (derivative) {$s\cdot K_{d}\cdot 
 K_{i}$};


%DEFINIZIONE COLLEGAMENTI IN CATENA DIRETTA
\draw [->] (input) -- node {$\omega_{M}^{\mathrm{DES}}(s)$}(speed_sum);
\draw [-] (speed_sum) -- (snodo1);
\draw [->] (snodo1) |- (Kp);
\draw [->] (snodo1) |- (Ki);
\draw [->] (Ki) --(integrator);
\draw [->] (Kp) -| node [pos=0.99] {$+$} (control_sum);
\draw [->] (integrator) -| node [pos=0.99] {$+$} (control_sum);
\draw [->] (control_sum) to[-|-] (Kc);
\draw [->] (Kc) -- node {$I^{\mathrm{DES}}(s)=I(s)$}(Kt);
\draw [->] (Kt) -- node {$C_{\mathrm{M}}(s)$}(system);
\draw [->] (system) -- node [name=motor_speed] {$s\theta_{M}(s)$}
 (output);

%DEFINIZIONE COLLEGAMENTI FEEDBACK
\draw [->] (motor_speed) -- ++ (0,-4) -| node [pos=0.99] {$-$} 
(speed_sum);
\node [dot] at (motor_speed.south) {};
\draw [->] (snodo2) -- (derivative);
\draw [->] (derivative) -- node [near end, above right] {$-$} (control_sum);

%DEFINIZIONE BOX CONTROLLORE DI VELOCITA'
\draw [color=cyan,thick](0.65,-4.3) rectangle (7.7,2.7);
\node at (0.65,3) [above=5mm, right=0mm] {\textsc{Controllore di 
velocit\`a}};

\end{tikzpicture}
\caption{Anello di controllo di velocit\`a implementato}
\label{fig:speed_loop_semplificato}
\end{figure} 

\end{document}

相关内容