从电路中分离出不同的子电路

从电路中分离出不同的子电路

我制作了这个电路,但我想将电路分成不同的子电路,如图所示。我希望通过评论一个子电路,我可以重现其他子电路,即按要求显示电路的不同部分。

在此处输入图片描述

\begin{circuitikz}[american]\draw

    %Inicio de la etapa de potencia
    (15,0) node[npn](Q5){$Q5$}
    (Q5.B) --++ (-1,0) coordinate (B)

    to[R,l_=$R_{17}$,*-*]++(0,3.54) coordinate (B1)% node[vcc](VCC){$+10\volt$}%Activar y desactivar para solo esta etapa
    -| (Q5.C)

    (B) to[C,l=$C_{7}$] ++ (-2,0) coordinate (F)%Desactivar para unir con las demás etapas.

    (B) --++(0,-1.5) coordinate (C) --++(1,0) --++ (0,-0.5) node[npn,anchor=C](Q4){$Q_{4}$}
    (C) --++(-1,0) --++(0,-0.71) node[potentiometershape, rotate=-90,anchor=west,label=south west:$R_{V1}$, font=\large](P){}
    (P.wiper) -| (Q4.B)
    (P.east) --++(0,-0.71) --++ (1,0) coordinate (D)
    (D) -| (Q4.E)

    (Q5.E) to[R, l = $R_{13}$,*-*]++ (0,-2) coordinate (A)
    to[C,l=$C_{5}$] ++ (2,0) to [R,l=$R_{L}$,*-*] ++(0,-2) node[vee](VEE){$-10\volt$}
    (A) to[R,l=$R_{14}$,*-*] ++(0,-2) node[pnp,anchor=E](Q6){$Q_{6}$} ++(0,-2)
    (Q6.B) --++(-1,0) coordinate (E)

    to[R,l=$R_{12}$,*-*] ++(0,-2) coordinate (G)% node[vee](VEE){$-10\volt$}%Activar y desactivar para solo esta etapa
    %
    -| (Q6.C)
    (D) -| (E)
    %Fin de la etapa de potencia


    %Inicio de la etapa de Incursora
    (F) to[R,l=$R_{16}$,*-*]++ (0,-7.54) coordinate (F1) -| (G)
    (F) to[C,l=$C_{4}$,*-*]++(-2,0) coordinate (F2) to[R,l=$R_{10}$,*-*] ++(0,-7.54) coordinate (F3) -| (F1)
    (F) node[pnp,anchor=C](Q3){$Q_{3}$} ++(0,2)
    (Q3.E) to[R,l=$R_{11}$,*-*] ++(0,2) coordinate (F4) -| (B1)
    (Q3.E) --++(1,0) to[C,l_=$C_{6}$,*-*]++(0,2) -| (B1)
    (Q3.B) -| (F2)
    (Q3.B) ++ (-1.16,0) coordinate (G1) to[R,l=$R_{15}$,*-*]++(0,2.77) coordinate (F5) -| (F4)

    (G1) to[C,l=$C_{2}$,*-*]++(-2,0) coordinate (G2)%Desactivar para unir con las demás etapas.

    %(F3) ++(1,0) node[vee](VEE){$-10\volt$}%Activar y desactivar para solo esta etapa
    %(F4) node[vcc](VCC){$+10\volt$}%Activar y desactivar para solo esta etapa
    %Fin de la etapa de Incursora


    %Inicio de la Etapa Diferencial
    (G2) to[R,l=$R_{8}$,*-*]++(0,2.77)  coordinate (H1) -| (F5)
    (G2) --++(0,-0.9) coordinate (H2) to[R,l=$R_{9}$,-*] ++(0,-7.41) coordinate(H3) -| (F3)
    (H2)--++(0,-0.6) coordinate (H4) --++(1,0) to[C,l=$C_{3}$] ++(0,-2) node[vee](VEE){$-10\volt$}
    (H4)--++(-0.5,0) node[npn,anchor=B,xscale=-1, label=left:$Q_{2}$](Q2) {}
    (Q2.E) --++ (0,-0.1) coordinate (I1) to[R,l=$R_{7}$] ++(0,-5.94) coordinate (H5) -| (H3)
    (Q2.C) to[R,l=$R_{6}$] ++(0,3.5) coordinate (H6) -| (H1)
    (I1) ++ (0,-1)to[R,l=$R_{5}$]++(-2,0) coordinate(I2) to[R,l=$R_4$] ++ (0,-4.94) coordinate (J1) -| (H5)
    (I2) --++ (0,1.1) node[npn,anchor=E](Q1){$Q_{1}$}
    (Q1.C) to[R,l=$R_{3}$] ++(0,3.5) coordinate(J2) -| (H6)
    (Q1.B) to[C,l=$C_{1}$] ++(-2,0) to[short,label=$V_{in}$,-o] ++(-0.5,0)
    (Q1.B)  ++ (-0.5,0) to[R,l=$R_{2}$] ++(0,-6.81) -| (J1)
    (Q1.B) ++ (-0.5,0) to[R,l=$R_{1}$] ++ (0,4.27) -| (J2)

    %(J1) ++(1,0) node[vee](VEE){$-10\volt$}%Activar y desactivar para solo esta etapa
    %(J2) ++(1,0) node[vcc](VCC){$+10\volt$}%Activar y desactivar para solo esta etapa
    %Fin de la Etapa Diferencial
