我怎样才能在 Latex 上制作这个电路?

我怎样才能在 Latex 上制作这个电路?

我不知道如何制作带有“关闭”项的电路,例如下面的 S2 IGBT 和二极管 D1。有人能帮帮我吗?

这是我的代码

  \documentclass[border=3mm]{standalone}
\usepackage[siunitx,american]{circuitikz}
\usetikzlibrary{arrows.meta}
\tikzset{
    every pin/.style = {pin distance=7mm, inner sep=1pt, text=teal,
        pin edge={teal, line width=2pt, shorten <=-2pt, 
            {Triangle Cap[]}-{Circle[open,line width=1pt,length=1.6mm]}}
    },
}
\ctikzset{resistor = european} %Definição de uso do resitor europeu


\begin{document}
    \begin{circuitikz}[american voltages,scale=1.25][european resistors]

        \draw
        (0,3) to[open,-*, l_=$V_{1}$] (0,0) %% Criação da Fonte
        ;  %% Finalizando plotagem da fonte


        \draw 
        (0,3) to[L, *-, l^=$L$, f^=$i_{L}$] (3,3) coordinate (Qpos) % conectando um indutor do ponto 0,2 até o 3,2 (Tamanho3)
        (5,3) coordinate (Qpos1)
        (7,3) coordinate (Qpos2)

        (Qpos)++(0,-3)
        to[Tnigbt, bodydiode] ++(0,3)

        (Qpos)        
        to[Tnigbt,bodydiode] ++(3,0)

        (Qpos1)++(1,-3)
        to[C, -,f_<=$i_{C}$,l^=$C_{DC}$] ++(0,3) coordinate (LMpos)

        (Qpos2)++(0.5,-3) coordinate (Rpos)
        to[open,*-*,l_=$V_{2}$] ++(0,3) -- (LMpos) %Se usado o Parametro V<= teriamos o + e - da tensão. Ao contrário disso foi usado l de label

        (Rpos) --(0,0)  
        (3.8,1.5) node[align=center]{$D_1$}
        (2.1,1.5) node[align=center]{$G_1$}
        (4.55,3.8) node[align=center]{$G_2$}
        (4.55,2.4) node[align=center]{$D_2$}
        (0,0) to[short,-*] (3,0)

        ;

    \end{circuitikz}
\end{document}

我的结果

在此处输入图片描述

我想要的结果

电路图

答案1

编辑:第一次尝试时我上传了错误的图片和代码。现在已更正:-)

像这样:

在此处输入图片描述

\documentclass[border=3mm]{standalone}
\usepackage[siunitx,american]{circuitikz}
\usetikzlibrary{arrows.meta,
                decorations.pathreplacing,
                }
\ctikzset{resistor = european} %Definição de uso do resitor europeu
\tikzset{B/.style = {decorate,   % added
            decoration={brace, amplitude=5pt,
            raise=3pt, mirror},thick},
        }

\begin{document}
    \begin{circuitikz}[
american voltages,scale=1.25][european resistors]
\draw
    (0,0)                                                   coordinate (in+)
                to [L=$L$, f^=$i_{L}$,o-*]  ++  (2,0)       coordinate (T1+)
                -- ++  (0,-0.5)
                node [nigbt,anchor=D]  (igbt1) {}
    (igbt1.G)   -- ++ (0,-0.5) node[below] {$S_1$}
    (igbt1.G)   -- ++ (0,-0.5) node[below] {$S_1$}
    (igbt1.S)   to [short,-*]               ++  (0,-0.5)    coordinate (T1-)
    (T1+)       -- ++  (0.5,0)
                node [nigbt,anchor=S,rotate=-90,color=gray]  (igbt2) {}
    (igbt2.D)   to [short, -*]               ++  (0.5,0)     coordinate (C+)
                to [C,a=$C_{DC}$,f=$i_{C}$,*-*]  (C+ |- T1-)
    (C+)        to [short, -o]               ++  (1.0,0)    coordinate (out+)
    (out+ |- T1-)                                           coordinate (out-)
    (in+ |- out-)                                           coordinate (in-)
    (in-)       to [short,o-]   (T1-)
                to [short,-o]   (out-);
\ctikzset{bipoles/length=6mm}
\draw       (igbt2.S)   -- ++ (0,-0.3) coordinate (D2)
                        to [Do,a=D2] (D2 -| igbt2.D) -- (igbt2.D);
