# Some help with connections and voltage arrow in CircuitikZ

Good evening,

in the following drawing I added two diodes on the secondary side. Three questions:

1. As you can see, I placed D1 first and went from there to D2, inverting D3. I did the same starting from the transformer with the lower part. How do I know connect the transformer terminal B2 to the wire between D3 and D4?
2. My added voltage arrow is not placed very well. It needs to go on the right with a little space added. Also it needs to be clear, that it points from the node c1 to node c2. Is there a way to improve this?

Thank you very much. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[siunitx,european,fetbodydiode,smartlabels]{circuitikz} \usetikzlibrary{positioning} \begin{document}

\begin{figure}   % Generalized diagram of different components inside an AC drive with voltage intermediate circuit % Based on a template by % Author: Erno Pentzin (2013), http://www.texample.net/tikz/examples/ac-drive-components/

\begin{circuitikz}
\draw
% top part of switch legs
(0,0) coordinate[label=above:s1] (s1)
to ++ (0,-0.4)
node (mosfet1) [nigfete,below,anchor=D] {$Q_1$}
(mosfet1) node (mosfet3) [nigfete,right=22mm]     {$Q_3$}
(mosfet1.S) to [short,-*] ++ (0,-0.4)           coordinate[label=above:t1] (t1)

% transformer       (t1 -| mosfet3.S) % Connect Q1 with Q3S which is electrically wrong, but easier to draw
node (T) [transformer core,below right=0mm and 11mm]{}

% bottom part of switch legs
(mosfet3.S |- T.A2)                             coordinate (t2)  % likewase counter intuitive
to ++ (0,-0.4)
node (mosfet4) [nigfete,below,anchor=D] {$Q_4$}
(t1 |- mosfet4.D)   node (mosfet2) [nigfete,below,anchor=D] {$Q_2$}

% connection lines origins at transformer
(T.A1) to                       (t1)
(T.A2) to [short,-*]            (t2)
(T.B1) to [short,-o]                ++ (0.5,0)  coordinate (t3)
(T.B2) to [short,-o]                ++ (0.5,0)  coordinate (t4)
(t3)   to[open, v^=$v_o(t)$]    (t4)

% connection lines orign at mosfet
(t1)        to      (mosfet2.D)
(mosfet2.S) to ++   (0,-0.4)                    coordinate[label=below:s2] (s2)
(mosfet3.D) to ++   (0, 0.4)                    coordinate[label=above:s3] (s3)
(mosfet3.S) to      (mosfet4.D)
(mosfet4.S) to ++   (0,-0.4)                    coordinate (s4)

% supply lines
(s3) -- (s1) to [short,*-o] ++ (-2,0)           coordinate (s+) % added *-o, * to get dot at S1
(s4) -- (s2) to [short,*-o] ++ (-2,0)           coordinate (s-) % added *-o, * to get dot at S2
(s+) to [open, v=60<\volt>, invert] (s-)

% secondary side
(t3) to [Do,name=d1,label=D1] ++(0,1.5) --++(1.5,0)               coordinate[label=above:c1] (c1)
(c1) to [Do,invert,name=d3,label=$D3$] ++(0,-1.5)

(t4) to [Do,invert,name=d2,label=D2] ++(0,-1.5) --++(1.5,0)     coordinate[label=below:c2] (c2)
(c2) to [Do,name=d4,label=D4] ++(0,1.5) -- (d3)
(d2) -- (d1)
(t4) -- (d4)
(c1) to [open, v=60<\volt>, invert] (c2)
;
\end{circuitikz}
\caption[Ersatzschaltbild]{Ersatzschaltbild}
\label{fig:ersatzschaltbild}
\end{figure}
\end{document}