;\end{circuitikz} 

答案1

如果我需要独立的人物(比如书中的人物)然后是一个全球性的人物,我会给你一个想法,我该怎么做。

诀窍是在赛道起点处定义主坐标(起点、轨道等)。然后,您可以独立绘制每个阶段,如下例所示:

\documentclass[border=3mm]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}
    % first part. Start at (origin1), rails at VCC, VEE
    \coordinate (origin 1) at (0,0);
    \path (origin 1) ++ (0,4) coordinate(rail +);
    \path (origin 1) ++ (0,-4) coordinate(rail -);
    % drawing the sub circuit 1
    \iffalse
        \draw (origin 1) node[above]{$v_i$} to[short, o-*] ++(0.5,0)
        node[npn, anchor=B](Q1){Q1}
        (Q1.B) to[R] (Q1.B |- rail +) node[vcc]{}
        (Q1.B) to[R] (Q1.B |- rail -) node[vee]{}
        (Q1.C) to[R] (Q1.C |- rail +) node[vcc]{}
        (Q1.E) to[R] (Q1.E |- rail -) node[vee]{}
        (Q1.C) -- ++(1,0) coordinate(out 1);
        \coordinate (origin 2) at (out 1);
    \else
         \coordinate (origin 2) at (0,0);
    \fi
    % ok, now we have first subcircuit drawn.
    % Let's go with the second.
    % drawing the sub circuit 2
    \iftrue
        \draw (origin 2) node[above]{$v_{i_2}$} to[short, o-*] ++(0.5,0)
        node[npn, anchor=B](Q2){Q2}
        (Q2.B) to[R] (Q2.B |- rail +) node[vcc]{}
        (Q2.B) to[R] (Q2.B |- rail -) node[vee]{}
        (Q2.C) to[R] (Q2.C |- rail +) node[vcc]{}
        (Q2.E) to[R] (Q2.E |- rail -) node[vee]{}
        (Q2.C) -- ++(1,0) coordinate(out 2);
    \fi
\end{circuitikz}
\end{document}

如果你按原样编译它,则你将得到:

在此处输入图片描述

将第二个(或第一个)\iftrue转换为\iffalse,得到:

在此处输入图片描述 在此处输入图片描述

请注意,两个阶段不是图形地与连接的相同,但它们是电气相同。

另一种选择是玩颜色(您可以将电路的第一部分scope分组包装并针对每个图形进行更改)。

\documentclass[border=2.7mm]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
    \begin{circuitikz}[scale=0.7, transform shape]
        % first part. Start at (origin1), rails at VCC, VEE
        \coordinate (origin 1) at (0,0);
        \path (origin 1) ++ (0,4) coordinate(rail +);
        \path (origin 1) ++ (0,-4) coordinate(rail -);
        % drawing the sub circuit 1
        \begin{scope}[color=gray!50]
            \draw (origin 1) node[above]{$v_i$} to[short, o-*] ++(0.5,0)
            node[npn, anchor=B](Q1){Q1}
            (Q1.B) to[R] (Q1.B |- rail +) node[vcc]{}
            (Q1.B) to[R] (Q1.B |- rail -) node[vee]{}
            (Q1.C) to[R] (Q1.C |- rail +) node[vcc]{}
            (Q1.E) to[R] (Q1.E |- rail -) node[vee]{}
            (Q1.C) -- ++(1,0) coordinate(out 1);
            \coordinate (origin 2) at (out 1);
        \end{scope}
        % ok, now we have first subcircuit drawn.
        % Let's go with the second.
        % drawing the sub circuit 2
        \begin{scope}[
            % color=gray!50 % uncomment to gray out the second stage
            ]
            \draw (origin 2) node[above]{$v_{i_2}$} to[short, o-*] ++(0.5,0)
            node[npn, anchor=B](Q2){Q2}
            (Q2.B) to[R] (Q2.B |- rail +) node[vcc]{}
            (Q2.B) to[R] (Q2.B |- rail -) node[vee]{}
            (Q2.C) to[R] (Q2.C |- rail +) node[vcc]{}
            (Q2.E) to[R] (Q2.E |- rail -) node[vee]{}
            (Q2.C) -- ++(1,0) coordinate(out 2);
        \end{scope}
    \end{circuitikz}
