我需要在电路中画一个表示电流方向的箭头。有人能帮我吗?
我的代码:
\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}
我的结果
我想要的结果
答案1
根据我的回答:
\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}
答案2
抱歉,我不太想安装软件包并测试它,但我认为这会起作用,只需添加这行代码并更改起始和结束坐标以将其带到您想要的位置(坐标可能非常偏离,因为我不知道点在哪里,因为我从未使用过 tikzcircuit)。
\draw[-latex] (0.5,1.5) -- node[above=1mm] {Power Flow Direction} (1, 1.5);
如果它不起作用,请见谅。另外,我的序言中有很多东西,我忘了哪个是哪个,但这里是所有我认为可能与绘制箭头相关的 tikz 内容。所以基本上把这个添加到序言中
\usetikzlibrary{arrows,shapes,positioning,calc}
\usetikzlibrary{decorations.markings}