Wie kann ich innerhalb eines Blocks zeichnen?

Wie kann ich innerhalb eines Blocks zeichnen?

Ich versuche einen PID-Regelblock mit Anti-Windup aufzubauen

\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}

Antiwindup

Stattdessen ANTI-WINDUP Symbolmöchte ich das Symbol wie folgt einfügen Bildbeschreibung hier eingeben

Antwort1

Dies ist eine Lösung.

  1. Verwenden Sie \tikzset{style files}stattdessen die altmodische \tikzsyleDefinition.
  2. antiwindwpSymbol wird in einem Tikz-Zeichenmakro definiert.
  3. D-Steuerung wurde hinzugefügt, da nur PI-Regler angezeigt wurden.
  4. Einige Codezeilen wurden entfernt.

AKTUALISIERENEine kurze Anmerkung. Danke an Claudio Fiandrino für die 2. Alternative: Verwendung von tikz 3.0 und folgendem Setup

\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);
}}

mit Kommandozeile

\pic (S) at (antiwindup) {mytest};

führt zum gleichen Ergebnis.

Bildbeschreibung hier eingeben

Code

\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}

verwandte Informationen