\end{document}

在此处输入图片描述

最后,这个解决方案(或多或少)与 beamer 完美配合:

\documentclass{beamer}
\usepackage[siunitx, RPvoltages]{circuitikz}
\tikzset{% see https://tex.stackexchange.com/q/84513/38080
    invisible/.style={color=gray!50},
    visible on/.style={alt=#1{}{invisible}},
    alt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
    },
  }\begin{document}
\begin{frame}
    \begin{circuitikz}[scale=0.7, transform shape]
        % first part. Start at (origin1), rails at VCC, VEE
        \coordinate (origin 1) at (0,0);
        \path (origin 1) ++ (0,4) coordinate(rail +);
        \path (origin 1) ++ (0,-4) coordinate(rail -);
        % drawing the sub circuit 1
        \begin{scope}[visible on=<{2,4-}>]
                \draw (origin 1) node[above]{$v_i$} to[short, o-*] ++(0.5,0)
                node[npn, anchor=B](Q1){Q1}
                (Q1.B) to[R] (Q1.B |- rail +) node[vcc]{}
                (Q1.B) to[R] (Q1.B |- rail -) node[vee]{}
                (Q1.C) to[R] (Q1.C |- rail +) node[vcc]{}
                (Q1.E) to[R] (Q1.E |- rail -) node[vee]{}
                (Q1.C) -- ++(1,0) coordinate(out 1);
                \coordinate (origin 2) at (out 1);
            \end{scope}
        % ok, now we have first subcircuit drawn.
        % Let's go with the second.
        % drawing the sub circuit 2
            \begin{scope}[visible on=<3->]
                \draw (origin 2) node[above]{$v_{i_2}$} to[short, o-*] ++(0.5,0)
                node[npn, anchor=B](Q2){Q2}
                (Q2.B) to[R] (Q2.B |- rail +) node[vcc]{}
                (Q2.B) to[R] (Q2.B |- rail -) node[vee]{}
                (Q2.C) to[R] (Q2.C |- rail +) node[vcc]{}
                (Q2.E) to[R] (Q2.E |- rail -) node[vee]{}
                (Q2.C) -- ++(1,0) coordinate(out 2);
            \end{scope}
    \end{circuitikz}
\end{frame}
\end{document}

在此处输入图片描述

答案2

\documentclass{standalone}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{pgfplots}
\usepackage{siunitx}


\newcommand{\volt}{\si{\volt}}
\newcommand{\amp}{\si{\amp}}
\newcommand{\ohm}{\si{\ohm}}
\newcommand{\watt}{\si{\watt}}

\ctikzset{%
monopoles/vcc/arrow={Triangle[width=0.8*\scaledwidth, length=\scaledwidth]},
monopoles/vee/arrow={Triangle[width=6pt, length=8pt]},
resistors/thickness=3,
}


