4

This is my code:

\documentclass[]{article}
\usepackage{circuitikz}
\begin{document}
\begin{figure}
\centering
\begin{circuitikz}
\draw (0,0) 
  to[short,o-](2,0)
  to[short,*-](4,0)
  to[D](4,2)
  to[D](4,4)
  to[short,-*](2,4)
  to[short,-o](0,4);
\draw (4,0) 
  to[short,*-](8,0)
  to[D](8,2)
  to[D](8,4)
  to[short,-*](4,4);
\draw (2,0)
  to[Tnpn,n=q2](2,2)
  to[Tnpn,n=q1](2,4);
\draw (8,0)
  to[short,*-](10,0)
  to[Tnpn,n=q4,mirror](10,2)
  to[Tnpn,n=q3,mirror](10,4)
  to[short,-*](8,4);
\draw
  (q1.B) to[short,-o](1,3) node[left]{$Q_1$}
  (q2.B) to[short,-o](1,1) node[left]{$Q_2$}
  (q3.B) to[short,-o](11,3) node[right]{$Q_3$}
  (q4.B) to[short,-o](11,1) node[right]{$Q_4$};
\draw (2,2) to[short,*-*](4,2) to[Telmech=M](8,2) to[short,*-*](10,2);
\end{circuitikz}
\caption{Chopper E}
\end{figure}
\end{document}

