1

I need to draw a arrow with power flow direction in my circuit. Anyone can help me ?

My Code:

\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,color=red]  (igbt1) {}
        (igbt1.S)    to [short,-*]               ++  (0,-0.5)    coordinate (T1-)
        %% tinha uma linha aqui
        (T1+)       -- ++  (0.5,0)
        node [nigbt,anchor=S,rotate=-90,color=gray]  (igbt2) {}
        (igbt2.D)   to [short, -*]               ++  (0.5,0)     coordinate (C+)
        to [C,f>^=$i_{C}$,l^=$C_{DC}$,*-*]  (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[red]
        (igbt1.G)   to[short,red] ++ (0,-0.5) node[below,red] {$S_1$};

        \ctikzset{bipoles/length=6mm}
        \draw       (igbt2.S) [red] -- ++ (0,-0.3) coordinate (D2)
        to [Do,a=D2,color = red] (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}

My Result

My result


The result I want

enter image description here

3
  • 1
    You only need to add \draw[thick,-latex] (0.2,1.25) -- ++(5,0) node[midway,above]{Power flow direction}; in the circuitikz environment.
    – user121799
    Jul 17, 2018 at 11:39
  • @marmot how can I change the arrow direction ? I tryid \draw[thick,-latex] (5,1.25)++ --(-0.2,1.25) node[midway,above]{Direção do Fluxo de Potência}; Works, but shows an error
    – SrnLord
    Jul 17, 2018 at 12:42
  • Just remove the ++ before --.
    – user121799
    Jul 17, 2018 at 13:23

2 Answers 2

3

based on my answer:

\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 [short,o-*]  ++ (1,0)                    coordinate (C1+)
            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
(C1+)       to [C,a=$C_1$,*-*]  (C1+ |- T1-)            % added capacitor C1
(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 (C2+);
\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,-*]       (C2+);                  % red line from IGBT to C
\draw % black again
(C2+)       to [C,a=$C_2$]      (C2+ |- T1-)
(C2+)       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
% added power flow
\path[draw=gray,ultra thick,-Triangle]                      
    ($(0,11mm)+(C1+)$) -- node[above] {Power flow direction} ($(0,11mm)+(C2+)$);
    \end{circuitikz}
\end{document}

enter image description here

1

Sorry I'm not quite bothered to install the packages and test it out but I think this would work, just add this line of code and change the starting and ending coordinates to get it to where you want it to be (the coordinates are probably very off because I don't know where the points are because I've never used a tikzcircuit).

\draw[-latex] (0.5,1.5) -- node[above=1mm] {Power Flow Direction} (1, 1.5);

Sorry if it doesn't work. Also I have a bunch of stuff I have in my preamble and I forgot which one is for which but here is all the tikz stuff I think might be related to drawing an arrow. So basically ad this to preamble

\usetikzlibrary{arrows,shapes,positioning,calc}
\usetikzlibrary{decorations.markings}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .