我正在尝试建立一个具有抗饱和功能的 PID 控制块
\tikzstyle{controller} = [draw, fill=blue!20, rectangle,
minimum height=3.5em, minimum width=6em]
\tikzstyle{subblock} = [draw, fill=blue!5, rectangle,
minimum height=3.5em, minimum width=6em]
\tikzstyle{pidblocks} = [draw, fill=green!5, rectangle,
minimum height=3.5em, minimum width=6em, text width= 6em]
\tikzstyle{transformation} = [draw, fill=red!5, rectangle,
minimum height=3.5em, minimum width=6em]
\tikzstyle{filter} = [draw, fill=green!10, rectangle,
minimum height=3.5em, minimum width=6em]
\tikzstyle{block} = [draw, fill=windblue!20, rectangle,
minimum height=3.5em, minimum width=6em]
\tikzstyle{sum} = [draw, circle, node distance=1.5cm, inner sep=0.15cm]
\tikzstyle{disturbance} = [draw=none, node distance=1.5cm, line width=0pt]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\begin{figure}[!h]
\centering
\begin{tikzpicture}[auto, scale=0.8, node distance=3cm,>=latex', every
node/.style={transform shape}]
% We start by placing the blocks
\node [input, name=input1] {};
\node [sum, right of=input1] (sumofinputerror) {};
\node [pidblocks, right= 5cm of sumofinputerror, yshift=1.5cm] (kp) {P\hfill$k_p e(t)$};
\node [pidblocks, right= 5cm of sumofinputerror, yshift=-1.5cm] (ki) {I\hfill$k_i \int{e(t)dt}$};
\node [sum, left = 0cm of $(sumofinputerror)!0.5!(ki.west)$, xshift=0.2cm, yshift=-0.8cm] (sumofantiwindup) {};
\node [sum, right = 2cm of $(kp.east)!0.5!(ki.east)$] (controlsum) {};
\node [pidblocks, right of= controlsum] (antiwindup) {};
\draw [->] (input1) -- node[name=inputerror] {$y_{ref}(t)$} (sumofinputerror);
%\draw [->] (sumofinputerror) -| ($(sumofinputerror)!0.5!(kp.west)$);
\draw [->] (sumofinputerror) -| (sumofantiwindup);
\draw [->] (sumofantiwindup) -- (ki);
\draw [->] (ki) -| node[pos=0.95]{$+$}(controlsum);
\draw [->] (kp) -| (controlsum);
\end{tikzpicture}
\label{fig:torque_pid_block}
\caption{Individual pitch and trailing edge flap control block.}
\end{figure}
ANTI-WINDUP Symbol
我想插入如下 符号
答案1
这是一个解决方案。
- 用来
\tikzset{style files}
代替旧式的\tikzsyle
定义。 antiwindwp
符号由 tikz 绘制宏定义。- 由于仅显示 PI 控制器,因此添加了 D 控制。
- 一些代码行已被删除。
更新简短说明。感谢 Claudio Fiandrino 提供的第二种替代方案:使用 tikz 3.0 和以下设置
\tikxset{mytest/.pic = {
\draw (-1,0) -- (1,0) (0,-0.6)--(0,0.6);
\draw (-0.7,-0.5)--(-0.5,-0.5) -- (0.5,0.5) --(0.7,0.5);
}}
使用命令行
\pic (S) at (antiwindup) {mytest};
将产生相同的输出。
代码
\documentclass[border=10pt]{standalone}%{article}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{arrows,calc,positioning}
\begin{document}
\tikzset{controller/.style = {draw, fill=blue!20, rectangle, minimum height=3.5em, minimum width=6em},
subblock/.style= {draw, fill=blue!5, rectangle, minimum height=3.5em, minimum width=6em},
pidblocks/.style = {draw, fill=green!5, rectangle, minimum height=3.5em, minimum width=6em, text width= 6em},
sum/.style = {draw, circle, node distance=1.5cm, inner sep=0.15cm},
input/.style = {coordinate},
output/.style ={coordinate}
}
%\tikzstyle{transformation} = [draw, fill=red!5, rectangle, minimum height=3.5em, minimum width=6em]
%\tikzstyle{filter} = [draw, fill=green!10, rectangle, minimum height=3.5em, minimum width=6em]
%\tikzstyle{block} = [draw, fill=windblue!20, rectangle, minimum height=3.5em, minimum width=6em]
%\tikzstyle{disturbance} = [draw=none, node distance=1.5cm, line width=0pt]
\def\windup{
\tikz[remember picture,overlay]{
\draw (-1,0) -- (1,0) (0,-0.6)--(0,0.6);
\draw (-0.7,-0.5)--(-0.5,-0.5) -- (0.5,0.5) --(0.7,0.5);
}}
%\begin{figure}[!h]
% \centering
\begin{tikzpicture}[auto, scale=0.8, node distance=3cm,>=latex',
every node/.style={transform shape}]
% We start by placing the blocks
\node [input, name=input1] {};
\node [sum, right of=input1] (sumofinputerror) {};
\node [pidblocks, right= 5cm of sumofinputerror, yshift=1.5cm] (kp) {P\hfill$k_p e(t)$};
\node [pidblocks, right = 5cm of sumofinputerror, yshift=-1.5cm] (ki) {I\hfill$k_i \int{e(t)dt}$};
\node [pidblocks] at ($(kp)!0.5!(ki)$)(kd) {D\hfill$k_d \frac{d e(t)}{dt}$}; % D control
\node [sum, right = 2cm of $(kp.east)!0.5!(ki.east)$] (controlsum) {};
\node [pidblocks, right of= controlsum] (antiwindup) {};
\node[] at (antiwindup) {\windup};
\draw [->] (input1) -- node[name=inputerror] {$y_{ref}(t)$} (sumofinputerror);
\draw [->] (sumofinputerror) -| ($(sumofinputerror)!0.5!(kp.west)$)|-(kp.west);
\draw [->] (sumofinputerror) -| ($(sumofinputerror)!0.5!(ki.west)$)|-(ki.west);
% --- draw lines
\draw [->] (sumofinputerror) -- (kd);
\draw [->] (kd) -- (controlsum);
\draw [->] (ki) -| node[pos=0.95]{$+$}(controlsum);
\draw [->] (kp) -| (controlsum);
\draw [->] (controlsum)--(antiwindup);
\node[right= 3cm of antiwindup] (output){};
\draw[->] (antiwindup) --node[pos=0.8](c){} (output);
\draw[->] (c) |- ([yshift=-1cm]ki.south)-|node[pos=0.95](){$-$}(sumofinputerror); % feedback line
\end{tikzpicture}
%\label{fig:torque_pid_block}
%\caption{Individual pitch and trailing edge flap control block.}
%\end{figure}
\end{document}