circuitikz 中的多路开关

circuitikz 中的多路开关

我想知道 中是否有一种多路开关的符号circuitikz。也就是说,像“spdt”(单刀双掷)这样的开关,但具有更多的切换位置。对于以下电路,我需要九个位置之类的东西。

在此处输入图片描述

答案1

这是一个可能的解决方案,对于重复节点生成和线路连接,foreach使用多个命令。dot为旋转开关定义了一个使用两个参数调用的样式,以便添加内部标签以方便接线。#1 = 位置,#2 = 标签。

在此处输入图片描述

代码

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{shapes,positioning,decorations.markings}
\usepackage{circuitikz}

\begin{document}
\tikzset{dot/.style args={#1#2}{decoration={
  markings,  mark=at position #1 with 
  {\draw[thin,black,fill=white] circle (1pt)coordinate(#2){};}}
  ,preaction={decorate}
  }} 

\begin{circuitikz}
% black dots on the left
\path [postaction={decorate,decoration={markings,
 mark=between positions 0 and 1 step 0.125 with 
{\draw[thin,black,fill=black] circle (1pt);}}}] (0,1) -- (0,-1);

% rotary switch on the right
\foreach \p/\l in{0/1,0.125/2,0.25/3,0.375/4,0.5/5,
0.625/6,0.750/7,0.875/8,0.99/9}{
\path [dot={\p}{a\l}] (1,0.5) to [out=180, in=180,looseness=1.5] (1,-0.5);
}

% pointer
\draw[->,red] (1,0) -- (0.65,0.15);  
\draw (1,0) to[short,*-o] (1.5,0)node(a){};
\draw(-0.5,1)node[below]{\tiny +}to[short,o-] (0,1);

% wires
\foreach \x\y in {1/1,0.75/2,0.5/3,0.25/4,0/5,
-0.25/6,-0.5/7,-0.75/8,-1/9} {
\draw[] (0,\x) --++(0.5,0) -- (a\y);
}
\draw(-0.5,-1)node[below]{\tiny $-$} to[short,o-] (0,-1);


\draw (0,1)--(0,-1);
\foreach \y in {0.875,0.625,0.375,0.125,-0.125,-0.375,-0.625,-0.875}{
\draw[gray] (-2pt,\y)--(2pt,\y);
}

% neutral wire
\draw (0,0) --(-0.8,0) --(-0.8,-1.5) to[short,-o](1.5,-1.5)node(b){};
\draw[->]  (a) --node[right](){\tiny Vac} (b);

% To remove the  overwriting lines
\foreach \p/\l in{0/1,0.125/2,0.25/3,0.375/4,0.5/5,
0.625/6,0.750/7,0.875/8,0.99/9}{
\path [dot={\p}{a\l}] (1,0.5) to [out=180, in=180,looseness=1.5] (1,-0.5);
}

\end{circuitikz}

\end{document}

相关内容