I want to know if there is the possibility, using circuitikz, of drawing the path of current and general potential line (general in the sens that they don't have to refer to a particular bipole but to two general point).

Also, is possible for the currect path to be behind the circuit?

example

Note: I'm looking for a functionality of circuitikz package. But if not, also a solution with tikz would be ok, but preferably without loading the circuit tikz library or I have to modify a lot of figures for compatibility reasons.

4
\documentclass[]{article}
\usepackage{circuitikz}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{figure}
  \centering
  \begin{circuitikz}
    \draw (0,0) node (N5){}
    to [short,o-](2,0) 
    to[short,*-](4,0)
    to[D](4,2)
    to[D](4,4)
    to[short,-*](2,4) node (N1){}
    to[short,-o](0,4) node (O){}; 
    \draw (4,0) 
    to[short,*-](8,0) 
    to[D](8,2)
    to[D](8,4)
    to[short,-*](4,4);
    \draw (2,0)
    to[Tnpn,n=q2](2,2) node(N2){}
    to[Tnpn,n=q1](2,4);
    \draw (8,0)
    to[short,*-](10,0) node(N4){}
    to[Tnpn,n=q4,mirror](10,2)
    to[Tnpn,n=q3,mirror](10,4)
    to[short,-*](8,4);
    \draw
    (q1.B) to[short,-o](1,3) node[left]{$Q_1$}
    (q2.B) to[short,-o](1,1) node[left]{$Q_2$}
    (q3.B) to[short,-o](11,3) node[right]{$Q_3$}
    (q4.B) to[short,-o](11,1) node[right]{$Q_4$};
    \draw (2,2) to[short,*-*](4,2) to[Telmech=M](8,2) to[short,*-*](10,2) node(N3){};
    % adding current
    \begin{scope}[very thick,decoration = {
        markings,
        mark = at position 0.05 with {\arrow{>}}}
    ] 
    \draw[line width = 3pt, red, opacity = 0.4, postaction = {decorate}] (O.north) -- 
    (N1.north east) node[above, midway, opacity = 1]{$i$} -- (N2.north east)
    -- (N3.north west) -- (N4.north west) -- (N5.north) ;
    \end{scope}
    % adding voltage
    \draw[line width = 3pt, red, opacity = 0.4, ->] (N5) to[out = 150, in = 210] (O) node[left, opacity = 1]{$V$};
  \end{circuitikz}
  \caption{Chopper E}
\end{figure}
\end{document}

enter image description here

EDIT To place the current on the background layer, add \usetikzlibrary{backgrounds} in the preamble, and on background layer as an option of the scope environment. Also changed the path following @ Kpym's suggestions

\documentclass[]{article}
\usepackage{circuitikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{backgrounds}

\begin{document}
\begin{figure}
  \centering
  \begin{circuitikz}
    \draw (0,0) node (N5){}
    to [short,o-](2,0) 
    to[short,*-](4,0)
    to[D](4,2)
    to[D](4,4)
    to[short,-*](2,4) node (N1){}
    to[short,-o](0,4) node (O){}; 
    \draw (4,0) 
    to[short,*-](8,0) 
    to[D](8,2)
    to[D](8,4)
    to[short,-*](4,4);
    \draw (2,0)
    to[Tnpn,n=q2](2,2) node(N2){}
    to[Tnpn,n=q1](2,4);
    \draw (8,0)
    to[short,*-](10,0) node(N4){}
    to[Tnpn,n=q4,mirror](10,2)
    to[Tnpn,n=q3,mirror](10,4)
    to[short,-*](8,4);
    \draw
    (q1.B) to[short,-o](1,3) node[left]{$Q_1$}
    (q2.B) to[short,-o](1,1) node[left]{$Q_2$}
    (q3.B) to[short,-o](11,3) node[right]{$Q_3$}
    (q4.B) to[short,-o](11,1) node[right]{$Q_4$};
    \draw (2,2) to[short,*-*](4,2) to[Telmech=M](8,2) to[short,*-*](10,2) node(N3){};
    % adding current
    \begin{scope}[on background layer, very thick,decoration = {
        markings,
        mark = at position 0.05 with {\arrow{>}}}
    ] 
    \draw[line width = 3pt, red!40, postaction = {decorate}] (O.north)
    -- node[above, red]{$i$} (N1.north east) |- (N3.north west) |-
    (N5.north); 
    \end{scope}
    % adding voltage
    \draw[line width = 3pt, red!40, ->] (N5) to[out = 150, in = 210]
    (O) node[left, red]{$V$};
  \end{circuitikz}
  \caption{Chopper E}
\end{figure}
\end{document}

enter image description here

  • Thank, there is a way to put the decoration in the background? I mean, in order to not cover the motor. Even if using opacity is good enough. – gvgramazio May 7 '18 at 12:07
  • @giusva Yes, make the two changes I mention in the edit – caverac May 7 '18 at 12:34
  • Thanks, now it's perfect. Tha fact that the arrow color doesn't add with the line color anymore is due to the background tikz library? – gvgramazio May 7 '18 at 17:35
  • @giusva No, it is because of node[above, red]{$i$}. Drop the red or use red!40 as for the curve. – user121799 May 7 '18 at 19:22
2

Here an implementation with almost 90% of circuitikz macros, with all styles options, the current lines are part of the tikz macros and the decorations library. An observation is that the notation of the voltage is wrong in your drawing, the current moves towards the positive voltage.

OBS: I compile in the standalone class, since I export the result in pdf, and then I import it into the main document through the graphicx library that allows to insert pdf documents you can see a more tedious explanation here.

RESULT: enter image description here

MWE:

% By j.leon.v
\documentclass[border=30pt]{standalone}
\usepackage{tikz}
\usepackage{circuitikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\ctikzset{bipoles/length=.8cm}
\begin{tikzpicture}[line width =.75pt,
    current1/.style ={
        line width=2pt,
        color=red,
        opacity=.3,
        postaction={decorate,decoration={
            markings,
            mark=between positions 0.25 and 1 step 1cm with{
                \arrow[red,line width=.8mm]{latex}}
            }
        }
    },
    current2/.style ={
        line width=2pt,
        color=red,
        opacity=.3,
        postaction={decorate,decoration={
            markings,
            mark=between positions 0.03 and 1 step 1cm with{
                \arrow[red,line width=.8mm]{latex}}
            }
        }
    },
    ]%TIKZ PICTURE PREAMBLE
% Draw transistors as objets
    \draw(2,3) node[npn,
        scale=1.5,
        line width=1.5pt,
        color=red
        ](q1){};

    \draw(2,1) node[npn,
        scale=1.5,
    %   line width=1.5pt,
        color=black
        ](q2){};

    \draw(9,3) node[npn,
        scale=1.5,
    %   line width=1.5pt,
    %   color=red,
        xscale=-1
        ](q3){};

    \draw(9,1) node[npn,
        scale=1.5,
        line width=1.5pt,
        color=red,
        xscale=-1
        ](q4){};

%Draw energy lines
    \draw(-0.5,4) node[ocirc,
        scale=1.5,
        line width=1.5pt,
    %   color=red
        ](L1){};

    \draw(-0.5,0) node[ocirc,
        scale=1.5,
        line width=1.5pt,
    %   color=red,
        ](L2){};


%Draw the motor     
    \draw[color=red,line width=1.5pt](4.5,2) coordinate (M1)
        to [Telmech=M,red](6,2) coordinate (M2);


%Draw diodes:
    \draw (7,0) to[D*,*-*](7,2)to[D*,*-*](7,4);
    \draw (3.5,0) to[D*,*-*](3.5,2)to[D*,*-*](3.5,4);

% Draw pasive wire
    \draw(q1.E|- M1) to [short,*-] (M1);
    \draw(q4.C|- M2) to [short,*-] (M2);
    \draw (q2.C) -- (q1.E);
    \draw (q4.C) -- (q3.E);
    \draw (L1) -| (q3.C);
    \draw (L1) to[short,-*](L1-|q1.C) -- (q1.C);
    \draw (L2) to[short,-*](L2-|q2.E) -- (q2.E);
    \draw (L2) -| (q4.E);

% Draw the path of the electric current.
    \draw [current1] (L1) -| (q1.C);
    \draw [current2] (q1.E) |- (M1);
    \draw [current1] (M2) -| (q4.C);
    \draw [current2] (q4.E) |- (L2);

% Draw labels
    \draw
      (q1.B) to[short,-o,red](q1.B) node[left]{$Q_1$}
      (q2.B) to[short,-o](q2.B) node[left]{$Q_2$}
      (q3.B) to[short,-o](q3.B) node[right]{$Q_3$}
      (q4.B) to[short,-o](q4.B) node[right]{$Q_4$};
    \draw (L1)node[left]{$-$};
    \draw (L2)node[left]{$+$};

\draw[color=red,line width=1.5pt] (L1) to [open,v=$Vin$] (L2);

\end{tikzpicture}
\end{document}
  • I like the idea behind your answer even if I don't like too much the final result. But this is a personal taste and it is only about changing some value here and there. I like mostly the part of using coordinates, display currents directly on lines and colouring the elements involved. – gvgramazio May 8 '18 at 12:22
  • About your sentence on the direction of the voltage I think that you're wrong (but correct me again if you are sure about that, I'll go check to be more sure and send you some reference). The voltage marked by the arrow is forced by a voltage direct source (only the voltage is forced, not the current). The circuit is a chopper that pilot a c.c. motor. In the case depicted by me and supposing that we measure the voltage across the motor as V_left - V_right, then the motor is operating in the I quadrant (voltage and current both positive). – gvgramazio May 8 '18 at 12:27
  • It can, however, operate in any of the four quadrants. e.g. If we stop Q_1 and Q_2, then, in order to have a continuous currect through the motor, the south-west diode and the north-east one cunducts. This mean that we are in the IV quadrant (voltage negative and current positive), i.e. the motor behave as a generator. Obv, there are some conditions to check in order that this can happen but in general it happens. – gvgramazio May 8 '18 at 12:31
  • Yes, I was confused with the direction in which the electrons are moving, by convention the electric current notation is contrary to this, so my mistake. I will correct this. – J Leon V. May 8 '18 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.