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

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.