동적 출력 피드백 컨트롤러

동적 출력 피드백 컨트롤러

나는 기본 LaTeX를 알고 있습니다. 다이어그램에 표시된 것과 유사한 블록 다이어그램을 그리려고 했지만 그릴 수 없습니다. 이러한 블록 다이어그램을 그리는 쉬운 방법을 제안해 주십시오. 감사합니다. 이것은 내 코드입니다. 합계에서 상태 추정기로 피드백을 그릴 수 없습니다.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,calc}

\begin{document}

\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$};
    \node [block, above of=controller,node distance=2cm] (up){$A,B$};
    \node [block, right of=controller] (esti) 
{$estimator$};

\node [block, above of=esti,node distance=2cm] (extra){$C$};
    \node [output, right of=extra, node distance=2cm] (output) {};
    \draw [->] (rinput) -- node{$R(s)$} (sum1);
    \draw [->] (sum1)|- node[name=z,anchor=north]{$u(k)$}(up);
    \draw [->] (up) -- node{$x(k)$} (extra);
     \draw [->] (extra) -- node [name=y] {$Y(s)$}(output);
     \draw [->] (y) |-  (esti);
     \draw [->] (esti)--node{$n(k)$}(controller);
    \draw [->] (controller)--(sum1);
 
    \end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

내 새 코드

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,calc}

\begin{document}

\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}
    },
    point/.style = {draw, fill=black, circle, minimum size=0.8mm, node distance=1.5cm, inner sep=0pt},
}
\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$};
    \node [block, above of=controller,node distance=2cm] (up){$A,B$};
    \node [block, right of=controller] (esti) 
{$estimator$};

\node [block, above of=esti,node distance=2cm] (extra){$C$};
    \node [output, right of=extra, node distance=2cm] (output) {};
    \node [point, above =1cm of sum1] (point0){};
    \draw [->] (rinput) -- node{$R(s)$} (sum1);
    \draw [->] (sum1)|- node[name=z,anchor=north]{$u(k)$}(up);
    \draw [->] (up) -- node{$x(k)$} (extra);
   \draw [->] (extra) -- node [name=y]  {$Y(s)$}(output);
   \draw [->] (y) |-  (esti);
     \draw [->] (esti)--node{$n(k)$}(controller);
    \draw [->] (controller)--(sum1);
   % \draw [->] (point0) -|  node{} ([xshift=2cm]esti);
 %  \draw [->] (point0) -- (output |- point0) |- ([yshift=0.5cm] esti);
    \draw [->] (point0) -- (output |- point0) |- ([yshift=0.5cm] esti);
     
    \end{tikzpicture}
\end{document}
    
\end{document}

답변1

[편집됨의견에서 요청한 대로 노드 및 좌표 그룹 주위에 맞는 노드를 추가합니다.]

이 같은? 대부분의 정리는 대신 positioning구문을 사용하여 수행됩니다 .<direction>=of ...<direction> of=...

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,fit}

