2

Task

I want to meet the following specifications with Circuitikz:

  • Technical current direction (+ to -)
  • Electric field voltage
  • European symbols but american style power sources

Problem

I already achieved most of the requirements but I have some struggle with the vsource, since its current direction points in the wrong direction in my case. I know that this is actually the correct behavior, since a producer always has anticipating voltage and current arrows, but using the invert option on the vsource only inverts its shape / polarity signs but not "the whole thing".

MWE

MWE

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[
    european,
    EFvoltages,
    siunitx]{circuitikz}

\begin{document}

\begin{circuitikz}
    \ctikzset{voltage=straight}
    
    \draw (0,0)
    to[american voltage source,  i=$I_0$, v=$U_0$, invert] (0,3)
    to[short] (1,3)
    to[R=$R_{Shunt}$, i=$I_0$, v=$U_S$] (3,3)
    to[short, -o] (4,3);
    
    \draw (0,0) to[short, -o] (4,0);
    \draw [dashed, gray] (4,3) to[R=$R_L$, i=$I_0$] (4,0);
\end{circuitikz}

\end{document}

Question

How can I achieve an american style voltage source, where + is facing upwards and the current is flowing in technical current direction?

I thought about reversing vsource's "path direction" but there has to be a better / cleaner solution, isn't it?

Reversing vsource path direction

path direction reversed

\begin{circuitikz}
    \ctikzset{voltage=straight}
    
    \draw (0,3)
    to[american voltage source,  i=$I_0$, v=$U_0$] (0,0)
    (0,3) to[short] (1,3)
    to[R=$R_{Shunt}$, i=$I_0$, v=$U_S$] (3,3)
    to[short, -o] (4,3);
    
    \draw (0,0) to[short, -o] (4,0);
    \draw [dashed, gray] (4,3) to[R=$R_L$, i=$I_0$] (4,0);
\end{circuitikz}

Hope someone has a clean solution for my question and many thanks in advance.

3
  • voltage arrow direction and shape direction are (more or less) independent. You can change the arrow using one of v<=... or v>=.... The same stands for the current.
    – Rmano
    Aug 29, 2021 at 17:08
  • @Rmano: that's a good point and definitely an legitimate answer to my question. Is it also possible to arrange to current arrow's position, i.e. whether it's put "before" or "after" the voltage source? And why is it at all, that the power source direction is reversed? I mean, I specifed "EFvoltages", so logically I assume that in "positive path direction" I get the "EFvoltages" direction, i.e. + to -. That's true for passive elements (consuming power) but for active ones (providing power) it seems reversed, since I get - facing upwards with a path in direction upwards.
    – Chilippso
    Aug 29, 2021 at 17:20
  • I added a bit on the answer. For a discussion about the (admittedly messy) voltage directions, you can see the manual here: texdoc.org/serve/circuitikz/0#subsection.5.2 and also here: github.com/circuitikz/circuitikz/issues/101
    – Rmano
    Aug 29, 2021 at 17:38

1 Answer 1

6

You can control the shape, the current position/direction, and the voltage position/direction in a quite independent way. Look at https://texdoc.org/serve/circuitikz/0#subsection.5.3 (for currents, but the same stands for voltages) or this example:

\documentclass{article}
%\usepackage[utf8]{inputenc} % this is default since 2018
\usepackage[T1]{fontenc}% this is highly recommended

\usepackage[european, EFvoltages, siunitx]{circuitikz}

\begin{document}
\begin{circuitikz}
    \ctikzset{voltage=straight} 
    \draw (0,0) to[american voltage source,  i=$I_0$, v=$U_0$, invert] ++(0,3);
    \draw (3,0) to[american voltage source,  i^<=$I_0$, v<=$U_0$, invert] ++(0,3);
    \draw (6,0) to[american voltage source,  i<^=$I_0$, v_=$U_0$, ] ++(0,3);
    \draw (9,0) to[american voltage source,  i^<=$I_0$, l=$U_0$, invert] ++(0,3);
\end{circuitikz}
\end{document}

Notice that for the current, switching <^ to ^< will move the current from one side to the other.

enter image description here

7
  • As I already mention in the comment on the question, but repeat here since I guess most people look at accepted solutions: why is it at all, that the power source direction is reversed? I mean, I specifed "EFvoltages", so logically I assume that in "positive path direction" I get the "EFvoltages" direction, i.e. + to -. That's true for passive elements (consuming power) but for active ones (providing power) it seems reversed, since I get - facing upwards with a path in upwards direction.
    – Chilippso
    Aug 29, 2021 at 17:26
  • @Chilippso voltage and current default directions are, admittedly, a mess. With the hindsight of almost three years maintaining the package, my gut feeling is to remove all the options, make the default direction of everything "follow the path" (although it does not corresponf to any standard or convention) and just letting the user use the switches provided. But that will break all the old circuits, so I can't do that.
    – Rmano
    Aug 29, 2021 at 17:32
  • Good to know! I wonder why \ctikzset{voltage=straight}} convert voltage source V using american style to European voltage style?
    – Zarko
    Aug 29, 2021 at 17:43
  • @Rmano: Well, I guess in this case it's time to increment the major version - as supposed by introducing "breaking changes" in semantic versioning :P just joking ... besides there are any volunteers for back-porting new stuff from 2.x.x to 1.x.x for legacy documents.
    – Chilippso
    Aug 29, 2021 at 17:47
  • @Zarko it changes the style, but not the default direction --- they are (barring possible bugs) independent ;-).
    – Rmano
    Aug 29, 2021 at 18:02

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.