[Tex/LaTex] How to produce this circuit on Latex

circuitikztikz-circuit-lib

I have no idea how to do a circuit with "off" itens like the S2 IGBT and diode D1 below. anyone can help me ?

Here is My Code

  \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}

My Result

enter image description here

The Result I desire

Circuit Figure

Best Answer

edit: in the first attemt i upload wrong image and code. now this is corrected :-)

like this:

enter image description here

\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}

addendum:

  • coloring elements in circuitikz is simple. you only need to add option color=<selected color> between element options. for example, IGBT igbt2 in the above example is in the gray color:

    ... node [nigbt,anchor=S,rotate=-90, color=gray] ...
    
  • for coloring complete branches, for example for diode D1 inthe above example, you need this branch draw separately:

     ...     
     \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
     ...  
    
  • a complete example with semiconductor elements in state "on" in red color together with connection lines is shown in example below. its code is a bit different from the above example:

    • branches in circuit are reorganized and divided regarding of their colors
    • styles of the elements are determined globally
    • diode size are determined at begin of the circuit scheme

      \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}
      

result:

enter image description here