\draw[gray] (igbt2.G) -- ++ (-0.5,0) node[left,gray] {$S_2$}
            (igbt1.S) -- ++ (0.3,0)  coordinate (D1)
                      to [Do,a=D1,color=gray] (D1 |- igbt1.D) -- (igbt1.D);
\draw[B]    (in+)  -- node[ left=5pt] {$V_1$} (in-);
\draw[B]    (out-) -- node[right=5pt] {$V_2$} (out+);
    \end{circuitikz}
\end{document}

附录:

  • 给元素着色circuitikz很简单,只需要color=<selected color>在元素选项之间添加选项即可,例如igbt2上例中的IGBT是灰色的:

    ... node [nigbt,anchor=S,rotate=-90, color=gray] ...
    
  • 为了给完整的分支着色,例如上例中的二极管 D1,需要单独绘制此分支:

     ...     
     \draw[gray] 
     (igbt2.G) -- ++ (-0.5,0) node[left,gray] {$S_2$}% node with IGBT control input, in gray color
     (igbt1.S) -- ++ (0.3,0)  coordinate (D1)                
               to [Do,a=D1,color=gray] (D1 |- igbt1.D) 
               -- (igbt1.D);                         % diode at igbt2 in gray color
     ...  
    
  • 下面的示例显示了一个完整的示例,其中半导体元件处于“开”状态(红色),并带有连接线。其代码与上面的例子略有不同:

    • 电路中的分支根据其颜色进行重新组织和划分
    • 元素的样式是全局确定的
    • 二极管尺寸在电路方案开始时就确定

      \documentclass[margin=3mm]{standalone}
      \usepackage[siunitx,american]{circuitikz}
      \usetikzlibrary{arrows.meta,
                      calc,
                      decorations.pathreplacing,
                      }
      \ctikzset{resistor = european,  %Definição de uso do resitor europeu
                voltage = american}
      \tikzset{B/.style = {decorate,
                  decoration={brace, amplitude=5pt,
                  raise=3pt, mirror},thick},
              }
      
      \begin{document}
          \begin{circuitikz}[scale=1.25],
      \ctikzset{bipoles/diode/height=0.25,bipoles/diode/width=0.25}
      \draw
      (0,0)                                                   coordinate (in+)
                  to [L=$L$, f^=$i_{L}$,o-]  ++  (2,0)        coordinate (T1+);
      \draw[red]                                                  % branch in red color
      (T1+)       to [short,*-] ++  (0,-0.5)
                  node [nigbt,anchor=D, color=red]  (igbt1) {}    % IGBT as node, in red color
      (igbt1.G)   -- ++ (0,-0.5) node[below] {$S_1$}              % node with IGBT control input
      (igbt1.S)   to [short,-*]               ++  (0,-0.5)    coordinate (T1-);
      \draw % black again
      (T1+)       ++  (0.5,0)                                 % no line to IGBT
                  node [nigbt,anchor=S,
                        rotate=-90,color=gray]  (igbt2) {}    % IGBT as node, in gray color
      (igbt2.D)   ++  (0.5,0)                                 coordinate (C+);
      \draw[red]
      (T1+)       to[short,*-]              (igbt2.S)         % red line to IGBT
                  -- ++ (0,-0.3) coordinate (D2)              % red line to diode
                  to [Do,a=D2,color=red] (D2 -| igbt2.D)      % diode, in red color
                  -- (igbt2.D)                                % red line to IOGBT
                  to [short,-*] (C+);                         % red line from IGBT to C
      \draw % black again
      (C+)        to [C,a=$C_{DC}$,f>^=$i_{C}$,*-*]  (C+ |- T1-)
      (C+)        to [short, -o]               ++  (1.0,0)    coordinate (out+)
      (out+ |- T1-)                                           coordinate (out-)
      (in+ |- out-)                                           coordinate (in-)
      (in-)       to [short,o-]   (T1-)
                  to [short,-o]   (out-);
      %
      \draw[gray] (igbt2.G) -- ++ (-0.5,0) node[left,gray] {$S_2$}% node with IGBT control input, in gray color
                  (igbt1.S) -- ++ (0.3,0)  coordinate (D1)
                            to [Do,a=D1,color=gray] (D1 |- igbt1.D)
                            -- (igbt1.D);                         % diode at igbt2 in gray color
      %
      \draw[B]    (in+)  -- node[ left=5pt] {$V_1$} (in-);        % curly brace indicated input
      \draw[B]    (out-) -- node[right=5pt] {$V_2$} (out+);       % curly brace indicated output
          \end{circuitikz}
      \end{document}
      

结果:

在此处输入图片描述

相关内容