\begin{document}
\newlength\estilength
\settowidth\estilength{$estimator$}
\tikzset{
  block/.style = {draw, fill=white, rectangle, minimum height=3em, minimum width=3em,text width=\estilength,align=center},
  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}
  },
  point/.style = {draw, fill=black, circle, minimum size=0.8mm, node distance=1.5cm, inner sep=0pt},
  dashed node/.style={draw,dashed,inner sep=7.5pt,rounded corners},
}%
\begin{tikzpicture}[auto, node distance=15mm,>=latex']
  \node [input, name=rinput] (rinput) {};
  \node [sum, right=25mm of rinput] (sum1) {};
  \node [block, right=of sum1] (controller) {$k$};
  \node [block, above=of controller] (up){$A,B$};
  \node [block, right=of controller] (esti) {$estimator$};
  
  \node [block] (extra) at (esti |- up){$C$};
  \node [output, right=25mm of extra] (output) {};
  \node [point, above=1cm of sum1] (point0){};
  \draw [->] (rinput) -- node{$R(s)$} (sum1);
  \draw [->] (sum1)|- node[name=z,midway]{$u(k)$}(up);
  \draw [->] (up) -- node{$x(k)$} (extra);
  \draw [->] (extra) -- node [name=y]  {$Y(s)$}(output);
  \draw [->] (y) |-  (esti);
  \draw [->] (esti)--node{$n(k)$}(controller);
  \draw [->] (controller)--(sum1);
  \draw [->] (point0) -- ([xshift=10pt]esti.east |- point0) |- ([yshift=0.5cm] esti) coordinate [midway] (c1);
  \coordinate [xshift=-2.5pt] (c2) at (sum1.south west);
  
  \node (f1) [dashed node,fit=(esti) (c2) (controller) (point0) (c1) (sum1)] {};
  \node [dashed node,fit=(extra) (up) (extra -| c2) (up -| c1)] {};
  
\end{tikzpicture}
\end{document}

정리된 출력 컨트롤러

답변2

@cfr +1의 훌륭한 답변에 대한 약간의 변형 - 색상이 있는 배경을 추가하고 진입점을 약간 이동합니다.node[xshift=-1em]

    \draw [->] (rinput) -- node[xshift=-1em]{$R(s)$} (sum1);

그리고

\begin{pgfonlayer}{background}
            % Draw background box.
            \node[fill=yellow!90!black,thick,draw=gray,rounded corners=2mm, inner xsep=1em, inner ysep=1em] (background) [fit = (z)  (extra) ] {};
            \node[fill=green!50,thick,draw=gray,rounded corners=2mm, inner xsep=1.7em, inner ysep=.5em, xshift=-.5em] (background) [fit = (point0)  (esti) ] {};
        \end{pgfonlayer}

산출

여기에 이미지 설명을 입력하세요

MWE

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,calc}
\usetikzlibrary{backgrounds,fit,decorations.pathreplacing}

\begin{document}
    \newlength\estilength
    \settowidth\estilength{$estimator$}
    \tikzset{
        block/.style = {draw, fill=brown!10, rectangle, minimum height=3em, minimum width=3em,text width=\estilength,align=center},
        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}
        },
        point/.style = {draw, fill=black, circle, minimum size=0.8mm, node distance=1.5cm, inner sep=0pt},
    }%
    \begin{tikzpicture}[auto, node distance=2cm,>=latex']
        \node [input, name=rinput] (rinput) {};
        \node [sum, right=2cm of rinput] (sum1) {};
        \node [block, right=of sum1] (controller) {$k$};
        \node [block, above=15mm of controller] (up){$A,B$};
        \node [block, right=of controller] (esti) {$estimator$};
        
        \node [block] (extra) at (esti |- up){$C$};
        \node [output, right=of extra] (output) {};
        \node [point, above=1cm of sum1] (point0){};
        \draw [->] (rinput) -- node[xshift=-1em]{$R(s)$} (sum1);
        \draw [->] (sum1)|- node[name=z,midway]{$u(k)$}(up);
        \draw [->] (up) -- node{$x(k)$} (extra);
        \draw [->] (extra) -- node [name=y]  {$Y(s)$}(output);
        \draw [->] (y) |-  (esti);
        \draw [->] (esti)--node{$n(k)$}(controller);
        \draw [->] (controller)--(sum1);
        \draw [->] (point0) -- ([xshift=10pt]esti.east |- point0) |- ([yshift=0.5cm] esti);
        
        \begin{pgfonlayer}{background}
            % Draw background box.
            \node[fill=yellow!90!black,thick,draw=gray,rounded corners=2mm, inner xsep=1em, inner ysep=1em] (background) [fit = (z)  (extra) ] {};
            \node[fill=green!50,thick,draw=gray,rounded corners=2mm, inner xsep=1.7em, inner ysep=.5em, xshift=-.5em] (background) [fit = (point0)  (esti) ] {};
        \end{pgfonlayer}
    \end{tikzpicture}
\end{document}

편집하다

필요한 OP로 점선을 사용합니다.

여기에 이미지 설명을 입력하세요

MWE

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,calc}
\usetikzlibrary{backgrounds,fit,decorations.pathreplacing}

