使用 Circuitikz:变压器

使用 Circuitikz:变压器

您能帮我画出变压器的图吗(见下文)?我对图书馆的经验不够circuitikz,但我认为这是最好的方法。

在此处输入图片描述

答案1

如果你不必使用circuitikz,我可以推荐以下内容(这是 Thomas Söll 绘制并发布的变压器的修改版本这里):

% xelatex transformer.tex

\documentclass{article}

\usepackage[
  hmargin=2.4cm,
  vmargin=3cm
]{geometry}
\usepackage[
  figureposition=bottom
]{caption}
\usepackage{pst-solides3d}

% Subscript.
\makeatletter
 \begingroup
  \catcode`\_=\active
  \protected\gdef_{\@ifnextchar|\subtextup\sb}
 \endgroup
\def\subtextup|#1|{\sb{\textup{#1}}}
\AtBeginDocument{\catcode`\_=12 \mathcode`\_=32768}
\makeatother

% Caption setup.
\DeclareCaptionLabelSeparator{tilpasning}{:\quad}
\captionsetup{
  font=small,
  labelfont=sc,
  labelsep=tilpasning,
  width=0.54\textwidth
}

%% Parameters
% Windings
\def\lWind{40}
\def\rWind{80}
% Radii
\def\rHelix{1.13}
\def\rWire{0.004}

% Constants
\def\factor{160} % \factor > \lWind,\rWind
\pstVerb{%
  /left 2 \lWind\space mul \factor\space div def
  /right 2 \rWind\space mul \factor\space div def
}

%% Colours
\colorlet{wireColor}{red!60}
\colorlet{coreColor}{cyan!50}
%% Wire
\newpsobject{wire}{psSolid}{%
  object=courbe,
  ngrid=4365 left mul cvi 5,
  r=\rWire,
  fillcolor=wireColor,
  incolor=wireColor
}

\pagestyle{empty}

\begin{document}

\begin{figure}[htbp]
 \centering
  \begin{pspicture}(-7,-5)(7,5)
   \psset{%
     algebraic,
     solidmemory,
     viewpoint=20 5 10 rtp2xyz,
     lightsrc=20 60 60 rtp2xyz,
     Decran=30,
     grid=false,
     action=none
   }
   %%--------- Core ----------
   \psSolid[object=anneau,h=1.0,R=4,r=2.5,ngrid=4,RotZ=90,RotY=45,RotX=90,
     fillcolor=coreColor,name=core]
   %%--------- Wire ----------
   % Left
   \defFunction{heliceA}(t){\rHelix*cos(\factor*t)}{\rHelix*sin(\factor*t)}{t/left}
   \wire[function=heliceA,range=0 Pi left mul,name=wireA](0,-2.25,-1.5)
   % Right
   \defFunction{heliceB}(t){\rHelix*cos(\factor*t)}{-\rHelix*sin(\factor*t)}{t/right}
   \wire[function=heliceB,range=0 Pi right mul,name=wireB](0,2.25,-1.5)
   %%------- Assembly --------
   \psSolid[object=fusion,base=core wireA wireB,action=draw**]
   %%---- Connecting wire ----
   % Left
   \psline[linewidth=1.5pt](-6.8,2.71)(-3.705,2.71)(-3.705,2.31)
   \psline[linewidth=1.5pt](-6.8,-2.845)(-3.65,-2.845)(-3.65,-2.545)
   \pcline[linewidth=0.5pt]{<->}(-6,2.71)(-6,-2.845)
   \ncput*{\small{$U_|p|$}}
   \uput[315](-6,2.71){\small{$+$}}
   \uput[40](-6,-2.845){\small{$-$}}
   \psline{->}(-6.8,3.01)(-5.5,3.01)
   \uput[0](-5.5,3.01){\small{$I_|p|$}}
   \rput(-1.3,0){\small{$N_|p|$}}
   % Right
   \psline[linewidth=1.5pt](6.8,2.65)(3.48,2.65)(3.48,2.25)
   \psline[linewidth=1.5pt](6.8,-3.0)(3.41,-3)(3.41,-2.7)
   \pcline[linewidth=0.5pt]{<->}(6,2.65)(6,-3)
   \ncput*{\small{$U_|s|$}}
   \uput[225](6,2.65){\small{$+$}}
   \uput[140](6,-3){\small{$-$}}
   \psline{->}(5.5,2.95)(6.8,2.95)
   \uput[180](5.5,2.95){\small{$I_|s|$}}
   \rput(1.3,0){\small{$N_|s|$}}
  \end{pspicture}
 \caption{Transformer with $\lWind$~windings on the primary side and $\rWind$~windings on the secondary side.}
 \label{fig:1}
\end{figure}

\end{document}

在此处输入图片描述

答案2

circuitikz这是一个使用(和一点纯 TikZ)的可能解决方案:

\documentclass{article}
\usepackage{circuitikz}

\begin{document}

\begin{circuitikz} 
\draw
(0,0) node[transformer] (T) {}
node[ocirc] (A) at ([xshift=-1cm]T.A1) {}
node[ocirc] (B) at ([xshift=-1cm]T.A2) {}
node[ocirc] (C) at ([xshift=1cm]T.B1) {}
node[ocirc] (D) at ([xshift=1cm]T.B2) {}
node[circ] (E) at ([xshift=0.4cm,yshift=-5pt]T.A1) {}
node[circ] (F) at ([xshift=-0.4cm,yshift=-5pt]T.B1) {}
(T.A1) to[-o] (A)
(T.A2) to [-o] (B) 
(T.B1) to[-o] (C)
(T.B2) to [-o] (D)
(T.west) node{$L_1$}
(T.east) node{$L_2$}
;
\begin{scope}[shorten >= 10pt,shorten <= 10pt,]
\draw[->] (A) -- node[left] {$u_1(t)$} (B);
\draw[->] (C) -- node[right] {$u_2(t)$} (D);
\draw[<->] ([xshift=7pt]T.north west) to[bend left] node[above] {$M,k$} ([xshift=-7pt]T.north east);
\end{scope}
\draw[->] ([xshift=-0.9cm,yshift=10pt]T.A1) -- node[above] {$i_1(t)$} +(20pt,0);
\draw[->] ([xshift=0.9cm,yshift=10pt]T.B1) -- node[above] {$i_2(t)$} +(-20pt,0);
\end{circuitikz}

\end{document}

在此处输入图片描述

相关内容