是否有适当的方法来改变 CircuiTikZ 中加法器和块的大小,以便适合块内的传递函数?
\begin{circuitikz}
\ctikzset{ blocks/scale = 0.5}
\draw (0,0) node[adder] (m) {}
(m.1) to[short,-o] ++(-1,0) node[](sp){};
\draw (m.2) node[below left] {\scriptsize $-$};
\draw (m.1) node[above left] {\scriptsize $+$};
\draw(m.1) node[inputarrow] {};
\ctikzset{ blocks/scale = 1}
\draw (m.3) to[short,>] ++(0.5,0) to[amp, t=$K_c$,l_={\scriptsize Gain},>] ++(1.25,0) node[] (p){};
\ctikzset{ blocks/scale = 0.5}
\draw (p) to[short,>] node[adder, fill=white] (int){} ++(0.75,0) (int.1) node[inputarrow] {};
\ctikzset{ blocks/scale = 1}
\draw (int.3) to[short] ++(2,0) node(ua) {} to[short] ++(0.25,0) to[twoport, l_={\scriptsize Process}, t=$\frac{k_p}{a s^2+b s+1}$,> ] ++(2.25,0) node(pv) {} to[short] ++(0,-2.25) node (a){} to[short] (a -| m.2) to[short,>] (m.2)node[inputarrow,rotate=90]{};
\draw (pv) to[short,*-o] ++(0.5,0) node[] (pv2) {};
\draw (ua) to[short,*-] ++(0,-1) node[] (ua2){} to[twoport,l={\scriptsize Integral}, t=$\frac{1}{T_i s+1}$,>] ++(-2,0) node (uf){} to[short] (ua2 -| int.2) to[short,>] (int.2)node[inputarrow,rotate=90]{};
\draw (int.2) node[below left] {\scriptsize $+$};
\draw (int.1) node[above left] {\scriptsize $+$};
\draw (ua) node[above right]() {\scriptsize \quad $u$} (ua) node[below right]() {\scriptsize\quad MV};
\draw (sp) node[above](){\scriptsize $w$} (sp) node[below](){\scriptsize SP};
\draw (pv2) node[above](){\scriptsize $y$} (pv2) node[below](){\scriptsize PV};
\draw (m.3) node[above right](){\scriptsize $e$};
\draw (uf) node[above](){\scriptsize $u_f$} (pv2);
\draw[dashed, cyan!70!black] (0.55,-2) rectangle ++(4.755,2.75);
\end{circuitikz}
答案1
使用纯净的tikz
:
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
calc,
fit,
positioning,
quotes,
shapes.geometric}
\usepackage{amsmath}
\tikzset{
alias path picture bounding box/.code=%
\pgfnodealias{#1}{path picture bounding box},
CNTRL/.style =
{
> = Triangle,
block/.style = {rectangle, draw,
minimum height=8mm, minimum width=16mm,
outer sep = 0mm},
dot/.style = {fill,
circle, inner sep=0mm, outer sep=0mm, minimum size=1mm,
node contents={}},
gain/.style = {regular polygon, regular polygon sides=3, shape border rotate=-90, draw,
inner sep=0pt, anchor=west,
outer sep = 0mm},
sum/.style = {circle, draw, minimum size=6mm,
path picture={%
\tikzset{alias path picture bounding box=@}
\draw[very thick, shorten <=1mm, shorten >=1mm, -]
(@.north) edge (@.south)
(@.west) -- (@.east);
},% end of node contents
node contents={}},
}% end of CNTRL style
}% end of tikzset
\begin{document}
\begin{tikzpicture}[CNTRL, node distance = 5mm and 10mm]
\draw[{Circle[open]}->] (0,0) node[above] {$w$}
node[below] {SP} -- ++ (1,0) node[above left] {$+$}
node (s1) [sum,right];
\draw[->] (s1.east) to["$e$"] ++ (1,0) node (g) [gain, right,
label={[yshift=-3mm]below:Gain}] {$K_c$};
\draw[->] (g.corner 1) -- ++ (1,0) node [above left] {$+$}
node (s2) [sum,right];
\node (m1) [block, label={[name=int]below: Integral},
below right=of s2] {$\dfrac{1}{T_i s +1}$};
\node (d1) [dot, right=of s2 -| m1.east];
\draw (s2) -- (d1);
\draw (d1) to["$u$", "MW" '] ++ (1,0) node (m2) [block,right] {$\dfrac{k_p}{a s^2+b s+1}$};
\draw (m2.east) -- ++ (1,0) node (d2) [dot];
\draw[-{Circle[open]}] (d2) -- ++ (1,0);
% inner loop
\draw[->] (d1) |- (m1);
\draw[->] (m1) -| (s2.south) node[pos=0.25, above] {$u_f$}
node[below left] {$+$};
% outer loop
\coordinate[below=of int] (aux);
\draw[->] (d2) |- (aux) -| (s1.south) node[below left] {$-$};
% fit
\node[draw=teal, dashed, inner sep=2mm, yshift=2mm, fit=(g) (d1) (int)] {};
\end{tikzpicture}
\end{document}
答案2
您可以随时重组和缩放事物以适应......
\documentclass[varwidth,border=3mm]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\ctikzset{blocks/scale=0.5}
\draw (0,0) node[adder] (m) {}
(m.1) to[short,-o] ++(-1,0) node[](sp){};
\draw (m.2) node[below left] {\scriptsize $-$};
\draw (m.1) node[above left] {\scriptsize $+$};
\draw(m.1) node[inputarrow] {};
\ctikzset{ blocks/scale = 1}
\draw (m.3) to[short,>] ++(0.5,0) to[amp, t=$K_c$,l_={\scriptsize Gain},>] ++(1.25,0) node[] (p){};
\ctikzset{ blocks/scale = 0.5}
\draw (p) to[short,>] node[adder, fill=white] (int){} ++(0.75,0) (int.1) node[inputarrow] {};
\ctikzset{ blocks/scale = 1}
\draw (int.3) to[short] ++(2,0) node(ua) {} to[short] ++(0.25,0) to[twoport, l_={\scriptsize Process},
t=\scalebox{0.5}{$k_p/(\begin{array}[t]{@{}c@{}}a s^2\\
+b s\\
+1)\end{array}$},> ] ++(2.25,0) node(pv) {} to[short] ++(0,-2.25) node (a){} to[short] (a -| m.2) to[short,>] (m.2)node[inputarrow,rotate=90]{};
\draw (pv) to[short,*-o] ++(0.5,0) node[] (pv2) {};
\draw (ua) to[short,*-] ++(0,-1) node[] (ua2){} to[twoport,l={\scriptsize Integral}, t=$\frac{1}{T_i s+1}$,>] ++(-2,0) node (uf){} to[short] (ua2 -| int.2) to[short,>] (int.2)node[inputarrow,rotate=90]{};
\draw (int.2) node[below left] {\scriptsize $+$};
\draw (int.1) node[above left] {\scriptsize $+$};
\draw (ua) node[above right]() {\scriptsize \quad $u$} (ua) node[below right]() {\scriptsize\quad MV};
\draw (sp) node[above](){\scriptsize $w$} (sp) node[below](){\scriptsize SP};
\draw (pv2) node[above](){\scriptsize $y$} (pv2) node[below](){\scriptsize PV};
\draw (m.3) node[above right](){\scriptsize $e$};
\draw (uf) node[above](){\scriptsize $u_f$} (pv2);
\draw[dashed, cyan!70!black] (0.55,-2) rectangle ++(4.755,2.75);
\end{circuitikz}
\end{document}
... 但毫无疑问这并不美观。所以恕我直言,真正的问题是您是否真的需要在电路元件中放置如此冗长的表达式。如果您只放置一些易读的字母并使用文本来解释它们的含义,那不是更好吗?