\begin{document}
    \newlength\estilength
    \settowidth\estilength{$estimator$}
    \tikzset{
        block/.style = {draw, fill=brown!10, rectangle, minimum height=3em, minimum width=3em,text width=\estilength,align=center},
        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}
        },
        point/.style = {draw, fill=black, circle, minimum size=0.8mm, node distance=1.5cm, inner sep=0pt},
    }%
    \begin{tikzpicture}[auto, node distance=2cm,>=latex']
        \node [input, name=rinput] (rinput) {};
        \node [sum, right=2cm of rinput] (sum1) {};
        \node [block, right=of sum1] (controller) {$k$};
        \node [block, above=15mm of controller] (up){$A,B$};
        \node [block, right=of controller] (esti) {$estimator$};
        
        \node [block] (extra) at (esti |- up){$C$};
        \node [output, right=of extra] (output) {};
        \node [point, above=1cm of sum1] (point0){};
        \draw [->] (rinput) -- node[xshift=-1em]{$R(s)$} (sum1);
        \draw [->] (sum1)|- node[name=z,midway]{$u(k)$}(up);
        \draw [->] (up) -- node{$x(k)$} (extra);
        \draw [->] (extra) -- node [name=y]  {$Y(s)$}(output);
        \draw [->] (y) |-  (esti);
        \draw [->] (esti)--node{$n(k)$}(controller);
        \draw [->] (controller)--(sum1);
        \draw [->] (point0) -- ([xshift=10pt]esti.east |- point0) |- ([yshift=0.5cm] esti);
        
        \begin{pgfonlayer}{background}
            % Draw background box.
            \node[fill=yellow!90!black,thick,dashed, draw=gray,rounded corners=2mm, inner xsep=1em, inner ysep=1em] (background) [fit = (z)  (extra) ] {};
            \node[fill=green!50,thick,draw=gray,dashed, rounded corners=2mm, inner xsep=1.7em, inner ysep=.5em, xshift=-.5em] (background) [fit = (point0)  (esti) ] {};
        \end{pgfonlayer}
    \end{tikzpicture}
\end{document}

답변3

코드를 더욱 간결하게 만들기 위한 (작은) 노력이 필요합니다 tikzpicture. 이를 위해 arrows.meta(더 좋은 화살표 머리용), ext.paths.ortho(두 개의 직교 화살표용), fit(상자 주변의 점선 노드용), positioning(노드 배치용) 및 quotes(대부분의 가장자리 레이블용) 패키지가 사용됩니다.

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                ext.paths.ortho,    % defined in the tikz-ext package
                                    % now possible with Console MiKTeX
                fit,
                positioning,
                quotes}

\begin{document}
\newlength\estilength
\settowidth\estilength{$estimator$}
\tikzset{
  arr/.style = {-Stealth},
  box/.style = {draw,  semithick, minimum height=3em, text width=\estilength, align=center},
  sum/.style = {circle, draw, semithick},
  dot/.style = {circle, fill=black, inner sep=2pt, outer sep=0pt},
  FIT/.style = {draw, dashed, rounded corners, 
                inner sep=2em, xshift=1em, 
                fit=#1},
every edge/.append style = {draw, arr}
        }%

\begin{tikzpicture}[auto, 
    node distance = 17mm and 17mm
                    ]
\coordinate (rin);
\node   (sum1)  [sum, right=of rin]     {};
\node   (cntr)  [box, right=of sum1]    {$k$};
\node   (esti)  [box, right=of cntr]    {\emph{estimator}};

\node   (up)    [box, above=of cntr]    {$A,B$};
\node   (extra) [box, right=of up]      {$C$};

\node   (dot)   [right=of extra, 
                 dot, label = $Y(s)$]    {};
\coordinate[right=of dot] (out);

\node[FIT=(sum1) (esti)]    {};
\node[FIT=(sum1.west |- up) (extra)]    {};
% arrows
\draw   (rin)   edge ["$R(s)$"]     (sum1)
        (up)    edge ["$x(k)$"]     (extra)
        (cntr)  edge                (sum1)
        (extra) edge                (out)
        (esti)  edge ["$n(k)$"]     (cntr);
\draw [arr]     (sum1)  |-          (up) node [pos=0.5, above] {$u(k)$};
\draw [arr]     (sum1.north)  -- ++ (0,9mm) node[dot] {}
                              r-rl  (esti.15);
\draw [arr]     (dot) |- (esti);
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보