我想在我的某些图纸中加入更直观的升压/降压变压器符号,例如下面的符号:
或“可爱电感”版本:
我尝试做什么此链接建议;复制用于在 pgfcircbipoles.tex 中定义“电感器”的代码类型,即定义一个“long_inductor”以在类似代码中使用,但我不清楚如何将它们组合在一起:
\begin{circuitikz}
\draw (1,5) to[short, o-] (2, 5)
to [long_inductor, l = Primary] (2, 0)
to [short, -o](1,0);
\draw (2.3,5) -- (2.3,0);
\draw (2.4,5) -- (2.4,0);
\draw (4,4) to[short, o-] (3,4)
to [inductor,l = Secondary] (3,1)
to [short, -o](4,1);
\end{circuitikz}
我见过使用的例子普斯特里克,但是我刚刚开始学习 tikz 和 circuitikz,所以此时我更感兴趣的是发现如何使用这些工具......包括定义我自己的形状以供使用。
答案1
线圈的数量也可以配置,也可以在一张图片中配置:
\begin{circuitikz}[]
\begin{scope}
\ctikzset{bipoles/cuteinductor/width/.initial=1.2}%default 0.6
\ctikzset{bipoles/cuteinductor/coils/.initial=10}%default 5
\draw (0, 0) to [short, o-] +(1, 0)
to [cute inductor] +(0, 3)
to [short, -o] +(-1, 0);
\end{scope}
%% vertical bare fore the core. The middle is in y=1.5
\draw[thick] (1.4, 0.5) -- (1.4, 2.5);
\draw[thick] (1.6, 0.5) -- (1.6, 2.5);
%% Secondary
\draw(3, 0) to [short, o-] +(-1, 0)
to [cute inductor] +(0, 3)
to [short, -o] +(1, 0);
%%American inductor version(only working using the most recent gitversion!)
\begin{scope}[xshift=4cm]
\begin{scope}
\ctikzset{bipoles/americaninductor/width/.initial=1.6}%default 0.8
\ctikzset{bipoles/americaninductor/coils/.initial=8}%default 4
\draw(0, 0) to [short, o-] +(1, 0)
to [inductor] +(0, 3)
to [short, -o] +(-1, 0);
\end{scope}
%% vertical bare fore the core. The middle is in y=1.5
\draw[thick] (1.4, 0.5) -- (1.4, 2.5);
\draw[thick] (1.6, 0.5) -- (1.6, 2.5);
%%Secondary
\draw (3, 0) to [short, o-] +(-1, 0)
to [inductor] +(0, 3)
to [short, -o] +(1, 0);
\end{scope}
\end{circuitikz}
在测试这个的时候,我发现了一个错误,因此,美国电感器(不是可爱/卷曲的)的代码只有使用最新的 git 版本或按照此提交调整代码才能工作:https://github.com/circuitikz/circuitikz/commit/1dc2ee4cef798bcd8f9a5fabbaf83f66afeaf0f2
谨致问候,Stefan
答案2
另一种方法是使用装饰物自己制作线圈。然后它们的工作方式与线完全相同,但bumps
第一条和coil
第二条用线绘制。我没有与circuitikz中的线圈进行比较,这可能会在设置中产生一些变化。初级和次级绕组之间的唯一区别是镜像。这也可以通过改变线的方向来实现。
\documentclass[border=1cm]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{circuitikz}[%
line width=1pt,
MyPrimaryBumps/.style={decorate,decoration={bumps,amplitude=10pt,segment length=10mm,mirror}},
MySecondaryBumps/.style={decorate,decoration={bumps,amplitude=10pt,segment length=10mm}},
MyPrimaryCoil/.style={decorate,decoration={coil,amplitude=10pt,segment length=4.8mm,mirror}},
MySecondaryCoil/.style={decorate,decoration={coil,amplitude=10pt,segment length=4.7mm}},
]
\draw[o-] (0,0) -- +(2,0);
\draw[MyPrimaryBumps] (2,0) -- +(0,3.01);
\draw[-o] (2,3) -- +(-2,0);
\draw(2.45,0) -- +(0,3);
\draw(2.54,0) -- +(0,3);
\draw[o-] (5,0.5) -- +(-2,0);
\draw[MySecondaryBumps] (3,0.5) -- +(0,2.01);
\draw[-o] (3,2.5) -- +(2,0);
\begin{scope}[xshift=8cm]
\draw[o-] (0,0) -- +(2,0);
\draw[MyPrimaryCoil] (2,0) -- +(0,3.01);
\draw[-o] (2,3) -- +(-2,0);
\draw(2.45,0) -- +(0,3);
\draw(2.54,0) -- +(0,3);
\draw[o-] (5,0.5) -- +(-2,0);
\draw[MySecondaryCoil] (3,0.5) -- +(0,2.01);
\draw[-o] (3,2.5) -- +(2,0);
\end{scope}
\end{circuitikz}
\end{document}
答案3
我的解决方案是,使用两个inductor
s 2 创建一个更大的线圈。
这是我的 MWE:
\documentclass[12pt]{article}
\usepackage[americaninductors]{circuitikz}
\begin{document}
\begin{circuitikz}
%% left side of the transformer This has two coils to indicate more
%% windings. Use relative coordinates, counting from the startpoint
%% The horizontal width is from y=0 to y=1
\draw
(0, 0) node[inductor] (P) {}
to [short, o-] +(1, 0)
to [inductor] +(0, 1.2)
to [inductor] +(0, 1.2)
to [short, -o] +(-1, 0);
%% vertical bare fore the core. The middle is in y=1.5
\draw (1.4, -0.1) -- (1.4, 2.5);
\draw (1.6, -0.1) -- (1.6, 2.5);
% %% right side of the transformer, being smaller than the first
% side. The width is y=3 to y=2
\draw
(3, 0) node[inductor] (S) {}
to [short, o-] +(-1, 0)
to [inductor, mirror] +(0, 2.5)
to [short, -o] +(1.2, 0);
\end{circuitikz}
\end{document}
结果
我必须承认,我在右侧发射器上使用了选项mirror
,以镜像发射器两侧的线圈。我还尝试mirror
在线圈左侧使用 - 选项,但它使连接线之间的连接变得丑陋。 :-(