\begin{document}
\ctikzsubcircuitdef{power}{in 1,in 3,in 2}{
    coordinate (#1-in 1) to[R,l=$R_{17}$,*-*] ++(0,-4.50) coordinate (#1-in 3)
    (#1-in 3) --++(1.5,0) node[npn,anchor=B](Q5){$Q_{5}$}
    (#1-in 1) -| (Q5.C)
    (Q5.E) to[R,l=$R_{13}$,*-*] ++(0,-2) coordinate (A) to[C,l_=$C_{5}$] ++(2,0) to[R,l=$R_{L}$,*-*] ++(0,-2) node[vee](VEE){$-10\volt$}
    (A) to[R,l=$R_{14}$,*-*] ++(0,-2) node[pnp, anchor=E](Q6){$Q_{6}$}
    (#1-in 3) --++(0,-1.5) coordinate(A1) --++(1,0) --++ (0,-0.5) node[npn,anchor=C](Q4){$Q_{4}$}
    (Q4.E) --++(0,-0.5) --++(-1,0) coordinate(A2)
    (A1) --++(-1,0) --++(0,-0.71) node[potentiometershape, rotate=-90,anchor=west,label=south west:$R_{V1}$, font=\large](P){}
    (P.wiper) -| (Q4.B)
    (P.east) --++(0,-0.71) -| (A2)
    (A2) --++(0,-1.5) coordinate (A3) -| (Q6.B)
    (A3) to[R,l=$R_{12}$,*-] ++(0,-2) coordinate (#1-in 2)
    (Q6.C) --++(0,-1.5) -| (#1-in 2)
}

\ctikzsubcircuitdef{incursora}{in 1, in 2, in 3, out 1, out 2, out 3}{
coordinate (#1-in 3) --++(0.5,0) node[pnp, anchor=B](Q3){$Q_{3}$}
(#1-in 3) to[R,l=$R_{15}$,*-*] ++(0,3.23) coordinate (#1-in 1)
(#1-in 3) --++(0,-1.27) coordinate (B1) to[R,l=$R_{10}$,*-*] ++(0,-7.81) coordinate (#1-in 2)
(Q3.E) to[R,l=$R_{11}$,*-*] ++(0,2.46) coordinate (B3)
(Q3.E) --++(1.5,0) to[C,l=$C_{6}$,*-*] ++(0,2.46) coordinate (#1-out 1) --(B3) -| (#1-in 1)
(Q3.C) --++(0,-0.5) coordinate (#1-out 3) to[R,l=$R_{16}$,*-*] ++(0,-7.81) coordinate (#1-out 2) -| (#1-in 2)
(B1) --++(0.4,0) to[C,l=$C_{4}$] ++(0.5,0) -| (#1-out 3)
}

\ctikzsubcircuitdef{diferential}{in 1,out 1, out 2,out 3}{
    coordinate (#1-in 1) --++(1,0) node[npn, anchor=B](Q1){$Q_{1}$}
    (Q1.C) --++(0,1) coordinate (#1-out 3) to[R,l=$R_{3}$,*-] ++(0,2) coordinate (C)
    (Q1.E) to[R,l=$R_{4}$,*-] ++(0,-6) coordinate (C2)
    (#1-in 1) to[R,l=$R_{1}$,*-*] ++(0,5) -| (C)
    (#1-in 1) to[R,l=$R_{2}$,*-*] ++(0,-7.31) -| (C2)
    (Q1.E) to[R,l_=$R_{5}$,*-*] ++(2.5,0) coordinate (C3) to[R,l=$R_{7}$,*-*] ++(0,-6.54) coordinate (C6) -| (C2)
    (C3) node[npn,xscale=-1, anchor=E,label=left:$Q_{2}$](Q2){} ++(0,1.5)
    (Q2.C) to[R,l=$R_{6}$,*-*] ++(0,4.23) coordinate (C4) -| (C)
    (Q2.B) --++(0.5,0) coordinate (C5) to[R,l=$R_{9}$,*-*] ++(0,-7.31) coordinate (#1-out 2) -| (C6)
    (C5) to[R,l=$R_{8}$,*-*] ++(0,5) coordinate (#1-out 1) -| (C4)
    (C5) --++(1,0) to[C,l=$C_{3}$,*-*] ++(0,-2) node[vee](VEE){$-10\volt$}
}
\ctikzsubcircuitactivate{power}
\ctikzsubcircuitactivate{incursora}
\ctikzsubcircuitactivate{diferential}

\begin{circuitikz}\draw
    (0,0)\incursora{incur}{out 3} to[C,l=$C_{7}$,*-*]++(3,0) \power{power}{in 3}
    (incur-out 1) -| (power-in 1)
    (incur-out 2) -| (power-in 2)
    (incur-in 3) to[C,l=$C_{2}$,*-*]++(-6,0) \diferential{dif}{out 3}
    (incur-in 1) -| (dif-out 1)
    (incur-in 2) -| (dif-out 2)
    (dif-in 1) to[C,l=$C_{1}$,*-*] ++(-2,0) to[short,-o, label=$V_{in}$] ++(-0.5,0)
;\end{circuitikz}
\end{document} 

相关内容