我想使用 circuitikz 在 Latex 中实现这个变压器模型。我可以绘制变压器、电阻器和电感器等基本元件。但我无法放置带标签的箭头、带标签的圆形箭头以及理想变压器块周围的虚线。我不是这个工具的专家。请帮助我。非常感谢。
这是我使用的代码,当我编译它时,由于所有变量相互重叠,输出看起来有点混乱。有人可以把它拿开并美化一下,使它与上图相匹配吗?
\begin{figure}[h!]
\label{fig:tfmodel}
\begin{circuitikz}[european]
\draw (0,0)
to[short,o-*] (1,0) node[anchor=south]{$K_1$}
to[R, l^=$R_{p}$, v_>=$U_{R_{p}} I_{R_{p}}$, *-*] (3.5,0) node[anchor=south]{$K_2$}
to[L, l^=$L_{p_{sf}}$, v_>=$U_{L_{p_{sf}}} I_{L_{p_{sf}}}$, *-*] (6,0) node[anchor=south]{$K_3$}
to[short] (8.5,0)
(9.5,0) node[transformer core] (T) {} (T.B1) node[anchor=south]{$K_5$}
to[R, l^=$R_{s}$, v_>=$U_{R_{s}} I_{R_{s}}$, *-*] (12.5,0) node[anchor=south]{$K_6$}
to[L, l^=$L_{s_{sf}}$, v_>=$U_{L_{s_{sf}}} I_{L_{s_{sf}}}$, *-*] (15,0) node[anchor=south]{$K_7$}
to [short,-o] (15.5,0)
(6,0) to[R, l^=$R_{p}$, v_>=$U_{R_{p}} I_{R_{p}}$, *-*] (6,0|-T.A2)
(6,0|-T.A2) to [short] (7.5,0|-T.A2)
(7.5,0) to [L, l^=$L_{p}$, v_>=$U_{L_{p}} I_{L_{p}}$] (7.5,0|-T.A2)
(7.5,0|-T.A2) -- (T.A2)
(0,0|-T.A2) to [short, o-*] (6,0|-T.A2)
(T.B2) to [short, -o] (15.5,0|-T.B2);
\draw[dashed] ($(T.south west)+(.2,.2)$) rectangle ($(T.north east)+(-.2,-.2)$)
;\end{circuitikz}
\caption{Transformer model}
\end{figure}
答案1
以下是一些比较困难的特征。
\documentclass[border=2pt]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{calc}
\begin{document}
\begin{circuitikz}[european]
\draw (0,0) node[above] {$\textrm{K}_1$}
to[R,l=$R_p$,v=\mbox{$U_{R_p},L_{R_p}$},*-*] (2,0);% \mbox hides the comma from the parser
% Transformer
\node (T) [transformer] at (1,-1) {};
\draw[dashed] ($(T.south west)+(.2,.2)$) rectangle ($(T.north east)+(-.2,-.2)$);
% Loop current.
\node (loop1) at (3,0) {$\textrm{M}_1 +$};
\draw[->] (loop1.west) arc[start angle=180, end angle=-90, radius=.5];
% It is possible to calculate the radius precisely using \pdfextractx
\end{circuitikz}
\end{document}
答案2
经过多次尝试,我终于能够完成代码。非常感谢 John Kormylo 的建议。它们真的帮了我大忙。以下是所有更改后的代码和输出。有些人以后可能会发现它很有用。
\documentclass{article}
\usepackage{graphicx}
\usepackage{circuitikz}
\usetikzlibrary{calc}
\begin{document}
\begin{figure}[htbp]
\label{fig:tfmodel}
\begin{flushleft}
\hspace*{-1.5cm}
\begin{circuitikz}[european]
\draw (0,0)
to[short,o-*] (1,0) node[anchor=south]{$K_1$}
to[R, l^=\rmfamily\tiny$R_{p}$, *-*] (3.1,0) node[anchor=south]{$K_2$}
to[L, l^=\rmfamily\tiny$L_{p_{sf}}$, *-] (5,0)
to [short] (6,0) node[anchor=south]{$K_3$}
to[short] (8.5,0)
(9.5,0) node[transformer core] (T) {} (T.B1) node[anchor=south]{$K_5$}
to[R, l^=\rmfamily\tiny$R_{s}$,*-*] (12.5,0) node[anchor=south]{$K_6$}
to[L, l^=\rmfamily\tiny$L_{s_{sf}}$, *-*] (15,0) node[anchor=south]{$K_7$}
to [short,-o] (15.5,0)
(6,0) to[R, *-*] (6,0|-T.A2) node[below]{$K_4$}
(6,0|-T.A2) to [short] (7.5,0|-T.A2)
(7.5,0) to [L] (7.5,0|-T.A2)
(7.5,0|-T.A2) -- (T.A2)
(0,0|-T.A2) to [short, o-*] (6,0|-T.A2)
(T.B2) to [short, -o] (15.5,0|-T.B2);
\node (loop1) at (3.5,-1.3) {\rmfamily\tiny $M_{1} +$};
\draw[->,blue] (loop1.west) arc[start angle=180, end angle=-90, radius=.35];
\node (loop4) at (12.5,-1.3) {\rmfamily\tiny $M_{4} +$};
\draw[->,blue] (loop4.west) arc[start angle=180, end angle=-90, radius=.35];
\node (loop2) at (6.75,-1.6) {\rmfamily\tiny $M_{2} +$};
\draw[->,blue] (loop2.west) arc[start angle=180, end angle=-90, radius=.35];
\node (loop3) at (8.0,-0.4) {\rmfamily\tiny $M_{3} +$};
\draw[->,blue] (loop3.west) arc[start angle=180, end angle=-90, radius=.35];
\draw[-latex,blue] ($(T.south west)+(.35,1.6)$) -- ($(T.south west)+(.35,.45)$);
\node(y1) at (8.6,-0.6){\rmfamily\tiny$N_{p}$};
\node(y2) at (8.6,-0.9){\rmfamily\tiny$U_{p}$};
\node(y3) at (8.6,-1.2){\rmfamily\tiny$I_{p}$};
\draw[-latex,blue] ($(T.north east)+(-.35,-.5)$) -- ($(T.north east)+(-.35,-1.6)$);
\node(y1) at (10.4,-0.6){\rmfamily\tiny$N_{s}$};
\node(y2) at (10.4,-0.9){\rmfamily\tiny$U_{s}$};
\node(y3) at (10.4,-1.2){\rmfamily\tiny$I_{s}$};
\draw[-latex,blue] (1.5,-0.35) -- (2.6,-.35) node[below,midway] {\rmfamily\tiny\color{black} {$U_{R_{p},} I_{R_{p}}$}};
\draw[-latex,blue] (3.5,-0.35) -- (4.6,-.35) node[below,midway] {\rmfamily\tiny\color{black} {$U_{L_{p_{sf}},} I_{L_{p_{sf}}}$}};
\draw[-latex,blue] (5.7,-0.5) -- (5.7,-1.6) node[left,pos=0.5] {\rmfamily\tiny\color{black} {$U_{R_{ml}} $}};
\node(y1) at (5.25,-1.3){\rmfamily\tiny$I_{R_{ml}}$};
\node(y1) at (5.7,-0.3){\rmfamily\tiny$R_{ml}$};
\draw[-latex,blue] (7.2,-0.5) -- (7.2,-1.6) node[left,pos=0.1] {\rmfamily\tiny\color{black} {$U_{L_{p}} $}};
\node(y1) at (6.9,-0.9){\rmfamily\tiny$I_{L_{p}}$};
\node(y1) at (7.3,-0.3){\rmfamily\tiny$L_{p}$};
\draw[-latex,blue] (11,-0.35) -- (12.1,-.35) node[below,midway] {\rmfamily\tiny\color{black} {$U_{R_{s},} I_{R_{s}}$}};
\draw[-latex,blue] (13.2,-0.35) -- (14.3,-.35) node[below,midway] {\rmfamily\tiny\color{black} {$U_{L_{s_{sf}},} I_{L_{s_{sf}}}$}};
\draw[-latex,blue] (-0.75,0) -- (-0.1,0) node[above,midway] {\rmfamily\tiny\color{black} {$I_{in}$}};
\draw[-latex,blue] (-0.1,0|-T.A2) -- (-0.75,0|-T.A2) node[below,midway] {\rmfamily\tiny\color{black} {$I_{in}$}};
\draw[-latex,blue] (0,-0.15) -- (0,-2) node[left,midway] {\rmfamily\tiny\color{black} {$U_{in}$}};
\draw[-latex,blue] (15.6,0) -- (16.25,0) node[above,midway] {\rmfamily\tiny\color{black} {$I_{out}$}};
\draw[-latex,blue] (16.25,0|-T.B2) -- (15.6,0|-T.B2) node[below,midway] {\rmfamily\tiny\color{black} {$I_{out}$}};
\draw[-latex,blue] (15.5,-0.15) -- (15.5,-2) node[left,midway] {\rmfamily\tiny\color{black} {$U_{out}$}};
\draw[dashed,blue] ($(T.south west)+(-.1,-.5)$) rectangle ($(T.north east)+(.1,-.2)$);
\node at ($(T.south west)+(1.05,-.5)$) [above,blue] {\rmfamily\tiny\textit{Ideal Transformer} };
\node(g) at (9.5,-1.8){\rmfamily$\gamma$}
;\end{circuitikz}
\end{flushleft}
\caption{Transformer model}
\end{figure}
\end{document}