let me continue where i stop in answer on your previous question: \documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[siunitx,european,fetbodydiode]{circuitikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{figure}
\begin{circuitikz}[
lbl/.style = {label={[label distance=4mm]above right:#1}} % <-- added
]
\draw
% top part of switch legs
(0,0)                                           coordinate (s1)
to              ++ (0,-0.4)
node (mosfet1) [nigfete,below,anchor=D,lbl=$Q_1$] {}
(mosfet1)           node (mosfet3) [nigfete,right=12mm,lbl=$Q_3$]     {}
(mosfet1.S)         to [short,-*]   ++ (0,-0.4) coordinate (t1)
% transformer
(t1 -| mosfet3.S)   node (T) [transformer core,below right=0mm and 5mm]{}
% bottom part of switch legs
(mosfet3.S |- T.A2)                             coordinate (t2)
to              ++ (0,-0.4)
node (mosfet4) [nigfete,below,anchor=D,lbl=$Q_4$] {}
(t1 |- mosfet4.D)   node (mosfet2) [nigfete,below,anchor=D,lbl=$Q_2$] {}
% connection lines origins at transformer
(T.A1) to                       (t1)
(T.A2) to [short,-*]            (t2)
(T.B1) to [short,-o]                ++ (0.1,0)  coordinate (t3)
(T.B2) to [short,-o]                ++ (0.1,0)  coordinate (t4)
(t3)   to[open, v^=$v_o(t)$]    (t4)
% connection lines orign at mosfet
(t1)        to      (mosfet2.D)
(mosfet2.S) to ++   (0,-0.4)                    coordinate (s2)
(mosfet3.D) to ++   (0, 0.4)                    coordinate (s3)
(mosfet3.S) to      (mosfet4.D)
(mosfet4.S) to ++   (0,-0.4)                    coordinate (s4)
% supply lines
(s3) -- (s1) to [short,-o]          ++ (-2,0)   coordinate (s+)
(s4) -- (s2) to [short,-o]          ++ (-2,0)   coordinate (s-)
(s+) to [open, v^=60<\volt>]           (s-)
% rectifier (on secundar side of transormer)
(t3) to [short, -*]  ++ (1.5,0)                 coordinate (t5)
(t4) to [short, -*]  ++ (2.5,0)                 coordinate (t6)
(mosfet4.S -| t5)   to [Do,l=$D2$]      (t5 |- t6)
-- (t5)        to [Do,l=$D1$]      (mosfet3.D -| t5)
(mosfet4.S -| t6)   to [Do,l_=$D4$]     (t6)
-- (t6 |- t5)  to [Do,l_=$D3$]     (mosfet3.D -| t6)
% rectifier conection and output lines
(mosfet4.S -| t5)   to [short,-*]       (mosfet4.S -| t6)
to [short,-o] ++ (1,0)
(mosfet3.D -| t5)   to [short,-*]       (mosfet3.D -| t6)
to [short,-o] ++ (1,0)
;
\end{circuitikz}
\caption[Ersatzschaltbild]{Ersatzschaltbild}
\label{fig:ersatzschaltbild}
\end{figure}
\end{document}


edit: naming of of transistors (mosfet) in my previous answer as here in the first version of answer not allow to simle adjustify distance between element symbol and its name. better is add their names as labels with appropriate label distance.

for shorter code i define (in edited answer) new style lbl7 and define it as:

lbl/.style = {label={[label distance=4mm]above right:#1}}


its use is:

node (mosfet1) [nigfete,below,anchor=D,lbl=$Q_1$] {}

• Awesome, thanks a lot. One more thing, the labels of Q1...4, I know I can set label=right:label, however this will place the label pretty much on top of the bodydiode. How can I specify an offset to the right? – SF6 Oct 10 '17 at 22:10
• see edited answer – Zarko Oct 10 '17 at 22:59

First I moved 1.5cm to the right to avoid the voltage label. Since components are centered relative to the end point for to[] one should skip over the interval between the two leads. The (AA |- BB) notation locates the point where (AA) up/down intersects (BB) left/right.

I switched to standalone simply to avoid cropping the image.

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[siunitx,european,fetbodydiode,smartlabels]{circuitikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{circuitikz}
\draw
% top part of switch legs
(0,0) coordinate[label=above:s1] (s1)
to ++ (0,-0.4)
node (mosfet1) [nigfete,below,anchor=D] {$Q_1$}
(mosfet1) node (mosfet3) [nigfete,right=22mm]     {$Q_3$}
(mosfet1.S) to [short,-*] ++ (0,-0.4)           coordinate[label=above:t1] (t1)

% transformer       (t1 -| mosfet3.S) % Connect Q1 with Q3S which is electrically wrong, but easier to draw
node (T) [transformer core,below right=0mm and 11mm]{}

% bottom part of switch legs
(mosfet3.S |- T.A2)                             coordinate (t2)  % likewase counter intuitive
to ++ (0,-0.4)
node (mosfet4) [nigfete,below,anchor=D] {$Q_4$}
(t1 |- mosfet4.D)   node (mosfet2) [nigfete,below,anchor=D] {$Q_2$}

% connection lines origins at transformer
(T.A1) to                       (t1)
(T.A2) to [short,-*]            (t2)
(T.B1) to [short,-o]                ++ (0.5,0)  coordinate (t3)
(T.B2) to [short,-o]                ++ (0.5,0)  coordinate (t4)
(t3)   to[open, v^=$v_o(t)$]    (t4)

% connection lines orign at mosfet
(t1)        to      (mosfet2.D)
(mosfet2.S) to ++   (0,-0.4)                    coordinate[label=below:s2] (s2)
(mosfet3.D) to ++   (0, 0.4)                    coordinate[label=above:s3] (s3)
(mosfet3.S) to      (mosfet4.D)
(mosfet4.S) to ++   (0,-0.4)                    coordinate (s4)

% supply lines
(s3) -- (s1) to [short,*-o] ++ (-2,0)           coordinate (s+) % added *-o, * to get dot at S1
(s4) -- (s2) to [short,*-o] ++ (-2,0)           coordinate (s-) % added *-o, * to get dot at S2
(s+) to [open, v=60<\volt>, invert] (s-)

% secondary side
% secondary side
(t3) to[short,-*] ++(1.5,0) coordinate (AA)
(t4) to[short,-*] ++(2.5,0) coordinate (BB)
(AA) to [Do] ++(0,1.5) to[short,-*] ++(1,0) coordinate (CC)
(AA) -- (AA |- BB) to [Do,invert] ++(0,-1.5) to[short,-*] ++(1,0) coordinate (DD)
(BB) -- (BB |- AA) to [Do] (CC)
(BB) to [Do,invert] (DD)
;
\end{circuitikz}
\end{document}
` • Hi, thanks a lot. I actually edited my question since I've found a way to do it. Well, almost. Let me compare the code... – SF6 Oct 10 '17 at 20:48
• Why use these shorts instead of a "normal" connection line? – SF6 Oct 10 '17 at 21:01
• I only use to[short,-*] to draw the connections (dots). One can also use node[circ]{} and node[ocirc]{}. – John Kormylo Oct 10 '17 at 21:12