Circuitikz Spannungsquelle amerikanischer Bauart

Circuitikz Spannungsquelle amerikanischer Bauart

Ich habe ein Problem mit einem bestimmten Element in Circuitikz, der Spannungsquelle.

Wenn ich dieses Element horizontal auf einem Schaltkreis platziere, werden die Symbole (−) und (+) ebenfalls gedreht, aber dieses Verhalten ist nicht richtig, das Symbol (−) wird aufgrund der Drehung der Spannungsquelle zu einem furchtbaren ( | ). Dasselbe passiert, wenn man eine schräge Spannungsquelle in jedem Drehwinkel erhält, zum Beispiel sieht das Symbol (+) der Spannungsquelle bei einer Drehung um 45° eher wie ein (×) aus und so weiter.

Ich möchte wissen, ob es möglich ist, NICHT GEDREHTE Polaritätssymbole der Spannungsquelle zu erhalten, das heißt, unabhängig von der Drehung der Spannungsquelle?

Genau wie die Bücher enthalten sie eine perfekte Darstellung einer amerikanischen Spannungsquelle, die in jeden beliebigen Winkel gedreht werden kann, ohne die Position der Polaritätssymbole zu ändern. (Ich könnte den europäischen Stil verwenden, aber diese Leute sind nicht daran gewöhnt und könnten verwirrt werden.)

Vielen Dank im Voraus. ☺

Antwort1

Schaltkreis

\documentclass{article}
\usepackage{circuitikz}

%% Independent voltage source - American style

\makeatletter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourceam/height}}{vsourceAM}{\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/vsourceam/width}}{

    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

    \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
    \pgfusepath{draw}
    \pgfscope
        \pgftransformxshift{\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@left}
        \pgftext[rotate=-\pgf@circ@direction]{$-$}
        \pgfusepath{draw}
    \endpgfscope
    \pgfscope
        \pgftransformxshift{\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@right}
        \pgftext[rotate=-\pgf@circ@direction]{$+$}
        \pgfusepath{draw}
    \endpgfscope
}
\makeatother

\begin{document}

\begin{circuitikz}[american voltages]

\ctikzset{bipoles/vsourceam/margin=.5}% default too big

\draw (0,0) to[V={v1}] (3,0) to[V={v2}] (3,3) to[V={v3}] (0,3) to[V={v4}] (0,0);
\draw (4,0) to[V={v5}] (6,2);
\end{circuitikz}

\end{document}

Für eine kontrollierte Spannungsquelle könnten Sie verwenden

%% Controlled voltage source - American

\makeatletter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cvsourceam/height}}{cvsourceAM}{\ctikzvalof{bipoles/cvsourceam/height}}{\ctikzvalof{bipoles/cvsourceam/width}}{

    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

      \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
        %\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$+$}
        %\pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$-$}
        \pgfusepath{draw}
    \pgfscope
        \pgftransformxshift{\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@left}
        \pgftext[rotate=-\pgf@circ@direction]{$-$}
        \pgfusepath{draw}
    \endpgfscope
    \pgfscope
        \pgftransformxshift{\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@right}
        \pgftext[rotate=-\pgf@circ@direction]{$+$}
        \pgfusepath{draw}
    \endpgfscope
}
\makeatother

verwandte Informationen