% ---------------------------------------------------------------
% Estrutura interna do controlador PID em malha fechada.
% ---------------------------------------------------------------
\begin{tikzpicture}[>=Latex, line width=0.9pt, node distance=1.0cm,
  bloco/.style={draw, minimum width=2.3cm, minimum height=0.85cm, fill=blue!8},
  soma/.style={draw, circle, minimum size=0.6cm, inner sep=0pt},
  seta/.style={->}]

  \node (r) at (0,0) {$r(t)$};
  \node[soma, right=0.9cm of r] (s1) {};

  \node[bloco, right=2.4cm of s1, yshift=1.7cm]  (p) {$K_p\,e(t)$};
  \node[bloco, right=2.4cm of s1]                (i) {$K_i\displaystyle\int e(t)\,dt$};
  \node[bloco, right=2.4cm of s1, yshift=-1.7cm] (d) {$K_d\,\dfrac{de(t)}{dt}$};

  \node[soma, right=2.2cm of i] (s2) {};
  \node[bloco, right=1.4cm of s2] (g) {$G(s)$};
  \node[right=1.1cm of g] (y) {$y(t)$};

  \draw[seta] (r) -- (s1);
  \draw[seta] (s1) -- node[above, font=\small, pos=0.15]{$e(t)$} ++(0.9,0) |- (p.west);
  \draw[seta] (s1) -- (i.west);
  \draw[seta] (s1) -- ++(0.9,0) |- (d.west);

  \draw[seta] (p.east) -| (s2.north);
  \draw[seta] (i.east) -- (s2);
  \draw[seta] (d.east) -| (s2.south);

  \draw[seta] (s2) -- node[above, font=\small]{$u(t)$} (g);
  \draw[seta] (g) -- (y);
  \draw[seta] (g.south) |- ++(0,-1.3) -| (s1.south);

  \node[font=\small] at ($(s1.north west)+(-0.12,0.12)$) {$+$};
  \node[font=\small] at ($(s1.south west)+(-0.12,-0.12)$) {$-$};
  \node[font=\small] at ($(s2.north west)+(-0.12,0.12)$) {$+$};
  \node[font=\small] at ($(s2.south west)+(-0.12,-0.12)$) {$+$};
  \node[font=\small] at ($(s2.north east)+(0.12,0.12)$) {$+$};

  \node[font=\small, draw, dashed, fit=(p)(i)(d), inner sep=6pt, label={[font=\small]above:Controlador PID}] {};

\end{tikzpicture}
