3

I have put together a equivalent circuit model of a battery in Latex and circuitikz, but I can not change the position of two elements. So I would like to have the arrow and label of the voltage source on the left side instead of the right. I tried "mirror" and a >/< by the v of the label, but it did not change. Additionally I would like the arrow and label of V_bat on the right instead of the left like it is now.

How do I accomplish this?

Here is the code and a picture:

\documentclass{article}
\usepackage{tikz}
\usepackage{circuitikz}


\begin{document}

\begin{figure}[h!]
  \begin{center}
    \begin{circuitikz}
      \draw (0,0) to[american voltage source, v=$V_{OCV}$] (0,-4);
            \draw (0,0) to [short] (2,0);
            \draw (2,0) to [short] (2,1);
            \draw (2,0) to [short] (2,-1);
            \draw (2,1) to[R=$R(SoC)$] (5,1);
            \draw (2,-1) to[C=$C(SoC)$] (5,-1);
            \draw (5,-1) to [short] (5,1);
            \draw (5,0) to [short, -o] (6,0);
            \draw (0,-4) to [short, -o] (6,-4);
            \draw (6,0) to [open, v=$V_{Bat}$] (6,-4);
    \end{circuitikz}
    \caption{}
  \end{center}
\end{figure}

\end{document}

enter image description here

3
  • 1
    Welcome to TSE. Please post a Minimal Working Example, instead of a code snippet. Commented Aug 13, 2023 at 13:43
  • Please do what @JoséCarlosSantos is suggesting. Which voltage option is in force (i.e., how you call the circuitikz package) is important to answer correctly...
    – Rmano
    Commented Aug 13, 2023 at 13:51
  • Please see the updated post Commented Aug 13, 2023 at 14:11

1 Answer 1

5

The side on which the labels are shown in voltages is controlled by the modifiers _ and ^ (the ones you tried, < and >, control the direction). So change the two voltages to:

    (0,0) to[american voltage source, v_=$V_{OCV}$] 
    ...
    (6,0) to [open, v^=$V_{Bat}$] (6,-4)

enter image description here

In addition, you should really use one of the two modern voltage directions (in your case, EFvoltages, I think); the default is the old nooldvoltages, which is not completely coherent (see the manual in section 5.2 for details). Moreover, you should try to use a continuous path when possible — if you zoom in, the wires in your circuits join like this:

enter image description here

So, for example (but this can be muchly improved using relative and named coordinates):

\documentclass{article}
\usepackage[EFvoltages]{circuitikz}
\begin{document}

\begin{circuitikz}
    \draw (0,0) to[american voltage source, v_=$V_{OCV}$]
        (0,-4) to [short, -o] (6,-4);
    \draw (0,0) -- (2,0) -- (2,1)
        to[R=$R(SoC)$] (5,1) -- (5,0)
        to[short, -o] (6,0);
    \draw (2,0) -- (2,-1)
        to[C=$C(SoC)$] (5,-1) -- (5,0);
    \draw (6,0) to [open, v^=$V_{Bat}$] (6,-4);
\end{circuitikz}

\end{document}

enter image description here

(Zoom in an see the difference!)

0

You must log in to answer this question.

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