1

I'd like to know if it is possible to place a current source that looks like the following:

Current source

5
  • 1
    Yes. You can do it yourself elfsoft2000.com/projects/bipole.pdf or give me a couple of days. What exactly do you call this? Aug 14, 2013 at 20:24
  • Oh wow, thanks! It's just a 'Current Source'!
    – user968243
    Aug 15, 2013 at 2:41
  • I would like to add this to my collection, but I need to give it a name. I read that this symbol is more common in Europe, but Europe is big place, and we already have a European current source. I suppose I could give it an acronym (YAFCS) or something. Aug 16, 2013 at 1:30
  • Hi, well I'm from Australia where this source is sometimes used. Some datasheets also use it. I just called it 'Iring'. Curiously, how is it that you 'add it to your collection'? Is there someone where I can just save the component so Circuitikz remembers it?
    – user968243
    Aug 16, 2013 at 1:58
  • You can put the definition into a separate file and \input it in the header (sort of like \usepackage). BTW, isourcebr it is. Aug 16, 2013 at 14:34

1 Answer 1

4
\documentclass{article}
\usepackage[screen,nopanel]{pdfscreen}
\usepackage{circuitikz}

\margins{0.2cm}{0.2cm}{0.2cm}{0.2cm}
\screensize{3cm}{5cm}
\backgroundcolor{white}

% preparation to create bipoles

\makeatletter
\def\TikzBipolePath#1#2{\pgf@circ@bipole@path{#1}{#2}}

\pgf@circ@Rlen = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
\makeatother 

\newlength{\ResUp} \newlength{\ResDown}
\newlength{\ResLeft} \newlength{\ResRight}

% set default dohicky size

\ctikzset{bipoles/doohicky/height/.initial=.4}
\ctikzset{bipoles/doohicky/width/.initial=.6}

% create doohicky shape

\pgfcircdeclarebipole{}
 {\ctikzvalof{bipoles/doohicky/height}}
 {doohicky}
 {\ctikzvalof{bipoles/doohicky/height}}
 {\ctikzvalof{bipoles/doohicky/width}}
 {
    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
    \pgfextractx{\ResRight}{\northeast}
    \pgfextracty{\ResUp}{\northeast}
    \pgfextractx{\ResLeft}{\southwest}

  \pgfmoveto{\pgfpoint{\ResLeft}{0cm}}
    \pgfpathellipse{\pgfpoint{0.333\ResLeft}{0cm}}{\pgfpoint{0.667\ResRight}{0cm}}{\pgfpoint{0cm}{\ResUp}}
  \pgfmoveto{\pgfpoint{\ResRight}{0cm}}
    \pgfpathellipse{\pgfpoint{0.333\ResRight}{0cm}}{\pgfpoint{0.667\ResRight}{0cm}}{\pgfpoint{0cm}{\ResUp}}
  \pgfusepath{draw} %draw doohicky
    \pgfscope
    \pgfsetarrowsend{latex'}
    \pgfpathmoveto{\pgfpoint{0.667\ResLeft}{1.333\ResUp}}
    \pgfpathlineto{\pgfpoint{0.667\ResRight}{1.333\ResUp}}
    \pgfusepath{draw}   %draw arrow
    \endpgfscope
 }

% create doohicky to-path style

\def\doohickypath#1{\TikzBipolePath{doohicky}{#1}}
\tikzset{doohicky/.style = {\circuitikzbasekey, /tikz/to path=\doohickypath, l=#1}}

% end of setup

\begin{document}

\begin{center}
\begin{circuitikz}
 \draw (0,0) to[doohicky, l=I, o-*] (0,2);
\end{circuitikz}
\end{center}

\end{document}

Output:

enter image description here

2
  • The code doesn't compile <to be read again> \pgfk@/tikz/circuitikz/bipoles/length l.14 ...ysvalueof{/tikz/circuitikz/bipoles/length}
    – Viesturs
    Jun 5, 2023 at 15:25
  • @viesturs - Circuitikz has changed since 2013. More importantly, it now provides ioosoiurce, voosource and oosourcetrans (page 70). Jun 5, 2023 at 16:03

You must log in to answer this question.

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